1 | <?php |
||
7 | class Jetpack_Sync_Defaults { |
||
8 | static $default_options_whitelist = array( |
||
|
|||
9 | 'stylesheet', |
||
10 | 'blogname', |
||
11 | 'blogdescription', |
||
12 | 'blog_charset', |
||
13 | 'permalink_structure', |
||
14 | 'category_base', |
||
15 | 'tag_base', |
||
16 | 'comment_moderation', |
||
17 | 'default_comment_status', |
||
18 | 'page_on_front', |
||
19 | 'rss_use_excerpt', |
||
20 | 'subscription_options', |
||
21 | 'stb_enabled', |
||
22 | 'stc_enabled', |
||
23 | 'comment_registration', |
||
24 | 'show_avatars', |
||
25 | 'avatar_default', |
||
26 | 'avatar_rating', |
||
27 | 'highlander_comment_form_prompt', |
||
28 | 'jetpack_comment_form_color_scheme', |
||
29 | 'stats_options', |
||
30 | 'gmt_offset', |
||
31 | 'timezone_string', |
||
32 | 'jetpack_sync_non_public_post_stati', |
||
33 | 'jetpack_options', |
||
34 | 'site_icon', // (int) - ID of core's Site Icon attachment ID |
||
35 | 'default_post_format', |
||
36 | 'default_category', |
||
37 | 'large_size_w', |
||
38 | 'large_size_h', |
||
39 | 'thumbnail_size_w', |
||
40 | 'thumbnail_size_h', |
||
41 | 'medium_size_w', |
||
42 | 'medium_size_h', |
||
43 | 'thumbnail_crop', |
||
44 | 'image_default_link_type', |
||
45 | 'site_logo', |
||
46 | 'sharing-options', |
||
47 | 'sharing-services', |
||
48 | 'post_count', |
||
49 | 'default_ping_status', |
||
50 | 'sticky_posts', |
||
51 | 'blog_public', |
||
52 | 'default_pingback_flag', |
||
53 | 'require_name_email', |
||
54 | 'close_comments_for_old_posts', |
||
55 | 'close_comments_days_old', |
||
56 | 'thread_comments', |
||
57 | 'thread_comments_depth', |
||
58 | 'page_comments', |
||
59 | 'comments_per_page', |
||
60 | 'default_comments_page', |
||
61 | 'comment_order', |
||
62 | 'comments_notify', |
||
63 | 'moderation_notify', |
||
64 | 'social_notifications_like', |
||
65 | 'social_notifications_reblog', |
||
66 | 'social_notifications_subscribe', |
||
67 | 'comment_whitelist', |
||
68 | 'comment_max_links', |
||
69 | 'moderation_keys', |
||
70 | 'jetpack_wga', |
||
71 | 'disabled_likes', |
||
72 | 'disabled_reblogs', |
||
73 | 'jetpack_comment_likes_enabled', |
||
74 | 'twitter_via', |
||
75 | 'jetpack-twitter-cards-site-tag', |
||
76 | 'wpcom_publish_posts_with_markdown', |
||
77 | 'wpcom_publish_comments_with_markdown', |
||
78 | 'jetpack_activated', |
||
79 | 'jetpack_available_modules', |
||
80 | 'jetpack_autoupdate_plugins', |
||
81 | 'jetpack_autoupdate_plugins_translations', |
||
82 | 'jetpack_autoupdate_themes', |
||
83 | 'jetpack_autoupdate_themes_translations', |
||
84 | 'jetpack_autoupdate_core', |
||
85 | 'jetpack_autoupdate_translations', |
||
86 | 'carousel_background_color', |
||
87 | 'carousel_display_exif', |
||
88 | 'jetpack_portfolio', |
||
89 | 'jetpack_portfolio_posts_per_page', |
||
90 | 'jetpack_testimonial', |
||
91 | 'jetpack_testimonial_posts_per_page', |
||
92 | 'tiled_galleries', |
||
93 | 'gravatar_disable_hovercards', |
||
94 | 'infinite_scroll', |
||
95 | 'infinite_scroll_google_analytics', |
||
96 | 'wp_mobile_excerpt', |
||
97 | 'wp_mobile_featured_images', |
||
98 | 'wp_mobile_app_promos', |
||
99 | 'monitor_receive_notifications', |
||
100 | 'post_by_email_address', |
||
101 | 'jetpack_protect_key', |
||
102 | 'jetpack_protect_global_whitelist', |
||
103 | 'jetpack_sso_require_two_step', |
||
104 | 'jetpack_relatedposts', |
||
105 | 'verification_services_codes', |
||
106 | 'users_can_register', |
||
107 | 'active_plugins', |
||
108 | 'uninstall_plugins', |
||
109 | 'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION |
||
110 | 'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION |
||
111 | 'jetpack_api_cache_enabled', |
||
112 | ); |
||
113 | |||
114 | public static function get_options_whitelist() { |
||
115 | /** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */ |
||
116 | $options_whitelist = apply_filters( 'jetpack_options_whitelist', self::$default_options_whitelist ); |
||
117 | /** |
||
118 | * Filter the list of WordPress options that are manageable via the JSON API. |
||
119 | * |
||
120 | * @module sync |
||
121 | * |
||
122 | * @since 4.7 |
||
123 | * |
||
124 | * @param array The default list of options. |
||
125 | */ |
||
126 | return apply_filters( 'jetpack_sync_options_whitelist', $options_whitelist ); |
||
127 | } |
||
128 | |||
129 | static $default_constants_whitelist = array( |
||
130 | 'EMPTY_TRASH_DAYS', |
||
131 | 'WP_POST_REVISIONS', |
||
132 | 'AUTOMATIC_UPDATER_DISABLED', |
||
133 | 'ABSPATH', |
||
134 | 'WP_CONTENT_DIR', |
||
135 | 'FS_METHOD', |
||
136 | 'DISALLOW_FILE_EDIT', |
||
137 | 'DISALLOW_FILE_MODS', |
||
138 | 'WP_AUTO_UPDATE_CORE', |
||
139 | 'WP_HTTP_BLOCK_EXTERNAL', |
||
140 | 'WP_ACCESSIBLE_HOSTS', |
||
141 | 'JETPACK__VERSION', |
||
142 | 'IS_PRESSABLE', |
||
143 | 'DISABLE_WP_CRON', |
||
144 | 'ALTERNATE_WP_CRON', |
||
145 | 'WP_CRON_LOCK_TIMEOUT', |
||
146 | 'PHP_VERSION', |
||
147 | ); |
||
148 | |||
149 | public static function get_constants_whitelist() { |
||
150 | /** |
||
151 | * Filter the list of PHP constants that are manageable via the JSON API. |
||
152 | * |
||
153 | * @module sync |
||
154 | * |
||
155 | * @since 4.7 |
||
156 | * |
||
157 | * @param array The default list of constants options. |
||
158 | */ |
||
159 | return apply_filters( 'jetpack_sync_constants_whitelist', self::$default_constants_whitelist ); |
||
160 | } |
||
161 | |||
162 | static $default_callable_whitelist = array( |
||
163 | 'wp_max_upload_size' => 'wp_max_upload_size', |
||
164 | 'is_main_network' => array( 'Jetpack', 'is_multi_network' ), |
||
165 | 'is_multi_site' => 'is_multisite', |
||
166 | 'main_network_site' => array( 'Jetpack_Sync_Functions', 'main_network_site_url' ), |
||
167 | 'site_url' => array( 'Jetpack_Sync_Functions', 'site_url' ), |
||
168 | 'home_url' => array( 'Jetpack_Sync_Functions', 'home_url' ), |
||
169 | 'single_user_site' => array( 'Jetpack', 'is_single_user_site' ), |
||
170 | 'updates' => array( 'Jetpack', 'get_updates' ), |
||
171 | 'has_file_system_write_access' => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ), |
||
172 | 'is_version_controlled' => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ), |
||
173 | 'taxonomies' => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ), |
||
174 | 'post_types' => array( 'Jetpack_Sync_Functions', 'get_post_types' ), |
||
175 | 'post_type_features' => array( 'Jetpack_Sync_Functions', 'get_post_type_features' ), |
||
176 | 'shortcodes' => array( 'Jetpack_Sync_Functions', 'get_shortcodes' ), |
||
177 | 'rest_api_allowed_post_types' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_post_types' ), |
||
178 | 'rest_api_allowed_public_metadata' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_public_metadata' ), |
||
179 | 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), |
||
180 | 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), |
||
181 | 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), |
||
182 | 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), |
||
183 | 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), |
||
184 | 'wp_version' => array( 'Jetpack_Sync_Functions', 'wp_version' ), |
||
185 | 'get_plugins' => array( 'Jetpack_Sync_Functions', 'get_plugins' ), |
||
186 | 'active_modules' => array( 'Jetpack', 'get_active_modules' ), |
||
187 | 'hosting_provider' => array( 'Jetpack_Sync_Functions', 'get_hosting_provider' ), |
||
188 | 'locale' => 'get_locale', |
||
189 | 'site_icon_url' => array( 'Jetpack_Sync_Functions', 'site_icon_url' ), |
||
190 | ); |
||
191 | |||
192 | static $blacklisted_post_types = array( |
||
193 | 'ai1ec_event', |
||
194 | 'snitch', |
||
195 | 'secupress_log_action', |
||
196 | 'http', |
||
197 | 'bwg_gallery', |
||
198 | 'bwg_album', |
||
199 | 'idx_page', |
||
200 | 'postman_sent_mail', |
||
201 | 'rssmi_feed_item', |
||
202 | ); |
||
203 | |||
204 | static $default_post_checksum_columns = array( |
||
205 | 'ID', |
||
206 | 'post_modified', |
||
207 | ); |
||
208 | |||
209 | static $default_post_meta_checksum_columns = array( |
||
210 | 'meta_id', |
||
211 | 'meta_value' |
||
212 | ); |
||
213 | |||
214 | static $default_comment_checksum_columns = array( |
||
215 | 'comment_ID', |
||
216 | 'comment_content', |
||
217 | ); |
||
218 | |||
219 | static $default_comment_meta_checksum_columns = array( |
||
220 | 'meta_id', |
||
221 | 'meta_value' |
||
222 | ); |
||
223 | |||
224 | static $default_option_checksum_columns = array( |
||
225 | 'option_name', |
||
226 | 'option_value', |
||
227 | ); |
||
228 | |||
229 | static $default_multisite_callable_whitelist = array( |
||
230 | 'network_name' => array( 'Jetpack', 'network_name' ), |
||
231 | 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), |
||
232 | 'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ), |
||
233 | 'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ), |
||
234 | 'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ), |
||
235 | 'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ), |
||
236 | ); |
||
237 | |||
238 | static $post_meta_whitelist = array( |
||
239 | '_feedback_akismet_values', |
||
240 | '_feedback_email', |
||
241 | '_feedback_extra_fields', |
||
242 | '_g_feedback_shortcode', |
||
243 | '_jetpack_post_thumbnail', |
||
244 | '_menu_item_classes', |
||
245 | '_menu_item_menu_item_parent', |
||
246 | '_menu_item_object', |
||
247 | '_menu_item_object_id', |
||
248 | '_menu_item_orphaned', |
||
249 | '_menu_item_type', |
||
250 | '_menu_item_xfn', |
||
251 | '_publicize_facebook_user', |
||
252 | '_publicize_twitter_user', |
||
253 | '_thumbnail_id', |
||
254 | '_wp_attached_file', |
||
255 | '_wp_attachment_backup_sizes', |
||
256 | '_wp_attachment_context', |
||
257 | '_wp_attachment_image_alt', |
||
258 | '_wp_attachment_is_custom_background', |
||
259 | '_wp_attachment_is_custom_header', |
||
260 | '_wp_attachment_metadata', |
||
261 | '_wp_page_template', |
||
262 | '_wp_trash_meta_comments_status', |
||
263 | '_wpas_mess', |
||
264 | 'content_width', |
||
265 | 'custom_css_add', |
||
266 | 'custom_css_preprocessor', |
||
267 | 'enclosure', |
||
268 | 'imagedata', |
||
269 | 'nova_price', |
||
270 | 'publicize_results', |
||
271 | 'sharing_disabled', |
||
272 | 'switch_like_status', |
||
273 | 'videopress_guid', |
||
274 | 'vimeo_poster_image', |
||
275 | 'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY |
||
276 | ); |
||
277 | |||
278 | public static function get_post_meta_whitelist() { |
||
279 | /** |
||
280 | * Filter the list of post meta data that are manageable via the JSON API. |
||
281 | * |
||
282 | * @module sync |
||
283 | * |
||
284 | * @since 4.7 |
||
285 | * |
||
286 | * @param array The default list of meta data keys. |
||
287 | */ |
||
288 | return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist ); |
||
289 | } |
||
290 | |||
291 | static $comment_meta_whitelist = array( |
||
292 | 'hc_avatar', |
||
293 | 'hc_post_as', |
||
294 | 'hc_wpcom_id_sig', |
||
295 | 'hc_foreign_user_id' |
||
296 | ); |
||
297 | |||
298 | // TODO: move this to server? - these are theme support values |
||
299 | // that should be synced as jetpack_current_theme_supports_foo option values |
||
300 | static $default_theme_support_whitelist = array( |
||
301 | 'post-thumbnails', |
||
302 | 'post-formats', |
||
303 | 'custom-header', |
||
304 | 'custom-background', |
||
305 | 'custom-logo', |
||
306 | 'menus', |
||
307 | 'automatic-feed-links', |
||
308 | 'editor-style', |
||
309 | 'widgets', |
||
310 | 'html5', |
||
311 | 'title-tag', |
||
312 | 'jetpack-social-menu', |
||
313 | 'jetpack-responsive-videos', |
||
314 | 'infinite-scroll', |
||
315 | 'site-logo', |
||
316 | ); |
||
317 | |||
318 | static function is_whitelisted_option( $option ) { |
||
329 | |||
330 | static function get_max_sync_execution_time() { |
||
338 | |||
339 | static $default_network_options_whitelist = array( |
||
340 | 'site_name', |
||
341 | 'jetpack_protect_key', |
||
342 | 'jetpack_protect_global_whitelist', |
||
343 | 'active_sitewide_plugins', |
||
344 | ); |
||
345 | |||
346 | static $default_taxonomy_whitelist = array(); |
||
347 | static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB |
||
348 | static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization |
||
349 | static $default_upload_max_rows = 500; |
||
350 | static $default_sync_wait_time = 10; // seconds, between syncs |
||
351 | static $default_sync_wait_threshold = 5; // only wait before next send if the current send took more than X seconds |
||
352 | static $default_enqueue_wait_time = 10; // wait between attempting to continue a full sync, via requests |
||
353 | static $default_max_queue_size = 1000; |
||
354 | static $default_max_queue_lag = 900; // 15 minutes |
||
355 | static $default_queue_max_writes_sec = 100; // 100 rows a second |
||
356 | static $default_post_types_blacklist = array(); |
||
357 | static $default_post_meta_whitelist = array(); |
||
358 | static $default_comment_meta_whitelist = array(); |
||
359 | static $default_disable = 0; // completely disable sending data to wpcom |
||
360 | static $default_sync_via_cron = 1; // use cron to sync |
||
361 | static $default_render_filtered_content = 0; // render post_filtered_content |
||
362 | static $default_max_enqueue_full_sync = 100; // max number of items to enqueue at a time when running full sync |
||
363 | static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue |
||
364 | static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again |
||
365 | static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again |
||
366 | static $default_sync_queue_lock_timeout = 120; // 2 minutes |
||
367 | static $default_cron_sync_time_limit = 30; // 30 seconds |
||
368 | } |
||
369 |
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.