diff options
Diffstat (limited to 'plugins/jetpack/vendor/automattic/jetpack-compat')
7 files changed, 820 insertions, 0 deletions
diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/functions.php b/plugins/jetpack/vendor/automattic/jetpack-compat/functions.php new file mode 100644 index 00000000..f326a46c --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/functions.php @@ -0,0 +1,25 @@ +<?php +/** + * Legacy global scope functions. + * + * @package automattic/jetpack-compat + */ + +if ( ! defined( 'ABSPATH' ) ) { + return; +} + +// Add here, after the condition above, any code that should only run when WordPress is running. +// Autoload will load everything even when PHPCS is running and we don't want to run these +// in such case because they will fatal, for example, due to 'add_action' being undefined. + +/** + * Load necessary functions. + */ +function jetpack_compat_require_defined_functions() { + jetpack_require_lib( 'tracks/client' ); +} + +add_action( 'plugins_loaded', 'jetpack_compat_require_defined_functions' ); + + diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-client.php b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-client.php new file mode 100644 index 00000000..1b71cdd7 --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-client.php @@ -0,0 +1,90 @@ +<?php +/** + * Jetpack Client + * + * Deprecated methods for Jetpack to act as client with wpcom, provided for back-compatibility. + * + * @category Connection + * @package automattic/jetpack-compat + */ + +use Automattic\Jetpack\Connection\Client; + +/** + * Class Jetpack_Client + * + * @deprecated Use Automattic\Jetpack\Connection\Client + */ +class Jetpack_Client { + + /** + * Jetpack API version. + * + * @deprecated use Automattic\Jetpack\Connection\Client::WPCOM_JSON_API_VERSION + */ + const WPCOM_JSON_API_VERSION = '1.1'; + + /** + * Perform remote request. + * + * @deprecated use Automattic\Jetpack\Connection\Client::remote_request + * + * @param array $args Arguments. + * @param null $body Request body. + * + * @return array|WP_Error + */ + public static function remote_request( $args, $body = null ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' ); + return Client::remote_request( $args, $body ); + } + + /** + * Request to wpcom using the blog id. + * + * @deprecated use Automattic\Jetpack\Connection\Client::wpcom_json_api_request_as_blog + * + * @param string $path Endpoint path. + * @param string $version Endpoint version. + * @param array $args Arguments. + * @param null $body Request body. + * @param string $base_api_path Endpoint base prefix. + * + * @return Array|WP_Error + */ + public static function wpcom_json_api_request_as_blog( + $path, + $version = self::WPCOM_JSON_API_VERSION, + $args = array(), + $body = null, + $base_api_path = 'rest' + ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' ); + return Client::wpcom_json_api_request_as_blog( $path, $version, $args, $body, $base_api_path ); + } + + /** + * Wrapper for wp_remote_request(). Turns off SSL verification for certain SSL errors. + * This is suboptimal, but many, many, many hosts have misconfigured SSL. + * + * @deprecated use Automattic\Jetpack\Connection\Client::_wp_remote_request + * + * When Jetpack is registered, the jetpack_fallback_no_verify_ssl_certs option is set to the current time if: + * 1. a certificate error is found AND + * 2. not verifying the certificate works around the problem. + * + * The option is checked on each request. + * + * @internal + * @see Utils::fix_url_for_bad_hosts() + * + * @param String $url the request URL. + * @param Array $args request arguments. + * @param Boolean $set_fallback whether to allow flagging this request to use a fallback certficate override. + * @return array|WP_Error WP HTTP response on success + */ + public static function _wp_remote_request( $url, $args, $set_fallback = false ) { // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Connection\Client' ); + return Client::_wp_remote_request( $url, $args, $set_fallback ); + } +} diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-actions.php b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-actions.php new file mode 100644 index 00000000..5e8c325a --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-actions.php @@ -0,0 +1,359 @@ +<?php +/** + * A compatibility shim for the sync actions class. + * + * @package automattic/jetpack-compat + */ + +use Automattic\Jetpack\Sync\Actions; + +/** + * Class Jetpack_Sync_Actions + * + * @deprecated Use Automattic\Jetpack\Sync\Actions + */ +class Jetpack_Sync_Actions extends Automattic\Jetpack\Sync\Actions { + + /** + * Initializes the class. + * + * @deprecated Automattic\Jetpack\Sync\Actions::init + */ + public static function init() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::init(); + } + + /** + * Adds a shutdown sender callback. + * + * @deprecated Automattic\Jetpack\Sync\Actions::add_sender_shutdown + */ + public static function add_sender_shutdown() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::add_sender_shutdown(); + } + + /** + * Returns false or true based on whether this class should initialize the sender + * in current circumstances. + * + * @deprecated Automattic\Jetpack\Sync\Actions::should_initialize_sender + * + * @return Boolean should the object initialize sender? + */ + public static function should_initialize_sender() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::should_initialize_sender(); + } + + /** + * Returns false or true based on whether sync is allowed. + * + * @deprecated Automattic\Jetpack\Sync\Actions::sync_allowed + * + * @return Boolean is sync allowed? + */ + public static function sync_allowed() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::sync_allowed(); + } + + /** + * Returns false or true based on whether sync via cron is allowed. + * + * @deprecated Automattic\Jetpack\Sync\Actions::sync_via_cron_allowed + * + * @return Boolean is sync via cron allowed? + */ + public static function sync_via_cron_allowed() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::sync_via_cron_allowed(); + } + + /** + * Filters a boolean value that determines whether blacklisted posts should be prevented + * from being publicized. + * + * @deprecated Automattic\Jetpack\Sync\Actions::prevent_publicize_blacklisted_posts + * + * @param Boolean $should_publicize initial setting value. + * @param WP_Post $post the post object. + * @return Boolean whether to prevent publicizing. + */ + public static function prevent_publicize_blacklisted_posts( $should_publicize, $post ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::prevent_publicize_blacklisted_posts( $should_publicize, $post ); + } + + /** + * Set the importing flag to true. + * + * @deprecated Automattic\Jetpack\Sync\Actions::set_is_importing_true + */ + public static function set_is_importing_true() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::set_is_importing_true(); + } + + /** + * Send the sync data. + * + * @deprecated Automattic\Jetpack\Sync\Actions::send_data + * + * @param Mixed $data the sync data. + * @param String $codec_name the codec slug. + * @param Integer $sent_timestamp the current server timestamp. + * @param Integer $queue_id the queue identifier. + * @param Integer $checkout_duration time spent retrieving items. + * @param Integer $preprocess_duration Time spent converting items into data. + * @return WP_Response the response object. + */ + public static function send_data( $data, $codec_name, $sent_timestamp, $queue_id, $checkout_duration, $preprocess_duration ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::send_data( $data, $codec_name, $sent_timestamp, $queue_id, $checkout_duration, $preprocess_duration ); + } + + /** + * Commence initial sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::do_initial_sync + */ + public static function do_initial_sync() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::do_initial_sync(); + } + + /** + * Commence full sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::do_full_sync + * + * @param Array $modules the modules list. + * @return Boolean whether the sync was initialized. + */ + public static function do_full_sync( $modules = null ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::do_full_sync( $modules ); + } + + /** + * Schedule cron sessions. + * + * @deprecated Automattic\Jetpack\Sync\Actions::jetpack_cron_schedule + * + * @param Array $schedules the schedules to add. + */ + public static function jetpack_cron_schedule( $schedules ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::jetpack_cron_schedule( $schedules ); + } + + /** + * Commence cron sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::do_cron_sync + */ + public static function do_cron_sync() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::do_cron_sync(); + } + + /** + * Commence cron full sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::do_cron_full_sync + */ + public static function do_cron_full_sync() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::do_cron_full_sync(); + } + + /** + * Commence cron sync of a specific type of object. + * + * @deprecated Automattic\Jetpack\Sync\Actions::do_cron_sync_by_type + * + * @param Array $type the type of object to sync. + */ + public static function do_cron_sync_by_type( $type ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::do_cron_sync_by_type(); + } + + /** + * Initalize the listener of the object. + * + * @deprecated Automattic\Jetpack\Sync\Actions::initialize_listener + */ + public static function initialize_listener() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::initialize_listener(); + } + + /** + * Initalize the sender of the object. + * + * @deprecated Automattic\Jetpack\Sync\Actions::initialize_sender + */ + public static function initialize_sender() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::initialize_sender(); + } + + /** + * Initalize the woocommerce listeners. + * + * @deprecated Automattic\Jetpack\Sync\Actions::initialize_woocommerce + */ + public static function initialize_woocommerce() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::initialize_woocommerce(); + } + + /** + * Add the woocommerce sync module. + * + * @deprecated Automattic\Jetpack\Sync\Actions::add_woocommerce_sync_module + * + * @param Array $sync_modules an array of modules. + */ + public static function add_woocommerce_sync_module( $sync_modules ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::add_woocommerce_sync_module( $sync_modules ); + } + + /** + * Initalize the WP Super Cache listener. + * + * @deprecated Automattic\Jetpack\Sync\Actions::initialize_wp_super_cache + */ + public static function initialize_wp_super_cache() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::initialize_wp_super_cache(); + } + + /** + * Add the WP Super Cache sync module. + * + * @deprecated Automattic\Jetpack\Sync\Actions::add_wp_super_cache_sync_module + * + * @param Array $sync_modules the list to be amended. + */ + public static function add_wp_super_cache_sync_module( $sync_modules ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::add_wp_super_cache_sync_module( $sync_modules ); + } + + /** + * Sanitizes the filtered sync cron schedule. + * + * @deprecated Automattic\Jetpack\Sync\Actions::sanitize_filtered_sync_cron_schedule + * + * @param String $schedule the cron schedule to sanitize. + * @return String sanitized cron schedule. + */ + public static function sanitize_filtered_sync_cron_schedule( $schedule ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::sanitize_filtered_sync_cron_schedule( $schedule ); + } + + /** + * Returns the time offset for a the start schedule. + * + * @deprecated Automattic\Jetpack\Sync\Actions::get_start_time_offset + * + * @param String $schedule the schedule string. + * @param String $hook hook slug. + * @return Integer start time offset. + */ + public static function get_start_time_offset( $schedule = '', $hook = '' ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::get_start_time_offset( $schedule, $hook ); + } + + /** + * If needed, schedule a cron sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::maybe_schedule_sync_cron + * + * @param String $schedule the schedule string. + * @param String $hook hook slug. + */ + public static function maybe_schedule_sync_cron( $schedule, $hook ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::maybe_schedule_sync_cron( $schedule, $hook ); + } + + /** + * Clears cron jobs scheduled for sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::clear_sync_cron_jobs + */ + public static function clear_sync_cron_jobs() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::clear_sync_cron_jobs(); + } + + /** + * Initialize cron jobs for sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::init_sync_cron_jobs + */ + public static function init_sync_cron_jobs() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::init_sync_cron_jobs(); + } + + /** + * Cleans up schedules on plugin upgrade. + * + * @deprecated Automattic\Jetpack\Sync\Actions::cleanup_on_upgrade + * + * @param String $new_version the new version. + * @param String $old_version the old version. + */ + public static function cleanup_on_upgrade( $new_version = null, $old_version = null ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::cleanup_on_upgrade( $new_version, $old_version ); + } + + /** + * Clears cron jobs scheduled for sync. + * + * @deprecated Automattic\Jetpack\Sync\Actions::get_sync_status + * + * @param Array $fields sync fields to get status of. + */ + public static function get_sync_status( $fields = null ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Actions' ); + + return Actions::get_sync_status( $fields ); + } +} diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-modules.php b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-modules.php new file mode 100644 index 00000000..69bc8af5 --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-modules.php @@ -0,0 +1,28 @@ +<?php +/** + * A compatibility shim for the sync modules class. + * + * @package automattic/jetpack-compat + */ + +use Automattic\Jetpack\Sync\Modules; + +/** + * Class Jetpack_Sync_Modules + * + * @deprecated Use Automattic\Jetpack\Sync\Modules + */ +class Jetpack_Sync_Modules { + + /** + * Returns the sync module object. + * + * @param String $module_name the module name. + * @return Automattic\Jetpack\Sync\Modules\Module the module object. + */ + public static function get_module( $module_name ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Modules' ); + + return Modules::get_module( $module_name ); + } +} diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-settings.php b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-settings.php new file mode 100644 index 00000000..f365257d --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpack-sync-settings.php @@ -0,0 +1,230 @@ +<?php +/** + * Legacy/deprecated Sync Setting getter and setter. + * + * @package automattic/jetpack-sync + */ + +use Automattic\Jetpack\Sync\Settings; + +/** + * Class Jetpack_Sync_Settings + * + * @deprecated Use Automattic\Jetpack\Sync\Settings + */ +class Jetpack_Sync_Settings { + + /** + * Return all settings + * + * @deprecated See Automattic/Jetpack/Sync/Settings + * + * @return array All Sync Settings. + */ + public static function get_settings() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_settings(); + } + + /** + * Return a single setting. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param string $setting Setting to return. + * + * @return mixed Value of setting. + */ + public static function get_setting( $setting ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_setting( $setting ); + } + + /** + * Update a sync setting + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param mixed $new_settings New setting to set. + */ + public static function update_settings( $new_settings ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::update_settings( $new_settings ); + } + + /** + * Return is_network_setting result. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param string $setting Setting to check. + * + * @return bool + */ + public static function is_network_setting( $setting ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_network_setting( $setting ); + } + + + /** + * Return blacklisted post types SQL. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + */ + public static function get_blacklisted_post_types_sql() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_blacklisted_post_types_sql(); + } + + /** + * Return whitelisted post meta SQL. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return string + */ + public static function get_whitelisted_post_meta_sql() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_whitelisted_post_meta_sql(); + } + + /** + * Return whitelsited comment meta SQL + * + * @deprecated See Automattic\Jetpack\Sync\Settings + */ + public static function get_whitelisted_comment_meta_sql() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_whitelisted_comment_meta_sql(); + } + + /** + * Return get_comments_filter_sql + * + * @deprecated See Automattic\Jetpack\Sync\Settings + */ + public static function get_comments_filter_sql() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::get_comments_filter_sql(); + } + + /** + * Result data. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + */ + public static function reset_data() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::reset_data(); + } + + /** + * Set importing status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param mixed $is_importing Value to set. + */ + public static function set_importing( $is_importing ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::set_importing( $is_importing ); + } + + /** + * Return is_importing status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return bool + */ + public static function is_importing() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_importing(); + } + + /** + * Return is_sync_enabled status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return bool + */ + public static function is_sync_enabled() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_sync_enabled(); + } + + /** + * Set cron status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param mixed $is_doing_cron Value to set. + */ + public static function set_doing_cron( $is_doing_cron ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::set_doing_cron( $is_doing_cron ); + } + + /** + * Return is_doing_cron status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return bool + */ + public static function is_doing_cron() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_doing_cron(); + } + + /** + * Return is_syncing status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return bool + */ + public static function is_syncing() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_syncing(); + } + + /** + * Set "is syncing" status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param mixed $is_syncing Is syncing value. + */ + public static function set_is_syncing( $is_syncing ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::set_is_syncing( $is_syncing ); + } + + /** + * Return is_sending status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @return bool + */ + public static function is_sending() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + return Settings::is_sending(); + } + + /** + * Set "is sending" status. + * + * @deprecated See Automattic\Jetpack\Sync\Settings + * + * @param mixed $is_sending Is sending value. + */ + public static function set_is_sending( $is_sending ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Sync\Settings' ); + Settings::set_is_sending( $is_sending ); + } + +} diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpacktracking.php b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpacktracking.php new file mode 100644 index 00000000..abfe4f62 --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/legacy/class-jetpacktracking.php @@ -0,0 +1,47 @@ +<?php +/** + * Legacy and deprecated Jetpack Tracking class. + * + * @package automattic/jetpack-compat + */ + +use Automattic\Jetpack\Tracking; + +/** + * Legacy class JetpackTracking + * + * @deprecated See Automattic\Jetpack\Tracking + */ +class JetpackTracking { + + /** + * Enqueue tracks scripts. + * + * @deprecated See Automattic\Jetpack\Tracking + */ + public static function enqueue_tracks_scripts() { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Tracking' ); + + $tracking = new Tracking(); + return $tracking->enqueue_tracks_scripts(); + } + + /** + * Record user event. + * + * @deprecated See Automattic\Jetpack\Tracking + * + * @param mixed $event_type Event type. + * @param array $data Event data. + * @param mixed $user User who did the event. + * + * @return bool + */ + public static function record_user_event( $event_type, $data = array(), $user = null ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Tracking' ); + + $tracking = new Tracking(); + return $tracking->record_user_event( $event_type, $data, $user ); + } + +} diff --git a/plugins/jetpack/vendor/automattic/jetpack-compat/lib/tracks/client.php b/plugins/jetpack/vendor/automattic/jetpack-compat/lib/tracks/client.php new file mode 100644 index 00000000..41056897 --- /dev/null +++ b/plugins/jetpack/vendor/automattic/jetpack-compat/lib/tracks/client.php @@ -0,0 +1,41 @@ +<?php +/** + * Deprecated Tracks client. + * + * @package automattic/jetpack-compat + */ + +/** + * Get tracks identity for an user. + * + * @deprecated 7.5.0 use Automattic\Jetpack\Tracking->tracks_get_identity instead + * + * @param int $user_id User id. + * + * @return mixed tracks identity. + */ +function jetpack_tracks_get_identity( $user_id ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Tracking->tracks_get_identity' ); + + $tracking = new Automattic\Jetpack\Tracking( 'jetpack', Jetpack::connection() ); + return $tracking->tracks_get_identity( $user_id ); +} + +/** + * Record Jetpack Tracks Event + * + * @deprecated 7.5.0 use Automattic\Jetpack\Tracking->tracks_record_event instead + * + * @param object $user User acting. + * @param string $event_name Event name. + * @param array $properties Properties. + * @param string|bool $event_timestamp_millis Timestamp. + * + * @return bool + */ +function jetpack_tracks_record_event( $user, $event_name, $properties = array(), $event_timestamp_millis = false ) { + _deprecated_function( __METHOD__, 'jetpack-7.5', 'Automattic\Jetpack\Tracking->tracks_record_event' ); + + $tracking = new Automattic\Jetpack\Tracking( 'jetpack', Jetpack::connection() ); + return $tracking->tracks_record_event( $user, $event_name, $properties, $event_timestamp_millis ); +} |