google / site-kit-wp

Site Kit is a one-stop solution for WordPress users to use everything Google has to offer to make them successful on the web.
https://sitekit.withgoogle.com
Apache License 2.0
1.25k stars 291 forks source link

Remove unnecessary actions and filters #199

Closed bjackson27 closed 1 year ago

bjackson27 commented 5 years ago

To make sure the plugin is only extensible where we want it to be, all action and filter hooks the plugin uses should be reviewed. Unless there is clear value in opening the respective area up to other plugins, they should be removed.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Changelog entry

felixarntz commented 3 years ago

This is an issue worth looking into once the refactoring has been entirely completed (i.e. rollout to 100%) and all old parts of the codebase have been removed.

aaemnnosttv commented 2 years ago

This is worth revisiting again, although I think most of the legacy stuff has been removed already.

Here's a current inventory

./google-site-kit.php:  do_action( 'googlesitekit_activation', $network_wide );
./google-site-kit.php:  do_action( 'googlesitekit_deactivation', $network_wide );
./includes/Context.php:     $reference_site_url = apply_filters( 'googlesitekit_site_url', $site_url );
./includes/Context.php:     return apply_filters( 'googlesitekit_canonical_home_url', home_url() );
./includes/Core/Admin_Bar/Admin_Bar.php:                do_action( 'googlesitekit_adminbar_modules_after' );
./includes/Core/Admin_Bar/Admin_Bar.php:                do_action( 'googlesitekit_adminbar_modules_before' );
./includes/Core/Admin_Bar/Admin_Bar.php:        return apply_filters( 'googlesitekit_show_admin_bar_menu', true, $current_url );
./includes/Core/Admin/Notices.php:      $notices = apply_filters( 'googlesitekit_admin_notices', array() );
./includes/Core/Assets/Assets.php:                      $preload_paths = apply_filters( 'googlesitekit_apifetch_preload_paths', array() );
./includes/Core/Assets/Assets.php:          'admin'  => apply_filters( 'googlesitekit_admin_data', $admin_data ),
./includes/Core/Assets/Assets.php:          'setup'  => apply_filters( 'googlesitekit_setup_data', array() ),
./includes/Core/Assets/Assets.php:      $assets = apply_filters( 'googlesitekit_assets', $assets );
./includes/Core/Assets/Assets.php:      $filtered_font_families = apply_filters( 'googlesitekit_font_families', $font_families );
./includes/Core/Assets/Assets.php:      return apply_filters( 'googlesitekit_dashboard_sharing_data', $inline_data );
./includes/Core/Assets/Assets.php:      return apply_filters( 'googlesitekit_inline_base_data', $inline_data );
./includes/Core/Assets/Assets.php:      return apply_filters( 'googlesitekit_inline_tracking_data', $inline_data );
./includes/Core/Assets/Assets.php:      return apply_filters( 'googlesitekit_user_data', $inline_data );
./includes/Core/Authentication/Authentication.php:      return (bool) apply_filters( 'googlesitekit_setup_complete', true );
./includes/Core/Authentication/Clients/Client_Factory.php:      $ssl_verify = apply_filters( 'https_ssl_verify', true, null );
./includes/Core/Authentication/Clients/Google_Site_Kit_Client.php:          do_action( 'googlesitekit_reauthorize_user', $token_response );
./includes/Core/Authentication/Clients/OAuth_Client_Base.php:       $scopes = (array) apply_filters( 'googlesitekit_auth_scopes', array() );
./includes/Core/Authentication/Clients/OAuth_Client.php:        do_action( 'googlesitekit_authorize_user', $token_response, $scopes, $previous_scopes );
./includes/Core/Authentication/Credentials.php:     $credentials = apply_filters( 'googlesitekit_oauth_secret', '' );
./includes/Core/Authentication/Google_Proxy.php:        $body = apply_filters( 'googlesitekit_features_request_data', $body );
./includes/Core/Authentication/Google_Proxy.php:        $metadata['mode'] = apply_filters( 'googlesitekit_proxy_setup_mode', $metadata['mode'] );
./includes/Core/Authentication/Setup.php:       do_action( 'googlesitekit_verify_site_ownership', $token, $method );
./includes/Core/Modules/Module.php:     do_action( $hook );
./includes/Core/Modules/Module.php:     return (bool) apply_filters( 'googlesitekit_is_module_recoverable', false, $this->slug );
./includes/Core/Modules/Modules.php:        $available_modules = (array) apply_filters( 'googlesitekit_available_modules', array_keys( $this->core_modules ) );
./includes/Core/Modules/Tags/Module_AMP_Tag.php:        $block_on_consent = apply_filters( "googlesitekit_{$this->module_slug}_tag_amp_block_on_consent", false );
./includes/Core/Modules/Tags/Module_AMP_Tag.php:        do_action( "googlesitekit_{$this->module_slug}_init_tag_amp", $this->tag_id );
./includes/Core/Modules/Tags/Module_AMP_Tag.php:        return (bool) apply_filters( "googlesitekit_{$this->module_slug}_tag_amp_blocked", false );
./includes/Core/Modules/Tags/Module_Web_Tag.php:        do_action( "googlesitekit_{$this->module_slug}_init_tag", $this->tag_id );
./includes/Core/Modules/Tags/Module_Web_Tag.php:        if ( apply_filters( "googlesitekit_{$this->module_slug}_tag_block_on_consent", false ) ) {
./includes/Core/Modules/Tags/Module_Web_Tag.php:        if ( apply_filters( "googlesitekit_{$this->module_slug}_tag_block_on_consent", false ) ) {
./includes/Core/Modules/Tags/Module_Web_Tag.php:        return (bool) apply_filters( "googlesitekit_{$this->module_slug}_tag_blocked", false );
./includes/Core/REST_API/REST_Routes.php:       return apply_filters( 'googlesitekit_rest_routes', $routes );
./includes/Core/Tags/Guards/Tag_Environment_Type_Guard.php:     $allowed_environments = apply_filters(
./includes/Core/Util/Build_Mode.php:        return (string) apply_filters( 'googlesitekit_build_mode', static::$mode ) ?: self::MODE_PRODUCTION;
./includes/Core/Util/Exit_Handler.php:          $callback = apply_filters( 'googlesitekit_exit_handler', $callback );
./includes/Core/Util/Feature_Flags.php:     return apply_filters( 'googlesitekit_is_feature_enabled', false, $feature );
./includes/Core/Util/Reset.php:     $hard_reset_enabled = apply_filters( 'googlesitekit_hard_reset_enabled', false );
./includes/Core/Util/WP_Query_Factory.php:          $public_query_vars = apply_filters( 'query_vars', $wp->public_query_vars );
./includes/Core/Util/WP_Query_Factory.php:      $query_args = apply_filters( 'request', $query_args );
./includes/Modules/AdSense/AMP_Tag.php:         : apply_filters( 'googlesitekit_amp_auto_ads_attributes', $options, $this->tag_id, $this->story_ad_slot_id );
./includes/Modules/AdSense/AMP_Tag.php:         ? apply_filters( 'googlesitekit_amp_story_auto_ads_attributes', $options, $this->tag_id, $this->story_ad_slot_id )
./includes/Modules/AdSense/Settings.php:                $account_id = apply_filters( 'googlesitekit_adsense_account_id', '' );
./includes/Modules/AdSense/Web_Tag.php:     $auto_ads_opt_filtered = apply_filters( 'googlesitekit_auto_ads_opt', $auto_ads_opt, $this->tag_id );
./includes/Modules/Analytics.php:           <?php do_action( 'googlesitekit_analytics_tracking_opt_out', $property_id, $account_id ); ?>
./includes/Modules/Analytics.php:       do_action(
./includes/Modules/Analytics.php:       if ( ! apply_filters( 'googlesitekit_allow_tracking_disabled', $settings['useSnippet'] ) ) {
./includes/Modules/Analytics.php:       return (bool) apply_filters( 'googlesitekit_analytics_tracking_disabled', $disabled );
./includes/Modules/Analytics/Advanced_Tracking.php:     do_action( 'googlesitekit_analytics_register_event_lists', $this->event_list_registry );
./includes/Modules/Analytics/AMP_Tag.php:       $gtag_amp_opt_filtered = apply_filters( 'googlesitekit_amp_gtag_opt', $gtag_amp_opt );
./includes/Modules/Analytics/Settings.php:              $account_id = apply_filters( 'googlesitekit_analytics_account_id', '' );
./includes/Modules/Analytics/Settings.php:              $adsense_linked = apply_filters( 'googlesitekit_analytics_adsense_linked', null );
./includes/Modules/Analytics/Settings.php:              $can_use_snippet = apply_filters( 'googlesitekit_analytics_can_use_snippet', true, '' );
./includes/Modules/Analytics/Settings.php:              $can_use_snippet = apply_filters( 'googlesitekit_analytics_can_use_snippet', true, $property_id );
./includes/Modules/Analytics/Settings.php:              $internal_web_property_id = apply_filters( 'googlesitekit_analytics_internal_web_property_id', '' );
./includes/Modules/Analytics/Settings.php:              $profile_id = apply_filters( 'googlesitekit_analytics_view_id', '' );
./includes/Modules/Analytics/Settings.php:              $property_id = apply_filters( 'googlesitekit_analytics_property_id', '' );
./includes/Modules/Analytics/Settings.php:              if ( is_null( apply_filters( 'googlesitekit_analytics_adsense_linked', null ) ) ) {
./includes/Modules/Analytics/Web_Tag.php:       $gtag_opt = apply_filters( 'googlesitekit_gtag_opt', $gtag_opt );
./includes/Plugin.php:              do_action( 'googlesitekit_init' );
./includes/Plugin.php:          echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
./uninstall.php:do_action( 'googlesitekit_uninstallation' );
aaemnnosttv commented 1 year ago

After reviewing again, this issue is no longer necessary.