Jetpack_Sync_Defaults

Just some defaults that we share with the server.

Defined (1)

The class is defined in the following location(s).

/sync/class.jetpack-sync-defaults.php  
  1. class Jetpack_Sync_Defaults { 
  2.  
  3. static $default_options_whitelist = array( 
  4. 'stylesheet',  
  5. 'blogname',  
  6. 'blogdescription',  
  7. 'blog_charset',  
  8. 'permalink_structure',  
  9. 'category_base',  
  10. 'tag_base',  
  11. 'sidebars_widgets',  
  12. 'comment_moderation',  
  13. 'default_comment_status',  
  14. 'page_on_front',  
  15. 'rss_use_excerpt',  
  16. 'subscription_options',  
  17. 'stb_enabled',  
  18. 'stc_enabled',  
  19. 'comment_registration',  
  20. 'show_avatars',  
  21. 'avatar_default',  
  22. 'avatar_rating',  
  23. 'highlander_comment_form_prompt',  
  24. 'jetpack_comment_form_color_scheme',  
  25. 'stats_options',  
  26. 'gmt_offset',  
  27. 'timezone_string',  
  28. 'jetpack_sync_non_public_post_stati',  
  29. 'jetpack_options',  
  30. 'site_icon', // (int) - ID of core's Site Icon attachment ID 
  31. 'default_post_format',  
  32. 'default_category',  
  33. 'large_size_w',  
  34. 'large_size_h',  
  35. 'thumbnail_size_w',  
  36. 'thumbnail_size_h',  
  37. 'medium_size_w',  
  38. 'medium_size_h',  
  39. 'thumbnail_crop',  
  40. 'image_default_link_type',  
  41. 'site_logo',  
  42. 'sharing-options',  
  43. 'sharing-services',  
  44. 'post_count',  
  45. 'default_ping_status',  
  46. 'sticky_posts',  
  47. 'blog_public',  
  48. 'default_pingback_flag',  
  49. 'require_name_email',  
  50. 'close_comments_for_old_posts',  
  51. 'close_comments_days_old',  
  52. 'thread_comments',  
  53. 'thread_comments_depth',  
  54. 'page_comments',  
  55. 'comments_per_page',  
  56. 'default_comments_page',  
  57. 'comment_order',  
  58. 'comments_notify',  
  59. 'moderation_notify',  
  60. 'social_notifications_like',  
  61. 'social_notifications_reblog',  
  62. 'social_notifications_subscribe',  
  63. 'comment_whitelist',  
  64. 'comment_max_links',  
  65. 'moderation_keys',  
  66. 'jetpack_wga',  
  67. 'disabled_likes',  
  68. 'disabled_reblogs',  
  69. 'jetpack_comment_likes_enabled',  
  70. 'twitter_via',  
  71. 'jetpack-twitter-cards-site-tag',  
  72. 'wpcom_publish_posts_with_markdown',  
  73. 'wpcom_publish_comments_with_markdown',  
  74. 'jetpack_activated',  
  75. 'jetpack_available_modules',  
  76. 'jetpack_autoupdate_plugins',  
  77. 'jetpack_autoupdate_plugins_translations',  
  78. 'jetpack_autoupdate_themes',  
  79. 'jetpack_autoupdate_themes_translations',  
  80. 'jetpack_autoupdate_core',  
  81. 'jetpack_autoupdate_translations',  
  82. 'carousel_background_color',  
  83. 'carousel_display_exif',  
  84. 'jetpack_portfolio',  
  85. 'jetpack_portfolio_posts_per_page',  
  86. 'jetpack_testimonial',  
  87. 'jetpack_testimonial_posts_per_page',  
  88. 'tiled_galleries',  
  89. 'gravatar_disable_hovercards',  
  90. 'infinite_scroll',  
  91. 'infinite_scroll_google_analytics',  
  92. 'wp_mobile_excerpt',  
  93. 'wp_mobile_featured_images',  
  94. 'wp_mobile_app_promos',  
  95. 'monitor_receive_notifications',  
  96. 'post_by_email_address',  
  97. 'jetpack_protect_key',  
  98. 'jetpack_protect_global_whitelist',  
  99. 'jetpack_sso_require_two_step',  
  100. 'jetpack_relatedposts',  
  101. 'verification_services_codes',  
  102. 'users_can_register',  
  103. 'active_plugins',  
  104. 'uninstall_plugins',  
  105. 'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION 
  106. 'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION 
  107. 'jetpack_api_cache_enabled',  
  108. ); 
  109.  
  110. public static function get_options_whitelist() { 
  111. /** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */ 
  112. $options_whitelist = apply_filters( 'jetpack_options_whitelist', self::$default_options_whitelist ); 
  113. /** 
  114. * Filter the list of WordPress options that are manageable via the JSON API. 
  115. * @module sync 
  116. * @since 4.8 
  117. * @param array The default list of options. 
  118. */ 
  119. return apply_filters( 'jetpack_sync_options_whitelist', $options_whitelist ); 
  120.  
  121. static $default_constants_whitelist = array( 
  122. 'EMPTY_TRASH_DAYS',  
  123. 'WP_POST_REVISIONS',  
  124. 'AUTOMATIC_UPDATER_DISABLED',  
  125. 'ABSPATH',  
  126. 'WP_CONTENT_DIR',  
  127. 'FS_METHOD',  
  128. 'DISALLOW_FILE_EDIT',  
  129. 'DISALLOW_FILE_MODS',  
  130. 'WP_AUTO_UPDATE_CORE',  
  131. 'WP_HTTP_BLOCK_EXTERNAL',  
  132. 'WP_ACCESSIBLE_HOSTS',  
  133. 'JETPACK__VERSION',  
  134. 'IS_PRESSABLE',  
  135. 'DISABLE_WP_CRON',  
  136. 'ALTERNATE_WP_CRON',  
  137. 'WP_CRON_LOCK_TIMEOUT',  
  138. 'PHP_VERSION',  
  139. ); 
  140.  
  141. public static function get_constants_whitelist() { 
  142. /** 
  143. * Filter the list of PHP constants that are manageable via the JSON API. 
  144. * @module sync 
  145. * @since 4.8 
  146. * @param array The default list of constants options. 
  147. */ 
  148. return apply_filters( 'jetpack_sync_constants_whitelist', self::$default_constants_whitelist ); 
  149.  
  150. static $default_callable_whitelist = array( 
  151. 'wp_max_upload_size' => 'wp_max_upload_size',  
  152. 'is_main_network' => array( 'Jetpack', 'is_multi_network' ),  
  153. 'is_multi_site' => 'is_multisite',  
  154. 'main_network_site' => array( 'Jetpack_Sync_Functions', 'main_network_site_url' ),  
  155. 'site_url' => array( 'Jetpack_Sync_Functions', 'site_url' ),  
  156. 'home_url' => array( 'Jetpack_Sync_Functions', 'home_url' ),  
  157. 'single_user_site' => array( 'Jetpack', 'is_single_user_site' ),  
  158. 'updates' => array( 'Jetpack', 'get_updates' ),  
  159. 'has_file_system_write_access' => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ),  
  160. 'is_version_controlled' => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ),  
  161. 'taxonomies' => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ),  
  162. 'post_types' => array( 'Jetpack_Sync_Functions', 'get_post_types' ),  
  163. 'post_type_features' => array( 'Jetpack_Sync_Functions', 'get_post_type_features' ),  
  164. 'shortcodes' => array( 'Jetpack_Sync_Functions', 'get_shortcodes' ),  
  165. 'rest_api_allowed_post_types' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_post_types' ),  
  166. 'rest_api_allowed_public_metadata' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_public_metadata' ),  
  167. 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ),  
  168. 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ),  
  169. 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ),  
  170. 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ),  
  171. 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ),  
  172. 'wp_version' => array( 'Jetpack_Sync_Functions', 'wp_version' ),  
  173. 'get_plugins' => array( 'Jetpack_Sync_Functions', 'get_plugins' ),  
  174. 'active_modules' => array( 'Jetpack', 'get_active_modules' ),  
  175. 'hosting_provider' => array( 'Jetpack_Sync_Functions', 'get_hosting_provider' ),  
  176. 'locale' => 'get_locale',  
  177. 'site_icon_url' => array( 'Jetpack_Sync_Functions', 'site_icon_url' ),  
  178. ); 
  179.  
  180. public static function get_callable_whitelist() { 
  181. /** 
  182. * Filter the list of callables that are manageable via the JSON API. 
  183. * @module sync 
  184. * @since 4.8 
  185. * @param array The default list of callables. 
  186. */ 
  187. return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist ); 
  188.  
  189. static $blacklisted_post_types = array( 
  190. 'ai1ec_event',  
  191. 'snitch',  
  192. 'secupress_log_action',  
  193. 'http',  
  194. 'bwg_gallery',  
  195. 'bwg_album',  
  196. 'idx_page',  
  197. 'postman_sent_mail',  
  198. 'rssmi_feed_item',  
  199. 'rssap-feed',  
  200. 'wp_automatic',  
  201. ); 
  202.  
  203. static $default_post_checksum_columns = array( 
  204. 'ID',  
  205. 'post_modified',  
  206. ); 
  207.  
  208. static $default_post_meta_checksum_columns = array( 
  209. 'meta_id',  
  210. 'meta_value' 
  211. ); 
  212.  
  213. static $default_comment_checksum_columns = array( 
  214. 'comment_ID',  
  215. 'comment_content',  
  216. ); 
  217.  
  218. static $default_comment_meta_checksum_columns = array( 
  219. 'meta_id',  
  220. 'meta_value' 
  221. ); 
  222.  
  223. static $default_option_checksum_columns = array( 
  224. 'option_name',  
  225. 'option_value',  
  226. ); 
  227.  
  228. static $default_multisite_callable_whitelist = array( 
  229. 'network_name' => array( 'Jetpack', 'network_name' ),  
  230. 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ),  
  231. 'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ),  
  232. 'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ),  
  233. 'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ),  
  234. 'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ),  
  235. ); 
  236.  
  237. public static function get_multisite_callable_whitelist() { 
  238. /** 
  239. * Filter the list of multisite callables that are manageable via the JSON API. 
  240. * @module sync 
  241. * @since 4.8 
  242. * @param array The default list of multisite callables. 
  243. */ 
  244. return apply_filters( 'jetpack_sync_multisite_callable_whitelist', self::$default_multisite_callable_whitelist ); 
  245.  
  246. static $post_meta_whitelist = array( 
  247. '_feedback_akismet_values',  
  248. '_feedback_email',  
  249. '_feedback_extra_fields',  
  250. '_g_feedback_shortcode',  
  251. '_jetpack_post_thumbnail',  
  252. '_menu_item_classes',  
  253. '_menu_item_menu_item_parent',  
  254. '_menu_item_object',  
  255. '_menu_item_object_id',  
  256. '_menu_item_orphaned',  
  257. '_menu_item_type',  
  258. '_menu_item_xfn',  
  259. '_publicize_facebook_user',  
  260. '_publicize_twitter_user',  
  261. '_thumbnail_id',  
  262. '_wp_attached_file',  
  263. '_wp_attachment_backup_sizes',  
  264. '_wp_attachment_context',  
  265. '_wp_attachment_image_alt',  
  266. '_wp_attachment_is_custom_background',  
  267. '_wp_attachment_is_custom_header',  
  268. '_wp_attachment_metadata',  
  269. '_wp_page_template',  
  270. '_wp_trash_meta_comments_status',  
  271. '_wpas_mess',  
  272. 'content_width',  
  273. 'custom_css_add',  
  274. 'custom_css_preprocessor',  
  275. 'enclosure',  
  276. 'imagedata',  
  277. 'nova_price',  
  278. 'publicize_results',  
  279. 'sharing_disabled',  
  280. 'switch_like_status',  
  281. 'videopress_guid',  
  282. 'vimeo_poster_image',  
  283. 'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY 
  284. ); 
  285.  
  286. public static function get_post_meta_whitelist() { 
  287. /** 
  288. * Filter the list of post meta data that are manageable via the JSON API. 
  289. * @module sync 
  290. * @since 4.8 
  291. * @param array The default list of meta data keys. 
  292. */ 
  293. return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist ); 
  294.  
  295. static $comment_meta_whitelist = array( 
  296. 'hc_avatar',  
  297. 'hc_post_as',  
  298. 'hc_wpcom_id_sig',  
  299. 'hc_foreign_user_id' 
  300. ); 
  301.  
  302. // TODO: move this to server? - these are theme support values 
  303. // that should be synced as jetpack_current_theme_supports_foo option values 
  304. static $default_theme_support_whitelist = array( 
  305. 'post-thumbnails',  
  306. 'post-formats',  
  307. 'custom-header',  
  308. 'custom-background',  
  309. 'custom-logo',  
  310. 'menus',  
  311. 'automatic-feed-links',  
  312. 'editor-style',  
  313. 'widgets',  
  314. 'html5',  
  315. 'title-tag',  
  316. 'jetpack-social-menu',  
  317. 'jetpack-responsive-videos',  
  318. 'infinite-scroll',  
  319. 'site-logo',  
  320. ); 
  321.  
  322. static function is_whitelisted_option( $option ) { 
  323. foreach ( self::$default_options_whitelist as $whitelisted_option ) { 
  324. if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) { 
  325. return true; 
  326. } elseif ( $whitelisted_option === $option ) { 
  327. return true; 
  328.  
  329. return false; 
  330.  
  331. static function get_max_sync_execution_time() { 
  332. $max_exec_time = intval( ini_get( 'max_execution_time' ) ); 
  333. if ( 0 === $max_exec_time ) { 
  334. // 0 actually means "unlimited", but let's not treat it that way 
  335. $max_exec_time = 60; 
  336. return floor( $max_exec_time / 3 ); 
  337.  
  338. static $default_network_options_whitelist = array( 
  339. 'site_name',  
  340. 'jetpack_protect_key',  
  341. 'jetpack_protect_global_whitelist',  
  342. 'active_sitewide_plugins',  
  343. ); 
  344.  
  345. static $default_taxonomy_whitelist = array(); 
  346. static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB 
  347. static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization 
  348. static $default_upload_max_rows = 500; 
  349. static $default_sync_wait_time = 10; // seconds, between syncs 
  350. static $default_sync_wait_threshold = 5; // only wait before next send if the current send took more than X seconds 
  351. static $default_enqueue_wait_time = 10; // wait between attempting to continue a full sync, via requests 
  352. static $default_max_queue_size = 1000; 
  353. static $default_max_queue_lag = 900; // 15 minutes 
  354. static $default_queue_max_writes_sec = 100; // 100 rows a second 
  355. static $default_post_types_blacklist = array(); 
  356. static $default_post_meta_whitelist = array(); 
  357. static $default_comment_meta_whitelist = array(); 
  358. static $default_disable = 0; // completely disable sending data to wpcom 
  359. static $default_sync_via_cron = 1; // use cron to sync 
  360. static $default_render_filtered_content = 0; // render post_filtered_content 
  361. static $default_max_enqueue_full_sync = 100; // max number of items to enqueue at a time when running full sync 
  362. static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue 
  363. static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again 
  364. static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again 
  365. static $default_sync_queue_lock_timeout = 120; // 2 minutes 
  366. static $default_cron_sync_time_limit = 30; // 30 seconds