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