1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Automattic\Jetpack\Sync; |
4
|
|
|
|
5
|
|
|
require_once JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-helpers.php'; |
6
|
|
|
|
7
|
|
|
use Automattic\Jetpack\Sync\Functions; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Just some defaults that we share with the server |
11
|
|
|
*/ |
12
|
|
|
class Defaults { |
13
|
|
|
|
14
|
|
|
static $default_options_whitelist = array( |
15
|
|
|
'stylesheet', |
16
|
|
|
'blogname', |
17
|
|
|
'blogdescription', |
18
|
|
|
'blog_charset', |
19
|
|
|
'permalink_structure', |
20
|
|
|
'category_base', |
21
|
|
|
'tag_base', |
22
|
|
|
'sidebars_widgets', |
23
|
|
|
'comment_moderation', |
24
|
|
|
'default_comment_status', |
25
|
|
|
'page_on_front', |
26
|
|
|
'rss_use_excerpt', |
27
|
|
|
'subscription_options', |
28
|
|
|
'stb_enabled', |
29
|
|
|
'stc_enabled', |
30
|
|
|
'comment_registration', |
31
|
|
|
'show_avatars', |
32
|
|
|
'avatar_default', |
33
|
|
|
'avatar_rating', |
34
|
|
|
'highlander_comment_form_prompt', |
35
|
|
|
'jetpack_comment_form_color_scheme', |
36
|
|
|
'stats_options', |
37
|
|
|
'gmt_offset', |
38
|
|
|
'timezone_string', |
39
|
|
|
'jetpack_sync_non_public_post_stati', |
40
|
|
|
'jetpack_options', |
41
|
|
|
'site_icon', // (int) - ID of core's Site Icon attachment ID |
42
|
|
|
'default_post_format', |
43
|
|
|
'default_category', |
44
|
|
|
'large_size_w', |
45
|
|
|
'large_size_h', |
46
|
|
|
'thumbnail_size_w', |
47
|
|
|
'thumbnail_size_h', |
48
|
|
|
'medium_size_w', |
49
|
|
|
'medium_size_h', |
50
|
|
|
'thumbnail_crop', |
51
|
|
|
'image_default_link_type', |
52
|
|
|
'site_logo', |
53
|
|
|
'sharing-options', |
54
|
|
|
'sharing-services', |
55
|
|
|
'post_count', |
56
|
|
|
'default_ping_status', |
57
|
|
|
'sticky_posts', |
58
|
|
|
'blog_public', |
59
|
|
|
'default_pingback_flag', |
60
|
|
|
'require_name_email', |
61
|
|
|
'close_comments_for_old_posts', |
62
|
|
|
'close_comments_days_old', |
63
|
|
|
'thread_comments', |
64
|
|
|
'thread_comments_depth', |
65
|
|
|
'page_comments', |
66
|
|
|
'comments_per_page', |
67
|
|
|
'default_comments_page', |
68
|
|
|
'comment_order', |
69
|
|
|
'comments_notify', |
70
|
|
|
'moderation_notify', |
71
|
|
|
'social_notifications_like', |
72
|
|
|
'social_notifications_reblog', |
73
|
|
|
'social_notifications_subscribe', |
74
|
|
|
'comment_whitelist', |
75
|
|
|
'comment_max_links', |
76
|
|
|
'moderation_keys', |
77
|
|
|
'jetpack_wga', |
78
|
|
|
'disabled_likes', |
79
|
|
|
'disabled_reblogs', |
80
|
|
|
'jetpack_comment_likes_enabled', |
81
|
|
|
'twitter_via', |
82
|
|
|
'jetpack-memberships-connected-account-id', |
83
|
|
|
'jetpack-twitter-cards-site-tag', |
84
|
|
|
'wpcom_publish_posts_with_markdown', |
85
|
|
|
'wpcom_publish_comments_with_markdown', |
86
|
|
|
'jetpack_activated', |
87
|
|
|
'jetpack_available_modules', |
88
|
|
|
'jetpack_allowed_xsite_search_ids', |
89
|
|
|
'jetpack_autoupdate_plugins', |
90
|
|
|
'jetpack_autoupdate_plugins_translations', |
91
|
|
|
'jetpack_autoupdate_themes', |
92
|
|
|
'jetpack_autoupdate_themes_translations', |
93
|
|
|
'jetpack_autoupdate_core', |
94
|
|
|
'jetpack_autoupdate_translations', |
95
|
|
|
'carousel_background_color', |
96
|
|
|
'carousel_display_exif', |
97
|
|
|
'jetpack_portfolio', |
98
|
|
|
'jetpack_portfolio_posts_per_page', |
99
|
|
|
'jetpack_testimonial', |
100
|
|
|
'jetpack_testimonial_posts_per_page', |
101
|
|
|
'tiled_galleries', |
102
|
|
|
'gravatar_disable_hovercards', |
103
|
|
|
'infinite_scroll', |
104
|
|
|
'infinite_scroll_google_analytics', |
105
|
|
|
'wp_mobile_excerpt', |
106
|
|
|
'wp_mobile_featured_images', |
107
|
|
|
'wp_mobile_app_promos', |
108
|
|
|
'monitor_receive_notifications', |
109
|
|
|
'post_by_email_address', |
110
|
|
|
'jetpack_mailchimp', |
111
|
|
|
'jetpack_protect_key', |
112
|
|
|
'jetpack_protect_global_whitelist', |
113
|
|
|
'jetpack_sso_require_two_step', |
114
|
|
|
'jetpack_sso_match_by_email', |
115
|
|
|
'jetpack_relatedposts', |
116
|
|
|
'verification_services_codes', |
117
|
|
|
'users_can_register', |
118
|
|
|
'active_plugins', |
119
|
|
|
'uninstall_plugins', |
120
|
|
|
'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION |
121
|
|
|
'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION |
122
|
|
|
'jetpack_api_cache_enabled', |
123
|
|
|
'start_of_week', |
124
|
|
|
'blacklist_keys', |
125
|
|
|
'posts_per_page', |
126
|
|
|
'posts_per_rss', |
127
|
|
|
'show_on_front', |
128
|
|
|
'ping_sites', |
129
|
|
|
'uploads_use_yearmonth_folders', |
130
|
|
|
'date_format', |
131
|
|
|
'time_format', |
132
|
|
|
'admin_email', |
133
|
|
|
'new_admin_email', |
134
|
|
|
'default_email_category', |
135
|
|
|
'default_role', |
136
|
|
|
'page_for_posts', |
137
|
|
|
'mailserver_url', |
138
|
|
|
'mailserver_login', // Not syncing contents, only the option name |
139
|
|
|
'mailserver_pass', // Not syncing contents, only the option name |
140
|
|
|
'mailserver_port', |
141
|
|
|
'wp_page_for_privacy_policy', |
142
|
|
|
'enable_header_ad', |
143
|
|
|
'wordads_second_belowpost', |
144
|
|
|
'wordads_display_front_page', |
145
|
|
|
'wordads_display_post', |
146
|
|
|
'wordads_display_page', |
147
|
|
|
'wordads_display_archive', |
148
|
|
|
'wordads_custom_adstxt', |
149
|
|
|
'site_segment', |
150
|
|
|
'site_user_type', |
151
|
|
|
'site_vertical', |
152
|
|
|
'jetpack_excluded_extensions', |
153
|
|
|
); |
154
|
|
|
|
155
|
|
|
public static function get_options_whitelist() { |
156
|
|
|
/** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */ |
157
|
|
|
$options_whitelist = apply_filters( 'jetpack_options_whitelist', self::$default_options_whitelist ); |
158
|
|
|
/** |
159
|
|
|
* Filter the list of WordPress options that are manageable via the JSON API. |
160
|
|
|
* |
161
|
|
|
* @module sync |
162
|
|
|
* |
163
|
|
|
* @since 4.8.0 |
164
|
|
|
* |
165
|
|
|
* @param array The default list of options. |
166
|
|
|
*/ |
167
|
|
|
return apply_filters( 'jetpack_sync_options_whitelist', $options_whitelist ); |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
// Do not sync contents for these events, only the option name |
171
|
|
|
static $default_options_contentless = array( |
172
|
|
|
'mailserver_login', |
173
|
|
|
'mailserver_pass', |
174
|
|
|
); |
175
|
|
|
|
176
|
|
|
public static function get_options_contentless() { |
177
|
|
|
/** |
178
|
|
|
* Filter the list of WordPress options that should be synced without content |
179
|
|
|
* |
180
|
|
|
* @module sync |
181
|
|
|
* |
182
|
|
|
* @since 6.1.0 |
183
|
|
|
* |
184
|
|
|
* @param array The list of options synced without content. |
185
|
|
|
*/ |
186
|
|
|
return apply_filters( 'jetpack_sync_options_contentless', self::$default_options_contentless ); |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
static $default_constants_whitelist = array( |
190
|
|
|
'EMPTY_TRASH_DAYS', |
191
|
|
|
'WP_POST_REVISIONS', |
192
|
|
|
'AUTOMATIC_UPDATER_DISABLED', |
193
|
|
|
'ABSPATH', |
194
|
|
|
'WP_CONTENT_DIR', |
195
|
|
|
'FS_METHOD', |
196
|
|
|
'DISALLOW_FILE_EDIT', |
197
|
|
|
'DISALLOW_FILE_MODS', |
198
|
|
|
'WP_AUTO_UPDATE_CORE', |
199
|
|
|
'WP_HTTP_BLOCK_EXTERNAL', |
200
|
|
|
'WP_ACCESSIBLE_HOSTS', |
201
|
|
|
'JETPACK__VERSION', |
202
|
|
|
'IS_PRESSABLE', |
203
|
|
|
'DISABLE_WP_CRON', |
204
|
|
|
'ALTERNATE_WP_CRON', |
205
|
|
|
'WP_CRON_LOCK_TIMEOUT', |
206
|
|
|
'PHP_VERSION', |
207
|
|
|
'WP_MEMORY_LIMIT', |
208
|
|
|
'WP_MAX_MEMORY_LIMIT', |
209
|
|
|
); |
210
|
|
|
|
211
|
|
|
public static function get_constants_whitelist() { |
212
|
|
|
/** |
213
|
|
|
* Filter the list of PHP constants that are manageable via the JSON API. |
214
|
|
|
* |
215
|
|
|
* @module sync |
216
|
|
|
* |
217
|
|
|
* @since 4.8.0 |
218
|
|
|
* |
219
|
|
|
* @param array The default list of constants options. |
220
|
|
|
*/ |
221
|
|
|
return apply_filters( 'jetpack_sync_constants_whitelist', self::$default_constants_whitelist ); |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
static $default_callable_whitelist = array( |
225
|
|
|
'wp_max_upload_size' => 'wp_max_upload_size', |
226
|
|
|
'is_main_network' => array( 'Jetpack', 'is_multi_network' ), |
227
|
|
|
'is_multi_site' => 'is_multisite', |
228
|
|
|
'main_network_site' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'main_network_site_url' ), |
229
|
|
|
'site_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'site_url' ), |
230
|
|
|
'home_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'home_url' ), |
231
|
|
|
'single_user_site' => array( 'Jetpack', 'is_single_user_site' ), |
232
|
|
|
'updates' => array( 'Jetpack', 'get_updates' ), |
233
|
|
|
'has_file_system_write_access' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'file_system_write_access' ), |
234
|
|
|
'is_version_controlled' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'is_version_controlled' ), |
235
|
|
|
'taxonomies' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_taxonomies' ), |
236
|
|
|
'post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_types' ), |
237
|
|
|
'post_type_features' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_type_features' ), |
238
|
|
|
'shortcodes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_shortcodes' ), |
239
|
|
|
'rest_api_allowed_post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_post_types' ), |
240
|
|
|
'rest_api_allowed_public_metadata' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_public_metadata' ), |
241
|
|
|
'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), |
242
|
|
|
'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), |
243
|
|
|
'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), |
244
|
|
|
'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), |
245
|
|
|
'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), |
246
|
|
|
'wp_version' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'wp_version' ), |
247
|
|
|
'get_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins' ), |
248
|
|
|
'get_plugins_action_links' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins_action_links' ), |
249
|
|
|
'active_modules' => array( 'Jetpack', 'get_active_modules' ), |
250
|
|
|
'hosting_provider' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_hosting_provider' ), |
251
|
|
|
'locale' => 'get_locale', |
252
|
|
|
'site_icon_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'site_icon_url' ), |
253
|
|
|
'roles' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'roles' ), |
254
|
|
|
'timezone' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_timezone' ), |
255
|
|
|
'available_jetpack_blocks' => array( 'Jetpack_Gutenberg', 'get_availability' ), // Includes both Gutenberg blocks *and* plugins |
256
|
|
|
'paused_themes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_themes' ), |
257
|
|
|
'paused_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_plugins' ), |
258
|
|
|
); |
259
|
|
|
|
260
|
|
|
|
261
|
|
|
static $default_post_type_attributes = array( |
262
|
|
|
'name' => '', |
263
|
|
|
'label' => '', |
264
|
|
|
'labels' => array(), |
265
|
|
|
'description' => '', |
266
|
|
|
'public' => false, |
267
|
|
|
'hierarchical' => false, |
268
|
|
|
'exclude_from_search' => true, |
269
|
|
|
'publicly_queryable' => null, |
270
|
|
|
'show_ui' => false, |
271
|
|
|
'show_in_menu' => null, |
272
|
|
|
'show_in_nav_menus' => null, |
273
|
|
|
'show_in_admin_bar' => false, |
274
|
|
|
'menu_position' => null, |
275
|
|
|
'menu_icon' => null, |
276
|
|
|
'supports' => array(), |
277
|
|
|
'capability_type' => 'post', |
278
|
|
|
'capabilities' => array(), |
279
|
|
|
'cap' => array(), |
280
|
|
|
'map_meta_cap' => true, |
281
|
|
|
'taxonomies' => array(), |
282
|
|
|
'has_archive' => false, |
283
|
|
|
'rewrite' => true, |
284
|
|
|
'query_var' => true, |
285
|
|
|
'can_export' => true, |
286
|
|
|
'delete_with_user' => null, |
287
|
|
|
'show_in_rest' => false, |
288
|
|
|
'rest_base' => false, |
289
|
|
|
'_builtin' => false, |
290
|
|
|
'_edit_link' => 'post.php?post=%d', |
291
|
|
|
); |
292
|
|
|
|
293
|
|
|
public static function get_callable_whitelist() { |
294
|
|
|
/** |
295
|
|
|
* Filter the list of callables that are manageable via the JSON API. |
296
|
|
|
* |
297
|
|
|
* @module sync |
298
|
|
|
* |
299
|
|
|
* @since 4.8.0 |
300
|
|
|
* |
301
|
|
|
* @param array The default list of callables. |
302
|
|
|
*/ |
303
|
|
|
return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist ); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
static $blacklisted_post_types = array( |
307
|
|
|
'ai1ec_event', |
308
|
|
|
'bwg_album', |
309
|
|
|
'bwg_gallery', |
310
|
|
|
'customize_changeset', // WP built-in post type for Customizer changesets |
311
|
|
|
'dn_wp_yt_log', |
312
|
|
|
'http', |
313
|
|
|
'idx_page', |
314
|
|
|
'jetpack_migration', |
315
|
|
|
'postman_sent_mail', |
316
|
|
|
'rssap-feed', |
317
|
|
|
'rssmi_feed_item', |
318
|
|
|
'secupress_log_action', |
319
|
|
|
'sg_optimizer_jobs', |
320
|
|
|
'snitch', |
321
|
|
|
'wpephpcompat_jobs', |
322
|
|
|
'wprss_feed_item', |
323
|
|
|
'wp_automatic', |
324
|
|
|
'jp_sitemap_master', |
325
|
|
|
'jp_sitemap', |
326
|
|
|
'jp_sitemap_index', |
327
|
|
|
'jp_img_sitemap', |
328
|
|
|
'jp_img_sitemap_index', |
329
|
|
|
'jp_vid_sitemap', |
330
|
|
|
'jp_vid_sitemap_index', |
331
|
|
|
'vip-legacy-redirect', |
332
|
|
|
); |
333
|
|
|
|
334
|
|
|
static $default_post_checksum_columns = array( |
335
|
|
|
'ID', |
336
|
|
|
'post_modified', |
337
|
|
|
); |
338
|
|
|
|
339
|
|
|
static $default_post_meta_checksum_columns = array( |
340
|
|
|
'meta_id', |
341
|
|
|
'meta_value', |
342
|
|
|
); |
343
|
|
|
|
344
|
|
|
static $default_comment_checksum_columns = array( |
345
|
|
|
'comment_ID', |
346
|
|
|
'comment_content', |
347
|
|
|
); |
348
|
|
|
|
349
|
|
|
static $default_comment_meta_checksum_columns = array( |
350
|
|
|
'meta_id', |
351
|
|
|
'meta_value', |
352
|
|
|
); |
353
|
|
|
|
354
|
|
|
static $default_option_checksum_columns = array( |
355
|
|
|
'option_name', |
356
|
|
|
'option_value', |
357
|
|
|
); |
358
|
|
|
|
359
|
|
|
static $default_multisite_callable_whitelist = array( |
360
|
|
|
'network_name' => array( 'Jetpack', 'network_name' ), |
361
|
|
|
'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), |
362
|
|
|
'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ), |
363
|
|
|
'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ), |
364
|
|
|
'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ), |
365
|
|
|
'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ), |
366
|
|
|
); |
367
|
|
|
|
368
|
|
|
public static function get_multisite_callable_whitelist() { |
369
|
|
|
/** |
370
|
|
|
* Filter the list of multisite callables that are manageable via the JSON API. |
371
|
|
|
* |
372
|
|
|
* @module sync |
373
|
|
|
* |
374
|
|
|
* @since 4.8.0 |
375
|
|
|
* |
376
|
|
|
* @param array The default list of multisite callables. |
377
|
|
|
*/ |
378
|
|
|
return apply_filters( 'jetpack_sync_multisite_callable_whitelist', self::$default_multisite_callable_whitelist ); |
379
|
|
|
} |
380
|
|
|
|
381
|
|
|
static $post_meta_whitelist = array( |
382
|
|
|
'_feedback_akismet_values', |
383
|
|
|
'_feedback_email', |
384
|
|
|
'_feedback_extra_fields', |
385
|
|
|
'_g_feedback_shortcode', |
386
|
|
|
'_jetpack_post_thumbnail', |
387
|
|
|
'_menu_item_classes', |
388
|
|
|
'_menu_item_menu_item_parent', |
389
|
|
|
'_menu_item_object', |
390
|
|
|
'_menu_item_object_id', |
391
|
|
|
'_menu_item_orphaned', |
392
|
|
|
'_menu_item_type', |
393
|
|
|
'_menu_item_xfn', |
394
|
|
|
'_publicize_facebook_user', |
395
|
|
|
'_publicize_twitter_user', |
396
|
|
|
'_thumbnail_id', |
397
|
|
|
'_wp_attached_file', |
398
|
|
|
'_wp_attachment_backup_sizes', |
399
|
|
|
'_wp_attachment_context', |
400
|
|
|
'_wp_attachment_image_alt', |
401
|
|
|
'_wp_attachment_is_custom_background', |
402
|
|
|
'_wp_attachment_is_custom_header', |
403
|
|
|
'_wp_attachment_metadata', |
404
|
|
|
'_wp_page_template', |
405
|
|
|
'_wp_trash_meta_comments_status', |
406
|
|
|
'_wpas_mess', |
407
|
|
|
'content_width', |
408
|
|
|
'custom_css_add', |
409
|
|
|
'custom_css_preprocessor', |
410
|
|
|
'enclosure', |
411
|
|
|
'imagedata', |
412
|
|
|
'nova_price', |
413
|
|
|
'publicize_results', |
414
|
|
|
'sharing_disabled', |
415
|
|
|
'switch_like_status', |
416
|
|
|
'videopress_guid', |
417
|
|
|
'vimeo_poster_image', |
418
|
|
|
'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY |
419
|
|
|
); |
420
|
|
|
|
421
|
|
|
public static function get_post_meta_whitelist() { |
422
|
|
|
/** |
423
|
|
|
* Filter the list of post meta data that are manageable via the JSON API. |
424
|
|
|
* |
425
|
|
|
* @module sync |
426
|
|
|
* |
427
|
|
|
* @since 4.8.0 |
428
|
|
|
* |
429
|
|
|
* @param array The default list of meta data keys. |
430
|
|
|
*/ |
431
|
|
|
return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist ); |
432
|
|
|
} |
433
|
|
|
|
434
|
|
|
static $comment_meta_whitelist = array( |
435
|
|
|
'hc_avatar', |
436
|
|
|
'hc_post_as', |
437
|
|
|
'hc_wpcom_id_sig', |
438
|
|
|
'hc_foreign_user_id', |
439
|
|
|
); |
440
|
|
|
|
441
|
|
|
public static function get_comment_meta_whitelist() { |
442
|
|
|
/** |
443
|
|
|
* Filter the list of comment meta data that are manageable via the JSON API. |
444
|
|
|
* |
445
|
|
|
* @module sync |
446
|
|
|
* |
447
|
|
|
* @since 5.7.0 |
448
|
|
|
* |
449
|
|
|
* @param array The default list of comment meta data keys. |
450
|
|
|
*/ |
451
|
|
|
return apply_filters( 'jetpack_sync_comment_meta_whitelist', self::$comment_meta_whitelist ); |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
// TODO: move this to server? - these are theme support values |
455
|
|
|
// that should be synced as jetpack_current_theme_supports_foo option values |
456
|
|
|
static $default_theme_support_whitelist = array( |
457
|
|
|
'post-thumbnails', |
458
|
|
|
'post-formats', |
459
|
|
|
'custom-header', |
460
|
|
|
'custom-background', |
461
|
|
|
'custom-logo', |
462
|
|
|
'menus', |
463
|
|
|
'automatic-feed-links', |
464
|
|
|
'editor-style', |
465
|
|
|
'widgets', |
466
|
|
|
'html5', |
467
|
|
|
'title-tag', |
468
|
|
|
'jetpack-social-menu', |
469
|
|
|
'jetpack-responsive-videos', |
470
|
|
|
'infinite-scroll', |
471
|
|
|
'site-logo', |
472
|
|
|
); |
473
|
|
|
|
474
|
|
|
static function is_whitelisted_option( $option ) { |
475
|
|
|
$whitelisted_options = self::get_options_whitelist(); |
476
|
|
|
foreach ( $whitelisted_options as $whitelisted_option ) { |
477
|
|
|
if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) { |
478
|
|
|
return true; |
479
|
|
|
} elseif ( $whitelisted_option === $option ) { |
480
|
|
|
return true; |
481
|
|
|
} |
482
|
|
|
} |
483
|
|
|
|
484
|
|
|
return false; |
485
|
|
|
} |
486
|
|
|
|
487
|
|
|
static $default_capabilities_whitelist = array( |
488
|
|
|
'switch_themes', |
489
|
|
|
'edit_themes', |
490
|
|
|
'edit_theme_options', |
491
|
|
|
'install_themes', |
492
|
|
|
'activate_plugins', |
493
|
|
|
'edit_plugins', |
494
|
|
|
'install_plugins', |
495
|
|
|
'edit_users', |
496
|
|
|
'edit_files', |
497
|
|
|
'manage_options', |
498
|
|
|
'moderate_comments', |
499
|
|
|
'manage_categories', |
500
|
|
|
'manage_links', |
501
|
|
|
'upload_files', |
502
|
|
|
'import', |
503
|
|
|
'unfiltered_html', |
504
|
|
|
'edit_posts', |
505
|
|
|
'edit_others_posts', |
506
|
|
|
'edit_published_posts', |
507
|
|
|
'publish_posts', |
508
|
|
|
'edit_pages', |
509
|
|
|
'read', |
510
|
|
|
'publish_pages', |
511
|
|
|
'edit_others_pages', |
512
|
|
|
'edit_published_pages', |
513
|
|
|
'delete_pages', |
514
|
|
|
'delete_others_pages', |
515
|
|
|
'delete_published_pages', |
516
|
|
|
'delete_posts', |
517
|
|
|
'delete_others_posts', |
518
|
|
|
'delete_published_posts', |
519
|
|
|
'delete_private_posts', |
520
|
|
|
'edit_private_posts', |
521
|
|
|
'read_private_posts', |
522
|
|
|
'delete_private_pages', |
523
|
|
|
'edit_private_pages', |
524
|
|
|
'read_private_pages', |
525
|
|
|
'delete_users', |
526
|
|
|
'create_users', |
527
|
|
|
'unfiltered_upload', |
528
|
|
|
'edit_dashboard', |
529
|
|
|
'customize', |
530
|
|
|
'delete_site', |
531
|
|
|
'update_plugins', |
532
|
|
|
'delete_plugins', |
533
|
|
|
'update_themes', |
534
|
|
|
'update_core', |
535
|
|
|
'list_users', |
536
|
|
|
'remove_users', |
537
|
|
|
'add_users', |
538
|
|
|
'promote_users', |
539
|
|
|
'delete_themes', |
540
|
|
|
'export', |
541
|
|
|
'edit_comment', |
542
|
|
|
'upload_plugins', |
543
|
|
|
'upload_themes', |
544
|
|
|
); |
545
|
|
|
|
546
|
|
|
public static function get_capabilities_whitelist() { |
547
|
|
|
/** |
548
|
|
|
* Filter the list of capabilities that we care about |
549
|
|
|
* |
550
|
|
|
* @module sync |
551
|
|
|
* |
552
|
|
|
* @since 5.5.0 |
553
|
|
|
* |
554
|
|
|
* @param array The default list of capabilities. |
555
|
|
|
*/ |
556
|
|
|
return apply_filters( 'jetpack_sync_capabilities_whitelist', self::$default_capabilities_whitelist ); |
557
|
|
|
} |
558
|
|
|
|
559
|
|
|
static function get_max_sync_execution_time() { |
560
|
|
|
$max_exec_time = intval( ini_get( 'max_execution_time' ) ); |
561
|
|
|
if ( 0 === $max_exec_time ) { |
562
|
|
|
// 0 actually means "unlimited", but let's not treat it that way |
563
|
|
|
$max_exec_time = 60; |
564
|
|
|
} |
565
|
|
|
return floor( $max_exec_time / 3 ); |
566
|
|
|
} |
567
|
|
|
|
568
|
|
|
static function get_default_setting( $setting ) { |
569
|
|
|
$default_name = "default_$setting"; // e.g. default_dequeue_max_bytes |
570
|
|
|
return self::$$default_name; |
571
|
|
|
} |
572
|
|
|
|
573
|
|
|
static $default_network_options_whitelist = array( |
574
|
|
|
'site_name', |
575
|
|
|
'jetpack_protect_key', |
576
|
|
|
'jetpack_protect_global_whitelist', |
577
|
|
|
'active_sitewide_plugins', |
578
|
|
|
); |
579
|
|
|
|
580
|
|
|
/** |
581
|
|
|
* A mapping of known importers to friendly names. |
582
|
|
|
* |
583
|
|
|
* Keys are the class name of the known importer. |
584
|
|
|
* Values are the friendly name. |
585
|
|
|
* |
586
|
|
|
* @since 7.3.0 |
587
|
|
|
* |
588
|
|
|
* @var array |
589
|
|
|
*/ |
590
|
|
|
public static $default_known_importers = array( |
591
|
|
|
'Blogger_Importer' => 'blogger', |
592
|
|
|
'LJ_API_Import' => 'livejournal', |
593
|
|
|
'MT_Import' => 'mt', |
594
|
|
|
'RSS_Import' => 'rss', |
595
|
|
|
'WC_Tax_Rate_Importer' => 'woo-tax-rate', |
596
|
|
|
'WP_Import' => 'wordpress', |
597
|
|
|
); |
598
|
|
|
|
599
|
|
|
/** |
600
|
|
|
* Returns a list of known importers. |
601
|
|
|
* |
602
|
|
|
* @since 7.3.0 |
603
|
|
|
* |
604
|
|
|
* @return array Known importers with importer class names as keys and friendly names as values. |
605
|
|
|
*/ |
606
|
|
|
public static function get_known_importers() { |
607
|
|
|
/** |
608
|
|
|
* Filter the list of known importers. |
609
|
|
|
* |
610
|
|
|
* @module sync |
611
|
|
|
* |
612
|
|
|
* @since 7.3.0 |
613
|
|
|
* |
614
|
|
|
* @param array The default list of known importers. |
615
|
|
|
*/ |
616
|
|
|
return apply_filters( 'jetpack_sync_known_importers', self::$default_known_importers ); |
617
|
|
|
} |
618
|
|
|
|
619
|
|
|
static $default_taxonomy_whitelist = array(); |
620
|
|
|
static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB |
621
|
|
|
static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization |
622
|
|
|
static $default_upload_max_rows = 500; |
623
|
|
|
static $default_sync_wait_time = 10; // seconds, between syncs |
624
|
|
|
static $default_sync_wait_threshold = 5; // only wait before next send if the current send took more than X seconds |
625
|
|
|
static $default_enqueue_wait_time = 10; // wait between attempting to continue a full sync, via requests |
626
|
|
|
static $default_max_queue_size = 1000; |
627
|
|
|
static $default_max_queue_lag = 900; // 15 minutes |
628
|
|
|
static $default_queue_max_writes_sec = 100; // 100 rows a second |
629
|
|
|
static $default_post_types_blacklist = array(); |
630
|
|
|
static $default_post_meta_whitelist = array(); |
631
|
|
|
static $default_comment_meta_whitelist = array(); |
632
|
|
|
static $default_disable = 0; // completely disable sending data to wpcom |
633
|
|
|
static $default_network_disable = 0; // completely disable sending data to wpcom network wide |
634
|
|
|
static $default_sync_via_cron = 1; // use cron to sync |
635
|
|
|
static $default_render_filtered_content = 0; // render post_filtered_content |
636
|
|
|
static $default_max_enqueue_full_sync = 100; // max number of items to enqueue at a time when running full sync |
637
|
|
|
static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue |
638
|
|
|
static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again |
639
|
|
|
static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again |
640
|
|
|
static $default_sync_queue_lock_timeout = 120; // 2 minutes |
641
|
|
|
static $default_cron_sync_time_limit = 30; // 30 seconds |
642
|
|
|
|
643
|
|
|
} |
644
|
|
|
|