PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.5
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.5
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
jetpack / jetpack_vendor / automattic / jetpack-sync / src / class-defaults.php

class-defaults.php in Jetpack – WP Security, Backup, Speed, & Growth 16.3-a.5, at jetpack_vendor/automattic/jetpack-sync/src/class-defaults.php

1,440 lines 37.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Jetpack Sync Defaults
4 *
5 * @package automattic/jetpack-sync
6 */
7
8 namespace Automattic\Jetpack\Sync;
9
10 use Automattic\Jetpack\Status;
11
12 /**
13 * Just some defaults that we share with the server.
14 */
15 class Defaults {
16
17 /**
18 * Default Options.
19 *
20 * @var array
21 */
22 public static $default_options_whitelist = array(
23 'active_plugins',
24 'admin_email',
25 'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION.
26 'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION.
27 'avatar_default',
28 'avatar_rating',
29 'blog_charset',
30 'blog_public',
31 'wpcom_data_sharing_opt_out',
32 'blogdescription',
33 'blogname',
34 'carousel_background_color',
35 'carousel_display_comments',
36 'carousel_display_exif',
37 'category_base',
38 'ce4wp_referred_by', // Creative Mail. See pbtFPC-H5-p2.
39 'close_comments_days_old',
40 'close_comments_for_old_posts',
41 'comment_max_links',
42 'comment_moderation',
43 'comment_order',
44 'comment_previously_approved',
45 'comment_registration',
46 'comments_notify',
47 'comments_per_page',
48 'date_format',
49 'default_category',
50 'default_comment_status',
51 'default_comments_page',
52 'default_email_category',
53 'default_ping_status',
54 'default_pingback_flag',
55 'default_post_format',
56 'default_role',
57 'disabled_likes',
58 'disabled_reblogs',
59 'disallowed_keys',
60 'enable_header_ad',
61 'gmt_offset',
62 'gravatar_disable_hovercards',
63 'highlander_comment_form_prompt',
64 'image_default_link_type',
65 'infinite_scroll',
66 'infinite_scroll_google_analytics',
67 'jetpack-memberships-has-connected-account',
68 'jetpack-twitter-cards-site-tag',
69 'jetpack_activated',
70 'jetpack_allowed_xsite_search_ids',
71 'jetpack_api_cache_enabled',
72 'jetpack_autoupdate_core',
73 'jetpack_autoupdate_plugins',
74 'jetpack_autoupdate_plugins_translations',
75 'jetpack_autoupdate_themes',
76 'jetpack_autoupdate_themes_translations',
77 'jetpack_autoupdate_translations',
78 'jetpack_available_modules',
79 'jetpack_comment_form_color_scheme',
80 'jetpack_comment_likes_enabled',
81 'jetpack_excluded_extensions',
82 'jetpack_holiday_snow_enabled',
83 'jetpack_mailchimp',
84 'jetpack_options',
85 'jetpack_portfolio',
86 'jetpack_portfolio_posts_per_page',
87 'jetpack_premium_analytics_enabled',
88 'jetpack_protect_global_whitelist',
89 'jetpack_protect_key',
90 'jetpack_publicize_options',
91 'jetpack_relatedposts',
92 'jetpack_social_message_template',
93 'jetpack_social_notes_config',
94 'jetpack_social_settings',
95 'jetpack_social_utm_settings',
96 'jetpack_sso_match_by_email',
97 'jetpack_sso_require_two_step',
98 'jetpack_sync_non_blocking', // is non-blocking Jetpack Sync flow enabled.
99 'jetpack_sync_non_public_post_stati',
100 'jetpack_sync_settings_comment_meta_whitelist',
101 'jetpack_sync_settings_post_meta_whitelist',
102 'jetpack_sync_settings_post_types_blacklist',
103 'jetpack_sync_settings_taxonomies_blacklist',
104 'jetpack_sync_settings_dedicated_sync_enabled', // is Dedicated Sync flow enabled.
105 'jetpack_sync_settings_custom_queue_table_enabled', // is custom queue table enabled.
106 'jetpack_sync_settings_wpcom_rest_api_enabled', // is wpcom rest api enabled.
107 'jetpack_testimonial',
108 'jetpack_testimonial_posts_per_page',
109 'jetpack_wga',
110 'large_size_h',
111 'large_size_w',
112 'launch-status',
113 'launchpad_checklist_tasks_statuses',
114 'launchpad_screen',
115 'mailserver_login', // Not syncing contents, only the option name.
116 'mailserver_pass', // Not syncing contents, only the option name.
117 'mailserver_port',
118 'mailserver_url',
119 'medium_size_h',
120 'medium_size_w',
121 'moderation_keys',
122 'moderation_notify',
123 'monitor_receive_notifications',
124 'new_admin_email',
125 'page_comments',
126 'page_for_posts',
127 'page_on_front',
128 'permalink_structure',
129 'ping_sites',
130 'post_by_email_address',
131 'post_count',
132 'posts_per_page',
133 'posts_per_rss',
134 'require_name_email',
135 'rss_use_excerpt',
136 'sharing-options',
137 'sharing-services',
138 'show_avatars',
139 'show_on_front',
140 'sidebars_widgets',
141 'site_icon', // (int) - ID of core's Site Icon attachment ID
142 'site_logo',
143 'site_segment',
144 'site_user_type',
145 'site_vertical',
146 'social_notifications_like',
147 'social_notifications_reblog',
148 'social_notifications_subscribe',
149 'start_of_week',
150 'stats_options',
151 'stb_enabled',
152 'stc_enabled',
153 'sm_enabled',
154 'sticky_posts',
155 'stylesheet',
156 'subscription_options',
157 'tag_base',
158 'thread_comments',
159 'thread_comments_depth',
160 'thumbnail_crop',
161 'thumbnail_size_h',
162 'thumbnail_size_w',
163 'tiled_galleries',
164 'time_format',
165 'timezone_string',
166 'twitter_via',
167 'uninstall_plugins',
168 'uploads_use_yearmonth_folders',
169 'users_can_register',
170 'verification_services_codes',
171 'videopress_auto_subtitles_disabled',
172 'videopress_player_preload_disabled',
173 'videopress_playlist_index',
174 'videopress_private_enabled_for_site',
175 'wordads_ccpa_enabled',
176 'wordads_ccpa_privacy_policy_url',
177 'wordads_cmp_enabled',
178 'wordads_custom_adstxt',
179 'wordads_custom_adstxt_enabled',
180 'wordads_display_archive',
181 'wordads_display_front_page',
182 'wordads_display_page',
183 'wordads_display_post',
184 'wordads_second_belowpost',
185 'wordads_inline_enabled',
186 'woocommerce_custom_orders_table_enabled',
187 'wp_mobile_app_promos',
188 'wp_mobile_excerpt',
189 'wp_mobile_featured_images',
190 'wp_page_for_privacy_policy',
191 'wpcom_ai_launchpad_completed',
192 'wpcom_ai_launchpad_dismissed',
193 'wpcom_ai_launchpad_enabled',
194 'wpcom_ai_site_prompt',
195 'wpcom_classic_early_release',
196 'wpcom_newsletter_send_default',
197 'wpcom_featured_image_in_email',
198 'jetpack_gravatar_in_email',
199 'jetpack_author_in_email',
200 'jetpack_post_date_in_email',
201 'wpcom_gifting_subscription',
202 'wpcom_is_fse_activated',
203 'wpcom_legacy_contact',
204 'wpcom_locked_mode',
205 'wpcom_newsletter_categories',
206 'wpcom_newsletter_categories_enabled',
207 'wpcom_publish_comments_with_markdown',
208 'wpcom_publish_posts_with_markdown',
209 'wpcom_reader_views_enabled',
210 'wpcom_site_setup',
211 'wpcom_subscription_emails_use_excerpt',
212 'jetpack_subscriptions_reply_to',
213 'jetpack_subscriptions_from_name',
214 'jetpack_verbum_subscription_modal',
215 'jetpack_blocks_disabled',
216 'jetpack_newsletters_publishing_default_frequency',
217 'jetpack_scheduled_plugins_update',
218 'jetpack_waf_automatic_rules',
219 'jetpack_waf_ip_allow_list',
220 'jetpack_waf_ip_allow_list_enabled',
221 'jetpack_waf_ip_block_list',
222 'jetpack_waf_ip_block_list_enabled',
223 'jetpack_waf_share_data',
224 'jetpack_waf_share_debug_data',
225 'jetpack_waf_automatic_rules_last_updated_timestamp',
226 );
227
228 /**
229 * Return options whitelist filtered.
230 *
231 * @return array Options whitelist.
232 */
233 public static function get_options_whitelist() {
234 /** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */
235 $options_whitelist = apply_filters( 'jetpack_options_whitelist', self::$default_options_whitelist );
236 /**
237 * Filter the list of WordPress options that are manageable via the JSON API.
238 *
239 * @module sync
240 *
241 * @since 1.6.3
242 * @since-jetpack 4.8.0
243 *
244 * @param array The default list of options.
245 */
246 return apply_filters( 'jetpack_sync_options_whitelist', $options_whitelist );
247 }
248
249 /**
250 * "Contentless" Options.
251 *
252 * Do not sync contents for these events, only the option name. Good for sensitive information that Sync does not need.
253 *
254 * @var array Options to sync name only.
255 */
256 public static $default_options_contentless = array(
257 'mailserver_login',
258 'mailserver_pass',
259 );
260
261 /**
262 * Return contentless options.
263 *
264 * These are options that Sync only uses the option names, not the content of the option.
265 *
266 * @return array
267 */
268 public static function get_options_contentless() {
269 /**
270 * Filter the list of WordPress options that should be synced without content
271 *
272 * @module sync
273 *
274 * @since 1.6.3
275 * @since-jetpack 6.1.0
276 *
277 * @param array The list of options synced without content.
278 */
279 return apply_filters( 'jetpack_sync_options_contentless', self::$default_options_contentless );
280 }
281
282 /**
283 * Array of defaulted constants whitelisted.
284 *
285 * @var array Default constants whitelist
286 */
287 public static $default_constants_whitelist = array(
288 'ABSPATH',
289 'ALTERNATE_WP_CRON',
290 'ATOMIC_CLIENT_ID',
291 'AUTOMATIC_UPDATER_DISABLED',
292 'DISABLE_WP_CRON',
293 'DISALLOW_FILE_EDIT',
294 'DISALLOW_FILE_MODS',
295 'EMPTY_TRASH_DAYS',
296 'FS_METHOD',
297 'IS_PRESSABLE',
298 'JETPACK__VERSION',
299 'PHP_VERSION',
300 'WP_ACCESSIBLE_HOSTS',
301 'WP_AUTO_UPDATE_CORE',
302 'WP_CONTENT_DIR',
303 'WP_CRON_LOCK_TIMEOUT',
304 'WP_DEBUG',
305 'WP_HTTP_BLOCK_EXTERNAL',
306 'WP_MAX_MEMORY_LIMIT',
307 'WP_MEMORY_LIMIT',
308 'WP_POST_REVISIONS',
309 );
310
311 /**
312 * Get constants whitelisted by Sync.
313 *
314 * @return array Constants accessible via sync.
315 */
316 public static function get_constants_whitelist() {
317 /**
318 * Filter the list of PHP constants that are manageable via the JSON API.
319 *
320 * @module sync
321 *
322 * @since 1.6.3
323 * @since-jetpack 4.8.0
324 *
325 * @param array The default list of constants options.
326 */
327 return apply_filters( 'jetpack_sync_constants_whitelist', self::$default_constants_whitelist );
328 }
329
330 /**
331 * Callables able to be managed via JSON API.
332 *
333 * @var array Default whitelist of callables.
334 */
335 public static $default_callable_whitelist = array(
336 'get_loaded_extensions' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_loaded_extensions' ),
337 'get_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins' ),
338 'get_themes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_themes' ),
339 'get_plugins_action_links' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_plugins_action_links' ),
340 'has_file_system_write_access' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'file_system_write_access' ),
341 'home_url' => array( 'Automattic\\Jetpack\\Connection\\Urls', 'home_url' ),
342 'hosting_provider' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_hosting_provider' ),
343 'is_fse_theme' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_is_fse_theme' ),
344 'is_main_network' => array( __CLASS__, 'is_multi_network' ),
345 'is_multi_site' => 'is_multisite',
346 'is_version_controlled' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'is_version_controlled' ),
347 'locale' => 'get_locale',
348 'main_network_site' => array( 'Automattic\\Jetpack\\Connection\\Urls', 'main_network_site_url' ),
349 'main_network_site_wpcom_id' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'main_network_site_wpcom_id' ),
350 'paused_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_plugins' ),
351 'paused_themes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_paused_themes' ),
352 'post_type_features' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_type_features' ),
353 'post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_post_types' ),
354 'rest_api_allowed_post_types' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_post_types' ),
355 'rest_api_allowed_public_metadata' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'rest_api_allowed_public_metadata' ),
356 'roles' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'roles' ),
357 'shortcodes' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_shortcodes' ),
358 'site_icon_url' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'site_icon_url' ),
359 'site_url' => array( 'Automattic\\Jetpack\\Connection\\Urls', 'site_url' ),
360 'taxonomies' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_taxonomies' ),
361 'theme_support' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_theme_support' ),
362 'timezone' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_timezone' ),
363 'wp_get_environment_type' => 'wp_get_environment_type',
364 'wp_max_upload_size' => 'wp_max_upload_size',
365 'wp_version' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'wp_version' ),
366 'active_modules' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_active_modules' ),
367 'jetpack_connection_active_plugins' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_jetpack_connection_active_plugins' ),
368 'jetpack_package_versions' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_jetpack_package_versions' ),
369 'jetpack_sync_active_modules' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_jetpack_sync_active_modules' ),
370 // Carries the `blog_public` value, but reports -1 when the site is private.
371 'jetpack_site_visibility' => array( 'Automattic\\Jetpack\\Sync\\Functions', 'get_site_visibility' ),
372 );
373
374 /**
375 * Array of post type attributes synced.
376 *
377 * @var array Default post type attributes.
378 */
379 public static $default_post_type_attributes = array(
380 '_builtin' => false,
381 '_edit_link' => 'post.php?post=%d',
382 'can_export' => true,
383 'cap' => array(),
384 'capabilities' => array(),
385 'capability_type' => 'post',
386 'delete_with_user' => null,
387 'description' => '',
388 'exclude_from_search' => true,
389 'has_archive' => false,
390 'hierarchical' => false,
391 'label' => '',
392 'labels' => array(),
393 'map_meta_cap' => true,
394 'menu_icon' => null,
395 'menu_position' => null,
396 'name' => '',
397 'public' => false,
398 'publicly_queryable' => null,
399 'query_var' => true,
400 'rest_base' => false,
401 'rewrite' => true,
402 'show_in_admin_bar' => false,
403 'show_in_menu' => null,
404 'show_in_nav_menus' => null,
405 'show_in_rest' => false,
406 'show_ui' => false,
407 'supports' => array(),
408 'taxonomies' => array(),
409 );
410
411 /**
412 * Get the whitelist of callables allowed to be managed via the JSON API.
413 *
414 * @return array Whitelist of callables allowed to be managed via the JSON API.
415 */
416 public static function get_callable_whitelist() {
417 /**
418 * Filter the list of callables that are manageable via the JSON API.
419 *
420 * @module sync
421 *
422 * @since 1.6.3
423 * @since-jetpack 4.8.0
424 *
425 * @param array The default list of callables.
426 */
427 return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist );
428 }
429
430 /**
431 * Post types that will not be synced.
432 *
433 * These are usually automated post types (sitemaps, logs, etc).
434 *
435 * @var array Blacklisted post types.
436 */
437 public static $blacklisted_post_types = array(
438 '_term_meta',
439 'ai1ec_event',
440 'ai_log', // Logger - https://github.com/alleyinteractive/logger.
441 'amp_validated_url', // AMP Validation Errors.
442 'bwg_album',
443 'bwg_gallery',
444 'customize_changeset', // WP built-in post type for Customizer changesets.
445 'dn_wp_yt_log',
446 'flamingo_contact', // https://wordpress.org/plugins/flamingo/.
447 'flamingo_inbound',
448 'flamingo_outbound',
449 'http',
450 'idx_page',
451 'jetpack_inspect_log', // Jetpack Inspect dev tool. p1HpG7-nkd-p2
452 'jetpack_migration',
453 'jp_img_sitemap',
454 'jp_img_sitemap_index',
455 'jp_sitemap',
456 'jp_sitemap_index',
457 'jp_sitemap_master',
458 'jp_vid_sitemap',
459 'jp_vid_sitemap_index',
460 'msm_sitemap', // Metro Sitemap Plugin.
461 'postman_sent_mail',
462 'rssap-feed',
463 'rssmi_feed_item',
464 'scheduled-action', // Action Scheduler - Job Queue for WordPress https://github.com/woocommerce/woocommerce/tree/e7762627c37ec1f7590e6cac4218ba0c6a20024d/includes/libraries/action-scheduler .
465 'secupress_log_action',
466 'sg_optimizer_jobs',
467 'sl-insta-media',
468 'snitch',
469 'vip-legacy-redirect',
470 'wp-rest-api-log', // https://wordpress.org/plugins/wp-rest-api-log/.
471 'wp_automatic',
472 'wp_log', // WP Logging Plugin.
473 'wpephpcompat_jobs',
474 'wprss_feed_item',
475 'tribe-ea-record', // The Events Calendar Plugin - Store Event Aggregator record information.
476 'wphb_minify_group', // Hummingbird Plugin - Used internally to keep data about assets minification.
477 'bigcommerce_task', // BigCommerce Plugin - Store import queue.
478 'secupress_log_err404', // SecuPress Plugin - Log 404 pages
479 'iw_omnibus_price_log', // Omnibus Plugin - Log price changes.
480 'od_url_metrics', // Optimization Detective - Log URL metrics.
481 'ap_outbox', // ActivityPub Outbox; only used for broadcasting ActivityPub activity to followers.
482 'shop_order_placehold', // WooCommerce placeholder - Used to maintain compatibility and references when switching between WP Posts-based order storage and the newer HPOS tables.
483 );
484
485 /**
486 * Taxonomies that we're not syncing by default.
487 *
488 * The list is compiled by auditing the dynamic filters and actions that contain taxonomy slugs
489 * and could conflict with other existing filters/actions in WP core, Jetpack and WooCommerce.
490 *
491 * @var array
492 */
493 public static $blacklisted_taxonomies = array(
494 'ancestors',
495 'archives_link',
496 'attached_file',
497 'attached_media',
498 'attached_media_args',
499 'attachment',
500 'available_languages',
501 'avatar',
502 'avatar_comment_types',
503 'avatar_data',
504 'avatar_url',
505 'bloginfo_rss',
506 'blogs_of_user',
507 'bookmark_link',
508 'bookmarks',
509 'calendar',
510 'canonical_url',
511 'categories_per_page',
512 'categories_taxonomy',
513 'category_form',
514 'category_form_fields',
515 'category_form_pre',
516 'comment',
517 'comment_ID',
518 'comment_author',
519 'comment_author_IP',
520 'comment_author_email',
521 'comment_author_link',
522 'comment_author_url',
523 'comment_author_url_link',
524 'comment_date',
525 'comment_excerpt',
526 'comment_link',
527 'comment_misc_actions',
528 'comment_text',
529 'comment_time',
530 'comment_type',
531 'comments_link',
532 'comments_number',
533 'comments_pagenum_link',
534 'custom_logo',
535 'date_sql',
536 'default_comment_status',
537 'delete_post_link',
538 'edit_bookmark_link',
539 'edit_comment_link',
540 'edit_post_link',
541 'edit_tag_link',
542 'edit_term_link',
543 'edit_user_link',
544 'enclosed',
545 'feed_build_date',
546 'form_advanced',
547 'form_after_editor',
548 'form_after_title',
549 'form_before_permalink',
550 'form_top',
551 'handle_product_cat',
552 'header_image_tag',
553 'header_video_url',
554 'image_tag',
555 'image_tag_class',
556 'lastpostdate',
557 'lastpostmodified',
558 'link',
559 'link_category_form',
560 'link_category_form_fields',
561 'link_category_form_pre',
562 'main_network_id',
563 'media',
564 'media_item_args',
565 'ms_user',
566 'network',
567 'object_terms',
568 'option',
569 'page',
570 'page_form',
571 'page_of_comment',
572 'page_uri',
573 'pagenum_link',
574 'pages',
575 'plugin',
576 'post',
577 'post_galleries',
578 'post_gallery',
579 'post_link',
580 'post_modified_time',
581 'post_status',
582 'post_time',
583 'postmeta',
584 'posts_per_page',
585 'product_search_form',
586 'profile_url',
587 'pung',
588 'role_list',
589 'sample_permalink',
590 'sample_permalink_html',
591 'schedule',
592 'search_form',
593 'search_query',
594 'shortlink',
595 'site',
596 'site_email_content',
597 'site_icon_url',
598 'site_option',
599 'space_allowed',
600 'tag',
601 'tag_form',
602 'tag_form_fields',
603 'tag_form_pre',
604 'tag_link',
605 'tags',
606 'tags_per_page',
607 'term',
608 'term_link',
609 'term_relationships',
610 'term_taxonomies',
611 'term_taxonomy',
612 'terms',
613 'terms_args',
614 'terms_defaults',
615 'terms_fields',
616 'terms_orderby',
617 'the_archive_description',
618 'the_archive_title',
619 'the_categories',
620 'the_date',
621 'the_excerpt',
622 'the_guid',
623 'the_modified_date',
624 'the_modified_time',
625 'the_post_type_description',
626 'the_tags',
627 'the_terms',
628 'the_time',
629 'theme_starter_content',
630 'to_ping',
631 'user',
632 'user_created_user',
633 'user_form',
634 'user_profile',
635 'user_profile_update',
636 'usermeta',
637 'usernumposts',
638 'users_drafts',
639 'webhook',
640 'widget',
641 'woocommerce_archive',
642 'wp_title_rss',
643 );
644
645 /**
646 * Default array of post table columns.
647 *
648 * @var array Post table columns.
649 */
650 public static $default_post_checksum_columns = array(
651 'ID',
652 'post_modified',
653 );
654
655 /**
656 * Default array of post meta table columns.
657 *
658 * @var array Post meta table columns.
659 */
660 public static $default_post_meta_checksum_columns = array(
661 'meta_id',
662 'meta_value',
663 );
664
665 /**
666 * Default array of comment table columns.
667 *
668 * @var array Default comment table columns.
669 */
670 public static $default_comment_checksum_columns = array(
671 'comment_ID',
672 'comment_content',
673 );
674
675 /**
676 * Default array of comment meta columns.
677 *
678 * @var array Comment meta table columns.
679 */
680 public static $default_comment_meta_checksum_columns = array(
681 'meta_id',
682 'meta_value',
683 );
684
685 /**
686 * Default array of option table columns.
687 *
688 * @var array Default array of option columns.
689 */
690 public static $default_option_checksum_columns = array(
691 'option_name',
692 'option_value',
693 );
694
695 /**
696 * Default array of term columns.
697 *
698 * @var array array of term columns.
699 */
700 public static $default_term_checksum_columns = array(
701 'name',
702 'slug',
703 'term_id',
704 );
705
706 /**
707 * Default array of term taxonomy columns.
708 *
709 * @var array Array of term taxonomy columns.
710 */
711 public static $default_term_taxonomy_checksum_columns = array(
712 'count',
713 'parent',
714 'taxonomy',
715 'term_id',
716 'term_taxonomy_id',
717 );
718
719 /**
720 * Default term relationship columns.
721 *
722 * @var array Array of term relationship columns.
723 */
724 public static $default_term_relationships_checksum_columns = array(
725 'object_id',
726 'term_order',
727 'term_taxonomy_id',
728 );
729
730 /**
731 * Default multisite callables able to be managed via JSON API.
732 *
733 * @var array multsite callables whitelisted
734 */
735 public static $default_multisite_callable_whitelist = array();
736
737 /**
738 * Get array of multisite callables whitelisted.
739 *
740 * @return array Multisite callables managable via JSON API.
741 */
742 public static function get_multisite_callable_whitelist() {
743 /**
744 * Filter the list of multisite callables that are manageable via the JSON API.
745 *
746 * @module sync
747 *
748 * @since 1.6.3
749 * @since-jetpack 4.8.0
750 *
751 * @param array The default list of multisite callables.
752 */
753 return apply_filters( 'jetpack_sync_multisite_callable_whitelist', self::$default_multisite_callable_whitelist );
754 }
755
756 /**
757 * Array of post meta keys whitelisted.
758 *
759 * @var array Post meta whitelist.
760 */
761 public static $post_meta_whitelist = array(
762 '_feedback_akismet_values',
763 '_feedback_email',
764 '_feedback_extra_fields',
765 '_g_feedback_shortcode',
766 '_jetpack_post_thumbnail',
767 '_last_editor_used_jetpack',
768 '_menu_item_classes',
769 '_menu_item_menu_item_parent',
770 '_menu_item_object',
771 '_menu_item_object_id',
772 '_menu_item_orphaned',
773 '_menu_item_type',
774 '_menu_item_xfn',
775 '_publicize_facebook_user',
776 '_publicize_twitter_user',
777 '_thumbnail_id',
778 '_wp_attached_file',
779 '_wp_attachment_backup_sizes',
780 '_wp_attachment_context',
781 '_wp_attachment_image_alt',
782 '_wp_attachment_is_custom_background',
783 '_wp_attachment_is_custom_header',
784 '_wp_attachment_metadata',
785 '_wp_old_date',
786 '_wp_page_template',
787 '_wp_trash_meta_comments_status',
788 '_wpas_feature_enabled',
789 '_wpas_connection_overrides',
790 '_wpas_customize_per_network',
791 '_wpas_mess',
792 '_wpas_options',
793 '_jetpack_social_image_focal_point', // Publicize_Base::ATTACHMENT_IMAGE_FOCAL_POINT.
794 'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY.
795 'content_width',
796 'custom_css_add',
797 'custom_css_preprocessor',
798 'enclosure',
799 'imagedata',
800 'nova_price',
801 'publicize_results',
802 'sharing_disabled',
803 'switch_like_status',
804 'videopress_guid',
805 'vimeo_poster_image',
806 '_jetpack_blogging_prompt_key',
807 'footnotes', // Core footnotes block
808 );
809
810 /**
811 * Get the post meta key whitelist.
812 *
813 * @return array Post meta whitelist.
814 */
815 public static function get_post_meta_whitelist() {
816 /**
817 * Filter the list of post meta data that are manageable via the JSON API.
818 *
819 * @module sync
820 *
821 * @since 1.6.3
822 * @since-jetpack 4.8.0
823 *
824 * @param array The default list of meta data keys.
825 */
826 return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist );
827 }
828
829 /**
830 * Comment meta whitelist.
831 *
832 * @var array Comment meta whitelist.
833 */
834 public static $comment_meta_whitelist = array(
835 'hc_avatar',
836 'hc_foreign_user_id',
837 'hc_post_as',
838 'hc_wpcom_id_sig',
839 'jetpack_comment_identity_avatar',
840 'jetpack_comment_identity_id',
841 'jetpack_comment_identity_provider',
842 'protocol',
843 );
844
845 /**
846 * Get the comment meta whitelist.
847 *
848 * @return array
849 */
850 public static function get_comment_meta_whitelist() {
851 /**
852 * Filter the list of comment meta data that are manageable via the JSON API.
853 *
854 * @module sync
855 *
856 * @since 1.6.3
857 * @since-jetpack 5.7.0
858 *
859 * @param array The default list of comment meta data keys.
860 */
861 return apply_filters( 'jetpack_sync_comment_meta_whitelist', self::$comment_meta_whitelist );
862 }
863
864 /**
865 * Comment types whitelist.
866 *
867 * @var array Comment types that are synced.
868 */
869 public static $comment_types_whitelist = array( '', 'comment', 'trackback', 'pingback', 'review', 'note' );
870
871 /**
872 * Get the comment types whitelist.
873 *
874 * @return array
875 */
876 public static function get_comment_types_whitelist() {
877 /**
878 * Comment types present in this list will be synced to WordPress.com.
879 *
880 * @module sync
881 *
882 * @since 1.6.3
883 * @since-jetpack 7.6.0
884 *
885 * @param array A list of comment types.
886 */
887 return apply_filters( 'jetpack_sync_whitelisted_comment_types', self::$comment_types_whitelist );
888 }
889
890 /**
891 * Default theme support whitelist.
892 *
893 * @todo move this to server? - these are theme support values
894 * that should be synced as jetpack_current_theme_supports_foo option values
895 *
896 * @var array Default theme support whitelist.
897 */
898 public static $default_theme_support_whitelist = array(
899 'align-wide',
900 'appearance-tools', // In Gutenberg.
901 'automatic-feed-links',
902 'block-templates',
903 'block-template-parts', // WP 6.1. Added via https://core.trac.wordpress.org/changeset/54176
904 'custom-background',
905 'custom-header',
906 'custom-logo',
907 'customize-selective-refresh-widgets',
908 'dark-editor-style',
909 'default-color-palette', // In Gutenberg.
910 'default-gradient-presets', // In Gutenberg.
911 'disable-custom-colors',
912 'disable-custom-font-sizes',
913 'disable-custom-gradients',
914 'disable-layout-styles', // WP 6.1. Added via https://core.trac.wordpress.org/changeset/54159
915 'editor-color-palette',
916 'editor-font-sizes',
917 'editor-gradient-presets',
918 'editor-spacing-sizes',
919 'editor-style', // deprecated.
920 'editor-styles',
921 'html5',
922 'infinite-scroll',
923 'jetpack-responsive-videos',
924 'jetpack-social-menu',
925 'menus',
926 'post-formats',
927 'post-thumbnails',
928 'responsive-embeds',
929 'site-logo',
930 'title-tag',
931 'widgets',
932 'wp-block-styles',
933 );
934
935 /**
936 * Is an option whitelisted?
937 *
938 * @param string $option Option name.
939 * @return bool If option is on the whitelist.
940 */
941 public static function is_whitelisted_option( $option ) {
942 $whitelisted_options = self::get_options_whitelist();
943 foreach ( $whitelisted_options as $whitelisted_option ) {
944 if ( '/' === $whitelisted_option[0] && preg_match( $whitelisted_option, $option ) ) {
945 return true;
946 } elseif ( $whitelisted_option === $option ) {
947 return true;
948 }
949 }
950
951 return false;
952 }
953
954 /**
955 * Default whitelist of capabilities to sync.
956 *
957 * @var array Array of WordPress capabilities.
958 */
959 public static $default_capabilities_whitelist = array(
960 'activate_plugins',
961 'add_users',
962 'create_users',
963 'customize',
964 'delete_others_pages',
965 'delete_others_posts',
966 'delete_pages',
967 'delete_plugins',
968 'delete_posts',
969 'delete_private_pages',
970 'delete_private_posts',
971 'delete_published_pages',
972 'delete_published_posts',
973 'delete_site',
974 'delete_themes',
975 'delete_users',
976 'edit_dashboard',
977 'edit_files',
978 'edit_others_pages',
979 'edit_others_posts',
980 'edit_pages',
981 'edit_plugins',
982 'edit_posts',
983 'edit_private_pages',
984 'edit_private_posts',
985 'edit_published_pages',
986 'edit_published_posts',
987 'edit_theme_options',
988 'edit_themes',
989 'edit_users',
990 'export',
991 'import',
992 'install_plugins',
993 'install_themes',
994 'list_users',
995 'manage_categories',
996 'manage_links',
997 'manage_options',
998 'moderate_comments',
999 'promote_users',
1000 'publish_pages',
1001 'publish_posts',
1002 'read',
1003 'read_private_pages',
1004 'read_private_posts',
1005 'remove_users',
1006 'switch_themes',
1007 'unfiltered_html',
1008 'unfiltered_upload',
1009 'update_core',
1010 'update_plugins',
1011 'update_themes',
1012 'upload_files',
1013 'upload_plugins',
1014 'upload_themes',
1015 );
1016
1017 /**
1018 * Get default capabilities whitelist.
1019 *
1020 * @return array
1021 */
1022 public static function get_capabilities_whitelist() {
1023 /**
1024 * Filter the list of capabilities that we care about
1025 *
1026 * @module sync
1027 *
1028 * @since 1.6.3
1029 * @since-jetpack 5.5.0
1030 *
1031 * @param array The default list of capabilities.
1032 */
1033 return apply_filters( 'jetpack_sync_capabilities_whitelist', self::$default_capabilities_whitelist );
1034 }
1035
1036 /**
1037 * Get max execution sync time.
1038 *
1039 * @return float Number of seconds.
1040 */
1041 public static function get_max_sync_execution_time() {
1042 $max_exec_time = (int) ini_get( 'max_execution_time' );
1043 if ( 0 === $max_exec_time ) {
1044 // 0 actually means "unlimited", but let's not treat it that way.
1045 $max_exec_time = 60;
1046 }
1047 return floor( $max_exec_time / 3 );
1048 }
1049
1050 /**
1051 * Get default for a given setting.
1052 *
1053 * @param string $setting Setting to get.
1054 * @return mixed Value will be a string, int, array, based on the particular setting requested.
1055 */
1056 public static function get_default_setting( $setting ) {
1057 $default_name = "default_$setting"; // e.g. default_dequeue_max_bytes.
1058 return self::$$default_name;
1059 }
1060
1061 /**
1062 * Default list of network options.
1063 *
1064 * @var array network options
1065 */
1066 public static $default_network_options_whitelist = array(
1067 'active_sitewide_plugins',
1068 'auto_update_plugins', // WordPress 5.5+ auto-updates.
1069 'jetpack_protect_global_whitelist',
1070 'jetpack_protect_key',
1071 'site_name',
1072 );
1073
1074 /**
1075 * A mapping of known importers to friendly names.
1076 *
1077 * Keys are the class name of the known importer.
1078 * Values are the friendly name.
1079 *
1080 * @since 1.6.3
1081 * @since-jetpack 7.3.0
1082 *
1083 * @var array
1084 */
1085 public static $default_known_importers = array(
1086 'Blogger_Importer' => 'blogger',
1087 'LJ_API_Import' => 'livejournal',
1088 'MT_Import' => 'mt',
1089 'RSS_Import' => 'rss',
1090 'WC_Tax_Rate_Importer' => 'woo-tax-rate',
1091 'WP_Import' => 'wordpress',
1092 );
1093
1094 /**
1095 * Returns a list of known importers.
1096 *
1097 * @since 1.6.3
1098 * @since-jetpack 7.3.0
1099 *
1100 * @return array Known importers with importer class names as keys and friendly names as values.
1101 */
1102 public static function get_known_importers() {
1103 /**
1104 * Filter the list of known importers.
1105 *
1106 * @module sync
1107 *
1108 * @since 1.6.3
1109 * @since-jetpack 7.3.0
1110 *
1111 * @param array The default list of known importers.
1112 */
1113 return apply_filters( 'jetpack_sync_known_importers', self::$default_known_importers );
1114 }
1115
1116 /**
1117 * Whether this is a system with a multiple networks.
1118 * We currently need this static wrapper because we statically define our default list of callables.
1119 *
1120 * @since 1.6.3
1121 * @since-jetpack 7.6.0
1122 *
1123 * @uses Automattic\Jetpack\Status::is_multi_network
1124 *
1125 * @return boolean
1126 */
1127 public static function is_multi_network() {
1128 $status = new Status();
1129 return $status->is_multi_network();
1130 }
1131
1132 /**
1133 * Default bytes to dequeue.
1134 *
1135 * @var int Bytes.
1136 */
1137 public static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB.
1138
1139 /**
1140 * Default upload bytes.
1141 *
1142 * This value is a little bigger than the upload limit to account for serialization.
1143 *
1144 * @var int Bytes.
1145 */
1146 public static $default_upload_max_bytes = 600000;
1147
1148 /**
1149 * Default number of rows uploaded.
1150 *
1151 * @var int Number of rows.
1152 */
1153 public static $default_upload_max_rows = 500;
1154
1155 /**
1156 * Default sync wait time.
1157 *
1158 * @var int Number of seconds.
1159 */
1160 public static $default_sync_wait_time = 10; // seconds, between syncs.
1161
1162 /**
1163 * Only wait before next send if the current send took more than this number of seconds.
1164 *
1165 * @var int Number of seconds.
1166 */
1167 public static $default_sync_wait_threshold = 10;
1168
1169 /**
1170 * Default wait between attempting to continue a full sync via requests.
1171 *
1172 * @var int Number of seconds.
1173 */
1174 public static $default_enqueue_wait_time = 1;
1175
1176 /**
1177 * Maximum queue size.
1178 *
1179 * Each item is represented with a new row in the wp_options table.
1180 *
1181 * @var int Number of queue items.
1182 */
1183 public static $default_max_queue_size = 5000;
1184
1185 /**
1186 * Default maximum lag allowed in the queue.
1187 *
1188 * @var int Number of seconds
1189 */
1190 public static $default_max_queue_lag = 7200; // 2 hours.
1191
1192 /**
1193 * Default for default writes per sec.
1194 *
1195 * @var int Rows per second.
1196 */
1197 public static $default_queue_max_writes_sec = 100; // 100 rows a second.
1198
1199 /**
1200 * Default for post types blacklist.
1201 *
1202 * @var array Empty array.
1203 */
1204 public static $default_post_types_blacklist = array();
1205
1206 /**
1207 * Default for taxonomies blacklist.
1208 *
1209 * @var array Empty array.
1210 */
1211 public static $default_taxonomies_blacklist = array();
1212
1213 /**
1214 * Default for taxonomies whitelist.
1215 *
1216 * @var array Empty array.
1217 */
1218 public static $default_taxonomy_whitelist = array();
1219
1220 /**
1221 * Default for post meta whitelist.
1222 *
1223 * @var array Empty array.
1224 */
1225 public static $default_post_meta_whitelist = array();
1226
1227 /**
1228 * Default for comment meta whitelist.
1229 *
1230 * @var array Empty array.
1231 */
1232 public static $default_comment_meta_whitelist = array();
1233
1234 /**
1235 * Default for sync actions blacklist.
1236 *
1237 * @var array Empty array.
1238 */
1239 public static $default_sync_actions_blacklist = array();
1240
1241 /**
1242 * Default for disabling sync across the site.
1243 *
1244 * @var int Bool-ish. Default to 0.
1245 */
1246 public static $default_disable = 0; // completely disable sending data to wpcom.
1247
1248 /**
1249 * Default for disabling sync across the entire network on multisite.
1250 *
1251 * @var int Bool-ish. Default 0.
1252 */
1253 public static $default_network_disable = 0;
1254
1255 /**
1256 * Default for disabling checksums.
1257 *
1258 * @var int Bool-ish. Default 0.
1259 */
1260 public static $default_checksum_disable = 0;
1261
1262 /**
1263 * Should Sync use cron?
1264 *
1265 * @var int Bool-ish value. Default 1.
1266 */
1267 public static $default_sync_via_cron = 1;
1268
1269 /**
1270 * Default if Sync should render content.
1271 *
1272 * @var int Bool-ish value. Default is 0.
1273 */
1274 public static $default_render_filtered_content = 0;
1275
1276 /**
1277 * Default number of items to enqueue at a time when running full sync.
1278 *
1279 * @var int Number of items.
1280 */
1281 public static $default_max_enqueue_full_sync = 100;
1282
1283 /**
1284 * Default for maximum queue size during a full sync.
1285 *
1286 * Each item will represent a value in the wp_options table.
1287 *
1288 * @var int Number of items.
1289 */
1290 public static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue.
1291
1292 /**
1293 * Default max time for sending in immediate mode.
1294 *
1295 * @var float Number of Seconds
1296 */
1297 public static $default_full_sync_send_duration = 9;
1298
1299 /**
1300 * Defaul for time between syncing callables.
1301 *
1302 * @var int Number of seconds.
1303 */
1304 public static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again.
1305
1306 /**
1307 * Default for time between syncing constants.
1308 *
1309 * @var int Number of seconds.
1310 */
1311 public static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again.
1312 /**
1313 * Default for sync queue lock timeout time.
1314 *
1315 * @var int Number of seconds.
1316 */
1317 public static $default_sync_queue_lock_timeout = 120; // 2 minutes.
1318
1319 /**
1320 * Default for cron sync time limit.
1321 *
1322 * @var int Number of seconds.
1323 */
1324 public static $default_cron_sync_time_limit = 4 * MINUTE_IN_SECONDS;
1325
1326 /**
1327 * Default for number of term relationship items sent in an full sync item.
1328 *
1329 * @var int Number of items.
1330 */
1331 public static $default_term_relationships_full_sync_item_size = 100;
1332
1333 /**
1334 * Default for enabling incremental sync.
1335 *
1336 * @var int 1 for true.
1337 */
1338 public static $default_sync_sender_enabled = 1; // Should send incremental sync items.
1339
1340 /**
1341 * Default for enabling Full Sync.
1342 *
1343 * @var int 1 for true.
1344 */
1345 public static $default_full_sync_sender_enabled = 1; // Should send full sync items.
1346
1347 /**
1348 * Default Full Sync config
1349 *
1350 * @var array list of module names.
1351 */
1352 public static $default_full_sync_config = array(
1353 'constants' => 1,
1354 'functions' => 1,
1355 'options' => 1,
1356 'terms' => 1,
1357 'themes' => 1,
1358 'users' => 1,
1359 'posts' => 1,
1360 'comments' => 1,
1361 'updates' => 1,
1362 'term_relationships' => 1,
1363 );
1364
1365 /**
1366 * Default Full Sync limits for one module.
1367 *
1368 * @var array list of limits.
1369 */
1370 public static $default_full_sync_limits_per_module = array(
1371 'chunk_size' => 100,
1372 'max_chunks' => 10,
1373 );
1374 /**
1375 * Default Full Sync max objects to send on a single request.
1376 *
1377 * @var array list of module => max.
1378 */
1379 public static $default_full_sync_limits = array(
1380 'comments' => array(
1381 'chunk_size' => 100,
1382 'max_chunks' => 10,
1383 ),
1384 'posts' => array(
1385 'chunk_size' => 500,
1386 'max_chunks' => 1,
1387 ),
1388 'term_relationships' => array(
1389 'chunk_size' => 1000,
1390 'max_chunks' => 10,
1391 ),
1392 'terms' => array(
1393 'chunk_size' => 1000,
1394 'max_chunks' => 10,
1395 ),
1396 'users' => array(
1397 'chunk_size' => 100,
1398 'max_chunks' => 10,
1399 ),
1400 'woocommerce' => array(
1401 'chunk_size' => 100,
1402 'max_chunks' => 10,
1403 ),
1404 'woocommerce_hpos_orders' => array(
1405 'chunk_size' => 100,
1406 'max_chunks' => 10,
1407 ),
1408 );
1409
1410 /**
1411 * Default for enabling dedicated Sync flow.
1412 *
1413 * @var int Bool-ish. Default 0.
1414 */
1415 public static $default_dedicated_sync_enabled = 0;
1416
1417 /**
1418 * Default for enabling custom queue table for Sync.
1419 *
1420 * @var int Bool-ish. Default 0.
1421 */
1422 public static $default_custom_queue_table_enabled = 0;
1423
1424 /**
1425 * Default for enabling wpcom rest api for Sync.
1426 *
1427 * @var int Bool-ish. Default 1.
1428 */
1429 public static $default_wpcom_rest_api_enabled = 1;
1430
1431 /**
1432 * A list of 'jetpack_options' specific keys we want to ignore.
1433 *
1434 * @var array
1435 */
1436 public static $jetpack_options_blacklist = array(
1437 'last_heartbeat',
1438 );
1439 }
1440