Completed
Push — update/version-432b1 ( bcfa87...258c8d )
by
unknown
86:43 queued 77:29
created

get_max_sync_execution_time()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 5
nc 2
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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
		'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
		'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_themes',
84
		'jetpack_autoupdate_core',
85
		'carousel_background_color',
86
		'carousel_display_exif',
87
		'jetpack_portfolio',
88
		'jetpack_portfolio_posts_per_page',
89
		'jetpack_testimonial',
90
		'jetpack_testimonial_posts_per_page',
91
		'tiled_galleries',
92
		'gravatar_disable_hovercards',
93
		'infinite_scroll',
94
		'infinite_scroll_google_analytics',
95
		'wp_mobile_excerpt',
96
		'wp_mobile_featured_images',
97
		'wp_mobile_app_promos',
98
		'monitor_receive_notifications',
99
		'post_by_email_address',
100
		'jetpack_protect_key',
101
		'jetpack_protect_global_whitelist',
102
		'sharing_services',
103
		'jetpack_sso_require_two_step',
104
		'jetpack_relatedposts',
105
		'verification_services_codes',
106
		'users_can_register',
107
		'active_plugins',
108
		'uninstall_plugins',
109
	);
110
111
	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...
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
		'IS_PRESSABLE',
125
	);
126
127
	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...
128
		'wp_max_upload_size'               => 'wp_max_upload_size',
129
		'is_main_network'                  => array( 'Jetpack', 'is_multi_network' ),
130
		'is_multi_site'                    => 'is_multisite',
131
		'main_network_site'                => array( 'Jetpack_Sync_Functions', 'main_network_site_url' ),
132
		'site_url'                         => array( 'Jetpack_Sync_Functions', 'site_url' ),
133
		'home_url'                         => array( 'Jetpack_Sync_Functions', 'home_url' ),
134
		'single_user_site'                 => array( 'Jetpack', 'is_single_user_site' ),
135
		'updates'                          => array( 'Jetpack', 'get_updates' ),
136
		'has_file_system_write_access'     => array( 'Jetpack_Sync_Functions', 'file_system_write_access' ),
137
		'is_version_controlled'            => array( 'Jetpack_Sync_Functions', 'is_version_controlled' ),
138
		'taxonomies'                       => array( 'Jetpack_Sync_Functions', 'get_taxonomies' ),
139
		'post_types'                       => array( 'Jetpack_Sync_Functions', 'get_post_types' ),
140
		'post_type_features'               => array( 'Jetpack_Sync_Functions', 'get_post_type_features' ),
141
		'rest_api_allowed_post_types'      => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_post_types' ),
142
		'rest_api_allowed_public_metadata' => array( 'Jetpack_Sync_Functions', 'rest_api_allowed_public_metadata' ),
143
		'sso_is_two_step_required'         => array( 'Jetpack_SSO_Helpers', 'is_two_step_required' ),
144
		'sso_should_hide_login_form'       => array( 'Jetpack_SSO_Helpers', 'should_hide_login_form' ),
145
		'sso_match_by_email'               => array( 'Jetpack_SSO_Helpers', 'match_by_email' ),
146
		'sso_new_user_override'            => array( 'Jetpack_SSO_Helpers', 'new_user_override' ),
147
		'sso_bypass_default_login_form'    => array( 'Jetpack_SSO_Helpers', 'bypass_login_forward_wpcom' ),
148
		'wp_version'                       => array( 'Jetpack_Sync_Functions', 'wp_version' ),
149
		'get_plugins'                      => array( 'Jetpack_Sync_Functions', 'get_plugins' ),
150
		'active_modules'                   => array( 'Jetpack', 'get_active_modules' ),
151
		'hosting_provider'                 => array( 'Jetpack_Sync_Functions', 'get_hosting_provider' ),
152
		'locale'                           => 'get_locale',
153
		'site_icon_url'                    => array( 'Jetpack_Sync_Functions', 'site_icon_url' ),
154
	);
155
156
	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...
157
		'ai1ec_event',
158
		'snitch',
159
	);
160
161
	static $default_post_checksum_columns = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_post_checksum_columns.

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...
162
		'ID',
163
		'post_modified',
164
	); 
165
166
	static $default_comment_checksum_columns = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_comment_checksum_columns.

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...
167
		'comment_ID',
168
		'comment_content',
169
	); 
170
171
	static $default_option_checksum_columns = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_option_checksum_columns.

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...
172
		'option_name',
173
		'option_value',
174
	);
175
176
	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...
177
		'network_name'                        => array( 'Jetpack', 'network_name' ),
178
		'network_allow_new_registrations'     => array( 'Jetpack', 'network_allow_new_registrations' ),
179
		'network_add_new_users'               => array( 'Jetpack', 'network_add_new_users' ),
180
		'network_site_upload_space'           => array( 'Jetpack', 'network_site_upload_space' ),
181
		'network_upload_file_types'           => array( 'Jetpack', 'network_upload_file_types' ),
182
		'network_enable_administration_menus' => array( 'Jetpack', 'network_enable_administration_menus' ),
183
	);
184
185
186
	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...
187
		'_wp_attachment_metadata',
188
		'_thumbnail_id',
189
		'_wpas_mess',
190
		'_wpas_skip_',
191
		'_g_feedback_shortcode',
192
		'_feedback_extra_fields',
193
		'_feedback_akismet_values',
194
		'_publicize_facebook_user',
195
		'_wp_attachment_image_alt',
196
		'_jetpack_post_thumbnail',
197
		'_thumbnail_id',
198
		'_wp_attachment_metadata',
199
		'_wp_page_template',
200
		'_publicize_twitter_user',
201
		'_wp_trash_meta_comments_status',
202
		'_wp_attached_file',
203
	);
204
205
	static $default_blacklist_meta_keys = array(
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_blacklist_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...
206
		'post_views_count',
207
		'Views',
208
		'tve_leads_impressions',
209
		'views',
210
		'scc_share_count_crawldate',
211
		'wprss_last_update',
212
		'wprss_feed_is_updating',
213
		'snapFB',
214
		'syndication_item_hash',
215
		'phonenumber_spellings',
216
		'tmac_last_id',
217
		'opanda_imperessions',
218
		'administer_stats',
219
		'spec_ads_views',
220
		'snp_views',
221
		'mip_post_views_count',
222
		'esml_socialcount_LAST_UPDATED',
223
		'wprss_last_update_items',
224
		'wp_automatic_cache',
225
		'snapTW',
226
	);
227
228
	// 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...
229
	// that should be synced as jetpack_current_theme_supports_foo option values
230
	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...
231
		'post-thumbnails',
232
		'post-formats',
233
		'custom-header',
234
		'custom-background',
235
		'custom-logo',
236
		'menus',
237
		'automatic-feed-links',
238
		'editor-style',
239
		'widgets',
240
		'html5',
241
		'title-tag',
242
		'jetpack-social-menu',
243
		'jetpack-responsive-videos',
244
		'infinite-scroll',
245
		'site-logo',
246
	);
247
248
	static function is_whitelisted_option( $option ) {
249
		foreach ( self::$default_options_whitelist as $whitelisted_option ) {
250
			if ( $whitelisted_option[0] === '/' && preg_match( $whitelisted_option, $option ) ) {
251
				return true;
252
			} elseif ( $whitelisted_option === $option ) {
253
				return true;
254
			}
255
		}
256
257
		return false;
258
	}
259
260
	static function get_max_sync_execution_time() {
261
		$max_exec_time = intval( ini_get( 'max_execution_time' ) );
262
		if ( 0 === $max_exec_time ) {
263
			// 0 actually means "unlimited", but let's not treat it that way
264
			$max_exec_time = 60;
265
		}
266
		return floor( $max_exec_time / 3 );
267
	}
268
269
	static $default_network_options_whitelist = array(
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...
270
		'site_name',
271
		'jetpack_protect_key',
272
		'jetpack_protect_global_whitelist',
273
		'active_sitewide_plugins',
274
	);
275
276
	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...
277
	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...
278
	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...
279
	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...
280
	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...
281
	static $default_sync_wait_threshold = 5; // only wait before next send if the current send took more than X seconds
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_sync_wait_threshold.

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...
282
	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...
283
	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...
284
	static $default_queue_max_writes_sec = 100; // 100 rows a second
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_queue_max_writes_sec.

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

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

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...
287
	static $default_disable = 0; // completely disable sending data to wpcom
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_disable.

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...
288
	static $default_render_filtered_content = 1; // render post_filtered_content
0 ignored issues
show
Coding Style introduced by
The visibility should be declared for property $default_render_filtered_content.

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...
289
	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...
290
	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...
291
}
292