Completed
Push — feature/jetpack-packages ( cf65ba...5255bf )
by Marin
09:02
created

Jetpack_Sync_Main::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 17
rs 9.7
c 0
b 0
f 0
1
<?php
2
/**
3
 * This class hooks the main sync actions.
4
 *
5
 * @package jetpack-sync
6
 */
7
8
/**
9
 * Jetpack Sync main class.
10
 */
11
class Jetpack_Sync_Main {
12
	/**
13
	 * Initialize the main sync actions.
14
	 */
15
	public static function init() {
16
		// Check for WooCommerce support.
17
		add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'initialize_woocommerce' ), 5 );
18
19
		// Check for WP Super Cache.
20
		add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'initialize_wp_super_cache' ), 5 );
21
22
		/*
23
		 * Init after plugins loaded and before the `init` action. This helps with issues where plugins init
24
		 * with a high priority or sites that use alternate cron.
25
		 */
26
		add_action( 'plugins_loaded', array( 'Jetpack_Sync_Actions', 'init' ), 90 );
27
28
		// We need to define this here so that it's hooked before `updating_jetpack_version` is called.
29
		add_action( 'updating_jetpack_version', array( 'Jetpack_Sync_Actions', 'cleanup_on_upgrade' ), 10, 2 );
30
		add_action( 'jetpack_user_authorized', array( 'Jetpack_Sync_Actions', 'do_initial_sync' ), 10, 0 );
31
	}
32
}
33