Automattic /
jetpack
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | require_once( JETPACK__PLUGIN_DIR . 'modules/sso/class.jetpack-sso-helpers.php' ); |
||
| 3 | |||
| 4 | /** |
||
| 5 | * Just some defaults that we share with the server |
||
| 6 | */ |
||
| 7 | class Jetpack_Sync_Defaults { |
||
| 8 | |||
| 9 | static $default_options_whitelist = array( |
||
| 10 | 'stylesheet', |
||
| 11 | 'blogname', |
||
| 12 | 'blogdescription', |
||
| 13 | 'blog_charset', |
||
| 14 | 'permalink_structure', |
||
| 15 | 'category_base', |
||
| 16 | 'tag_base', |
||
| 17 | 'sidebars_widgets', |
||
| 18 | 'comment_moderation', |
||
| 19 | 'default_comment_status', |
||
| 20 | 'page_on_front', |
||
| 21 | 'rss_use_excerpt', |
||
| 22 | 'subscription_options', |
||
| 23 | 'stb_enabled', |
||
| 24 | 'stc_enabled', |
||
| 25 | 'comment_registration', |
||
| 26 | 'show_avatars', |
||
| 27 | 'avatar_default', |
||
| 28 | 'avatar_rating', |
||
| 29 | 'highlander_comment_form_prompt', |
||
| 30 | 'jetpack_comment_form_color_scheme', |
||
| 31 | 'stats_options', |
||
| 32 | 'gmt_offset', |
||
| 33 | 'timezone_string', |
||
| 34 | 'jetpack_sync_non_public_post_stati', |
||
| 35 | 'jetpack_options', |
||
| 36 | 'site_icon', // (int) - ID of core's Site Icon attachment ID |
||
| 37 | 'default_post_format', |
||
| 38 | 'default_category', |
||
| 39 | 'large_size_w', |
||
| 40 | 'large_size_h', |
||
| 41 | 'thumbnail_size_w', |
||
| 42 | 'thumbnail_size_h', |
||
| 43 | 'medium_size_w', |
||
| 44 | 'medium_size_h', |
||
| 45 | 'thumbnail_crop', |
||
| 46 | 'image_default_link_type', |
||
| 47 | 'site_logo', |
||
| 48 | 'sharing-options', |
||
| 49 | 'sharing-services', |
||
| 50 | 'post_count', |
||
| 51 | 'default_ping_status', |
||
| 52 | 'sticky_posts', |
||
| 53 | 'blog_public', |
||
| 54 | 'default_pingback_flag', |
||
| 55 | 'require_name_email', |
||
| 56 | 'close_comments_for_old_posts', |
||
| 57 | 'close_comments_days_old', |
||
| 58 | 'thread_comments', |
||
| 59 | 'thread_comments_depth', |
||
| 60 | 'page_comments', |
||
| 61 | 'comments_per_page', |
||
| 62 | 'default_comments_page', |
||
| 63 | 'comment_order', |
||
| 64 | 'comments_notify', |
||
| 65 | 'moderation_notify', |
||
| 66 | 'social_notifications_like', |
||
| 67 | 'social_notifications_reblog', |
||
| 68 | 'social_notifications_subscribe', |
||
| 69 | 'comment_whitelist', |
||
| 70 | 'comment_max_links', |
||
| 71 | 'moderation_keys', |
||
| 72 | 'jetpack_wga', |
||
| 73 | 'disabled_likes', |
||
| 74 | 'disabled_reblogs', |
||
| 75 | 'jetpack_comment_likes_enabled', |
||
| 76 | 'twitter_via', |
||
| 77 | 'jetpack-twitter-cards-site-tag', |
||
| 78 | 'wpcom_publish_posts_with_markdown', |
||
| 79 | 'wpcom_publish_comments_with_markdown', |
||
| 80 | 'jetpack_activated', |
||
| 81 | 'jetpack_available_modules', |
||
| 82 | 'jetpack_autoupdate_plugins', |
||
| 83 | 'jetpack_autoupdate_plugins_translations', |
||
| 84 | 'jetpack_autoupdate_themes', |
||
| 85 | 'jetpack_autoupdate_themes_translations', |
||
| 86 | 'jetpack_autoupdate_core', |
||
| 87 | 'jetpack_autoupdate_translations', |
||
| 88 | 'carousel_background_color', |
||
| 89 | 'carousel_display_exif', |
||
| 90 | 'jetpack_portfolio', |
||
| 91 | 'jetpack_portfolio_posts_per_page', |
||
| 92 | 'jetpack_testimonial', |
||
| 93 | 'jetpack_testimonial_posts_per_page', |
||
| 94 | 'tiled_galleries', |
||
| 95 | 'gravatar_disable_hovercards', |
||
| 96 | 'infinite_scroll', |
||
| 97 | 'infinite_scroll_google_analytics', |
||
| 98 | 'wp_mobile_excerpt', |
||
| 99 | 'wp_mobile_featured_images', |
||
| 100 | 'wp_mobile_app_promos', |
||
| 101 | 'monitor_receive_notifications', |
||
| 102 | 'post_by_email_address', |
||
| 103 | 'jetpack_protect_key', |
||
| 104 | 'jetpack_protect_global_whitelist', |
||
| 105 | 'jetpack_sso_require_two_step', |
||
| 106 | 'jetpack_relatedposts', |
||
| 107 | 'verification_services_codes', |
||
| 108 | 'users_can_register', |
||
| 109 | 'active_plugins', |
||
| 110 | 'uninstall_plugins', |
||
| 111 | 'advanced_seo_front_page_description', // Jetpack_SEO_Utils::FRONT_PAGE_META_OPTION |
||
| 112 | 'advanced_seo_title_formats', // Jetpack_SEO_Titles::TITLE_FORMATS_OPTION |
||
| 113 | 'jetpack_api_cache_enabled', |
||
| 114 | 'start_of_week', |
||
| 115 | 'blacklist_keys', |
||
| 116 | 'posts_per_page', |
||
| 117 | 'posts_per_rss', |
||
| 118 | 'show_on_front', |
||
| 119 | 'ping_sites', |
||
| 120 | 'uploads_use_yearmonth_folders', |
||
| 121 | 'date_format', |
||
| 122 | 'time_format', |
||
| 123 | 'admin_email', |
||
| 124 | 'new_admin_email', |
||
| 125 | 'default_email_category', |
||
| 126 | 'default_role', |
||
| 127 | 'page_for_posts', |
||
| 128 | 'mailserver_url', |
||
| 129 | 'mailserver_login', // Not syncing contents, only the option name |
||
| 130 | 'mailserver_pass', // Not syncing contents, only the option name |
||
| 131 | 'mailserver_port', |
||
| 132 | ); |
||
| 133 | |||
| 134 | public static function get_options_whitelist() { |
||
| 135 | /** This filter is already documented in json-endpoints/jetpack/class.wpcom-json-api-get-option-endpoint.php */ |
||
| 136 | $options_whitelist = apply_filters( 'jetpack_options_whitelist', self::$default_options_whitelist ); |
||
| 137 | /** |
||
| 138 | * Filter the list of WordPress options that are manageable via the JSON API. |
||
| 139 | * |
||
| 140 | * @module sync |
||
| 141 | * |
||
| 142 | * @since 4.8 |
||
| 143 | * |
||
| 144 | * @param array The default list of options. |
||
| 145 | */ |
||
| 146 | return apply_filters( 'jetpack_sync_options_whitelist', $options_whitelist ); |
||
| 147 | } |
||
| 148 | |||
| 149 | // Do not sync contents for these events, only the option name |
||
| 150 | static $default_options_contentless = array( |
||
|
0 ignored issues
–
show
|
|||
| 151 | 'mailserver_login', |
||
| 152 | 'mailserver_pass', |
||
| 153 | ); |
||
| 154 | |||
| 155 | public static function get_options_contentless() { |
||
| 156 | /** |
||
| 157 | * Filter the list of WordPress options that should be synced without content |
||
| 158 | * |
||
| 159 | * @module sync |
||
| 160 | * |
||
| 161 | * @since 6.1 |
||
| 162 | * |
||
| 163 | * @param array The list of options synced without content. |
||
| 164 | */ |
||
| 165 | return apply_filters( 'jetpack_sync_options_contentless', self::$default_options_contentless ); |
||
| 166 | } |
||
| 167 | |||
| 168 | static $default_constants_whitelist = array( |
||
| 169 | 'EMPTY_TRASH_DAYS', |
||
| 170 | 'WP_POST_REVISIONS', |
||
| 171 | 'AUTOMATIC_UPDATER_DISABLED', |
||
| 172 | 'ABSPATH', |
||
| 173 | 'WP_CONTENT_DIR', |
||
| 174 | 'FS_METHOD', |
||
| 175 | 'DISALLOW_FILE_EDIT', |
||
| 176 | 'DISALLOW_FILE_MODS', |
||
| 177 | 'WP_AUTO_UPDATE_CORE', |
||
| 178 | 'WP_HTTP_BLOCK_EXTERNAL', |
||
| 179 | 'WP_ACCESSIBLE_HOSTS', |
||
| 180 | 'JETPACK__VERSION', |
||
| 181 | 'IS_PRESSABLE', |
||
| 182 | 'DISABLE_WP_CRON', |
||
| 183 | 'ALTERNATE_WP_CRON', |
||
| 184 | 'WP_CRON_LOCK_TIMEOUT', |
||
| 185 | 'PHP_VERSION', |
||
| 186 | 'WP_MEMORY_LIMIT', |
||
| 187 | 'WP_MAX_MEMORY_LIMIT' |
||
| 188 | ); |
||
| 189 | |||
| 190 | public static function get_constants_whitelist() { |
||
| 191 | /** |
||
| 192 | * Filter the list of PHP constants that are manageable via the JSON API. |
||
| 193 | * |
||
| 194 | * @module sync |
||
| 195 | * |
||
| 196 | * @since 4.8 |
||
| 197 | * |
||
| 198 | * @param array The default list of constants options. |
||
| 199 | */ |
||
| 200 | return apply_filters( 'jetpack_sync_constants_whitelist', self::$default_constants_whitelist ); |
||
| 201 | } |
||
| 202 | |||
| 203 | static $default_callable_whitelist = array( |
||
| 204 | 'wp_max_upload_size' => 'wp_max_upload_size', |
||
| 205 | 'is_main_network' => array( 'Jetpack', 'is_multi_network' ), |
||
| 206 | 'is_multi_site' => 'is_multisite', |
||
| 207 | 'main_network_site' => array( 'Jetpack_Sync_Functions', 'main_network_site_url' ), |
||
| 208 | 'site_url' => array( 'Jetpack_Sync_Functions', 'site_url' ), |
||
| 209 | 'home_url' => array( 'Jetpack_Sync_Functions', 'home_url' ), |
||
| 210 | 'single_user_site' => array( 'Jetpack', 'is_single_user_site' ), |
||
| 211 | 'updates' => array( 'Jetpack', 'get_updates' ), |
||
| 212 | 'has_file_system_write_access' => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ), |
||
| 213 | 'is_version_controlled' => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ), |
||
| 214 | 'taxonomies' => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ), |
||
| 215 | 'post_types' => array( 'Jetpack_Sync_Functions', 'get_post_types' ), |
||
| 216 | 'post_type_features' => array( 'Jetpack_Sync_Functions', 'get_post_type_features' ), |
||
| 217 | 'shortcodes' => array( 'Jetpack_Sync_Functions', 'get_shortcodes' ), |
||
| 218 | 'rest_api_allowed_post_types' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_post_types' ), |
||
| 219 | 'rest_api_allowed_public_metadata' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_public_metadata' ), |
||
| 220 | 'sso_is_two_step_required' => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ), |
||
| 221 | 'sso_should_hide_login_form' => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ), |
||
| 222 | 'sso_match_by_email' => array( 'Jetpack_SSO_Helpers', 'match_by_email' ), |
||
| 223 | 'sso_new_user_override' => array( 'Jetpack_SSO_Helpers', 'new_user_override' ), |
||
| 224 | 'sso_bypass_default_login_form' => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ), |
||
| 225 | 'wp_version' => array( 'Jetpack_Sync_Functions', 'wp_version' ), |
||
| 226 | 'get_plugins' => array( 'Jetpack_Sync_Functions', 'get_plugins' ), |
||
| 227 | 'get_plugins_action_links' => array( 'Jetpack_Sync_functions', 'get_plugins_action_links' ), |
||
| 228 | 'active_modules' => array( 'Jetpack', 'get_active_modules' ), |
||
| 229 | 'hosting_provider' => array( 'Jetpack_Sync_Functions', 'get_hosting_provider' ), |
||
| 230 | 'locale' => 'get_locale', |
||
| 231 | 'site_icon_url' => array( 'Jetpack_Sync_Functions', 'site_icon_url' ), |
||
| 232 | 'roles' => array( 'Jetpack_Sync_Functions', 'roles' ), |
||
| 233 | 'timezone' => array( 'Jetpack_Sync_Functions', 'get_timezone' ), |
||
| 234 | ); |
||
| 235 | |||
| 236 | |||
| 237 | static $default_post_type_attributes = array( |
||
| 238 | 'name' => '', |
||
| 239 | 'label' => '', |
||
| 240 | 'labels' => array(), |
||
| 241 | 'description' => '', |
||
| 242 | 'public' => false, |
||
| 243 | 'hierarchical' => false, |
||
| 244 | 'exclude_from_search' => true, |
||
| 245 | 'publicly_queryable' => null, |
||
| 246 | 'show_ui' => false, |
||
| 247 | 'show_in_menu' => null, |
||
| 248 | 'show_in_nav_menus' => null, |
||
| 249 | 'show_in_admin_bar' => false, |
||
| 250 | 'menu_position' => null, |
||
| 251 | 'menu_icon' => null, |
||
| 252 | 'supports' => array(), |
||
| 253 | 'capability_type' => 'post', |
||
| 254 | 'capabilities' => array(), |
||
| 255 | 'cap' => array(), |
||
| 256 | 'map_meta_cap' => true, |
||
| 257 | 'taxonomies' => array(), |
||
| 258 | 'has_archive' => false, |
||
| 259 | 'rewrite' => true, |
||
| 260 | 'query_var' => true, |
||
| 261 | 'can_export' => true, |
||
| 262 | 'delete_with_user' => null, |
||
| 263 | 'show_in_rest' => false, |
||
| 264 | 'rest_base' => false, |
||
| 265 | '_builtin' => false, |
||
| 266 | '_edit_link' => 'post.php?post=%d', |
||
| 267 | ); |
||
| 268 | |||
| 269 | public static function get_callable_whitelist() { |
||
| 270 | /** |
||
| 271 | * Filter the list of callables that are manageable via the JSON API. |
||
| 272 | * |
||
| 273 | * @module sync |
||
| 274 | * |
||
| 275 | * @since 4.8 |
||
| 276 | * |
||
| 277 | * @param array The default list of callables. |
||
| 278 | */ |
||
| 279 | return apply_filters( 'jetpack_sync_callable_whitelist', self::$default_callable_whitelist ); |
||
| 280 | } |
||
| 281 | |||
| 282 | static $blacklisted_post_types = array( |
||
| 283 | 'ai1ec_event', |
||
| 284 | 'bwg_album', |
||
| 285 | 'bwg_gallery', |
||
| 286 | 'customize_changeset', // WP built-in post type for Customizer changesets |
||
| 287 | 'dn_wp_yt_log', |
||
| 288 | 'http', |
||
| 289 | 'idx_page', |
||
| 290 | 'jetpack_migration', |
||
| 291 | 'postman_sent_mail', |
||
| 292 | 'rssap-feed', |
||
| 293 | 'rssmi_feed_item', |
||
| 294 | 'secupress_log_action', |
||
| 295 | 'sg_optimizer_jobs', |
||
| 296 | 'snitch', |
||
| 297 | 'wpephpcompat_jobs', |
||
| 298 | 'wprss_feed_item', |
||
| 299 | 'wp_automatic', |
||
| 300 | 'jp_sitemap_master', |
||
| 301 | 'jp_sitemap', |
||
| 302 | 'jp_sitemap_index', |
||
| 303 | 'jp_img_sitemap', |
||
| 304 | 'jp_img_sitemap_index', |
||
| 305 | 'jp_vid_sitemap', |
||
| 306 | 'jp_vid_sitemap_index', |
||
| 307 | ); |
||
| 308 | |||
| 309 | static $default_post_checksum_columns = array( |
||
| 310 | 'ID', |
||
| 311 | 'post_modified', |
||
| 312 | ); |
||
| 313 | |||
| 314 | static $default_post_meta_checksum_columns = array( |
||
| 315 | 'meta_id', |
||
| 316 | 'meta_value' |
||
| 317 | ); |
||
| 318 | |||
| 319 | static $default_comment_checksum_columns = array( |
||
| 320 | 'comment_ID', |
||
| 321 | 'comment_content', |
||
| 322 | ); |
||
| 323 | |||
| 324 | static $default_comment_meta_checksum_columns = array( |
||
| 325 | 'meta_id', |
||
| 326 | 'meta_value' |
||
| 327 | ); |
||
| 328 | |||
| 329 | static $default_option_checksum_columns = array( |
||
| 330 | 'option_name', |
||
| 331 | 'option_value', |
||
| 332 | ); |
||
| 333 | |||
| 334 | static $default_multisite_callable_whitelist = array( |
||
| 335 | 'network_name' => array( 'Jetpack', 'network_name' ), |
||
| 336 | 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), |
||
| 337 | 'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ), |
||
| 338 | 'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ), |
||
| 339 | 'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ), |
||
| 340 | 'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ), |
||
| 341 | ); |
||
| 342 | |||
| 343 | public static function get_multisite_callable_whitelist() { |
||
| 344 | /** |
||
| 345 | * Filter the list of multisite callables that are manageable via the JSON API. |
||
| 346 | * |
||
| 347 | * @module sync |
||
| 348 | * |
||
| 349 | * @since 4.8 |
||
| 350 | * |
||
| 351 | * @param array The default list of multisite callables. |
||
| 352 | */ |
||
| 353 | return apply_filters( 'jetpack_sync_multisite_callable_whitelist', self::$default_multisite_callable_whitelist ); |
||
| 354 | } |
||
| 355 | |||
| 356 | static $post_meta_whitelist = array( |
||
| 357 | '_feedback_akismet_values', |
||
| 358 | '_feedback_email', |
||
| 359 | '_feedback_extra_fields', |
||
| 360 | '_g_feedback_shortcode', |
||
| 361 | '_jetpack_post_thumbnail', |
||
| 362 | '_menu_item_classes', |
||
| 363 | '_menu_item_menu_item_parent', |
||
| 364 | '_menu_item_object', |
||
| 365 | '_menu_item_object_id', |
||
| 366 | '_menu_item_orphaned', |
||
| 367 | '_menu_item_type', |
||
| 368 | '_menu_item_xfn', |
||
| 369 | '_publicize_facebook_user', |
||
| 370 | '_publicize_twitter_user', |
||
| 371 | '_thumbnail_id', |
||
| 372 | '_wp_attached_file', |
||
| 373 | '_wp_attachment_backup_sizes', |
||
| 374 | '_wp_attachment_context', |
||
| 375 | '_wp_attachment_image_alt', |
||
| 376 | '_wp_attachment_is_custom_background', |
||
| 377 | '_wp_attachment_is_custom_header', |
||
| 378 | '_wp_attachment_metadata', |
||
| 379 | '_wp_page_template', |
||
| 380 | '_wp_trash_meta_comments_status', |
||
| 381 | '_wpas_mess', |
||
| 382 | 'content_width', |
||
| 383 | 'custom_css_add', |
||
| 384 | 'custom_css_preprocessor', |
||
| 385 | 'enclosure', |
||
| 386 | 'imagedata', |
||
| 387 | 'nova_price', |
||
| 388 | 'publicize_results', |
||
| 389 | 'sharing_disabled', |
||
| 390 | 'switch_like_status', |
||
| 391 | 'videopress_guid', |
||
| 392 | 'vimeo_poster_image', |
||
| 393 | 'advanced_seo_description', // Jetpack_SEO_Posts::DESCRIPTION_META_KEY |
||
| 394 | ); |
||
| 395 | |||
| 396 | public static function get_post_meta_whitelist() { |
||
| 397 | /** |
||
| 398 | * Filter the list of post meta data that are manageable via the JSON API. |
||
| 399 | * |
||
| 400 | * @module sync |
||
| 401 | * |
||
| 402 | * @since 4.8 |
||
| 403 | * |
||
| 404 | * @param array The default list of meta data keys. |
||
| 405 | */ |
||
| 406 | return apply_filters( 'jetpack_sync_post_meta_whitelist', self::$post_meta_whitelist ); |
||
| 407 | } |
||
| 408 | |||
| 409 | static $comment_meta_whitelist = array( |
||
| 410 | 'hc_avatar', |
||
| 411 | 'hc_post_as', |
||
| 412 | 'hc_wpcom_id_sig', |
||
| 413 | 'hc_foreign_user_id' |
||
| 414 | ); |
||
| 415 | |||
| 416 | public static function get_comment_meta_whitelist() { |
||
| 417 | /** |
||
| 418 | * Filter the list of comment meta data that are manageable via the JSON API. |
||
| 419 | * |
||
| 420 | * @module sync |
||
| 421 | * |
||
| 422 | * @since 5.7.0 |
||
| 423 | * |
||
| 424 | * @param array The default list of comment meta data keys. |
||
| 425 | */ |
||
| 426 | return apply_filters( 'jetpack_sync_comment_meta_whitelist', self::$comment_meta_whitelist ); |
||
| 427 | } |
||
| 428 | |||
| 429 | // TODO: move this to server? - these are theme support values |
||
| 430 | // that should be synced as jetpack_current_theme_supports_foo option values |
||
| 431 | static $default_theme_support_whitelist = array( |
||
| 432 | 'post-thumbnails', |
||
| 433 | 'post-formats', |
||
| 434 | 'custom-header', |
||
| 435 | 'custom-background', |
||
| 436 | 'custom-logo', |
||
| 437 | 'menus', |
||
| 438 | 'automatic-feed-links', |
||
| 439 | 'editor-style', |
||
| 440 | 'widgets', |
||
| 441 | 'html5', |
||
| 442 | 'title-tag', |
||
| 443 | 'jetpack-social-menu', |
||
| 444 | 'jetpack-responsive-videos', |
||
| 445 | 'infinite-scroll', |
||
| 446 | 'site-logo', |
||
| 447 | ); |
||
| 448 | |||
| 449 | static function is_whitelisted_option( $option ) { |
||
| 450 | foreach ( self::$default_options_whitelist as $whitelisted_option ) { |
||
| 451 | if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) { |
||
| 452 | return true; |
||
| 453 | } elseif ( $whitelisted_option === $option ) { |
||
| 454 | return true; |
||
| 455 | } |
||
| 456 | } |
||
| 457 | |||
| 458 | return false; |
||
| 459 | } |
||
| 460 | |||
| 461 | static $default_capabilities_whitelist = array( |
||
| 462 | 'switch_themes', |
||
| 463 | 'edit_themes', |
||
| 464 | 'edit_theme_options', |
||
| 465 | 'install_themes', |
||
| 466 | 'activate_plugins', |
||
| 467 | 'edit_plugins', |
||
| 468 | 'install_plugins', |
||
| 469 | 'edit_users', |
||
| 470 | 'edit_files', |
||
| 471 | 'manage_options', |
||
| 472 | 'moderate_comments', |
||
| 473 | 'manage_categories', |
||
| 474 | 'manage_links', |
||
| 475 | 'upload_files', |
||
| 476 | 'import', |
||
| 477 | 'unfiltered_html', |
||
| 478 | 'edit_posts', |
||
| 479 | 'edit_others_posts', |
||
| 480 | 'edit_published_posts', |
||
| 481 | 'publish_posts', |
||
| 482 | 'edit_pages', |
||
| 483 | 'read', |
||
| 484 | 'publish_pages', |
||
| 485 | 'edit_others_pages', |
||
| 486 | 'edit_published_pages', |
||
| 487 | 'delete_pages', |
||
| 488 | 'delete_others_pages', |
||
| 489 | 'delete_published_pages', |
||
| 490 | 'delete_posts', |
||
| 491 | 'delete_others_posts', |
||
| 492 | 'delete_published_posts', |
||
| 493 | 'delete_private_posts', |
||
| 494 | 'edit_private_posts', |
||
| 495 | 'read_private_posts', |
||
| 496 | 'delete_private_pages', |
||
| 497 | 'edit_private_pages', |
||
| 498 | 'read_private_pages', |
||
| 499 | 'delete_users', |
||
| 500 | 'create_users', |
||
| 501 | 'unfiltered_upload', |
||
| 502 | 'edit_dashboard', |
||
| 503 | 'customize', |
||
| 504 | 'delete_site', |
||
| 505 | 'update_plugins', |
||
| 506 | 'delete_plugins', |
||
| 507 | 'update_themes', |
||
| 508 | 'update_core', |
||
| 509 | 'list_users', |
||
| 510 | 'remove_users', |
||
| 511 | 'add_users', |
||
| 512 | 'promote_users', |
||
| 513 | 'delete_themes', |
||
| 514 | 'export', |
||
| 515 | 'edit_comment', |
||
| 516 | 'upload_plugins', |
||
| 517 | 'upload_themes', |
||
| 518 | ); |
||
| 519 | |||
| 520 | public static function get_capabilities_whitelist() { |
||
| 521 | /** |
||
| 522 | * Filter the list of capabilities that we care about |
||
| 523 | * |
||
| 524 | * @module sync |
||
| 525 | * |
||
| 526 | * @since 5.5.0 |
||
| 527 | * |
||
| 528 | * @param array The default list of capabilities. |
||
| 529 | */ |
||
| 530 | return apply_filters( 'jetpack_sync_capabilities_whitelist', self::$default_capabilities_whitelist ); |
||
| 531 | } |
||
| 532 | |||
| 533 | static function get_max_sync_execution_time() { |
||
| 534 | $max_exec_time = intval( ini_get( 'max_execution_time' ) ); |
||
| 535 | if ( 0 === $max_exec_time ) { |
||
| 536 | // 0 actually means "unlimited", but let's not treat it that way |
||
| 537 | $max_exec_time = 60; |
||
| 538 | } |
||
| 539 | return floor( $max_exec_time / 3 ); |
||
| 540 | } |
||
| 541 | |||
| 542 | static $default_network_options_whitelist = array( |
||
| 543 | 'site_name', |
||
| 544 | 'jetpack_protect_key', |
||
| 545 | 'jetpack_protect_global_whitelist', |
||
| 546 | 'active_sitewide_plugins', |
||
| 547 | ); |
||
| 548 | |||
| 549 | static $default_taxonomy_whitelist = array(); |
||
| 550 | static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB |
||
| 551 | static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization |
||
| 552 | static $default_upload_max_rows = 500; |
||
| 553 | static $default_sync_wait_time = 10; // seconds, between syncs |
||
| 554 | static $default_sync_wait_threshold = 5; // only wait before next send if the current send took more than X seconds |
||
| 555 | static $default_enqueue_wait_time = 10; // wait between attempting to continue a full sync, via requests |
||
| 556 | static $default_max_queue_size = 1000; |
||
| 557 | static $default_max_queue_lag = 900; // 15 minutes |
||
| 558 | static $default_queue_max_writes_sec = 100; // 100 rows a second |
||
| 559 | static $default_post_types_blacklist = array(); |
||
| 560 | static $default_post_meta_whitelist = array(); |
||
| 561 | static $default_comment_meta_whitelist = array(); |
||
| 562 | static $default_disable = 0; // completely disable sending data to wpcom |
||
| 563 | static $default_sync_via_cron = 1; // use cron to sync |
||
| 564 | static $default_render_filtered_content = 0; // render post_filtered_content |
||
| 565 | static $default_max_enqueue_full_sync = 100; // max number of items to enqueue at a time when running full sync |
||
| 566 | static $default_max_queue_size_full_sync = 1000; // max number of total items in the full sync queue |
||
| 567 | static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again |
||
| 568 | static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again |
||
| 569 | static $default_sync_queue_lock_timeout = 120; // 2 minutes |
||
| 570 | static $default_cron_sync_time_limit = 30; // 30 seconds |
||
| 571 | } |
||
| 572 |
The PSR-2 coding standard requires that all properties in a class have their visibility explicitly declared. If you declare a property using
the property is implicitly global.
To learn more about the PSR-2, please see the PHP-FIG site on the PSR-2.