1 | <?php |
||
18 | class Defaults { |
||
19 | |||
20 | /** |
||
21 | * Default Options. |
||
22 | * |
||
23 | * @var array |
||
24 | */ |
||
25 | public static $default_options_whitelist = array( |
||
26 | 'stylesheet', |
||
27 | 'blogname', |
||
28 | 'blogdescription', |
||
29 | 'blog_charset', |
||
30 | 'permalink_structure', |
||
31 | 'category_base', |
||
32 | 'tag_base', |
||
33 | 'sidebars_widgets', |
||
34 | 'comment_moderation', |
||
35 | 'default_comment_status', |
||
36 | 'page_on_front', |
||
37 | 'rss_use_excerpt', |
||
38 | 'subscription_options', |
||
39 | 'stb_enabled', |
||
40 | 'stc_enabled', |
||
41 | 'comment_registration', |
||
42 | 'show_avatars', |
||
43 | 'avatar_default', |
||
44 | 'avatar_rating', |
||
45 | 'highlander_comment_form_prompt', |
||
46 | 'jetpack_comment_form_color_scheme', |
||
47 | 'stats_options', |
||
48 | 'gmt_offset', |
||
49 | 'timezone_string', |
||
50 | 'jetpack_sync_non_public_post_stati', |
||
51 | 'jetpack_options', |
||
52 | 'site_icon', // (int) - ID of core's Site Icon attachment ID |
||
53 | 'default_post_format', |
||
54 | 'default_category', |
||
55 | 'large_size_w', |
||
56 | 'large_size_h', |
||
57 | 'thumbnail_size_w', |
||
58 | 'thumbnail_size_h', |
||
59 | 'medium_size_w', |
||
60 | 'medium_size_h', |
||
61 | 'thumbnail_crop', |
||
62 | 'image_default_link_type', |
||
63 | 'site_logo', |
||
64 | 'sharing-options', |
||
65 | 'sharing-services', |
||
66 | 'post_count', |
||
67 | 'default_ping_status', |
||
68 | 'sticky_posts', |
||
69 | 'blog_public', |
||
70 | 'default_pingback_flag', |
||
71 | 'require_name_email', |
||
72 | 'close_comments_for_old_posts', |
||
73 | 'close_comments_days_old', |
||
74 | 'thread_comments', |
||
75 | 'thread_comments_depth', |
||
76 | 'page_comments', |
||
77 | 'comments_per_page', |
||
78 | 'default_comments_page', |
||
79 | 'comment_order', |
||
80 | 'comments_notify', |
||
81 | 'moderation_notify', |
||
82 | 'social_notifications_like', |
||
83 | 'social_notifications_reblog', |
||
84 | 'social_notifications_subscribe', |
||
85 | 'comment_whitelist', |
||
86 | 'comment_max_links', |
||
87 | 'moderation_keys', |
||
88 | 'jetpack_wga', |
||
89 | 'disabled_likes', |
||
90 | 'disabled_reblogs', |
||
91 | 'jetpack_comment_likes_enabled', |
||
92 | 'twitter_via', |
||
93 | 'jetpack-memberships-connected-account-id', |
||
94 | 'jetpack-twitter-cards-site-tag', |
||
95 | 'wpcom_publish_posts_with_markdown', |
||
96 | 'wpcom_publish_comments_with_markdown', |
||
97 | 'jetpack_activated', |
||
98 | 'jetpack_available_modules', |
||
99 | 'jetpack_allowed_xsite_search_ids', |
||
100 | 'jetpack_autoupdate_plugins', |
||
101 | 'jetpack_autoupdate_plugins_translations', |
||
102 | 'jetpack_autoupdate_themes', |
||
103 | 'jetpack_autoupdate_themes_translations', |
||
104 | 'jetpack_autoupdate_core', |
||
105 | 'jetpack_autoupdate_translations', |
||
106 | 'carousel_background_color', |
||
107 | 'carousel_display_exif', |
||
108 | 'jetpack_portfolio', |
||
109 | 'jetpack_portfolio_posts_per_page', |
||
110 | 'jetpack_testimonial', |
||
111 | 'jetpack_testimonial_posts_per_page', |
||
112 | 'tiled_galleries', |
||
113 | 'gravatar_disable_hovercards', |
||
114 | 'infinite_scroll', |
||
115 | 'infinite_scroll_google_analytics', |
||
116 | 'wp_mobile_excerpt', |
||
117 | 'wp_mobile_featured_images', |
||
118 | 'wp_mobile_app_promos', |
||
119 | 'monitor_receive_notifications', |
||
120 | 'post_by_email_address', |
||
121 | 'jetpack_mailchimp', |
||
122 | 'jetpack_protect_key', |
||
123 | 'jetpack_protect_global_whitelist', |
||
124 | 'jetpack_sso_require_two_step', |
||
125 | 'jetpack_sso_match_by_email', |
||
126 | 'jetpack_relatedposts', |
||
127 | 'verification_services_codes', |
||
128 | 'users_can_register', |
||
129 | 'active_plugins', |
||
130 | 'uninstall_plugins', |
||
131 | 'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION. |
||
132 | 'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION. |
||
133 | 'jetpack_api_cache_enabled', |
||
134 | 'start_of_week', |
||
135 | 'blacklist_keys', |
||
136 | 'posts_per_page', |
||
137 | 'posts_per_rss', |
||
138 | 'show_on_front', |
||
139 | 'ping_sites', |
||
140 | 'uploads_use_yearmonth_folders', |
||
141 | 'date_format', |
||
142 | 'time_format', |
||
143 | 'admin_email', |
||
144 | 'new_admin_email', |
||
145 | 'default_email_category', |
||
146 | 'default_role', |
||
147 | 'page_for_posts', |
||
148 | 'mailserver_url', |
||
149 | 'mailserver_login', // Not syncing contents, only the option name. |
||
150 | 'mailserver_pass', // Not syncing contents, only the option name. |
||
151 | 'mailserver_port', |
||
152 | 'wp_page_for_privacy_policy', |
||
153 | 'enable_header_ad', |
||
154 | 'wordads_second_belowpost', |
||
155 | 'wordads_display_front_page', |
||
156 | 'wordads_display_post', |
||
157 | 'wordads_display_page', |
||
158 | 'wordads_display_archive', |
||
159 | 'wordads_custom_adstxt', |
||
160 | 'site_segment', |
||
161 | 'site_user_type', |
||
162 | 'site_vertical', |
||
163 | 'jetpack_excluded_extensions', |
||
164 | ); |
||
165 | |||
166 | /** |
||
167 | * Return options whitelist filtered. |
||
168 | * |
||
169 | * @return array Options whitelist. |
||
170 | */ |
||
171 | public static function get_options_whitelist() { |
||
185 | |||
186 | /** |
||
187 | * "Contentless" Options. |
||
188 | * |
||
189 | * Do not sync contents for these events, only the option name. Good for sensitive information that Sync does not need. |
||
190 | * |
||
191 | * @var array Options to sync name only. |
||
192 | */ |
||
193 | public static $default_options_contentless = array( |
||
194 | 'mailserver_login', |
||
195 | 'mailserver_pass', |
||
196 | ); |
||
197 | |||
198 | /** |
||
199 | * Return contentless options. |
||
200 | * |
||
201 | * These are options that Sync only uses the option names, not the content of the option. |
||
202 | * |
||
203 | * @return array |
||
204 | */ |
||
205 | public static function get_options_contentless() { |
||
217 | |||
218 | /** |
||
219 | * Array of defaulted constants whitelisted. |
||
220 | * |
||
221 | * @var array Default constants whitelist |
||
222 | */ |
||
223 | public static $default_constants_whitelist = array( |
||
224 | 'EMPTY_TRASH_DAYS', |
||
225 | 'WP_POST_REVISIONS', |
||
226 | 'AUTOMATIC_UPDATER_DISABLED', |
||
227 | 'ABSPATH', |
||
228 | 'WP_CONTENT_DIR', |
||
229 | 'FS_METHOD', |
||
230 | 'DISALLOW_FILE_EDIT', |
||
231 | 'DISALLOW_FILE_MODS', |
||
232 | 'WP_AUTO_UPDATE_CORE', |
||
233 | 'WP_HTTP_BLOCK_EXTERNAL', |
||
234 | 'WP_ACCESSIBLE_HOSTS', |
||
235 | 'JETPACK__VERSION', |
||
236 | 'IS_PRESSABLE', |
||
237 | 'DISABLE_WP_CRON', |
||
238 | 'ALTERNATE_WP_CRON', |
||
239 | 'WP_CRON_LOCK_TIMEOUT', |
||
240 | 'PHP_VERSION', |
||
241 | 'WP_MEMORY_LIMIT', |
||
242 | 'WP_MAX_MEMORY_LIMIT', |
||
243 | 'WP_DEBUG', |
||
244 | ); |
||
245 | |||
246 | /** |
||
247 | * Get constants whitelisted by Sync. |
||
248 | * |
||
249 | * @return array Constants accessible via sync. |
||
250 | */ |
||
251 | public static function get_constants_whitelist() { |
||
263 | |||
264 | /** |
||
265 | * Callables able to be managed via JSON API. |
||
266 | * |
||
267 | * @var array Default whitelist of callables. |
||
268 | */ |
||
269 | public static $default_callable_whitelist = array( |
||
270 | 'wp_max_upload_size' => 'wp_max_upload_size', |
||
271 | 'is_main_network' => array( __CLASS__, 'is_multi_network' ), |
||
272 | 'is_multi_site' => 'is_multisite', |
||
273 | 'main_network_site' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'main_network_site_url' ), |
||
274 | 'site_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'site_url' ), |
||
275 | 'home_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'home_url' ), |
||
276 | 'single_user_site' => array( 'Jetpack', 'is_single_user_site' ), |
||
277 | 'updates' => array( 'Jetpack', 'get_updates' ), |
||
278 | 'has_file_system_write_access' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'file_system_write_access' ), |
||
279 | 'is_version_controlled' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'is_version_controlled' ), |
||
280 | 'taxonomies' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_taxonomies' ), |
||
281 | 'post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_types' ), |
||
282 | 'post_type_features' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_type_features' ), |
||
283 | 'shortcodes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_shortcodes' ), |
||
284 | 'rest_api_allowed_post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_post_types' ), |
||
285 | 'rest_api_allowed_public_metadata' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_public_metadata' ), |
||
286 | 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), |
||
287 | 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), |
||
288 | 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), |
||
289 | 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), |
||
290 | 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), |
||
291 | 'wp_version' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'wp_version' ), |
||
292 | 'get_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins' ), |
||
293 | 'get_plugins_action_links' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins_action_links' ), |
||
294 | 'active_modules' => array( 'Jetpack', 'get_active_modules' ), |
||
295 | 'hosting_provider' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_hosting_provider' ), |
||
296 | 'locale' => 'get_locale', |
||
297 | 'site_icon_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'site_icon_url' ), |
||
298 | 'roles' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'roles' ), |
||
299 | 'timezone' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_timezone' ), |
||
300 | 'available_jetpack_blocks' => array( 'Jetpack_Gutenberg', 'get_availability' ), // Includes both Gutenberg blocks *and* plugins. |
||
301 | 'paused_themes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_themes' ), |
||
302 | 'paused_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_plugins' ), |
||
303 | ); |
||
304 | |||
305 | |||
306 | /** |
||
307 | * Array of post type attributes synced. |
||
308 | * |
||
309 | * @var array Default post type attributes. |
||
310 | */ |
||
311 | public static $default_post_type_attributes = array( |
||
312 | 'name' => '', |
||
313 | 'label' => '', |
||
314 | 'labels' => array(), |
||
315 | 'description' => '', |
||
316 | 'public' => false, |
||
317 | 'hierarchical' => false, |
||
318 | 'exclude_from_search' => true, |
||
319 | 'publicly_queryable' => null, |
||
320 | 'show_ui' => false, |
||
321 | 'show_in_menu' => null, |
||
322 | 'show_in_nav_menus' => null, |
||
323 | 'show_in_admin_bar' => false, |
||
324 | 'menu_position' => null, |
||
325 | 'menu_icon' => null, |
||
326 | 'supports' => array(), |
||
327 | 'capability_type' => 'post', |
||
328 | 'capabilities' => array(), |
||
329 | 'cap' => array(), |
||
330 | 'map_meta_cap' => true, |
||
331 | 'taxonomies' => array(), |
||
332 | 'has_archive' => false, |
||
333 | 'rewrite' => true, |
||
334 | 'query_var' => true, |
||
335 | 'can_export' => true, |
||
336 | 'delete_with_user' => null, |
||
337 | 'show_in_rest' => false, |
||
338 | 'rest_base' => false, |
||
339 | '_builtin' => false, |
||
340 | '_edit_link' => 'post.php?post=%d', |
||
341 | ); |
||
342 | |||
343 | /** |
||
344 | * Get the whitelist of callables allowed to be managed via the JSON API. |
||
345 | * |
||
346 | * @return array Whitelist of callables allowed to be managed via the JSON API. |
||
347 | */ |
||
348 | public static function get_callable_whitelist() { |
||
360 | |||
361 | /** |
||
362 | * Post types that will not be synced. |
||
363 | * |
||
364 | * These are usually automated post types (sitemaps, logs, etc). |
||
365 | * |
||
366 | * @var array Blacklisted post types. |
||
367 | */ |
||
368 | public static $blacklisted_post_types = array( |
||
369 | 'ai1ec_event', |
||
370 | 'bwg_album', |
||
371 | 'bwg_gallery', |
||
372 | 'customize_changeset', // WP built-in post type for Customizer changesets. |
||
373 | 'dn_wp_yt_log', |
||
374 | 'http', |
||
375 | 'idx_page', |
||
376 | 'jetpack_migration', |
||
377 | 'jp_img_sitemap', |
||
378 | 'jp_img_sitemap_index', |
||
379 | 'jp_sitemap', |
||
380 | 'jp_sitemap_index', |
||
381 | 'jp_sitemap_master', |
||
382 | 'jp_vid_sitemap', |
||
383 | 'jp_vid_sitemap_index', |
||
384 | 'postman_sent_mail', |
||
385 | 'rssap-feed', |
||
386 | 'rssmi_feed_item', |
||
387 | 'scheduled-action', // Action Scheduler - Job Queue for WordPress https://github.com/woocommerce/woocommerce/tree/e7762627c37ec1f7590e6cac4218ba0c6a20024d/includes/libraries/action-scheduler . |
||
388 | 'secupress_log_action', |
||
389 | 'sg_optimizer_jobs', |
||
390 | 'snitch', |
||
391 | 'vip-legacy-redirect', |
||
392 | 'wp_automatic', |
||
393 | 'wpephpcompat_jobs', |
||
394 | 'wprss_feed_item', |
||
395 | ); |
||
396 | |||
397 | /** |
||
398 | * Taxonomies that we're not syncing by default. |
||
399 | * |
||
400 | * The list is compiled by auditing the dynamic filters and actions that contain taxonomy slugs |
||
401 | * and could conflict with other existing filters/actions in WP core, Jetpack and WooCommerce. |
||
402 | * |
||
403 | * @var array |
||
404 | */ |
||
405 | public static $blacklisted_taxonomies = array( |
||
406 | 'ancestors', |
||
407 | 'archives_link', |
||
408 | 'attached_file', |
||
409 | 'attached_media', |
||
410 | 'attached_media_args', |
||
411 | 'attachment', |
||
412 | 'available_languages', |
||
413 | 'avatar', |
||
414 | 'avatar_comment_types', |
||
415 | 'avatar_data', |
||
416 | 'avatar_url', |
||
417 | 'bloginfo_rss', |
||
418 | 'blogs_of_user', |
||
419 | 'bookmark_link', |
||
420 | 'bookmarks', |
||
421 | 'calendar', |
||
422 | 'canonical_url', |
||
423 | 'categories_per_page', |
||
424 | 'categories_taxonomy', |
||
425 | 'category_form', |
||
426 | 'category_form_fields', |
||
427 | 'category_form_pre', |
||
428 | 'comment', |
||
429 | 'comment_author', |
||
430 | 'comment_author_email', |
||
431 | 'comment_author_IP', |
||
432 | 'comment_author_link', |
||
433 | 'comment_author_url', |
||
434 | 'comment_author_url_link', |
||
435 | 'comment_date', |
||
436 | 'comment_excerpt', |
||
437 | 'comment_ID', |
||
438 | 'comment_link', |
||
439 | 'comment_misc_actions', |
||
440 | 'comment_text', |
||
441 | 'comment_time', |
||
442 | 'comment_type', |
||
443 | 'comments_link', |
||
444 | 'comments_number', |
||
445 | 'comments_pagenum_link', |
||
446 | 'custom_logo', |
||
447 | 'date_sql', |
||
448 | 'default_comment_status', |
||
449 | 'delete_post_link', |
||
450 | 'edit_bookmark_link', |
||
451 | 'edit_comment_link', |
||
452 | 'edit_post_link', |
||
453 | 'edit_tag_link', |
||
454 | 'edit_term_link', |
||
455 | 'edit_user_link', |
||
456 | 'enclosed', |
||
457 | 'feed_build_date', |
||
458 | 'form_advanced', |
||
459 | 'form_after_editor', |
||
460 | 'form_after_title', |
||
461 | 'form_before_permalink', |
||
462 | 'form_top', |
||
463 | 'handle_product_cat', |
||
464 | 'header_image_tag', |
||
465 | 'header_video_url', |
||
466 | 'image_tag', |
||
467 | 'image_tag_class', |
||
468 | 'lastpostdate', |
||
469 | 'lastpostmodified', |
||
470 | 'link', |
||
471 | 'link_category_form', |
||
472 | 'link_category_form_fields', |
||
473 | 'link_category_form_pre', |
||
474 | 'main_network_id', |
||
475 | 'media', |
||
476 | 'media_item_args', |
||
477 | 'ms_user', |
||
478 | 'network', |
||
479 | 'object_terms', |
||
480 | 'option', |
||
481 | 'page', |
||
482 | 'page_form', |
||
483 | 'page_of_comment', |
||
484 | 'page_uri', |
||
485 | 'pagenum_link', |
||
486 | 'pages', |
||
487 | 'plugin', |
||
488 | 'post', |
||
489 | 'post_galleries', |
||
490 | 'post_gallery', |
||
491 | 'post_link', |
||
492 | 'post_modified_time', |
||
493 | 'post_status', |
||
494 | 'post_time', |
||
495 | 'postmeta', |
||
496 | 'posts_per_page', |
||
497 | 'product_cat', |
||
498 | 'product_search_form', |
||
499 | 'profile_url', |
||
500 | 'pung', |
||
501 | 'role_list', |
||
502 | 'sample_permalink', |
||
503 | 'sample_permalink_html', |
||
504 | 'schedule', |
||
505 | 'search_form', |
||
506 | 'search_query', |
||
507 | 'shortlink', |
||
508 | 'site', |
||
509 | 'site_email_content', |
||
510 | 'site_icon_url', |
||
511 | 'site_option', |
||
512 | 'space_allowed', |
||
513 | 'tag', |
||
514 | 'tag_form', |
||
515 | 'tag_form_fields', |
||
516 | 'tag_form_pre', |
||
517 | 'tag_link', |
||
518 | 'tags', |
||
519 | 'tags_per_page', |
||
520 | 'term', |
||
521 | 'term_link', |
||
522 | 'term_relationships', |
||
523 | 'term_taxonomies', |
||
524 | 'term_taxonomy', |
||
525 | 'terms', |
||
526 | 'terms_args', |
||
527 | 'terms_defaults', |
||
528 | 'terms_fields', |
||
529 | 'terms_orderby', |
||
530 | 'the_archive_description', |
||
531 | 'the_archive_title', |
||
532 | 'the_categories', |
||
533 | 'the_date', |
||
534 | 'the_excerpt', |
||
535 | 'the_guid', |
||
536 | 'the_modified_date', |
||
537 | 'the_modified_time', |
||
538 | 'the_post_type_description', |
||
539 | 'the_tags', |
||
540 | 'the_terms', |
||
541 | 'the_time', |
||
542 | 'theme_starter_content', |
||
543 | 'to_ping', |
||
544 | 'user', |
||
545 | 'user_created_user', |
||
546 | 'user_form', |
||
547 | 'user_profile', |
||
548 | 'user_profile_update', |
||
549 | 'usermeta', |
||
550 | 'usernumposts', |
||
551 | 'users_drafts', |
||
552 | 'webhook', |
||
553 | 'widget', |
||
554 | 'woocommerce_archive', |
||
555 | 'wp_title_rss', |
||
556 | ); |
||
557 | |||
558 | /** |
||
559 | * Default array of post table columns. |
||
560 | * |
||
561 | * @var array Post table columns. |
||
562 | */ |
||
563 | public static $default_post_checksum_columns = array( |
||
564 | 'ID', |
||
565 | 'post_modified', |
||
566 | ); |
||
567 | |||
568 | /** |
||
569 | * Default array of post meta table columns. |
||
570 | * |
||
571 | * @var array Post meta table columns. |
||
572 | */ |
||
573 | public static $default_post_meta_checksum_columns = array( |
||
574 | 'meta_id', |
||
575 | 'meta_value', |
||
576 | ); |
||
577 | |||
578 | /** |
||
579 | * Default array of comment table columns. |
||
580 | * |
||
581 | * @var array Default comment table columns. |
||
582 | */ |
||
583 | public static $default_comment_checksum_columns = array( |
||
584 | 'comment_ID', |
||
585 | 'comment_content', |
||
586 | ); |
||
587 | |||
588 | /** |
||
589 | * Default array of comment meta columns. |
||
590 | * |
||
591 | * @var array Comment meta table columns. |
||
592 | */ |
||
593 | public static $default_comment_meta_checksum_columns = array( |
||
594 | 'meta_id', |
||
595 | 'meta_value', |
||
596 | ); |
||
597 | |||
598 | /** |
||
599 | * Default array of option table columns. |
||
600 | * |
||
601 | * @var array Default array of option columns. |
||
602 | */ |
||
603 | public static $default_option_checksum_columns = array( |
||
604 | 'option_name', |
||
605 | 'option_value', |
||
606 | ); |
||
607 | |||
608 | /** |
||
609 | * Default array of term columns. |
||
610 | * |
||
611 | * @var array array of term columns. |
||
612 | */ |
||
613 | public static $default_term_checksum_columns = array( |
||
614 | 'term_id', |
||
615 | 'name', |
||
616 | 'slug', |
||
617 | ); |
||
618 | |||
619 | /** |
||
620 | * Default array of term taxonomy columns. |
||
621 | * |
||
622 | * @var array Array of term taxonomy columns. |
||
623 | */ |
||
624 | public static $default_term_taxonomy_checksum_columns = array( |
||
625 | 'term_taxonomy_id', |
||
626 | 'term_id', |
||
627 | 'taxonomy', |
||
628 | 'parent', |
||
629 | 'count', |
||
630 | ); |
||
631 | |||
632 | /** |
||
633 | * Default term relationship columns. |
||
634 | * |
||
635 | * @var array Array of term relationship columns. |
||
636 | */ |
||
637 | public static $default_term_relationships_checksum_columns = array( |
||
638 | 'object_id', |
||
639 | 'term_taxonomy_id', |
||
640 | 'term_order', |
||
641 | ); |
||
642 | |||
643 | /** |
||
644 | * Default multisite callables able to be managed via JSON API. |
||
645 | * |
||
646 | * @var array multsite callables whitelisted |
||
647 | */ |
||
648 | public static $default_multisite_callable_whitelist = array( |
||
649 | 'network_name' => array( 'Jetpack', 'network_name' ), |
||
650 | 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), |
||
651 | 'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ), |
||
652 | 'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ), |
||
653 | 'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ), |
||
654 | 'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ), |
||
655 | ); |
||
656 | |||
657 | /** |
||
658 | * Get array of multisite callables whitelisted. |
||
659 | * |
||
660 | * @return array Multisite callables managable via JSON API. |
||
661 | */ |
||
662 | public static function get_multisite_callable_whitelist() { |
||
674 | |||
675 | /** |
||
676 | * Array of post meta keys whitelisted. |
||
677 | * |
||
678 | * @var array Post meta whitelist. |
||
679 | */ |
||
680 | public static $post_meta_whitelist = array( |
||
681 | '_feedback_akismet_values', |
||
682 | '_feedback_email', |
||
683 | '_feedback_extra_fields', |
||
684 | '_g_feedback_shortcode', |
||
685 | '_jetpack_post_thumbnail', |
||
686 | '_menu_item_classes', |
||
687 | '_menu_item_menu_item_parent', |
||
688 | '_menu_item_object', |
||
689 | '_menu_item_object_id', |
||
690 | '_menu_item_orphaned', |
||
691 | '_menu_item_type', |
||
692 | '_menu_item_xfn', |
||
693 | '_publicize_facebook_user', |
||
694 | '_publicize_twitter_user', |
||
695 | '_thumbnail_id', |
||
696 | '_wp_attached_file', |
||
697 | '_wp_attachment_backup_sizes', |
||
698 | '_wp_attachment_context', |
||
699 | '_wp_attachment_image_alt', |
||
700 | '_wp_attachment_is_custom_background', |
||
701 | '_wp_attachment_is_custom_header', |
||
702 | '_wp_attachment_metadata', |
||
703 | '_wp_page_template', |
||
704 | '_wp_trash_meta_comments_status', |
||
705 | '_wpas_mess', |
||
706 | 'content_width', |
||
707 | 'custom_css_add', |
||
708 | 'custom_css_preprocessor', |
||
709 | 'enclosure', |
||
710 | 'imagedata', |
||
711 | 'nova_price', |
||
712 | 'publicize_results', |
||
713 | 'sharing_disabled', |
||
714 | 'switch_like_status', |
||
715 | 'videopress_guid', |
||
716 | 'vimeo_poster_image', |
||
717 | 'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY. |
||
718 | ); |
||
719 | |||
720 | /** |
||
721 | * Get the post meta key whitelist. |
||
722 | * |
||
723 | * @return array Post meta whitelist. |
||
724 | */ |
||
725 | public static function get_post_meta_whitelist() { |
||
737 | |||
738 | /** |
||
739 | * Comment meta whitelist. |
||
740 | * |
||
741 | * @var array Comment meta whitelist. |
||
742 | */ |
||
743 | public static $comment_meta_whitelist = array( |
||
744 | 'hc_avatar', |
||
745 | 'hc_post_as', |
||
746 | 'hc_wpcom_id_sig', |
||
747 | 'hc_foreign_user_id', |
||
748 | ); |
||
749 | |||
750 | /** |
||
751 | * Get the comment meta whitelist. |
||
752 | * |
||
753 | * @return array |
||
754 | */ |
||
755 | public static function get_comment_meta_whitelist() { |
||
767 | |||
768 | /** |
||
769 | * Default theme support whitelist. |
||
770 | * |
||
771 | * @todo move this to server? - these are theme support values |
||
772 | * that should be synced as jetpack_current_theme_supports_foo option values |
||
773 | * |
||
774 | * @var array Default theme support whitelist. |
||
775 | */ |
||
776 | public static $default_theme_support_whitelist = array( |
||
777 | 'post-thumbnails', |
||
778 | 'post-formats', |
||
779 | 'custom-header', |
||
780 | 'custom-background', |
||
781 | 'custom-logo', |
||
782 | 'menus', |
||
783 | 'automatic-feed-links', |
||
784 | 'editor-style', |
||
785 | 'widgets', |
||
786 | 'html5', |
||
787 | 'title-tag', |
||
788 | 'jetpack-social-menu', |
||
789 | 'jetpack-responsive-videos', |
||
790 | 'infinite-scroll', |
||
791 | 'site-logo', |
||
792 | ); |
||
793 | |||
794 | /** |
||
795 | * Is an option whitelisted? |
||
796 | * |
||
797 | * @param string $option Option name. |
||
798 | * @return bool If option is on the whitelist. |
||
799 | */ |
||
800 | public static function is_whitelisted_option( $option ) { |
||
812 | |||
813 | /** |
||
814 | * Default whitelist of capabilities to sync. |
||
815 | * |
||
816 | * @var array Array of WordPress capabilities. |
||
817 | */ |
||
818 | public static $default_capabilities_whitelist = array( |
||
819 | 'switch_themes', |
||
820 | 'edit_themes', |
||
821 | 'edit_theme_options', |
||
822 | 'install_themes', |
||
823 | 'activate_plugins', |
||
824 | 'edit_plugins', |
||
825 | 'install_plugins', |
||
826 | 'edit_users', |
||
827 | 'edit_files', |
||
828 | 'manage_options', |
||
829 | 'moderate_comments', |
||
830 | 'manage_categories', |
||
831 | 'manage_links', |
||
832 | 'upload_files', |
||
833 | 'import', |
||
834 | 'unfiltered_html', |
||
835 | 'edit_posts', |
||
836 | 'edit_others_posts', |
||
837 | 'edit_published_posts', |
||
838 | 'publish_posts', |
||
839 | 'edit_pages', |
||
840 | 'read', |
||
841 | 'publish_pages', |
||
842 | 'edit_others_pages', |
||
843 | 'edit_published_pages', |
||
844 | 'delete_pages', |
||
845 | 'delete_others_pages', |
||
846 | 'delete_published_pages', |
||
847 | 'delete_posts', |
||
848 | 'delete_others_posts', |
||
849 | 'delete_published_posts', |
||
850 | 'delete_private_posts', |
||
851 | 'edit_private_posts', |
||
852 | 'read_private_posts', |
||
853 | 'delete_private_pages', |
||
854 | 'edit_private_pages', |
||
855 | 'read_private_pages', |
||
856 | 'delete_users', |
||
857 | 'create_users', |
||
858 | 'unfiltered_upload', |
||
859 | 'edit_dashboard', |
||
860 | 'customize', |
||
861 | 'delete_site', |
||
862 | 'update_plugins', |
||
863 | 'delete_plugins', |
||
864 | 'update_themes', |
||
865 | 'update_core', |
||
866 | 'list_users', |
||
867 | 'remove_users', |
||
868 | 'add_users', |
||
869 | 'promote_users', |
||
870 | 'delete_themes', |
||
871 | 'export', |
||
872 | 'edit_comment', |
||
873 | 'upload_plugins', |
||
874 | 'upload_themes', |
||
875 | ); |
||
876 | |||
877 | /** |
||
878 | * Get default capabilities whitelist. |
||
879 | * |
||
880 | * @return array |
||
881 | */ |
||
882 | public static function get_capabilities_whitelist() { |
||
894 | |||
895 | /** |
||
896 | * Get max execution sync time. |
||
897 | * |
||
898 | * @return float Number of seconds. |
||
899 | */ |
||
900 | public static function get_max_sync_execution_time() { |
||
908 | |||
909 | /** |
||
910 | * Get default for a given setting. |
||
911 | * |
||
912 | * @param string $setting Setting to get. |
||
913 | * @return mixed Value will be a string, int, array, based on the particular setting requested. |
||
914 | */ |
||
915 | public static function get_default_setting( $setting ) { |
||
919 | |||
920 | /** |
||
921 | * Default list of network options. |
||
922 | * |
||
923 | * @var array network options |
||
924 | */ |
||
925 | public static $default_network_options_whitelist = array( |
||
926 | 'site_name', |
||
927 | 'jetpack_protect_key', |
||
928 | 'jetpack_protect_global_whitelist', |
||
929 | 'active_sitewide_plugins', |
||
930 | ); |
||
931 | |||
932 | /** |
||
933 | * A mapping of known importers to friendly names. |
||
934 | * |
||
935 | * Keys are the class name of the known importer. |
||
936 | * Values are the friendly name. |
||
937 | * |
||
938 | * @since 7.3.0 |
||
939 | * |
||
940 | * @var array |
||
941 | */ |
||
942 | public static $default_known_importers = array( |
||
943 | 'Blogger_Importer' => 'blogger', |
||
944 | 'LJ_API_Import' => 'livejournal', |
||
945 | 'MT_Import' => 'mt', |
||
946 | 'RSS_Import' => 'rss', |
||
947 | 'WC_Tax_Rate_Importer' => 'woo-tax-rate', |
||
948 | 'WP_Import' => 'wordpress', |
||
949 | ); |
||
950 | |||
951 | /** |
||
952 | * Returns a list of known importers. |
||
953 | * |
||
954 | * @since 7.3.0 |
||
955 | * |
||
956 | * @return array Known importers with importer class names as keys and friendly names as values. |
||
957 | */ |
||
958 | public static function get_known_importers() { |
||
970 | |||
971 | /** |
||
972 | * Whether this is a system with a multiple networks. |
||
973 | * We currently need this static wrapper because we statically define our default list of callables. |
||
974 | * |
||
975 | * @since 7.6.0 |
||
976 | * |
||
977 | * @uses Automattic\Jetpack\Status::is_multi_network |
||
978 | * |
||
979 | * @return boolean |
||
980 | */ |
||
981 | public static function is_multi_network() { |
||
985 | |||
986 | /** |
||
987 | * Default bytes to dequeue. |
||
988 | * |
||
989 | * @var int Bytes. |
||
990 | */ |
||
991 | public static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB. |
||
992 | |||
993 | /** |
||
994 | * Default upload bytes. |
||
995 | * |
||
996 | * This value is a little bigger than the upload limit to account for serialization. |
||
997 | * |
||
998 | * @var int Bytes. |
||
999 | */ |
||
1000 | public static $default_upload_max_bytes = 600000; |
||
1001 | |||
1002 | /** |
||
1003 | * Default number of rows uploaded. |
||
1004 | * |
||
1005 | * @var int Number of rows. |
||
1006 | */ |
||
1007 | public static $default_upload_max_rows = 500; |
||
1008 | |||
1009 | /** |
||
1010 | * Default sync wait time. |
||
1011 | * |
||
1012 | * @var int Number of seconds. |
||
1013 | */ |
||
1014 | public static $default_sync_wait_time = 10; // seconds, between syncs. |
||
1015 | |||
1016 | /** |
||
1017 | * Only wait before next send if the current send took more than this number of seconds. |
||
1018 | * |
||
1019 | * @var int Number of seconds. |
||
1020 | */ |
||
1021 | public static $default_sync_wait_threshold = 5; |
||
1022 | |||
1023 | /** |
||
1024 | * Default wait between attempting to continue a full sync via requests. |
||
1025 | * |
||
1026 | * @var int Number of seconds. |
||
1027 | */ |
||
1028 | public static $default_enqueue_wait_time = 10; |
||
1029 | |||
1030 | /** |
||
1031 | * Maximum queue size. |
||
1032 | * |
||
1033 | * Each item is represented with a new row in the wp_options table. |
||
1034 | * |
||
1035 | * @var int Number of queue items. |
||
1036 | */ |
||
1037 | public static $default_max_queue_size = 1000; |
||
1038 | |||
1039 | /** |
||
1040 | * Default maximum lag allowed in the queue. |
||
1041 | * |
||
1042 | * @var int Number of seconds |
||
1043 | */ |
||
1044 | public static $default_max_queue_lag = 900; // 15 minutes. |
||
1045 | |||
1046 | /** |
||
1047 | * Default for default writes per sec. |
||
1048 | * |
||
1049 | * @var int Rows per second. |
||
1050 | */ |
||
1051 | public static $default_queue_max_writes_sec = 100; // 100 rows a second. |
||
1052 | |||
1053 | /** |
||
1054 | * Default for post types blacklist. |
||
1055 | * |
||
1056 | * @var array Empty array. |
||
1057 | */ |
||
1058 | public static $default_post_types_blacklist = array(); |
||
1059 | |||
1060 | /** |
||
1061 | * Default for taxonomies blacklist. |
||
1062 | * |
||
1063 | * @var array Empty array. |
||
1064 | */ |
||
1065 | public static $default_taxonomies_blacklist = array(); |
||
1066 | |||
1067 | /** |
||
1068 | * Default for taxonomies whitelist. |
||
1069 | * |
||
1070 | * @var array Empty array. |
||
1071 | */ |
||
1072 | public static $default_taxonomy_whitelist = array(); |
||
1073 | |||
1074 | /** |
||
1075 | * Default for post meta whitelist. |
||
1076 | * |
||
1077 | * @var array Empty array. |
||
1078 | */ |
||
1079 | public static $default_post_meta_whitelist = array(); |
||
1080 | |||
1081 | /** |
||
1082 | * Default for comment meta whitelist. |
||
1083 | * |
||
1084 | * @var array Empty array. |
||
1085 | */ |
||
1086 | public static $default_comment_meta_whitelist = array(); |
||
1087 | |||
1088 | /** |
||
1089 | * Default for disabling sync across the site. |
||
1090 | * |
||
1091 | * @var int Bool-ish. Default to 0. |
||
1092 | */ |
||
1093 | public static $default_disable = 0; // completely disable sending data to wpcom. |
||
1094 | |||
1095 | /** |
||
1096 | * Default for disabling sync across the entire network on multisite. |
||
1097 | * |
||
1098 | * @var int Bool-ish. Default 0. |
||
1099 | */ |
||
1100 | public static $default_network_disable = 0; |
||
1101 | |||
1102 | /** |
||
1103 | * Should Sync use cron? |
||
1104 | * |
||
1105 | * @var int Bool-ish value. Default 1. |
||
1106 | */ |
||
1107 | public static $default_sync_via_cron = 1; |
||
1108 | |||
1109 | /** |
||
1110 | * Default if Sync should render content. |
||
1111 | * |
||
1112 | * @var int Bool-ish value. Default is 0. |
||
1113 | */ |
||
1114 | public static $default_render_filtered_content = 0; |
||
1115 | |||
1116 | /** |
||
1117 | * Default number of items to enqueue at a time when running full sync. |
||
1118 | * |
||
1119 | * @var int Number of items. |
||
1120 | */ |
||
1121 | public static $default_max_enqueue_full_sync = 100; |
||
1122 | |||
1123 | /** |
||
1124 | * Default for maximum queue size during a full sync. |
||
1125 | * |
||
1126 | * Each item will represent a value in the wp_options table. |
||
1127 | * |
||
1128 | * @var int Number of items. |
||
1129 | */ |
||
1130 | public static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue. |
||
1131 | |||
1132 | /** |
||
1133 | * Defaul for time between syncing callables. |
||
1134 | * |
||
1135 | * @var int Number of seconds. |
||
1136 | */ |
||
1137 | public static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again. |
||
1138 | |||
1139 | /** |
||
1140 | * Default for time between syncing constants. |
||
1141 | * |
||
1142 | * @var int Number of seconds. |
||
1143 | */ |
||
1144 | public static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again. |
||
1145 | /** |
||
1146 | * Default for sync queue lock timeout time. |
||
1147 | * |
||
1148 | * @var int Number of seconds. |
||
1149 | */ |
||
1150 | public static $default_sync_queue_lock_timeout = 120; // 2 minutes. |
||
1151 | |||
1152 | /** |
||
1153 | * Default for cron sync time limit. |
||
1154 | * |
||
1155 | * @var int Number of seconds. |
||
1156 | */ |
||
1157 | public static $default_cron_sync_time_limit = 30; // 30 seconds. |
||
1158 | |||
1159 | /** |
||
1160 | * Default for number of term relationship items sent in an full sync item. |
||
1161 | * |
||
1162 | * @var int Number of items. |
||
1163 | */ |
||
1164 | public static $default_term_relationships_full_sync_item_size = 100; |
||
1165 | |||
1166 | /** |
||
1167 | * Default for enabling incremental sync. |
||
1168 | * |
||
1169 | * @var int 1 for true. |
||
1170 | */ |
||
1171 | public static $default_sync_sender_enabled = 1; // Should send incremental sync items. |
||
1172 | |||
1173 | /** |
||
1174 | * Default for enabling Full Sync. |
||
1175 | * |
||
1176 | * @var int 1 for true. |
||
1177 | */ |
||
1178 | public static $default_full_sync_sender_enabled = 1; // Should send full sync items. |
||
1179 | } |
||
1180 |