1 | <?php |
||
3 | class Jetpack_Sync_Module_Options extends Jetpack_Sync_Module { |
||
4 | private $options_whitelist; |
||
5 | |||
6 | public function name() { |
||
9 | |||
10 | public function init_listeners( $callable ) { |
||
11 | // options |
||
12 | add_action( 'added_option', $callable, 10, 2 ); |
||
13 | add_action( 'updated_option', $callable, 10, 3 ); |
||
14 | add_action( 'deleted_option', $callable, 10, 1 ); |
||
15 | |||
16 | // Sync Core Icon: Detect changes in Core's Site Icon and make it syncable. |
||
17 | add_action( 'add_option_site_icon', array( $this, 'jetpack_sync_core_icon' ) ); |
||
18 | add_action( 'update_option_site_icon', array( $this, 'jetpack_sync_core_icon' ) ); |
||
19 | add_action( 'delete_option_site_icon', array( $this, 'jetpack_sync_core_icon' ) ); |
||
20 | |||
21 | $whitelist_option_handler = array( $this, 'whitelist_options' ); |
||
22 | add_filter( 'jetpack_sync_before_enqueue_deleted_option', $whitelist_option_handler ); |
||
23 | add_filter( 'jetpack_sync_before_enqueue_added_option', $whitelist_option_handler ); |
||
24 | add_filter( 'jetpack_sync_before_enqueue_updated_option', $whitelist_option_handler ); |
||
25 | } |
||
26 | |||
27 | public function init_full_sync_listeners( $callable ) { |
||
28 | add_action( 'jetpack_full_sync_options', $callable ); |
||
29 | } |
||
30 | |||
31 | public function init_before_send() { |
||
32 | // full sync |
||
33 | add_filter( 'jetpack_sync_before_send_jetpack_full_sync_options', array( $this, 'expand_options' ) ); |
||
34 | } |
||
35 | |||
36 | public function set_defaults() { |
||
39 | |||
40 | public function set_late_default() { |
||
41 | |||
42 | /** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */ |
||
48 | |||
49 | function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $state ) { |
||
62 | |||
63 | public function estimate_full_sync_actions( $config ) { |
||
66 | |||
67 | function get_full_sync_actions() { |
||
70 | |||
71 | // Is public so that we don't have to store so much data all the options twice. |
||
72 | function get_all_options() { |
||
92 | |||
93 | function update_options_whitelist() { |
||
96 | |||
97 | function set_options_whitelist( $options ) { |
||
100 | |||
101 | function get_options_whitelist() { |
||
104 | |||
105 | // reject non-whitelisted options |
||
106 | function whitelist_options( $args ) { |
||
120 | |||
121 | function is_whitelisted_option( $option ) { |
||
124 | |||
125 | private function filter_theme_mods( &$value ) { |
||
130 | |||
131 | function jetpack_sync_core_icon() { |
||
147 | |||
148 | public function expand_options( $args ) { |
||
155 | } |
||
156 |