Complex classes like Jetpack_Sync_Actions often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Jetpack_Sync_Actions, and based on these observations, apply Extract Interface, too.
| 1 | <?php  | 
            ||
| 9 | class Jetpack_Sync_Actions { | 
            ||
| 10 | static $sender = null;  | 
            ||
| 
                                                                                                    
                        
                         | 
                |||
| 11 | static $listener = null;  | 
            ||
| 12 | const DEFAULT_SYNC_CRON_INTERVAL_NAME = 'jetpack_sync_interval';  | 
            ||
| 13 | const DEFAULT_SYNC_CRON_INTERVAL_VALUE = 300; // 5 * MINUTE_IN_SECONDS;  | 
            ||
| 14 | |||
| 15 | 	static function init() { | 
            ||
| 16 | |||
| 17 | // everything below this point should only happen if we're a valid sync site  | 
            ||
| 18 | 		if ( ! self::sync_allowed() ) { | 
            ||
| 19 | return;  | 
            ||
| 20 | }  | 
            ||
| 21 | |||
| 22 | 		if ( self::sync_via_cron_allowed() ) { | 
            ||
| 23 | self::init_sync_cron_jobs();  | 
            ||
| 24 | 		} else if ( wp_next_scheduled( 'jetpack_sync_cron' ) ) { | 
            ||
| 25 | self::clear_sync_cron_jobs();  | 
            ||
| 26 | }  | 
            ||
| 27 | |||
| 28 | // On jetpack authorization, schedule a full sync  | 
            ||
| 29 | add_action( 'jetpack_client_authorized', array( __CLASS__, 'do_full_sync' ), 10, 0 );  | 
            ||
| 30 | |||
| 31 | // When importing via cron, do not sync  | 
            ||
| 32 | add_action( 'wp_cron_importer_hook', array( __CLASS__, 'set_is_importing_true' ), 1 );  | 
            ||
| 33 | |||
| 34 | // Sync connected user role changes to .com  | 
            ||
| 35 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-users.php';  | 
            ||
| 36 | |||
| 37 | // publicize filter to prevent publicizing blacklisted post types  | 
            ||
| 38 | add_filter( 'publicize_should_publicize_published_post', array( __CLASS__, 'prevent_publicize_blacklisted_posts' ), 10, 2 );  | 
            ||
| 39 | |||
| 40 | /**  | 
            ||
| 41 | * Fires on every request before default loading sync listener code.  | 
            ||
| 42 | * Return false to not load sync listener code that monitors common  | 
            ||
| 43 | * WP actions to be serialized.  | 
            ||
| 44 | *  | 
            ||
| 45 | * By default this returns true for cron jobs, non-GET-requests, or requests where the  | 
            ||
| 46 | * user is logged-in.  | 
            ||
| 47 | *  | 
            ||
| 48 | * @since 4.2.0  | 
            ||
| 49 | *  | 
            ||
| 50 | * @param bool should we load sync listener code for this request  | 
            ||
| 51 | */  | 
            ||
| 52 | 		if ( apply_filters( 'jetpack_sync_listener_should_load', true ) ) { | 
            ||
| 53 | self::initialize_listener();  | 
            ||
| 54 | }  | 
            ||
| 55 | |||
| 56 | add_action( 'init', array( __CLASS__, 'add_sender_shutdown' ), 90 );  | 
            ||
| 57 | |||
| 58 | }  | 
            ||
| 59 | |||
| 60 | 	static function add_sender_shutdown() { | 
            ||
| 61 | /**  | 
            ||
| 62 | * Fires on every request before default loading sync sender code.  | 
            ||
| 63 | * Return false to not load sync sender code that serializes pending  | 
            ||
| 64 | * data and sends it to WPCOM for processing.  | 
            ||
| 65 | *  | 
            ||
| 66 | * By default this returns true for cron jobs, POST requests, admin requests, or requests  | 
            ||
| 67 | * by users who can manage_options.  | 
            ||
| 68 | *  | 
            ||
| 69 | * @since 4.2.0  | 
            ||
| 70 | *  | 
            ||
| 71 | * @param bool should we load sync sender code for this request  | 
            ||
| 72 | */  | 
            ||
| 73 | if ( apply_filters( 'jetpack_sync_sender_should_load',  | 
            ||
| 74 | (  | 
            ||
| 75 | ( isset( $_SERVER["REQUEST_METHOD"] ) && 'POST' === $_SERVER['REQUEST_METHOD'] )  | 
            ||
| 76 | ||  | 
            ||
| 77 | current_user_can( 'manage_options' )  | 
            ||
| 78 | ||  | 
            ||
| 79 | is_admin()  | 
            ||
| 80 | ||  | 
            ||
| 81 | defined( 'PHPUNIT_JETPACK_TESTSUITE' )  | 
            ||
| 82 | )  | 
            ||
| 83 | 		) ) { | 
            ||
| 84 | self::initialize_sender();  | 
            ||
| 85 | add_action( 'shutdown', array( self::$sender, 'do_sync' ) );  | 
            ||
| 86 | add_action( 'shutdown', array( self::$sender, 'do_full_sync' ) );  | 
            ||
| 87 | }  | 
            ||
| 88 | }  | 
            ||
| 89 | |||
| 90 | 	static function sync_allowed() { | 
            ||
| 91 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-settings.php';  | 
            ||
| 92 | return ( ! Jetpack_Sync_Settings::get_setting( 'disable' ) && Jetpack::is_active() && ! ( Jetpack::is_development_mode() || Jetpack::is_staging_site() ) )  | 
            ||
| 93 | || defined( 'PHPUNIT_JETPACK_TESTSUITE' );  | 
            ||
| 94 | }  | 
            ||
| 95 | |||
| 96 | 	static function sync_via_cron_allowed() { | 
            ||
| 97 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-settings.php';  | 
            ||
| 98 | return ( Jetpack_Sync_Settings::get_setting( 'sync_via_cron' ) );  | 
            ||
| 99 | }  | 
            ||
| 100 | |||
| 101 | 	static function prevent_publicize_blacklisted_posts( $should_publicize, $post ) { | 
            ||
| 102 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-settings.php';  | 
            ||
| 103 | 		if ( in_array( $post->post_type, Jetpack_Sync_Settings::get_setting( 'post_types_blacklist' ) ) ) { | 
            ||
| 104 | return false;  | 
            ||
| 105 | }  | 
            ||
| 106 | |||
| 107 | return $should_publicize;  | 
            ||
| 108 | }  | 
            ||
| 109 | |||
| 110 | 	static function set_is_importing_true() { | 
            ||
| 111 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-settings.php';  | 
            ||
| 112 | Jetpack_Sync_Settings::set_importing( true );  | 
            ||
| 113 | }  | 
            ||
| 114 | |||
| 115 | 	static function send_data( $data, $codec_name, $sent_timestamp, $queue_id, $checkout_duration, $preprocess_duration ) { | 
            ||
| 116 | Jetpack::load_xml_rpc_client();  | 
            ||
| 117 | |||
| 118 | $query_args = array(  | 
            ||
| 119 | 'sync' => '1', // add an extra parameter to the URL so we can tell it's a sync action  | 
            ||
| 120 | 'codec' => $codec_name, // send the name of the codec used to encode the data  | 
            ||
| 121 | 'timestamp' => $sent_timestamp, // send current server time so we can compensate for clock differences  | 
            ||
| 122 | 'queue' => $queue_id, // sync or full_sync  | 
            ||
| 123 | 'home' => get_home_url(), // Send home url option to check for Identity Crisis server-side  | 
            ||
| 124 | 'siteurl' => get_site_url(), // Send siteurl option to check for Identity Crisis server-side  | 
            ||
| 125 | 'cd' => sprintf( '%.4f', $checkout_duration), // Time spent retrieving queue items from the DB  | 
            ||
| 126 | 'pd' => sprintf( '%.4f', $preprocess_duration), // Time spent converting queue items into data to send  | 
            ||
| 127 | );  | 
            ||
| 128 | |||
| 129 | // Has the site opted in to IDC mitigation?  | 
            ||
| 130 | 		if ( Jetpack::sync_idc_optin() ) { | 
            ||
| 131 | $query_args['idc'] = true;  | 
            ||
| 132 | }  | 
            ||
| 133 | |||
| 134 | 		if ( Jetpack_Options::get_option( 'migrate_for_idc', false ) ) { | 
            ||
| 135 | $query_args['migrate_for_idc'] = true;  | 
            ||
| 136 | }  | 
            ||
| 137 | |||
| 138 | $query_args['timeout'] = Jetpack_Sync_Settings::is_doing_cron() ? 30 : 15;  | 
            ||
| 139 | |||
| 140 | /**  | 
            ||
| 141 | * Filters query parameters appended to the Sync request URL sent to WordPress.com.  | 
            ||
| 142 | *  | 
            ||
| 143 | * @since 4.7.0  | 
            ||
| 144 | *  | 
            ||
| 145 | * @param array $query_args associative array of query parameters.  | 
            ||
| 146 | */  | 
            ||
| 147 | $query_args = apply_filters( 'jetpack_sync_send_data_query_args', $query_args );  | 
            ||
| 148 | |||
| 149 | $url = add_query_arg( $query_args, Jetpack::xmlrpc_api_url() );  | 
            ||
| 150 | |||
| 151 | $rpc = new Jetpack_IXR_Client( array(  | 
            ||
| 152 | 'url' => $url,  | 
            ||
| 153 | 'user_id' => JETPACK_MASTER_USER,  | 
            ||
| 154 | 'timeout' => $query_args['timeout'],  | 
            ||
| 155 | ) );  | 
            ||
| 156 | |||
| 157 | $result = $rpc->query( 'jetpack.syncActions', $data );  | 
            ||
| 158 | |||
| 159 | 		if ( ! $result ) { | 
            ||
| 160 | return $rpc->get_jetpack_error();  | 
            ||
| 161 | }  | 
            ||
| 162 | |||
| 163 | $response = $rpc->getResponse();  | 
            ||
| 164 | |||
| 165 | // Check if WordPress.com IDC mitigation blocked the sync request  | 
            ||
| 166 | 		if ( is_array( $response ) && isset( $response['error_code'] ) ) { | 
            ||
| 167 | $error_code = $response['error_code'];  | 
            ||
| 168 | $allowed_idc_error_codes = array(  | 
            ||
| 169 | 'jetpack_url_mismatch',  | 
            ||
| 170 | 'jetpack_home_url_mismatch',  | 
            ||
| 171 | 'jetpack_site_url_mismatch'  | 
            ||
| 172 | );  | 
            ||
| 173 | |||
| 174 | 			if ( in_array( $error_code, $allowed_idc_error_codes ) ) { | 
            ||
| 175 | Jetpack_Options::update_option(  | 
            ||
| 176 | 'sync_error_idc',  | 
            ||
| 177 | Jetpack::get_sync_error_idc_option( $response )  | 
            ||
| 178 | );  | 
            ||
| 179 | }  | 
            ||
| 180 | |||
| 181 | return new WP_Error(  | 
            ||
| 182 | 'sync_error_idc',  | 
            ||
| 183 | esc_html__( 'Sync has been blocked from WordPress.com because it would cause an identity crisis', 'jetpack' )  | 
            ||
| 184 | );  | 
            ||
| 185 | }  | 
            ||
| 186 | |||
| 187 | return $response;  | 
            ||
| 188 | }  | 
            ||
| 189 | |||
| 190 | 	static function do_initial_sync( $new_version = null, $old_version = null ) { | 
            ||
| 191 | 		if ( ! empty( $old_version ) && version_compare( $old_version, '4.2', '>=' ) ) { | 
            ||
| 192 | return;  | 
            ||
| 193 | }  | 
            ||
| 194 | |||
| 195 | $initial_sync_config = array(  | 
            ||
| 196 | 'options' => true,  | 
            ||
| 197 | 'network_options' => true,  | 
            ||
| 198 | 'functions' => true,  | 
            ||
| 199 | 'constants' => true,  | 
            ||
| 200 | 'users' => 'initial',  | 
            ||
| 201 | );  | 
            ||
| 202 | |||
| 203 | self::do_full_sync( $initial_sync_config );  | 
            ||
| 204 | }  | 
            ||
| 205 | |||
| 206 | 	static function do_full_sync( $modules = null ) { | 
            ||
| 207 | 		if ( ! self::sync_allowed() ) { | 
            ||
| 208 | return false;  | 
            ||
| 209 | }  | 
            ||
| 210 | |||
| 211 | self::initialize_listener();  | 
            ||
| 212 | Jetpack_Sync_Modules::get_module( 'full-sync' )->start( $modules );  | 
            ||
| 213 | |||
| 214 | return true;  | 
            ||
| 215 | }  | 
            ||
| 216 | |||
| 217 | 	static function jetpack_cron_schedule( $schedules ) { | 
            ||
| 218 | 		if ( ! isset( $schedules[ self::DEFAULT_SYNC_CRON_INTERVAL_NAME ] ) ) { | 
            ||
| 219 | $schedules[ self::DEFAULT_SYNC_CRON_INTERVAL_NAME ] = array(  | 
            ||
| 220 | 'interval' => self::DEFAULT_SYNC_CRON_INTERVAL_VALUE,  | 
            ||
| 221 | 'display' => sprintf(  | 
            ||
| 222 | esc_html( _n( 'Every minute', 'Every %d minutes', intval( self::DEFAULT_SYNC_CRON_INTERVAL_VALUE / 60 ), 'jetpack' ) ),  | 
            ||
| 223 | intval( self::DEFAULT_SYNC_CRON_INTERVAL_VALUE / 60 )  | 
            ||
| 224 | )  | 
            ||
| 225 | );  | 
            ||
| 226 | }  | 
            ||
| 227 | return $schedules;  | 
            ||
| 228 | }  | 
            ||
| 229 | |||
| 230 | 	static function do_cron_sync() { | 
            ||
| 231 | self::do_cron_sync_by_type( 'sync' );  | 
            ||
| 232 | }  | 
            ||
| 233 | |||
| 234 | 	static function do_cron_full_sync() { | 
            ||
| 235 | self::do_cron_sync_by_type( 'full_sync' );  | 
            ||
| 236 | }  | 
            ||
| 237 | |||
| 238 | /**  | 
            ||
| 239 | * Try to send actions until we run out of things to send,  | 
            ||
| 240 | * or have to wait more than 15s before sending again,  | 
            ||
| 241 | * or we hit a lock or some other sending issue  | 
            ||
| 242 | *  | 
            ||
| 243 | * @param string $type Sync type. Can be `sync` or `full_sync`.  | 
            ||
| 244 | */  | 
            ||
| 245 | 	static function do_cron_sync_by_type( $type ) { | 
            ||
| 246 | 		if ( ! self::sync_allowed() || ( 'sync' !== $type && 'full_sync' !== $type ) ) { | 
            ||
| 247 | return;  | 
            ||
| 248 | }  | 
            ||
| 249 | |||
| 250 | self::initialize_sender();  | 
            ||
| 251 | |||
| 252 | $time_limit = Jetpack_Sync_Settings::get_setting( 'cron_sync_time_limit' );  | 
            ||
| 253 | $start_time = time();  | 
            ||
| 254 | |||
| 255 | 		do { | 
            ||
| 256 | $next_sync_time = self::$sender->get_next_sync_time( $type );  | 
            ||
| 257 | |||
| 258 | 			if ( $next_sync_time ) { | 
            ||
| 259 | $delay = $next_sync_time - time() + 1;  | 
            ||
| 260 | 				if ( $delay > 15 ) { | 
            ||
| 261 | break;  | 
            ||
| 262 | 				} elseif ( $delay > 0 ) { | 
            ||
| 263 | sleep( $delay );  | 
            ||
| 264 | }  | 
            ||
| 265 | }  | 
            ||
| 266 | |||
| 267 | $result = 'full_sync' === $type ? self::$sender->do_full_sync() : self::$sender->do_sync();  | 
            ||
| 268 | } while ( $result && ( $start_time + $time_limit ) > time() );  | 
            ||
| 269 | }  | 
            ||
| 270 | |||
| 271 | 	static function initialize_listener() { | 
            ||
| 275 | |||
| 276 | 	static function initialize_sender() { | 
            ||
| 283 | |||
| 284 | 	static function initialize_woocommerce() { | 
            ||
| 285 | 		if ( false === class_exists( 'WooCommerce' ) ) { | 
            ||
| 286 | return;  | 
            ||
| 287 | }  | 
            ||
| 288 | add_filter( 'jetpack_sync_modules', array( 'Jetpack_Sync_Actions', 'add_woocommerce_sync_module' ) );  | 
            ||
| 289 | }  | 
            ||
| 290 | |||
| 291 | 	static function add_woocommerce_sync_module( $sync_modules ) { | 
            ||
| 292 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-woocommerce.php';  | 
            ||
| 293 | $sync_modules[] = 'Jetpack_Sync_Module_WooCommerce';  | 
            ||
| 294 | return $sync_modules;  | 
            ||
| 295 | }  | 
            ||
| 296 | |||
| 297 | 	static function initialize_wp_super_cache() { | 
            ||
| 298 | 		if ( false === function_exists( 'wp_cache_is_enabled' ) ) { | 
            ||
| 299 | return;  | 
            ||
| 300 | }  | 
            ||
| 301 | add_filter( 'jetpack_sync_modules', array( 'Jetpack_Sync_Actions', 'add_wp_super_cache_sync_module' ) );  | 
            ||
| 302 | }  | 
            ||
| 303 | |||
| 304 | 	static function add_wp_super_cache_sync_module( $sync_modules ) { | 
            ||
| 305 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-module-wp-super-cache.php';  | 
            ||
| 306 | $sync_modules[] = 'Jetpack_Sync_Module_WP_Super_Cache';  | 
            ||
| 307 | return $sync_modules;  | 
            ||
| 308 | }  | 
            ||
| 309 | |||
| 310 | 	static function sanitize_filtered_sync_cron_schedule( $schedule ) { | 
            ||
| 311 | $schedule = sanitize_key( $schedule );  | 
            ||
| 312 | $schedules = wp_get_schedules();  | 
            ||
| 313 | |||
| 314 | // Make sure that the schedule has actually been registered using the `cron_intervals` filter.  | 
            ||
| 315 | 		if ( isset( $schedules[ $schedule ] ) ) { | 
            ||
| 316 | return $schedule;  | 
            ||
| 317 | }  | 
            ||
| 318 | |||
| 319 | return self::DEFAULT_SYNC_CRON_INTERVAL_NAME;  | 
            ||
| 320 | }  | 
            ||
| 321 | |||
| 322 | 	static function get_start_time_offset( $schedule = '', $hook = '' ) { | 
            ||
| 323 | $start_time_offset = is_multisite()  | 
            ||
| 324 | ? mt_rand( 0, ( 2 * self::DEFAULT_SYNC_CRON_INTERVAL_VALUE ) )  | 
            ||
| 325 | : 0;  | 
            ||
| 326 | |||
| 327 | /**  | 
            ||
| 328 | * Allows overriding the offset that the sync cron jobs will first run. This can be useful when scheduling  | 
            ||
| 329 | * cron jobs across multiple sites in a network.  | 
            ||
| 330 | *  | 
            ||
| 331 | * @since 4.5  | 
            ||
| 332 | *  | 
            ||
| 333 | * @param int $start_time_offset  | 
            ||
| 334 | * @param string $hook  | 
            ||
| 335 | * @param string $schedule  | 
            ||
| 336 | */  | 
            ||
| 337 | return intval( apply_filters(  | 
            ||
| 338 | 'jetpack_sync_cron_start_time_offset',  | 
            ||
| 339 | $start_time_offset,  | 
            ||
| 340 | $hook,  | 
            ||
| 341 | $schedule  | 
            ||
| 342 | ) );  | 
            ||
| 343 | }  | 
            ||
| 344 | |||
| 345 | 	static function maybe_schedule_sync_cron( $schedule, $hook ) { | 
            ||
| 346 | 		if ( ! $hook ) { | 
            ||
| 347 | return;  | 
            ||
| 348 | }  | 
            ||
| 349 | $schedule = self::sanitize_filtered_sync_cron_schedule( $schedule );  | 
            ||
| 350 | |||
| 351 | $start_time = time() + self::get_start_time_offset( $schedule, $hook );  | 
            ||
| 352 | 		if ( ! wp_next_scheduled( $hook ) ) { | 
            ||
| 353 | // Schedule a job to send pending queue items once a minute  | 
            ||
| 354 | wp_schedule_event( $start_time, $schedule, $hook );  | 
            ||
| 355 | 		} else if ( $schedule != wp_get_schedule( $hook ) ) { | 
            ||
| 356 | // If the schedule has changed, update the schedule  | 
            ||
| 357 | wp_clear_scheduled_hook( $hook );  | 
            ||
| 358 | wp_schedule_event( $start_time, $schedule, $hook );  | 
            ||
| 359 | }  | 
            ||
| 360 | }  | 
            ||
| 361 | |||
| 362 | 	static function clear_sync_cron_jobs() { | 
            ||
| 363 | wp_clear_scheduled_hook( 'jetpack_sync_cron' );  | 
            ||
| 364 | wp_clear_scheduled_hook( 'jetpack_sync_full_cron' );  | 
            ||
| 365 | }  | 
            ||
| 366 | |||
| 367 | 	static function init_sync_cron_jobs() { | 
            ||
| 368 | add_filter( 'cron_schedules', array( __CLASS__, 'jetpack_cron_schedule' ) );  | 
            ||
| 369 | |||
| 370 | add_action( 'jetpack_sync_cron', array( __CLASS__, 'do_cron_sync' ) );  | 
            ||
| 371 | add_action( 'jetpack_sync_full_cron', array( __CLASS__, 'do_cron_full_sync' ) );  | 
            ||
| 372 | |||
| 373 | /**  | 
            ||
| 374 | * Allows overriding of the default incremental sync cron schedule which defaults to once every 5 minutes.  | 
            ||
| 375 | *  | 
            ||
| 376 | * @since 4.3.2  | 
            ||
| 377 | *  | 
            ||
| 378 | * @param string self::DEFAULT_SYNC_CRON_INTERVAL_NAME  | 
            ||
| 379 | */  | 
            ||
| 380 | $incremental_sync_cron_schedule = apply_filters( 'jetpack_sync_incremental_sync_interval', self::DEFAULT_SYNC_CRON_INTERVAL_NAME );  | 
            ||
| 381 | self::maybe_schedule_sync_cron( $incremental_sync_cron_schedule, 'jetpack_sync_cron' );  | 
            ||
| 382 | |||
| 383 | /**  | 
            ||
| 384 | * Allows overriding of the full sync cron schedule which defaults to once every 5 minutes.  | 
            ||
| 385 | *  | 
            ||
| 386 | * @since 4.3.2  | 
            ||
| 387 | *  | 
            ||
| 388 | * @param string self::DEFAULT_SYNC_CRON_INTERVAL_NAME  | 
            ||
| 389 | */  | 
            ||
| 390 | $full_sync_cron_schedule = apply_filters( 'jetpack_sync_full_sync_interval', self::DEFAULT_SYNC_CRON_INTERVAL_NAME );  | 
            ||
| 391 | self::maybe_schedule_sync_cron( $full_sync_cron_schedule, 'jetpack_sync_full_cron' );  | 
            ||
| 392 | }  | 
            ||
| 393 | |||
| 394 | 	static function cleanup_on_upgrade( $new_version = null, $old_version = null ) { | 
            ||
| 395 | 		if ( wp_next_scheduled( 'jetpack_sync_send_db_checksum' ) ) { | 
            ||
| 396 | wp_clear_scheduled_hook( 'jetpack_sync_send_db_checksum' );  | 
            ||
| 397 | }  | 
            ||
| 398 | |||
| 399 | $is_new_sync_upgrade = version_compare( $old_version, '4.2', '>=' );  | 
            ||
| 400 | 		if ( ! empty( $old_version ) && $is_new_sync_upgrade && version_compare( $old_version, '4.5', '<' ) ) { | 
            ||
| 401 | require_once dirname( __FILE__ ) . '/class.jetpack-sync-settings.php';  | 
            ||
| 402 | self::clear_sync_cron_jobs();  | 
            ||
| 403 | Jetpack_Sync_Settings::update_settings( array(  | 
            ||
| 404 | 'render_filtered_content' => Jetpack_Sync_Defaults::$default_render_filtered_content  | 
            ||
| 405 | ) );  | 
            ||
| 406 | }  | 
            ||
| 407 | }  | 
            ||
| 408 | |||
| 409 | 	static function get_sync_status() { | 
            ||
| 432 | }  | 
            ||
| 433 | |||
| 434 | // Check for WooCommerce support  | 
            ||
| 435 | add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'initialize_woocommerce' ), 5 );  | 
            ||
| 436 | |||
| 437 | // Check for WP Super Cache  | 
            ||
| 438 | add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'initialize_wp_super_cache' ), 5 );  | 
            ||
| 439 | |||
| 440 | /*  | 
            ||
| 441 | * Init after plugins loaded and before the `init` action. This helps with issues where plugins init  | 
            ||
| 442 | * with a high priority or sites that use alternate cron.  | 
            ||
| 443 | */  | 
            ||
| 444 | add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'init' ), 90 );  | 
            ||
| 445 | |||
| 446 | |||
| 447 | |||
| 448 | // We need to define this here so that it's hooked before `updating_jetpack_version` is called  | 
            ||
| 449 | add_action( 'updating_jetpack_version', array( 'Jetpack_Sync_Actions', 'do_initial_sync' ), 10, 2 );  | 
            ||
| 450 | add_action( 'updating_jetpack_version', array( 'Jetpack_Sync_Actions', 'cleanup_on_upgrade' ), 10, 2 );  | 
            ||
| 451 | 
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.