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 | |||
| 3 | /** |
||
| 4 | * Just some defaults that we share with the server |
||
| 5 | */ |
||
| 6 | class Jetpack_Sync_Defaults { |
||
| 7 | static $default_options_whitelist = array( |
||
| 8 | 'stylesheet', |
||
| 9 | 'blogname', |
||
| 10 | 'home', |
||
| 11 | 'siteurl', |
||
| 12 | 'blogdescription', |
||
| 13 | 'blog_charset', |
||
| 14 | 'permalink_structure', |
||
| 15 | 'category_base', |
||
| 16 | 'tag_base', |
||
| 17 | 'comment_moderation', |
||
| 18 | 'default_comment_status', |
||
| 19 | 'jetpack_site_icon_url', |
||
| 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 | 'blacklist_keys', |
||
| 73 | 'lang_id', |
||
| 74 | 'wga', |
||
| 75 | 'disabled_likes', |
||
| 76 | 'disabled_reblogs', |
||
| 77 | 'jetpack_comment_likes_enabled', |
||
| 78 | 'twitter_via', |
||
| 79 | 'twitter-cards-site-tag', |
||
| 80 | 'wpcom_publish_posts_with_markdown', |
||
| 81 | 'wpcom_publish_comments_with_markdown', |
||
| 82 | 'jetpack_activated', |
||
| 83 | 'jetpack_active_modules', |
||
| 84 | 'jetpack_available_modules', |
||
| 85 | 'jetpack_autoupdate_plugins', |
||
| 86 | 'jetpack_autoupdate_themes', |
||
| 87 | 'jetpack_autoupdate_core', |
||
| 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 | 'sharing_services', |
||
| 106 | 'jetpack_sso_require_two_step', |
||
| 107 | 'jetpack_relatedposts', |
||
| 108 | 'verification_services_codes', |
||
| 109 | ); |
||
| 110 | |||
| 111 | static $default_constants_whitelist = array( |
||
| 112 | 'EMPTY_TRASH_DAYS', |
||
| 113 | 'WP_POST_REVISIONS', |
||
| 114 | 'AUTOMATIC_UPDATER_DISABLED', |
||
| 115 | 'ABSPATH', |
||
| 116 | 'WP_CONTENT_DIR', |
||
| 117 | 'FS_METHOD', |
||
| 118 | 'DISALLOW_FILE_EDIT', |
||
| 119 | 'DISALLOW_FILE_MODS', |
||
| 120 | 'WP_AUTO_UPDATE_CORE', |
||
| 121 | 'WP_HTTP_BLOCK_EXTERNAL', |
||
| 122 | 'WP_ACCESSIBLE_HOSTS', |
||
| 123 | 'JETPACK__VERSION' |
||
| 124 | ); |
||
| 125 | |||
| 126 | static $default_callable_whitelist = array( |
||
| 127 | 'wp_max_upload_size' => 'wp_max_upload_size', |
||
| 128 | 'is_main_network' => array( 'Jetpack', 'is_multi_network' ), |
||
| 129 | 'is_multi_site' => 'is_multisite', |
||
| 130 | 'main_network_site' => 'network_site_url', |
||
| 131 | 'single_user_site' => array( 'Jetpack', 'is_single_user_site' ), |
||
| 132 | 'has_file_system_write_access' => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ), |
||
| 133 | 'is_version_controlled' => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ), |
||
| 134 | 'taxonomies' => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ), |
||
| 135 | 'post_types' => array( 'Jetpack_Sync_Functions', 'get_post_types' ), |
||
| 136 | ); |
||
| 137 | |||
| 138 | static $blacklisted_post_types = array( |
||
| 139 | 'revision', // "don't ever sync revisions, they overwrite post meta for the parent post." |
||
| 140 | 'ai1ec_event' // https://irc.automattic.com/chanlog.php?channel=jetpack&day=2014-05-29&sort=asc#m71850 |
||
| 141 | ); |
||
| 142 | |||
| 143 | // returns escapted SQL that can be injected into a WHERE clause |
||
| 144 | static function get_blacklisted_post_types_sql() { |
||
| 145 | return 'post_type NOT IN (\'' . join( '\', \'', array_map( 'esc_sql', self::$blacklisted_post_types ) ) . '\')'; |
||
| 146 | } |
||
| 147 | |||
| 148 | static $default_multisite_callable_whitelist = array( |
||
| 149 | 'network_name' => array( 'Jetpack', 'network_name' ), |
||
| 150 | 'network_allow_new_registrations' => array( 'Jetpack', 'network_allow_new_registrations' ), |
||
| 151 | 'network_add_new_users' => array( 'Jetpack', 'network_add_new_users' ), |
||
| 152 | 'network_site_upload_space' => array( 'Jetpack', 'network_site_upload_space' ), |
||
| 153 | 'network_upload_file_types' => array( 'Jetpack', 'network_upload_file_types' ), |
||
| 154 | 'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ), |
||
| 155 | ); |
||
| 156 | |||
| 157 | static $default_whitelist_meta_keys = array( |
||
| 158 | '_wp_attachment_metadata', |
||
| 159 | '_thumbnail_id', |
||
| 160 | ); |
||
| 161 | |||
| 162 | // TODO: move this to server? - these are theme support values |
||
| 163 | // that should be synced as jetpack_current_theme_supports_foo option values |
||
| 164 | static $default_theme_support_whitelist = array( |
||
| 165 | 'post-thumbnails', |
||
| 166 | 'post-formats', |
||
| 167 | 'custom-header', |
||
| 168 | 'custom-background', |
||
| 169 | 'custom-logo', |
||
| 170 | 'menus', |
||
| 171 | 'automatic-feed-links', |
||
| 172 | 'editor-style', |
||
| 173 | 'widgets', |
||
| 174 | 'html5', |
||
| 175 | 'title-tag', |
||
| 176 | 'jetpack-social-menu', |
||
| 177 | 'jetpack-responsive-videos', |
||
| 178 | 'infinite-scroll', |
||
| 179 | 'site-logo', |
||
| 180 | ); |
||
| 181 | |||
| 182 | static function is_whitelisted_option( $option ) { |
||
| 183 | foreach ( self::$default_options_whitelist as $whitelisted_option ) { |
||
| 184 | if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) { |
||
| 185 | return true; |
||
| 186 | } elseif ( $whitelisted_option === $option ) { |
||
| 187 | return true; |
||
| 188 | } |
||
| 189 | } |
||
| 190 | |||
| 191 | return false; |
||
| 192 | } |
||
| 193 | |||
| 194 | static $default_network_options_whitelist = array( 'site_name', 'jetpack_protect_key', 'jetpack_protect_global_whitelist' ); |
||
|
0 ignored issues
–
show
|
|||
| 195 | static $default_taxonomy_whitelist = array(); |
||
| 196 | static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB |
||
|
0 ignored issues
–
show
The visibility should be declared for property
$default_dequeue_max_bytes.
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...
|
|||
| 197 | static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization |
||
| 198 | static $default_upload_max_rows = 500; |
||
| 199 | static $default_sync_wait_time = 10; // seconds, between syncs |
||
| 200 | static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again |
||
| 201 | static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again |
||
| 202 | } |
||
| 203 |
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.