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_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_private_enabled_for_site',
174        'wordads_ccpa_enabled',
175        'wordads_ccpa_privacy_policy_url',
176        'wordads_cmp_enabled',
177        'wordads_custom_adstxt',
178        'wordads_custom_adstxt_enabled',
179        'wordads_display_archive',
180        'wordads_display_front_page',
181        'wordads_display_page',
182        'wordads_display_post',
183        'wordads_second_belowpost',
184        'wordads_inline_enabled',
185        'woocommerce_custom_orders_table_enabled',
186        'wp_mobile_app_promos',
187        'wp_mobile_excerpt',
188        'wp_mobile_featured_images',
189        'wp_page_for_privacy_policy',
190        'wpcom_ai_launchpad_completed',
191        'wpcom_ai_launchpad_dismissed',
192        'wpcom_ai_launchpad_enabled',
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    );
370
371    /**
372     * Array of post type attributes synced.
373     *
374     * @var array Default post type attributes.
375     */
376    public static $default_post_type_attributes = array(
377        '_builtin'            => false,
378        '_edit_link'          => 'post.php?post=%d',
379        'can_export'          => true,
380        'cap'                 => array(),
381        'capabilities'        => array(),
382        'capability_type'     => 'post',
383        'delete_with_user'    => null,
384        'description'         => '',
385        'exclude_from_search' => true,
386        'has_archive'         => false,
387        'hierarchical'        => false,
388        'label'               => '',
389        'labels'              => array(),
390        'map_meta_cap'        => true,
391        'menu_icon'           => null,
392        'menu_position'       => null,
393        'name'                => '',
394        'public'              => false,
395        'publicly_queryable'  => null,
396        'query_var'           => true,
397        'rest_base'           => false,
398        'rewrite'             => true,
399        'show_in_admin_bar'   => false,
400        'show_in_menu'        => null,
401        'show_in_nav_menus'   => null,
402        'show_in_rest'        => false,
403        'show_ui'             => false,
404        'supports'            => array(),
405        'taxonomies'          => array(),
406    );
407
408    /**
409     * Get the whitelist of callables allowed to be managed via the JSON API.
410     *
411     * @return array Whitelist of callables allowed to be managed via the JSON API.
412     */
413    public static function get_callable_whitelist() {
414        /**
415         * Filter the list of callables that are manageable via the JSON API.
416         *
417         * @module sync
418         *
419         * @since 1.6.3
420         * @since-jetpack 4.8.0
421         *
422         * @param array The default list of callables.
423         */
424        return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist );
425    }
426
427    /**
428     * Post types that will not be synced.
429     *
430     * These are usually automated post types (sitemaps, logs, etc).
431     *
432     * @var array Blacklisted post types.
433     */
434    public static $blacklisted_post_types = array(
435        '_term_meta',
436        'ai1ec_event',
437        'ai_log', // Logger - https://github.com/alleyinteractive/logger.
438        'amp_validated_url', // AMP Validation Errors.
439        'bwg_album',
440        'bwg_gallery',
441        'customize_changeset', // WP built-in post type for Customizer changesets.
442        'dn_wp_yt_log',
443        'flamingo_contact', // https://wordpress.org/plugins/flamingo/.
444        'flamingo_inbound',
445        'flamingo_outbound',
446        'http',
447        'idx_page',
448        'jetpack_inspect_log', // Jetpack Inspect dev tool. p1HpG7-nkd-p2
449        'jetpack_migration',
450        'jp_img_sitemap',
451        'jp_img_sitemap_index',
452        'jp_sitemap',
453        'jp_sitemap_index',
454        'jp_sitemap_master',
455        'jp_vid_sitemap',
456        'jp_vid_sitemap_index',
457        'msm_sitemap', // Metro Sitemap Plugin.
458        'postman_sent_mail',
459        'rssap-feed',
460        'rssmi_feed_item',
461        'scheduled-action', // Action Scheduler - Job Queue for WordPress https://github.com/woocommerce/woocommerce/tree/e7762627c37ec1f7590e6cac4218ba0c6a20024d/includes/libraries/action-scheduler .
462        'secupress_log_action',
463        'sg_optimizer_jobs',
464        'sl-insta-media',
465        'snitch',
466        'vip-legacy-redirect',
467        'wp-rest-api-log', // https://wordpress.org/plugins/wp-rest-api-log/.
468        'wp_automatic',
469        'wp_log', // WP Logging Plugin.
470        'wpephpcompat_jobs',
471        'wprss_feed_item',
472        'tribe-ea-record', // The Events Calendar Plugin - Store Event Aggregator record information.
473        'wphb_minify_group', // Hummingbird Plugin - Used internally to keep data about assets minification.
474        'bigcommerce_task', // BigCommerce Plugin - Store import queue.
475        'secupress_log_err404', // SecuPress Plugin - Log 404 pages
476        'iw_omnibus_price_log', // Omnibus Plugin - Log price changes.
477        'od_url_metrics', // Optimization Detective - Log URL metrics.
478        'ap_outbox', // ActivityPub Outbox; only used for broadcasting ActivityPub activity to followers.
479        'shop_order_placehold', // WooCommerce placeholder - Used to maintain compatibility and references when switching between WP Posts-based order storage and the newer HPOS tables.
480    );
481
482    /**
483     * Taxonomies that we're not syncing by default.
484     *
485     * The list is compiled by auditing the dynamic filters and actions that contain taxonomy slugs
486     * and could conflict with other existing filters/actions in WP core, Jetpack and WooCommerce.
487     *
488     * @var array
489     */
490    public static $blacklisted_taxonomies = array(
491        'ancestors',
492        'archives_link',
493        'attached_file',
494        'attached_media',
495        'attached_media_args',
496        'attachment',
497        'available_languages',
498        'avatar',
499        'avatar_comment_types',
500        'avatar_data',
501        'avatar_url',
502        'bloginfo_rss',
503        'blogs_of_user',
504        'bookmark_link',
505        'bookmarks',
506        'calendar',
507        'canonical_url',
508        'categories_per_page',
509        'categories_taxonomy',
510        'category_form',
511        'category_form_fields',
512        'category_form_pre',
513        'comment',
514        'comment_ID',
515        'comment_author',
516        'comment_author_IP',
517        'comment_author_email',
518        'comment_author_link',
519        'comment_author_url',
520        'comment_author_url_link',
521        'comment_date',
522        'comment_excerpt',
523        'comment_link',
524        'comment_misc_actions',
525        'comment_text',
526        'comment_time',
527        'comment_type',
528        'comments_link',
529        'comments_number',
530        'comments_pagenum_link',
531        'custom_logo',
532        'date_sql',
533        'default_comment_status',
534        'delete_post_link',
535        'edit_bookmark_link',
536        'edit_comment_link',
537        'edit_post_link',
538        'edit_tag_link',
539        'edit_term_link',
540        'edit_user_link',
541        'enclosed',
542        'feed_build_date',
543        'form_advanced',
544        'form_after_editor',
545        'form_after_title',
546        'form_before_permalink',
547        'form_top',
548        'handle_product_cat',
549        'header_image_tag',
550        'header_video_url',
551        'image_tag',
552        'image_tag_class',
553        'lastpostdate',
554        'lastpostmodified',
555        'link',
556        'link_category_form',
557        'link_category_form_fields',
558        'link_category_form_pre',
559        'main_network_id',
560        'media',
561        'media_item_args',
562        'ms_user',
563        'network',
564        'object_terms',
565        'option',
566        'page',
567        'page_form',
568        'page_of_comment',
569        'page_uri',
570        'pagenum_link',
571        'pages',
572        'plugin',
573        'post',
574        'post_galleries',
575        'post_gallery',
576        'post_link',
577        'post_modified_time',
578        'post_status',
579        'post_time',
580        'postmeta',
581        'posts_per_page',
582        'product_search_form',
583        'profile_url',
584        'pung',
585        'role_list',
586        'sample_permalink',
587        'sample_permalink_html',
588        'schedule',
589        'search_form',
590        'search_query',
591        'shortlink',
592        'site',
593        'site_email_content',
594        'site_icon_url',
595        'site_option',
596        'space_allowed',
597        'tag',
598        'tag_form',
599        'tag_form_fields',
600        'tag_form_pre',
601        'tag_link',
602        'tags',
603        'tags_per_page',
604        'term',
605        'term_link',
606        'term_relationships',
607        'term_taxonomies',
608        'term_taxonomy',
609        'terms',
610        'terms_args',
611        'terms_defaults',
612        'terms_fields',
613        'terms_orderby',
614        'the_archive_description',
615        'the_archive_title',
616        'the_categories',
617        'the_date',
618        'the_excerpt',
619        'the_guid',
620        'the_modified_date',
621        'the_modified_time',
622        'the_post_type_description',
623        'the_tags',
624        'the_terms',
625        'the_time',
626        'theme_starter_content',
627        'to_ping',
628        'user',
629        'user_created_user',
630        'user_form',
631        'user_profile',
632        'user_profile_update',
633        'usermeta',
634        'usernumposts',
635        'users_drafts',
636        'webhook',
637        'widget',
638        'woocommerce_archive',
639        'wp_title_rss',
640    );
641
642    /**
643     * Default array of post table columns.
644     *
645     * @var array Post table columns.
646     */
647    public static $default_post_checksum_columns = array(
648        'ID',
649        'post_modified',
650    );
651
652    /**
653     * Default array of post meta table columns.
654     *
655     * @var array Post meta table columns.
656     */
657    public static $default_post_meta_checksum_columns = array(
658        'meta_id',
659        'meta_value',
660    );
661
662    /**
663     * Default array of comment table columns.
664     *
665     * @var array Default comment table columns.
666     */
667    public static $default_comment_checksum_columns = array(
668        'comment_ID',
669        'comment_content',
670    );
671
672    /**
673     * Default array of comment meta columns.
674     *
675     * @var array Comment meta table columns.
676     */
677    public static $default_comment_meta_checksum_columns = array(
678        'meta_id',
679        'meta_value',
680    );
681
682    /**
683     * Default array of option table columns.
684     *
685     * @var array Default array of option columns.
686     */
687    public static $default_option_checksum_columns = array(
688        'option_name',
689        'option_value',
690    );
691
692    /**
693     * Default array of term columns.
694     *
695     * @var array array of term columns.
696     */
697    public static $default_term_checksum_columns = array(
698        'name',
699        'slug',
700        'term_id',
701    );
702
703    /**
704     * Default array of term taxonomy columns.
705     *
706     * @var array Array of term taxonomy columns.
707     */
708    public static $default_term_taxonomy_checksum_columns = array(
709        'count',
710        'parent',
711        'taxonomy',
712        'term_id',
713        'term_taxonomy_id',
714    );
715
716    /**
717     * Default term relationship columns.
718     *
719     * @var array Array of term relationship columns.
720     */
721    public static $default_term_relationships_checksum_columns = array(
722        'object_id',
723        'term_order',
724        'term_taxonomy_id',
725    );
726
727    /**
728     * Default multisite callables able to be managed via JSON API.
729     *
730     * @var array multsite callables whitelisted
731     */
732    public static $default_multisite_callable_whitelist = array();
733
734    /**
735     * Get array of multisite callables whitelisted.
736     *
737     * @return array Multisite callables managable via JSON API.
738     */
739    public static function get_multisite_callable_whitelist() {
740        /**
741         * Filter the list of multisite callables that are manageable via the JSON API.
742         *
743         * @module sync
744         *
745         * @since 1.6.3
746         * @since-jetpack 4.8.0
747         *
748         * @param array The default list of multisite callables.
749         */
750        return apply_filters( 'jetpack_sync_multisite_callable_whitelist', self::$default_multisite_callable_whitelist );
751    }
752
753    /**
754     * Array of post meta keys whitelisted.
755     *
756     * @var array Post meta whitelist.
757     */
758    public static $post_meta_whitelist = array(
759        '_feedback_akismet_values',
760        '_feedback_email',
761        '_feedback_extra_fields',
762        '_g_feedback_shortcode',
763        '_jetpack_post_thumbnail',
764        '_last_editor_used_jetpack',
765        '_menu_item_classes',
766        '_menu_item_menu_item_parent',
767        '_menu_item_object',
768        '_menu_item_object_id',
769        '_menu_item_orphaned',
770        '_menu_item_type',
771        '_menu_item_xfn',
772        '_publicize_facebook_user',
773        '_publicize_twitter_user',
774        '_thumbnail_id',
775        '_wp_attached_file',
776        '_wp_attachment_backup_sizes',
777        '_wp_attachment_context',
778        '_wp_attachment_image_alt',
779        '_wp_attachment_is_custom_background',
780        '_wp_attachment_is_custom_header',
781        '_wp_attachment_metadata',
782        '_wp_old_date',
783        '_wp_page_template',
784        '_wp_trash_meta_comments_status',
785        '_wpas_feature_enabled',
786        '_wpas_connection_overrides',
787        '_wpas_customize_per_network',
788        '_wpas_mess',
789        '_wpas_options',
790        '_jetpack_social_image_focal_point', // Publicize_Base::ATTACHMENT_IMAGE_FOCAL_POINT.
791        'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY.
792        'content_width',
793        'custom_css_add',
794        'custom_css_preprocessor',
795        'enclosure',
796        'imagedata',
797        'nova_price',
798        'publicize_results',
799        'sharing_disabled',
800        'switch_like_status',
801        'videopress_guid',
802        'vimeo_poster_image',
803        '_jetpack_blogging_prompt_key',
804        'footnotes', // Core footnotes block
805    );
806
807    /**
808     * Get the post meta key whitelist.
809     *
810     * @return array Post meta whitelist.
811     */
812    public static function get_post_meta_whitelist() {
813        /**
814         * Filter the list of post meta data that are manageable via the JSON API.
815         *
816         * @module sync
817         *
818         * @since 1.6.3
819         * @since-jetpack 4.8.0
820         *
821         * @param array The default list of meta data keys.
822         */
823        return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist );
824    }
825
826    /**
827     * Comment meta whitelist.
828     *
829     * @var array Comment meta whitelist.
830     */
831    public static $comment_meta_whitelist = array(
832        'hc_avatar',
833        'hc_foreign_user_id',
834        'hc_post_as',
835        'hc_wpcom_id_sig',
836        'protocol',
837    );
838
839    /**
840     * Get the comment meta whitelist.
841     *
842     * @return array
843     */
844    public static function get_comment_meta_whitelist() {
845        /**
846         * Filter the list of comment meta data that are manageable via the JSON API.
847         *
848         * @module sync
849         *
850         * @since 1.6.3
851         * @since-jetpack 5.7.0
852         *
853         * @param array The default list of comment meta data keys.
854         */
855        return apply_filters( 'jetpack_sync_comment_meta_whitelist', self::$comment_meta_whitelist );
856    }
857
858    /**
859     * Comment types whitelist.
860     *
861     * @var array Comment types that are synced.
862     */
863    public static $comment_types_whitelist = array( '', 'comment', 'trackback', 'pingback', 'review', 'note' );
864
865    /**
866     * Get the comment types whitelist.
867     *
868     * @return array
869     */
870    public static function get_comment_types_whitelist() {
871        /**
872         * Comment types present in this list will be synced to WordPress.com.
873         *
874         * @module sync
875         *
876         * @since 1.6.3
877         * @since-jetpack 7.6.0
878         *
879         * @param array A list of comment types.
880         */
881        return apply_filters( 'jetpack_sync_whitelisted_comment_types', self::$comment_types_whitelist );
882    }
883
884    /**
885     * Default theme support whitelist.
886     *
887     * @todo move this to server? - these are theme support values
888     * that should be synced as jetpack_current_theme_supports_foo option values
889     *
890     * @var array Default theme support whitelist.
891     */
892    public static $default_theme_support_whitelist = array(
893        'align-wide',
894        'appearance-tools', // In Gutenberg.
895        'automatic-feed-links',
896        'block-templates',
897        'block-template-parts', // WP 6.1. Added via https://core.trac.wordpress.org/changeset/54176
898        'custom-background',
899        'custom-header',
900        'custom-logo',
901        'customize-selective-refresh-widgets',
902        'dark-editor-style',
903        'default-color-palette', // In Gutenberg.
904        'default-gradient-presets', // In Gutenberg.
905        'disable-custom-colors',
906        'disable-custom-font-sizes',
907        'disable-custom-gradients',
908        'disable-layout-styles', // WP 6.1. Added via https://core.trac.wordpress.org/changeset/54159
909        'editor-color-palette',
910        'editor-font-sizes',
911        'editor-gradient-presets',
912        'editor-spacing-sizes',
913        'editor-style', // deprecated.
914        'editor-styles',
915        'html5',
916        'infinite-scroll',
917        'jetpack-responsive-videos',
918        'jetpack-social-menu',
919        'menus',
920        'post-formats',
921        'post-thumbnails',
922        'responsive-embeds',
923        'site-logo',
924        'title-tag',
925        'widgets',
926        'wp-block-styles',
927    );
928
929    /**
930     * Is an option whitelisted?
931     *
932     * @param string $option Option name.
933     * @return bool If option is on the whitelist.
934     */
935    public static function is_whitelisted_option( $option ) {
936        $whitelisted_options = self::get_options_whitelist();
937        foreach ( $whitelisted_options as $whitelisted_option ) {
938            if ( '/' === $whitelisted_option[0] && preg_match( $whitelisted_option, $option ) ) {
939                return true;
940            } elseif ( $whitelisted_option === $option ) {
941                return true;
942            }
943        }
944
945        return false;
946    }
947
948    /**
949     * Default whitelist of capabilities to sync.
950     *
951     * @var array Array of WordPress capabilities.
952     */
953    public static $default_capabilities_whitelist = array(
954        'activate_plugins',
955        'add_users',
956        'create_users',
957        'customize',
958        'delete_others_pages',
959        'delete_others_posts',
960        'delete_pages',
961        'delete_plugins',
962        'delete_posts',
963        'delete_private_pages',
964        'delete_private_posts',
965        'delete_published_pages',
966        'delete_published_posts',
967        'delete_site',
968        'delete_themes',
969        'delete_users',
970        'edit_dashboard',
971        'edit_files',
972        'edit_others_pages',
973        'edit_others_posts',
974        'edit_pages',
975        'edit_plugins',
976        'edit_posts',
977        'edit_private_pages',
978        'edit_private_posts',
979        'edit_published_pages',
980        'edit_published_posts',
981        'edit_theme_options',
982        'edit_themes',
983        'edit_users',
984        'export',
985        'import',
986        'install_plugins',
987        'install_themes',
988        'list_users',
989        'manage_categories',
990        'manage_links',
991        'manage_options',
992        'moderate_comments',
993        'promote_users',
994        'publish_pages',
995        'publish_posts',
996        'read',
997        'read_private_pages',
998        'read_private_posts',
999        'remove_users',
1000        'switch_themes',
1001        'unfiltered_html',
1002        'unfiltered_upload',
1003        'update_core',
1004        'update_plugins',
1005        'update_themes',
1006        'upload_files',
1007        'upload_plugins',
1008        'upload_themes',
1009    );
1010
1011    /**
1012     * Get default capabilities whitelist.
1013     *
1014     * @return array
1015     */
1016    public static function get_capabilities_whitelist() {
1017        /**
1018         * Filter the list of capabilities that we care about
1019         *
1020         * @module sync
1021         *
1022         * @since 1.6.3
1023         * @since-jetpack 5.5.0
1024         *
1025         * @param array The default list of capabilities.
1026         */
1027        return apply_filters( 'jetpack_sync_capabilities_whitelist', self::$default_capabilities_whitelist );
1028    }
1029
1030    /**
1031     * Get max execution sync time.
1032     *
1033     * @return float Number of seconds.
1034     */
1035    public static function get_max_sync_execution_time() {
1036        $max_exec_time = (int) ini_get( 'max_execution_time' );
1037        if ( 0 === $max_exec_time ) {
1038            // 0 actually means "unlimited", but let's not treat it that way.
1039            $max_exec_time = 60;
1040        }
1041        return floor( $max_exec_time / 3 );
1042    }
1043
1044    /**
1045     * Get default for a given setting.
1046     *
1047     * @param string $setting Setting to get.
1048     * @return mixed Value will be a string, int, array, based on the particular setting requested.
1049     */
1050    public static function get_default_setting( $setting ) {
1051        $default_name = "default_$setting"; // e.g. default_dequeue_max_bytes.
1052        return self::$$default_name;
1053    }
1054
1055    /**
1056     * Default list of network options.
1057     *
1058     * @var array network options
1059     */
1060    public static $default_network_options_whitelist = array(
1061        'active_sitewide_plugins',
1062        'auto_update_plugins', // WordPress 5.5+ auto-updates.
1063        'jetpack_protect_global_whitelist',
1064        'jetpack_protect_key',
1065        'site_name',
1066    );
1067
1068    /**
1069     * A mapping of known importers to friendly names.
1070     *
1071     * Keys are the class name of the known importer.
1072     * Values are the friendly name.
1073     *
1074     * @since 1.6.3
1075     * @since-jetpack 7.3.0
1076     *
1077     * @var array
1078     */
1079    public static $default_known_importers = array(
1080        'Blogger_Importer'     => 'blogger',
1081        'LJ_API_Import'        => 'livejournal',
1082        'MT_Import'            => 'mt',
1083        'RSS_Import'           => 'rss',
1084        'WC_Tax_Rate_Importer' => 'woo-tax-rate',
1085        'WP_Import'            => 'wordpress',
1086    );
1087
1088    /**
1089     * Returns a list of known importers.
1090     *
1091     * @since 1.6.3
1092     * @since-jetpack 7.3.0
1093     *
1094     * @return array Known importers with importer class names as keys and friendly names as values.
1095     */
1096    public static function get_known_importers() {
1097        /**
1098         * Filter the list of known importers.
1099         *
1100         * @module sync
1101         *
1102         * @since 1.6.3
1103         * @since-jetpack 7.3.0
1104         *
1105         * @param array The default list of known importers.
1106         */
1107        return apply_filters( 'jetpack_sync_known_importers', self::$default_known_importers );
1108    }
1109
1110    /**
1111     * Whether this is a system with a multiple networks.
1112     * We currently need this static wrapper because we statically define our default list of callables.
1113     *
1114     * @since 1.6.3
1115     * @since-jetpack 7.6.0
1116     *
1117     * @uses Automattic\Jetpack\Status::is_multi_network
1118     *
1119     * @return boolean
1120     */
1121    public static function is_multi_network() {
1122        $status = new Status();
1123        return $status->is_multi_network();
1124    }
1125
1126    /**
1127     * Default bytes to dequeue.
1128     *
1129     * @var int Bytes.
1130     */
1131    public static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB.
1132
1133    /**
1134     * Default upload bytes.
1135     *
1136     * This value is a little bigger than the upload limit to account for serialization.
1137     *
1138     * @var int Bytes.
1139     */
1140    public static $default_upload_max_bytes = 600000;
1141
1142    /**
1143     * Default number of rows uploaded.
1144     *
1145     * @var int Number of rows.
1146     */
1147    public static $default_upload_max_rows = 500;
1148
1149    /**
1150     * Default sync wait time.
1151     *
1152     * @var int Number of seconds.
1153     */
1154    public static $default_sync_wait_time = 10; // seconds, between syncs.
1155
1156    /**
1157     * Only wait before next send if the current send took more than this number of seconds.
1158     *
1159     * @var int Number of seconds.
1160     */
1161    public static $default_sync_wait_threshold = 10;
1162
1163    /**
1164     * Default wait between attempting to continue a full sync via requests.
1165     *
1166     * @var int Number of seconds.
1167     */
1168    public static $default_enqueue_wait_time = 1;
1169
1170    /**
1171     * Maximum queue size.
1172     *
1173     * Each item is represented with a new row in the wp_options table.
1174     *
1175     * @var int Number of queue items.
1176     */
1177    public static $default_max_queue_size = 5000;
1178
1179    /**
1180     * Default maximum lag allowed in the queue.
1181     *
1182     * @var int Number of seconds
1183     */
1184    public static $default_max_queue_lag = 7200; // 2 hours.
1185
1186    /**
1187     * Default for default writes per sec.
1188     *
1189     * @var int Rows per second.
1190     */
1191    public static $default_queue_max_writes_sec = 100; // 100 rows a second.
1192
1193    /**
1194     * Default for post types blacklist.
1195     *
1196     * @var array Empty array.
1197     */
1198    public static $default_post_types_blacklist = array();
1199
1200    /**
1201     * Default for taxonomies blacklist.
1202     *
1203     * @var array Empty array.
1204     */
1205    public static $default_taxonomies_blacklist = array();
1206
1207    /**
1208     * Default for taxonomies whitelist.
1209     *
1210     * @var array Empty array.
1211     */
1212    public static $default_taxonomy_whitelist = array();
1213
1214    /**
1215     * Default for post meta whitelist.
1216     *
1217     * @var array Empty array.
1218     */
1219    public static $default_post_meta_whitelist = array();
1220
1221    /**
1222     * Default for comment meta whitelist.
1223     *
1224     * @var array Empty array.
1225     */
1226    public static $default_comment_meta_whitelist = array();
1227
1228    /**
1229     * Default for sync actions blacklist.
1230     *
1231     * @var array Empty array.
1232     */
1233    public static $default_sync_actions_blacklist = array();
1234
1235    /**
1236     * Default for disabling sync across the site.
1237     *
1238     * @var int Bool-ish. Default to 0.
1239     */
1240    public static $default_disable = 0; // completely disable sending data to wpcom.
1241
1242    /**
1243     * Default for disabling sync across the entire network on multisite.
1244     *
1245     * @var int Bool-ish. Default 0.
1246     */
1247    public static $default_network_disable = 0;
1248
1249    /**
1250     * Default for disabling checksums.
1251     *
1252     * @var int Bool-ish. Default 0.
1253     */
1254    public static $default_checksum_disable = 0;
1255
1256    /**
1257     * Should Sync use cron?
1258     *
1259     * @var int Bool-ish value. Default 1.
1260     */
1261    public static $default_sync_via_cron = 1;
1262
1263    /**
1264     * Default if Sync should render content.
1265     *
1266     * @var int Bool-ish value. Default is 0.
1267     */
1268    public static $default_render_filtered_content = 0;
1269
1270    /**
1271     * Default number of items to enqueue at a time when running full sync.
1272     *
1273     * @var int Number of items.
1274     */
1275    public static $default_max_enqueue_full_sync = 100;
1276
1277    /**
1278     * Default for maximum queue size during a full sync.
1279     *
1280     * Each item will represent a value in the wp_options table.
1281     *
1282     * @var int Number of items.
1283     */
1284    public static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue.
1285
1286    /**
1287     * Default max time for sending in immediate mode.
1288     *
1289     * @var float Number of Seconds
1290     */
1291    public static $default_full_sync_send_duration = 9;
1292
1293    /**
1294     * Defaul for time between syncing callables.
1295     *
1296     * @var int Number of seconds.
1297     */
1298    public static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again.
1299
1300    /**
1301     * Default for time between syncing constants.
1302     *
1303     * @var int Number of seconds.
1304     */
1305    public static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again.
1306    /**
1307     * Default for sync queue lock timeout time.
1308     *
1309     * @var int Number of seconds.
1310     */
1311    public static $default_sync_queue_lock_timeout = 120; // 2 minutes.
1312
1313    /**
1314     * Default for cron sync time limit.
1315     *
1316     * @var int Number of seconds.
1317     */
1318    public static $default_cron_sync_time_limit = 4 * MINUTE_IN_SECONDS;
1319
1320    /**
1321     * Default for number of term relationship items sent in an full sync item.
1322     *
1323     * @var int Number of items.
1324     */
1325    public static $default_term_relationships_full_sync_item_size = 100;
1326
1327    /**
1328     * Default for enabling incremental sync.
1329     *
1330     * @var int 1 for true.
1331     */
1332    public static $default_sync_sender_enabled = 1; // Should send incremental sync items.
1333
1334    /**
1335     * Default for enabling Full Sync.
1336     *
1337     * @var int 1 for true.
1338     */
1339    public static $default_full_sync_sender_enabled = 1; // Should send full sync items.
1340
1341    /**
1342     * Default Full Sync config
1343     *
1344     * @var array list of module names.
1345     */
1346    public static $default_full_sync_config = array(
1347        'constants'          => 1,
1348        'functions'          => 1,
1349        'options'            => 1,
1350        'terms'              => 1,
1351        'themes'             => 1,
1352        'users'              => 1,
1353        'posts'              => 1,
1354        'comments'           => 1,
1355        'updates'            => 1,
1356        'term_relationships' => 1,
1357    );
1358
1359    /**
1360     * Default Full Sync limits for one module.
1361     *
1362     * @var array list of limits.
1363     */
1364    public static $default_full_sync_limits_per_module = array(
1365        'chunk_size' => 100,
1366        'max_chunks' => 10,
1367    );
1368    /**
1369     * Default Full Sync max objects to send on a single request.
1370     *
1371     * @var array list of module => max.
1372     */
1373    public static $default_full_sync_limits = array(
1374        'comments'                => array(
1375            'chunk_size' => 100,
1376            'max_chunks' => 10,
1377        ),
1378        'posts'                   => array(
1379            'chunk_size' => 500,
1380            'max_chunks' => 1,
1381        ),
1382        'term_relationships'      => array(
1383            'chunk_size' => 1000,
1384            'max_chunks' => 10,
1385        ),
1386        'terms'                   => array(
1387            'chunk_size' => 1000,
1388            'max_chunks' => 10,
1389        ),
1390        'users'                   => array(
1391            'chunk_size' => 100,
1392            'max_chunks' => 10,
1393        ),
1394        'woocommerce'             => array(
1395            'chunk_size' => 100,
1396            'max_chunks' => 10,
1397        ),
1398        'woocommerce_hpos_orders' => array(
1399            'chunk_size' => 100,
1400            'max_chunks' => 10,
1401        ),
1402    );
1403
1404    /**
1405     * Default for enabling dedicated Sync flow.
1406     *
1407     * @var int Bool-ish. Default 0.
1408     */
1409    public static $default_dedicated_sync_enabled = 0;
1410
1411    /**
1412     * Default for enabling custom queue table for Sync.
1413     *
1414     * @var int Bool-ish. Default 0.
1415     */
1416    public static $default_custom_queue_table_enabled = 0;
1417
1418    /**
1419     * Default for enabling wpcom rest api for Sync.
1420     *
1421     * @var int Bool-ish. Default 1.
1422     */
1423    public static $default_wpcom_rest_api_enabled = 1;
1424
1425    /**
1426     * A list of 'jetpack_options' specific keys we want to ignore.
1427     *
1428     * @var array
1429     */
1430    public static $jetpack_options_blacklist = array(
1431        'last_heartbeat',
1432    );
1433}