1 | <?php |
||
3 | class Jetpack_Sync_Module_Options extends Jetpack_Sync_Module { |
||
4 | private $options_whitelist, $options_contentless; |
||
|
|||
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() { |
||
35 | |||
36 | public function set_defaults() { |
||
37 | $this->update_options_whitelist(); |
||
40 | |||
41 | public function set_late_default() { |
||
49 | |||
50 | function enqueue_full_sync_actions( $config, $max_items_to_enqueue, $state ) { |
||
63 | |||
64 | public function estimate_full_sync_actions( $config ) { |
||
67 | |||
68 | function get_full_sync_actions() { |
||
71 | |||
72 | // Is public so that we don't have to store so much data all the options twice. |
||
73 | function get_all_options() { |
||
93 | |||
94 | function update_options_whitelist() { |
||
97 | |||
98 | function set_options_whitelist( $options ) { |
||
101 | |||
102 | function get_options_whitelist() { |
||
105 | |||
106 | function update_options_contentless() { |
||
109 | |||
110 | function get_options_contentless() { |
||
113 | |||
114 | function whitelist_options( $args ) { |
||
138 | |||
139 | function is_whitelisted_option( $option ) { |
||
142 | |||
143 | private function is_contentless_option( $option ) { |
||
146 | |||
147 | private function filter_theme_mods( &$value ) { |
||
152 | |||
153 | function jetpack_sync_core_icon() { |
||
169 | |||
170 | public function expand_options( $args ) { |
||
177 | } |
||
178 |
Only declaring a single property per statement allows you to later on add doc comments more easily.
It is also recommended by PSR2, so it is a common style that many people expect.