| @@ -4,8 +4,11 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package WPSEO\Admin\Tracking |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +use Yoast\WP\SEO\Analytics\Application\Missing_Indexables_Collector; | |
| 9 | +use Yoast\WP\SEO\Analytics\Application\To_Be_Cleaned_Indexables_Collector; | |
| 10 | + | |
| 8 | 11 | /** |
| 9 | 12 | * This class handles the tracking routine. |
| 10 | 13 | */ |
| 11 | 14 | class WPSEO_Tracking implements WPSEO_WordPress_Integration { |
| @@ -55,8 +58,10 @@ | ||
| 55 | 58 | } |
| 56 | 59 | |
| 57 | 60 | /** |
| 58 | 61 | * Registers all hooks to WordPress. |
| 62 | + * | |
| 63 | + * @return void | |
| 59 | 64 | */ |
| 60 | 65 | public function register_hooks() { |
| 61 | 66 | if ( ! $this->tracking_enabled() ) { |
| 62 | 67 | return; |
| @@ -92,14 +97,14 @@ | ||
| 92 | 97 | * To uniquely identify the scheduled cron event, `wp_next_scheduled()` |
| 93 | 98 | * needs to receive the same arguments as those used when originally |
| 94 | 99 | * scheduling the event otherwise it will always return false. |
| 95 | 100 | */ |
| 96 | - if ( ! wp_next_scheduled( 'wpseo_send_tracking_data_after_core_update', true ) ) { | |
| 101 | + if ( ! wp_next_scheduled( 'wpseo_send_tracking_data_after_core_update', [ true ] ) ) { | |
| 97 | 102 | /* |
| 98 | 103 | * Schedule sending of data tracking 6 hours after a WordPress core |
| 99 | 104 | * update. Pass a `true` parameter for the callback `$force` argument. |
| 100 | 105 | */ |
| 101 | - wp_schedule_single_event( ( time() + ( HOUR_IN_SECONDS * 6 ) ), 'wpseo_send_tracking_data_after_core_update', true ); | |
| 106 | + wp_schedule_single_event( ( time() + ( HOUR_IN_SECONDS * 6 ) ), 'wpseo_send_tracking_data_after_core_update', [ true ] ); | |
| 102 | 107 | } |
| 103 | 108 | } |
| 104 | 109 | |
| 105 | 110 | /** |
| @@ -105,9 +110,11 @@ | ||
| 105 | 110 | /** |
| 106 | 111 | * Sends the tracking data. |
| 107 | 112 | * |
| 108 | 113 | * @param bool $force Whether to send the tracking data ignoring the two |
| 109 | - * weeks time treshhold. Default false. | |
| 114 | + * weeks time threshold. Default false. | |
| 115 | + * | |
| 116 | + * @return void | |
| 110 | 117 | */ |
| 111 | 118 | public function send( $force = false ) { |
| 112 | 119 | if ( ! $this->should_send_tracking( $force ) ) { |
| 113 | 120 | return; |
| @@ -187,8 +194,11 @@ | ||
| 187 | 194 | $collector->add_collection( new WPSEO_Tracking_Server_Data() ); |
| 188 | 195 | $collector->add_collection( new WPSEO_Tracking_Theme_Data() ); |
| 189 | 196 | $collector->add_collection( new WPSEO_Tracking_Plugin_Data() ); |
| 190 | 197 | $collector->add_collection( new WPSEO_Tracking_Settings_Data() ); |
| 198 | + $collector->add_collection( new WPSEO_Tracking_Addon_Data() ); | |
| 199 | + $collector->add_collection( YoastSEO()->classes->get( Missing_Indexables_Collector::class ) ); | |
| 200 | + $collector->add_collection( YoastSEO()->classes->get( To_Be_Cleaned_Indexables_Collector::class ) ); | |
| 191 | 201 | |
| 192 | 202 | return $collector; |
| 193 | 203 | } |
| 194 | 204 | |
| @@ -209,9 +219,9 @@ | ||
| 209 | 219 | if ( $tracking === null ) { |
| 210 | 220 | /** |
| 211 | 221 | * Filter: 'wpseo_enable_tracking' - Enables the data tracking of Yoast SEO Premium and add-ons. |
| 212 | 222 | * |
| 213 | - * @api string $is_enabled The enabled state. Default is false. | |
| 223 | + * @param string|false $is_enabled The enabled state. Default is false. | |
| 214 | 224 | */ |
| 215 | 225 | $tracking = apply_filters( 'wpseo_enable_tracking', false ); |
| 216 | 226 | |
| 217 | 227 | WPSEO_Options::set( 'tracking', $tracking ); |
| @@ -220,9 +230,9 @@ | ||
| 220 | 230 | if ( $tracking === false ) { |
| 221 | 231 | return false; |
| 222 | 232 | } |
| 223 | 233 | |
| 224 | - if ( wp_get_environment_type() !== 'production' ) { | |
| 234 | + if ( ! YoastSEO()->helpers->environment->is_production_mode() ) { | |
| 225 | 235 | return false; |
| 226 | 236 | } |
| 227 | 237 | |
| 228 | 238 | return true; |