Completed
Push — update/non-admin-view ( b1ee9d...762240 )
by
unknown
10:19
created

Jetpack_Sync_Defaults   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 226
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 0

Importance

Changes 5
Bugs 1 Features 0
Metric Value
c 5
b 1
f 0
dl 0
loc 226
rs 10
wmc 6
lcom 2
cbo 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A get_blacklisted_post_types_sql() 0 3 1
B is_whitelisted_option() 0 11 5
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(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_options_whitelist.

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...
9
		'stylesheet',
10
		'blogname',
11
		'home',
12
		'siteurl',
13
		'blogdescription',
14
		'blog_charset',
15
		'permalink_structure',
16
		'category_base',
17
		'tag_base',
18
		'comment_moderation',
19
		'default_comment_status',
20
		'jetpack_site_icon_url',
21
		'page_on_front',
22
		'rss_use_excerpt',
23
		'subscription_options',
24
		'stb_enabled',
25
		'stc_enabled',
26
		'comment_registration',
27
		'show_avatars',
28
		'avatar_default',
29
		'avatar_rating',
30
		'highlander_comment_form_prompt',
31
		'jetpack_comment_form_color_scheme',
32
		'stats_options',
33
		'gmt_offset',
34
		'timezone_string',
35
		'jetpack_sync_non_public_post_stati',
36
		'jetpack_options',
37
		'site_icon', // (int) - ID of core's Site Icon attachment ID
38
		'default_post_format',
39
		'default_category',
40
		'large_size_w',
41
		'large_size_h',
42
		'thumbnail_size_w',
43
		'thumbnail_size_h',
44
		'medium_size_w',
45
		'medium_size_h',
46
		'thumbnail_crop',
47
		'image_default_link_type',
48
		'site_logo',
49
		'sharing-options',
50
		'sharing-services',
51
		'post_count',
52
		'default_ping_status',
53
		'sticky_posts',
54
		'blog_public',
55
		'default_pingback_flag',
56
		'require_name_email',
57
		'close_comments_for_old_posts',
58
		'close_comments_days_old',
59
		'thread_comments',
60
		'thread_comments_depth',
61
		'page_comments',
62
		'comments_per_page',
63
		'default_comments_page',
64
		'comment_order',
65
		'comments_notify',
66
		'moderation_notify',
67
		'social_notifications_like',
68
		'social_notifications_reblog',
69
		'social_notifications_subscribe',
70
		'comment_whitelist',
71
		'comment_max_links',
72
		'moderation_keys',
73
		'blacklist_keys',
74
		'lang_id',
75
		'wga',
76
		'disabled_likes',
77
		'disabled_reblogs',
78
		'jetpack_comment_likes_enabled',
79
		'twitter_via',
80
		'twitter-cards-site-tag',
81
		'wpcom_publish_posts_with_markdown',
82
		'wpcom_publish_comments_with_markdown',
83
		'jetpack_activated',
84
		'jetpack_active_modules',
85
		'jetpack_available_modules',
86
		'jetpack_autoupdate_plugins',
87
		'jetpack_autoupdate_themes',
88
		'jetpack_autoupdate_core',
89
		'carousel_background_color',
90
		'carousel_display_exif',
91
		'jetpack_portfolio',
92
		'jetpack_portfolio_posts_per_page',
93
		'jetpack_testimonial',
94
		'jetpack_testimonial_posts_per_page',
95
		'tiled_galleries',
96
		'gravatar_disable_hovercards',
97
		'infinite_scroll',
98
		'infinite_scroll_google_analytics',
99
		'wp_mobile_excerpt',
100
		'wp_mobile_featured_images',
101
		'wp_mobile_app_promos',
102
		'monitor_receive_notifications',
103
		'post_by_email_address',
104
		'jetpack_protect_key',
105
		'jetpack_protect_global_whitelist',
106
		'sharing_services',
107
		'jetpack_sso_require_two_step',
108
		'jetpack_relatedposts',
109
		'verification_services_codes',
110
		'users_can_register',
111
		'active_plugins',
112
		'uninstall_plugins',
113
	);
114
115
	static $default_constants_whitelist = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_constants_whitelist.

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...
116
		'EMPTY_TRASH_DAYS',
117
		'WP_POST_REVISIONS',
118
		'AUTOMATIC_UPDATER_DISABLED',
119
		'ABSPATH',
120
		'WP_CONTENT_DIR',
121
		'FS_METHOD',
122
		'DISALLOW_FILE_EDIT',
123
		'DISALLOW_FILE_MODS',
124
		'WP_AUTO_UPDATE_CORE',
125
		'WP_HTTP_BLOCK_EXTERNAL',
126
		'WP_ACCESSIBLE_HOSTS',
127
		'JETPACK__VERSION'
128
	);
129
130
	static $default_callable_whitelist = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_callable_whitelist.

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...
131
		'wp_max_upload_size'              => 'wp_max_upload_size',
132
		'is_main_network'                 => array( 'Jetpack', 'is_multi_network' ),
133
		'is_multi_site'                   => 'is_multisite',
134
		'main_network_site'               => array( 'Jetpack_Sync_Functions', 'main_network_site_url' ),
135
		'site_url'                        => array( 'Jetpack_Sync_Functions', 'site_url' ),
136
		'home_url'                        => array( 'Jetpack_Sync_Functions', 'home_url' ),
137
		'single_user_site'                => array( 'Jetpack', 'is_single_user_site' ),
138
		'updates'                         => array( 'Jetpack', 'get_updates' ),
139
		'has_file_system_write_access'    => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ),
140
		'is_version_controlled'           => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ),
141
		'taxonomies'                      => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ),
142
		'post_types'                      => array( 'Jetpack_Sync_Functions', 'get_post_types' ),
143
		'rest_api_allowed_post_types'     => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_post_types' ),
144
		'rest_api_allowed_public_metadata'=> array( 'Jetpack_Sync_Functions', 'rest_api_allowed_public_metadata' ),
145
		'sso_is_two_step_required'        => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ),
146
		'sso_should_hide_login_form'      => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ),
147
		'sso_match_by_email'              => array( 'Jetpack_SSO_Helpers', 'match_by_email' ),
148
		'sso_new_user_override'           => array( 'Jetpack_SSO_Helpers', 'new_user_override' ),
149
		'sso_bypass_default_login_form'   => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ),
150
		'wp_version'                      => array( 'Jetpack_Sync_Functions', 'wp_version' ),
151
		'get_plugins'                     => array( 'Jetpack_Sync_Functions', 'get_plugins' ),
152
	);
153
154
	static $blacklisted_post_types = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $blacklisted_post_types.

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...
155
		'ai1ec_event' // https://irc.automattic.com/chanlog.php?channel=jetpack&day=2014-05-29&sort=asc#m71850
156
	);
157
158
	// returns escapted SQL that can be injected into a WHERE clause
159
	static function get_blacklisted_post_types_sql() {
160
		return 'post_type NOT IN (\'' . join( '\', \'', array_map( 'esc_sql', self::$blacklisted_post_types ) ) . '\')';
161
	}
162
163
	static $default_multisite_callable_whitelist = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_multisite_callable_whitelist.

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...
164
		'network_name'                        => array( 'Jetpack', 'network_name' ),
165
		'network_allow_new_registrations'     => array( 'Jetpack', 'network_allow_new_registrations' ),
166
		'network_add_new_users'               => array( 'Jetpack', 'network_add_new_users' ),
167
		'network_site_upload_space'           => array( 'Jetpack', 'network_site_upload_space' ),
168
		'network_upload_file_types'           => array( 'Jetpack', 'network_upload_file_types' ),
169
		'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ),
170
	);
171
	
172
173
	static $default_whitelist_meta_keys = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_whitelist_meta_keys.

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...
174
		'_wp_attachment_metadata',
175
		'_thumbnail_id',
176
		'_wpas_mess',
177
		'_wpas_skip_',
178
		'_g_feedback_shortcode',
179
		'_feedback_extra_fields',
180
		'_feedback_akismet_values',
181
		'_publicize_facebook_user',
182
		'_wp_attachment_image_alt',
183
		'_jetpack_post_thumbnail',
184
		'_thumbnail_id',
185
		'_wp_attachment_metadata',
186
		'_wp_page_template',
187
		'_publicize_twitter_user'
188
	);
189
190
	// TODO: move this to server? - these are theme support values
0 ignored issues
show
Coding Style Best Practice introduced by
Comments for TODO tasks are often forgotten in the code; it might be better to use a dedicated issue tracker.
Loading history...
191
	// that should be synced as jetpack_current_theme_supports_foo option values
192
	static $default_theme_support_whitelist = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_theme_support_whitelist.

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...
193
		'post-thumbnails',
194
		'post-formats',
195
		'custom-header',
196
		'custom-background',
197
		'custom-logo',
198
		'menus',
199
		'automatic-feed-links',
200
		'editor-style',
201
		'widgets',
202
		'html5',
203
		'title-tag',
204
		'jetpack-social-menu',
205
		'jetpack-responsive-videos',
206
		'infinite-scroll',
207
		'site-logo',
208
	);
209
210
	static function is_whitelisted_option( $option ) {
211
		foreach ( self::$default_options_whitelist as $whitelisted_option ) {
212
			if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) {
213
				return true;
214
			} elseif ( $whitelisted_option === $option ) {
215
				return true;
216
			}
217
		}
218
		
219
		return false;
220
	}
221
222
	static $default_network_options_whitelist = array( 'site_name', 'jetpack_protect_key', 'jetpack_protect_global_whitelist', 'active_sitewide_plugins' );
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_network_options_whitelist.

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...
223
	static $default_taxonomy_whitelist = array();
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_taxonomy_whitelist.

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...
224
	static $default_dequeue_max_bytes = 500000; // very conservative value, 1/2 MB
0 ignored issues
show
Coding Style introduced by
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...
225
	static $default_upload_max_bytes = 600000; // a little bigger than the upload limit to account for serialization
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_upload_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...
226
	static $default_upload_max_rows = 500;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_upload_max_rows.

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...
227
	static $default_sync_wait_time = 10; // seconds, between syncs
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_sync_wait_time.

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...
228
	static $default_max_queue_size = 1000;
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_max_queue_size.

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...
229
	static $default_max_queue_lag = 900; // 15 minutes
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_max_queue_lag.

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...
230
	static $default_sync_callables_wait_time = MINUTE_IN_SECONDS; // seconds before sending callables again
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_sync_callables_wait_time.

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...
231
	static $default_sync_constants_wait_time = HOUR_IN_SECONDS; // seconds before sending constants again
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_sync_constants_wait_time.

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...
232
}
233