able via the JSON API. * * @module sync * * @since 5.7.0 * * @param array The default list of comment meta data keys. */ return apply_filters( 'jetpack_sync_comment_meta_whitelist', self::$comment_meta_whitelist ); } /** * Default theme support whitelist. * * @todo move this to server? - these are theme support values * that should be synced as jetpack_current_theme_supports_foo option values * * @var array Default theme support whitelist. */ public static $default_theme_support_whitelist = array( 'post-thumbnails', 'post-formats', 'custom-header', 'custom-background', 'custom-logo', 'menus', 'automatic-feed-links', 'align-wide', 'wp-block-styles', 'responsive-embeds', 'disable-custom-gradients', 'disable-custom-font-sizes', 'disable-custom-colors', 'dark-editor-style', 'customize-selective-refresh-widgets', 'widgets', 'html5', 'title-tag', 'jetpack-social-menu', 'jetpack-responsive-videos', 'infinite-scroll', 'site-logo', 'editor-color-palette', 'editor-gradient-presets', 'editor-font-sizes', 'editor-styles', 'editor-style', // deprecated. ); /** * Is an option whitelisted? * * @param string $option Option name. * @return bool If option is on the whitelist. */ public static function is_whitelisted_option( $option ) { $whitelisted_options = self::get_options_whitelist(); foreach ( $whitelisted_options as $whitelisted_option ) { if ( '/' === $whitelisted_option[0] && preg_match( $whitelisted_option, $option ) ) { return true; } elseif ( $whitelisted_option === $option ) { return true; } } return false; } /** * Default whitelist of capabilities to sync. * * @var array Array of WordPress capabilities. */ public static $default_capabilities_whitelist = array( 'switch_themes', 'edit_themes', 'edit_theme_options', 'install_themes', 'activate_plugins', 'edit_plugins', 'install_plugins', 'edit_users', 'edit_files', 'manage_options', 'moderate_comments', 'manage_categories', 'manage_links', 'upload_files', 'import', 'unfiltered_html', 'edit_posts', 'edit_others_posts', 'edit_published_posts', 'publish_posts', 'edit_pages', 'read', 'publish_pages', 'edit_others_pages', 'edit_published_pages', 'delete_pages', 'delete_others_pages', 'delete_published_pages', 'delete_posts', 'delete_others_posts', 'delete_published_posts', 'delete_private_posts', 'edit_private_posts', 'read_private_posts', 'delete_private_pages', 'edit_private_pages', 'read_private_pages', 'delete_users', 'create_users', 'unfiltered_upload', 'edit_dashboard', 'customize', 'delete_site', 'update_plugins', 'delete_plugins', 'update_themes', 'update_core', 'list_users', 'remove_users', 'add_users', 'promote_users', 'delete_themes', 'export', 'upload_plugins', 'upload_themes', ); /** * Get default capabilities whitelist. * * @return array */ public static function get_capabilities_whitelist() { /** * Filter the list of capabilities that we care about * * @module sync * * @since 5.5.0 * * @param array The default list of capabilities. */ return apply_filters( 'jetpack_sync_capabilities_whitelist', self::$default_capabilities_whitelist ); } /** * Get max execution sync time. * * @return float Number of seconds. */ public static function get_max_sync_execution_time() { $max_exec_time = (int) ini_get( 'max_execution_time' ); if ( 0 === $max_exec_time ) { // 0 actually means "unlimited", but let's not treat it that way. $max_exec_time = 60; } return floor( $max_exec_time / 3 ); } /** * Get default for a given setting. * * @param string $setting Setting to get. * @return mixed Value will be a string, int, array, based on the particular setting requested. */ public static function get_default_setting( $setting ) { $default_name = "default_$setting"; // e.g. default_dequeue_max_bytes. return self::$$default_name; } /** * Default list of network options. * * @var array network options */ public static $default_network_options_whitelist = array( 'site_name', 'jetpack_protect_key', 'jetpack_protect_global_whitelist', 'active_sitewide_plugins', 'auto_update_plugins', // WordPress 5.5+ auto-updates. ); /** * A mapping of known importers to friendly names. * * Keys are the class name of the known importer. * Values are the friendly name. * * @since 7.3.0 * * @var array */ public static $default_known_importers = array( 'Blogger_Importer' => 'blogger', 'LJ_API_Import' => 'livejournal', 'MT_Import' => 'mt', 'RSS_Import' => 'rss', 'WC_Tax_Rate_Importer' => 'woo-tax-rate', 'WP_Import' => 'wordpress', ); /** * Returns a list of known importers. * * @since 7.3.0 * * @return array Known importers with importer class names as keys and friendly names as values. */ public static function get_known_importers() { /** * Filter the list of known importers. * * @module sync * * @since 7.3.0 * * @param array The default list of known importers. */ return apply_filters( 'jetpack_sync_known_importers', self::$default_known_importers ); } /** * Whether this is a system with a multiple networks. * We currently need this static wrapper because we statically define our default list of callables. * * @since 7.6.0 * * @uses Automattic\Jetpack\Status::is_multi_network * * @return boolean */ public static function is_multi_network() { $status = new Status(); return $status->is_multi_network(); } /** * Default bytes to dequeue. * * @var int Bytes. */ public static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB. /** * Default upload bytes. * * This value is a little bigger than the upload limit to account for serialization. * * @var int Bytes. */ public static $default_upload_max_bytes = 600000; /** * Default number of rows uploaded. * * @var int Number of rows. */ public static $default_upload_max_rows = 500; /** * Default sync wait time. * * @var int Number of seconds. */ public static $default_sync_wait_time = 10; // seconds, between syncs. /** * Only wait before next send if the current send took more than this number of seconds. * * @var int Number of seconds. */ public static $default_sync_wait_threshold = 10; /** * Default wait between attempting to continue a full sync via requests. * * @var int Number of seconds. */ public static $default_enqueue_wait_time = 1; /** * Maximum queue size. * * Each item is represented with a new row in the wp_options table. * * @var int Number of queue items. */ public static $default_max_queue_size = 5000; /** * Default maximum lag allowed in the queue. * * @var int Number of seconds */ public static $default_max_queue_lag = 7200; // 2 hours. /** * Default for default writes per sec. * * @var int Rows per second. */ public static $default_queue_max_writes_sec = 100; // 100 rows a second. /** * Default for post types blacklist. * * @var array Empty array. */ public static $default_post_types_blacklist = array(); /** * Default for taxonomies blacklist. * * @var array Empty array. */ public static $default_taxonomies_blacklist = array(); /** * Default for taxonomies whitelist. * * @var array Empty array. */ public static $default_taxonomy_whitelist = array(); /** * Default for post meta whitelist. * * @var array Empty array. */ public static $default_post_meta_whitelist = array(); /** * Default for comment meta whitelist. * * @var array Empty array. */ public static $default_comment_meta_whitelist = array(); /** * Default for disabling sync across the site. * * @var int Bool-ish. Default to 0. */ public static $default_disable = 0; // completely disable sending data to wpcom. /** * Default for disabling sync across the entire network on multisite. * * @var int Bool-ish. Default 0. */ public static $default_network_disable = 0; /** * Default for disabling checksums. * * @var int Bool-ish. Default 0. */ public static $default_checksum_disable = 0; /** * Should Sync use cron? * * @var int Bool-ish value. Default 1. */ public static $default_sync_via_cron = 1; /** * Default if Sync should render content. * * @var int Bool-ish value. Default is 0. */ public static $default_render_filtered_content = 0; /** * Default number of items to enqueue at a time when running full sync. * * @var int Number of items. */ public static $default_max_enqueue_full_sync = 100; /** * Default for maximum queue size during a full sync. * * Each item will represent a value in the wp_options table. * * @var int Number of items. */ public static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue. /** * Default max time for sending in immediate mode. * * @var float Number of Seconds */ public static $default_full_sync_send_duration = 9; /** * Defaul for time between syncing callables. * * @var int Number of seconds. */ public static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again. /** * Default for time between syncing constants. * * @var int Number of seconds. */ public static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again. /** * Default for sync queue lock timeout time. * * @var int Number of seconds. */ public static $default_sync_queue_lock_timeout = 120; // 2 minutes. /** * Default for cron sync time limit. * * @var int Number of seconds. */ public static $default_cron_sync_time_limit = 4 * MINUTE_IN_SECONDS; /** * Default for number of term relationship items sent in an full sync item. * * @var int Number of items. */ public static $default_term_relationships_full_sync_item_size = 100; /** * Default for enabling incremental sync. * * @var int 1 for true. */ public static $default_sync_sender_enabled = 1; // Should send incremental sync items. /** * Default for enabling Full Sync. * * @var int 1 for true. */ public static $default_full_sync_sender_enabled = 1; // Should send full sync items. /** * Default Full Sync config * * @var array list of module names. */ public static $default_full_sync_config = array( 'constants' => 1, 'functions' => 1, 'options' => 1, 'updates' => 1, 'themes' => 1, 'users' => 1, 'terms' => 1, 'posts' => 1, 'comments' => 1, 'term_relationships' => 1, ); /** * Default Full Sync max objects to send on a single request. * * @var array list of module => max. */ public static $default_full_sync_limits = array( 'users' => array( 'chunk_size' => 100, 'max_chunks' => 10, ), 'terms' => array( 'chunk_size' => 1000, 'max_chunks' => 10, ), 'posts' => array( 'chunk_size' => 100, 'max_chunks' => 1, ), 'comments' => array( 'chunk_size' => 100, 'max_chunks' => 10, ), 'term_relationships' => array( 'chunk_size' => 1000, 'max_chunks' => 10, ), ); }