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