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