Submit
Path:
~
/
home
/
bfxleof
/
www
/
wp-content
/
plugins
/
wordpress-seo
/
admin
/
tracking
/
File Content:
class-tracking-20260622063559.php
<?php /** * WPSEO plugin file. * * @package WPSEO\Admin\Tracking */ /** * This class handles the tracking routine. */ class WPSEO_Tracking implements WPSEO_WordPress_Integration { /** * The tracking option name. * * @var string */ protected $option_name = 'wpseo_tracking_last_request'; /** * The limit for the option. * * @var int */ protected $threshold = 0; /** * The endpoint to send the data to. * * @var string */ protected $endpoint = ''; /** * The current time. * * @var int */ private $current_time; /** * WPSEO_Tracking constructor. * * @param string $endpoint The endpoint to send the data to. * @param int $threshold The limit for the option. */ public function __construct( $endpoint, $threshold ) { if ( ! $this->tracking_enabled() ) { return; } $this->endpoint = $endpoint; $this->threshold = $threshold; $this->current_time = time(); } /** * Registers all hooks to WordPress. */ public function register_hooks() { if ( ! $this->tracking_enabled() ) { return; } // Send tracking data on `admin_init`. add_action( 'admin_init', [ $this, 'send' ], 1 ); // Add an action hook that will be triggered at the specified time by `wp_schedule_single_event()`. add_action( 'wpseo_send_tracking_data_after_core_update', [ $this, 'send' ] ); // Call `wp_schedule_single_event()` after a WordPress core update. add_action( 'upgrader_process_complete', [ $this, 'schedule_tracking_data_sending' ], 10, 2 ); } /** * Schedules a new sending of the tracking data after a WordPress core update. * * @param bool|WP_Upgrader $upgrader Optional. WP_Upgrader instance or false. * Depending on context, it might be a Theme_Upgrader, * Plugin_Upgrader, Core_Upgrade, or Language_Pack_Upgrader. * instance. Default false. * @param array $data Array of update data. * * @return void */ public function schedule_tracking_data_sending( $upgrader = false, $data = [] ) { // Return if it's not a WordPress core update. if ( ! $upgrader || ! isset( $data['type'] ) || $data['type'] !== 'core' ) { return; } /* * To uniquely identify the scheduled cron event, `wp_next_scheduled()` * needs to receive the same arguments as those used when originally * scheduling the event otherwise it will always return false. */ if ( ! wp_next_scheduled( 'wpseo_send_tracking_data_after_core_update', true ) ) { /* * Schedule sending of data tracking 6 hours after a WordPress core * update. Pass a `true` parameter for the callback `$force` argument. */ wp_schedule_single_event( ( time() + ( HOUR_IN_SECONDS * 6 ) ), 'wpseo_send_tracking_data_after_core_update', true ); } } /** * Sends the tracking data. * * @param bool $force Whether to send the tracking data ignoring the two * weeks time treshhold. Default false. */ public function send( $force = false ) { if ( ! $this->should_send_tracking( $force ) ) { return; } // Set a 'content-type' header of 'application/json'. $tracking_request_args = [ 'headers' => [ 'content-type:' => 'application/json', ], ]; $collector = $this->get_collector(); $request = new WPSEO_Remote_Request( $this->endpoint, $tracking_request_args ); $request->set_body( $collector->get_as_json() ); $request->send(); update_option( $this->option_name, $this->current_time, 'yes' ); } /** * Determines whether to send the tracking data. * * Returns false if tracking is disabled or the current page is one of the * admin plugins pages. Returns true when there's no tracking data stored or * the data was sent more than two weeks ago. The two weeks interval is set * when instantiating the class. * * @param bool $ignore_time_treshhold Whether to send the tracking data ignoring * the two weeks time treshhold. Default false. * * @return bool True when tracking data should be sent. */ protected function should_send_tracking( $ignore_time_treshhold = false ) { global $pagenow; // Only send tracking on the main site of a multi-site instance. This returns true on non-multisite installs. if ( is_network_admin() || ! is_main_site() ) { return false; } // Because we don't want to possibly block plugin actions with our routines. if ( in_array( $pagenow, [ 'plugins.php', 'plugin-install.php', 'plugin-editor.php' ], true ) ) { return false; } $last_time = get_option( $this->option_name ); // When tracking data haven't been sent yet or when sending data is forced. if ( ! $last_time || $ignore_time_treshhold ) { return true; } return $this->exceeds_treshhold( $this->current_time - $last_time ); } /** * Checks if the given amount of seconds exceeds the set threshold. * * @param int $seconds The amount of seconds to check. * * @return bool True when seconds is bigger than threshold. */ protected function exceeds_treshhold( $seconds ) { return ( $seconds > $this->threshold ); } /** * Returns the collector for collecting the data. * * @return WPSEO_Collector The instance of the collector. */ public function get_collector() { $collector = new WPSEO_Collector(); $collector->add_collection( new WPSEO_Tracking_Default_Data() ); $collector->add_collection( new WPSEO_Tracking_Server_Data() ); $collector->add_collection( new WPSEO_Tracking_Theme_Data() ); $collector->add_collection( new WPSEO_Tracking_Plugin_Data() ); $collector->add_collection( new WPSEO_Tracking_Settings_Data() ); return $collector; } /** * See if we should run tracking at all. * * @return bool True when we can track, false when we can't. */ private function tracking_enabled() { // Check if we're allowing tracking. $tracking = WPSEO_Options::get( 'tracking' ); if ( $tracking === false ) { return false; } // Save this state. if ( $tracking === null ) { /** * Filter: 'wpseo_enable_tracking' - Enables the data tracking of Yoast SEO Premium and add-ons. * * @api string $is_enabled The enabled state. Default is false. */ $tracking = apply_filters( 'wpseo_enable_tracking', false ); WPSEO_Options::set( 'tracking', $tracking ); } if ( $tracking === false ) { return false; } if ( wp_get_environment_type() !== 'production' ) { return false; } return true; } }
Submit
FILE
FOLDER
Name
Size
Permission
Action
-20260707073801.DS_Store
10234 bytes
0644
.DS_Store
10234 bytes
0644
20200616130143_ReplacePermalinkHashIndex.php
2293 bytes
0644
AjaxController.php
2162 bytes
0644
DownloadConfController.php
945 bytes
0644
JsonSerializable.php
577 bytes
0644
LimitStream.php
4209 bytes
0644
admin-network-it_IT.l10n.php
42133 bytes
0644
article-modified-time-presenter.php
609 bytes
0644
base.php
2793 bytes
0644
bing-presenter.php
638 bytes
0644
class-abstract-plugin-importer.php
8466 bytes
0644
class-endpoint-statistics.php
1613 bytes
0644
class-field.php
2563 bytes
0644
class-gutenberg-compatibility.php
2510 bytes
0644
class-helpscout.php
6972 bytes
0644
class-metabox-formatter.php
12602 bytes
0644
class-metabox-null-tab.php
425 bytes
0644
class-option-tabs-formatter-20260705055921.php
2321 bytes
0644
class-option-tabs-formatter.php
2321 bytes
0644
class-plugin-conflict-20260622015355.php
8640 bytes
0644
class-sitemaps-admin-20260703023908.php
3665 bytes
0644
class-sitemaps-admin-20260707090801.php
3665 bytes
0644
class-sitemaps-admin.php
3665 bytes
0644
class-tracking-20260622063559.php
6539 bytes
0644
class-tracking-server-data-20260622150453.php
1989 bytes
0644
class-tracking-server-data.php
1989 bytes
0644
class-tracking-settings-data-20260622151145.php
5203 bytes
0644
class-wpseo-statistics.php
1443 bytes
0644
class-yoast-notification-center-20260707074829.php
23601 bytes
0644
class-yoast-notification-center.php
23601 bytes
0644
class-yoast-notification.php
9611 bytes
0644
class-yoast-plugin-conflict.php
10390 bytes
0644
class.pack.database.php
30838 bytes
0644
dashboard-1650-rtl.css
1634 bytes
0644
deactivation.php
21118 bytes
0644
debug-20260707193019.php
276 bytes
0644
debug.php
276 bytes
0644
duplicator-en_US.mo
582 bytes
0644
duplicator.php
1781 bytes
0644
elFinderPlugin.php
3331 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500-20260705194237.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class-20260623050500.php
48544 bytes
0644
elFinderVolumeLocalFileSystem.class.php
48544 bytes
0644
estimated-reading-time.php
1111 bytes
0644
exceptions.php
708 bytes
0644
flexible-widget.php
11167 bytes
0644
inc.data.php
5121 bytes
0644
inc.validator-20260705185423.php
5401 bytes
0644
inc.validator.php
5401 bytes
0644
index.php
157663 bytes
0644
interface-sitemap-cache-data.php
1208 bytes
0644
loco-20260705153209.php
5626 bytes
0644
loco.php
5626 bytes
0644
loco.xml
657 bytes
0644
manager-20260707040851.php
14659 bytes
0644
manager.php
14659 bytes
0644
meta-fields-presenter.php
1600 bytes
0644
module.php
1297 bytes
0644
quick-edit-handler-1650.js
1848 bytes
0644
recovery.php
1146 bytes
0644
root.php
1951 bytes
0644
wordpress-seojs-ar.json
25925 bytes
0644
wordpress-seojs-bs_BA.json
13790 bytes
0644
wordpress-seojs-ja.json
21424 bytes
0644
wordpress-seojs-uk-20260705091620.json
26506 bytes
0644
wordpress-seojs-uk.json
26506 bytes
0644
wp-seo-main.php
17504 bytes
0644
N4ST4R_ID | Naxtarrr