Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-includes/ms-default-filters.php 2 patches
Braces   +10 added lines, -4 removed lines patch added patch discarded remove patch
@@ -49,10 +49,12 @@  discard block
 block discarded – undo
49 49
 // Counts
50 50
 add_action( 'admin_init', 'wp_schedule_update_network_counts');
51 51
 add_action( 'update_network_counts', 'wp_update_network_counts');
52
-foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
52
+foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action ) {
53 53
 	add_action( $action, 'wp_maybe_update_network_user_counts' );
54
-foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
54
+}
55
+foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action ) {
55 56
 	add_action( $action, 'wp_maybe_update_network_site_counts' );
57
+}
56 58
 unset( $action );
57 59
 
58 60
 // Files
@@ -67,10 +69,14 @@  discard block
 block discarded – undo
67 69
 
68 70
 // Disable somethings by default for multisite
69 71
 add_filter( 'enable_update_services_configuration', '__return_false' );
70
-if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
72
+if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) {
73
+	// back compat constant.
71 74
 	add_filter( 'enable_post_by_email_configuration', '__return_false' );
72
-if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
75
+}
76
+if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) {
77
+	// back compat constant.
73 78
 	add_filter( 'enable_edit_any_user_configuration', '__return_false' );
79
+}
74 80
 add_filter( 'force_filtered_html_on_import', '__return_true' );
75 81
 
76 82
 // WP_HOME and WP_SITEURL should not have any effect in MS
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -13,84 +13,84 @@
 block discarded – undo
13 13
  * @since 3.0.0
14 14
  */
15 15
 
16
-add_action( 'init', 'ms_subdomain_constants' );
16
+add_action('init', 'ms_subdomain_constants');
17 17
 
18 18
 // Functions
19
-add_action( 'update_option_blog_public', 'update_blog_public', 10, 2 );
20
-add_filter( 'option_users_can_register', 'users_can_register_signup_filter' );
21
-add_filter( 'site_option_welcome_user_email', 'welcome_user_msg_filter' );
19
+add_action('update_option_blog_public', 'update_blog_public', 10, 2);
20
+add_filter('option_users_can_register', 'users_can_register_signup_filter');
21
+add_filter('site_option_welcome_user_email', 'welcome_user_msg_filter');
22 22
 
23 23
 // Users
24
-add_filter( 'wpmu_validate_user_signup', 'signup_nonce_check' );
25
-add_action( 'init', 'maybe_add_existing_user_to_blog' );
26
-add_action( 'wpmu_new_user', 'newuser_notify_siteadmin' );
27
-add_action( 'wpmu_activate_user', 'add_new_user_to_blog', 10, 3 );
28
-add_action( 'wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3 );
29
-add_action( 'after_signup_user', 'wpmu_signup_user_notification', 10, 4 );
30
-add_action( 'network_site_new_created_user',   'wp_send_new_user_notifications' );
31
-add_action( 'network_site_users_created_user', 'wp_send_new_user_notifications' );
32
-add_action( 'network_user_new_created_user',   'wp_send_new_user_notifications' );
33
-add_filter( 'sanitize_user', 'strtolower' );
24
+add_filter('wpmu_validate_user_signup', 'signup_nonce_check');
25
+add_action('init', 'maybe_add_existing_user_to_blog');
26
+add_action('wpmu_new_user', 'newuser_notify_siteadmin');
27
+add_action('wpmu_activate_user', 'add_new_user_to_blog', 10, 3);
28
+add_action('wpmu_activate_user', 'wpmu_welcome_user_notification', 10, 3);
29
+add_action('after_signup_user', 'wpmu_signup_user_notification', 10, 4);
30
+add_action('network_site_new_created_user', 'wp_send_new_user_notifications');
31
+add_action('network_site_users_created_user', 'wp_send_new_user_notifications');
32
+add_action('network_user_new_created_user', 'wp_send_new_user_notifications');
33
+add_filter('sanitize_user', 'strtolower');
34 34
 
35 35
 // Blogs
36
-add_filter( 'wpmu_validate_blog_signup', 'signup_nonce_check' );
37
-add_action( 'wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2 );
38
-add_action( 'wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2 );
39
-add_action( 'wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5 );
40
-add_action( 'after_signup_site', 'wpmu_signup_blog_notification', 10, 7 );
36
+add_filter('wpmu_validate_blog_signup', 'signup_nonce_check');
37
+add_action('wpmu_new_blog', 'wpmu_log_new_registrations', 10, 2);
38
+add_action('wpmu_new_blog', 'newblog_notify_siteadmin', 10, 2);
39
+add_action('wpmu_activate_blog', 'wpmu_welcome_notification', 10, 5);
40
+add_action('after_signup_site', 'wpmu_signup_blog_notification', 10, 7);
41 41
 
42 42
 // Register Nonce
43
-add_action( 'signup_hidden_fields', 'signup_nonce_fields' );
43
+add_action('signup_hidden_fields', 'signup_nonce_fields');
44 44
 
45 45
 // Template
46
-add_action( 'template_redirect', 'maybe_redirect_404' );
47
-add_filter( 'allowed_redirect_hosts', 'redirect_this_site' );
46
+add_action('template_redirect', 'maybe_redirect_404');
47
+add_filter('allowed_redirect_hosts', 'redirect_this_site');
48 48
 
49 49
 // Administration
50
-add_filter( 'term_id_filter', 'global_terms', 10, 2 );
51
-add_action( 'delete_post', '_update_posts_count_on_delete' );
52
-add_action( 'delete_post', '_update_blog_date_on_post_delete' );
53
-add_action( 'transition_post_status', '_update_blog_date_on_post_publish', 10, 3 );
54
-add_action( 'transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2 );
50
+add_filter('term_id_filter', 'global_terms', 10, 2);
51
+add_action('delete_post', '_update_posts_count_on_delete');
52
+add_action('delete_post', '_update_blog_date_on_post_delete');
53
+add_action('transition_post_status', '_update_blog_date_on_post_publish', 10, 3);
54
+add_action('transition_post_status', '_update_posts_count_on_transition_post_status', 10, 2);
55 55
 
56 56
 // Counts
57
-add_action( 'admin_init', 'wp_schedule_update_network_counts');
58
-add_action( 'update_network_counts', 'wp_update_network_counts');
59
-foreach ( array( 'user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user' ) as $action )
60
-	add_action( $action, 'wp_maybe_update_network_user_counts' );
61
-foreach ( array( 'make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog' ) as $action )
62
-	add_action( $action, 'wp_maybe_update_network_site_counts' );
63
-unset( $action );
57
+add_action('admin_init', 'wp_schedule_update_network_counts');
58
+add_action('update_network_counts', 'wp_update_network_counts');
59
+foreach (array('user_register', 'deleted_user', 'wpmu_new_user', 'make_spam_user', 'make_ham_user') as $action)
60
+	add_action($action, 'wp_maybe_update_network_user_counts');
61
+foreach (array('make_spam_blog', 'make_ham_blog', 'archive_blog', 'unarchive_blog', 'make_delete_blog', 'make_undelete_blog') as $action)
62
+	add_action($action, 'wp_maybe_update_network_site_counts');
63
+unset($action);
64 64
 
65 65
 // Files
66
-add_filter( 'wp_upload_bits', 'upload_is_file_too_big' );
67
-add_filter( 'import_upload_size_limit', 'fix_import_form_size' );
68
-add_filter( 'upload_mimes', 'check_upload_mimes' );
69
-add_filter( 'upload_size_limit', 'upload_size_limit_filter' );
70
-add_action( 'upload_ui_over_quota', 'multisite_over_quota_message' );
66
+add_filter('wp_upload_bits', 'upload_is_file_too_big');
67
+add_filter('import_upload_size_limit', 'fix_import_form_size');
68
+add_filter('upload_mimes', 'check_upload_mimes');
69
+add_filter('upload_size_limit', 'upload_size_limit_filter');
70
+add_action('upload_ui_over_quota', 'multisite_over_quota_message');
71 71
 
72 72
 // Mail
73
-add_action( 'phpmailer_init', 'fix_phpmailer_messageid' );
73
+add_action('phpmailer_init', 'fix_phpmailer_messageid');
74 74
 
75 75
 // Disable somethings by default for multisite
76
-add_filter( 'enable_update_services_configuration', '__return_false' );
77
-if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL ) // back compat constant.
78
-	add_filter( 'enable_post_by_email_configuration', '__return_false' );
79
-if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER ) // back compat constant.
80
-	add_filter( 'enable_edit_any_user_configuration', '__return_false' );
81
-add_filter( 'force_filtered_html_on_import', '__return_true' );
76
+add_filter('enable_update_services_configuration', '__return_false');
77
+if ( ! defined('POST_BY_EMAIL') || ! POST_BY_EMAIL) // back compat constant.
78
+	add_filter('enable_post_by_email_configuration', '__return_false');
79
+if ( ! defined('EDIT_ANY_USER') || ! EDIT_ANY_USER) // back compat constant.
80
+	add_filter('enable_edit_any_user_configuration', '__return_false');
81
+add_filter('force_filtered_html_on_import', '__return_true');
82 82
 
83 83
 // WP_HOME and WP_SITEURL should not have any effect in MS
84
-remove_filter( 'option_siteurl', '_config_wp_siteurl' );
85
-remove_filter( 'option_home',    '_config_wp_home'    );
84
+remove_filter('option_siteurl', '_config_wp_siteurl');
85
+remove_filter('option_home', '_config_wp_home');
86 86
 
87 87
 // Some options changes should trigger blog details refresh.
88
-add_action( 'update_option_blogname',   'refresh_blog_details', 10, 0 );
89
-add_action( 'update_option_siteurl',    'refresh_blog_details', 10, 0 );
90
-add_action( 'update_option_post_count', 'refresh_blog_details', 10, 0 );
88
+add_action('update_option_blogname', 'refresh_blog_details', 10, 0);
89
+add_action('update_option_siteurl', 'refresh_blog_details', 10, 0);
90
+add_action('update_option_post_count', 'refresh_blog_details', 10, 0);
91 91
 
92 92
 // If the network upgrade hasn't run yet, assume ms-files.php rewriting is used.
93
-add_filter( 'default_site_option_ms_files_rewriting', '__return_true' );
93
+add_filter('default_site_option_ms_files_rewriting', '__return_true');
94 94
 
95 95
 // Whitelist multisite domains for HTTP requests
96
-add_filter( 'http_request_host_is_external', 'ms_allowed_http_request_hosts', 20, 2 );
96
+add_filter('http_request_host_is_external', 'ms_allowed_http_request_hosts', 20, 2);
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.audio.flac.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 		if (isset($info['flac']['STREAMINFO']['audio_signature'])) {
168 168
 
169 169
 			if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) {
170
-                $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)');
170
+				$this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)');
171 171
 			}
172 172
 			else {
173 173
 				$info['md5_data_source'] = '';
@@ -346,9 +346,9 @@  discard block
 block discarded – undo
346 346
 	}
347 347
 
348 348
 	/**
349
-	* Parse METADATA_BLOCK_PICTURE flac structure and extract attachment
350
-	* External usage: audio.ogg
351
-	*/
349
+	 * Parse METADATA_BLOCK_PICTURE flac structure and extract attachment
350
+	 * External usage: audio.ogg
351
+	 */
352 352
 	public function parsePICTURE() {
353 353
 		$info = &$this->getid3->info;
354 354
 
Please login to merge, or discard this patch.
Spacing   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			$BlockHeader   = $this->fread(4);
49 49
 			$LBFBT         = getid3_lib::BigEndian2Int(substr($BlockHeader, 0, 1));
50 50
 			$LastBlockFlag = (bool) ($LBFBT & 0x80);
51
-			$BlockType     =        ($LBFBT & 0x7F);
51
+			$BlockType     = ($LBFBT & 0x7F);
52 52
 			$BlockLength   = getid3_lib::BigEndian2Int(substr($BlockHeader, 1, 3));
53 53
 			$BlockTypeText = self::metaBlockTypeLookup($BlockType);
54 54
 
@@ -70,12 +70,12 @@  discard block
 block discarded – undo
70 70
 			$BlockTypeText_raw['block_type_text'] = $BlockTypeText;
71 71
 			$BlockTypeText_raw['block_length']    = $BlockLength;
72 72
 			if ($BlockTypeText_raw['block_type'] != 0x06) { // do not read attachment data automatically
73
-				$BlockTypeText_raw['block_data']  = $this->fread($BlockLength);
73
+				$BlockTypeText_raw['block_data'] = $this->fread($BlockLength);
74 74
 			}
75 75
 
76 76
 			switch ($BlockTypeText) {
77 77
 				case 'STREAMINFO':     // 0x00
78
-					if (!$this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) {
78
+					if ( ! $this->parseSTREAMINFO($BlockTypeText_raw['block_data'])) {
79 79
 						return false;
80 80
 					}
81 81
 					break;
@@ -85,31 +85,31 @@  discard block
 block discarded – undo
85 85
 					break;
86 86
 
87 87
 				case 'APPLICATION':    // 0x02
88
-					if (!$this->parseAPPLICATION($BlockTypeText_raw['block_data'])) {
88
+					if ( ! $this->parseAPPLICATION($BlockTypeText_raw['block_data'])) {
89 89
 						return false;
90 90
 					}
91 91
 					break;
92 92
 
93 93
 				case 'SEEKTABLE':      // 0x03
94
-					if (!$this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) {
94
+					if ( ! $this->parseSEEKTABLE($BlockTypeText_raw['block_data'])) {
95 95
 						return false;
96 96
 					}
97 97
 					break;
98 98
 
99 99
 				case 'VORBIS_COMMENT': // 0x04
100
-					if (!$this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) {
100
+					if ( ! $this->parseVORBIS_COMMENT($BlockTypeText_raw['block_data'])) {
101 101
 						return false;
102 102
 					}
103 103
 					break;
104 104
 
105 105
 				case 'CUESHEET':       // 0x05
106
-					if (!$this->parseCUESHEET($BlockTypeText_raw['block_data'])) {
106
+					if ( ! $this->parseCUESHEET($BlockTypeText_raw['block_data'])) {
107 107
 						return false;
108 108
 					}
109 109
 					break;
110 110
 
111 111
 				case 'PICTURE':        // 0x06
112
-					if (!$this->parsePICTURE()) {
112
+					if ( ! $this->parsePICTURE()) {
113 113
 						return false;
114 114
 					}
115 115
 					break;
@@ -124,18 +124,18 @@  discard block
 block discarded – undo
124 124
 		while ($LastBlockFlag === false);
125 125
 
126 126
 		// handle tags
127
-		if (!empty($info['flac']['VORBIS_COMMENT']['comments'])) {
127
+		if ( ! empty($info['flac']['VORBIS_COMMENT']['comments'])) {
128 128
 			$info['flac']['comments'] = $info['flac']['VORBIS_COMMENT']['comments'];
129 129
 		}
130
-		if (!empty($info['flac']['VORBIS_COMMENT']['vendor'])) {
130
+		if ( ! empty($info['flac']['VORBIS_COMMENT']['vendor'])) {
131 131
 			$info['audio']['encoder'] = str_replace('reference ', '', $info['flac']['VORBIS_COMMENT']['vendor']);
132 132
 		}
133 133
 
134 134
 		// copy attachments to 'comments' array if nesesary
135 135
 		if (isset($info['flac']['PICTURE']) && ($this->getid3->option_save_attachments !== getID3::ATTACHMENTS_NONE)) {
136 136
 			foreach ($info['flac']['PICTURE'] as $entry) {
137
-				if (!empty($entry['data'])) {
138
-					if (!isset($info['flac']['comments']['picture'])) {
137
+				if ( ! empty($entry['data'])) {
138
+					if ( ! isset($info['flac']['comments']['picture'])) {
139 139
 						$info['flac']['comments']['picture'] = array();
140 140
 					}
141 141
 					$comments_picture_data = array();
@@ -151,14 +151,14 @@  discard block
 block discarded – undo
151 151
 		}
152 152
 
153 153
 		if (isset($info['flac']['STREAMINFO'])) {
154
-			if (!$this->isDependencyFor('matroska')) {
154
+			if ( ! $this->isDependencyFor('matroska')) {
155 155
 				$info['flac']['compressed_audio_bytes'] = $info['avdataend'] - $info['avdataoffset'];
156 156
 			}
157 157
 			$info['flac']['uncompressed_audio_bytes'] = $info['flac']['STREAMINFO']['samples_stream'] * $info['flac']['STREAMINFO']['channels'] * ($info['flac']['STREAMINFO']['bits_per_sample'] / 8);
158 158
 			if ($info['flac']['uncompressed_audio_bytes'] == 0) {
159 159
 				return $this->error('Corrupt FLAC file: uncompressed_audio_bytes == zero');
160 160
 			}
161
-			if (!empty($info['flac']['compressed_audio_bytes'])) {
161
+			if ( ! empty($info['flac']['compressed_audio_bytes'])) {
162 162
 				$info['flac']['compression_ratio'] = $info['flac']['compressed_audio_bytes'] / $info['flac']['uncompressed_audio_bytes'];
163 163
 			}
164 164
 		}
@@ -175,7 +175,7 @@  discard block
 block discarded – undo
175 175
 				for ($i = 0; $i < strlen($md5); $i++) {
176 176
 					$info['md5_data_source'] .= str_pad(dechex(ord($md5[$i])), 2, '00', STR_PAD_LEFT);
177 177
 				}
178
-				if (!preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
178
+				if ( ! preg_match('/^[0-9a-f]{32}$/', $info['md5_data_source'])) {
179 179
 					unset($info['md5_data_source']);
180 180
 				}
181 181
 			}
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 		$streaminfo['max_frame_size']  = getid3_lib::BigEndian2Int(substr($BlockData, 7, 3));
207 207
 
208 208
 		$SRCSBSS                       = getid3_lib::BigEndian2Bin(substr($BlockData, 10, 8));
209
-		$streaminfo['sample_rate']     = getid3_lib::Bin2Dec(substr($SRCSBSS,  0, 20));
210
-		$streaminfo['channels']        = getid3_lib::Bin2Dec(substr($SRCSBSS, 20,  3)) + 1;
211
-		$streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23,  5)) + 1;
209
+		$streaminfo['sample_rate']     = getid3_lib::Bin2Dec(substr($SRCSBSS, 0, 20));
210
+		$streaminfo['channels']        = getid3_lib::Bin2Dec(substr($SRCSBSS, 20, 3)) + 1;
211
+		$streaminfo['bits_per_sample'] = getid3_lib::Bin2Dec(substr($SRCSBSS, 23, 5)) + 1;
212 212
 		$streaminfo['samples_stream']  = getid3_lib::Bin2Dec(substr($SRCSBSS, 28, 36));
213 213
 
214 214
 		$streaminfo['audio_signature'] = substr($BlockData, 18, 16);
215 215
 
216
-		if (!empty($streaminfo['sample_rate'])) {
216
+		if ( ! empty($streaminfo['sample_rate'])) {
217 217
 
218 218
 			$info['audio']['bitrate_mode']    = 'vbr';
219 219
 			$info['audio']['sample_rate']     = $streaminfo['sample_rate'];
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 			$info['audio']['bits_per_sample'] = $streaminfo['bits_per_sample'];
222 222
 			$info['playtime_seconds']         = $streaminfo['samples_stream'] / $streaminfo['sample_rate'];
223 223
 			if ($info['playtime_seconds'] > 0) {
224
-				if (!$this->isDependencyFor('matroska')) {
224
+				if ( ! $this->isDependencyFor('matroska')) {
225 225
 					$info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
226 226
 				}
227 227
 				else {
@@ -297,16 +297,16 @@  discard block
 block discarded – undo
297 297
 	private function parseCUESHEET($BlockData) {
298 298
 		$info = &$this->getid3->info;
299 299
 		$offset = 0;
300
-		$info['flac']['CUESHEET']['media_catalog_number'] =                              trim(substr($BlockData, $offset, 128), "\0");
300
+		$info['flac']['CUESHEET']['media_catalog_number'] = trim(substr($BlockData, $offset, 128), "\0");
301 301
 		$offset += 128;
302
-		$info['flac']['CUESHEET']['lead_in_samples']      =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
302
+		$info['flac']['CUESHEET']['lead_in_samples']      = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 8));
303 303
 		$offset += 8;
304 304
 		$info['flac']['CUESHEET']['flags']['is_cd']       = (bool) (getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1)) & 0x80);
305 305
 		$offset += 1;
306 306
 
307 307
 		$offset += 258; // reserved
308 308
 
309
-		$info['flac']['CUESHEET']['number_tracks']        =         getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
309
+		$info['flac']['CUESHEET']['number_tracks'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
310 310
 		$offset += 1;
311 311
 
312 312
 		for ($track = 0; $track < $info['flac']['CUESHEET']['number_tracks']; $track++) {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 
318 318
 			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['sample_offset']         = $TrackSampleOffset;
319 319
 
320
-			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc']                  =                           substr($BlockData, $offset, 12);
320
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['isrc']                  = substr($BlockData, $offset, 12);
321 321
 			$offset += 12;
322 322
 
323 323
 			$TrackFlagsRaw                                                             = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 
328 328
 			$offset += 13; // reserved
329 329
 
330
-			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']          = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
330
+			$info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points'] = getid3_lib::BigEndian2Int(substr($BlockData, $offset, 1));
331 331
 			$offset += 1;
332 332
 
333 333
 			for ($index = 0; $index < $info['flac']['CUESHEET']['tracks'][$TrackNumber]['index_points']; $index++) {
@@ -396,35 +396,35 @@  discard block
 block discarded – undo
396 396
 	public static function applicationIDLookup($applicationid) {
397 397
 		// http://flac.sourceforge.net/id.html
398 398
 		static $lookup = array(
399
-			0x41544348 => 'FlacFile',                                                                           // "ATCH"
400
-			0x42534F4C => 'beSolo',                                                                             // "BSOL"
401
-			0x42554753 => 'Bugs Player',                                                                        // "BUGS"
402
-			0x43756573 => 'GoldWave cue points (specification)',                                                // "Cues"
403
-			0x46696361 => 'CUE Splitter',                                                                       // "Fica"
404
-			0x46746F6C => 'flac-tools',                                                                         // "Ftol"
405
-			0x4D4F5442 => 'MOTB MetaCzar',                                                                      // "MOTB"
406
-			0x4D505345 => 'MP3 Stream Editor',                                                                  // "MPSE"
407
-			0x4D754D4C => 'MusicML: Music Metadata Language',                                                   // "MuML"
408
-			0x52494646 => 'Sound Devices RIFF chunk storage',                                                   // "RIFF"
409
-			0x5346464C => 'Sound Font FLAC',                                                                    // "SFFL"
410
-			0x534F4E59 => 'Sony Creative Software',                                                             // "SONY"
411
-			0x5351455A => 'flacsqueeze',                                                                        // "SQEZ"
412
-			0x54745776 => 'TwistedWave',                                                                        // "TtWv"
413
-			0x55495453 => 'UITS Embedding tools',                                                               // "UITS"
414
-			0x61696666 => 'FLAC AIFF chunk storage',                                                            // "aiff"
415
-			0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks',  // "imag"
416
-			0x7065656D => 'Parseable Embedded Extensible Metadata (specification)',                             // "peem"
417
-			0x71667374 => 'QFLAC Studio',                                                                       // "qfst"
418
-			0x72696666 => 'FLAC RIFF chunk storage',                                                            // "riff"
419
-			0x74756E65 => 'TagTuner',                                                                           // "tune"
420
-			0x78626174 => 'XBAT',                                                                               // "xbat"
421
-			0x786D6364 => 'xmcd',                                                                               // "xmcd"
399
+			0x41544348 => 'FlacFile', // "ATCH"
400
+			0x42534F4C => 'beSolo', // "BSOL"
401
+			0x42554753 => 'Bugs Player', // "BUGS"
402
+			0x43756573 => 'GoldWave cue points (specification)', // "Cues"
403
+			0x46696361 => 'CUE Splitter', // "Fica"
404
+			0x46746F6C => 'flac-tools', // "Ftol"
405
+			0x4D4F5442 => 'MOTB MetaCzar', // "MOTB"
406
+			0x4D505345 => 'MP3 Stream Editor', // "MPSE"
407
+			0x4D754D4C => 'MusicML: Music Metadata Language', // "MuML"
408
+			0x52494646 => 'Sound Devices RIFF chunk storage', // "RIFF"
409
+			0x5346464C => 'Sound Font FLAC', // "SFFL"
410
+			0x534F4E59 => 'Sony Creative Software', // "SONY"
411
+			0x5351455A => 'flacsqueeze', // "SQEZ"
412
+			0x54745776 => 'TwistedWave', // "TtWv"
413
+			0x55495453 => 'UITS Embedding tools', // "UITS"
414
+			0x61696666 => 'FLAC AIFF chunk storage', // "aiff"
415
+			0x696D6167 => 'flac-image application for storing arbitrary files in APPLICATION metadata blocks', // "imag"
416
+			0x7065656D => 'Parseable Embedded Extensible Metadata (specification)', // "peem"
417
+			0x71667374 => 'QFLAC Studio', // "qfst"
418
+			0x72696666 => 'FLAC RIFF chunk storage', // "riff"
419
+			0x74756E65 => 'TagTuner', // "tune"
420
+			0x78626174 => 'XBAT', // "xbat"
421
+			0x786D6364 => 'xmcd', // "xmcd"
422 422
 		);
423 423
 		return (isset($lookup[$applicationid]) ? $lookup[$applicationid] : 'reserved');
424 424
 	}
425 425
 
426 426
 	public static function pictureTypeLookup($type_id) {
427
-		static $lookup = array (
427
+		static $lookup = array(
428 428
 			 0 => 'Other',
429 429
 			 1 => '32x32 pixels \'file icon\' (PNG only)',
430 430
 			 2 => 'Other file icon',
Please login to merge, or discard this patch.
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -168,8 +168,7 @@  discard block
 block discarded – undo
168 168
 
169 169
 			if ($info['flac']['STREAMINFO']['audio_signature'] === str_repeat("\x00", 16)) {
170 170
                 $this->warning('FLAC STREAMINFO.audio_signature is null (known issue with libOggFLAC)');
171
-			}
172
-			else {
171
+			} else {
173 172
 				$info['md5_data_source'] = '';
174 173
 				$md5 = $info['flac']['STREAMINFO']['audio_signature'];
175 174
 				for ($i = 0; $i < strlen($md5); $i++) {
@@ -223,8 +222,7 @@  discard block
 block discarded – undo
223 222
 			if ($info['playtime_seconds'] > 0) {
224 223
 				if (!$this->isDependencyFor('matroska')) {
225 224
 					$info['audio']['bitrate'] = (($info['avdataend'] - $info['avdataoffset']) * 8) / $info['playtime_seconds'];
226
-				}
227
-				else {
225
+				} else {
228 226
 					$this->warning('Cannot determine audio bitrate because total stream size is unknown');
229 227
 				}
230 228
 			}
Please login to merge, or discard this patch.
src/wp-includes/ID3/module.tag.id3v1.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	public function Analyze() {
22 22
 		$info = &$this->getid3->info;
23 23
 
24
-		if (!getid3_lib::intValueSupported($info['filesize'])) {
24
+		if ( ! getid3_lib::intValueSupported($info['filesize'])) {
25 25
 			$info['warning'][] = 'Unable to check for ID3v1 because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';
26 26
 			return false;
27 27
 		}
@@ -34,23 +34,23 @@  discard block
 block discarded – undo
34 34
 
35 35
 			$info['avdataend'] = $info['filesize'] - 128;
36 36
 
37
-			$ParsedID3v1['title']   = $this->cutfield(substr($id3v1tag,   3, 30));
38
-			$ParsedID3v1['artist']  = $this->cutfield(substr($id3v1tag,  33, 30));
39
-			$ParsedID3v1['album']   = $this->cutfield(substr($id3v1tag,  63, 30));
40
-			$ParsedID3v1['year']    = $this->cutfield(substr($id3v1tag,  93,  4));
41
-			$ParsedID3v1['comment'] =                 substr($id3v1tag,  97, 30);  // can't remove nulls yet, track detection depends on them
42
-			$ParsedID3v1['genreid'] =             ord(substr($id3v1tag, 127,  1));
37
+			$ParsedID3v1['title']   = $this->cutfield(substr($id3v1tag, 3, 30));
38
+			$ParsedID3v1['artist']  = $this->cutfield(substr($id3v1tag, 33, 30));
39
+			$ParsedID3v1['album']   = $this->cutfield(substr($id3v1tag, 63, 30));
40
+			$ParsedID3v1['year']    = $this->cutfield(substr($id3v1tag, 93, 4));
41
+			$ParsedID3v1['comment'] = substr($id3v1tag, 97, 30); // can't remove nulls yet, track detection depends on them
42
+			$ParsedID3v1['genreid'] = ord(substr($id3v1tag, 127, 1));
43 43
 
44 44
 			// If second-last byte of comment field is null and last byte of comment field is non-null
45 45
 			// then this is ID3v1.1 and the comment field is 28 bytes long and the 30th byte is the track number
46 46
 			if (($id3v1tag{125} === "\x00") && ($id3v1tag{126} !== "\x00")) {
47
-				$ParsedID3v1['track']   = ord(substr($ParsedID3v1['comment'], 29,  1));
48
-				$ParsedID3v1['comment'] =     substr($ParsedID3v1['comment'],  0, 28);
47
+				$ParsedID3v1['track']   = ord(substr($ParsedID3v1['comment'], 29, 1));
48
+				$ParsedID3v1['comment'] = substr($ParsedID3v1['comment'], 0, 28);
49 49
 			}
50 50
 			$ParsedID3v1['comment'] = $this->cutfield($ParsedID3v1['comment']);
51 51
 
52 52
 			$ParsedID3v1['genre'] = $this->LookupGenreName($ParsedID3v1['genreid']);
53
-			if (!empty($ParsedID3v1['genre'])) {
53
+			if ( ! empty($ParsedID3v1['genre'])) {
54 54
 				unset($ParsedID3v1['genreid']);
55 55
 			}
56 56
 			if (isset($ParsedID3v1['genre']) && (empty($ParsedID3v1['genre']) || ($ParsedID3v1['genre'] == 'Unknown'))) {
@@ -69,7 +69,7 @@  discard block
 block discarded – undo
69 69
 											$ParsedID3v1['year'],
70 70
 											(isset($ParsedID3v1['genre']) ? $this->LookupGenreID($ParsedID3v1['genre']) : false),
71 71
 											$ParsedID3v1['comment'],
72
-											(!empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : ''));
72
+											( ! empty($ParsedID3v1['track']) ? $ParsedID3v1['track'] : ''));
73 73
 			$ParsedID3v1['padding_valid'] = true;
74 74
 			if ($id3v1tag !== $GoodFormatID3v1tag) {
75 75
 				$ParsedID3v1['padding_valid'] = false;
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
 		return trim(substr($str, 0, strcspn($str, "\x00")));
108 108
 	}
109 109
 
110
-	public static function ArrayOfGenres($allowSCMPXextended=false) {
110
+	public static function ArrayOfGenres($allowSCMPXextended = false) {
111 111
 		static $GenreLookup = array(
112 112
 			0    => 'Blues',
113 113
 			1    => 'Classic Rock',
@@ -291,13 +291,13 @@  discard block
 block discarded – undo
291 291
 		return ($allowSCMPXextended ? $GenreLookupSCMPX : $GenreLookup);
292 292
 	}
293 293
 
294
-	public static function LookupGenreName($genreid, $allowSCMPXextended=true) {
294
+	public static function LookupGenreName($genreid, $allowSCMPXextended = true) {
295 295
 		switch ($genreid) {
296 296
 			case 'RX':
297 297
 			case 'CR':
298 298
 				break;
299 299
 			default:
300
-				if (!is_numeric($genreid)) {
300
+				if ( ! is_numeric($genreid)) {
301 301
 					return false;
302 302
 				}
303 303
 				$genreid = intval($genreid); // to handle 3 or '3' or '03'
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		return (isset($GenreLookup[$genreid]) ? $GenreLookup[$genreid] : false);
308 308
 	}
309 309
 
310
-	public static function LookupGenreID($genre, $allowSCMPXextended=false) {
310
+	public static function LookupGenreID($genre, $allowSCMPXextended = false) {
311 311
 		$GenreLookup = self::ArrayOfGenres($allowSCMPXextended);
312 312
 		$LowerCaseNoSpaceSearchTerm = strtolower(str_replace(' ', '', $genre));
313 313
 		foreach ($GenreLookup as $key => $value) {
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
 		return $OriginalGenre;
326 326
 	}
327 327
 
328
-	public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track='') {
328
+	public static function GenerateID3v1Tag($title, $artist, $album, $year, $genreid, $comment, $track = '') {
329 329
 		$ID3v1Tag  = 'TAG';
330
-		$ID3v1Tag .= str_pad(trim(substr($title,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
330
+		$ID3v1Tag .= str_pad(trim(substr($title, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
331 331
 		$ID3v1Tag .= str_pad(trim(substr($artist, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
332
-		$ID3v1Tag .= str_pad(trim(substr($album,  0, 30)), 30, "\x00", STR_PAD_RIGHT);
333
-		$ID3v1Tag .= str_pad(trim(substr($year,   0,  4)),  4, "\x00", STR_PAD_LEFT);
334
-		if (!empty($track) && ($track > 0) && ($track <= 255)) {
332
+		$ID3v1Tag .= str_pad(trim(substr($album, 0, 30)), 30, "\x00", STR_PAD_RIGHT);
333
+		$ID3v1Tag .= str_pad(trim(substr($year, 0, 4)), 4, "\x00", STR_PAD_LEFT);
334
+		if ( ! empty($track) && ($track > 0) && ($track <= 255)) {
335 335
 			$ID3v1Tag .= str_pad(trim(substr($comment, 0, 28)), 28, "\x00", STR_PAD_RIGHT);
336 336
 			$ID3v1Tag .= "\x00";
337 337
 			if (gettype($track) == 'string') {
Please login to merge, or discard this patch.
src/wp-includes/default-filters.php 3 patches
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Sets up the default filters and actions for most
4
- * of the WordPress hooks.
5
- *
6
- * If you need to remove a default hook, this file will
7
- * give you the priority for which to use to remove the
8
- * hook.
9
- *
10
- * Not all of the default hooks are found in default-filters.php
11
- *
12
- * @package WordPress
13
- */
3
+	 * Sets up the default filters and actions for most
4
+	 * of the WordPress hooks.
5
+	 *
6
+	 * If you need to remove a default hook, this file will
7
+	 * give you the priority for which to use to remove the
8
+	 * hook.
9
+	 *
10
+	 * Not all of the default hooks are found in default-filters.php
11
+	 *
12
+	 * @package WordPress
13
+	 */
14 14
 
15 15
 // Strip, trim, kses, special chars for string saves
16 16
 foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 add_action( 'wp_print_styles',     'print_emoji_styles'                     );
230 230
 
231 231
 if ( isset( $_GET['replytocom'] ) )
232
-    add_action( 'wp_head', 'wp_no_robots' );
232
+	add_action( 'wp_head', 'wp_no_robots' );
233 233
 
234 234
 // Login actions
235 235
 add_action( 'login_head',          'wp_print_head_scripts',         9     );
Please login to merge, or discard this patch.
Braces   +17 added lines, -11 removed lines patch added patch discarded remove patch
@@ -52,9 +52,10 @@  discard block
 block discarded – undo
52 52
 // Email admin display
53 53
 foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
54 54
 	add_filter( $filter, 'sanitize_email' );
55
-	if ( is_admin() )
56
-		add_filter( $filter, 'wp_kses_data' );
57
-}
55
+	if ( is_admin() ) {
56
+			add_filter( $filter, 'wp_kses_data' );
57
+	}
58
+	}
58 59
 
59 60
 // Save URL
60 61
 foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
@@ -66,12 +67,14 @@  discard block
 block discarded – undo
66 67
 
67 68
 // Display URL
68 69
 foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) {
69
-	if ( is_admin() )
70
-		add_filter( $filter, 'wp_strip_all_tags' );
70
+	if ( is_admin() ) {
71
+			add_filter( $filter, 'wp_strip_all_tags' );
72
+	}
71 73
 	add_filter( $filter, 'esc_url'           );
72
-	if ( is_admin() )
73
-		add_filter( $filter, 'wp_kses_data'    );
74
-}
74
+	if ( is_admin() ) {
75
+			add_filter( $filter, 'wp_kses_data'    );
76
+	}
77
+	}
75 78
 
76 79
 // Slugs
77 80
 add_filter( 'pre_term_slug', 'sanitize_title' );
@@ -99,8 +102,9 @@  discard block
 block discarded – undo
99 102
 }
100 103
 
101 104
 // Format WordPress
102
-foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter )
105
+foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter ) {
103 106
 	add_filter( $filter, 'capital_P_dangit', 11 );
107
+}
104 108
 add_filter( 'comment_text', 'capital_P_dangit', 31 );
105 109
 
106 110
 // Format titles
@@ -228,8 +232,9 @@  discard block
 block discarded – undo
228 232
 add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
229 233
 add_action( 'wp_print_styles',     'print_emoji_styles'                     );
230 234
 
231
-if ( isset( $_GET['replytocom'] ) )
235
+if ( isset( $_GET['replytocom'] ) ) {
232 236
     add_action( 'wp_head', 'wp_no_robots' );
237
+}
233 238
 
234 239
 // Login actions
235 240
 add_action( 'login_head',          'wp_print_head_scripts',         9     );
@@ -247,8 +252,9 @@  discard block
 block discarded – undo
247 252
 
248 253
 
249 254
 // WP Cron
250
-if ( !defined( 'DOING_CRON' ) )
255
+if ( !defined( 'DOING_CRON' ) ) {
251 256
 	add_action( 'init', 'wp_cron' );
257
+}
252 258
 
253 259
 // 2 Actions 2 Furious
254 260
 add_action( 'do_feed_rdf',                'do_feed_rdf',                             10, 1 );
Please login to merge, or discard this patch.
Spacing   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -13,468 +13,468 @@
 block discarded – undo
13 13
  */
14 14
 
15 15
 // Strip, trim, kses, special chars for string saves
16
-foreach ( array( 'pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname' ) as $filter ) {
17
-	add_filter( $filter, 'sanitize_text_field'  );
18
-	add_filter( $filter, 'wp_filter_kses'       );
19
-	add_filter( $filter, '_wp_specialchars', 30 );
16
+foreach (array('pre_term_name', 'pre_comment_author_name', 'pre_link_name', 'pre_link_target', 'pre_link_rel', 'pre_user_display_name', 'pre_user_first_name', 'pre_user_last_name', 'pre_user_nickname') as $filter) {
17
+	add_filter($filter, 'sanitize_text_field');
18
+	add_filter($filter, 'wp_filter_kses');
19
+	add_filter($filter, '_wp_specialchars', 30);
20 20
 }
21 21
 
22 22
 // Strip, kses, special chars for string display
23
-foreach ( array( 'term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname' ) as $filter ) {
24
-	if ( is_admin() ) {
23
+foreach (array('term_name', 'comment_author_name', 'link_name', 'link_target', 'link_rel', 'user_display_name', 'user_first_name', 'user_last_name', 'user_nickname') as $filter) {
24
+	if (is_admin()) {
25 25
 		// These are expensive. Run only on admin pages for defense in depth.
26
-		add_filter( $filter, 'sanitize_text_field'  );
27
-		add_filter( $filter, 'wp_kses_data'       );
26
+		add_filter($filter, 'sanitize_text_field');
27
+		add_filter($filter, 'wp_kses_data');
28 28
 	}
29
-	add_filter( $filter, '_wp_specialchars', 30 );
29
+	add_filter($filter, '_wp_specialchars', 30);
30 30
 }
31 31
 
32 32
 // Kses only for textarea saves
33
-foreach ( array( 'pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description' ) as $filter ) {
34
-	add_filter( $filter, 'wp_filter_kses' );
33
+foreach (array('pre_term_description', 'pre_link_description', 'pre_link_notes', 'pre_user_description') as $filter) {
34
+	add_filter($filter, 'wp_filter_kses');
35 35
 }
36 36
 
37 37
 // Kses only for textarea admin displays
38
-if ( is_admin() ) {
39
-	foreach ( array( 'term_description', 'link_description', 'link_notes', 'user_description' ) as $filter ) {
40
-		add_filter( $filter, 'wp_kses_data' );
38
+if (is_admin()) {
39
+	foreach (array('term_description', 'link_description', 'link_notes', 'user_description') as $filter) {
40
+		add_filter($filter, 'wp_kses_data');
41 41
 	}
42
-	add_filter( 'comment_text', 'wp_kses_post' );
42
+	add_filter('comment_text', 'wp_kses_post');
43 43
 }
44 44
 
45 45
 // Email saves
46
-foreach ( array( 'pre_comment_author_email', 'pre_user_email' ) as $filter ) {
47
-	add_filter( $filter, 'trim'           );
48
-	add_filter( $filter, 'sanitize_email' );
49
-	add_filter( $filter, 'wp_filter_kses' );
46
+foreach (array('pre_comment_author_email', 'pre_user_email') as $filter) {
47
+	add_filter($filter, 'trim');
48
+	add_filter($filter, 'sanitize_email');
49
+	add_filter($filter, 'wp_filter_kses');
50 50
 }
51 51
 
52 52
 // Email admin display
53
-foreach ( array( 'comment_author_email', 'user_email' ) as $filter ) {
54
-	add_filter( $filter, 'sanitize_email' );
55
-	if ( is_admin() )
56
-		add_filter( $filter, 'wp_kses_data' );
53
+foreach (array('comment_author_email', 'user_email') as $filter) {
54
+	add_filter($filter, 'sanitize_email');
55
+	if (is_admin())
56
+		add_filter($filter, 'wp_kses_data');
57 57
 }
58 58
 
59 59
 // Save URL
60
-foreach ( array( 'pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
61
-	'pre_link_rss', 'pre_post_guid' ) as $filter ) {
62
-	add_filter( $filter, 'wp_strip_all_tags' );
63
-	add_filter( $filter, 'esc_url_raw'       );
64
-	add_filter( $filter, 'wp_filter_kses'    );
60
+foreach (array('pre_comment_author_url', 'pre_user_url', 'pre_link_url', 'pre_link_image',
61
+	'pre_link_rss', 'pre_post_guid') as $filter) {
62
+	add_filter($filter, 'wp_strip_all_tags');
63
+	add_filter($filter, 'esc_url_raw');
64
+	add_filter($filter, 'wp_filter_kses');
65 65
 }
66 66
 
67 67
 // Display URL
68
-foreach ( array( 'user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid' ) as $filter ) {
69
-	if ( is_admin() )
70
-		add_filter( $filter, 'wp_strip_all_tags' );
71
-	add_filter( $filter, 'esc_url'           );
72
-	if ( is_admin() )
73
-		add_filter( $filter, 'wp_kses_data'    );
68
+foreach (array('user_url', 'link_url', 'link_image', 'link_rss', 'comment_url', 'post_guid') as $filter) {
69
+	if (is_admin())
70
+		add_filter($filter, 'wp_strip_all_tags');
71
+	add_filter($filter, 'esc_url');
72
+	if (is_admin())
73
+		add_filter($filter, 'wp_kses_data');
74 74
 }
75 75
 
76 76
 // Slugs
77
-add_filter( 'pre_term_slug', 'sanitize_title' );
77
+add_filter('pre_term_slug', 'sanitize_title');
78 78
 
79 79
 // Keys
80
-foreach ( array( 'pre_post_type', 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status' ) as $filter ) {
81
-	add_filter( $filter, 'sanitize_key' );
80
+foreach (array('pre_post_type', 'pre_post_status', 'pre_post_comment_status', 'pre_post_ping_status') as $filter) {
81
+	add_filter($filter, 'sanitize_key');
82 82
 }
83 83
 
84 84
 // Mime types
85
-add_filter( 'pre_post_mime_type', 'sanitize_mime_type' );
86
-add_filter( 'post_mime_type', 'sanitize_mime_type' );
85
+add_filter('pre_post_mime_type', 'sanitize_mime_type');
86
+add_filter('post_mime_type', 'sanitize_mime_type');
87 87
 
88 88
 // Places to balance tags on input
89
-foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content' ) as $filter ) {
90
-	add_filter( $filter, 'convert_invalid_entities' );
91
-	add_filter( $filter, 'balanceTags', 50 );
89
+foreach (array('content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pre_comment_content') as $filter) {
90
+	add_filter($filter, 'convert_invalid_entities');
91
+	add_filter($filter, 'balanceTags', 50);
92 92
 }
93 93
 
94 94
 // Format strings for display.
95
-foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) {
96
-	add_filter( $filter, 'wptexturize'   );
97
-	add_filter( $filter, 'convert_chars' );
98
-	add_filter( $filter, 'esc_html'      );
95
+foreach (array('comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title') as $filter) {
96
+	add_filter($filter, 'wptexturize');
97
+	add_filter($filter, 'convert_chars');
98
+	add_filter($filter, 'esc_html');
99 99
 }
100 100
 
101 101
 // Format WordPress
102
-foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter )
103
-	add_filter( $filter, 'capital_P_dangit', 11 );
104
-add_filter( 'comment_text', 'capital_P_dangit', 31 );
102
+foreach (array('the_content', 'the_title', 'wp_title') as $filter)
103
+	add_filter($filter, 'capital_P_dangit', 11);
104
+add_filter('comment_text', 'capital_P_dangit', 31);
105 105
 
106 106
 // Format titles
107
-foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description' ) as $filter ) {
108
-	add_filter( $filter, 'wptexturize' );
109
-	add_filter( $filter, 'strip_tags'  );
107
+foreach (array('single_post_title', 'single_cat_title', 'single_tag_title', 'single_month_title', 'nav_menu_attr_title', 'nav_menu_description') as $filter) {
108
+	add_filter($filter, 'wptexturize');
109
+	add_filter($filter, 'strip_tags');
110 110
 }
111 111
 
112 112
 // Format text area for display.
113
-foreach ( array( 'term_description' ) as $filter ) {
114
-	add_filter( $filter, 'wptexturize'      );
115
-	add_filter( $filter, 'convert_chars'    );
116
-	add_filter( $filter, 'wpautop'          );
117
-	add_filter( $filter, 'shortcode_unautop');
113
+foreach (array('term_description') as $filter) {
114
+	add_filter($filter, 'wptexturize');
115
+	add_filter($filter, 'convert_chars');
116
+	add_filter($filter, 'wpautop');
117
+	add_filter($filter, 'shortcode_unautop');
118 118
 }
119 119
 
120 120
 // Format for RSS
121
-add_filter( 'term_name_rss', 'convert_chars' );
121
+add_filter('term_name_rss', 'convert_chars');
122 122
 
123 123
 // Pre save hierarchy
124
-add_filter( 'wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2 );
125
-add_filter( 'wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3 );
124
+add_filter('wp_insert_post_parent', 'wp_check_post_hierarchy_for_loops', 10, 2);
125
+add_filter('wp_update_term_parent', 'wp_check_term_hierarchy_for_loops', 10, 3);
126 126
 
127 127
 // Display filters
128
-add_filter( 'the_title', 'wptexturize'   );
129
-add_filter( 'the_title', 'convert_chars' );
130
-add_filter( 'the_title', 'trim'          );
128
+add_filter('the_title', 'wptexturize');
129
+add_filter('the_title', 'convert_chars');
130
+add_filter('the_title', 'trim');
131 131
 
132
-add_filter( 'the_content', 'wptexturize'                       );
133
-add_filter( 'the_content', 'convert_smilies'                   );
134
-add_filter( 'the_content', 'wpautop'                           );
135
-add_filter( 'the_content', 'shortcode_unautop'                 );
136
-add_filter( 'the_content', 'prepend_attachment'                );
137
-add_filter( 'the_content', 'wp_make_content_images_responsive' );
132
+add_filter('the_content', 'wptexturize');
133
+add_filter('the_content', 'convert_smilies');
134
+add_filter('the_content', 'wpautop');
135
+add_filter('the_content', 'shortcode_unautop');
136
+add_filter('the_content', 'prepend_attachment');
137
+add_filter('the_content', 'wp_make_content_images_responsive');
138 138
 
139
-add_filter( 'the_excerpt',     'wptexturize'      );
140
-add_filter( 'the_excerpt',     'convert_smilies'  );
141
-add_filter( 'the_excerpt',     'convert_chars'    );
142
-add_filter( 'the_excerpt',     'wpautop'          );
143
-add_filter( 'the_excerpt',     'shortcode_unautop');
144
-add_filter( 'get_the_excerpt', 'wp_trim_excerpt'  );
139
+add_filter('the_excerpt', 'wptexturize');
140
+add_filter('the_excerpt', 'convert_smilies');
141
+add_filter('the_excerpt', 'convert_chars');
142
+add_filter('the_excerpt', 'wpautop');
143
+add_filter('the_excerpt', 'shortcode_unautop');
144
+add_filter('get_the_excerpt', 'wp_trim_excerpt');
145 145
 
146
-add_filter( 'comment_text', 'wptexturize'            );
147
-add_filter( 'comment_text', 'convert_chars'          );
148
-add_filter( 'comment_text', 'make_clickable',      9 );
149
-add_filter( 'comment_text', 'force_balance_tags', 25 );
150
-add_filter( 'comment_text', 'convert_smilies',    20 );
151
-add_filter( 'comment_text', 'wpautop',            30 );
146
+add_filter('comment_text', 'wptexturize');
147
+add_filter('comment_text', 'convert_chars');
148
+add_filter('comment_text', 'make_clickable', 9);
149
+add_filter('comment_text', 'force_balance_tags', 25);
150
+add_filter('comment_text', 'convert_smilies', 20);
151
+add_filter('comment_text', 'wpautop', 30);
152 152
 
153
-add_filter( 'comment_excerpt', 'convert_chars' );
153
+add_filter('comment_excerpt', 'convert_chars');
154 154
 
155
-add_filter( 'list_cats',         'wptexturize' );
155
+add_filter('list_cats', 'wptexturize');
156 156
 
157
-add_filter( 'wp_sprintf', 'wp_sprintf_l', 10, 2 );
157
+add_filter('wp_sprintf', 'wp_sprintf_l', 10, 2);
158 158
 
159
-add_filter( 'widget_text', 'balanceTags' );
159
+add_filter('widget_text', 'balanceTags');
160 160
 
161
-add_filter( 'date_i18n', 'wp_maybe_decline_date' );
161
+add_filter('date_i18n', 'wp_maybe_decline_date');
162 162
 
163 163
 // RSS filters
164
-add_filter( 'the_title_rss',      'strip_tags'                    );
165
-add_filter( 'the_title_rss',      'ent2ncr',                    8 );
166
-add_filter( 'the_title_rss',      'esc_html'                      );
167
-add_filter( 'the_content_rss',    'ent2ncr',                    8 );
168
-add_filter( 'the_content_feed',   'wp_staticize_emoji'            );
169
-add_filter( 'the_content_feed',   '_oembed_filter_feed_content'   );
170
-add_filter( 'the_excerpt_rss',    'convert_chars'                 );
171
-add_filter( 'the_excerpt_rss',    'ent2ncr',                    8 );
172
-add_filter( 'comment_author_rss', 'ent2ncr',                    8 );
173
-add_filter( 'comment_text_rss',   'ent2ncr',                    8 );
174
-add_filter( 'comment_text_rss',   'esc_html'                      );
175
-add_filter( 'comment_text_rss',   'wp_staticize_emoji'            );
176
-add_filter( 'bloginfo_rss',       'ent2ncr',                    8 );
177
-add_filter( 'the_author',         'ent2ncr',                    8 );
178
-add_filter( 'the_guid',           'esc_url'                       );
164
+add_filter('the_title_rss', 'strip_tags');
165
+add_filter('the_title_rss', 'ent2ncr', 8);
166
+add_filter('the_title_rss', 'esc_html');
167
+add_filter('the_content_rss', 'ent2ncr', 8);
168
+add_filter('the_content_feed', 'wp_staticize_emoji');
169
+add_filter('the_content_feed', '_oembed_filter_feed_content');
170
+add_filter('the_excerpt_rss', 'convert_chars');
171
+add_filter('the_excerpt_rss', 'ent2ncr', 8);
172
+add_filter('comment_author_rss', 'ent2ncr', 8);
173
+add_filter('comment_text_rss', 'ent2ncr', 8);
174
+add_filter('comment_text_rss', 'esc_html');
175
+add_filter('comment_text_rss', 'wp_staticize_emoji');
176
+add_filter('bloginfo_rss', 'ent2ncr', 8);
177
+add_filter('the_author', 'ent2ncr', 8);
178
+add_filter('the_guid', 'esc_url');
179 179
 
180 180
 // Email filters
181
-add_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
181
+add_filter('wp_mail', 'wp_staticize_emoji_for_email');
182 182
 
183 183
 // Misc filters
184
-add_filter( 'option_ping_sites',        'privacy_ping_filter'                 );
185
-add_filter( 'option_blog_charset',      '_wp_specialchars'                    ); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
186
-add_filter( 'option_blog_charset',      '_canonical_charset'                  );
187
-add_filter( 'option_home',              '_config_wp_home'                     );
188
-add_filter( 'option_siteurl',           '_config_wp_siteurl'                  );
189
-add_filter( 'tiny_mce_before_init',     '_mce_set_direction'                  );
190
-add_filter( 'teeny_mce_before_init',    '_mce_set_direction'                  );
191
-add_filter( 'pre_kses',                 'wp_pre_kses_less_than'               );
192
-add_filter( 'sanitize_title',           'sanitize_title_with_dashes',   10, 3 );
193
-add_action( 'check_comment_flood',      'check_comment_flood_db',       10, 3 );
194
-add_filter( 'comment_flood_filter',     'wp_throttle_comment_flood',    10, 3 );
195
-add_filter( 'pre_comment_content',      'wp_rel_nofollow',              15    );
196
-add_filter( 'comment_email',            'antispambot'                         );
197
-add_filter( 'option_tag_base',          '_wp_filter_taxonomy_base'            );
198
-add_filter( 'option_category_base',     '_wp_filter_taxonomy_base'            );
199
-add_filter( 'the_posts',                '_close_comments_for_old_posts', 10, 2);
200
-add_filter( 'comments_open',            '_close_comments_for_old_post', 10, 2 );
201
-add_filter( 'pings_open',               '_close_comments_for_old_post', 10, 2 );
202
-add_filter( 'editable_slug',            'urldecode'                           );
203
-add_filter( 'editable_slug',            'esc_textarea'                        );
204
-add_filter( 'nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object'        );
205
-add_filter( 'pingback_ping_source_uri', 'pingback_ping_source_uri'            );
206
-add_filter( 'xmlrpc_pingback_error',    'xmlrpc_pingback_error'               );
207
-add_filter( 'title_save_pre',           'trim'                                );
208
-
209
-add_filter( 'http_request_host_is_external', 'allowed_http_request_hosts', 10, 2 );
184
+add_filter('option_ping_sites', 'privacy_ping_filter');
185
+add_filter('option_blog_charset', '_wp_specialchars'); // IMPORTANT: This must not be wp_specialchars() or esc_html() or it'll cause an infinite loop
186
+add_filter('option_blog_charset', '_canonical_charset');
187
+add_filter('option_home', '_config_wp_home');
188
+add_filter('option_siteurl', '_config_wp_siteurl');
189
+add_filter('tiny_mce_before_init', '_mce_set_direction');
190
+add_filter('teeny_mce_before_init', '_mce_set_direction');
191
+add_filter('pre_kses', 'wp_pre_kses_less_than');
192
+add_filter('sanitize_title', 'sanitize_title_with_dashes', 10, 3);
193
+add_action('check_comment_flood', 'check_comment_flood_db', 10, 3);
194
+add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
195
+add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
196
+add_filter('comment_email', 'antispambot');
197
+add_filter('option_tag_base', '_wp_filter_taxonomy_base');
198
+add_filter('option_category_base', '_wp_filter_taxonomy_base');
199
+add_filter('the_posts', '_close_comments_for_old_posts', 10, 2);
200
+add_filter('comments_open', '_close_comments_for_old_post', 10, 2);
201
+add_filter('pings_open', '_close_comments_for_old_post', 10, 2);
202
+add_filter('editable_slug', 'urldecode');
203
+add_filter('editable_slug', 'esc_textarea');
204
+add_filter('nav_menu_meta_box_object', '_wp_nav_menu_meta_box_object');
205
+add_filter('pingback_ping_source_uri', 'pingback_ping_source_uri');
206
+add_filter('xmlrpc_pingback_error', 'xmlrpc_pingback_error');
207
+add_filter('title_save_pre', 'trim');
208
+
209
+add_filter('http_request_host_is_external', 'allowed_http_request_hosts', 10, 2);
210 210
 
211 211
 // REST API filters.
212
-add_action( 'xmlrpc_rsd_apis',            'rest_output_rsd' );
213
-add_action( 'wp_head',                    'rest_output_link_wp_head', 10, 0 );
214
-add_action( 'template_redirect',          'rest_output_link_header', 11, 0 );
215
-add_action( 'auth_cookie_malformed',      'rest_cookie_collect_status' );
216
-add_action( 'auth_cookie_expired',        'rest_cookie_collect_status' );
217
-add_action( 'auth_cookie_bad_username',   'rest_cookie_collect_status' );
218
-add_action( 'auth_cookie_bad_hash',       'rest_cookie_collect_status' );
219
-add_action( 'auth_cookie_valid',          'rest_cookie_collect_status' );
220
-add_filter( 'rest_authentication_errors', 'rest_cookie_check_errors', 100 );
212
+add_action('xmlrpc_rsd_apis', 'rest_output_rsd');
213
+add_action('wp_head', 'rest_output_link_wp_head', 10, 0);
214
+add_action('template_redirect', 'rest_output_link_header', 11, 0);
215
+add_action('auth_cookie_malformed', 'rest_cookie_collect_status');
216
+add_action('auth_cookie_expired', 'rest_cookie_collect_status');
217
+add_action('auth_cookie_bad_username', 'rest_cookie_collect_status');
218
+add_action('auth_cookie_bad_hash', 'rest_cookie_collect_status');
219
+add_action('auth_cookie_valid', 'rest_cookie_collect_status');
220
+add_filter('rest_authentication_errors', 'rest_cookie_check_errors', 100);
221 221
 
222 222
 // Actions
223
-add_action( 'wp_head',             '_wp_render_title_tag',            1     );
224
-add_action( 'wp_head',             'wp_enqueue_scripts',              1     );
225
-add_action( 'wp_head',             'feed_links',                      2     );
226
-add_action( 'wp_head',             'feed_links_extra',                3     );
227
-add_action( 'wp_head',             'rsd_link'                               );
228
-add_action( 'wp_head',             'wlwmanifest_link'                       );
229
-add_action( 'wp_head',             'adjacent_posts_rel_link_wp_head', 10, 0 );
230
-add_action( 'wp_head',             'locale_stylesheet'                      );
231
-add_action( 'publish_future_post', 'check_and_publish_future_post',   10, 1 );
232
-add_action( 'wp_head',             'noindex',                          1    );
233
-add_action( 'wp_head',             'print_emoji_detection_script',     7    );
234
-add_action( 'wp_head',             'wp_print_styles',                  8    );
235
-add_action( 'wp_head',             'wp_print_head_scripts',            9    );
236
-add_action( 'wp_head',             'wp_generator'                           );
237
-add_action( 'wp_head',             'rel_canonical'                          );
238
-add_action( 'wp_head',             'wp_shortlink_wp_head',            10, 0 );
239
-add_action( 'wp_head',             'wp_site_icon',                    99    );
240
-add_action( 'wp_footer',           'wp_print_footer_scripts',         20    );
241
-add_action( 'template_redirect',   'wp_shortlink_header',             11, 0 );
242
-add_action( 'wp_print_footer_scripts', '_wp_footer_scripts'                 );
243
-add_action( 'init',                'check_theme_switched',            99    );
244
-add_action( 'after_switch_theme',  '_wp_sidebars_changed'                   );
245
-add_action( 'wp_print_styles',     'print_emoji_styles'                     );
246
-
247
-if ( isset( $_GET['replytocom'] ) )
248
-    add_action( 'wp_head', 'wp_no_robots' );
223
+add_action('wp_head', '_wp_render_title_tag', 1);
224
+add_action('wp_head', 'wp_enqueue_scripts', 1);
225
+add_action('wp_head', 'feed_links', 2);
226
+add_action('wp_head', 'feed_links_extra', 3);
227
+add_action('wp_head', 'rsd_link');
228
+add_action('wp_head', 'wlwmanifest_link');
229
+add_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
230
+add_action('wp_head', 'locale_stylesheet');
231
+add_action('publish_future_post', 'check_and_publish_future_post', 10, 1);
232
+add_action('wp_head', 'noindex', 1);
233
+add_action('wp_head', 'print_emoji_detection_script', 7);
234
+add_action('wp_head', 'wp_print_styles', 8);
235
+add_action('wp_head', 'wp_print_head_scripts', 9);
236
+add_action('wp_head', 'wp_generator');
237
+add_action('wp_head', 'rel_canonical');
238
+add_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
239
+add_action('wp_head', 'wp_site_icon', 99);
240
+add_action('wp_footer', 'wp_print_footer_scripts', 20);
241
+add_action('template_redirect', 'wp_shortlink_header', 11, 0);
242
+add_action('wp_print_footer_scripts', '_wp_footer_scripts');
243
+add_action('init', 'check_theme_switched', 99);
244
+add_action('after_switch_theme', '_wp_sidebars_changed');
245
+add_action('wp_print_styles', 'print_emoji_styles');
246
+
247
+if (isset($_GET['replytocom']))
248
+    add_action('wp_head', 'wp_no_robots');
249 249
 
250 250
 // Login actions
251
-add_action( 'login_head',          'wp_print_head_scripts',         9     );
252
-add_action( 'login_head',          'print_admin_styles',            9     );
253
-add_action( 'login_head',          'wp_site_icon',                  99    );
254
-add_action( 'login_footer',        'wp_print_footer_scripts',       20    );
255
-add_action( 'login_init',          'send_frame_options_header',     10, 0 );
251
+add_action('login_head', 'wp_print_head_scripts', 9);
252
+add_action('login_head', 'print_admin_styles', 9);
253
+add_action('login_head', 'wp_site_icon', 99);
254
+add_action('login_footer', 'wp_print_footer_scripts', 20);
255
+add_action('login_init', 'send_frame_options_header', 10, 0);
256 256
 
257 257
 // Feed Generator Tags
258
-foreach ( array( 'rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head' ) as $action ) {
259
-	add_action( $action, 'the_generator' );
258
+foreach (array('rss2_head', 'commentsrss2_head', 'rss_head', 'rdf_header', 'atom_head', 'comments_atom_head', 'opml_head', 'app_head') as $action) {
259
+	add_action($action, 'the_generator');
260 260
 }
261 261
 
262 262
 // Feed Site Icon
263
-add_action( 'atom_head', 'atom_site_icon' );
264
-add_action( 'rss2_head', 'rss2_site_icon' );
263
+add_action('atom_head', 'atom_site_icon');
264
+add_action('rss2_head', 'rss2_site_icon');
265 265
 
266 266
 
267 267
 // WP Cron
268
-if ( !defined( 'DOING_CRON' ) )
269
-	add_action( 'init', 'wp_cron' );
268
+if ( ! defined('DOING_CRON'))
269
+	add_action('init', 'wp_cron');
270 270
 
271 271
 // 2 Actions 2 Furious
272
-add_action( 'do_feed_rdf',                'do_feed_rdf',                             10, 1 );
273
-add_action( 'do_feed_rss',                'do_feed_rss',                             10, 1 );
274
-add_action( 'do_feed_rss2',               'do_feed_rss2',                            10, 1 );
275
-add_action( 'do_feed_atom',               'do_feed_atom',                            10, 1 );
276
-add_action( 'do_pings',                   'do_all_pings',                            10, 1 );
277
-add_action( 'do_robots',                  'do_robots'                                      );
278
-add_action( 'set_comment_cookies',        'wp_set_comment_cookies',                  10, 2 );
279
-add_action( 'sanitize_comment_cookies',   'sanitize_comment_cookies'                       );
280
-add_action( 'admin_print_scripts',        'print_emoji_detection_script'                   );
281
-add_action( 'admin_print_scripts',        'print_head_scripts',                      20    );
282
-add_action( 'admin_print_footer_scripts', '_wp_footer_scripts'                             );
283
-add_action( 'admin_print_styles',         'print_emoji_styles'                             );
284
-add_action( 'admin_print_styles',         'print_admin_styles',                      20    );
285
-add_action( 'init',                       'smilies_init',                             5    );
286
-add_action( 'plugins_loaded',             'wp_maybe_load_widgets',                    0    );
287
-add_action( 'plugins_loaded',             'wp_maybe_load_embeds',                     0    );
288
-add_action( 'shutdown',                   'wp_ob_end_flush_all',                      1    );
272
+add_action('do_feed_rdf', 'do_feed_rdf', 10, 1);
273
+add_action('do_feed_rss', 'do_feed_rss', 10, 1);
274
+add_action('do_feed_rss2', 'do_feed_rss2', 10, 1);
275
+add_action('do_feed_atom', 'do_feed_atom', 10, 1);
276
+add_action('do_pings', 'do_all_pings', 10, 1);
277
+add_action('do_robots', 'do_robots');
278
+add_action('set_comment_cookies', 'wp_set_comment_cookies', 10, 2);
279
+add_action('sanitize_comment_cookies', 'sanitize_comment_cookies');
280
+add_action('admin_print_scripts', 'print_emoji_detection_script');
281
+add_action('admin_print_scripts', 'print_head_scripts', 20);
282
+add_action('admin_print_footer_scripts', '_wp_footer_scripts');
283
+add_action('admin_print_styles', 'print_emoji_styles');
284
+add_action('admin_print_styles', 'print_admin_styles', 20);
285
+add_action('init', 'smilies_init', 5);
286
+add_action('plugins_loaded', 'wp_maybe_load_widgets', 0);
287
+add_action('plugins_loaded', 'wp_maybe_load_embeds', 0);
288
+add_action('shutdown', 'wp_ob_end_flush_all', 1);
289 289
 // Create a revision whenever a post is updated.
290
-add_action( 'post_updated',               'wp_save_post_revision',                   10, 1 );
291
-add_action( 'publish_post',               '_publish_post_hook',                       5, 1 );
292
-add_action( 'transition_post_status',     '_transition_post_status',                  5, 3 );
293
-add_action( 'transition_post_status',     '_update_term_count_on_transition_post_status', 10, 3 );
294
-add_action( 'comment_form',               'wp_comment_form_unfiltered_html_nonce'          );
295
-add_action( 'wp_scheduled_delete',        'wp_scheduled_delete'                            );
296
-add_action( 'wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts'                      );
297
-add_action( 'admin_init',                 'send_frame_options_header',               10, 0 );
298
-add_action( 'importer_scheduled_cleanup', 'wp_delete_attachment'                           );
299
-add_action( 'upgrader_scheduled_cleanup', 'wp_delete_attachment'                           );
300
-add_action( 'welcome_panel',              'wp_welcome_panel'                               );
290
+add_action('post_updated', 'wp_save_post_revision', 10, 1);
291
+add_action('publish_post', '_publish_post_hook', 5, 1);
292
+add_action('transition_post_status', '_transition_post_status', 5, 3);
293
+add_action('transition_post_status', '_update_term_count_on_transition_post_status', 10, 3);
294
+add_action('comment_form', 'wp_comment_form_unfiltered_html_nonce');
295
+add_action('wp_scheduled_delete', 'wp_scheduled_delete');
296
+add_action('wp_scheduled_auto_draft_delete', 'wp_delete_auto_drafts');
297
+add_action('admin_init', 'send_frame_options_header', 10, 0);
298
+add_action('importer_scheduled_cleanup', 'wp_delete_attachment');
299
+add_action('upgrader_scheduled_cleanup', 'wp_delete_attachment');
300
+add_action('welcome_panel', 'wp_welcome_panel');
301 301
 
302 302
 // Navigation menu actions
303
-add_action( 'delete_post',                '_wp_delete_post_menu_item'         );
304
-add_action( 'delete_term',                '_wp_delete_tax_menu_item',   10, 3 );
305
-add_action( 'transition_post_status',     '_wp_auto_add_pages_to_menu', 10, 3 );
303
+add_action('delete_post', '_wp_delete_post_menu_item');
304
+add_action('delete_term', '_wp_delete_tax_menu_item', 10, 3);
305
+add_action('transition_post_status', '_wp_auto_add_pages_to_menu', 10, 3);
306 306
 
307 307
 // Post Thumbnail CSS class filtering
308
-add_action( 'begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add'    );
309
-add_action( 'end_fetch_post_thumbnail_html',   '_wp_post_thumbnail_class_filter_remove' );
308
+add_action('begin_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_add');
309
+add_action('end_fetch_post_thumbnail_html', '_wp_post_thumbnail_class_filter_remove');
310 310
 
311 311
 // Redirect Old Slugs
312
-add_action( 'template_redirect',  'wp_old_slug_redirect'              );
313
-add_action( 'post_updated',       'wp_check_for_changed_slugs', 12, 3 );
314
-add_action( 'attachment_updated', 'wp_check_for_changed_slugs', 12, 3 );
312
+add_action('template_redirect', 'wp_old_slug_redirect');
313
+add_action('post_updated', 'wp_check_for_changed_slugs', 12, 3);
314
+add_action('attachment_updated', 'wp_check_for_changed_slugs', 12, 3);
315 315
 
316 316
 // Nonce check for Post Previews
317
-add_action( 'init', '_show_post_preview' );
317
+add_action('init', '_show_post_preview');
318 318
 
319 319
 // Output JS to reset window.name for previews
320
-add_action( 'wp_head', 'wp_post_preview_js', 1 );
320
+add_action('wp_head', 'wp_post_preview_js', 1);
321 321
 
322 322
 // Timezone
323
-add_filter( 'pre_option_gmt_offset','wp_timezone_override_offset' );
323
+add_filter('pre_option_gmt_offset', 'wp_timezone_override_offset');
324 324
 
325 325
 // Admin Color Schemes
326
-add_action( 'admin_init', 'register_admin_color_schemes', 1);
327
-add_action( 'admin_color_scheme_picker', 'admin_color_scheme_picker' );
326
+add_action('admin_init', 'register_admin_color_schemes', 1);
327
+add_action('admin_color_scheme_picker', 'admin_color_scheme_picker');
328 328
 
329 329
 // If the upgrade hasn't run yet, assume link manager is used.
330
-add_filter( 'default_option_link_manager_enabled', '__return_true' );
330
+add_filter('default_option_link_manager_enabled', '__return_true');
331 331
 
332 332
 // This option no longer exists; tell plugins we always support auto-embedding.
333
-add_filter( 'default_option_embed_autourls', '__return_true' );
333
+add_filter('default_option_embed_autourls', '__return_true');
334 334
 
335 335
 // Default settings for heartbeat
336
-add_filter( 'heartbeat_settings', 'wp_heartbeat_settings' );
336
+add_filter('heartbeat_settings', 'wp_heartbeat_settings');
337 337
 
338 338
 // Check if the user is logged out
339
-add_action( 'admin_enqueue_scripts', 'wp_auth_check_load' );
340
-add_filter( 'heartbeat_send',        'wp_auth_check' );
341
-add_filter( 'heartbeat_nopriv_send', 'wp_auth_check' );
339
+add_action('admin_enqueue_scripts', 'wp_auth_check_load');
340
+add_filter('heartbeat_send', 'wp_auth_check');
341
+add_filter('heartbeat_nopriv_send', 'wp_auth_check');
342 342
 
343 343
 // Default authentication filters
344
-add_filter( 'authenticate', 'wp_authenticate_username_password',  20, 3 );
345
-add_filter( 'authenticate', 'wp_authenticate_email_password',     20, 3 );
346
-add_filter( 'authenticate', 'wp_authenticate_spam_check',         99    );
347
-add_filter( 'determine_current_user', 'wp_validate_auth_cookie'          );
348
-add_filter( 'determine_current_user', 'wp_validate_logged_in_cookie', 20 );
344
+add_filter('authenticate', 'wp_authenticate_username_password', 20, 3);
345
+add_filter('authenticate', 'wp_authenticate_email_password', 20, 3);
346
+add_filter('authenticate', 'wp_authenticate_spam_check', 99);
347
+add_filter('determine_current_user', 'wp_validate_auth_cookie');
348
+add_filter('determine_current_user', 'wp_validate_logged_in_cookie', 20);
349 349
 
350 350
 // Split term updates.
351
-add_action( 'admin_init',        '_wp_check_for_scheduled_split_terms' );
352
-add_action( 'split_shared_term', '_wp_check_split_default_terms',  10, 4 );
353
-add_action( 'split_shared_term', '_wp_check_split_terms_in_menus', 10, 4 );
354
-add_action( 'split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4 );
355
-add_action( 'wp_split_shared_term_batch', '_wp_batch_split_terms' );
351
+add_action('admin_init', '_wp_check_for_scheduled_split_terms');
352
+add_action('split_shared_term', '_wp_check_split_default_terms', 10, 4);
353
+add_action('split_shared_term', '_wp_check_split_terms_in_menus', 10, 4);
354
+add_action('split_shared_term', '_wp_check_split_nav_menu_terms', 10, 4);
355
+add_action('wp_split_shared_term_batch', '_wp_batch_split_terms');
356 356
 
357 357
 // Email notifications.
358
-add_action( 'comment_post', 'wp_new_comment_notify_moderator' );
359
-add_action( 'comment_post', 'wp_new_comment_notify_postauthor' );
360
-add_action( 'after_password_reset', 'wp_password_change_notification' );
361
-add_action( 'register_new_user',      'wp_send_new_user_notifications' );
362
-add_action( 'edit_user_created_user', 'wp_send_new_user_notifications', 10, 2 );
358
+add_action('comment_post', 'wp_new_comment_notify_moderator');
359
+add_action('comment_post', 'wp_new_comment_notify_postauthor');
360
+add_action('after_password_reset', 'wp_password_change_notification');
361
+add_action('register_new_user', 'wp_send_new_user_notifications');
362
+add_action('edit_user_created_user', 'wp_send_new_user_notifications', 10, 2);
363 363
 
364 364
 // REST API actions.
365
-add_action( 'init',          'rest_api_init' );
366
-add_action( 'rest_api_init', 'rest_api_default_filters', 10, 1 );
367
-add_action( 'parse_request', 'rest_api_loaded' );
365
+add_action('init', 'rest_api_init');
366
+add_action('rest_api_init', 'rest_api_default_filters', 10, 1);
367
+add_action('parse_request', 'rest_api_loaded');
368 368
 
369 369
 /**
370 370
  * Filters formerly mixed into wp-includes
371 371
  */
372 372
 // Theme
373
-add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
374
-add_action( 'wp_head', '_custom_logo_header_styles' );
375
-add_action( 'plugins_loaded', '_wp_customize_include' );
376
-add_action( 'admin_enqueue_scripts', '_wp_customize_loader_settings' );
377
-add_action( 'delete_attachment', '_delete_attachment_theme_mod' );
373
+add_action('wp_loaded', '_custom_header_background_just_in_time');
374
+add_action('wp_head', '_custom_logo_header_styles');
375
+add_action('plugins_loaded', '_wp_customize_include');
376
+add_action('admin_enqueue_scripts', '_wp_customize_loader_settings');
377
+add_action('delete_attachment', '_delete_attachment_theme_mod');
378 378
 
379 379
 // Calendar widget cache
380
-add_action( 'save_post', 'delete_get_calendar_cache' );
381
-add_action( 'delete_post', 'delete_get_calendar_cache' );
382
-add_action( 'update_option_start_of_week', 'delete_get_calendar_cache' );
383
-add_action( 'update_option_gmt_offset', 'delete_get_calendar_cache' );
380
+add_action('save_post', 'delete_get_calendar_cache');
381
+add_action('delete_post', 'delete_get_calendar_cache');
382
+add_action('update_option_start_of_week', 'delete_get_calendar_cache');
383
+add_action('update_option_gmt_offset', 'delete_get_calendar_cache');
384 384
 
385 385
 // Author
386
-add_action( 'transition_post_status', '__clear_multi_author_cache' );
386
+add_action('transition_post_status', '__clear_multi_author_cache');
387 387
 
388 388
 // Post
389
-add_action( 'init', 'create_initial_post_types', 0 ); // highest priority
390
-add_action( 'admin_menu', '_add_post_type_submenus' );
391
-add_action( 'before_delete_post', '_reset_front_page_settings_for_post' );
392
-add_action( 'wp_trash_post',      '_reset_front_page_settings_for_post' );
389
+add_action('init', 'create_initial_post_types', 0); // highest priority
390
+add_action('admin_menu', '_add_post_type_submenus');
391
+add_action('before_delete_post', '_reset_front_page_settings_for_post');
392
+add_action('wp_trash_post', '_reset_front_page_settings_for_post');
393 393
 
394 394
 // Post Formats
395
-add_filter( 'request', '_post_format_request' );
396
-add_filter( 'term_link', '_post_format_link', 10, 3 );
397
-add_filter( 'get_post_format', '_post_format_get_term' );
398
-add_filter( 'get_terms', '_post_format_get_terms', 10, 3 );
399
-add_filter( 'wp_get_object_terms', '_post_format_wp_get_object_terms' );
395
+add_filter('request', '_post_format_request');
396
+add_filter('term_link', '_post_format_link', 10, 3);
397
+add_filter('get_post_format', '_post_format_get_term');
398
+add_filter('get_terms', '_post_format_get_terms', 10, 3);
399
+add_filter('wp_get_object_terms', '_post_format_wp_get_object_terms');
400 400
 
401 401
 // KSES
402
-add_action( 'init', 'kses_init' );
403
-add_action( 'set_current_user', 'kses_init' );
402
+add_action('init', 'kses_init');
403
+add_action('set_current_user', 'kses_init');
404 404
 
405 405
 // Script Loader
406
-add_action( 'wp_default_scripts', 'wp_default_scripts' );
407
-add_filter( 'wp_print_scripts', 'wp_just_in_time_script_localization' );
408
-add_filter( 'print_scripts_array', 'wp_prototype_before_jquery' );
406
+add_action('wp_default_scripts', 'wp_default_scripts');
407
+add_filter('wp_print_scripts', 'wp_just_in_time_script_localization');
408
+add_filter('print_scripts_array', 'wp_prototype_before_jquery');
409 409
 
410
-add_action( 'wp_default_styles', 'wp_default_styles' );
411
-add_filter( 'style_loader_src', 'wp_style_loader_src', 10, 2 );
410
+add_action('wp_default_styles', 'wp_default_styles');
411
+add_filter('style_loader_src', 'wp_style_loader_src', 10, 2);
412 412
 
413 413
 // Taxonomy
414
-add_action( 'init', 'create_initial_taxonomies', 0 ); // highest priority
414
+add_action('init', 'create_initial_taxonomies', 0); // highest priority
415 415
 
416 416
 // Canonical
417
-add_action( 'template_redirect', 'redirect_canonical' );
418
-add_action( 'template_redirect', 'wp_redirect_admin_locations', 1000 );
417
+add_action('template_redirect', 'redirect_canonical');
418
+add_action('template_redirect', 'wp_redirect_admin_locations', 1000);
419 419
 
420 420
 // Shortcodes
421
-add_filter( 'the_content', 'do_shortcode', 11 ); // AFTER wpautop()
421
+add_filter('the_content', 'do_shortcode', 11); // AFTER wpautop()
422 422
 
423 423
 // Media
424
-add_action( 'wp_playlist_scripts', 'wp_playlist_scripts' );
425
-add_action( 'customize_controls_enqueue_scripts', 'wp_plupload_default_settings' );
424
+add_action('wp_playlist_scripts', 'wp_playlist_scripts');
425
+add_action('customize_controls_enqueue_scripts', 'wp_plupload_default_settings');
426 426
 
427 427
 // Nav menu
428
-add_filter( 'nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2 );
428
+add_filter('nav_menu_item_id', '_nav_menu_item_id_use_once', 10, 2);
429 429
 
430 430
 // Widgets
431
-add_action( 'init', 'wp_widgets_init', 1 );
431
+add_action('init', 'wp_widgets_init', 1);
432 432
 
433 433
 // Admin Bar
434 434
 // Don't remove. Wrong way to disable.
435
-add_action( 'template_redirect', '_wp_admin_bar_init', 0 );
436
-add_action( 'admin_init', '_wp_admin_bar_init' );
437
-add_action( 'before_signup_header', '_wp_admin_bar_init' );
438
-add_action( 'activate_header', '_wp_admin_bar_init' );
439
-add_action( 'wp_footer', 'wp_admin_bar_render', 1000 );
440
-add_action( 'in_admin_header', 'wp_admin_bar_render', 0 );
435
+add_action('template_redirect', '_wp_admin_bar_init', 0);
436
+add_action('admin_init', '_wp_admin_bar_init');
437
+add_action('before_signup_header', '_wp_admin_bar_init');
438
+add_action('activate_header', '_wp_admin_bar_init');
439
+add_action('wp_footer', 'wp_admin_bar_render', 1000);
440
+add_action('in_admin_header', 'wp_admin_bar_render', 0);
441 441
 
442 442
 // Former admin filters that can also be hooked on the front end
443
-add_action( 'media_buttons', 'media_buttons' );
444
-add_filter( 'image_send_to_editor', 'image_add_caption', 20, 8 );
445
-add_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 );
443
+add_action('media_buttons', 'media_buttons');
444
+add_filter('image_send_to_editor', 'image_add_caption', 20, 8);
445
+add_filter('media_send_to_editor', 'image_media_send_to_editor', 10, 3);
446 446
 
447 447
 // Embeds
448
-add_action( 'rest_api_init',          'wp_oembed_register_route'              );
449
-add_filter( 'rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4 );
450
-
451
-add_action( 'wp_head',                'wp_oembed_add_discovery_links'         );
452
-add_action( 'wp_head',                'wp_oembed_add_host_js'                 );
453
-
454
-add_action( 'embed_head',             'enqueue_embed_scripts',           1    );
455
-add_action( 'embed_head',             'print_emoji_detection_script'          );
456
-add_action( 'embed_head',             'print_embed_styles'                    );
457
-add_action( 'embed_head',             'wp_print_head_scripts',          20    );
458
-add_action( 'embed_head',             'wp_print_styles',                20    );
459
-add_action( 'embed_head',             'wp_no_robots'                          );
460
-add_action( 'embed_head',             'rel_canonical'                         );
461
-add_action( 'embed_head',             'locale_stylesheet'                     );
462
-
463
-add_action( 'embed_content_meta',     'print_embed_comments_button'           );
464
-add_action( 'embed_content_meta',     'print_embed_sharing_button'            );
465
-
466
-add_action( 'embed_footer',           'print_embed_sharing_dialog'            );
467
-add_action( 'embed_footer',           'print_embed_scripts'                   );
468
-add_action( 'embed_footer',           'wp_print_footer_scripts',        20    );
469
-
470
-add_filter( 'excerpt_more',           'wp_embed_excerpt_more',          20    );
471
-add_filter( 'the_excerpt_embed',      'wptexturize'                           );
472
-add_filter( 'the_excerpt_embed',      'convert_chars'                         );
473
-add_filter( 'the_excerpt_embed',      'wpautop'                               );
474
-add_filter( 'the_excerpt_embed',      'shortcode_unautop'                     );
475
-add_filter( 'the_excerpt_embed',      'wp_embed_excerpt_attachment'           );
476
-
477
-add_filter( 'oembed_dataparse',       'wp_filter_oembed_result',        10, 3 );
478
-add_filter( 'oembed_response_data',   'get_oembed_response_data_rich',  10, 4 );
479
-
480
-unset( $filter, $action );
448
+add_action('rest_api_init', 'wp_oembed_register_route');
449
+add_filter('rest_pre_serve_request', '_oembed_rest_pre_serve_request', 10, 4);
450
+
451
+add_action('wp_head', 'wp_oembed_add_discovery_links');
452
+add_action('wp_head', 'wp_oembed_add_host_js');
453
+
454
+add_action('embed_head', 'enqueue_embed_scripts', 1);
455
+add_action('embed_head', 'print_emoji_detection_script');
456
+add_action('embed_head', 'print_embed_styles');
457
+add_action('embed_head', 'wp_print_head_scripts', 20);
458
+add_action('embed_head', 'wp_print_styles', 20);
459
+add_action('embed_head', 'wp_no_robots');
460
+add_action('embed_head', 'rel_canonical');
461
+add_action('embed_head', 'locale_stylesheet');
462
+
463
+add_action('embed_content_meta', 'print_embed_comments_button');
464
+add_action('embed_content_meta', 'print_embed_sharing_button');
465
+
466
+add_action('embed_footer', 'print_embed_sharing_dialog');
467
+add_action('embed_footer', 'print_embed_scripts');
468
+add_action('embed_footer', 'wp_print_footer_scripts', 20);
469
+
470
+add_filter('excerpt_more', 'wp_embed_excerpt_more', 20);
471
+add_filter('the_excerpt_embed', 'wptexturize');
472
+add_filter('the_excerpt_embed', 'convert_chars');
473
+add_filter('the_excerpt_embed', 'wpautop');
474
+add_filter('the_excerpt_embed', 'shortcode_unautop');
475
+add_filter('the_excerpt_embed', 'wp_embed_excerpt_attachment');
476
+
477
+add_filter('oembed_dataparse', 'wp_filter_oembed_result', 10, 3);
478
+add_filter('oembed_response_data', 'get_oembed_response_data_rich', 10, 4);
479
+
480
+unset($filter, $action);
Please login to merge, or discard this patch.
src/wp-includes/registration-functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
  *
5 5
  * @package WordPress
6 6
  */
7
-_deprecated_file( basename(__FILE__), '2.1', null, __( 'This file no longer needs to be included.' ) );
7
+_deprecated_file(basename(__FILE__), '2.1', null, __('This file no longer needs to be included.'));
Please login to merge, or discard this patch.
src/wp-includes/functions.php 5 patches
Switch Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -2440,15 +2440,15 @@  discard block
 block discarded – undo
2440 2440
 		}
2441 2441
 		$errors = $message->get_error_messages();
2442 2442
 		switch ( count( $errors ) ) {
2443
-		case 0 :
2444
-			$message = '';
2445
-			break;
2446
-		case 1 :
2447
-			$message = "<p>{$errors[0]}</p>";
2448
-			break;
2449
-		default :
2450
-			$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
2451
-			break;
2443
+			case 0 :
2444
+				$message = '';
2445
+				break;
2446
+			case 1 :
2447
+				$message = "<p>{$errors[0]}</p>";
2448
+				break;
2449
+			default :
2450
+				$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
2451
+				break;
2452 2452
 		}
2453 2453
 	} elseif ( is_string( $message ) ) {
2454 2454
 		$message = "<p>$message</p>";
@@ -4447,17 +4447,17 @@  discard block
 block discarded – undo
4447 4447
  */
4448 4448
 function _wp_mysql_week( $column ) {
4449 4449
 	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
4450
-	case 1 :
4451
-		return "WEEK( $column, 1 )";
4452
-	case 2 :
4453
-	case 3 :
4454
-	case 4 :
4455
-	case 5 :
4456
-	case 6 :
4457
-		return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
4458
-	case 0 :
4459
-	default :
4460
-		return "WEEK( $column, 0 )";
4450
+		case 1 :
4451
+			return "WEEK( $column, 1 )";
4452
+		case 2 :
4453
+		case 3 :
4454
+		case 4 :
4455
+		case 5 :
4456
+		case 6 :
4457
+			return "WEEK( DATE_SUB( $column, INTERVAL $start_of_week DAY ), 0 )";
4458
+		case 0 :
4459
+		default :
4460
+			return "WEEK( $column, 0 )";
4461 4461
 	}
4462 4462
 }
4463 4463
 
Please login to merge, or discard this patch.
Doc Comments   +7 added lines, -10 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
  *
56 56
  * @param string   $type Type of time to retrieve. Accepts 'mysql', 'timestamp', or PHP date
57 57
  *                       format string (e.g. 'Y-m-d').
58
- * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
58
+ * @param integer $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61 61
 function current_time( $type, $gmt = 0 ) {
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
  * @since 2.0.5
428 428
  *
429 429
  * @param string|array|object $data Data that might be serialized.
430
- * @return mixed A scalar data
430
+ * @return string A scalar data
431 431
  */
432 432
 function maybe_serialize( $data ) {
433 433
 	if ( is_array( $data ) || is_object( $data ) )
@@ -762,9 +762,6 @@  discard block
 block discarded – undo
762 762
  *
763 763
  * @since 1.5.0
764 764
  *
765
- * @param string|array $key   Either a query variable key, or an associative array of query variables.
766
- * @param string       $value Optional. Either a query variable value, or a URL to act upon.
767
- * @param string       $url   Optional. A URL to act upon.
768 765
  * @return string New URL query string (unescaped).
769 766
  */
770 767
 function add_query_arg() {
@@ -1419,7 +1416,7 @@  discard block
 block discarded – undo
1419 1416
  * @since 2.0.4
1420 1417
  *
1421 1418
  * @param string     $actionurl URL to add nonce action.
1422
- * @param int|string $action    Optional. Nonce action name. Default -1.
1419
+ * @param integer $action    Optional. Nonce action name. Default -1.
1423 1420
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1424 1421
  * @return string Escaped URL with nonce action added.
1425 1422
  */
@@ -1448,7 +1445,7 @@  discard block
 block discarded – undo
1448 1445
  *
1449 1446
  * @since 2.0.4
1450 1447
  *
1451
- * @param int|string $action  Optional. Action name. Default -1.
1448
+ * @param integer $action  Optional. Action name. Default -1.
1452 1449
  * @param string     $name    Optional. Nonce name. Default '_wpnonce'.
1453 1450
  * @param bool       $referer Optional. Whether to set the referer field for validation. Default true.
1454 1451
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
@@ -1540,7 +1537,7 @@  discard block
 block discarded – undo
1540 1537
  *
1541 1538
  * @since 4.5.0
1542 1539
  *
1543
- * @return string|false Referer URL on success, false on failure.
1540
+ * @return string Referer URL on success, false on failure.
1544 1541
  */
1545 1542
 function wp_get_raw_referer() {
1546 1543
 	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
@@ -4616,7 +4613,7 @@  discard block
 block discarded – undo
4616 4613
  *
4617 4614
  * @see __return_false()
4618 4615
  *
4619
- * @return true True.
4616
+ * @return boolean True.
4620 4617
  */
4621 4618
 function __return_true() {
4622 4619
 	return true;
@@ -4738,7 +4735,7 @@  discard block
 block discarded – undo
4738 4735
  * @param int      $start         The ID to start the loop check at.
4739 4736
  * @param int      $start_parent  The parent_ID of $start to use instead of calling $callback( $start ).
4740 4737
  *                                Use null to always use $callback
4741
- * @param array    $callback_args Optional. Additional arguments to send to $callback.
4738
+ * @param string[]    $callback_args Optional. Additional arguments to send to $callback.
4742 4739
  * @return array IDs of all members of loop.
4743 4740
  */
4744 4741
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Main WordPress API
4
- *
5
- * @package WordPress
6
- */
3
+	 * Main WordPress API
4
+	 *
5
+	 * @package WordPress
6
+	 */
7 7
 
8 8
 require( ABSPATH . WPINC . '/option.php' );
9 9
 
@@ -2452,14 +2452,14 @@  discard block
 block discarded – undo
2452 2452
 	) );
2453 2453
 }
2454 2454
 /**
2455
- * Retrieve list of allowed mime types and file extensions.
2456
- *
2457
- * @since 2.8.6
2458
- *
2459
- * @param int|WP_User $user Optional. User to check. Defaults to current user.
2460
- * @return array Array of mime types keyed by the file extension regex corresponding
2461
- *               to those types.
2462
- */
2455
+	 * Retrieve list of allowed mime types and file extensions.
2456
+	 *
2457
+	 * @since 2.8.6
2458
+	 *
2459
+	 * @param int|WP_User $user Optional. User to check. Defaults to current user.
2460
+	 * @return array Array of mime types keyed by the file extension regex corresponding
2461
+	 *               to those types.
2462
+	 */
2463 2463
 function get_allowed_mime_types( $user = null ) {
2464 2464
 	$t = wp_get_mime_types();
2465 2465
 
@@ -3208,7 +3208,7 @@  discard block
 block discarded – undo
3208 3208
 		  ':arrow:' => "\xe2\x9e\xa1",
3209 3209
 		  ':shock:' => "\xf0\x9f\x98\xaf",
3210 3210
 		  ':smile:' => "\xf0\x9f\x99\x82",
3211
-		    ':???:' => "\xf0\x9f\x98\x95",
3211
+			':???:' => "\xf0\x9f\x98\x95",
3212 3212
 		   ':cool:' => "\xf0\x9f\x98\x8e",
3213 3213
 		   ':evil:' => "\xf0\x9f\x91\xbf",
3214 3214
 		   ':grin:' => "\xf0\x9f\x98\x80",
@@ -3217,36 +3217,36 @@  discard block
 block discarded – undo
3217 3217
 		   ':razz:' => "\xf0\x9f\x98\x9b",
3218 3218
 		   ':roll:' => 'rolleyes.png',
3219 3219
 		   ':wink:' => "\xf0\x9f\x98\x89",
3220
-		    ':cry:' => "\xf0\x9f\x98\xa5",
3221
-		    ':eek:' => "\xf0\x9f\x98\xae",
3222
-		    ':lol:' => "\xf0\x9f\x98\x86",
3223
-		    ':mad:' => "\xf0\x9f\x98\xa1",
3224
-		    ':sad:' => "\xf0\x9f\x99\x81",
3225
-		      '8-)' => "\xf0\x9f\x98\x8e",
3226
-		      '8-O' => "\xf0\x9f\x98\xaf",
3227
-		      ':-(' => "\xf0\x9f\x99\x81",
3228
-		      ':-)' => "\xf0\x9f\x99\x82",
3229
-		      ':-?' => "\xf0\x9f\x98\x95",
3230
-		      ':-D' => "\xf0\x9f\x98\x80",
3231
-		      ':-P' => "\xf0\x9f\x98\x9b",
3232
-		      ':-o' => "\xf0\x9f\x98\xae",
3233
-		      ':-x' => "\xf0\x9f\x98\xa1",
3234
-		      ':-|' => "\xf0\x9f\x98\x90",
3235
-		      ';-)' => "\xf0\x9f\x98\x89",
3220
+			':cry:' => "\xf0\x9f\x98\xa5",
3221
+			':eek:' => "\xf0\x9f\x98\xae",
3222
+			':lol:' => "\xf0\x9f\x98\x86",
3223
+			':mad:' => "\xf0\x9f\x98\xa1",
3224
+			':sad:' => "\xf0\x9f\x99\x81",
3225
+			  '8-)' => "\xf0\x9f\x98\x8e",
3226
+			  '8-O' => "\xf0\x9f\x98\xaf",
3227
+			  ':-(' => "\xf0\x9f\x99\x81",
3228
+			  ':-)' => "\xf0\x9f\x99\x82",
3229
+			  ':-?' => "\xf0\x9f\x98\x95",
3230
+			  ':-D' => "\xf0\x9f\x98\x80",
3231
+			  ':-P' => "\xf0\x9f\x98\x9b",
3232
+			  ':-o' => "\xf0\x9f\x98\xae",
3233
+			  ':-x' => "\xf0\x9f\x98\xa1",
3234
+			  ':-|' => "\xf0\x9f\x98\x90",
3235
+			  ';-)' => "\xf0\x9f\x98\x89",
3236 3236
 		// This one transformation breaks regular text with frequency.
3237 3237
 		//     '8)' => "\xf0\x9f\x98\x8e",
3238
-		       '8O' => "\xf0\x9f\x98\xaf",
3239
-		       ':(' => "\xf0\x9f\x99\x81",
3240
-		       ':)' => "\xf0\x9f\x99\x82",
3241
-		       ':?' => "\xf0\x9f\x98\x95",
3242
-		       ':D' => "\xf0\x9f\x98\x80",
3243
-		       ':P' => "\xf0\x9f\x98\x9b",
3244
-		       ':o' => "\xf0\x9f\x98\xae",
3245
-		       ':x' => "\xf0\x9f\x98\xa1",
3246
-		       ':|' => "\xf0\x9f\x98\x90",
3247
-		       ';)' => "\xf0\x9f\x98\x89",
3248
-		      ':!:' => "\xe2\x9d\x97",
3249
-		      ':?:' => "\xe2\x9d\x93",
3238
+			   '8O' => "\xf0\x9f\x98\xaf",
3239
+			   ':(' => "\xf0\x9f\x99\x81",
3240
+			   ':)' => "\xf0\x9f\x99\x82",
3241
+			   ':?' => "\xf0\x9f\x98\x95",
3242
+			   ':D' => "\xf0\x9f\x98\x80",
3243
+			   ':P' => "\xf0\x9f\x98\x9b",
3244
+			   ':o' => "\xf0\x9f\x98\xae",
3245
+			   ':x' => "\xf0\x9f\x98\xa1",
3246
+			   ':|' => "\xf0\x9f\x98\x90",
3247
+			   ';)' => "\xf0\x9f\x98\x89",
3248
+			  ':!:' => "\xe2\x9d\x97",
3249
+			  ':?:' => "\xe2\x9d\x93",
3250 3250
 		);
3251 3251
 	}
3252 3252
 
@@ -3795,31 +3795,31 @@  discard block
 block discarded – undo
3795 3795
 	}
3796 3796
 }
3797 3797
 /**
3798
- * Mark a function argument as deprecated and inform when it has been used.
3799
- *
3800
- * This function is to be used whenever a deprecated function argument is used.
3801
- * Before this function is called, the argument must be checked for whether it was
3802
- * used by comparing it to its default value or evaluating whether it is empty.
3803
- * For example:
3804
- *
3805
- *     if ( ! empty( $deprecated ) ) {
3806
- *         _deprecated_argument( __FUNCTION__, '3.0' );
3807
- *     }
3808
- *
3809
- *
3810
- * There is a hook deprecated_argument_run that will be called that can be used
3811
- * to get the backtrace up to what file and function used the deprecated
3812
- * argument.
3813
- *
3814
- * The current behavior is to trigger a user error if WP_DEBUG is true.
3815
- *
3816
- * @since 3.0.0
3817
- * @access private
3818
- *
3819
- * @param string $function The function that was called.
3820
- * @param string $version  The version of WordPress that deprecated the argument used.
3821
- * @param string $message  Optional. A message regarding the change. Default null.
3822
- */
3798
+	 * Mark a function argument as deprecated and inform when it has been used.
3799
+	 *
3800
+	 * This function is to be used whenever a deprecated function argument is used.
3801
+	 * Before this function is called, the argument must be checked for whether it was
3802
+	 * used by comparing it to its default value or evaluating whether it is empty.
3803
+	 * For example:
3804
+	 *
3805
+	 *     if ( ! empty( $deprecated ) ) {
3806
+	 *         _deprecated_argument( __FUNCTION__, '3.0' );
3807
+	 *     }
3808
+	 *
3809
+	 *
3810
+	 * There is a hook deprecated_argument_run that will be called that can be used
3811
+	 * to get the backtrace up to what file and function used the deprecated
3812
+	 * argument.
3813
+	 *
3814
+	 * The current behavior is to trigger a user error if WP_DEBUG is true.
3815
+	 *
3816
+	 * @since 3.0.0
3817
+	 * @access private
3818
+	 *
3819
+	 * @param string $function The function that was called.
3820
+	 * @param string $version  The version of WordPress that deprecated the argument used.
3821
+	 * @param string $message  Optional. A message regarding the change. Default null.
3822
+	 */
3823 3823
 function _deprecated_argument( $function, $version, $message = null ) {
3824 3824
 
3825 3825
 	/**
Please login to merge, or discard this patch.
Spacing   +1005 added lines, -1005 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@  discard block
 block discarded – undo
5 5
  * @package WordPress
6 6
  */
7 7
 
8
-require( ABSPATH . WPINC . '/option.php' );
8
+require(ABSPATH.WPINC.'/option.php');
9 9
 
10 10
 /**
11 11
  * Convert given date string into a different format.
@@ -23,22 +23,22 @@  discard block
 block discarded – undo
23 23
  * @param bool   $translate Whether the return date should be translated. Default true.
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26
-function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
26
+function mysql2date($format, $date, $translate = true) {
27
+	if (empty($date))
28 28
 		return false;
29 29
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
30
+	if ('G' == $format)
31
+		return strtotime($date.' +0000');
32 32
 
33
-	$i = strtotime( $date );
33
+	$i = strtotime($date);
34 34
 
35
-	if ( 'U' == $format )
35
+	if ('U' == $format)
36 36
 		return $i;
37 37
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
38
+	if ($translate)
39
+		return date_i18n($format, $i);
40 40
 	else
41
-		return date( $format, $i );
41
+		return date($format, $i);
42 42
 }
43 43
 
44 44
 /**
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
  * @param int|bool $gmt  Optional. Whether to use GMT timezone. Default false.
59 59
  * @return int|string Integer if $type is 'timestamp', string otherwise.
60 60
  */
61
-function current_time( $type, $gmt = 0 ) {
62
-	switch ( $type ) {
61
+function current_time($type, $gmt = 0) {
62
+	switch ($type) {
63 63
 		case 'mysql':
64
-			return ( $gmt ) ? gmdate( 'Y-m-d H:i:s' ) : gmdate( 'Y-m-d H:i:s', ( time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) ) );
64
+			return ($gmt) ? gmdate('Y-m-d H:i:s') : gmdate('Y-m-d H:i:s', (time() + (get_option('gmt_offset') * HOUR_IN_SECONDS)));
65 65
 		case 'timestamp':
66
-			return ( $gmt ) ? time() : time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS );
66
+			return ($gmt) ? time() : time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
67 67
 		default:
68
-			return ( $gmt ) ? date( $type ) : date( $type, time() + ( get_option( 'gmt_offset' ) * HOUR_IN_SECONDS ) );
68
+			return ($gmt) ? date($type) : date($type, time() + (get_option('gmt_offset') * HOUR_IN_SECONDS));
69 69
 	}
70 70
 }
71 71
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
  *
87 87
  * @return string The date, translated if locale specifies it.
88 88
  */
89
-function date_i18n( $dateformatstring, $unixtimestamp = false, $gmt = false ) {
89
+function date_i18n($dateformatstring, $unixtimestamp = false, $gmt = false) {
90 90
 	global $wp_locale;
91 91
 	$i = $unixtimestamp;
92 92
 
93
-	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
93
+	if (false === $i) {
94
+		if ( ! $gmt)
95
+			$i = current_time('timestamp');
96 96
 		else
97 97
 			$i = time();
98 98
 		// we should not let date() interfere with our
@@ -106,43 +106,43 @@  discard block
 block discarded – undo
106 106
 	 */
107 107
 	$req_format = $dateformatstring;
108 108
 
109
-	$datefunc = $gmt? 'gmdate' : 'date';
109
+	$datefunc = $gmt ? 'gmdate' : 'date';
110 110
 
111
-	if ( ( !empty( $wp_locale->month ) ) && ( !empty( $wp_locale->weekday ) ) ) {
112
-		$datemonth = $wp_locale->get_month( $datefunc( 'm', $i ) );
113
-		$datemonth_abbrev = $wp_locale->get_month_abbrev( $datemonth );
114
-		$dateweekday = $wp_locale->get_weekday( $datefunc( 'w', $i ) );
115
-		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev( $dateweekday );
116
-		$datemeridiem = $wp_locale->get_meridiem( $datefunc( 'a', $i ) );
117
-		$datemeridiem_capital = $wp_locale->get_meridiem( $datefunc( 'A', $i ) );
111
+	if (( ! empty($wp_locale->month)) && ( ! empty($wp_locale->weekday))) {
112
+		$datemonth = $wp_locale->get_month($datefunc('m', $i));
113
+		$datemonth_abbrev = $wp_locale->get_month_abbrev($datemonth);
114
+		$dateweekday = $wp_locale->get_weekday($datefunc('w', $i));
115
+		$dateweekday_abbrev = $wp_locale->get_weekday_abbrev($dateweekday);
116
+		$datemeridiem = $wp_locale->get_meridiem($datefunc('a', $i));
117
+		$datemeridiem_capital = $wp_locale->get_meridiem($datefunc('A', $i));
118 118
 		$dateformatstring = ' '.$dateformatstring;
119
-		$dateformatstring = preg_replace( "/([^\\\])D/", "\\1" . backslashit( $dateweekday_abbrev ), $dateformatstring );
120
-		$dateformatstring = preg_replace( "/([^\\\])F/", "\\1" . backslashit( $datemonth ), $dateformatstring );
121
-		$dateformatstring = preg_replace( "/([^\\\])l/", "\\1" . backslashit( $dateweekday ), $dateformatstring );
122
-		$dateformatstring = preg_replace( "/([^\\\])M/", "\\1" . backslashit( $datemonth_abbrev ), $dateformatstring );
123
-		$dateformatstring = preg_replace( "/([^\\\])a/", "\\1" . backslashit( $datemeridiem ), $dateformatstring );
124
-		$dateformatstring = preg_replace( "/([^\\\])A/", "\\1" . backslashit( $datemeridiem_capital ), $dateformatstring );
125
-
126
-		$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
127
-	}
128
-	$timezone_formats = array( 'P', 'I', 'O', 'T', 'Z', 'e' );
129
-	$timezone_formats_re = implode( '|', $timezone_formats );
130
-	if ( preg_match( "/$timezone_formats_re/", $dateformatstring ) ) {
131
-		$timezone_string = get_option( 'timezone_string' );
132
-		if ( $timezone_string ) {
133
-			$timezone_object = timezone_open( $timezone_string );
134
-			$date_object = date_create( null, $timezone_object );
135
-			foreach ( $timezone_formats as $timezone_format ) {
136
-				if ( false !== strpos( $dateformatstring, $timezone_format ) ) {
137
-					$formatted = date_format( $date_object, $timezone_format );
119
+		$dateformatstring = preg_replace("/([^\\\])D/", "\\1".backslashit($dateweekday_abbrev), $dateformatstring);
120
+		$dateformatstring = preg_replace("/([^\\\])F/", "\\1".backslashit($datemonth), $dateformatstring);
121
+		$dateformatstring = preg_replace("/([^\\\])l/", "\\1".backslashit($dateweekday), $dateformatstring);
122
+		$dateformatstring = preg_replace("/([^\\\])M/", "\\1".backslashit($datemonth_abbrev), $dateformatstring);
123
+		$dateformatstring = preg_replace("/([^\\\])a/", "\\1".backslashit($datemeridiem), $dateformatstring);
124
+		$dateformatstring = preg_replace("/([^\\\])A/", "\\1".backslashit($datemeridiem_capital), $dateformatstring);
125
+
126
+		$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
127
+	}
128
+	$timezone_formats = array('P', 'I', 'O', 'T', 'Z', 'e');
129
+	$timezone_formats_re = implode('|', $timezone_formats);
130
+	if (preg_match("/$timezone_formats_re/", $dateformatstring)) {
131
+		$timezone_string = get_option('timezone_string');
132
+		if ($timezone_string) {
133
+			$timezone_object = timezone_open($timezone_string);
134
+			$date_object = date_create(null, $timezone_object);
135
+			foreach ($timezone_formats as $timezone_format) {
136
+				if (false !== strpos($dateformatstring, $timezone_format)) {
137
+					$formatted = date_format($date_object, $timezone_format);
138 138
 					$dateformatstring = ' '.$dateformatstring;
139
-					$dateformatstring = preg_replace( "/([^\\\])$timezone_format/", "\\1" . backslashit( $formatted ), $dateformatstring );
140
-					$dateformatstring = substr( $dateformatstring, 1, strlen( $dateformatstring ) -1 );
139
+					$dateformatstring = preg_replace("/([^\\\])$timezone_format/", "\\1".backslashit($formatted), $dateformatstring);
140
+					$dateformatstring = substr($dateformatstring, 1, strlen($dateformatstring) - 1);
141 141
 				}
142 142
 			}
143 143
 		}
144 144
 	}
145
-	$j = @$datefunc( $dateformatstring, $i );
145
+	$j = @$datefunc($dateformatstring, $i);
146 146
 
147 147
 	/**
148 148
 	 * Filter the date formatted based on the locale.
@@ -154,7 +154,7 @@  discard block
 block discarded – undo
154 154
 	 * @param int    $i          Unix timestamp.
155 155
 	 * @param bool   $gmt        Whether to convert to GMT for time. Default false.
156 156
 	 */
157
-	$j = apply_filters( 'date_i18n', $j, $req_format, $i, $gmt );
157
+	$j = apply_filters('date_i18n', $j, $req_format, $i, $gmt);
158 158
 	return $j;
159 159
 }
160 160
 
@@ -169,36 +169,36 @@  discard block
 block discarded – undo
169 169
  * @param string $date Formatted date string.
170 170
  * @return string The date, declined if locale specifies it.
171 171
  */
172
-function wp_maybe_decline_date( $date ) {
172
+function wp_maybe_decline_date($date) {
173 173
 	global $wp_locale;
174 174
 
175 175
 	// i18n functions are not available in SHORTINIT mode
176
-	if ( ! function_exists( '_x' ) ) {
176
+	if ( ! function_exists('_x')) {
177 177
 		return $date;
178 178
 	}
179 179
 
180 180
 	/* translators: If months in your language require a genitive case,
181 181
 	 * translate this to 'on'. Do not translate into your own language.
182 182
 	 */
183
-	if ( 'on' === _x( 'off', 'decline months names: on or off' ) ) {
183
+	if ('on' === _x('off', 'decline months names: on or off')) {
184 184
 		// Match a format like 'j F Y' or 'j. F'
185
-		if ( @preg_match( '#^\d{1,2}\.? \w+#u', $date ) ) {
185
+		if (@preg_match('#^\d{1,2}\.? \w+#u', $date)) {
186 186
 			$months = $wp_locale->month;
187 187
 
188
-			foreach ( $months as $key => $month ) {
189
-				$months[ $key ] = '#' . $month . '#';
188
+			foreach ($months as $key => $month) {
189
+				$months[$key] = '#'.$month.'#';
190 190
 			}
191 191
 
192
-			$date = preg_replace( $months, $wp_locale->month_genitive, $date );
192
+			$date = preg_replace($months, $wp_locale->month_genitive, $date);
193 193
 		}
194 194
 	}
195 195
 
196 196
 	// Used for locale-specific rules
197 197
 	$locale = get_locale();
198 198
 
199
-	if ( 'ca' === $locale ) {
199
+	if ('ca' === $locale) {
200 200
 		// " de abril| de agost| de octubre..." -> " d'abril| d'agost| d'octubre..."
201
-		$date = preg_replace( '# de ([ao])#i', " d'\\1", $date );
201
+		$date = preg_replace('# de ([ao])#i', " d'\\1", $date);
202 202
 	}
203 203
 
204 204
 	return $date;
@@ -215,13 +215,13 @@  discard block
 block discarded – undo
215 215
  * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
216 216
  * @return string Converted number in string format.
217 217
  */
218
-function number_format_i18n( $number, $decimals = 0 ) {
218
+function number_format_i18n($number, $decimals = 0) {
219 219
 	global $wp_locale;
220 220
 
221
-	if ( isset( $wp_locale ) ) {
222
-		$formatted = number_format( $number, absint( $decimals ), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep'] );
221
+	if (isset($wp_locale)) {
222
+		$formatted = number_format($number, absint($decimals), $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']);
223 223
 	} else {
224
-		$formatted = number_format( $number, absint( $decimals ) );
224
+		$formatted = number_format($number, absint($decimals));
225 225
 	}
226 226
 
227 227
 	/**
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
 	 *
232 232
 	 * @param string $formatted Converted number in string format.
233 233
 	 */
234
-	return apply_filters( 'number_format_i18n', $formatted );
234
+	return apply_filters('number_format_i18n', $formatted);
235 235
 }
236 236
 
237 237
 /**
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
  * @param int        $decimals Optional. Precision of number of decimal places. Default 0.
255 255
  * @return string|false False on failure. Number string on success.
256 256
  */
257
-function size_format( $bytes, $decimals = 0 ) {
257
+function size_format($bytes, $decimals = 0) {
258 258
 	$quant = array(
259 259
 		'TB' => TB_IN_BYTES,
260 260
 		'GB' => GB_IN_BYTES,
@@ -263,9 +263,9 @@  discard block
 block discarded – undo
263 263
 		'B'  => 1,
264 264
 	);
265 265
 
266
-	foreach ( $quant as $unit => $mag ) {
267
-		if ( doubleval( $bytes ) >= $mag ) {
268
-			return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
266
+	foreach ($quant as $unit => $mag) {
267
+		if (doubleval($bytes) >= $mag) {
268
+			return number_format_i18n($bytes / $mag, $decimals).' '.$unit;
269 269
 		}
270 270
 	}
271 271
 
@@ -281,34 +281,34 @@  discard block
 block discarded – undo
281 281
  * @param int|string $start_of_week Optional. Start of the week as an integer. Default empty string.
282 282
  * @return array Keys are 'start' and 'end'.
283 283
  */
284
-function get_weekstartend( $mysqlstring, $start_of_week = '' ) {
284
+function get_weekstartend($mysqlstring, $start_of_week = '') {
285 285
 	// MySQL string year.
286
-	$my = substr( $mysqlstring, 0, 4 );
286
+	$my = substr($mysqlstring, 0, 4);
287 287
 
288 288
 	// MySQL string month.
289
-	$mm = substr( $mysqlstring, 8, 2 );
289
+	$mm = substr($mysqlstring, 8, 2);
290 290
 
291 291
 	// MySQL string day.
292
-	$md = substr( $mysqlstring, 5, 2 );
292
+	$md = substr($mysqlstring, 5, 2);
293 293
 
294 294
 	// The timestamp for MySQL string day.
295
-	$day = mktime( 0, 0, 0, $md, $mm, $my );
295
+	$day = mktime(0, 0, 0, $md, $mm, $my);
296 296
 
297 297
 	// The day of the week from the timestamp.
298
-	$weekday = date( 'w', $day );
298
+	$weekday = date('w', $day);
299 299
 
300
-	if ( !is_numeric($start_of_week) )
301
-		$start_of_week = get_option( 'start_of_week' );
300
+	if ( ! is_numeric($start_of_week))
301
+		$start_of_week = get_option('start_of_week');
302 302
 
303
-	if ( $weekday < $start_of_week )
303
+	if ($weekday < $start_of_week)
304 304
 		$weekday += 7;
305 305
 
306 306
 	// The most recent week start day on or before $day.
307
-	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
307
+	$start = $day - DAY_IN_SECONDS * ($weekday - $start_of_week);
308 308
 
309 309
 	// $start + 1 week - 1 second.
310 310
 	$end = $start + WEEK_IN_SECONDS - 1;
311
-	return compact( 'start', 'end' );
311
+	return compact('start', 'end');
312 312
 }
313 313
 
314 314
 /**
@@ -319,9 +319,9 @@  discard block
 block discarded – undo
319 319
  * @param string $original Maybe unserialized original, if is needed.
320 320
  * @return mixed Unserialized data can be any type.
321 321
  */
322
-function maybe_unserialize( $original ) {
323
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
324
-		return @unserialize( $original );
322
+function maybe_unserialize($original) {
323
+	if (is_serialized($original)) // don't attempt to unserialize data that wasn't serialized going in
324
+		return @unserialize($original);
325 325
 	return $original;
326 326
 }
327 327
 
@@ -337,57 +337,57 @@  discard block
 block discarded – undo
337 337
  * @param bool   $strict Optional. Whether to be strict about the end of the string. Default true.
338 338
  * @return bool False if not serialized and true if it was.
339 339
  */
340
-function is_serialized( $data, $strict = true ) {
340
+function is_serialized($data, $strict = true) {
341 341
 	// if it isn't a string, it isn't serialized.
342
-	if ( ! is_string( $data ) ) {
342
+	if ( ! is_string($data)) {
343 343
 		return false;
344 344
 	}
345
-	$data = trim( $data );
346
- 	if ( 'N;' == $data ) {
345
+	$data = trim($data);
346
+ 	if ('N;' == $data) {
347 347
 		return true;
348 348
 	}
349
-	if ( strlen( $data ) < 4 ) {
349
+	if (strlen($data) < 4) {
350 350
 		return false;
351 351
 	}
352
-	if ( ':' !== $data[1] ) {
352
+	if (':' !== $data[1]) {
353 353
 		return false;
354 354
 	}
355
-	if ( $strict ) {
356
-		$lastc = substr( $data, -1 );
357
-		if ( ';' !== $lastc && '}' !== $lastc ) {
355
+	if ($strict) {
356
+		$lastc = substr($data, -1);
357
+		if (';' !== $lastc && '}' !== $lastc) {
358 358
 			return false;
359 359
 		}
360 360
 	} else {
361
-		$semicolon = strpos( $data, ';' );
362
-		$brace     = strpos( $data, '}' );
361
+		$semicolon = strpos($data, ';');
362
+		$brace     = strpos($data, '}');
363 363
 		// Either ; or } must exist.
364
-		if ( false === $semicolon && false === $brace )
364
+		if (false === $semicolon && false === $brace)
365 365
 			return false;
366 366
 		// But neither must be in the first X characters.
367
-		if ( false !== $semicolon && $semicolon < 3 )
367
+		if (false !== $semicolon && $semicolon < 3)
368 368
 			return false;
369
-		if ( false !== $brace && $brace < 4 )
369
+		if (false !== $brace && $brace < 4)
370 370
 			return false;
371 371
 	}
372 372
 	$token = $data[0];
373
-	switch ( $token ) {
373
+	switch ($token) {
374 374
 		case 's' :
375
-			if ( $strict ) {
376
-				if ( '"' !== substr( $data, -2, 1 ) ) {
375
+			if ($strict) {
376
+				if ('"' !== substr($data, -2, 1)) {
377 377
 					return false;
378 378
 				}
379
-			} elseif ( false === strpos( $data, '"' ) ) {
379
+			} elseif (false === strpos($data, '"')) {
380 380
 				return false;
381 381
 			}
382 382
 			// or else fall through
383 383
 		case 'a' :
384 384
 		case 'O' :
385
-			return (bool) preg_match( "/^{$token}:[0-9]+:/s", $data );
385
+			return (bool) preg_match("/^{$token}:[0-9]+:/s", $data);
386 386
 		case 'b' :
387 387
 		case 'i' :
388 388
 		case 'd' :
389 389
 			$end = $strict ? '$' : '';
390
-			return (bool) preg_match( "/^{$token}:[0-9.E-]+;$end/", $data );
390
+			return (bool) preg_match("/^{$token}:[0-9.E-]+;$end/", $data);
391 391
 	}
392 392
 	return false;
393 393
 }
@@ -400,21 +400,21 @@  discard block
 block discarded – undo
400 400
  * @param string $data Serialized data.
401 401
  * @return bool False if not a serialized string, true if it is.
402 402
  */
403
-function is_serialized_string( $data ) {
403
+function is_serialized_string($data) {
404 404
 	// if it isn't a string, it isn't a serialized string.
405
-	if ( ! is_string( $data ) ) {
405
+	if ( ! is_string($data)) {
406 406
 		return false;
407 407
 	}
408
-	$data = trim( $data );
409
-	if ( strlen( $data ) < 4 ) {
408
+	$data = trim($data);
409
+	if (strlen($data) < 4) {
410 410
 		return false;
411
-	} elseif ( ':' !== $data[1] ) {
411
+	} elseif (':' !== $data[1]) {
412 412
 		return false;
413
-	} elseif ( ';' !== substr( $data, -1 ) ) {
413
+	} elseif (';' !== substr($data, -1)) {
414 414
 		return false;
415
-	} elseif ( $data[0] !== 's' ) {
415
+	} elseif ($data[0] !== 's') {
416 416
 		return false;
417
-	} elseif ( '"' !== substr( $data, -2, 1 ) ) {
417
+	} elseif ('"' !== substr($data, -2, 1)) {
418 418
 		return false;
419 419
 	} else {
420 420
 		return true;
@@ -429,15 +429,15 @@  discard block
 block discarded – undo
429 429
  * @param string|array|object $data Data that might be serialized.
430 430
  * @return mixed A scalar data
431 431
  */
432
-function maybe_serialize( $data ) {
433
-	if ( is_array( $data ) || is_object( $data ) )
434
-		return serialize( $data );
432
+function maybe_serialize($data) {
433
+	if (is_array($data) || is_object($data))
434
+		return serialize($data);
435 435
 
436 436
 	// Double serialization is required for backward compatibility.
437 437
 	// See https://core.trac.wordpress.org/ticket/12930
438 438
 	// Also the world will end. See WP 3.6.1.
439
-	if ( is_serialized( $data, false ) )
440
-		return serialize( $data );
439
+	if (is_serialized($data, false))
440
+		return serialize($data);
441 441
 
442 442
 	return $data;
443 443
 }
@@ -455,9 +455,9 @@  discard block
 block discarded – undo
455 455
  * @param string $content XMLRPC XML Request content
456 456
  * @return string Post title
457 457
  */
458
-function xmlrpc_getposttitle( $content ) {
458
+function xmlrpc_getposttitle($content) {
459 459
 	global $post_default_title;
460
-	if ( preg_match( '/<title>(.+?)<\/title>/is', $content, $matchtitle ) ) {
460
+	if (preg_match('/<title>(.+?)<\/title>/is', $content, $matchtitle)) {
461 461
 		$post_title = $matchtitle[1];
462 462
 	} else {
463 463
 		$post_title = $post_default_title;
@@ -479,11 +479,11 @@  discard block
 block discarded – undo
479 479
  * @param string $content XMLRPC XML Request content
480 480
  * @return string|array List of categories or category name.
481 481
  */
482
-function xmlrpc_getpostcategory( $content ) {
482
+function xmlrpc_getpostcategory($content) {
483 483
 	global $post_default_category;
484
-	if ( preg_match( '/<category>(.+?)<\/category>/is', $content, $matchcat ) ) {
485
-		$post_category = trim( $matchcat[1], ',' );
486
-		$post_category = explode( ',', $post_category );
484
+	if (preg_match('/<category>(.+?)<\/category>/is', $content, $matchcat)) {
485
+		$post_category = trim($matchcat[1], ',');
486
+		$post_category = explode(',', $post_category);
487 487
 	} else {
488 488
 		$post_category = $post_default_category;
489 489
 	}
@@ -498,10 +498,10 @@  discard block
 block discarded – undo
498 498
  * @param string $content XML-RPC XML Request content.
499 499
  * @return string XMLRPC XML Request content without title and category elements.
500 500
  */
501
-function xmlrpc_removepostdata( $content ) {
502
-	$content = preg_replace( '/<title>(.+?)<\/title>/si', '', $content );
503
-	$content = preg_replace( '/<category>(.+?)<\/category>/si', '', $content );
504
-	$content = trim( $content );
501
+function xmlrpc_removepostdata($content) {
502
+	$content = preg_replace('/<title>(.+?)<\/title>/si', '', $content);
503
+	$content = preg_replace('/<category>(.+?)<\/category>/si', '', $content);
504
+	$content = trim($content);
505 505
 	return $content;
506 506
 }
507 507
 
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
  * @param string $content Content to extract URLs from.
514 514
  * @return array URLs found in passed string.
515 515
  */
516
-function wp_extract_urls( $content ) {
516
+function wp_extract_urls($content) {
517 517
 	preg_match_all(
518 518
 		"#([\"']?)("
519 519
 			. "(?:([\w-]+:)?//?)"
@@ -531,9 +531,9 @@  discard block
 block discarded – undo
531 531
 		$post_links
532 532
 	);
533 533
 
534
-	$post_links = array_unique( array_map( 'html_entity_decode', $post_links[2] ) );
534
+	$post_links = array_unique(array_map('html_entity_decode', $post_links[2]));
535 535
 
536
-	return array_values( $post_links );
536
+	return array_values($post_links);
537 537
 }
538 538
 
539 539
 /**
@@ -550,34 +550,34 @@  discard block
 block discarded – undo
550 550
  * @param string $content Post Content.
551 551
  * @param int    $post_ID Post ID.
552 552
  */
553
-function do_enclose( $content, $post_ID ) {
553
+function do_enclose($content, $post_ID) {
554 554
 	global $wpdb;
555 555
 
556 556
 	//TODO: Tidy this ghetto code up and make the debug code optional
557
-	include_once( ABSPATH . WPINC . '/class-IXR.php' );
557
+	include_once(ABSPATH.WPINC.'/class-IXR.php');
558 558
 
559 559
 	$post_links = array();
560 560
 
561
-	$pung = get_enclosed( $post_ID );
561
+	$pung = get_enclosed($post_ID);
562 562
 
563
-	$post_links_temp = wp_extract_urls( $content );
563
+	$post_links_temp = wp_extract_urls($content);
564 564
 
565
-	foreach ( $pung as $link_test ) {
566
-		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
567
-			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
568
-			foreach ( $mids as $mid )
569
-				delete_metadata_by_mid( 'post', $mid );
565
+	foreach ($pung as $link_test) {
566
+		if ( ! in_array($link_test, $post_links_temp)) { // link no longer in post
567
+			$mids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($link_test).'%'));
568
+			foreach ($mids as $mid)
569
+				delete_metadata_by_mid('post', $mid);
570 570
 		}
571 571
 	}
572 572
 
573
-	foreach ( (array) $post_links_temp as $link_test ) {
574
-		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
575
-			$test = @parse_url( $link_test );
576
-			if ( false === $test )
573
+	foreach ((array) $post_links_temp as $link_test) {
574
+		if ( ! in_array($link_test, $pung)) { // If we haven't pung it already
575
+			$test = @parse_url($link_test);
576
+			if (false === $test)
577 577
 				continue;
578
-			if ( isset( $test['query'] ) )
578
+			if (isset($test['query']))
579 579
 				$post_links[] = $link_test;
580
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
580
+			elseif (isset($test['path']) && ($test['path'] != '/') && ($test['path'] != ''))
581 581
 				$post_links[] = $link_test;
582 582
 		}
583 583
 	}
@@ -593,24 +593,24 @@  discard block
 block discarded – undo
593 593
 	 * @param array $post_links An array of enclosure links.
594 594
 	 * @param int   $post_ID    Post ID.
595 595
 	 */
596
-	$post_links = apply_filters( 'enclosure_links', $post_links, $post_ID );
596
+	$post_links = apply_filters('enclosure_links', $post_links, $post_ID);
597 597
 
598
-	foreach ( (array) $post_links as $url ) {
599
-		if ( $url != '' && !$wpdb->get_var( $wpdb->prepare( "SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $url ) . '%' ) ) ) {
598
+	foreach ((array) $post_links as $url) {
599
+		if ($url != '' && ! $wpdb->get_var($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like($url).'%'))) {
600 600
 
601
-			if ( $headers = wp_get_http_headers( $url) ) {
602
-				$len = isset( $headers['content-length'] ) ? (int) $headers['content-length'] : 0;
603
-				$type = isset( $headers['content-type'] ) ? $headers['content-type'] : '';
604
-				$allowed_types = array( 'video', 'audio' );
601
+			if ($headers = wp_get_http_headers($url)) {
602
+				$len = isset($headers['content-length']) ? (int) $headers['content-length'] : 0;
603
+				$type = isset($headers['content-type']) ? $headers['content-type'] : '';
604
+				$allowed_types = array('video', 'audio');
605 605
 
606 606
 				// Check to see if we can figure out the mime type from
607 607
 				// the extension
608
-				$url_parts = @parse_url( $url );
609
-				if ( false !== $url_parts ) {
610
-					$extension = pathinfo( $url_parts['path'], PATHINFO_EXTENSION );
611
-					if ( !empty( $extension ) ) {
612
-						foreach ( wp_get_mime_types() as $exts => $mime ) {
613
-							if ( preg_match( '!^(' . $exts . ')$!i', $extension ) ) {
608
+				$url_parts = @parse_url($url);
609
+				if (false !== $url_parts) {
610
+					$extension = pathinfo($url_parts['path'], PATHINFO_EXTENSION);
611
+					if ( ! empty($extension)) {
612
+						foreach (wp_get_mime_types() as $exts => $mime) {
613
+							if (preg_match('!^('.$exts.')$!i', $extension)) {
614 614
 								$type = $mime;
615 615
 								break;
616 616
 							}
@@ -618,8 +618,8 @@  discard block
 block discarded – undo
618 618
 					}
619 619
 				}
620 620
 
621
-				if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) {
622
-					add_post_meta( $post_ID, 'enclosure', "$url\n$len\n$mime\n" );
621
+				if (in_array(substr($type, 0, strpos($type, "/")), $allowed_types)) {
622
+					add_post_meta($post_ID, 'enclosure', "$url\n$len\n$mime\n");
623 623
 				}
624 624
 			}
625 625
 		}
@@ -635,16 +635,16 @@  discard block
 block discarded – undo
635 635
  * @param bool   $deprecated Not Used.
636 636
  * @return bool|string False on failure, headers on success.
637 637
  */
638
-function wp_get_http_headers( $url, $deprecated = false ) {
639
-	if ( !empty( $deprecated ) )
640
-		_deprecated_argument( __FUNCTION__, '2.7' );
638
+function wp_get_http_headers($url, $deprecated = false) {
639
+	if ( ! empty($deprecated))
640
+		_deprecated_argument(__FUNCTION__, '2.7');
641 641
 
642
-	$response = wp_safe_remote_head( $url );
642
+	$response = wp_safe_remote_head($url);
643 643
 
644
-	if ( is_wp_error( $response ) )
644
+	if (is_wp_error($response))
645 645
 		return false;
646 646
 
647
-	return wp_remote_retrieve_headers( $response );
647
+	return wp_remote_retrieve_headers($response);
648 648
 }
649 649
 
650 650
 /**
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
  */
661 661
 function is_new_day() {
662 662
 	global $currentday, $previousday;
663
-	if ( $currentday != $previousday )
663
+	if ($currentday != $previousday)
664 664
 		return 1;
665 665
 	else
666 666
 		return 0;
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
  * @param array $data URL-encode key/value pairs.
682 682
  * @return string URL-encoded string.
683 683
  */
684
-function build_query( $data ) {
685
-	return _http_build_query( $data, null, '&', '', false );
684
+function build_query($data) {
685
+	return _http_build_query($data, null, '&', '', false);
686 686
 }
687 687
 
688 688
 /**
@@ -703,30 +703,30 @@  discard block
 block discarded – undo
703 703
  *
704 704
  * @return string The query string.
705 705
  */
706
-function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urlencode = true ) {
706
+function _http_build_query($data, $prefix = null, $sep = null, $key = '', $urlencode = true) {
707 707
 	$ret = array();
708 708
 
709
-	foreach ( (array) $data as $k => $v ) {
710
-		if ( $urlencode)
709
+	foreach ((array) $data as $k => $v) {
710
+		if ($urlencode)
711 711
 			$k = urlencode($k);
712
-		if ( is_int($k) && $prefix != null )
712
+		if (is_int($k) && $prefix != null)
713 713
 			$k = $prefix.$k;
714
-		if ( !empty($key) )
715
-			$k = $key . '%5B' . $k . '%5D';
716
-		if ( $v === null )
714
+		if ( ! empty($key))
715
+			$k = $key.'%5B'.$k.'%5D';
716
+		if ($v === null)
717 717
 			continue;
718
-		elseif ( $v === false )
718
+		elseif ($v === false)
719 719
 			$v = '0';
720 720
 
721
-		if ( is_array($v) || is_object($v) )
722
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
723
-		elseif ( $urlencode )
721
+		if (is_array($v) || is_object($v))
722
+			array_push($ret, _http_build_query($v, '', $sep, $k, $urlencode));
723
+		elseif ($urlencode)
724 724
 			array_push($ret, $k.'='.urlencode($v));
725 725
 		else
726 726
 			array_push($ret, $k.'='.$v);
727 727
 	}
728 728
 
729
-	if ( null === $sep )
729
+	if (null === $sep)
730 730
 		$sep = ini_get('arg_separator.output');
731 731
 
732 732
 	return implode($sep, $ret);
@@ -769,64 +769,64 @@  discard block
 block discarded – undo
769 769
  */
770 770
 function add_query_arg() {
771 771
 	$args = func_get_args();
772
-	if ( is_array( $args[0] ) ) {
773
-		if ( count( $args ) < 2 || false === $args[1] )
772
+	if (is_array($args[0])) {
773
+		if (count($args) < 2 || false === $args[1])
774 774
 			$uri = $_SERVER['REQUEST_URI'];
775 775
 		else
776 776
 			$uri = $args[1];
777 777
 	} else {
778
-		if ( count( $args ) < 3 || false === $args[2] )
778
+		if (count($args) < 3 || false === $args[2])
779 779
 			$uri = $_SERVER['REQUEST_URI'];
780 780
 		else
781 781
 			$uri = $args[2];
782 782
 	}
783 783
 
784
-	if ( $frag = strstr( $uri, '#' ) )
785
-		$uri = substr( $uri, 0, -strlen( $frag ) );
784
+	if ($frag = strstr($uri, '#'))
785
+		$uri = substr($uri, 0, -strlen($frag));
786 786
 	else
787 787
 		$frag = '';
788 788
 
789
-	if ( 0 === stripos( $uri, 'http://' ) ) {
789
+	if (0 === stripos($uri, 'http://')) {
790 790
 		$protocol = 'http://';
791
-		$uri = substr( $uri, 7 );
792
-	} elseif ( 0 === stripos( $uri, 'https://' ) ) {
791
+		$uri = substr($uri, 7);
792
+	} elseif (0 === stripos($uri, 'https://')) {
793 793
 		$protocol = 'https://';
794
-		$uri = substr( $uri, 8 );
794
+		$uri = substr($uri, 8);
795 795
 	} else {
796 796
 		$protocol = '';
797 797
 	}
798 798
 
799
-	if ( strpos( $uri, '?' ) !== false ) {
800
-		list( $base, $query ) = explode( '?', $uri, 2 );
799
+	if (strpos($uri, '?') !== false) {
800
+		list($base, $query) = explode('?', $uri, 2);
801 801
 		$base .= '?';
802
-	} elseif ( $protocol || strpos( $uri, '=' ) === false ) {
803
-		$base = $uri . '?';
802
+	} elseif ($protocol || strpos($uri, '=') === false) {
803
+		$base = $uri.'?';
804 804
 		$query = '';
805 805
 	} else {
806 806
 		$base = '';
807 807
 		$query = $uri;
808 808
 	}
809 809
 
810
-	wp_parse_str( $query, $qs );
811
-	$qs = urlencode_deep( $qs ); // this re-URL-encodes things that were already in the query string
812
-	if ( is_array( $args[0] ) ) {
813
-		foreach ( $args[0] as $k => $v ) {
814
-			$qs[ $k ] = $v;
810
+	wp_parse_str($query, $qs);
811
+	$qs = urlencode_deep($qs); // this re-URL-encodes things that were already in the query string
812
+	if (is_array($args[0])) {
813
+		foreach ($args[0] as $k => $v) {
814
+			$qs[$k] = $v;
815 815
 		}
816 816
 	} else {
817
-		$qs[ $args[0] ] = $args[1];
817
+		$qs[$args[0]] = $args[1];
818 818
 	}
819 819
 
820
-	foreach ( $qs as $k => $v ) {
821
-		if ( $v === false )
822
-			unset( $qs[$k] );
820
+	foreach ($qs as $k => $v) {
821
+		if ($v === false)
822
+			unset($qs[$k]);
823 823
 	}
824 824
 
825
-	$ret = build_query( $qs );
826
-	$ret = trim( $ret, '?' );
827
-	$ret = preg_replace( '#=(&|$)#', '$1', $ret );
828
-	$ret = $protocol . $base . $ret . $frag;
829
-	$ret = rtrim( $ret, '?' );
825
+	$ret = build_query($qs);
826
+	$ret = trim($ret, '?');
827
+	$ret = preg_replace('#=(&|$)#', '$1', $ret);
828
+	$ret = $protocol.$base.$ret.$frag;
829
+	$ret = rtrim($ret, '?');
830 830
 	return $ret;
831 831
 }
832 832
 
@@ -839,13 +839,13 @@  discard block
 block discarded – undo
839 839
  * @param bool|string  $query Optional. When false uses the current URL. Default false.
840 840
  * @return string New URL query string.
841 841
  */
842
-function remove_query_arg( $key, $query = false ) {
843
-	if ( is_array( $key ) ) { // removing multiple keys
844
-		foreach ( $key as $k )
845
-			$query = add_query_arg( $k, false, $query );
842
+function remove_query_arg($key, $query = false) {
843
+	if (is_array($key)) { // removing multiple keys
844
+		foreach ($key as $k)
845
+			$query = add_query_arg($k, false, $query);
846 846
 		return $query;
847 847
 	}
848
-	return add_query_arg( $key, false, $query );
848
+	return add_query_arg($key, false, $query);
849 849
 }
850 850
 
851 851
 /**
@@ -887,7 +887,7 @@  discard block
 block discarded – undo
887 887
 	 *
888 888
 	 * @param array $removable_query_args An array of query variables to remove from a URL.
889 889
 	 */
890
-	return apply_filters( 'removable_query_args', $removable_query_args );
890
+	return apply_filters('removable_query_args', $removable_query_args);
891 891
 }
892 892
 
893 893
 /**
@@ -898,12 +898,12 @@  discard block
 block discarded – undo
898 898
  * @param array $array Array to walk while sanitizing contents.
899 899
  * @return array Sanitized $array.
900 900
  */
901
-function add_magic_quotes( $array ) {
902
-	foreach ( (array) $array as $k => $v ) {
903
-		if ( is_array( $v ) ) {
904
-			$array[$k] = add_magic_quotes( $v );
901
+function add_magic_quotes($array) {
902
+	foreach ((array) $array as $k => $v) {
903
+		if (is_array($v)) {
904
+			$array[$k] = add_magic_quotes($v);
905 905
 		} else {
906
-			$array[$k] = addslashes( $v );
906
+			$array[$k] = addslashes($v);
907 907
 		}
908 908
 	}
909 909
 	return $array;
@@ -919,21 +919,21 @@  discard block
 block discarded – undo
919 919
  * @param string $uri URI/URL of web page to retrieve.
920 920
  * @return false|string HTTP content. False on failure.
921 921
  */
922
-function wp_remote_fopen( $uri ) {
923
-	$parsed_url = @parse_url( $uri );
922
+function wp_remote_fopen($uri) {
923
+	$parsed_url = @parse_url($uri);
924 924
 
925
-	if ( !$parsed_url || !is_array( $parsed_url ) )
925
+	if ( ! $parsed_url || ! is_array($parsed_url))
926 926
 		return false;
927 927
 
928 928
 	$options = array();
929 929
 	$options['timeout'] = 10;
930 930
 
931
-	$response = wp_safe_remote_get( $uri, $options );
931
+	$response = wp_safe_remote_get($uri, $options);
932 932
 
933
-	if ( is_wp_error( $response ) )
933
+	if (is_wp_error($response))
934 934
 		return false;
935 935
 
936
-	return wp_remote_retrieve_body( $response );
936
+	return wp_remote_retrieve_body($response);
937 937
 }
938 938
 
939 939
 /**
@@ -947,11 +947,11 @@  discard block
 block discarded – undo
947 947
  *
948 948
  * @param string|array $query_vars Default WP_Query arguments.
949 949
  */
950
-function wp( $query_vars = '' ) {
950
+function wp($query_vars = '') {
951 951
 	global $wp, $wp_query, $wp_the_query;
952
-	$wp->main( $query_vars );
952
+	$wp->main($query_vars);
953 953
 
954
-	if ( !isset($wp_the_query) )
954
+	if ( ! isset($wp_the_query))
955 955
 		$wp_the_query = $wp_query;
956 956
 }
957 957
 
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
  * @param int $code HTTP status code.
966 966
  * @return string Empty string if not found, or description if found.
967 967
  */
968
-function get_status_header_desc( $code ) {
968
+function get_status_header_desc($code) {
969 969
 	global $wp_header_to_desc;
970 970
 
971
-	$code = absint( $code );
971
+	$code = absint($code);
972 972
 
973
-	if ( !isset( $wp_header_to_desc ) ) {
973
+	if ( ! isset($wp_header_to_desc)) {
974 974
 		$wp_header_to_desc = array(
975 975
 			100 => 'Continue',
976 976
 			101 => 'Switching Protocols',
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
 		);
1039 1039
 	}
1040 1040
 
1041
-	if ( isset( $wp_header_to_desc[$code] ) )
1041
+	if (isset($wp_header_to_desc[$code]))
1042 1042
 		return $wp_header_to_desc[$code];
1043 1043
 	else
1044 1044
 		return '';
@@ -1055,18 +1055,18 @@  discard block
 block discarded – undo
1055 1055
  * @param int    $code        HTTP status code.
1056 1056
  * @param string $description Optional. A custom description for the HTTP status.
1057 1057
  */
1058
-function status_header( $code, $description = '' ) {
1059
-	if ( ! $description ) {
1060
-		$description = get_status_header_desc( $code );
1058
+function status_header($code, $description = '') {
1059
+	if ( ! $description) {
1060
+		$description = get_status_header_desc($code);
1061 1061
 	}
1062 1062
 
1063
-	if ( empty( $description ) ) {
1063
+	if (empty($description)) {
1064 1064
 		return;
1065 1065
 	}
1066 1066
 
1067 1067
 	$protocol = wp_get_server_protocol();
1068 1068
 	$status_header = "$protocol $code $description";
1069
-	if ( function_exists( 'apply_filters' ) )
1069
+	if (function_exists('apply_filters'))
1070 1070
 
1071 1071
 		/**
1072 1072
 		 * Filter an HTTP status header.
@@ -1078,9 +1078,9 @@  discard block
 block discarded – undo
1078 1078
 		 * @param string $description   Description for the status code.
1079 1079
 		 * @param string $protocol      Server protocol.
1080 1080
 		 */
1081
-		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1081
+		$status_header = apply_filters('status_header', $status_header, $code, $description, $protocol);
1082 1082
 
1083
-	@header( $status_header, true, $code );
1083
+	@header($status_header, true, $code);
1084 1084
 }
1085 1085
 
1086 1086
 /**
@@ -1100,7 +1100,7 @@  discard block
 block discarded – undo
1100 1100
 		'Pragma' => 'no-cache',
1101 1101
 	);
1102 1102
 
1103
-	if ( function_exists('apply_filters') ) {
1103
+	if (function_exists('apply_filters')) {
1104 1104
 		/**
1105 1105
 		 * Filter the cache-controlling headers.
1106 1106
 		 *
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 		 *     @type string $Pragma        Pragma header.
1117 1117
 		 * }
1118 1118
 		 */
1119
-		$headers = (array) apply_filters( 'nocache_headers', $headers );
1119
+		$headers = (array) apply_filters('nocache_headers', $headers);
1120 1120
 	}
1121 1121
 	$headers['Last-Modified'] = false;
1122 1122
 	return $headers;
@@ -1136,23 +1136,23 @@  discard block
 block discarded – undo
1136 1136
 function nocache_headers() {
1137 1137
 	$headers = wp_get_nocache_headers();
1138 1138
 
1139
-	unset( $headers['Last-Modified'] );
1139
+	unset($headers['Last-Modified']);
1140 1140
 
1141 1141
 	// In PHP 5.3+, make sure we are not sending a Last-Modified header.
1142
-	if ( function_exists( 'header_remove' ) ) {
1143
-		@header_remove( 'Last-Modified' );
1142
+	if (function_exists('header_remove')) {
1143
+		@header_remove('Last-Modified');
1144 1144
 	} else {
1145 1145
 		// In PHP 5.2, send an empty Last-Modified header, but only as a
1146 1146
 		// last resort to override a header already sent. #WP23021
1147
-		foreach ( headers_list() as $header ) {
1148
-			if ( 0 === stripos( $header, 'Last-Modified' ) ) {
1147
+		foreach (headers_list() as $header) {
1148
+			if (0 === stripos($header, 'Last-Modified')) {
1149 1149
 				$headers['Last-Modified'] = '';
1150 1150
 				break;
1151 1151
 			}
1152 1152
 		}
1153 1153
 	}
1154 1154
 
1155
-	foreach ( $headers as $name => $field_value )
1155
+	foreach ($headers as $name => $field_value)
1156 1156
 		@header("{$name}: {$field_value}");
1157 1157
 }
1158 1158
 
@@ -1164,9 +1164,9 @@  discard block
 block discarded – undo
1164 1164
 function cache_javascript_headers() {
1165 1165
 	$expiresOffset = 10 * DAY_IN_SECONDS;
1166 1166
 
1167
-	header( "Content-Type: text/javascript; charset=" . get_bloginfo( 'charset' ) );
1168
-	header( "Vary: Accept-Encoding" ); // Handle proxies
1169
-	header( "Expires: " . gmdate( "D, d M Y H:i:s", time() + $expiresOffset ) . " GMT" );
1167
+	header("Content-Type: text/javascript; charset=".get_bloginfo('charset'));
1168
+	header("Vary: Accept-Encoding"); // Handle proxies
1169
+	header("Expires: ".gmdate("D, d M Y H:i:s", time() + $expiresOffset)." GMT");
1170 1170
 }
1171 1171
 
1172 1172
 /**
@@ -1193,8 +1193,8 @@  discard block
 block discarded – undo
1193 1193
  * @param string $yn Character string containing either 'y' (yes) or 'n' (no).
1194 1194
  * @return bool True if yes, false on anything else.
1195 1195
  */
1196
-function bool_from_yn( $yn ) {
1197
-	return ( strtolower( $yn ) == 'y' );
1196
+function bool_from_yn($yn) {
1197
+	return (strtolower($yn) == 'y');
1198 1198
 }
1199 1199
 
1200 1200
 /**
@@ -1212,16 +1212,16 @@  discard block
 block discarded – undo
1212 1212
 function do_feed() {
1213 1213
 	global $wp_query;
1214 1214
 
1215
-	$feed = get_query_var( 'feed' );
1215
+	$feed = get_query_var('feed');
1216 1216
 
1217 1217
 	// Remove the pad, if present.
1218
-	$feed = preg_replace( '/^_+/', '', $feed );
1218
+	$feed = preg_replace('/^_+/', '', $feed);
1219 1219
 
1220
-	if ( $feed == '' || $feed == 'feed' )
1220
+	if ($feed == '' || $feed == 'feed')
1221 1221
 		$feed = get_default_feed();
1222 1222
 
1223
-	if ( ! has_action( "do_feed_{$feed}" ) ) {
1224
-		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
1223
+	if ( ! has_action("do_feed_{$feed}")) {
1224
+		wp_die(__('ERROR: This is not a valid feed template.'), '', array('response' => 404));
1225 1225
 	}
1226 1226
 
1227 1227
 	/**
@@ -1236,7 +1236,7 @@  discard block
 block discarded – undo
1236 1236
 	 * @param bool   $is_comment_feed Whether the feed is a comment feed.
1237 1237
 	 * @param string $feed            The feed name.
1238 1238
 	 */
1239
-	do_action( "do_feed_{$feed}", $wp_query->is_comment_feed, $feed );
1239
+	do_action("do_feed_{$feed}", $wp_query->is_comment_feed, $feed);
1240 1240
 }
1241 1241
 
1242 1242
 /**
@@ -1247,7 +1247,7 @@  discard block
 block discarded – undo
1247 1247
  * @see load_template()
1248 1248
  */
1249 1249
 function do_feed_rdf() {
1250
-	load_template( ABSPATH . WPINC . '/feed-rdf.php' );
1250
+	load_template(ABSPATH.WPINC.'/feed-rdf.php');
1251 1251
 }
1252 1252
 
1253 1253
 /**
@@ -1258,7 +1258,7 @@  discard block
 block discarded – undo
1258 1258
  * @see load_template()
1259 1259
  */
1260 1260
 function do_feed_rss() {
1261
-	load_template( ABSPATH . WPINC . '/feed-rss.php' );
1261
+	load_template(ABSPATH.WPINC.'/feed-rss.php');
1262 1262
 }
1263 1263
 
1264 1264
 /**
@@ -1270,11 +1270,11 @@  discard block
 block discarded – undo
1270 1270
  *
1271 1271
  * @param bool $for_comments True for the comment feed, false for normal feed.
1272 1272
  */
1273
-function do_feed_rss2( $for_comments ) {
1274
-	if ( $for_comments )
1275
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1273
+function do_feed_rss2($for_comments) {
1274
+	if ($for_comments)
1275
+		load_template(ABSPATH.WPINC.'/feed-rss2-comments.php');
1276 1276
 	else
1277
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1277
+		load_template(ABSPATH.WPINC.'/feed-rss2.php');
1278 1278
 }
1279 1279
 
1280 1280
 /**
@@ -1286,11 +1286,11 @@  discard block
 block discarded – undo
1286 1286
  *
1287 1287
  * @param bool $for_comments True for the comment feed, false for normal feed.
1288 1288
  */
1289
-function do_feed_atom( $for_comments ) {
1289
+function do_feed_atom($for_comments) {
1290 1290
 	if ($for_comments)
1291
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1291
+		load_template(ABSPATH.WPINC.'/feed-atom-comments.php');
1292 1292
 	else
1293
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1293
+		load_template(ABSPATH.WPINC.'/feed-atom.php');
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1302,22 +1302,22 @@  discard block
 block discarded – undo
1302 1302
  * @since 2.1.0
1303 1303
  */
1304 1304
 function do_robots() {
1305
-	header( 'Content-Type: text/plain; charset=utf-8' );
1305
+	header('Content-Type: text/plain; charset=utf-8');
1306 1306
 
1307 1307
 	/**
1308 1308
 	 * Fires when displaying the robots.txt file.
1309 1309
 	 *
1310 1310
 	 * @since 2.1.0
1311 1311
 	 */
1312
-	do_action( 'do_robotstxt' );
1312
+	do_action('do_robotstxt');
1313 1313
 
1314 1314
 	$output = "User-agent: *\n";
1315
-	$public = get_option( 'blog_public' );
1316
-	if ( '0' == $public ) {
1315
+	$public = get_option('blog_public');
1316
+	if ('0' == $public) {
1317 1317
 		$output .= "Disallow: /\n";
1318 1318
 	} else {
1319
-		$site_url = parse_url( site_url() );
1320
-		$path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : '';
1319
+		$site_url = parse_url(site_url());
1320
+		$path = ( ! empty($site_url['path'])) ? $site_url['path'] : '';
1321 1321
 		$output .= "Disallow: $path/wp-admin/\n";
1322 1322
 		$output .= "Allow: $path/wp-admin/admin-ajax.php\n";
1323 1323
 	}
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
 	 * @param string $output Robots.txt output.
1331 1331
 	 * @param bool   $public Whether the site is considered "public".
1332 1332
 	 */
1333
-	echo apply_filters( 'robots_txt', $output, $public );
1333
+	echo apply_filters('robots_txt', $output, $public);
1334 1334
 }
1335 1335
 
1336 1336
 /**
@@ -1355,28 +1355,28 @@  discard block
 block discarded – undo
1355 1355
 	 * Check cache first. If options table goes away and we have true
1356 1356
 	 * cached, oh well.
1357 1357
 	 */
1358
-	if ( wp_cache_get( 'is_blog_installed' ) )
1358
+	if (wp_cache_get('is_blog_installed'))
1359 1359
 		return true;
1360 1360
 
1361 1361
 	$suppress = $wpdb->suppress_errors();
1362
-	if ( ! wp_installing() ) {
1362
+	if ( ! wp_installing()) {
1363 1363
 		$alloptions = wp_load_alloptions();
1364 1364
 	}
1365 1365
 	// If siteurl is not set to autoload, check it specifically
1366
-	if ( !isset( $alloptions['siteurl'] ) )
1367
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1366
+	if ( ! isset($alloptions['siteurl']))
1367
+		$installed = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'");
1368 1368
 	else
1369 1369
 		$installed = $alloptions['siteurl'];
1370
-	$wpdb->suppress_errors( $suppress );
1370
+	$wpdb->suppress_errors($suppress);
1371 1371
 
1372
-	$installed = !empty( $installed );
1373
-	wp_cache_set( 'is_blog_installed', $installed );
1372
+	$installed = ! empty($installed);
1373
+	wp_cache_set('is_blog_installed', $installed);
1374 1374
 
1375
-	if ( $installed )
1375
+	if ($installed)
1376 1376
 		return true;
1377 1377
 
1378 1378
 	// If visiting repair.php, return true and let it take over.
1379
-	if ( defined( 'WP_REPAIRING' ) )
1379
+	if (defined('WP_REPAIRING'))
1380 1380
 		return true;
1381 1381
 
1382 1382
 	$suppress = $wpdb->suppress_errors();
@@ -1387,14 +1387,14 @@  discard block
 block discarded – undo
1387 1387
 	 * options table could not be accessed.
1388 1388
 	 */
1389 1389
 	$wp_tables = $wpdb->tables();
1390
-	foreach ( $wp_tables as $table ) {
1390
+	foreach ($wp_tables as $table) {
1391 1391
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1392
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1392
+		if (defined('CUSTOM_USER_TABLE') && CUSTOM_USER_TABLE == $table)
1393 1393
 			continue;
1394
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1394
+		if (defined('CUSTOM_USER_META_TABLE') && CUSTOM_USER_META_TABLE == $table)
1395 1395
 			continue;
1396 1396
 
1397
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1397
+		if ( ! $wpdb->get_results("DESCRIBE $table;"))
1398 1398
 			continue;
1399 1399
 
1400 1400
 		// One or more tables exist. We are insane.
@@ -1402,13 +1402,13 @@  discard block
 block discarded – undo
1402 1402
 		wp_load_translations_early();
1403 1403
 
1404 1404
 		// Die with a DB error.
1405
-		$wpdb->error = sprintf( __( 'One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.' ), 'maint/repair.php?referrer=is_blog_installed' );
1405
+		$wpdb->error = sprintf(__('One or more database tables are unavailable. The database may need to be <a href="%s">repaired</a>.'), 'maint/repair.php?referrer=is_blog_installed');
1406 1406
 		dead_db();
1407 1407
 	}
1408 1408
 
1409
-	$wpdb->suppress_errors( $suppress );
1409
+	$wpdb->suppress_errors($suppress);
1410 1410
 
1411
-	wp_cache_set( 'is_blog_installed', false );
1411
+	wp_cache_set('is_blog_installed', false);
1412 1412
 
1413 1413
 	return false;
1414 1414
 }
@@ -1423,9 +1423,9 @@  discard block
 block discarded – undo
1423 1423
  * @param string     $name      Optional. Nonce name. Default '_wpnonce'.
1424 1424
  * @return string Escaped URL with nonce action added.
1425 1425
  */
1426
-function wp_nonce_url( $actionurl, $action = -1, $name = '_wpnonce' ) {
1427
-	$actionurl = str_replace( '&amp;', '&', $actionurl );
1428
-	return esc_html( add_query_arg( $name, wp_create_nonce( $action ), $actionurl ) );
1426
+function wp_nonce_url($actionurl, $action = -1, $name = '_wpnonce') {
1427
+	$actionurl = str_replace('&amp;', '&', $actionurl);
1428
+	return esc_html(add_query_arg($name, wp_create_nonce($action), $actionurl));
1429 1429
 }
1430 1430
 
1431 1431
 /**
@@ -1454,14 +1454,14 @@  discard block
 block discarded – undo
1454 1454
  * @param bool       $echo    Optional. Whether to display or return hidden form field. Default true.
1455 1455
  * @return string Nonce field HTML markup.
1456 1456
  */
1457
-function wp_nonce_field( $action = -1, $name = "_wpnonce", $referer = true , $echo = true ) {
1458
-	$name = esc_attr( $name );
1459
-	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1457
+function wp_nonce_field($action = -1, $name = "_wpnonce", $referer = true, $echo = true) {
1458
+	$name = esc_attr($name);
1459
+	$nonce_field = '<input type="hidden" id="'.$name.'" name="'.$name.'" value="'.wp_create_nonce($action).'" />';
1460 1460
 
1461
-	if ( $referer )
1462
-		$nonce_field .= wp_referer_field( false );
1461
+	if ($referer)
1462
+		$nonce_field .= wp_referer_field(false);
1463 1463
 
1464
-	if ( $echo )
1464
+	if ($echo)
1465 1465
 		echo $nonce_field;
1466 1466
 
1467 1467
 	return $nonce_field;
@@ -1478,10 +1478,10 @@  discard block
 block discarded – undo
1478 1478
  * @param bool $echo Optional. Whether to echo or return the referer field. Default true.
1479 1479
  * @return string Referer field HTML markup.
1480 1480
  */
1481
-function wp_referer_field( $echo = true ) {
1482
-	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1481
+function wp_referer_field($echo = true) {
1482
+	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />';
1483 1483
 
1484
-	if ( $echo )
1484
+	if ($echo)
1485 1485
 		echo $referer_field;
1486 1486
 	return $referer_field;
1487 1487
 }
@@ -1500,12 +1500,12 @@  discard block
 block discarded – undo
1500 1500
  *                             Default 'current'.
1501 1501
  * @return string Original referer field.
1502 1502
  */
1503
-function wp_original_referer_field( $echo = true, $jump_back_to = 'current' ) {
1504
-	if ( ! $ref = wp_get_original_referer() ) {
1505
-		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1503
+function wp_original_referer_field($echo = true, $jump_back_to = 'current') {
1504
+	if ( ! $ref = wp_get_original_referer()) {
1505
+		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash($_SERVER['REQUEST_URI']);
1506 1506
 	}
1507
-	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1508
-	if ( $echo )
1507
+	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="'.esc_attr($ref).'" />';
1508
+	if ($echo)
1509 1509
 		echo $orig_referer_field;
1510 1510
 	return $orig_referer_field;
1511 1511
 }
@@ -1520,14 +1520,14 @@  discard block
 block discarded – undo
1520 1520
  * @return false|string False on failure. Referer URL on success.
1521 1521
  */
1522 1522
 function wp_get_referer() {
1523
-	if ( ! function_exists( 'wp_validate_redirect' ) ) {
1523
+	if ( ! function_exists('wp_validate_redirect')) {
1524 1524
 		return false;
1525 1525
 	}
1526 1526
 
1527 1527
 	$ref = wp_get_raw_referer();
1528 1528
 
1529
-	if ( $ref && $ref !== wp_unslash( $_SERVER['REQUEST_URI'] ) && $ref !== home_url() . wp_unslash( $_SERVER['REQUEST_URI'] ) ) {
1530
-		return wp_validate_redirect( $ref, false );
1529
+	if ($ref && $ref !== wp_unslash($_SERVER['REQUEST_URI']) && $ref !== home_url().wp_unslash($_SERVER['REQUEST_URI'])) {
1530
+		return wp_validate_redirect($ref, false);
1531 1531
 	}
1532 1532
 
1533 1533
 	return false;
@@ -1543,10 +1543,10 @@  discard block
 block discarded – undo
1543 1543
  * @return string|false Referer URL on success, false on failure.
1544 1544
  */
1545 1545
 function wp_get_raw_referer() {
1546
-	if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
1547
-		return wp_unslash( $_REQUEST['_wp_http_referer'] );
1548
-	} else if ( ! empty( $_SERVER['HTTP_REFERER'] ) ) {
1549
-		return wp_unslash( $_SERVER['HTTP_REFERER'] );
1546
+	if ( ! empty($_REQUEST['_wp_http_referer'])) {
1547
+		return wp_unslash($_REQUEST['_wp_http_referer']);
1548
+	} else if ( ! empty($_SERVER['HTTP_REFERER'])) {
1549
+		return wp_unslash($_SERVER['HTTP_REFERER']);
1550 1550
 	}
1551 1551
 
1552 1552
 	return false;
@@ -1560,8 +1560,8 @@  discard block
 block discarded – undo
1560 1560
  * @return string|false False if no original referer or original referer if set.
1561 1561
  */
1562 1562
 function wp_get_original_referer() {
1563
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1564
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1563
+	if ( ! empty($_REQUEST['_wp_original_http_referer']) && function_exists('wp_validate_redirect'))
1564
+		return wp_validate_redirect(wp_unslash($_REQUEST['_wp_original_http_referer']), false);
1565 1565
 	return false;
1566 1566
 }
1567 1567
 
@@ -1575,20 +1575,20 @@  discard block
 block discarded – undo
1575 1575
  * @param string $target Full path to attempt to create.
1576 1576
  * @return bool Whether the path was created. True if path already exists.
1577 1577
  */
1578
-function wp_mkdir_p( $target ) {
1578
+function wp_mkdir_p($target) {
1579 1579
 	$wrapper = null;
1580 1580
 
1581 1581
 	// Strip the protocol.
1582
-	if ( wp_is_stream( $target ) ) {
1583
-		list( $wrapper, $target ) = explode( '://', $target, 2 );
1582
+	if (wp_is_stream($target)) {
1583
+		list($wrapper, $target) = explode('://', $target, 2);
1584 1584
 	}
1585 1585
 
1586 1586
 	// From php.net/mkdir user contributed notes.
1587
-	$target = str_replace( '//', '/', $target );
1587
+	$target = str_replace('//', '/', $target);
1588 1588
 
1589 1589
 	// Put the wrapper back on the target.
1590
-	if ( $wrapper !== null ) {
1591
-		$target = $wrapper . '://' . $target;
1590
+	if ($wrapper !== null) {
1591
+		$target = $wrapper.'://'.$target;
1592 1592
 	}
1593 1593
 
1594 1594
 	/*
@@ -1596,35 +1596,35 @@  discard block
 block discarded – undo
1596 1596
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1597 1597
 	 */
1598 1598
 	$target = rtrim($target, '/');
1599
-	if ( empty($target) )
1599
+	if (empty($target))
1600 1600
 		$target = '/';
1601 1601
 
1602
-	if ( file_exists( $target ) )
1603
-		return @is_dir( $target );
1602
+	if (file_exists($target))
1603
+		return @is_dir($target);
1604 1604
 
1605 1605
 	// We need to find the permissions of the parent folder that exists and inherit that.
1606
-	$target_parent = dirname( $target );
1607
-	while ( '.' != $target_parent && ! is_dir( $target_parent ) ) {
1608
-		$target_parent = dirname( $target_parent );
1606
+	$target_parent = dirname($target);
1607
+	while ('.' != $target_parent && ! is_dir($target_parent)) {
1608
+		$target_parent = dirname($target_parent);
1609 1609
 	}
1610 1610
 
1611 1611
 	// Get the permission bits.
1612
-	if ( $stat = @stat( $target_parent ) ) {
1612
+	if ($stat = @stat($target_parent)) {
1613 1613
 		$dir_perms = $stat['mode'] & 0007777;
1614 1614
 	} else {
1615 1615
 		$dir_perms = 0777;
1616 1616
 	}
1617 1617
 
1618
-	if ( @mkdir( $target, $dir_perms, true ) ) {
1618
+	if (@mkdir($target, $dir_perms, true)) {
1619 1619
 
1620 1620
 		/*
1621 1621
 		 * If a umask is set that modifies $dir_perms, we'll have to re-set
1622 1622
 		 * the $dir_perms correctly with chmod()
1623 1623
 		 */
1624
-		if ( $dir_perms != ( $dir_perms & ~umask() ) ) {
1625
-			$folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
1626
-			for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
1627
-				@chmod( $target_parent . '/' . implode( '/', array_slice( $folder_parts, 0, $i ) ), $dir_perms );
1624
+		if ($dir_perms != ($dir_perms & ~umask())) {
1625
+			$folder_parts = explode('/', substr($target, strlen($target_parent) + 1));
1626
+			for ($i = 1, $c = count($folder_parts); $i <= $c; $i++) {
1627
+				@chmod($target_parent.'/'.implode('/', array_slice($folder_parts, 0, $i)), $dir_perms);
1628 1628
 			}
1629 1629
 		}
1630 1630
 
@@ -1644,23 +1644,23 @@  discard block
 block discarded – undo
1644 1644
  * @param string $path File path.
1645 1645
  * @return bool True if path is absolute, false is not absolute.
1646 1646
  */
1647
-function path_is_absolute( $path ) {
1647
+function path_is_absolute($path) {
1648 1648
 	/*
1649 1649
 	 * This is definitive if true but fails if $path does not exist or contains
1650 1650
 	 * a symbolic link.
1651 1651
 	 */
1652
-	if ( realpath($path) == $path )
1652
+	if (realpath($path) == $path)
1653 1653
 		return true;
1654 1654
 
1655
-	if ( strlen($path) == 0 || $path[0] == '.' )
1655
+	if (strlen($path) == 0 || $path[0] == '.')
1656 1656
 		return false;
1657 1657
 
1658 1658
 	// Windows allows absolute paths like this.
1659
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1659
+	if (preg_match('#^[a-zA-Z]:\\\\#', $path))
1660 1660
 		return true;
1661 1661
 
1662 1662
 	// A path starting with / or \ is absolute; anything else is relative.
1663
-	return ( $path[0] == '/' || $path[0] == '\\' );
1663
+	return ($path[0] == '/' || $path[0] == '\\');
1664 1664
 }
1665 1665
 
1666 1666
 /**
@@ -1675,11 +1675,11 @@  discard block
 block discarded – undo
1675 1675
  * @param string $path Path relative to $base.
1676 1676
  * @return string The path with the base or absolute path.
1677 1677
  */
1678
-function path_join( $base, $path ) {
1679
-	if ( path_is_absolute($path) )
1678
+function path_join($base, $path) {
1679
+	if (path_is_absolute($path))
1680 1680
 		return $path;
1681 1681
 
1682
-	return rtrim($base, '/') . '/' . ltrim($path, '/');
1682
+	return rtrim($base, '/').'/'.ltrim($path, '/');
1683 1683
 }
1684 1684
 
1685 1685
 /**
@@ -1697,11 +1697,11 @@  discard block
 block discarded – undo
1697 1697
  * @param string $path Path to normalize.
1698 1698
  * @return string Normalized path.
1699 1699
  */
1700
-function wp_normalize_path( $path ) {
1701
-	$path = str_replace( '\\', '/', $path );
1702
-	$path = preg_replace( '|(?<=.)/+|', '/', $path );
1703
-	if ( ':' === substr( $path, 1, 1 ) ) {
1704
-		$path = ucfirst( $path );
1700
+function wp_normalize_path($path) {
1701
+	$path = str_replace('\\', '/', $path);
1702
+	$path = preg_replace('|(?<=.)/+|', '/', $path);
1703
+	if (':' === substr($path, 1, 1)) {
1704
+		$path = ucfirst($path);
1705 1705
 	}
1706 1706
 	return $path;
1707 1707
 }
@@ -1724,24 +1724,24 @@  discard block
 block discarded – undo
1724 1724
  */
1725 1725
 function get_temp_dir() {
1726 1726
 	static $temp = '';
1727
-	if ( defined('WP_TEMP_DIR') )
1727
+	if (defined('WP_TEMP_DIR'))
1728 1728
 		return trailingslashit(WP_TEMP_DIR);
1729 1729
 
1730
-	if ( $temp )
1731
-		return trailingslashit( $temp );
1730
+	if ($temp)
1731
+		return trailingslashit($temp);
1732 1732
 
1733
-	if ( function_exists('sys_get_temp_dir') ) {
1733
+	if (function_exists('sys_get_temp_dir')) {
1734 1734
 		$temp = sys_get_temp_dir();
1735
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1736
-			return trailingslashit( $temp );
1735
+		if (@is_dir($temp) && wp_is_writable($temp))
1736
+			return trailingslashit($temp);
1737 1737
 	}
1738 1738
 
1739 1739
 	$temp = ini_get('upload_tmp_dir');
1740
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1741
-		return trailingslashit( $temp );
1740
+	if (@is_dir($temp) && wp_is_writable($temp))
1741
+		return trailingslashit($temp);
1742 1742
 
1743
-	$temp = WP_CONTENT_DIR . '/';
1744
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1743
+	$temp = WP_CONTENT_DIR.'/';
1744
+	if (is_dir($temp) && wp_is_writable($temp))
1745 1745
 		return $temp;
1746 1746
 
1747 1747
 	return '/tmp/';
@@ -1760,11 +1760,11 @@  discard block
 block discarded – undo
1760 1760
  * @param string $path Path to check for write-ability.
1761 1761
  * @return bool Whether the path is writable.
1762 1762
  */
1763
-function wp_is_writable( $path ) {
1764
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1765
-		return win_is_writable( $path );
1763
+function wp_is_writable($path) {
1764
+	if ('WIN' === strtoupper(substr(PHP_OS, 0, 3)))
1765
+		return win_is_writable($path);
1766 1766
 	else
1767
-		return @is_writable( $path );
1767
+		return @is_writable($path);
1768 1768
 }
1769 1769
 
1770 1770
 /**
@@ -1783,21 +1783,21 @@  discard block
 block discarded – undo
1783 1783
  * @param string $path Windows path to check for write-ability.
1784 1784
  * @return bool Whether the path is writable.
1785 1785
  */
1786
-function win_is_writable( $path ) {
1786
+function win_is_writable($path) {
1787 1787
 
1788
-	if ( $path[strlen( $path ) - 1] == '/' ) { // if it looks like a directory, check a random file within the directory
1789
-		return win_is_writable( $path . uniqid( mt_rand() ) . '.tmp');
1790
-	} elseif ( is_dir( $path ) ) { // If it's a directory (and not a file) check a random file within the directory
1791
-		return win_is_writable( $path . '/' . uniqid( mt_rand() ) . '.tmp' );
1788
+	if ($path[strlen($path) - 1] == '/') { // if it looks like a directory, check a random file within the directory
1789
+		return win_is_writable($path.uniqid(mt_rand()).'.tmp');
1790
+	} elseif (is_dir($path)) { // If it's a directory (and not a file) check a random file within the directory
1791
+		return win_is_writable($path.'/'.uniqid(mt_rand()).'.tmp');
1792 1792
 	}
1793 1793
 	// check tmp file for read/write capabilities
1794
-	$should_delete_tmp_file = !file_exists( $path );
1795
-	$f = @fopen( $path, 'a' );
1796
-	if ( $f === false )
1794
+	$should_delete_tmp_file = ! file_exists($path);
1795
+	$f = @fopen($path, 'a');
1796
+	if ($f === false)
1797 1797
 		return false;
1798
-	fclose( $f );
1799
-	if ( $should_delete_tmp_file )
1800
-		unlink( $path );
1798
+	fclose($f);
1799
+	if ($should_delete_tmp_file)
1800
+		unlink($path);
1801 1801
 	return true;
1802 1802
 }
1803 1803
 
@@ -1815,7 +1815,7 @@  discard block
 block discarded – undo
1815 1815
  * @return array See wp_upload_dir() for description.
1816 1816
  */
1817 1817
 function wp_get_upload_dir() {
1818
-	return wp_upload_dir( null, false );
1818
+	return wp_upload_dir(null, false);
1819 1819
 }
1820 1820
 
1821 1821
 /**
@@ -1853,13 +1853,13 @@  discard block
 block discarded – undo
1853 1853
  * @param bool   $refresh_cache Optional. Whether to refresh the cache. Default false.
1854 1854
  * @return array See above for description.
1855 1855
  */
1856
-function wp_upload_dir( $time = null, $create_dir = true, $refresh_cache = false ) {
1856
+function wp_upload_dir($time = null, $create_dir = true, $refresh_cache = false) {
1857 1857
 	static $cache = array();
1858 1858
 
1859
-	$key = sprintf( '%d-%s', get_current_blog_id(), (string) $time );
1859
+	$key = sprintf('%d-%s', get_current_blog_id(), (string) $time);
1860 1860
 
1861
-	if ( $refresh_cache || empty( $cache[ $key ] ) ) {
1862
-		$cache[ $key ] = _wp_upload_dir( $time );
1861
+	if ($refresh_cache || empty($cache[$key])) {
1862
+		$cache[$key] = _wp_upload_dir($time);
1863 1863
 	}
1864 1864
 
1865 1865
 	/**
@@ -1870,28 +1870,28 @@  discard block
 block discarded – undo
1870 1870
 	 * @param array $uploads Array of upload directory data with keys of 'path',
1871 1871
 	 *                       'url', 'subdir, 'basedir', and 'error'.
1872 1872
 	 */
1873
-	$uploads = apply_filters( 'upload_dir', $cache[ $key ] );
1873
+	$uploads = apply_filters('upload_dir', $cache[$key]);
1874 1874
 
1875
-	if ( $create_dir ) {
1875
+	if ($create_dir) {
1876 1876
 		$path = $uploads['path'];
1877
-		$tested_paths = wp_cache_get( 'upload_dir_tested_paths' );
1877
+		$tested_paths = wp_cache_get('upload_dir_tested_paths');
1878 1878
 
1879
-		if ( ! is_array( $tested_paths ) ) {
1879
+		if ( ! is_array($tested_paths)) {
1880 1880
 			$tested_paths = array();
1881 1881
 		}
1882 1882
 
1883
-		if ( ! in_array( $path, $tested_paths, true ) ) {
1884
-			if ( ! wp_mkdir_p( $path ) ) {
1885
-				if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
1886
-					$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
1883
+		if ( ! in_array($path, $tested_paths, true)) {
1884
+			if ( ! wp_mkdir_p($path)) {
1885
+				if (0 === strpos($uploads['basedir'], ABSPATH)) {
1886
+					$error_path = str_replace(ABSPATH, '', $uploads['basedir']).$uploads['subdir'];
1887 1887
 				} else {
1888
-					$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
1888
+					$error_path = basename($uploads['basedir']).$uploads['subdir'];
1889 1889
 				}
1890 1890
 
1891
-				$uploads['error'] = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), esc_html( $error_path ) );
1891
+				$uploads['error'] = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), esc_html($error_path));
1892 1892
 			} else {
1893 1893
 				$tested_paths[] = $path;
1894
-				wp_cache_set( 'upload_dir_tested_paths', $tested_paths );
1894
+				wp_cache_set('upload_dir_tested_paths', $tested_paths);
1895 1895
 			}
1896 1896
 		}
1897 1897
 	}
@@ -1907,39 +1907,39 @@  discard block
 block discarded – undo
1907 1907
  * @param string $time Optional. Time formatted in 'yyyy/mm'. Default null.
1908 1908
  * @return array See wp_upload_dir()
1909 1909
  */
1910
-function _wp_upload_dir( $time = null ) {
1911
-	$siteurl = get_option( 'siteurl' );
1912
-	$upload_path = trim( get_option( 'upload_path' ) );
1910
+function _wp_upload_dir($time = null) {
1911
+	$siteurl = get_option('siteurl');
1912
+	$upload_path = trim(get_option('upload_path'));
1913 1913
 
1914
-	if ( empty( $upload_path ) || 'wp-content/uploads' == $upload_path ) {
1915
-		$dir = WP_CONTENT_DIR . '/uploads';
1916
-	} elseif ( 0 !== strpos( $upload_path, ABSPATH ) ) {
1914
+	if (empty($upload_path) || 'wp-content/uploads' == $upload_path) {
1915
+		$dir = WP_CONTENT_DIR.'/uploads';
1916
+	} elseif (0 !== strpos($upload_path, ABSPATH)) {
1917 1917
 		// $dir is absolute, $upload_path is (maybe) relative to ABSPATH
1918
-		$dir = path_join( ABSPATH, $upload_path );
1918
+		$dir = path_join(ABSPATH, $upload_path);
1919 1919
 	} else {
1920 1920
 		$dir = $upload_path;
1921 1921
 	}
1922 1922
 
1923
-	if ( !$url = get_option( 'upload_url_path' ) ) {
1924
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1925
-			$url = WP_CONTENT_URL . '/uploads';
1923
+	if ( ! $url = get_option('upload_url_path')) {
1924
+		if (empty($upload_path) || ('wp-content/uploads' == $upload_path) || ($upload_path == $dir))
1925
+			$url = WP_CONTENT_URL.'/uploads';
1926 1926
 		else
1927
-			$url = trailingslashit( $siteurl ) . $upload_path;
1927
+			$url = trailingslashit($siteurl).$upload_path;
1928 1928
 	}
1929 1929
 
1930 1930
 	/*
1931 1931
 	 * Honor the value of UPLOADS. This happens as long as ms-files rewriting is disabled.
1932 1932
 	 * We also sometimes obey UPLOADS when rewriting is enabled -- see the next block.
1933 1933
 	 */
1934
-	if ( defined( 'UPLOADS' ) && ! ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) ) {
1935
-		$dir = ABSPATH . UPLOADS;
1936
-		$url = trailingslashit( $siteurl ) . UPLOADS;
1934
+	if (defined('UPLOADS') && ! (is_multisite() && get_site_option('ms_files_rewriting'))) {
1935
+		$dir = ABSPATH.UPLOADS;
1936
+		$url = trailingslashit($siteurl).UPLOADS;
1937 1937
 	}
1938 1938
 
1939 1939
 	// If multisite (and if not the main site in a post-MU network)
1940
-	if ( is_multisite() && ! ( is_main_network() && is_main_site() && defined( 'MULTISITE' ) ) ) {
1940
+	if (is_multisite() && ! (is_main_network() && is_main_site() && defined('MULTISITE'))) {
1941 1941
 
1942
-		if ( ! get_site_option( 'ms_files_rewriting' ) ) {
1942
+		if ( ! get_site_option('ms_files_rewriting')) {
1943 1943
 			/*
1944 1944
 			 * If ms-files rewriting is disabled (networks created post-3.5), it is fairly
1945 1945
 			 * straightforward: Append sites/%d if we're not on the main site (for post-MU
@@ -1949,15 +1949,15 @@  discard block
 block discarded – undo
1949 1949
 			 * had wp-content/uploads for the main site.)
1950 1950
 			 */
1951 1951
 
1952
-			if ( defined( 'MULTISITE' ) )
1953
-				$ms_dir = '/sites/' . get_current_blog_id();
1952
+			if (defined('MULTISITE'))
1953
+				$ms_dir = '/sites/'.get_current_blog_id();
1954 1954
 			else
1955
-				$ms_dir = '/' . get_current_blog_id();
1955
+				$ms_dir = '/'.get_current_blog_id();
1956 1956
 
1957 1957
 			$dir .= $ms_dir;
1958 1958
 			$url .= $ms_dir;
1959 1959
 
1960
-		} elseif ( defined( 'UPLOADS' ) && ! ms_is_switched() ) {
1960
+		} elseif (defined('UPLOADS') && ! ms_is_switched()) {
1961 1961
 			/*
1962 1962
 			 * Handle the old-form ms-files.php rewriting if the network still has that enabled.
1963 1963
 			 * When ms-files rewriting is enabled, then we only listen to UPLOADS when:
@@ -1972,11 +1972,11 @@  discard block
 block discarded – undo
1972 1972
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1973 1973
 			 */
1974 1974
 
1975
-			if ( defined( 'BLOGUPLOADDIR' ) )
1976
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1975
+			if (defined('BLOGUPLOADDIR'))
1976
+				$dir = untrailingslashit(BLOGUPLOADDIR);
1977 1977
 			else
1978
-				$dir = ABSPATH . UPLOADS;
1979
-			$url = trailingslashit( $siteurl ) . 'files';
1978
+				$dir = ABSPATH.UPLOADS;
1979
+			$url = trailingslashit($siteurl).'files';
1980 1980
 		}
1981 1981
 	}
1982 1982
 
@@ -1984,12 +1984,12 @@  discard block
 block discarded – undo
1984 1984
 	$baseurl = $url;
1985 1985
 
1986 1986
 	$subdir = '';
1987
-	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1987
+	if (get_option('uploads_use_yearmonth_folders')) {
1988 1988
 		// Generate the yearly and monthly dirs
1989
-		if ( !$time )
1990
-			$time = current_time( 'mysql' );
1991
-		$y = substr( $time, 0, 4 );
1992
-		$m = substr( $time, 5, 2 );
1989
+		if ( ! $time)
1990
+			$time = current_time('mysql');
1991
+		$y = substr($time, 0, 4);
1992
+		$m = substr($time, 5, 2);
1993 1993
 		$subdir = "/$y/$m";
1994 1994
 	}
1995 1995
 
@@ -2023,38 +2023,38 @@  discard block
 block discarded – undo
2023 2023
  * @param callable $unique_filename_callback Callback. Default null.
2024 2024
  * @return string New filename, if given wasn't unique.
2025 2025
  */
2026
-function wp_unique_filename( $dir, $filename, $unique_filename_callback = null ) {
2026
+function wp_unique_filename($dir, $filename, $unique_filename_callback = null) {
2027 2027
 	// Sanitize the file name before we begin processing.
2028 2028
 	$filename = sanitize_file_name($filename);
2029 2029
 
2030 2030
 	// Separate the filename into a name and extension.
2031 2031
 	$info = pathinfo($filename);
2032
-	$ext = !empty($info['extension']) ? '.' . $info['extension'] : '';
2032
+	$ext = ! empty($info['extension']) ? '.'.$info['extension'] : '';
2033 2033
 	$name = basename($filename, $ext);
2034 2034
 
2035 2035
 	// Edge case: if file is named '.ext', treat as an empty name.
2036
-	if ( $name === $ext )
2036
+	if ($name === $ext)
2037 2037
 		$name = '';
2038 2038
 
2039 2039
 	/*
2040 2040
 	 * Increment the file number until we have a unique file to save in $dir.
2041 2041
 	 * Use callback if supplied.
2042 2042
 	 */
2043
-	if ( $unique_filename_callback && is_callable( $unique_filename_callback ) ) {
2044
-		$filename = call_user_func( $unique_filename_callback, $dir, $name, $ext );
2043
+	if ($unique_filename_callback && is_callable($unique_filename_callback)) {
2044
+		$filename = call_user_func($unique_filename_callback, $dir, $name, $ext);
2045 2045
 	} else {
2046 2046
 		$number = '';
2047 2047
 
2048 2048
 		// Change '.ext' to lower case.
2049
-		if ( $ext && strtolower($ext) != $ext ) {
2049
+		if ($ext && strtolower($ext) != $ext) {
2050 2050
 			$ext2 = strtolower($ext);
2051
-			$filename2 = preg_replace( '|' . preg_quote($ext) . '$|', $ext2, $filename );
2051
+			$filename2 = preg_replace('|'.preg_quote($ext).'$|', $ext2, $filename);
2052 2052
 
2053 2053
 			// Check for both lower and upper case extension or image sub-sizes may be overwritten.
2054
-			while ( file_exists($dir . "/$filename") || file_exists($dir . "/$filename2") ) {
2054
+			while (file_exists($dir."/$filename") || file_exists($dir."/$filename2")) {
2055 2055
 				$new_number = $number + 1;
2056
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-$new_number$ext", $filename );
2057
-				$filename2 = str_replace( array( "-$number$ext2", "$number$ext2" ), "-$new_number$ext2", $filename2 );
2056
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-$new_number$ext", $filename);
2057
+				$filename2 = str_replace(array("-$number$ext2", "$number$ext2"), "-$new_number$ext2", $filename2);
2058 2058
 				$number = $new_number;
2059 2059
 			}
2060 2060
 
@@ -2068,20 +2068,20 @@  discard block
 block discarded – undo
2068 2068
 			 * @param string        $dir                      Directory path.
2069 2069
 			 * @param callable|null $unique_filename_callback Callback function that generates the unique file name.
2070 2070
 			 */
2071
-			return apply_filters( 'wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback );
2071
+			return apply_filters('wp_unique_filename', $filename2, $ext, $dir, $unique_filename_callback);
2072 2072
 		}
2073 2073
 
2074
-		while ( file_exists( $dir . "/$filename" ) ) {
2075
-			if ( '' == "$number$ext" ) {
2076
-				$filename = "$filename-" . ++$number;
2074
+		while (file_exists($dir."/$filename")) {
2075
+			if ('' == "$number$ext") {
2076
+				$filename = "$filename-".++$number;
2077 2077
 			} else {
2078
-				$filename = str_replace( array( "-$number$ext", "$number$ext" ), "-" . ++$number . $ext, $filename );
2078
+				$filename = str_replace(array("-$number$ext", "$number$ext"), "-".++$number.$ext, $filename);
2079 2079
 			}
2080 2080
 		}
2081 2081
 	}
2082 2082
 
2083 2083
 	/** This filter is documented in wp-includes/functions.php */
2084
-	return apply_filters( 'wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback );
2084
+	return apply_filters('wp_unique_filename', $filename, $ext, $dir, $unique_filename_callback);
2085 2085
 }
2086 2086
 
2087 2087
 /**
@@ -2107,20 +2107,20 @@  discard block
 block discarded – undo
2107 2107
  * @param string       $time       Optional. Time formatted in 'yyyy/mm'. Default null.
2108 2108
  * @return array
2109 2109
  */
2110
-function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2111
-	if ( !empty( $deprecated ) )
2112
-		_deprecated_argument( __FUNCTION__, '2.0' );
2110
+function wp_upload_bits($name, $deprecated, $bits, $time = null) {
2111
+	if ( ! empty($deprecated))
2112
+		_deprecated_argument(__FUNCTION__, '2.0');
2113 2113
 
2114
-	if ( empty( $name ) )
2115
-		return array( 'error' => __( 'Empty filename' ) );
2114
+	if (empty($name))
2115
+		return array('error' => __('Empty filename'));
2116 2116
 
2117
-	$wp_filetype = wp_check_filetype( $name );
2118
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2119
-		return array( 'error' => __( 'Invalid file type' ) );
2117
+	$wp_filetype = wp_check_filetype($name);
2118
+	if ( ! $wp_filetype['ext'] && ! current_user_can('unfiltered_upload'))
2119
+		return array('error' => __('Invalid file type'));
2120 2120
 
2121
-	$upload = wp_upload_dir( $time );
2121
+	$upload = wp_upload_dir($time);
2122 2122
 
2123
-	if ( $upload['error'] !== false )
2123
+	if ($upload['error'] !== false)
2124 2124
 		return $upload;
2125 2125
 
2126 2126
 	/**
@@ -2133,45 +2133,45 @@  discard block
 block discarded – undo
2133 2133
 	 *
2134 2134
 	 * @param mixed $upload_bits_error An array of upload bits data, or a non-array error to return.
2135 2135
 	 */
2136
-	$upload_bits_error = apply_filters( 'wp_upload_bits', array( 'name' => $name, 'bits' => $bits, 'time' => $time ) );
2137
-	if ( !is_array( $upload_bits_error ) ) {
2138
-		$upload[ 'error' ] = $upload_bits_error;
2136
+	$upload_bits_error = apply_filters('wp_upload_bits', array('name' => $name, 'bits' => $bits, 'time' => $time));
2137
+	if ( ! is_array($upload_bits_error)) {
2138
+		$upload['error'] = $upload_bits_error;
2139 2139
 		return $upload;
2140 2140
 	}
2141 2141
 
2142
-	$filename = wp_unique_filename( $upload['path'], $name );
2142
+	$filename = wp_unique_filename($upload['path'], $name);
2143 2143
 
2144
-	$new_file = $upload['path'] . "/$filename";
2145
-	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2146
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2147
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2144
+	$new_file = $upload['path']."/$filename";
2145
+	if ( ! wp_mkdir_p(dirname($new_file))) {
2146
+		if (0 === strpos($upload['basedir'], ABSPATH))
2147
+			$error_path = str_replace(ABSPATH, '', $upload['basedir']).$upload['subdir'];
2148 2148
 		else
2149
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2149
+			$error_path = basename($upload['basedir']).$upload['subdir'];
2150 2150
 
2151
-		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2152
-		return array( 'error' => $message );
2151
+		$message = sprintf(__('Unable to create directory %s. Is its parent directory writable by the server?'), $error_path);
2152
+		return array('error' => $message);
2153 2153
 	}
2154 2154
 
2155
-	$ifp = @ fopen( $new_file, 'wb' );
2156
-	if ( ! $ifp )
2157
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2155
+	$ifp = @ fopen($new_file, 'wb');
2156
+	if ( ! $ifp)
2157
+		return array('error' => sprintf(__('Could not write file %s'), $new_file));
2158 2158
 
2159
-	@fwrite( $ifp, $bits );
2160
-	fclose( $ifp );
2159
+	@fwrite($ifp, $bits);
2160
+	fclose($ifp);
2161 2161
 	clearstatcache();
2162 2162
 
2163 2163
 	// Set correct file permissions
2164
-	$stat = @ stat( dirname( $new_file ) );
2164
+	$stat = @ stat(dirname($new_file));
2165 2165
 	$perms = $stat['mode'] & 0007777;
2166 2166
 	$perms = $perms & 0000666;
2167
-	@ chmod( $new_file, $perms );
2167
+	@ chmod($new_file, $perms);
2168 2168
 	clearstatcache();
2169 2169
 
2170 2170
 	// Compute the URL
2171
-	$url = $upload['url'] . "/$filename";
2171
+	$url = $upload['url']."/$filename";
2172 2172
 
2173 2173
 	/** This filter is documented in wp-admin/includes/file.php */
2174
-	return apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false ), 'sideload' );
2174
+	return apply_filters('wp_handle_upload', array('file' => $new_file, 'url' => $url, 'type' => $wp_filetype['type'], 'error' => false), 'sideload');
2175 2175
 }
2176 2176
 
2177 2177
 /**
@@ -2182,8 +2182,8 @@  discard block
 block discarded – undo
2182 2182
  * @param string $ext The extension to search.
2183 2183
  * @return string|void The file type, example: audio, video, document, spreadsheet, etc.
2184 2184
  */
2185
-function wp_ext2type( $ext ) {
2186
-	$ext = strtolower( $ext );
2185
+function wp_ext2type($ext) {
2186
+	$ext = strtolower($ext);
2187 2187
 
2188 2188
 	/**
2189 2189
 	 * Filter file type based on the extension name.
@@ -2195,20 +2195,20 @@  discard block
 block discarded – undo
2195 2195
 	 * @param array $ext2type Multi-dimensional array with extensions for a default set
2196 2196
 	 *                        of file types.
2197 2197
 	 */
2198
-	$ext2type = apply_filters( 'ext2type', array(
2199
-		'image'       => array( 'jpg', 'jpeg', 'jpe',  'gif',  'png',  'bmp',   'tif',  'tiff', 'ico' ),
2200
-		'audio'       => array( 'aac', 'ac3',  'aif',  'aiff', 'm3a',  'm4a',   'm4b',  'mka',  'mp1',  'mp2',  'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma' ),
2201
-		'video'       => array( '3g2',  '3gp', '3gpp', 'asf', 'avi',  'divx', 'dv',   'flv',  'm4v',   'mkv',  'mov',  'mp4',  'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt',  'rm', 'vob', 'wmv' ),
2202
-		'document'    => array( 'doc', 'docx', 'docm', 'dotm', 'odt',  'pages', 'pdf',  'xps',  'oxps', 'rtf',  'wp', 'wpd', 'psd', 'xcf' ),
2203
-		'spreadsheet' => array( 'numbers',     'ods',  'xls',  'xlsx', 'xlsm',  'xlsb' ),
2204
-		'interactive' => array( 'swf', 'key',  'ppt',  'pptx', 'pptm', 'pps',   'ppsx', 'ppsm', 'sldx', 'sldm', 'odp' ),
2205
-		'text'        => array( 'asc', 'csv',  'tsv',  'txt' ),
2206
-		'archive'     => array( 'bz2', 'cab',  'dmg',  'gz',   'rar',  'sea',   'sit',  'sqx',  'tar',  'tgz',  'zip', '7z' ),
2207
-		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
2208
-	) );
2209
-
2210
-	foreach ( $ext2type as $type => $exts )
2211
-		if ( in_array( $ext, $exts ) )
2198
+	$ext2type = apply_filters('ext2type', array(
2199
+		'image'       => array('jpg', 'jpeg', 'jpe', 'gif', 'png', 'bmp', 'tif', 'tiff', 'ico'),
2200
+		'audio'       => array('aac', 'ac3', 'aif', 'aiff', 'm3a', 'm4a', 'm4b', 'mka', 'mp1', 'mp2', 'mp3', 'ogg', 'oga', 'ram', 'wav', 'wma'),
2201
+		'video'       => array('3g2', '3gp', '3gpp', 'asf', 'avi', 'divx', 'dv', 'flv', 'm4v', 'mkv', 'mov', 'mp4', 'mpeg', 'mpg', 'mpv', 'ogm', 'ogv', 'qt', 'rm', 'vob', 'wmv'),
2202
+		'document'    => array('doc', 'docx', 'docm', 'dotm', 'odt', 'pages', 'pdf', 'xps', 'oxps', 'rtf', 'wp', 'wpd', 'psd', 'xcf'),
2203
+		'spreadsheet' => array('numbers', 'ods', 'xls', 'xlsx', 'xlsm', 'xlsb'),
2204
+		'interactive' => array('swf', 'key', 'ppt', 'pptx', 'pptm', 'pps', 'ppsx', 'ppsm', 'sldx', 'sldm', 'odp'),
2205
+		'text'        => array('asc', 'csv', 'tsv', 'txt'),
2206
+		'archive'     => array('bz2', 'cab', 'dmg', 'gz', 'rar', 'sea', 'sit', 'sqx', 'tar', 'tgz', 'zip', '7z'),
2207
+		'code'        => array('css', 'htm', 'html', 'php', 'js'),
2208
+	));
2209
+
2210
+	foreach ($ext2type as $type => $exts)
2211
+		if (in_array($ext, $exts))
2212 2212
 			return $type;
2213 2213
 }
2214 2214
 
@@ -2223,22 +2223,22 @@  discard block
 block discarded – undo
2223 2223
  * @param array  $mimes    Optional. Key is the file extension with value as the mime type.
2224 2224
  * @return array Values with extension first and mime type.
2225 2225
  */
2226
-function wp_check_filetype( $filename, $mimes = null ) {
2227
-	if ( empty($mimes) )
2226
+function wp_check_filetype($filename, $mimes = null) {
2227
+	if (empty($mimes))
2228 2228
 		$mimes = get_allowed_mime_types();
2229 2229
 	$type = false;
2230 2230
 	$ext = false;
2231 2231
 
2232
-	foreach ( $mimes as $ext_preg => $mime_match ) {
2233
-		$ext_preg = '!\.(' . $ext_preg . ')$!i';
2234
-		if ( preg_match( $ext_preg, $filename, $ext_matches ) ) {
2232
+	foreach ($mimes as $ext_preg => $mime_match) {
2233
+		$ext_preg = '!\.('.$ext_preg.')$!i';
2234
+		if (preg_match($ext_preg, $filename, $ext_matches)) {
2235 2235
 			$type = $mime_match;
2236 2236
 			$ext = $ext_matches[1];
2237 2237
 			break;
2238 2238
 		}
2239 2239
 	}
2240 2240
 
2241
-	return compact( 'ext', 'type' );
2241
+	return compact('ext', 'type');
2242 2242
 }
2243 2243
 
2244 2244
 /**
@@ -2260,27 +2260,27 @@  discard block
 block discarded – undo
2260 2260
  * @return array Values for the extension, MIME, and either a corrected filename or false
2261 2261
  *               if original $filename is valid.
2262 2262
  */
2263
-function wp_check_filetype_and_ext( $file, $filename, $mimes = null ) {
2263
+function wp_check_filetype_and_ext($file, $filename, $mimes = null) {
2264 2264
 	$proper_filename = false;
2265 2265
 
2266 2266
 	// Do basic extension validation and MIME mapping
2267
-	$wp_filetype = wp_check_filetype( $filename, $mimes );
2267
+	$wp_filetype = wp_check_filetype($filename, $mimes);
2268 2268
 	$ext = $wp_filetype['ext'];
2269 2269
 	$type = $wp_filetype['type'];
2270 2270
 
2271 2271
 	// We can't do any further validation without a file to work with
2272
-	if ( ! file_exists( $file ) ) {
2273
-		return compact( 'ext', 'type', 'proper_filename' );
2272
+	if ( ! file_exists($file)) {
2273
+		return compact('ext', 'type', 'proper_filename');
2274 2274
 	}
2275 2275
 
2276 2276
 	// We're able to validate images using GD
2277
-	if ( $type && 0 === strpos( $type, 'image/' ) && function_exists('getimagesize') ) {
2277
+	if ($type && 0 === strpos($type, 'image/') && function_exists('getimagesize')) {
2278 2278
 
2279 2279
 		// Attempt to figure out what type of image it actually is
2280
-		$imgstats = @getimagesize( $file );
2280
+		$imgstats = @getimagesize($file);
2281 2281
 
2282 2282
 		// If getimagesize() knows what kind of image it really is and if the real MIME doesn't match the claimed MIME
2283
-		if ( !empty($imgstats['mime']) && $imgstats['mime'] != $type ) {
2283
+		if ( ! empty($imgstats['mime']) && $imgstats['mime'] != $type) {
2284 2284
 			/**
2285 2285
 			 * Filter the list mapping image mime types to their respective extensions.
2286 2286
 			 *
@@ -2288,26 +2288,26 @@  discard block
 block discarded – undo
2288 2288
 			 *
2289 2289
 			 * @param  array $mime_to_ext Array of image mime types and their matching extensions.
2290 2290
 			 */
2291
-			$mime_to_ext = apply_filters( 'getimagesize_mimes_to_exts', array(
2291
+			$mime_to_ext = apply_filters('getimagesize_mimes_to_exts', array(
2292 2292
 				'image/jpeg' => 'jpg',
2293 2293
 				'image/png'  => 'png',
2294 2294
 				'image/gif'  => 'gif',
2295 2295
 				'image/bmp'  => 'bmp',
2296 2296
 				'image/tiff' => 'tif',
2297
-			) );
2297
+			));
2298 2298
 
2299 2299
 			// Replace whatever is after the last period in the filename with the correct extension
2300
-			if ( ! empty( $mime_to_ext[ $imgstats['mime'] ] ) ) {
2301
-				$filename_parts = explode( '.', $filename );
2302
-				array_pop( $filename_parts );
2303
-				$filename_parts[] = $mime_to_ext[ $imgstats['mime'] ];
2304
-				$new_filename = implode( '.', $filename_parts );
2300
+			if ( ! empty($mime_to_ext[$imgstats['mime']])) {
2301
+				$filename_parts = explode('.', $filename);
2302
+				array_pop($filename_parts);
2303
+				$filename_parts[] = $mime_to_ext[$imgstats['mime']];
2304
+				$new_filename = implode('.', $filename_parts);
2305 2305
 
2306
-				if ( $new_filename != $filename ) {
2306
+				if ($new_filename != $filename) {
2307 2307
 					$proper_filename = $new_filename; // Mark that it changed
2308 2308
 				}
2309 2309
 				// Redefine the extension / MIME
2310
-				$wp_filetype = wp_check_filetype( $new_filename, $mimes );
2310
+				$wp_filetype = wp_check_filetype($new_filename, $mimes);
2311 2311
 				$ext = $wp_filetype['ext'];
2312 2312
 				$type = $wp_filetype['type'];
2313 2313
 			}
@@ -2326,7 +2326,7 @@  discard block
 block discarded – undo
2326 2326
 	 *                                          $file being in a tmp directory).
2327 2327
 	 * @param array  $mimes                     Key is the file extension with value as the mime type.
2328 2328
 	 */
2329
-	return apply_filters( 'wp_check_filetype_and_ext', compact( 'ext', 'type', 'proper_filename' ), $file, $filename, $mimes );
2329
+	return apply_filters('wp_check_filetype_and_ext', compact('ext', 'type', 'proper_filename'), $file, $filename, $mimes);
2330 2330
 }
2331 2331
 
2332 2332
 /**
@@ -2349,7 +2349,7 @@  discard block
 block discarded – undo
2349 2349
 	 * @param array $wp_get_mime_types Mime types keyed by the file extension regex
2350 2350
 	 *                                 corresponding to those types.
2351 2351
 	 */
2352
-	return apply_filters( 'mime_types', array(
2352
+	return apply_filters('mime_types', array(
2353 2353
 	// Image formats.
2354 2354
 	'jpg|jpeg|jpe' => 'image/jpeg',
2355 2355
 	'gif' => 'image/gif',
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 	'key' => 'application/vnd.apple.keynote',
2450 2450
 	'numbers' => 'application/vnd.apple.numbers',
2451 2451
 	'pages' => 'application/vnd.apple.pages',
2452
-	) );
2452
+	));
2453 2453
 }
2454 2454
 /**
2455 2455
  * Retrieve list of allowed mime types and file extensions.
@@ -2460,15 +2460,15 @@  discard block
 block discarded – undo
2460 2460
  * @return array Array of mime types keyed by the file extension regex corresponding
2461 2461
  *               to those types.
2462 2462
  */
2463
-function get_allowed_mime_types( $user = null ) {
2463
+function get_allowed_mime_types($user = null) {
2464 2464
 	$t = wp_get_mime_types();
2465 2465
 
2466
-	unset( $t['swf'], $t['exe'] );
2467
-	if ( function_exists( 'current_user_can' ) )
2468
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2466
+	unset($t['swf'], $t['exe']);
2467
+	if (function_exists('current_user_can'))
2468
+		$unfiltered = $user ? user_can($user, 'unfiltered_html') : current_user_can('unfiltered_html');
2469 2469
 
2470
-	if ( empty( $unfiltered ) )
2471
-		unset( $t['htm|html'] );
2470
+	if (empty($unfiltered))
2471
+		unset($t['htm|html']);
2472 2472
 
2473 2473
 	/**
2474 2474
 	 * Filter list of allowed mime types and file extensions.
@@ -2480,7 +2480,7 @@  discard block
 block discarded – undo
2480 2480
 	 *                               removed depending on '$user' capabilities.
2481 2481
 	 * @param int|WP_User|null $user User ID, User object or null if not provided (indicates current user).
2482 2482
 	 */
2483
-	return apply_filters( 'upload_mimes', $t, $user );
2483
+	return apply_filters('upload_mimes', $t, $user);
2484 2484
 }
2485 2485
 
2486 2486
 /**
@@ -2493,18 +2493,18 @@  discard block
 block discarded – undo
2493 2493
  *
2494 2494
  * @param string $action The nonce action.
2495 2495
  */
2496
-function wp_nonce_ays( $action ) {
2497
-	if ( 'log-out' == $action ) {
2498
-		$html = sprintf( __( 'You are attempting to log out of %s' ), get_bloginfo( 'name' ) ) . '</p><p>';
2499
-		$redirect_to = isset( $_REQUEST['redirect_to'] ) ? $_REQUEST['redirect_to'] : '';
2500
-		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2496
+function wp_nonce_ays($action) {
2497
+	if ('log-out' == $action) {
2498
+		$html = sprintf(__('You are attempting to log out of %s'), get_bloginfo('name')).'</p><p>';
2499
+		$redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : '';
2500
+		$html .= sprintf(__("Do you really want to <a href='%s'>log out</a>?"), wp_logout_url($redirect_to));
2501 2501
 	} else {
2502
-		$html = __( 'Are you sure you want to do this?' );
2503
-		if ( wp_get_referer() )
2504
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2502
+		$html = __('Are you sure you want to do this?');
2503
+		if (wp_get_referer())
2504
+			$html .= "</p><p><a href='".esc_url(remove_query_arg('updated', wp_get_referer()))."'>".__('Please try again.')."</a>";
2505 2505
 	}
2506 2506
 
2507
-	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
2507
+	wp_die($html, __('WordPress Failure Notice'), 403);
2508 2508
 }
2509 2509
 
2510 2510
 /**
@@ -2540,16 +2540,16 @@  discard block
 block discarded – undo
2540 2540
  *                                  Default is the value of {@see is_rtl()}.
2541 2541
  * }
2542 2542
  */
2543
-function wp_die( $message = '', $title = '', $args = array() ) {
2543
+function wp_die($message = '', $title = '', $args = array()) {
2544 2544
 
2545
-	if ( is_int( $args ) ) {
2546
-		$args = array( 'response' => $args );
2547
-	} elseif ( is_int( $title ) ) {
2548
-		$args  = array( 'response' => $title );
2545
+	if (is_int($args)) {
2546
+		$args = array('response' => $args);
2547
+	} elseif (is_int($title)) {
2548
+		$args  = array('response' => $title);
2549 2549
 		$title = '';
2550 2550
 	}
2551 2551
 
2552
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
2552
+	if (defined('DOING_AJAX') && DOING_AJAX) {
2553 2553
 		/**
2554 2554
 		 * Filter callback for killing WordPress execution for AJAX requests.
2555 2555
 		 *
@@ -2557,8 +2557,8 @@  discard block
 block discarded – undo
2557 2557
 		 *
2558 2558
 		 * @param callable $function Callback function name.
2559 2559
 		 */
2560
-		$function = apply_filters( 'wp_die_ajax_handler', '_ajax_wp_die_handler' );
2561
-	} elseif ( defined( 'XMLRPC_REQUEST' ) && XMLRPC_REQUEST ) {
2560
+		$function = apply_filters('wp_die_ajax_handler', '_ajax_wp_die_handler');
2561
+	} elseif (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST) {
2562 2562
 		/**
2563 2563
 		 * Filter callback for killing WordPress execution for XML-RPC requests.
2564 2564
 		 *
@@ -2566,7 +2566,7 @@  discard block
 block discarded – undo
2566 2566
 		 *
2567 2567
 		 * @param callable $function Callback function name.
2568 2568
 		 */
2569
-		$function = apply_filters( 'wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler' );
2569
+		$function = apply_filters('wp_die_xmlrpc_handler', '_xmlrpc_wp_die_handler');
2570 2570
 	} else {
2571 2571
 		/**
2572 2572
 		 * Filter callback for killing WordPress execution for all non-AJAX, non-XML-RPC requests.
@@ -2575,10 +2575,10 @@  discard block
 block discarded – undo
2575 2575
 		 *
2576 2576
 		 * @param callable $function Callback function name.
2577 2577
 		 */
2578
-		$function = apply_filters( 'wp_die_handler', '_default_wp_die_handler' );
2578
+		$function = apply_filters('wp_die_handler', '_default_wp_die_handler');
2579 2579
 	}
2580 2580
 
2581
-	call_user_func( $function, $message, $title, $args );
2581
+	call_user_func($function, $message, $title, $args);
2582 2582
 }
2583 2583
 
2584 2584
 /**
@@ -2594,20 +2594,20 @@  discard block
 block discarded – undo
2594 2594
  * @param string       $title   Optional. Error title. Default empty.
2595 2595
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2596 2596
  */
2597
-function _default_wp_die_handler( $message, $title = '', $args = array() ) {
2598
-	$defaults = array( 'response' => 500 );
2597
+function _default_wp_die_handler($message, $title = '', $args = array()) {
2598
+	$defaults = array('response' => 500);
2599 2599
 	$r = wp_parse_args($args, $defaults);
2600 2600
 
2601 2601
 	$have_gettext = function_exists('__');
2602 2602
 
2603
-	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2604
-		if ( empty( $title ) ) {
2603
+	if (function_exists('is_wp_error') && is_wp_error($message)) {
2604
+		if (empty($title)) {
2605 2605
 			$error_data = $message->get_error_data();
2606
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2606
+			if (is_array($error_data) && isset($error_data['title']))
2607 2607
 				$title = $error_data['title'];
2608 2608
 		}
2609 2609
 		$errors = $message->get_error_messages();
2610
-		switch ( count( $errors ) ) {
2610
+		switch (count($errors)) {
2611 2611
 		case 0 :
2612 2612
 			$message = '';
2613 2613
 			break;
@@ -2615,38 +2615,38 @@  discard block
 block discarded – undo
2615 2615
 			$message = "<p>{$errors[0]}</p>";
2616 2616
 			break;
2617 2617
 		default :
2618
-			$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $errors ) . "</li>\n\t</ul>";
2618
+			$message = "<ul>\n\t\t<li>".join("</li>\n\t\t<li>", $errors)."</li>\n\t</ul>";
2619 2619
 			break;
2620 2620
 		}
2621
-	} elseif ( is_string( $message ) ) {
2621
+	} elseif (is_string($message)) {
2622 2622
 		$message = "<p>$message</p>";
2623 2623
 	}
2624 2624
 
2625
-	if ( isset( $r['back_link'] ) && $r['back_link'] ) {
2626
-		$back_text = $have_gettext? __('&laquo; Back') : '&laquo; Back';
2625
+	if (isset($r['back_link']) && $r['back_link']) {
2626
+		$back_text = $have_gettext ? __('&laquo; Back') : '&laquo; Back';
2627 2627
 		$message .= "\n<p><a href='javascript:history.back()'>$back_text</a></p>";
2628 2628
 	}
2629 2629
 
2630
-	if ( ! did_action( 'admin_head' ) ) :
2631
-		if ( !headers_sent() ) {
2632
-			status_header( $r['response'] );
2630
+	if ( ! did_action('admin_head')) :
2631
+		if ( ! headers_sent()) {
2632
+			status_header($r['response']);
2633 2633
 			nocache_headers();
2634
-			header( 'Content-Type: text/html; charset=utf-8' );
2634
+			header('Content-Type: text/html; charset=utf-8');
2635 2635
 		}
2636 2636
 
2637
-		if ( empty($title) )
2637
+		if (empty($title))
2638 2638
 			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2639 2639
 
2640 2640
 		$text_direction = 'ltr';
2641
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2641
+		if (isset($r['text_direction']) && 'rtl' == $r['text_direction'])
2642 2642
 			$text_direction = 'rtl';
2643
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2643
+		elseif (function_exists('is_rtl') && is_rtl())
2644 2644
 			$text_direction = 'rtl';
2645 2645
 ?>
2646 2646
 <!DOCTYPE html>
2647 2647
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2648 2648
 -->
2649
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2649
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if (function_exists('language_attributes') && function_exists('is_rtl')) language_attributes(); else echo "dir='$text_direction'"; ?>>
2650 2650
 <head>
2651 2651
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2652 2652
 	<meta name="viewport" content="width=device-width">
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 		}
2763 2763
 
2764 2764
 		<?php
2765
-		if ( 'rtl' == $text_direction ) {
2765
+		if ('rtl' == $text_direction) {
2766 2766
 			echo 'body { font-family: Tahoma, Arial; }';
2767 2767
 		}
2768 2768
 		?>
@@ -2791,15 +2791,15 @@  discard block
 block discarded – undo
2791 2791
  * @param string       $title   Optional. Error title. Default empty.
2792 2792
  * @param string|array $args    Optional. Arguments to control behavior. Default empty array.
2793 2793
  */
2794
-function _xmlrpc_wp_die_handler( $message, $title = '', $args = array() ) {
2794
+function _xmlrpc_wp_die_handler($message, $title = '', $args = array()) {
2795 2795
 	global $wp_xmlrpc_server;
2796
-	$defaults = array( 'response' => 500 );
2796
+	$defaults = array('response' => 500);
2797 2797
 
2798 2798
 	$r = wp_parse_args($args, $defaults);
2799 2799
 
2800
-	if ( $wp_xmlrpc_server ) {
2801
-		$error = new IXR_Error( $r['response'] , $message);
2802
-		$wp_xmlrpc_server->output( $error->getXml() );
2800
+	if ($wp_xmlrpc_server) {
2801
+		$error = new IXR_Error($r['response'], $message);
2802
+		$wp_xmlrpc_server->output($error->getXml());
2803 2803
 	}
2804 2804
 	die();
2805 2805
 }
@@ -2814,10 +2814,10 @@  discard block
 block discarded – undo
2814 2814
  *
2815 2815
  * @param string $message Optional. Response to print. Default empty.
2816 2816
  */
2817
-function _ajax_wp_die_handler( $message = '' ) {
2818
-	if ( is_scalar( $message ) )
2819
-		die( (string) $message );
2820
-	die( '0' );
2817
+function _ajax_wp_die_handler($message = '') {
2818
+	if (is_scalar($message))
2819
+		die((string) $message);
2820
+	die('0');
2821 2821
 }
2822 2822
 
2823 2823
 /**
@@ -2830,9 +2830,9 @@  discard block
 block discarded – undo
2830 2830
  *
2831 2831
  * @param string $message Optional. Response to print. Default empty.
2832 2832
  */
2833
-function _scalar_wp_die_handler( $message = '' ) {
2834
-	if ( is_scalar( $message ) )
2835
-		die( (string) $message );
2833
+function _scalar_wp_die_handler($message = '') {
2834
+	if (is_scalar($message))
2835
+		die((string) $message);
2836 2836
 	die();
2837 2837
 }
2838 2838
 
@@ -2847,39 +2847,39 @@  discard block
 block discarded – undo
2847 2847
  *                       greater than 0. Default 512.
2848 2848
  * @return string|false The JSON encoded string, or false if it cannot be encoded.
2849 2849
  */
2850
-function wp_json_encode( $data, $options = 0, $depth = 512 ) {
2850
+function wp_json_encode($data, $options = 0, $depth = 512) {
2851 2851
 	/*
2852 2852
 	 * json_encode() has had extra params added over the years.
2853 2853
 	 * $options was added in 5.3, and $depth in 5.5.
2854 2854
 	 * We need to make sure we call it with the correct arguments.
2855 2855
 	 */
2856
-	if ( version_compare( PHP_VERSION, '5.5', '>=' ) ) {
2857
-		$args = array( $data, $options, $depth );
2858
-	} elseif ( version_compare( PHP_VERSION, '5.3', '>=' ) ) {
2859
-		$args = array( $data, $options );
2856
+	if (version_compare(PHP_VERSION, '5.5', '>=')) {
2857
+		$args = array($data, $options, $depth);
2858
+	} elseif (version_compare(PHP_VERSION, '5.3', '>=')) {
2859
+		$args = array($data, $options);
2860 2860
 	} else {
2861
-		$args = array( $data );
2861
+		$args = array($data);
2862 2862
 	}
2863 2863
 
2864 2864
 	// Prepare the data for JSON serialization.
2865
-	$data = _wp_json_prepare_data( $data );
2865
+	$data = _wp_json_prepare_data($data);
2866 2866
 
2867
-	$json = @call_user_func_array( 'json_encode', $args );
2867
+	$json = @call_user_func_array('json_encode', $args);
2868 2868
 
2869 2869
 	// If json_encode() was successful, no need to do more sanity checking.
2870 2870
 	// ... unless we're in an old version of PHP, and json_encode() returned
2871 2871
 	// a string containing 'null'. Then we need to do more sanity checking.
2872
-	if ( false !== $json && ( version_compare( PHP_VERSION, '5.5', '>=' ) || false === strpos( $json, 'null' ) ) )  {
2872
+	if (false !== $json && (version_compare(PHP_VERSION, '5.5', '>=') || false === strpos($json, 'null'))) {
2873 2873
 		return $json;
2874 2874
 	}
2875 2875
 
2876 2876
 	try {
2877
-		$args[0] = _wp_json_sanity_check( $data, $depth );
2878
-	} catch ( Exception $e ) {
2877
+		$args[0] = _wp_json_sanity_check($data, $depth);
2878
+	} catch (Exception $e) {
2879 2879
 		return false;
2880 2880
 	}
2881 2881
 
2882
-	return call_user_func_array( 'json_encode', $args );
2882
+	return call_user_func_array('json_encode', $args);
2883 2883
 }
2884 2884
 
2885 2885
 /**
@@ -2895,49 +2895,49 @@  discard block
 block discarded – undo
2895 2895
  * @param int   $depth Maximum depth to walk through $data. Must be greater than 0.
2896 2896
  * @return mixed The sanitized data that shall be encoded to JSON.
2897 2897
  */
2898
-function _wp_json_sanity_check( $data, $depth ) {
2899
-	if ( $depth < 0 ) {
2900
-		throw new Exception( 'Reached depth limit' );
2898
+function _wp_json_sanity_check($data, $depth) {
2899
+	if ($depth < 0) {
2900
+		throw new Exception('Reached depth limit');
2901 2901
 	}
2902 2902
 
2903
-	if ( is_array( $data ) ) {
2903
+	if (is_array($data)) {
2904 2904
 		$output = array();
2905
-		foreach ( $data as $id => $el ) {
2905
+		foreach ($data as $id => $el) {
2906 2906
 			// Don't forget to sanitize the ID!
2907
-			if ( is_string( $id ) ) {
2908
-				$clean_id = _wp_json_convert_string( $id );
2907
+			if (is_string($id)) {
2908
+				$clean_id = _wp_json_convert_string($id);
2909 2909
 			} else {
2910 2910
 				$clean_id = $id;
2911 2911
 			}
2912 2912
 
2913 2913
 			// Check the element type, so that we're only recursing if we really have to.
2914
-			if ( is_array( $el ) || is_object( $el ) ) {
2915
-				$output[ $clean_id ] = _wp_json_sanity_check( $el, $depth - 1 );
2916
-			} elseif ( is_string( $el ) ) {
2917
-				$output[ $clean_id ] = _wp_json_convert_string( $el );
2914
+			if (is_array($el) || is_object($el)) {
2915
+				$output[$clean_id] = _wp_json_sanity_check($el, $depth - 1);
2916
+			} elseif (is_string($el)) {
2917
+				$output[$clean_id] = _wp_json_convert_string($el);
2918 2918
 			} else {
2919
-				$output[ $clean_id ] = $el;
2919
+				$output[$clean_id] = $el;
2920 2920
 			}
2921 2921
 		}
2922
-	} elseif ( is_object( $data ) ) {
2922
+	} elseif (is_object($data)) {
2923 2923
 		$output = new stdClass;
2924
-		foreach ( $data as $id => $el ) {
2925
-			if ( is_string( $id ) ) {
2926
-				$clean_id = _wp_json_convert_string( $id );
2924
+		foreach ($data as $id => $el) {
2925
+			if (is_string($id)) {
2926
+				$clean_id = _wp_json_convert_string($id);
2927 2927
 			} else {
2928 2928
 				$clean_id = $id;
2929 2929
 			}
2930 2930
 
2931
-			if ( is_array( $el ) || is_object( $el ) ) {
2932
-				$output->$clean_id = _wp_json_sanity_check( $el, $depth - 1 );
2933
-			} elseif ( is_string( $el ) ) {
2934
-				$output->$clean_id = _wp_json_convert_string( $el );
2931
+			if (is_array($el) || is_object($el)) {
2932
+				$output->$clean_id = _wp_json_sanity_check($el, $depth - 1);
2933
+			} elseif (is_string($el)) {
2934
+				$output->$clean_id = _wp_json_convert_string($el);
2935 2935
 			} else {
2936 2936
 				$output->$clean_id = $el;
2937 2937
 			}
2938 2938
 		}
2939
-	} elseif ( is_string( $data ) ) {
2940
-		return _wp_json_convert_string( $data );
2939
+	} elseif (is_string($data)) {
2940
+		return _wp_json_convert_string($data);
2941 2941
 	} else {
2942 2942
 		return $data;
2943 2943
 	}
@@ -2959,21 +2959,21 @@  discard block
 block discarded – undo
2959 2959
  * @param string $string The string which is to be converted.
2960 2960
  * @return string The checked string.
2961 2961
  */
2962
-function _wp_json_convert_string( $string ) {
2962
+function _wp_json_convert_string($string) {
2963 2963
 	static $use_mb = null;
2964
-	if ( is_null( $use_mb ) ) {
2965
-		$use_mb = function_exists( 'mb_convert_encoding' );
2964
+	if (is_null($use_mb)) {
2965
+		$use_mb = function_exists('mb_convert_encoding');
2966 2966
 	}
2967 2967
 
2968
-	if ( $use_mb ) {
2969
-		$encoding = mb_detect_encoding( $string, mb_detect_order(), true );
2970
-		if ( $encoding ) {
2971
-			return mb_convert_encoding( $string, 'UTF-8', $encoding );
2968
+	if ($use_mb) {
2969
+		$encoding = mb_detect_encoding($string, mb_detect_order(), true);
2970
+		if ($encoding) {
2971
+			return mb_convert_encoding($string, 'UTF-8', $encoding);
2972 2972
 		} else {
2973
-			return mb_convert_encoding( $string, 'UTF-8', 'UTF-8' );
2973
+			return mb_convert_encoding($string, 'UTF-8', 'UTF-8');
2974 2974
 		}
2975 2975
 	} else {
2976
-		return wp_check_invalid_utf8( $string, true );
2976
+		return wp_check_invalid_utf8($string, true);
2977 2977
 	}
2978 2978
 }
2979 2979
 
@@ -2989,12 +2989,12 @@  discard block
 block discarded – undo
2989 2989
  * @param mixed $data Native representation.
2990 2990
  * @return bool|int|float|null|string|array Data ready for `json_encode()`.
2991 2991
  */
2992
-function _wp_json_prepare_data( $data ) {
2993
-	if ( ! defined( 'WP_JSON_SERIALIZE_COMPATIBLE' ) || WP_JSON_SERIALIZE_COMPATIBLE === false ) {
2992
+function _wp_json_prepare_data($data) {
2993
+	if ( ! defined('WP_JSON_SERIALIZE_COMPATIBLE') || WP_JSON_SERIALIZE_COMPATIBLE === false) {
2994 2994
 		return $data;
2995 2995
 	}
2996 2996
 
2997
-	switch ( gettype( $data ) ) {
2997
+	switch (gettype($data)) {
2998 2998
 		case 'boolean':
2999 2999
 		case 'integer':
3000 3000
 		case 'double':
@@ -3005,22 +3005,22 @@  discard block
 block discarded – undo
3005 3005
 
3006 3006
 		case 'array':
3007 3007
 			// Arrays must be mapped in case they also return objects.
3008
-			return array_map( '_wp_json_prepare_data', $data );
3008
+			return array_map('_wp_json_prepare_data', $data);
3009 3009
 
3010 3010
 		case 'object':
3011 3011
 			// If this is an incomplete object (__PHP_Incomplete_Class), bail.
3012
-			if ( ! is_object( $data ) ) {
3012
+			if ( ! is_object($data)) {
3013 3013
 				return null;
3014 3014
 			}
3015 3015
 
3016
-			if ( $data instanceof JsonSerializable ) {
3016
+			if ($data instanceof JsonSerializable) {
3017 3017
 				$data = $data->jsonSerialize();
3018 3018
 			} else {
3019
-				$data = get_object_vars( $data );
3019
+				$data = get_object_vars($data);
3020 3020
 			}
3021 3021
 
3022 3022
 			// Now, pass the array (or whatever was returned from jsonSerialize through).
3023
-			return _wp_json_prepare_data( $data );
3023
+			return _wp_json_prepare_data($data);
3024 3024
 
3025 3025
 		default:
3026 3026
 			return null;
@@ -3035,10 +3035,10 @@  discard block
 block discarded – undo
3035 3035
  * @param mixed $response Variable (usually an array or object) to encode as JSON,
3036 3036
  *                        then print and die.
3037 3037
  */
3038
-function wp_send_json( $response ) {
3039
-	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3040
-	echo wp_json_encode( $response );
3041
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3038
+function wp_send_json($response) {
3039
+	@header('Content-Type: application/json; charset='.get_option('blog_charset'));
3040
+	echo wp_json_encode($response);
3041
+	if (defined('DOING_AJAX') && DOING_AJAX)
3042 3042
 		wp_die();
3043 3043
 	else
3044 3044
 		die;
@@ -3051,13 +3051,13 @@  discard block
 block discarded – undo
3051 3051
  *
3052 3052
  * @param mixed $data Data to encode as JSON, then print and die.
3053 3053
  */
3054
-function wp_send_json_success( $data = null ) {
3055
-	$response = array( 'success' => true );
3054
+function wp_send_json_success($data = null) {
3055
+	$response = array('success' => true);
3056 3056
 
3057
-	if ( isset( $data ) )
3057
+	if (isset($data))
3058 3058
 		$response['data'] = $data;
3059 3059
 
3060
-	wp_send_json( $response );
3060
+	wp_send_json($response);
3061 3061
 }
3062 3062
 
3063 3063
 /**
@@ -3074,15 +3074,15 @@  discard block
 block discarded – undo
3074 3074
  *
3075 3075
  * @param mixed $data Data to encode as JSON, then print and die.
3076 3076
  */
3077
-function wp_send_json_error( $data = null ) {
3078
-	$response = array( 'success' => false );
3077
+function wp_send_json_error($data = null) {
3078
+	$response = array('success' => false);
3079 3079
 
3080
-	if ( isset( $data ) ) {
3081
-		if ( is_wp_error( $data ) ) {
3080
+	if (isset($data)) {
3081
+		if (is_wp_error($data)) {
3082 3082
 			$result = array();
3083
-			foreach ( $data->errors as $code => $messages ) {
3084
-				foreach ( $messages as $message ) {
3085
-					$result[] = array( 'code' => $code, 'message' => $message );
3083
+			foreach ($data->errors as $code => $messages) {
3084
+				foreach ($messages as $message) {
3085
+					$result[] = array('code' => $code, 'message' => $message);
3086 3086
 				}
3087 3087
 			}
3088 3088
 
@@ -3092,7 +3092,7 @@  discard block
 block discarded – undo
3092 3092
 		}
3093 3093
 	}
3094 3094
 
3095
-	wp_send_json( $response );
3095
+	wp_send_json($response);
3096 3096
 }
3097 3097
 
3098 3098
 /**
@@ -3110,9 +3110,9 @@  discard block
 block discarded – undo
3110 3110
  * @param string $url URL for the home location.
3111 3111
  * @return string Homepage location.
3112 3112
  */
3113
-function _config_wp_home( $url = '' ) {
3114
-	if ( defined( 'WP_HOME' ) )
3115
-		return untrailingslashit( WP_HOME );
3113
+function _config_wp_home($url = '') {
3114
+	if (defined('WP_HOME'))
3115
+		return untrailingslashit(WP_HOME);
3116 3116
 	return $url;
3117 3117
 }
3118 3118
 
@@ -3131,9 +3131,9 @@  discard block
 block discarded – undo
3131 3131
  * @param string $url URL to set the WordPress site location.
3132 3132
  * @return string The WordPress Site URL.
3133 3133
  */
3134
-function _config_wp_siteurl( $url = '' ) {
3135
-	if ( defined( 'WP_SITEURL' ) )
3136
-		return untrailingslashit( WP_SITEURL );
3134
+function _config_wp_siteurl($url = '') {
3135
+	if (defined('WP_SITEURL'))
3136
+		return untrailingslashit(WP_SITEURL);
3137 3137
 	return $url;
3138 3138
 }
3139 3139
 
@@ -3154,15 +3154,15 @@  discard block
 block discarded – undo
3154 3154
  * @param array $input MCE settings array.
3155 3155
  * @return array Direction set for 'rtl', if needed by locale.
3156 3156
  */
3157
-function _mce_set_direction( $input ) {
3158
-	if ( is_rtl() ) {
3157
+function _mce_set_direction($input) {
3158
+	if (is_rtl()) {
3159 3159
 		$input['directionality'] = 'rtl';
3160 3160
 
3161
-		if ( ! empty( $input['plugins'] ) && strpos( $input['plugins'], 'directionality' ) === false ) {
3161
+		if ( ! empty($input['plugins']) && strpos($input['plugins'], 'directionality') === false) {
3162 3162
 			$input['plugins'] .= ',directionality';
3163 3163
 		}
3164 3164
 
3165
-		if ( ! empty( $input['toolbar1'] ) && ! preg_match( '/\bltr\b/', $input['toolbar1'] ) ) {
3165
+		if ( ! empty($input['toolbar1']) && ! preg_match('/\bltr\b/', $input['toolbar1'])) {
3166 3166
 			$input['toolbar1'] .= ',ltr';
3167 3167
 		}
3168 3168
 	}
@@ -3197,10 +3197,10 @@  discard block
 block discarded – undo
3197 3197
 	global $wpsmiliestrans, $wp_smiliessearch;
3198 3198
 
3199 3199
 	// don't bother setting up smilies if they are disabled
3200
-	if ( !get_option( 'use_smilies' ) )
3200
+	if ( ! get_option('use_smilies'))
3201 3201
 		return;
3202 3202
 
3203
-	if ( !isset( $wpsmiliestrans ) ) {
3203
+	if ( ! isset($wpsmiliestrans)) {
3204 3204
 		$wpsmiliestrans = array(
3205 3205
 		':mrgreen:' => 'mrgreen.png',
3206 3206
 		':neutral:' => "\xf0\x9f\x98\x90",
@@ -3264,28 +3264,28 @@  discard block
 block discarded – undo
3264 3264
 	$spaces = wp_spaces_regexp();
3265 3265
 
3266 3266
 	// Begin first "subpattern"
3267
-	$wp_smiliessearch = '/(?<=' . $spaces . '|^)';
3267
+	$wp_smiliessearch = '/(?<='.$spaces.'|^)';
3268 3268
 
3269 3269
 	$subchar = '';
3270
-	foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
3270
+	foreach ((array) $wpsmiliestrans as $smiley => $img) {
3271 3271
 		$firstchar = substr($smiley, 0, 1);
3272 3272
 		$rest = substr($smiley, 1);
3273 3273
 
3274 3274
 		// new subpattern?
3275 3275
 		if ($firstchar != $subchar) {
3276 3276
 			if ($subchar != '') {
3277
-				$wp_smiliessearch .= ')(?=' . $spaces . '|$)';  // End previous "subpattern"
3278
-				$wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern"
3277
+				$wp_smiliessearch .= ')(?='.$spaces.'|$)'; // End previous "subpattern"
3278
+				$wp_smiliessearch .= '|(?<='.$spaces.'|^)'; // Begin another "subpattern"
3279 3279
 			}
3280 3280
 			$subchar = $firstchar;
3281
-			$wp_smiliessearch .= preg_quote($firstchar, '/') . '(?:';
3281
+			$wp_smiliessearch .= preg_quote($firstchar, '/').'(?:';
3282 3282
 		} else {
3283 3283
 			$wp_smiliessearch .= '|';
3284 3284
 		}
3285 3285
 		$wp_smiliessearch .= preg_quote($rest, '/');
3286 3286
 	}
3287 3287
 
3288
-	$wp_smiliessearch .= ')(?=' . $spaces . '|$)/m';
3288
+	$wp_smiliessearch .= ')(?='.$spaces.'|$)/m';
3289 3289
 
3290 3290
 }
3291 3291
 
@@ -3301,16 +3301,16 @@  discard block
 block discarded – undo
3301 3301
  * @param array        $defaults Optional. Array that serves as the defaults. Default empty.
3302 3302
  * @return array Merged user defined values with defaults.
3303 3303
  */
3304
-function wp_parse_args( $args, $defaults = '' ) {
3305
-	if ( is_object( $args ) )
3306
-		$r = get_object_vars( $args );
3307
-	elseif ( is_array( $args ) )
3308
-		$r =& $args;
3304
+function wp_parse_args($args, $defaults = '') {
3305
+	if (is_object($args))
3306
+		$r = get_object_vars($args);
3307
+	elseif (is_array($args))
3308
+		$r = & $args;
3309 3309
 	else
3310
-		wp_parse_str( $args, $r );
3310
+		wp_parse_str($args, $r);
3311 3311
 
3312
-	if ( is_array( $defaults ) )
3313
-		return array_merge( $defaults, $r );
3312
+	if (is_array($defaults))
3313
+		return array_merge($defaults, $r);
3314 3314
 	return $r;
3315 3315
 }
3316 3316
 
@@ -3322,8 +3322,8 @@  discard block
 block discarded – undo
3322 3322
  * @param array|string $list List of ids.
3323 3323
  * @return array Sanitized array of IDs.
3324 3324
  */
3325
-function wp_parse_id_list( $list ) {
3326
-	if ( !is_array($list) )
3325
+function wp_parse_id_list($list) {
3326
+	if ( ! is_array($list))
3327 3327
 		$list = preg_split('/[\s,]+/', $list);
3328 3328
 
3329 3329
 	return array_unique(array_map('absint', $list));
@@ -3338,11 +3338,11 @@  discard block
 block discarded – undo
3338 3338
  * @param array $keys  The list of keys.
3339 3339
  * @return array The array slice.
3340 3340
  */
3341
-function wp_array_slice_assoc( $array, $keys ) {
3341
+function wp_array_slice_assoc($array, $keys) {
3342 3342
 	$slice = array();
3343
-	foreach ( $keys as $key )
3344
-		if ( isset( $array[ $key ] ) )
3345
-			$slice[ $key ] = $array[ $key ];
3343
+	foreach ($keys as $key)
3344
+		if (isset($array[$key]))
3345
+			$slice[$key] = $array[$key];
3346 3346
 
3347 3347
 	return $slice;
3348 3348
 }
@@ -3355,14 +3355,14 @@  discard block
 block discarded – undo
3355 3355
  * @param mixed $data Variable to check.
3356 3356
  * @return bool Whether the variable is a list.
3357 3357
  */
3358
-function wp_is_numeric_array( $data ) {
3359
-	if ( ! is_array( $data ) ) {
3358
+function wp_is_numeric_array($data) {
3359
+	if ( ! is_array($data)) {
3360 3360
 		return false;
3361 3361
 	}
3362 3362
 
3363
-	$keys = array_keys( $data );
3364
-	$string_keys = array_filter( $keys, 'is_string' );
3365
-	return count( $string_keys ) === 0;
3363
+	$keys = array_keys($data);
3364
+	$string_keys = array_filter($keys, 'is_string');
3365
+	return count($string_keys) === 0;
3366 3366
 }
3367 3367
 
3368 3368
 /**
@@ -3381,14 +3381,14 @@  discard block
 block discarded – undo
3381 3381
  *                              Default false.
3382 3382
  * @return array A list of objects or object fields.
3383 3383
  */
3384
-function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3385
-	if ( ! is_array( $list ) )
3384
+function wp_filter_object_list($list, $args = array(), $operator = 'and', $field = false) {
3385
+	if ( ! is_array($list))
3386 3386
 		return array();
3387 3387
 
3388
-	$list = wp_list_filter( $list, $args, $operator );
3388
+	$list = wp_list_filter($list, $args, $operator);
3389 3389
 
3390
-	if ( $field )
3391
-		$list = wp_list_pluck( $list, $field );
3390
+	if ($field)
3391
+		$list = wp_list_pluck($list, $field);
3392 3392
 
3393 3393
 	return $list;
3394 3394
 }
@@ -3407,29 +3407,29 @@  discard block
 block discarded – undo
3407 3407
  *                         match. Default 'AND'.
3408 3408
  * @return array Array of found values.
3409 3409
  */
3410
-function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3411
-	if ( ! is_array( $list ) )
3410
+function wp_list_filter($list, $args = array(), $operator = 'AND') {
3411
+	if ( ! is_array($list))
3412 3412
 		return array();
3413 3413
 
3414
-	if ( empty( $args ) )
3414
+	if (empty($args))
3415 3415
 		return $list;
3416 3416
 
3417
-	$operator = strtoupper( $operator );
3418
-	$count = count( $args );
3417
+	$operator = strtoupper($operator);
3418
+	$count = count($args);
3419 3419
 	$filtered = array();
3420 3420
 
3421
-	foreach ( $list as $key => $obj ) {
3421
+	foreach ($list as $key => $obj) {
3422 3422
 		$to_match = (array) $obj;
3423 3423
 
3424 3424
 		$matched = 0;
3425
-		foreach ( $args as $m_key => $m_value ) {
3426
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3425
+		foreach ($args as $m_key => $m_value) {
3426
+			if (array_key_exists($m_key, $to_match) && $m_value == $to_match[$m_key])
3427 3427
 				$matched++;
3428 3428
 		}
3429 3429
 
3430
-		if ( ( 'AND' == $operator && $matched == $count )
3431
-		  || ( 'OR' == $operator && $matched > 0 )
3432
-		  || ( 'NOT' == $operator && 0 == $matched ) ) {
3430
+		if (('AND' == $operator && $matched == $count)
3431
+		  || ('OR' == $operator && $matched > 0)
3432
+		  || ('NOT' == $operator && 0 == $matched)) {
3433 3433
 			$filtered[$key] = $obj;
3434 3434
 		}
3435 3435
 	}
@@ -3454,17 +3454,17 @@  discard block
 block discarded – undo
3454 3454
  *               corresponding to `$index_key`. If `$index_key` is null, array keys from the original
3455 3455
  *               `$list` will be preserved in the results.
3456 3456
  */
3457
-function wp_list_pluck( $list, $field, $index_key = null ) {
3458
-	if ( ! $index_key ) {
3457
+function wp_list_pluck($list, $field, $index_key = null) {
3458
+	if ( ! $index_key) {
3459 3459
 		/*
3460 3460
 		 * This is simple. Could at some point wrap array_column()
3461 3461
 		 * if we knew we had an array of arrays.
3462 3462
 		 */
3463
-		foreach ( $list as $key => $value ) {
3464
-			if ( is_object( $value ) ) {
3465
-				$list[ $key ] = $value->$field;
3463
+		foreach ($list as $key => $value) {
3464
+			if (is_object($value)) {
3465
+				$list[$key] = $value->$field;
3466 3466
 			} else {
3467
-				$list[ $key ] = $value[ $field ];
3467
+				$list[$key] = $value[$field];
3468 3468
 			}
3469 3469
 		}
3470 3470
 		return $list;
@@ -3475,18 +3475,18 @@  discard block
 block discarded – undo
3475 3475
 	 * to the end of the stack. This is how array_column() behaves.
3476 3476
 	 */
3477 3477
 	$newlist = array();
3478
-	foreach ( $list as $value ) {
3479
-		if ( is_object( $value ) ) {
3480
-			if ( isset( $value->$index_key ) ) {
3481
-				$newlist[ $value->$index_key ] = $value->$field;
3478
+	foreach ($list as $value) {
3479
+		if (is_object($value)) {
3480
+			if (isset($value->$index_key)) {
3481
+				$newlist[$value->$index_key] = $value->$field;
3482 3482
 			} else {
3483 3483
 				$newlist[] = $value->$field;
3484 3484
 			}
3485 3485
 		} else {
3486
-			if ( isset( $value[ $index_key ] ) ) {
3487
-				$newlist[ $value[ $index_key ] ] = $value[ $field ];
3486
+			if (isset($value[$index_key])) {
3487
+				$newlist[$value[$index_key]] = $value[$field];
3488 3488
 			} else {
3489
-				$newlist[] = $value[ $field ];
3489
+				$newlist[] = $value[$field];
3490 3490
 			}
3491 3491
 		}
3492 3492
 	}
@@ -3514,13 +3514,13 @@  discard block
 block discarded – undo
3514 3514
 	 * @param bool $wp_maybe_load_widgets Whether to load the Widgets library.
3515 3515
 	 *                                    Default true.
3516 3516
 	 */
3517
-	if ( ! apply_filters( 'load_default_widgets', true ) ) {
3517
+	if ( ! apply_filters('load_default_widgets', true)) {
3518 3518
 		return;
3519 3519
 	}
3520 3520
 
3521
-	require_once( ABSPATH . WPINC . '/default-widgets.php' );
3521
+	require_once(ABSPATH.WPINC.'/default-widgets.php');
3522 3522
 
3523
-	add_action( '_admin_menu', 'wp_widgets_add_menu' );
3523
+	add_action('_admin_menu', 'wp_widgets_add_menu');
3524 3524
 }
3525 3525
 
3526 3526
 /**
@@ -3533,11 +3533,11 @@  discard block
 block discarded – undo
3533 3533
 function wp_widgets_add_menu() {
3534 3534
 	global $submenu;
3535 3535
 
3536
-	if ( ! current_theme_supports( 'widgets' ) )
3536
+	if ( ! current_theme_supports('widgets'))
3537 3537
 		return;
3538 3538
 
3539
-	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3540
-	ksort( $submenu['themes.php'], SORT_NUMERIC );
3539
+	$submenu['themes.php'][7] = array(__('Widgets'), 'edit_theme_options', 'widgets.php');
3540
+	ksort($submenu['themes.php'], SORT_NUMERIC);
3541 3541
 }
3542 3542
 
3543 3543
 /**
@@ -3549,7 +3549,7 @@  discard block
 block discarded – undo
3549 3549
  */
3550 3550
 function wp_ob_end_flush_all() {
3551 3551
 	$levels = ob_get_level();
3552
-	for ($i=0; $i<$levels; $i++)
3552
+	for ($i = 0; $i < $levels; $i++)
3553 3553
 		ob_end_flush();
3554 3554
 }
3555 3555
 
@@ -3577,29 +3577,29 @@  discard block
 block discarded – undo
3577 3577
 	wp_load_translations_early();
3578 3578
 
3579 3579
 	// Load custom DB error template, if present.
3580
-	if ( file_exists( WP_CONTENT_DIR . '/db-error.php' ) ) {
3581
-		require_once( WP_CONTENT_DIR . '/db-error.php' );
3580
+	if (file_exists(WP_CONTENT_DIR.'/db-error.php')) {
3581
+		require_once(WP_CONTENT_DIR.'/db-error.php');
3582 3582
 		die();
3583 3583
 	}
3584 3584
 
3585 3585
 	// If installing or in the admin, provide the verbose message.
3586
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3586
+	if (wp_installing() || defined('WP_ADMIN'))
3587 3587
 		wp_die($wpdb->error);
3588 3588
 
3589 3589
 	// Otherwise, be terse.
3590
-	status_header( 500 );
3590
+	status_header(500);
3591 3591
 	nocache_headers();
3592
-	header( 'Content-Type: text/html; charset=utf-8' );
3592
+	header('Content-Type: text/html; charset=utf-8');
3593 3593
 ?>
3594 3594
 <!DOCTYPE html>
3595
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3595
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
3596 3596
 <head>
3597 3597
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3598
-	<title><?php _e( 'Database Error' ); ?></title>
3598
+	<title><?php _e('Database Error'); ?></title>
3599 3599
 
3600 3600
 </head>
3601 3601
 <body>
3602
-	<h1><?php _e( 'Error establishing a database connection' ); ?></h1>
3602
+	<h1><?php _e('Error establishing a database connection'); ?></h1>
3603 3603
 </body>
3604 3604
 </html>
3605 3605
 <?php
@@ -3614,8 +3614,8 @@  discard block
 block discarded – undo
3614 3614
  * @param mixed $maybeint Data you wish to have converted to a non-negative integer.
3615 3615
  * @return int A non-negative integer.
3616 3616
  */
3617
-function absint( $maybeint ) {
3618
-	return abs( intval( $maybeint ) );
3617
+function absint($maybeint) {
3618
+	return abs(intval($maybeint));
3619 3619
 }
3620 3620
 
3621 3621
 /**
@@ -3636,7 +3636,7 @@  discard block
 block discarded – undo
3636 3636
  * @param string $version     The version of WordPress that deprecated the function.
3637 3637
  * @param string $replacement Optional. The function that should have been called. Default null.
3638 3638
  */
3639
-function _deprecated_function( $function, $version, $replacement = null ) {
3639
+function _deprecated_function($function, $version, $replacement = null) {
3640 3640
 
3641 3641
 	/**
3642 3642
 	 * Fires when a deprecated function is called.
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
 	 * @param string $replacement The function that should have been called.
3648 3648
 	 * @param string $version     The version of WordPress that deprecated the function.
3649 3649
 	 */
3650
-	do_action( 'deprecated_function_run', $function, $replacement, $version );
3650
+	do_action('deprecated_function_run', $function, $replacement, $version);
3651 3651
 
3652 3652
 	/**
3653 3653
 	 * Filter whether to trigger an error for deprecated functions.
@@ -3656,17 +3656,17 @@  discard block
 block discarded – undo
3656 3656
 	 *
3657 3657
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3658 3658
 	 */
3659
-	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3660
-		if ( function_exists( '__' ) ) {
3661
-			if ( ! is_null( $replacement ) )
3662
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3659
+	if (WP_DEBUG && apply_filters('deprecated_function_trigger_error', true)) {
3660
+		if (function_exists('__')) {
3661
+			if ( ! is_null($replacement))
3662
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement));
3663 3663
 			else
3664
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3664
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3665 3665
 		} else {
3666
-			if ( ! is_null( $replacement ) )
3667
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3666
+			if ( ! is_null($replacement))
3667
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement));
3668 3668
 			else
3669
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3669
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3670 3670
 		}
3671 3671
 	}
3672 3672
 }
@@ -3691,7 +3691,7 @@  discard block
 block discarded – undo
3691 3691
  * @param string $parent_class Optional. The parent class calling the deprecated constructor.
3692 3692
  *                             Default empty string.
3693 3693
  */
3694
-function _deprecated_constructor( $class, $version, $parent_class = '' ) {
3694
+function _deprecated_constructor($class, $version, $parent_class = '') {
3695 3695
 
3696 3696
 	/**
3697 3697
 	 * Fires when a deprecated constructor is called.
@@ -3703,7 +3703,7 @@  discard block
 block discarded – undo
3703 3703
 	 * @param string $version      The version of WordPress that deprecated the function.
3704 3704
 	 * @param string $parent_class The parent class calling the deprecated constructor.
3705 3705
 	 */
3706
-	do_action( 'deprecated_constructor_run', $class, $version, $parent_class );
3706
+	do_action('deprecated_constructor_run', $class, $version, $parent_class);
3707 3707
 
3708 3708
 	/**
3709 3709
 	 * Filter whether to trigger an error for deprecated functions.
@@ -3714,24 +3714,24 @@  discard block
 block discarded – undo
3714 3714
 	 *
3715 3715
 	 * @param bool $trigger Whether to trigger the error for deprecated functions. Default true.
3716 3716
 	 */
3717
-	if ( WP_DEBUG && apply_filters( 'deprecated_constructor_trigger_error', true ) ) {
3718
-		if ( function_exists( '__' ) ) {
3719
-			if ( ! empty( $parent_class ) ) {
3717
+	if (WP_DEBUG && apply_filters('deprecated_constructor_trigger_error', true)) {
3718
+		if (function_exists('__')) {
3719
+			if ( ! empty($parent_class)) {
3720 3720
 				/* translators: 1: PHP class name, 2: PHP parent class name, 3: version number, 4: __construct() method */
3721
-				trigger_error( sprintf( __( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.' ),
3722
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3721
+				trigger_error(sprintf(__('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.'),
3722
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3723 3723
 			} else {
3724 3724
 				/* translators: 1: PHP class name, 2: version number, 3: __construct() method */
3725
-				trigger_error( sprintf( __( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
3726
-					$class, $version, '<pre>__construct()</pre>' ) );
3725
+				trigger_error(sprintf(__('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'),
3726
+					$class, $version, '<pre>__construct()</pre>'));
3727 3727
 			}
3728 3728
 		} else {
3729
-			if ( ! empty( $parent_class ) ) {
3730
-				trigger_error( sprintf( 'The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3731
-					$class, $parent_class, $version, '<pre>__construct()</pre>' ) );
3729
+			if ( ! empty($parent_class)) {
3730
+				trigger_error(sprintf('The called constructor method for %1$s in %2$s is <strong>deprecated</strong> since version %3$s! Use %4$s instead.',
3731
+					$class, $parent_class, $version, '<pre>__construct()</pre>'));
3732 3732
 			} else {
3733
-				trigger_error( sprintf( 'The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3734
-					$class, $version, '<pre>__construct()</pre>' ) );
3733
+				trigger_error(sprintf('The called constructor method for %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
3734
+					$class, $version, '<pre>__construct()</pre>'));
3735 3735
 			}
3736 3736
 		}
3737 3737
 	}
@@ -3758,7 +3758,7 @@  discard block
 block discarded – undo
3758 3758
  *                            Default null.
3759 3759
  * @param string $message     Optional. A message regarding the change. Default empty.
3760 3760
  */
3761
-function _deprecated_file( $file, $version, $replacement = null, $message = '' ) {
3761
+function _deprecated_file($file, $version, $replacement = null, $message = '') {
3762 3762
 
3763 3763
 	/**
3764 3764
 	 * Fires when a deprecated file is called.
@@ -3770,7 +3770,7 @@  discard block
 block discarded – undo
3770 3770
 	 * @param string $version     The version of WordPress that deprecated the file.
3771 3771
 	 * @param string $message     A message regarding the change.
3772 3772
 	 */
3773
-	do_action( 'deprecated_file_included', $file, $replacement, $version, $message );
3773
+	do_action('deprecated_file_included', $file, $replacement, $version, $message);
3774 3774
 
3775 3775
 	/**
3776 3776
 	 * Filter whether to trigger an error for deprecated files.
@@ -3779,18 +3779,18 @@  discard block
 block discarded – undo
3779 3779
 	 *
3780 3780
 	 * @param bool $trigger Whether to trigger the error for deprecated files. Default true.
3781 3781
 	 */
3782
-	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3783
-		$message = empty( $message ) ? '' : ' ' . $message;
3784
-		if ( function_exists( '__' ) ) {
3785
-			if ( ! is_null( $replacement ) )
3786
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3782
+	if (WP_DEBUG && apply_filters('deprecated_file_trigger_error', true)) {
3783
+		$message = empty($message) ? '' : ' '.$message;
3784
+		if (function_exists('__')) {
3785
+			if ( ! is_null($replacement))
3786
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement).$message);
3787 3787
 			else
3788
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3788
+				trigger_error(sprintf(__('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version).$message);
3789 3789
 		} else {
3790
-			if ( ! is_null( $replacement ) )
3791
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3790
+			if ( ! is_null($replacement))
3791
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement).$message);
3792 3792
 			else
3793
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3793
+				trigger_error(sprintf('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version).$message);
3794 3794
 		}
3795 3795
 	}
3796 3796
 }
@@ -3820,7 +3820,7 @@  discard block
 block discarded – undo
3820 3820
  * @param string $version  The version of WordPress that deprecated the argument used.
3821 3821
  * @param string $message  Optional. A message regarding the change. Default null.
3822 3822
  */
3823
-function _deprecated_argument( $function, $version, $message = null ) {
3823
+function _deprecated_argument($function, $version, $message = null) {
3824 3824
 
3825 3825
 	/**
3826 3826
 	 * Fires when a deprecated argument is called.
@@ -3831,7 +3831,7 @@  discard block
 block discarded – undo
3831 3831
 	 * @param string $message  A message regarding the change.
3832 3832
 	 * @param string $version  The version of WordPress that deprecated the argument used.
3833 3833
 	 */
3834
-	do_action( 'deprecated_argument_run', $function, $message, $version );
3834
+	do_action('deprecated_argument_run', $function, $message, $version);
3835 3835
 
3836 3836
 	/**
3837 3837
 	 * Filter whether to trigger an error for deprecated arguments.
@@ -3840,17 +3840,17 @@  discard block
 block discarded – undo
3840 3840
 	 *
3841 3841
 	 * @param bool $trigger Whether to trigger the error for deprecated arguments. Default true.
3842 3842
 	 */
3843
-	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3844
-		if ( function_exists( '__' ) ) {
3845
-			if ( ! is_null( $message ) )
3846
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3843
+	if (WP_DEBUG && apply_filters('deprecated_argument_trigger_error', true)) {
3844
+		if (function_exists('__')) {
3845
+			if ( ! is_null($message))
3846
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message));
3847 3847
 			else
3848
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3848
+				trigger_error(sprintf(__('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version));
3849 3849
 		} else {
3850
-			if ( ! is_null( $message ) )
3851
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3850
+			if ( ! is_null($message))
3851
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message));
3852 3852
 			else
3853
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3853
+				trigger_error(sprintf('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version));
3854 3854
 		}
3855 3855
 	}
3856 3856
 }
@@ -3871,7 +3871,7 @@  discard block
 block discarded – undo
3871 3871
  * @param string $message  A message explaining what has been done incorrectly.
3872 3872
  * @param string $version  The version of WordPress where the message was added.
3873 3873
  */
3874
-function _doing_it_wrong( $function, $message, $version ) {
3874
+function _doing_it_wrong($function, $message, $version) {
3875 3875
 
3876 3876
 	/**
3877 3877
 	 * Fires when the given function is being used incorrectly.
@@ -3882,7 +3882,7 @@  discard block
 block discarded – undo
3882 3882
 	 * @param string $message  A message explaining what has been done incorrectly.
3883 3883
 	 * @param string $version  The version of WordPress where the message was added.
3884 3884
 	 */
3885
-	do_action( 'doing_it_wrong_run', $function, $message, $version );
3885
+	do_action('doing_it_wrong_run', $function, $message, $version);
3886 3886
 
3887 3887
 	/**
3888 3888
 	 * Filter whether to trigger an error for _doing_it_wrong() calls.
@@ -3891,20 +3891,20 @@  discard block
 block discarded – undo
3891 3891
 	 *
3892 3892
 	 * @param bool $trigger Whether to trigger the error for _doing_it_wrong() calls. Default true.
3893 3893
 	 */
3894
-	if ( WP_DEBUG && apply_filters( 'doing_it_wrong_trigger_error', true ) ) {
3895
-		if ( function_exists( '__' ) ) {
3896
-			$version = is_null( $version ) ? '' : sprintf( __( '(This message was added in version %s.)' ), $version );
3894
+	if (WP_DEBUG && apply_filters('doing_it_wrong_trigger_error', true)) {
3895
+		if (function_exists('__')) {
3896
+			$version = is_null($version) ? '' : sprintf(__('(This message was added in version %s.)'), $version);
3897 3897
 			/* translators: %s: Codex URL */
3898
-			$message .= ' ' . sprintf( __( 'Please see <a href="%s">Debugging in WordPress</a> for more information.' ),
3899
-				__( 'https://codex.wordpress.org/Debugging_in_WordPress' )
3898
+			$message .= ' '.sprintf(__('Please see <a href="%s">Debugging in WordPress</a> for more information.'),
3899
+				__('https://codex.wordpress.org/Debugging_in_WordPress')
3900 3900
 			);
3901
-			trigger_error( sprintf( __( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s' ), $function, $message, $version ) );
3901
+			trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s'), $function, $message, $version));
3902 3902
 		} else {
3903
-			$version = is_null( $version ) ? '' : sprintf( '(This message was added in version %s.)', $version );
3904
-			$message .= sprintf( ' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3903
+			$version = is_null($version) ? '' : sprintf('(This message was added in version %s.)', $version);
3904
+			$message .= sprintf(' Please see <a href="%s">Debugging in WordPress</a> for more information.',
3905 3905
 				'https://codex.wordpress.org/Debugging_in_WordPress'
3906 3906
 			);
3907
-			trigger_error( sprintf( '%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version ) );
3907
+			trigger_error(sprintf('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', $function, $message, $version));
3908 3908
 		}
3909 3909
 	}
3910 3910
 }
@@ -3917,9 +3917,9 @@  discard block
 block discarded – undo
3917 3917
  * @return bool Whether the server is running lighttpd < 1.5.0.
3918 3918
  */
3919 3919
 function is_lighttpd_before_150() {
3920
-	$server_parts = explode( '/', isset( $_SERVER['SERVER_SOFTWARE'] )? $_SERVER['SERVER_SOFTWARE'] : '' );
3921
-	$server_parts[1] = isset( $server_parts[1] )? $server_parts[1] : '';
3922
-	return  'lighttpd' == $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' );
3920
+	$server_parts = explode('/', isset($_SERVER['SERVER_SOFTWARE']) ? $_SERVER['SERVER_SOFTWARE'] : '');
3921
+	$server_parts[1] = isset($server_parts[1]) ? $server_parts[1] : '';
3922
+	return  'lighttpd' == $server_parts[0] && -1 == version_compare($server_parts[1], '1.5.0');
3923 3923
 }
3924 3924
 
3925 3925
 /**
@@ -3936,18 +3936,18 @@  discard block
 block discarded – undo
3936 3936
 function apache_mod_loaded($mod, $default = false) {
3937 3937
 	global $is_apache;
3938 3938
 
3939
-	if ( !$is_apache )
3939
+	if ( ! $is_apache)
3940 3940
 		return false;
3941 3941
 
3942
-	if ( function_exists( 'apache_get_modules' ) ) {
3942
+	if (function_exists('apache_get_modules')) {
3943 3943
 		$mods = apache_get_modules();
3944
-		if ( in_array($mod, $mods) )
3944
+		if (in_array($mod, $mods))
3945 3945
 			return true;
3946
-	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
3946
+	} elseif (function_exists('phpinfo') && false === strpos(ini_get('disable_functions'), 'phpinfo')) {
3947 3947
 			ob_start();
3948 3948
 			phpinfo(8);
3949 3949
 			$phpinfo = ob_get_clean();
3950
-			if ( false !== strpos($phpinfo, $mod) )
3950
+			if (false !== strpos($phpinfo, $mod))
3951 3951
 				return true;
3952 3952
 	}
3953 3953
 	return $default;
@@ -3966,7 +3966,7 @@  discard block
 block discarded – undo
3966 3966
 	global $is_iis7;
3967 3967
 
3968 3968
 	$supports_permalinks = false;
3969
-	if ( $is_iis7 ) {
3969
+	if ($is_iis7) {
3970 3970
 		/* First we check if the DOMDocument class exists. If it does not exist, then we cannot
3971 3971
 		 * easily update the xml configuration file, hence we just bail out and tell user that
3972 3972
 		 * pretty permalinks cannot be used.
@@ -3976,7 +3976,7 @@  discard block
 block discarded – undo
3976 3976
 		 * Lastly we make sure that PHP is running via FastCGI. This is important because if it runs
3977 3977
 		 * via ISAPI then pretty permalinks will not work.
3978 3978
 		 */
3979
-		$supports_permalinks = class_exists( 'DOMDocument', false ) && isset($_SERVER['IIS_UrlRewriteModule']) && ( PHP_SAPI == 'cgi-fcgi' );
3979
+		$supports_permalinks = class_exists('DOMDocument', false) && isset($_SERVER['IIS_UrlRewriteModule']) && (PHP_SAPI == 'cgi-fcgi');
3980 3980
 	}
3981 3981
 
3982 3982
 	/**
@@ -3986,7 +3986,7 @@  discard block
 block discarded – undo
3986 3986
 	 *
3987 3987
 	 * @param bool $supports_permalinks Whether IIS7 supports permalinks. Default false.
3988 3988
 	 */
3989
-	return apply_filters( 'iis7_supports_permalinks', $supports_permalinks );
3989
+	return apply_filters('iis7_supports_permalinks', $supports_permalinks);
3990 3990
 }
3991 3991
 
3992 3992
 /**
@@ -4003,17 +4003,17 @@  discard block
 block discarded – undo
4003 4003
  * @param array  $allowed_files List of allowed files.
4004 4004
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4005 4005
  */
4006
-function validate_file( $file, $allowed_files = '' ) {
4007
-	if ( false !== strpos( $file, '..' ) )
4006
+function validate_file($file, $allowed_files = '') {
4007
+	if (false !== strpos($file, '..'))
4008 4008
 		return 1;
4009 4009
 
4010
-	if ( false !== strpos( $file, './' ) )
4010
+	if (false !== strpos($file, './'))
4011 4011
 		return 1;
4012 4012
 
4013
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4013
+	if ( ! empty($allowed_files) && ! in_array($file, $allowed_files))
4014 4014
 		return 3;
4015 4015
 
4016
-	if (':' == substr( $file, 1, 1 ) )
4016
+	if (':' == substr($file, 1, 1))
4017 4017
 		return 2;
4018 4018
 
4019 4019
 	return 0;
@@ -4027,12 +4027,12 @@  discard block
 block discarded – undo
4027 4027
  * @return bool True if SSL, false if not used.
4028 4028
  */
4029 4029
 function is_ssl() {
4030
-	if ( isset($_SERVER['HTTPS']) ) {
4031
-		if ( 'on' == strtolower($_SERVER['HTTPS']) )
4030
+	if (isset($_SERVER['HTTPS'])) {
4031
+		if ('on' == strtolower($_SERVER['HTTPS']))
4032 4032
 			return true;
4033
-		if ( '1' == $_SERVER['HTTPS'] )
4033
+		if ('1' == $_SERVER['HTTPS'])
4034 4034
 			return true;
4035
-	} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
4035
+	} elseif (isset($_SERVER['SERVER_PORT']) && ('443' == $_SERVER['SERVER_PORT'])) {
4036 4036
 		return true;
4037 4037
 	}
4038 4038
 	return false;
@@ -4048,10 +4048,10 @@  discard block
 block discarded – undo
4048 4048
  * @param string|bool $force Optional. Whether to force SSL in admin screens. Default null.
4049 4049
  * @return bool True if forced, false if not forced.
4050 4050
  */
4051
-function force_ssl_admin( $force = null ) {
4051
+function force_ssl_admin($force = null) {
4052 4052
 	static $forced = false;
4053 4053
 
4054
-	if ( !is_null( $force ) ) {
4054
+	if ( ! is_null($force)) {
4055 4055
 		$old_forced = $forced;
4056 4056
 		$forced = $force;
4057 4057
 		return $old_forced;
@@ -4071,39 +4071,39 @@  discard block
 block discarded – undo
4071 4071
  * @return string The guessed URL.
4072 4072
  */
4073 4073
 function wp_guess_url() {
4074
-	if ( defined('WP_SITEURL') && '' != WP_SITEURL ) {
4074
+	if (defined('WP_SITEURL') && '' != WP_SITEURL) {
4075 4075
 		$url = WP_SITEURL;
4076 4076
 	} else {
4077
-		$abspath_fix = str_replace( '\\', '/', ABSPATH );
4078
-		$script_filename_dir = dirname( $_SERVER['SCRIPT_FILENAME'] );
4077
+		$abspath_fix = str_replace('\\', '/', ABSPATH);
4078
+		$script_filename_dir = dirname($_SERVER['SCRIPT_FILENAME']);
4079 4079
 
4080 4080
 		// The request is for the admin
4081
-		if ( strpos( $_SERVER['REQUEST_URI'], 'wp-admin' ) !== false || strpos( $_SERVER['REQUEST_URI'], 'wp-login.php' ) !== false ) {
4082
-			$path = preg_replace( '#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI'] );
4081
+		if (strpos($_SERVER['REQUEST_URI'], 'wp-admin') !== false || strpos($_SERVER['REQUEST_URI'], 'wp-login.php') !== false) {
4082
+			$path = preg_replace('#/(wp-admin/.*|wp-login.php)#i', '', $_SERVER['REQUEST_URI']);
4083 4083
 
4084 4084
 		// The request is for a file in ABSPATH
4085
-		} elseif ( $script_filename_dir . '/' == $abspath_fix ) {
4085
+		} elseif ($script_filename_dir.'/' == $abspath_fix) {
4086 4086
 			// Strip off any file/query params in the path
4087
-			$path = preg_replace( '#/[^/]*$#i', '', $_SERVER['PHP_SELF'] );
4087
+			$path = preg_replace('#/[^/]*$#i', '', $_SERVER['PHP_SELF']);
4088 4088
 
4089 4089
 		} else {
4090
-			if ( false !== strpos( $_SERVER['SCRIPT_FILENAME'], $abspath_fix ) ) {
4090
+			if (false !== strpos($_SERVER['SCRIPT_FILENAME'], $abspath_fix)) {
4091 4091
 				// Request is hitting a file inside ABSPATH
4092
-				$directory = str_replace( ABSPATH, '', $script_filename_dir );
4092
+				$directory = str_replace(ABSPATH, '', $script_filename_dir);
4093 4093
 				// Strip off the sub directory, and any file/query params
4094
-				$path = preg_replace( '#/' . preg_quote( $directory, '#' ) . '/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] );
4095
-			} elseif ( false !== strpos( $abspath_fix, $script_filename_dir ) ) {
4094
+				$path = preg_replace('#/'.preg_quote($directory, '#').'/[^/]*$#i', '', $_SERVER['REQUEST_URI']);
4095
+			} elseif (false !== strpos($abspath_fix, $script_filename_dir)) {
4096 4096
 				// Request is hitting a file above ABSPATH
4097
-				$subdirectory = substr( $abspath_fix, strpos( $abspath_fix, $script_filename_dir ) + strlen( $script_filename_dir ) );
4097
+				$subdirectory = substr($abspath_fix, strpos($abspath_fix, $script_filename_dir) + strlen($script_filename_dir));
4098 4098
 				// Strip off any file/query params from the path, appending the sub directory to the install
4099
-				$path = preg_replace( '#/[^/]*$#i', '' , $_SERVER['REQUEST_URI'] ) . $subdirectory;
4099
+				$path = preg_replace('#/[^/]*$#i', '', $_SERVER['REQUEST_URI']).$subdirectory;
4100 4100
 			} else {
4101 4101
 				$path = $_SERVER['REQUEST_URI'];
4102 4102
 			}
4103 4103
 		}
4104 4104
 
4105 4105
 		$schema = is_ssl() ? 'https://' : 'http://'; // set_url_scheme() is not defined yet
4106
-		$url = $schema . $_SERVER['HTTP_HOST'] . $path;
4106
+		$url = $schema.$_SERVER['HTTP_HOST'].$path;
4107 4107
 	}
4108 4108
 
4109 4109
 	return rtrim($url, '/');
@@ -4126,10 +4126,10 @@  discard block
 block discarded – undo
4126 4126
  * @param bool $suspend Optional. Suspends additions if true, re-enables them if false.
4127 4127
  * @return bool The current suspend setting
4128 4128
  */
4129
-function wp_suspend_cache_addition( $suspend = null ) {
4129
+function wp_suspend_cache_addition($suspend = null) {
4130 4130
 	static $_suspend = false;
4131 4131
 
4132
-	if ( is_bool( $suspend ) )
4132
+	if (is_bool($suspend))
4133 4133
 		$_suspend = $suspend;
4134 4134
 
4135 4135
 	return $_suspend;
@@ -4149,7 +4149,7 @@  discard block
 block discarded – undo
4149 4149
  * @param bool $suspend Optional. Whether to suspend or enable cache invalidation. Default true.
4150 4150
  * @return bool The current suspend setting.
4151 4151
  */
4152
-function wp_suspend_cache_invalidation( $suspend = true ) {
4152
+function wp_suspend_cache_invalidation($suspend = true) {
4153 4153
 	global $_wp_suspend_cache_invalidation;
4154 4154
 
4155 4155
 	$current_suspend = $_wp_suspend_cache_invalidation;
@@ -4169,14 +4169,14 @@  discard block
 block discarded – undo
4169 4169
  * @return bool True if $site_id is the main site of the network, or if not
4170 4170
  *              running Multisite.
4171 4171
  */
4172
-function is_main_site( $site_id = null ) {
4172
+function is_main_site($site_id = null) {
4173 4173
 	// This is the current network's information; 'site' is old terminology.
4174 4174
 	global $current_site;
4175 4175
 
4176
-	if ( ! is_multisite() )
4176
+	if ( ! is_multisite())
4177 4177
 		return true;
4178 4178
 
4179
-	if ( ! $site_id )
4179
+	if ( ! $site_id)
4180 4180
 		$site_id = get_current_blog_id();
4181 4181
 
4182 4182
 	return (int) $site_id === (int) $current_site->blog_id;
@@ -4190,20 +4190,20 @@  discard block
 block discarded – undo
4190 4190
  * @param int $network_id Optional. Network ID to test. Defaults to current network.
4191 4191
  * @return bool True if $network_id is the main network, or if not running Multisite.
4192 4192
  */
4193
-function is_main_network( $network_id = null ) {
4194
-	if ( ! is_multisite() ) {
4193
+function is_main_network($network_id = null) {
4194
+	if ( ! is_multisite()) {
4195 4195
 		return true;
4196 4196
 	}
4197 4197
 
4198 4198
 	$current_network_id = (int) get_current_site()->id;
4199 4199
 
4200
-	if ( null === $network_id ) {
4200
+	if (null === $network_id) {
4201 4201
 		$network_id = $current_network_id;
4202 4202
 	}
4203 4203
 
4204 4204
 	$network_id = (int) $network_id;
4205 4205
 
4206
-	return ( $network_id === get_main_network_id() );
4206
+	return ($network_id === get_main_network_id());
4207 4207
 }
4208 4208
 
4209 4209
 /**
@@ -4218,21 +4218,21 @@  discard block
 block discarded – undo
4218 4218
 function get_main_network_id() {
4219 4219
 	global $wpdb;
4220 4220
 
4221
-	if ( ! is_multisite() ) {
4221
+	if ( ! is_multisite()) {
4222 4222
 		return 1;
4223 4223
 	}
4224 4224
 
4225
-	if ( defined( 'PRIMARY_NETWORK_ID' ) ) {
4225
+	if (defined('PRIMARY_NETWORK_ID')) {
4226 4226
 		$main_network_id = PRIMARY_NETWORK_ID;
4227
-	} elseif ( 1 === (int) get_current_site()->id ) {
4227
+	} elseif (1 === (int) get_current_site()->id) {
4228 4228
 		// If the current network has an ID of 1, assume it is the main network.
4229 4229
 		$main_network_id = 1;
4230 4230
 	} else {
4231
-		$main_network_id = wp_cache_get( 'primary_network_id', 'site-options' );
4231
+		$main_network_id = wp_cache_get('primary_network_id', 'site-options');
4232 4232
 
4233
-		if ( false === $main_network_id ) {
4234
-			$main_network_id = (int) $wpdb->get_var( "SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1" );
4235
-			wp_cache_add( 'primary_network_id', $main_network_id, 'site-options' );
4233
+		if (false === $main_network_id) {
4234
+			$main_network_id = (int) $wpdb->get_var("SELECT id FROM {$wpdb->site} ORDER BY id LIMIT 1");
4235
+			wp_cache_add('primary_network_id', $main_network_id, 'site-options');
4236 4236
 		}
4237 4237
 	}
4238 4238
 
@@ -4243,7 +4243,7 @@  discard block
 block discarded – undo
4243 4243
 	 *
4244 4244
 	 * @param int $main_network_id The ID of the main network.
4245 4245
 	 */
4246
-	return (int) apply_filters( 'get_main_network_id', $main_network_id );
4246
+	return (int) apply_filters('get_main_network_id', $main_network_id);
4247 4247
 }
4248 4248
 
4249 4249
 /**
@@ -4256,11 +4256,11 @@  discard block
 block discarded – undo
4256 4256
  * @return bool True if multisite and global terms enabled.
4257 4257
  */
4258 4258
 function global_terms_enabled() {
4259
-	if ( ! is_multisite() )
4259
+	if ( ! is_multisite())
4260 4260
 		return false;
4261 4261
 
4262 4262
 	static $global_terms = null;
4263
-	if ( is_null( $global_terms ) ) {
4263
+	if (is_null($global_terms)) {
4264 4264
 
4265 4265
 		/**
4266 4266
 		 * Filter whether global terms are enabled.
@@ -4272,11 +4272,11 @@  discard block
 block discarded – undo
4272 4272
 		 *
4273 4273
 		 * @param null $enabled Whether global terms are enabled.
4274 4274
 		 */
4275
-		$filter = apply_filters( 'global_terms_enabled', null );
4276
-		if ( ! is_null( $filter ) )
4275
+		$filter = apply_filters('global_terms_enabled', null);
4276
+		if ( ! is_null($filter))
4277 4277
 			$global_terms = (bool) $filter;
4278 4278
 		else
4279
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4279
+			$global_terms = (bool) get_site_option('global_terms_enabled', false);
4280 4280
 	}
4281 4281
 	return $global_terms;
4282 4282
 }
@@ -4291,16 +4291,16 @@  discard block
 block discarded – undo
4291 4291
  * @return float|false Timezone GMT offset, false otherwise.
4292 4292
  */
4293 4293
 function wp_timezone_override_offset() {
4294
-	if ( !$timezone_string = get_option( 'timezone_string' ) ) {
4294
+	if ( ! $timezone_string = get_option('timezone_string')) {
4295 4295
 		return false;
4296 4296
 	}
4297 4297
 
4298
-	$timezone_object = timezone_open( $timezone_string );
4298
+	$timezone_object = timezone_open($timezone_string);
4299 4299
 	$datetime_object = date_create();
4300
-	if ( false === $timezone_object || false === $datetime_object ) {
4300
+	if (false === $timezone_object || false === $datetime_object) {
4301 4301
 		return false;
4302 4302
 	}
4303
-	return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
4303
+	return round(timezone_offset_get($timezone_object, $datetime_object) / HOUR_IN_SECONDS, 2);
4304 4304
 }
4305 4305
 
4306 4306
 /**
@@ -4313,41 +4313,41 @@  discard block
 block discarded – undo
4313 4313
  * @param array $b
4314 4314
  * @return int
4315 4315
  */
4316
-function _wp_timezone_choice_usort_callback( $a, $b ) {
4316
+function _wp_timezone_choice_usort_callback($a, $b) {
4317 4317
 	// Don't use translated versions of Etc
4318
-	if ( 'Etc' === $a['continent'] && 'Etc' === $b['continent'] ) {
4318
+	if ('Etc' === $a['continent'] && 'Etc' === $b['continent']) {
4319 4319
 		// Make the order of these more like the old dropdown
4320
-		if ( 'GMT+' === substr( $a['city'], 0, 4 ) && 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4321
-			return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
4320
+		if ('GMT+' === substr($a['city'], 0, 4) && 'GMT+' === substr($b['city'], 0, 4)) {
4321
+			return -1 * (strnatcasecmp($a['city'], $b['city']));
4322 4322
 		}
4323
-		if ( 'UTC' === $a['city'] ) {
4324
-			if ( 'GMT+' === substr( $b['city'], 0, 4 ) ) {
4323
+		if ('UTC' === $a['city']) {
4324
+			if ('GMT+' === substr($b['city'], 0, 4)) {
4325 4325
 				return 1;
4326 4326
 			}
4327 4327
 			return -1;
4328 4328
 		}
4329
-		if ( 'UTC' === $b['city'] ) {
4330
-			if ( 'GMT+' === substr( $a['city'], 0, 4 ) ) {
4329
+		if ('UTC' === $b['city']) {
4330
+			if ('GMT+' === substr($a['city'], 0, 4)) {
4331 4331
 				return -1;
4332 4332
 			}
4333 4333
 			return 1;
4334 4334
 		}
4335
-		return strnatcasecmp( $a['city'], $b['city'] );
4335
+		return strnatcasecmp($a['city'], $b['city']);
4336 4336
 	}
4337
-	if ( $a['t_continent'] == $b['t_continent'] ) {
4338
-		if ( $a['t_city'] == $b['t_city'] ) {
4339
-			return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
4337
+	if ($a['t_continent'] == $b['t_continent']) {
4338
+		if ($a['t_city'] == $b['t_city']) {
4339
+			return strnatcasecmp($a['t_subcity'], $b['t_subcity']);
4340 4340
 		}
4341
-		return strnatcasecmp( $a['t_city'], $b['t_city'] );
4341
+		return strnatcasecmp($a['t_city'], $b['t_city']);
4342 4342
 	} else {
4343 4343
 		// Force Etc to the bottom of the list
4344
-		if ( 'Etc' === $a['continent'] ) {
4344
+		if ('Etc' === $a['continent']) {
4345 4345
 			return 1;
4346 4346
 		}
4347
-		if ( 'Etc' === $b['continent'] ) {
4347
+		if ('Etc' === $b['continent']) {
4348 4348
 			return -1;
4349 4349
 		}
4350
-		return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
4350
+		return strnatcasecmp($a['t_continent'], $b['t_continent']);
4351 4351
 	}
4352 4352
 }
4353 4353
 
@@ -4361,125 +4361,125 @@  discard block
 block discarded – undo
4361 4361
  * @param string $selected_zone Selected timezone.
4362 4362
  * @return string
4363 4363
  */
4364
-function wp_timezone_choice( $selected_zone ) {
4364
+function wp_timezone_choice($selected_zone) {
4365 4365
 	static $mo_loaded = false;
4366 4366
 
4367
-	$continents = array( 'Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4367
+	$continents = array('Africa', 'America', 'Antarctica', 'Arctic', 'Asia', 'Atlantic', 'Australia', 'Europe', 'Indian', 'Pacific');
4368 4368
 
4369 4369
 	// Load translations for continents and cities
4370
-	if ( !$mo_loaded ) {
4370
+	if ( ! $mo_loaded) {
4371 4371
 		$locale = get_locale();
4372
-		$mofile = WP_LANG_DIR . '/continents-cities-' . $locale . '.mo';
4373
-		load_textdomain( 'continents-cities', $mofile );
4372
+		$mofile = WP_LANG_DIR.'/continents-cities-'.$locale.'.mo';
4373
+		load_textdomain('continents-cities', $mofile);
4374 4374
 		$mo_loaded = true;
4375 4375
 	}
4376 4376
 
4377 4377
 	$zonen = array();
4378
-	foreach ( timezone_identifiers_list() as $zone ) {
4379
-		$zone = explode( '/', $zone );
4380
-		if ( !in_array( $zone[0], $continents ) ) {
4378
+	foreach (timezone_identifiers_list() as $zone) {
4379
+		$zone = explode('/', $zone);
4380
+		if ( ! in_array($zone[0], $continents)) {
4381 4381
 			continue;
4382 4382
 		}
4383 4383
 
4384 4384
 		// This determines what gets set and translated - we don't translate Etc/* strings here, they are done later
4385 4385
 		$exists = array(
4386
-			0 => ( isset( $zone[0] ) && $zone[0] ),
4387
-			1 => ( isset( $zone[1] ) && $zone[1] ),
4388
-			2 => ( isset( $zone[2] ) && $zone[2] ),
4386
+			0 => (isset($zone[0]) && $zone[0]),
4387
+			1 => (isset($zone[1]) && $zone[1]),
4388
+			2 => (isset($zone[2]) && $zone[2]),
4389 4389
 		);
4390
-		$exists[3] = ( $exists[0] && 'Etc' !== $zone[0] );
4391
-		$exists[4] = ( $exists[1] && $exists[3] );
4392
-		$exists[5] = ( $exists[2] && $exists[3] );
4390
+		$exists[3] = ($exists[0] && 'Etc' !== $zone[0]);
4391
+		$exists[4] = ($exists[1] && $exists[3]);
4392
+		$exists[5] = ($exists[2] && $exists[3]);
4393 4393
 
4394 4394
 		$zonen[] = array(
4395
-			'continent'   => ( $exists[0] ? $zone[0] : '' ),
4396
-			'city'        => ( $exists[1] ? $zone[1] : '' ),
4397
-			'subcity'     => ( $exists[2] ? $zone[2] : '' ),
4398
-			't_continent' => ( $exists[3] ? translate( str_replace( '_', ' ', $zone[0] ), 'continents-cities' ) : '' ),
4399
-			't_city'      => ( $exists[4] ? translate( str_replace( '_', ' ', $zone[1] ), 'continents-cities' ) : '' ),
4400
-			't_subcity'   => ( $exists[5] ? translate( str_replace( '_', ' ', $zone[2] ), 'continents-cities' ) : '' )
4395
+			'continent'   => ($exists[0] ? $zone[0] : ''),
4396
+			'city'        => ($exists[1] ? $zone[1] : ''),
4397
+			'subcity'     => ($exists[2] ? $zone[2] : ''),
4398
+			't_continent' => ($exists[3] ? translate(str_replace('_', ' ', $zone[0]), 'continents-cities') : ''),
4399
+			't_city'      => ($exists[4] ? translate(str_replace('_', ' ', $zone[1]), 'continents-cities') : ''),
4400
+			't_subcity'   => ($exists[5] ? translate(str_replace('_', ' ', $zone[2]), 'continents-cities') : '')
4401 4401
 		);
4402 4402
 	}
4403
-	usort( $zonen, '_wp_timezone_choice_usort_callback' );
4403
+	usort($zonen, '_wp_timezone_choice_usort_callback');
4404 4404
 
4405 4405
 	$structure = array();
4406 4406
 
4407
-	if ( empty( $selected_zone ) ) {
4408
-		$structure[] = '<option selected="selected" value="">' . __( 'Select a city' ) . '</option>';
4407
+	if (empty($selected_zone)) {
4408
+		$structure[] = '<option selected="selected" value="">'.__('Select a city').'</option>';
4409 4409
 	}
4410 4410
 
4411
-	foreach ( $zonen as $key => $zone ) {
4411
+	foreach ($zonen as $key => $zone) {
4412 4412
 		// Build value in an array to join later
4413
-		$value = array( $zone['continent'] );
4413
+		$value = array($zone['continent']);
4414 4414
 
4415
-		if ( empty( $zone['city'] ) ) {
4415
+		if (empty($zone['city'])) {
4416 4416
 			// It's at the continent level (generally won't happen)
4417 4417
 			$display = $zone['t_continent'];
4418 4418
 		} else {
4419 4419
 			// It's inside a continent group
4420 4420
 
4421 4421
 			// Continent optgroup
4422
-			if ( !isset( $zonen[$key - 1] ) || $zonen[$key - 1]['continent'] !== $zone['continent'] ) {
4422
+			if ( ! isset($zonen[$key - 1]) || $zonen[$key - 1]['continent'] !== $zone['continent']) {
4423 4423
 				$label = $zone['t_continent'];
4424
-				$structure[] = '<optgroup label="'. esc_attr( $label ) .'">';
4424
+				$structure[] = '<optgroup label="'.esc_attr($label).'">';
4425 4425
 			}
4426 4426
 
4427 4427
 			// Add the city to the value
4428 4428
 			$value[] = $zone['city'];
4429 4429
 
4430 4430
 			$display = $zone['t_city'];
4431
-			if ( !empty( $zone['subcity'] ) ) {
4431
+			if ( ! empty($zone['subcity'])) {
4432 4432
 				// Add the subcity to the value
4433 4433
 				$value[] = $zone['subcity'];
4434
-				$display .= ' - ' . $zone['t_subcity'];
4434
+				$display .= ' - '.$zone['t_subcity'];
4435 4435
 			}
4436 4436
 		}
4437 4437
 
4438 4438
 		// Build the value
4439
-		$value = join( '/', $value );
4439
+		$value = join('/', $value);
4440 4440
 		$selected = '';
4441
-		if ( $value === $selected_zone ) {
4441
+		if ($value === $selected_zone) {
4442 4442
 			$selected = 'selected="selected" ';
4443 4443
 		}
4444
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $value ) . '">' . esc_html( $display ) . "</option>";
4444
+		$structure[] = '<option '.$selected.'value="'.esc_attr($value).'">'.esc_html($display)."</option>";
4445 4445
 
4446 4446
 		// Close continent optgroup
4447
-		if ( !empty( $zone['city'] ) && ( !isset($zonen[$key + 1]) || (isset( $zonen[$key + 1] ) && $zonen[$key + 1]['continent'] !== $zone['continent']) ) ) {
4447
+		if ( ! empty($zone['city']) && ( ! isset($zonen[$key + 1]) || (isset($zonen[$key + 1]) && $zonen[$key + 1]['continent'] !== $zone['continent']))) {
4448 4448
 			$structure[] = '</optgroup>';
4449 4449
 		}
4450 4450
 	}
4451 4451
 
4452 4452
 	// Do UTC
4453
-	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4453
+	$structure[] = '<optgroup label="'.esc_attr__('UTC').'">';
4454 4454
 	$selected = '';
4455
-	if ( 'UTC' === $selected_zone )
4455
+	if ('UTC' === $selected_zone)
4456 4456
 		$selected = 'selected="selected" ';
4457
-	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4457
+	$structure[] = '<option '.$selected.'value="'.esc_attr('UTC').'">'.__('UTC').'</option>';
4458 4458
 	$structure[] = '</optgroup>';
4459 4459
 
4460 4460
 	// Do manual UTC offsets
4461
-	$structure[] = '<optgroup label="'. esc_attr__( 'Manual Offsets' ) .'">';
4462
-	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4461
+	$structure[] = '<optgroup label="'.esc_attr__('Manual Offsets').'">';
4462
+	$offset_range = array(-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4463 4463
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4464
-	foreach ( $offset_range as $offset ) {
4465
-		if ( 0 <= $offset )
4466
-			$offset_name = '+' . $offset;
4464
+	foreach ($offset_range as $offset) {
4465
+		if (0 <= $offset)
4466
+			$offset_name = '+'.$offset;
4467 4467
 		else
4468 4468
 			$offset_name = (string) $offset;
4469 4469
 
4470 4470
 		$offset_value = $offset_name;
4471
-		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4472
-		$offset_name = 'UTC' . $offset_name;
4473
-		$offset_value = 'UTC' . $offset_value;
4471
+		$offset_name = str_replace(array('.25', '.5', '.75'), array(':15', ':30', ':45'), $offset_name);
4472
+		$offset_name = 'UTC'.$offset_name;
4473
+		$offset_value = 'UTC'.$offset_value;
4474 4474
 		$selected = '';
4475
-		if ( $offset_value === $selected_zone )
4475
+		if ($offset_value === $selected_zone)
4476 4476
 			$selected = 'selected="selected" ';
4477
-		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4477
+		$structure[] = '<option '.$selected.'value="'.esc_attr($offset_value).'">'.esc_html($offset_name)."</option>";
4478 4478
 
4479 4479
 	}
4480 4480
 	$structure[] = '</optgroup>';
4481 4481
 
4482
-	return join( "\n", $structure );
4482
+	return join("\n", $structure);
4483 4483
 }
4484 4484
 
4485 4485
 /**
@@ -4493,7 +4493,7 @@  discard block
 block discarded – undo
4493 4493
  * @param string $str Header comment to clean up.
4494 4494
  * @return string
4495 4495
  */
4496
-function _cleanup_header_comment( $str ) {
4496
+function _cleanup_header_comment($str) {
4497 4497
 	return trim(preg_replace("/\s*(?:\*\/|\?>).*/", '', $str));
4498 4498
 }
4499 4499
 
@@ -4510,18 +4510,18 @@  discard block
 block discarded – undo
4510 4510
 function wp_scheduled_delete() {
4511 4511
 	global $wpdb;
4512 4512
 
4513
-	$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
4513
+	$delete_timestamp = time() - (DAY_IN_SECONDS * EMPTY_TRASH_DAYS);
4514 4514
 
4515 4515
 	$posts_to_delete = $wpdb->get_results($wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4516 4516
 
4517
-	foreach ( (array) $posts_to_delete as $post ) {
4517
+	foreach ((array) $posts_to_delete as $post) {
4518 4518
 		$post_id = (int) $post['post_id'];
4519
-		if ( !$post_id )
4519
+		if ( ! $post_id)
4520 4520
 			continue;
4521 4521
 
4522 4522
 		$del_post = get_post($post_id);
4523 4523
 
4524
-		if ( !$del_post || 'trash' != $del_post->post_status ) {
4524
+		if ( ! $del_post || 'trash' != $del_post->post_status) {
4525 4525
 			delete_post_meta($post_id, '_wp_trash_meta_status');
4526 4526
 			delete_post_meta($post_id, '_wp_trash_meta_time');
4527 4527
 		} else {
@@ -4531,18 +4531,18 @@  discard block
 block discarded – undo
4531 4531
 
4532 4532
 	$comments_to_delete = $wpdb->get_results($wpdb->prepare("SELECT comment_id FROM $wpdb->commentmeta WHERE meta_key = '_wp_trash_meta_time' AND meta_value < '%d'", $delete_timestamp), ARRAY_A);
4533 4533
 
4534
-	foreach ( (array) $comments_to_delete as $comment ) {
4534
+	foreach ((array) $comments_to_delete as $comment) {
4535 4535
 		$comment_id = (int) $comment['comment_id'];
4536
-		if ( !$comment_id )
4536
+		if ( ! $comment_id)
4537 4537
 			continue;
4538 4538
 
4539 4539
 		$del_comment = get_comment($comment_id);
4540 4540
 
4541
-		if ( !$del_comment || 'trash' != $del_comment->comment_approved ) {
4541
+		if ( ! $del_comment || 'trash' != $del_comment->comment_approved) {
4542 4542
 			delete_comment_meta($comment_id, '_wp_trash_meta_time');
4543 4543
 			delete_comment_meta($comment_id, '_wp_trash_meta_status');
4544 4544
 		} else {
4545
-			wp_delete_comment( $del_comment );
4545
+			wp_delete_comment($del_comment);
4546 4546
 		}
4547 4547
 	}
4548 4548
 }
@@ -4567,18 +4567,18 @@  discard block
 block discarded – undo
4567 4567
  *                                Default empty.
4568 4568
  * @return array Array of file headers in `HeaderKey => Header Value` format.
4569 4569
  */
4570
-function get_file_data( $file, $default_headers, $context = '' ) {
4570
+function get_file_data($file, $default_headers, $context = '') {
4571 4571
 	// We don't need to write to the file, so just open for reading.
4572
-	$fp = fopen( $file, 'r' );
4572
+	$fp = fopen($file, 'r');
4573 4573
 
4574 4574
 	// Pull only the first 8kiB of the file in.
4575
-	$file_data = fread( $fp, 8192 );
4575
+	$file_data = fread($fp, 8192);
4576 4576
 
4577 4577
 	// PHP will close file handle, but we are good citizens.
4578
-	fclose( $fp );
4578
+	fclose($fp);
4579 4579
 
4580 4580
 	// Make sure we catch CR-only line endings.
4581
-	$file_data = str_replace( "\r", "\n", $file_data );
4581
+	$file_data = str_replace("\r", "\n", $file_data);
4582 4582
 
4583 4583
 	/**
4584 4584
 	 * Filter extra file headers by context.
@@ -4590,18 +4590,18 @@  discard block
 block discarded – undo
4590 4590
 	 *
4591 4591
 	 * @param array $extra_context_headers Empty array by default.
4592 4592
 	 */
4593
-	if ( $context && $extra_headers = apply_filters( "extra_{$context}_headers", array() ) ) {
4594
-		$extra_headers = array_combine( $extra_headers, $extra_headers ); // keys equal values
4595
-		$all_headers = array_merge( $extra_headers, (array) $default_headers );
4593
+	if ($context && $extra_headers = apply_filters("extra_{$context}_headers", array())) {
4594
+		$extra_headers = array_combine($extra_headers, $extra_headers); // keys equal values
4595
+		$all_headers = array_merge($extra_headers, (array) $default_headers);
4596 4596
 	} else {
4597 4597
 		$all_headers = $default_headers;
4598 4598
 	}
4599 4599
 
4600
-	foreach ( $all_headers as $field => $regex ) {
4601
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4602
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4600
+	foreach ($all_headers as $field => $regex) {
4601
+		if (preg_match('/^[ \t\/*#@]*'.preg_quote($regex, '/').':(.*)$/mi', $file_data, $match) && $match[1])
4602
+			$all_headers[$field] = _cleanup_header_comment($match[1]);
4603 4603
 		else
4604
-			$all_headers[ $field ] = '';
4604
+			$all_headers[$field] = '';
4605 4605
 	}
4606 4606
 
4607 4607
 	return $all_headers;
@@ -4700,7 +4700,7 @@  discard block
 block discarded – undo
4700 4700
  * @see http://src.chromium.org/viewvc/chrome?view=rev&revision=6985
4701 4701
  */
4702 4702
 function send_nosniff_header() {
4703
-	@header( 'X-Content-Type-Options: nosniff' );
4703
+	@header('X-Content-Type-Options: nosniff');
4704 4704
 }
4705 4705
 
4706 4706
 /**
@@ -4712,8 +4712,8 @@  discard block
 block discarded – undo
4712 4712
  * @param string $column Database column.
4713 4713
  * @return string SQL clause.
4714 4714
  */
4715
-function _wp_mysql_week( $column ) {
4716
-	switch ( $start_of_week = (int) get_option( 'start_of_week' ) ) {
4715
+function _wp_mysql_week($column) {
4716
+	switch ($start_of_week = (int) get_option('start_of_week')) {
4717 4717
 	case 1 :
4718 4718
 		return "WEEK( $column, 1 )";
4719 4719
 	case 2 :
@@ -4741,13 +4741,13 @@  discard block
 block discarded – undo
4741 4741
  * @param array    $callback_args Optional. Additional arguments to send to $callback.
4742 4742
  * @return array IDs of all members of loop.
4743 4743
  */
4744
-function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4745
-	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4744
+function wp_find_hierarchy_loop($callback, $start, $start_parent, $callback_args = array()) {
4745
+	$override = is_null($start_parent) ? array() : array($start => $start_parent);
4746 4746
 
4747
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4747
+	if ( ! $arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override, $callback_args))
4748 4748
 		return array();
4749 4749
 
4750
-	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4750
+	return wp_find_hierarchy_loop_tortoise_hare($callback, $arbitrary_loop_member, $override, $callback_args, true);
4751 4751
 }
4752 4752
 
4753 4753
 /**
@@ -4770,7 +4770,7 @@  discard block
 block discarded – undo
4770 4770
  * @return mixed Scalar ID of some arbitrary member of the loop, or array of IDs of all members of loop if
4771 4771
  *               $_return_loop
4772 4772
  */
4773
-function wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override = array(), $callback_args = array(), $_return_loop = false ) {
4773
+function wp_find_hierarchy_loop_tortoise_hare($callback, $start, $override = array(), $callback_args = array(), $_return_loop = false) {
4774 4774
 	$tortoise = $hare = $evanescent_hare = $start;
4775 4775
 	$return = array();
4776 4776
 
@@ -4779,19 +4779,19 @@  discard block
 block discarded – undo
4779 4779
 	while (
4780 4780
 		$tortoise
4781 4781
 	&&
4782
-		( $evanescent_hare = isset( $override[$hare] ) ? $override[$hare] : call_user_func_array( $callback, array_merge( array( $hare ), $callback_args ) ) )
4782
+		($evanescent_hare = isset($override[$hare]) ? $override[$hare] : call_user_func_array($callback, array_merge(array($hare), $callback_args)))
4783 4783
 	&&
4784
-		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4784
+		($hare = isset($override[$evanescent_hare]) ? $override[$evanescent_hare] : call_user_func_array($callback, array_merge(array($evanescent_hare), $callback_args)))
4785 4785
 	) {
4786
-		if ( $_return_loop )
4786
+		if ($_return_loop)
4787 4787
 			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4788 4788
 
4789 4789
 		// tortoise got lapped - must be a loop
4790
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4790
+		if ($tortoise == $evanescent_hare || $tortoise == $hare)
4791 4791
 			return $_return_loop ? $return : $tortoise;
4792 4792
 
4793 4793
 		// Increment tortoise by one step
4794
-		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
4794
+		$tortoise = isset($override[$tortoise]) ? $override[$tortoise] : call_user_func_array($callback, array_merge(array($tortoise), $callback_args));
4795 4795
 	}
4796 4796
 
4797 4797
 	return false;
@@ -4805,7 +4805,7 @@  discard block
 block discarded – undo
4805 4805
  * @see https://developer.mozilla.org/en/the_x-frame-options_response_header
4806 4806
  */
4807 4807
 function send_frame_options_header() {
4808
-	@header( 'X-Frame-Options: SAMEORIGIN' );
4808
+	@header('X-Frame-Options: SAMEORIGIN');
4809 4809
 }
4810 4810
 
4811 4811
 /**
@@ -4826,8 +4826,8 @@  discard block
 block discarded – undo
4826 4826
 function wp_allowed_protocols() {
4827 4827
 	static $protocols = array();
4828 4828
 
4829
-	if ( empty( $protocols ) ) {
4830
-		$protocols = array( 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal' );
4829
+	if (empty($protocols)) {
4830
+		$protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet', 'mms', 'rtsp', 'svn', 'tel', 'fax', 'xmpp', 'webcal');
4831 4831
 
4832 4832
 		/**
4833 4833
 		 * Filter the list of protocols allowed in HTML attributes.
@@ -4836,7 +4836,7 @@  discard block
 block discarded – undo
4836 4836
 		 *
4837 4837
 		 * @param array $protocols Array of allowed protocols e.g. 'http', 'ftp', 'tel', and more.
4838 4838
 		 */
4839
-		$protocols = apply_filters( 'kses_allowed_protocols', $protocols );
4839
+		$protocols = apply_filters('kses_allowed_protocols', $protocols);
4840 4840
 	}
4841 4841
 
4842 4842
 	return $protocols;
@@ -4859,36 +4859,36 @@  discard block
 block discarded – undo
4859 4859
  * @return string|array Either a string containing a reversed comma separated trace or an array
4860 4860
  *                      of individual calls.
4861 4861
  */
4862
-function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4863
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4864
-		$trace = debug_backtrace( false );
4862
+function wp_debug_backtrace_summary($ignore_class = null, $skip_frames = 0, $pretty = true) {
4863
+	if (version_compare(PHP_VERSION, '5.2.5', '>='))
4864
+		$trace = debug_backtrace(false);
4865 4865
 	else
4866 4866
 		$trace = debug_backtrace();
4867 4867
 
4868 4868
 	$caller = array();
4869
-	$check_class = ! is_null( $ignore_class );
4869
+	$check_class = ! is_null($ignore_class);
4870 4870
 	$skip_frames++; // skip this function
4871 4871
 
4872
-	foreach ( $trace as $call ) {
4873
-		if ( $skip_frames > 0 ) {
4872
+	foreach ($trace as $call) {
4873
+		if ($skip_frames > 0) {
4874 4874
 			$skip_frames--;
4875
-		} elseif ( isset( $call['class'] ) ) {
4876
-			if ( $check_class && $ignore_class == $call['class'] )
4875
+		} elseif (isset($call['class'])) {
4876
+			if ($check_class && $ignore_class == $call['class'])
4877 4877
 				continue; // Filter out calls
4878 4878
 
4879 4879
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4880 4880
 		} else {
4881
-			if ( in_array( $call['function'], array( 'do_action', 'apply_filters' ) ) ) {
4881
+			if (in_array($call['function'], array('do_action', 'apply_filters'))) {
4882 4882
 				$caller[] = "{$call['function']}('{$call['args'][0]}')";
4883
-			} elseif ( in_array( $call['function'], array( 'include', 'include_once', 'require', 'require_once' ) ) ) {
4884
-				$caller[] = $call['function'] . "('" . str_replace( array( WP_CONTENT_DIR, ABSPATH ) , '', $call['args'][0] ) . "')";
4883
+			} elseif (in_array($call['function'], array('include', 'include_once', 'require', 'require_once'))) {
4884
+				$caller[] = $call['function']."('".str_replace(array(WP_CONTENT_DIR, ABSPATH), '', $call['args'][0])."')";
4885 4885
 			} else {
4886 4886
 				$caller[] = $call['function'];
4887 4887
 			}
4888 4888
 		}
4889 4889
 	}
4890
-	if ( $pretty )
4891
-		return join( ', ', array_reverse( $caller ) );
4890
+	if ($pretty)
4891
+		return join(', ', array_reverse($caller));
4892 4892
 	else
4893 4893
 		return $caller;
4894 4894
 }
@@ -4904,11 +4904,11 @@  discard block
 block discarded – undo
4904 4904
  *
4905 4905
  * @return array List of ids not present in the cache.
4906 4906
  */
4907
-function _get_non_cached_ids( $object_ids, $cache_key ) {
4907
+function _get_non_cached_ids($object_ids, $cache_key) {
4908 4908
 	$clean = array();
4909
-	foreach ( $object_ids as $id ) {
4909
+	foreach ($object_ids as $id) {
4910 4910
 		$id = (int) $id;
4911
-		if ( !wp_cache_get( $id, $cache_key ) ) {
4911
+		if ( ! wp_cache_get($id, $cache_key)) {
4912 4912
 			$clean[] = $id;
4913 4913
 		}
4914 4914
 	}
@@ -4925,15 +4925,15 @@  discard block
 block discarded – undo
4925 4925
  * @return bool Whether the device is able to upload files.
4926 4926
  */
4927 4927
 function _device_can_upload() {
4928
-	if ( ! wp_is_mobile() )
4928
+	if ( ! wp_is_mobile())
4929 4929
 		return true;
4930 4930
 
4931 4931
 	$ua = $_SERVER['HTTP_USER_AGENT'];
4932 4932
 
4933
-	if ( strpos($ua, 'iPhone') !== false
4933
+	if (strpos($ua, 'iPhone') !== false
4934 4934
 		|| strpos($ua, 'iPad') !== false
4935
-		|| strpos($ua, 'iPod') !== false ) {
4936
-			return preg_match( '#OS ([\d_]+) like Mac OS X#', $ua, $version ) && version_compare( $version[1], '6', '>=' );
4935
+		|| strpos($ua, 'iPod') !== false) {
4936
+			return preg_match('#OS ([\d_]+) like Mac OS X#', $ua, $version) && version_compare($version[1], '6', '>=');
4937 4937
 	}
4938 4938
 
4939 4939
 	return true;
@@ -4945,11 +4945,11 @@  discard block
 block discarded – undo
4945 4945
  * @param string $path The resource path or URL.
4946 4946
  * @return bool True if the path is a stream URL.
4947 4947
  */
4948
-function wp_is_stream( $path ) {
4948
+function wp_is_stream($path) {
4949 4949
 	$wrappers = stream_get_wrappers();
4950
-	$wrappers_re = '(' . join('|', $wrappers) . ')';
4950
+	$wrappers_re = '('.join('|', $wrappers).')';
4951 4951
 
4952
-	return preg_match( "!^$wrappers_re://!", $path ) === 1;
4952
+	return preg_match("!^$wrappers_re://!", $path) === 1;
4953 4953
 }
4954 4954
 
4955 4955
 /**
@@ -4965,7 +4965,7 @@  discard block
 block discarded – undo
4965 4965
  * @param  string $source_date The date to filter.
4966 4966
  * @return bool True if valid date, false if not valid date.
4967 4967
  */
4968
-function wp_checkdate( $month, $day, $year, $source_date ) {
4968
+function wp_checkdate($month, $day, $year, $source_date) {
4969 4969
 	/**
4970 4970
 	 * Filter whether the given date is valid for the Gregorian calendar.
4971 4971
 	 *
@@ -4974,7 +4974,7 @@  discard block
 block discarded – undo
4974 4974
 	 * @param bool   $checkdate   Whether the given date is valid.
4975 4975
 	 * @param string $source_date Date to check.
4976 4976
 	 */
4977
-	return apply_filters( 'wp_checkdate', checkdate( $month, $day, $year ), $source_date );
4977
+	return apply_filters('wp_checkdate', checkdate($month, $day, $year), $source_date);
4978 4978
 }
4979 4979
 
4980 4980
 /**
@@ -4989,15 +4989,15 @@  discard block
 block discarded – undo
4989 4989
  * @since 3.6.0
4990 4990
  */
4991 4991
 function wp_auth_check_load() {
4992
-	if ( ! is_admin() && ! is_user_logged_in() )
4992
+	if ( ! is_admin() && ! is_user_logged_in())
4993 4993
 		return;
4994 4994
 
4995
-	if ( defined( 'IFRAME_REQUEST' ) )
4995
+	if (defined('IFRAME_REQUEST'))
4996 4996
 		return;
4997 4997
 
4998 4998
 	$screen = get_current_screen();
4999
-	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
5000
-	$show = ! in_array( $screen->id, $hidden );
4999
+	$hidden = array('update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network');
5000
+	$show = ! in_array($screen->id, $hidden);
5001 5001
 
5002 5002
 	/**
5003 5003
 	 * Filter whether to load the authentication check.
@@ -5010,12 +5010,12 @@  discard block
 block discarded – undo
5010 5010
 	 * @param bool      $show   Whether to load the authentication check.
5011 5011
 	 * @param WP_Screen $screen The current screen object.
5012 5012
 	 */
5013
-	if ( apply_filters( 'wp_auth_check_load', $show, $screen ) ) {
5014
-		wp_enqueue_style( 'wp-auth-check' );
5015
-		wp_enqueue_script( 'wp-auth-check' );
5013
+	if (apply_filters('wp_auth_check_load', $show, $screen)) {
5014
+		wp_enqueue_style('wp-auth-check');
5015
+		wp_enqueue_script('wp-auth-check');
5016 5016
 
5017
-		add_action( 'admin_print_footer_scripts', 'wp_auth_check_html', 5 );
5018
-		add_action( 'wp_print_footer_scripts', 'wp_auth_check_html', 5 );
5017
+		add_action('admin_print_footer_scripts', 'wp_auth_check_html', 5);
5018
+		add_action('wp_print_footer_scripts', 'wp_auth_check_html', 5);
5019 5019
 	}
5020 5020
 }
5021 5021
 
@@ -5026,8 +5026,8 @@  discard block
 block discarded – undo
5026 5026
  */
5027 5027
 function wp_auth_check_html() {
5028 5028
 	$login_url = wp_login_url();
5029
-	$current_domain = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'];
5030
-	$same_domain = ( strpos( $login_url, $current_domain ) === 0 );
5029
+	$current_domain = (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'];
5030
+	$same_domain = (strpos($login_url, $current_domain) === 0);
5031 5031
 
5032 5032
 	/**
5033 5033
 	 * Filter whether the authentication check originated at the same domain.
@@ -5036,26 +5036,26 @@  discard block
 block discarded – undo
5036 5036
 	 *
5037 5037
 	 * @param bool $same_domain Whether the authentication check originated at the same domain.
5038 5038
 	 */
5039
-	$same_domain = apply_filters( 'wp_auth_check_same_domain', $same_domain );
5039
+	$same_domain = apply_filters('wp_auth_check_same_domain', $same_domain);
5040 5040
 	$wrap_class = $same_domain ? 'hidden' : 'hidden fallback';
5041 5041
 
5042 5042
 	?>
5043 5043
 	<div id="wp-auth-check-wrap" class="<?php echo $wrap_class; ?>">
5044 5044
 	<div id="wp-auth-check-bg"></div>
5045 5045
 	<div id="wp-auth-check">
5046
-	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e( 'Close dialog' ); ?></span></button>
5046
+	<button type="button" class="wp-auth-check-close button-link"><span class="screen-reader-text"><?php _e('Close dialog'); ?></span></button>
5047 5047
 	<?php
5048 5048
 
5049
-	if ( $same_domain ) {
5049
+	if ($same_domain) {
5050 5050
 		?>
5051
-		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url( add_query_arg( array( 'interim-login' => 1 ), $login_url ) ); ?>"></div>
5051
+		<div id="wp-auth-check-form" class="loading" data-src="<?php echo esc_url(add_query_arg(array('interim-login' => 1), $login_url)); ?>"></div>
5052 5052
 		<?php
5053 5053
 	}
5054 5054
 
5055 5055
 	?>
5056 5056
 	<div class="wp-auth-fallback">
5057 5057
 		<p><b class="wp-auth-fallback-expired" tabindex="0"><?php _e('Session expired'); ?></b></p>
5058
-		<p><a href="<?php echo esc_url( $login_url ); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5058
+		<p><a href="<?php echo esc_url($login_url); ?>" target="_blank"><?php _e('Please log in again.'); ?></a>
5059 5059
 		<?php _e('The login page will open in a new window. After logging in you can close it and return to this page.'); ?></p>
5060 5060
 	</div>
5061 5061
 	</div>
@@ -5076,8 +5076,8 @@  discard block
 block discarded – undo
5076 5076
  * @param array $response  The Heartbeat response.
5077 5077
  * @return array $response The Heartbeat response with 'wp-auth-check' value set.
5078 5078
  */
5079
-function wp_auth_check( $response ) {
5080
-	$response['wp-auth-check'] = is_user_logged_in() && empty( $GLOBALS['login_grace_period'] );
5079
+function wp_auth_check($response) {
5080
+	$response['wp-auth-check'] = is_user_logged_in() && empty($GLOBALS['login_grace_period']);
5081 5081
 	return $response;
5082 5082
 }
5083 5083
 
@@ -5097,10 +5097,10 @@  discard block
 block discarded – undo
5097 5097
  * @param string $tag An HTML tag name. Example: 'video'.
5098 5098
  * @return string Tag RegEx.
5099 5099
  */
5100
-function get_tag_regex( $tag ) {
5101
-	if ( empty( $tag ) )
5100
+function get_tag_regex($tag) {
5101
+	if (empty($tag))
5102 5102
 		return;
5103
-	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5103
+	return sprintf('<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape($tag));
5104 5104
 }
5105 5105
 
5106 5106
 /**
@@ -5115,13 +5115,13 @@  discard block
 block discarded – undo
5115 5115
  * @param string $charset A charset name.
5116 5116
  * @return string The canonical form of the charset.
5117 5117
  */
5118
-function _canonical_charset( $charset ) {
5119
-	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
-		'UTF8' === $charset )
5118
+function _canonical_charset($charset) {
5119
+	if ('UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
+		'UTF8' === $charset)
5121 5121
 		return 'UTF-8';
5122 5122
 
5123
-	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5123
+	if ('ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset)
5125 5125
 		return 'ISO-8859-1';
5126 5126
 
5127 5127
 	return $charset;
@@ -5153,25 +5153,25 @@  discard block
 block discarded – undo
5153 5153
  * @param bool $reset Optional. Whether to reset the encoding back to a previously-set encoding.
5154 5154
  *                    Default false.
5155 5155
  */
5156
-function mbstring_binary_safe_encoding( $reset = false ) {
5156
+function mbstring_binary_safe_encoding($reset = false) {
5157 5157
 	static $encodings = array();
5158 5158
 	static $overloaded = null;
5159 5159
 
5160
-	if ( is_null( $overloaded ) )
5161
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5160
+	if (is_null($overloaded))
5161
+		$overloaded = function_exists('mb_internal_encoding') && (ini_get('mbstring.func_overload') & 2);
5162 5162
 
5163
-	if ( false === $overloaded )
5163
+	if (false === $overloaded)
5164 5164
 		return;
5165 5165
 
5166
-	if ( ! $reset ) {
5166
+	if ( ! $reset) {
5167 5167
 		$encoding = mb_internal_encoding();
5168
-		array_push( $encodings, $encoding );
5169
-		mb_internal_encoding( 'ISO-8859-1' );
5168
+		array_push($encodings, $encoding);
5169
+		mb_internal_encoding('ISO-8859-1');
5170 5170
 	}
5171 5171
 
5172
-	if ( $reset && $encodings ) {
5173
-		$encoding = array_pop( $encodings );
5174
-		mb_internal_encoding( $encoding );
5172
+	if ($reset && $encodings) {
5173
+		$encoding = array_pop($encodings);
5174
+		mb_internal_encoding($encoding);
5175 5175
 	}
5176 5176
 }
5177 5177
 
@@ -5183,7 +5183,7 @@  discard block
 block discarded – undo
5183 5183
  * @since 3.7.0
5184 5184
  */
5185 5185
 function reset_mbstring_encoding() {
5186
-	mbstring_binary_safe_encoding( true );
5186
+	mbstring_binary_safe_encoding(true);
5187 5187
 }
5188 5188
 
5189 5189
 /**
@@ -5196,12 +5196,12 @@  discard block
 block discarded – undo
5196 5196
  * @param mixed $var Boolean value to validate.
5197 5197
  * @return bool Whether the value is validated.
5198 5198
  */
5199
-function wp_validate_boolean( $var ) {
5200
-	if ( is_bool( $var ) ) {
5199
+function wp_validate_boolean($var) {
5200
+	if (is_bool($var)) {
5201 5201
 		return $var;
5202 5202
 	}
5203 5203
 
5204
-	if ( is_string( $var ) && 'false' === strtolower( $var ) ) {
5204
+	if (is_string($var) && 'false' === strtolower($var)) {
5205 5205
 		return false;
5206 5206
 	}
5207 5207
 
@@ -5215,7 +5215,7 @@  discard block
 block discarded – undo
5215 5215
  *
5216 5216
  * @param string $file The path to the file to delete.
5217 5217
  */
5218
-function wp_delete_file( $file ) {
5218
+function wp_delete_file($file) {
5219 5219
 	/**
5220 5220
 	 * Filter the path of the file to delete.
5221 5221
 	 *
@@ -5223,9 +5223,9 @@  discard block
 block discarded – undo
5223 5223
 	 *
5224 5224
 	 * @param string $medium Path to the file to delete.
5225 5225
 	 */
5226
-	$delete = apply_filters( 'wp_delete_file', $file );
5227
-	if ( ! empty( $delete ) ) {
5228
-		@unlink( $delete );
5226
+	$delete = apply_filters('wp_delete_file', $file);
5227
+	if ( ! empty($delete)) {
5228
+		@unlink($delete);
5229 5229
 	}
5230 5230
 }
5231 5231
 
@@ -5239,12 +5239,12 @@  discard block
 block discarded – undo
5239 5239
 function wp_post_preview_js() {
5240 5240
 	global $post;
5241 5241
 
5242
-	if ( ! is_preview() || empty( $post ) ) {
5242
+	if ( ! is_preview() || empty($post)) {
5243 5243
 		return;
5244 5244
 	}
5245 5245
 
5246 5246
 	// Has to match the window name used in post_submit_meta_box()
5247
-	$name = 'wp-preview-' . (int) $post->ID;
5247
+	$name = 'wp-preview-'.(int) $post->ID;
5248 5248
 
5249 5249
 	?>
5250 5250
 	<script>
@@ -5274,9 +5274,9 @@  discard block
 block discarded – undo
5274 5274
  * @param string $date_string Date string to parse and format.
5275 5275
  * @return string Date formatted for ISO8601/RFC3339.
5276 5276
  */
5277
-function mysql_to_rfc3339( $date_string ) {
5278
-	$formatted = mysql2date( 'c', $date_string, false );
5277
+function mysql_to_rfc3339($date_string) {
5278
+	$formatted = mysql2date('c', $date_string, false);
5279 5279
 
5280 5280
 	// Strip timezone information
5281
-	return preg_replace( '/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted );
5281
+	return preg_replace('/(?:Z|[+-]\d{2}(?::\d{2})?)$/', '', $formatted);
5282 5282
 }
Please login to merge, or discard this patch.
Braces   +522 added lines, -369 removed lines patch added patch discarded remove patch
@@ -24,22 +24,26 @@  discard block
 block discarded – undo
24 24
  * @return string|int|bool Formatted date string or Unix timestamp. False if $date is empty.
25 25
  */
26 26
 function mysql2date( $format, $date, $translate = true ) {
27
-	if ( empty( $date ) )
28
-		return false;
27
+	if ( empty( $date ) ) {
28
+			return false;
29
+	}
29 30
 
30
-	if ( 'G' == $format )
31
-		return strtotime( $date . ' +0000' );
31
+	if ( 'G' == $format ) {
32
+			return strtotime( $date . ' +0000' );
33
+	}
32 34
 
33 35
 	$i = strtotime( $date );
34 36
 
35
-	if ( 'U' == $format )
36
-		return $i;
37
+	if ( 'U' == $format ) {
38
+			return $i;
39
+	}
37 40
 
38
-	if ( $translate )
39
-		return date_i18n( $format, $i );
40
-	else
41
-		return date( $format, $i );
42
-}
41
+	if ( $translate ) {
42
+			return date_i18n( $format, $i );
43
+	} else {
44
+			return date( $format, $i );
45
+	}
46
+	}
43 47
 
44 48
 /**
45 49
  * Retrieve the current time based on specified type.
@@ -91,10 +95,11 @@  discard block
 block discarded – undo
91 95
 	$i = $unixtimestamp;
92 96
 
93 97
 	if ( false === $i ) {
94
-		if ( ! $gmt )
95
-			$i = current_time( 'timestamp' );
96
-		else
97
-			$i = time();
98
+		if ( ! $gmt ) {
99
+					$i = current_time( 'timestamp' );
100
+		} else {
101
+					$i = time();
102
+		}
98 103
 		// we should not let date() interfere with our
99 104
 		// specially computed timestamp
100 105
 		$gmt = true;
@@ -297,11 +302,13 @@  discard block
 block discarded – undo
297 302
 	// The day of the week from the timestamp.
298 303
 	$weekday = date( 'w', $day );
299 304
 
300
-	if ( !is_numeric($start_of_week) )
301
-		$start_of_week = get_option( 'start_of_week' );
305
+	if ( !is_numeric($start_of_week) ) {
306
+			$start_of_week = get_option( 'start_of_week' );
307
+	}
302 308
 
303
-	if ( $weekday < $start_of_week )
304
-		$weekday += 7;
309
+	if ( $weekday < $start_of_week ) {
310
+			$weekday += 7;
311
+	}
305 312
 
306 313
 	// The most recent week start day on or before $day.
307 314
 	$start = $day - DAY_IN_SECONDS * ( $weekday - $start_of_week );
@@ -320,8 +327,10 @@  discard block
 block discarded – undo
320 327
  * @return mixed Unserialized data can be any type.
321 328
  */
322 329
 function maybe_unserialize( $original ) {
323
-	if ( is_serialized( $original ) ) // don't attempt to unserialize data that wasn't serialized going in
330
+	if ( is_serialized( $original ) ) {
331
+		// don't attempt to unserialize data that wasn't serialized going in
324 332
 		return @unserialize( $original );
333
+	}
325 334
 	return $original;
326 335
 }
327 336
 
@@ -361,13 +370,16 @@  discard block
 block discarded – undo
361 370
 		$semicolon = strpos( $data, ';' );
362 371
 		$brace     = strpos( $data, '}' );
363 372
 		// Either ; or } must exist.
364
-		if ( false === $semicolon && false === $brace )
365
-			return false;
373
+		if ( false === $semicolon && false === $brace ) {
374
+					return false;
375
+		}
366 376
 		// But neither must be in the first X characters.
367
-		if ( false !== $semicolon && $semicolon < 3 )
368
-			return false;
369
-		if ( false !== $brace && $brace < 4 )
370
-			return false;
377
+		if ( false !== $semicolon && $semicolon < 3 ) {
378
+					return false;
379
+		}
380
+		if ( false !== $brace && $brace < 4 ) {
381
+					return false;
382
+		}
371 383
 	}
372 384
 	$token = $data[0];
373 385
 	switch ( $token ) {
@@ -430,14 +442,16 @@  discard block
 block discarded – undo
430 442
  * @return mixed A scalar data
431 443
  */
432 444
 function maybe_serialize( $data ) {
433
-	if ( is_array( $data ) || is_object( $data ) )
434
-		return serialize( $data );
445
+	if ( is_array( $data ) || is_object( $data ) ) {
446
+			return serialize( $data );
447
+	}
435 448
 
436 449
 	// Double serialization is required for backward compatibility.
437 450
 	// See https://core.trac.wordpress.org/ticket/12930
438 451
 	// Also the world will end. See WP 3.6.1.
439
-	if ( is_serialized( $data, false ) )
440
-		return serialize( $data );
452
+	if ( is_serialized( $data, false ) ) {
453
+			return serialize( $data );
454
+	}
441 455
 
442 456
 	return $data;
443 457
 }
@@ -565,20 +579,23 @@  discard block
 block discarded – undo
565 579
 	foreach ( $pung as $link_test ) {
566 580
 		if ( ! in_array( $link_test, $post_links_temp ) ) { // link no longer in post
567 581
 			$mids = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE %s", $post_ID, $wpdb->esc_like( $link_test ) . '%') );
568
-			foreach ( $mids as $mid )
569
-				delete_metadata_by_mid( 'post', $mid );
582
+			foreach ( $mids as $mid ) {
583
+							delete_metadata_by_mid( 'post', $mid );
584
+			}
570 585
 		}
571 586
 	}
572 587
 
573 588
 	foreach ( (array) $post_links_temp as $link_test ) {
574 589
 		if ( !in_array( $link_test, $pung ) ) { // If we haven't pung it already
575 590
 			$test = @parse_url( $link_test );
576
-			if ( false === $test )
577
-				continue;
578
-			if ( isset( $test['query'] ) )
579
-				$post_links[] = $link_test;
580
-			elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) )
581
-				$post_links[] = $link_test;
591
+			if ( false === $test ) {
592
+							continue;
593
+			}
594
+			if ( isset( $test['query'] ) ) {
595
+							$post_links[] = $link_test;
596
+			} elseif ( isset($test['path']) && ( $test['path'] != '/' ) &&  ($test['path'] != '' ) ) {
597
+							$post_links[] = $link_test;
598
+			}
582 599
 		}
583 600
 	}
584 601
 
@@ -636,13 +653,15 @@  discard block
 block discarded – undo
636 653
  * @return bool|string False on failure, headers on success.
637 654
  */
638 655
 function wp_get_http_headers( $url, $deprecated = false ) {
639
-	if ( !empty( $deprecated ) )
640
-		_deprecated_argument( __FUNCTION__, '2.7' );
656
+	if ( !empty( $deprecated ) ) {
657
+			_deprecated_argument( __FUNCTION__, '2.7' );
658
+	}
641 659
 
642 660
 	$response = wp_safe_remote_head( $url );
643 661
 
644
-	if ( is_wp_error( $response ) )
645
-		return false;
662
+	if ( is_wp_error( $response ) ) {
663
+			return false;
664
+	}
646 665
 
647 666
 	return wp_remote_retrieve_headers( $response );
648 667
 }
@@ -660,11 +679,12 @@  discard block
 block discarded – undo
660 679
  */
661 680
 function is_new_day() {
662 681
 	global $currentday, $previousday;
663
-	if ( $currentday != $previousday )
664
-		return 1;
665
-	else
666
-		return 0;
667
-}
682
+	if ( $currentday != $previousday ) {
683
+			return 1;
684
+	} else {
685
+			return 0;
686
+	}
687
+	}
668 688
 
669 689
 /**
670 690
  * Build URL query based on an associative and, or indexed array.
@@ -707,27 +727,33 @@  discard block
 block discarded – undo
707 727
 	$ret = array();
708 728
 
709 729
 	foreach ( (array) $data as $k => $v ) {
710
-		if ( $urlencode)
711
-			$k = urlencode($k);
712
-		if ( is_int($k) && $prefix != null )
713
-			$k = $prefix.$k;
714
-		if ( !empty($key) )
715
-			$k = $key . '%5B' . $k . '%5D';
716
-		if ( $v === null )
717
-			continue;
718
-		elseif ( $v === false )
719
-			$v = '0';
730
+		if ( $urlencode) {
731
+					$k = urlencode($k);
732
+		}
733
+		if ( is_int($k) && $prefix != null ) {
734
+					$k = $prefix.$k;
735
+		}
736
+		if ( !empty($key) ) {
737
+					$k = $key . '%5B' . $k . '%5D';
738
+		}
739
+		if ( $v === null ) {
740
+					continue;
741
+		} elseif ( $v === false ) {
742
+					$v = '0';
743
+		}
720 744
 
721
-		if ( is_array($v) || is_object($v) )
722
-			array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
723
-		elseif ( $urlencode )
724
-			array_push($ret, $k.'='.urlencode($v));
725
-		else
726
-			array_push($ret, $k.'='.$v);
745
+		if ( is_array($v) || is_object($v) ) {
746
+					array_push($ret,_http_build_query($v, '', $sep, $k, $urlencode));
747
+		} elseif ( $urlencode ) {
748
+					array_push($ret, $k.'='.urlencode($v));
749
+		} else {
750
+					array_push($ret, $k.'='.$v);
751
+		}
727 752
 	}
728 753
 
729
-	if ( null === $sep )
730
-		$sep = ini_get('arg_separator.output');
754
+	if ( null === $sep ) {
755
+			$sep = ini_get('arg_separator.output');
756
+	}
731 757
 
732 758
 	return implode($sep, $ret);
733 759
 }
@@ -770,21 +796,24 @@  discard block
 block discarded – undo
770 796
 function add_query_arg() {
771 797
 	$args = func_get_args();
772 798
 	if ( is_array( $args[0] ) ) {
773
-		if ( count( $args ) < 2 || false === $args[1] )
774
-			$uri = $_SERVER['REQUEST_URI'];
775
-		else
776
-			$uri = $args[1];
799
+		if ( count( $args ) < 2 || false === $args[1] ) {
800
+					$uri = $_SERVER['REQUEST_URI'];
801
+		} else {
802
+					$uri = $args[1];
803
+		}
777 804
 	} else {
778
-		if ( count( $args ) < 3 || false === $args[2] )
779
-			$uri = $_SERVER['REQUEST_URI'];
780
-		else
781
-			$uri = $args[2];
805
+		if ( count( $args ) < 3 || false === $args[2] ) {
806
+					$uri = $_SERVER['REQUEST_URI'];
807
+		} else {
808
+					$uri = $args[2];
809
+		}
782 810
 	}
783 811
 
784
-	if ( $frag = strstr( $uri, '#' ) )
785
-		$uri = substr( $uri, 0, -strlen( $frag ) );
786
-	else
787
-		$frag = '';
812
+	if ( $frag = strstr( $uri, '#' ) ) {
813
+			$uri = substr( $uri, 0, -strlen( $frag ) );
814
+	} else {
815
+			$frag = '';
816
+	}
788 817
 
789 818
 	if ( 0 === stripos( $uri, 'http://' ) ) {
790 819
 		$protocol = 'http://';
@@ -818,8 +847,9 @@  discard block
 block discarded – undo
818 847
 	}
819 848
 
820 849
 	foreach ( $qs as $k => $v ) {
821
-		if ( $v === false )
822
-			unset( $qs[$k] );
850
+		if ( $v === false ) {
851
+					unset( $qs[$k] );
852
+		}
823 853
 	}
824 854
 
825 855
 	$ret = build_query( $qs );
@@ -841,8 +871,9 @@  discard block
 block discarded – undo
841 871
  */
842 872
 function remove_query_arg( $key, $query = false ) {
843 873
 	if ( is_array( $key ) ) { // removing multiple keys
844
-		foreach ( $key as $k )
845
-			$query = add_query_arg( $k, false, $query );
874
+		foreach ( $key as $k ) {
875
+					$query = add_query_arg( $k, false, $query );
876
+		}
846 877
 		return $query;
847 878
 	}
848 879
 	return add_query_arg( $key, false, $query );
@@ -922,16 +953,18 @@  discard block
 block discarded – undo
922 953
 function wp_remote_fopen( $uri ) {
923 954
 	$parsed_url = @parse_url( $uri );
924 955
 
925
-	if ( !$parsed_url || !is_array( $parsed_url ) )
926
-		return false;
956
+	if ( !$parsed_url || !is_array( $parsed_url ) ) {
957
+			return false;
958
+	}
927 959
 
928 960
 	$options = array();
929 961
 	$options['timeout'] = 10;
930 962
 
931 963
 	$response = wp_safe_remote_get( $uri, $options );
932 964
 
933
-	if ( is_wp_error( $response ) )
934
-		return false;
965
+	if ( is_wp_error( $response ) ) {
966
+			return false;
967
+	}
935 968
 
936 969
 	return wp_remote_retrieve_body( $response );
937 970
 }
@@ -951,9 +984,10 @@  discard block
 block discarded – undo
951 984
 	global $wp, $wp_query, $wp_the_query;
952 985
 	$wp->main( $query_vars );
953 986
 
954
-	if ( !isset($wp_the_query) )
955
-		$wp_the_query = $wp_query;
956
-}
987
+	if ( !isset($wp_the_query) ) {
988
+			$wp_the_query = $wp_query;
989
+	}
990
+	}
957 991
 
958 992
 /**
959 993
  * Retrieve the description for the HTTP status.
@@ -1038,11 +1072,12 @@  discard block
 block discarded – undo
1038 1072
 		);
1039 1073
 	}
1040 1074
 
1041
-	if ( isset( $wp_header_to_desc[$code] ) )
1042
-		return $wp_header_to_desc[$code];
1043
-	else
1044
-		return '';
1045
-}
1075
+	if ( isset( $wp_header_to_desc[$code] ) ) {
1076
+			return $wp_header_to_desc[$code];
1077
+	} else {
1078
+			return '';
1079
+	}
1080
+	}
1046 1081
 
1047 1082
 /**
1048 1083
  * Set HTTP status header.
@@ -1066,8 +1101,8 @@  discard block
 block discarded – undo
1066 1101
 
1067 1102
 	$protocol = wp_get_server_protocol();
1068 1103
 	$status_header = "$protocol $code $description";
1069
-	if ( function_exists( 'apply_filters' ) )
1070
-
1104
+	if ( function_exists( 'apply_filters' ) ) {
1105
+	
1071 1106
 		/**
1072 1107
 		 * Filter an HTTP status header.
1073 1108
 		 *
@@ -1079,6 +1114,7 @@  discard block
 block discarded – undo
1079 1114
 		 * @param string $protocol      Server protocol.
1080 1115
 		 */
1081 1116
 		$status_header = apply_filters( 'status_header', $status_header, $code, $description, $protocol );
1117
+	}
1082 1118
 
1083 1119
 	@header( $status_header, true, $code );
1084 1120
 }
@@ -1152,9 +1188,10 @@  discard block
 block discarded – undo
1152 1188
 		}
1153 1189
 	}
1154 1190
 
1155
-	foreach ( $headers as $name => $field_value )
1156
-		@header("{$name}: {$field_value}");
1157
-}
1191
+	foreach ( $headers as $name => $field_value ) {
1192
+			@header("{$name}: {$field_value}");
1193
+	}
1194
+	}
1158 1195
 
1159 1196
 /**
1160 1197
  * Set the headers for caching for 10 days with JavaScript content type.
@@ -1217,8 +1254,9 @@  discard block
 block discarded – undo
1217 1254
 	// Remove the pad, if present.
1218 1255
 	$feed = preg_replace( '/^_+/', '', $feed );
1219 1256
 
1220
-	if ( $feed == '' || $feed == 'feed' )
1221
-		$feed = get_default_feed();
1257
+	if ( $feed == '' || $feed == 'feed' ) {
1258
+			$feed = get_default_feed();
1259
+	}
1222 1260
 
1223 1261
 	if ( ! has_action( "do_feed_{$feed}" ) ) {
1224 1262
 		wp_die( __( 'ERROR: This is not a valid feed template.' ), '', array( 'response' => 404 ) );
@@ -1271,11 +1309,12 @@  discard block
 block discarded – undo
1271 1309
  * @param bool $for_comments True for the comment feed, false for normal feed.
1272 1310
  */
1273 1311
 function do_feed_rss2( $for_comments ) {
1274
-	if ( $for_comments )
1275
-		load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1276
-	else
1277
-		load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1278
-}
1312
+	if ( $for_comments ) {
1313
+			load_template( ABSPATH . WPINC . '/feed-rss2-comments.php' );
1314
+	} else {
1315
+			load_template( ABSPATH . WPINC . '/feed-rss2.php' );
1316
+	}
1317
+	}
1279 1318
 
1280 1319
 /**
1281 1320
  * Load either Atom comment feed or Atom posts feed.
@@ -1287,11 +1326,12 @@  discard block
 block discarded – undo
1287 1326
  * @param bool $for_comments True for the comment feed, false for normal feed.
1288 1327
  */
1289 1328
 function do_feed_atom( $for_comments ) {
1290
-	if ($for_comments)
1291
-		load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1292
-	else
1293
-		load_template( ABSPATH . WPINC . '/feed-atom.php' );
1294
-}
1329
+	if ($for_comments) {
1330
+			load_template( ABSPATH . WPINC . '/feed-atom-comments.php');
1331
+	} else {
1332
+			load_template( ABSPATH . WPINC . '/feed-atom.php' );
1333
+	}
1334
+	}
1295 1335
 
1296 1336
 /**
1297 1337
  * Display the robots.txt file content.
@@ -1355,29 +1395,33 @@  discard block
 block discarded – undo
1355 1395
 	 * Check cache first. If options table goes away and we have true
1356 1396
 	 * cached, oh well.
1357 1397
 	 */
1358
-	if ( wp_cache_get( 'is_blog_installed' ) )
1359
-		return true;
1398
+	if ( wp_cache_get( 'is_blog_installed' ) ) {
1399
+			return true;
1400
+	}
1360 1401
 
1361 1402
 	$suppress = $wpdb->suppress_errors();
1362 1403
 	if ( ! wp_installing() ) {
1363 1404
 		$alloptions = wp_load_alloptions();
1364 1405
 	}
1365 1406
 	// If siteurl is not set to autoload, check it specifically
1366
-	if ( !isset( $alloptions['siteurl'] ) )
1367
-		$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1368
-	else
1369
-		$installed = $alloptions['siteurl'];
1407
+	if ( !isset( $alloptions['siteurl'] ) ) {
1408
+			$installed = $wpdb->get_var( "SELECT option_value FROM $wpdb->options WHERE option_name = 'siteurl'" );
1409
+	} else {
1410
+			$installed = $alloptions['siteurl'];
1411
+	}
1370 1412
 	$wpdb->suppress_errors( $suppress );
1371 1413
 
1372 1414
 	$installed = !empty( $installed );
1373 1415
 	wp_cache_set( 'is_blog_installed', $installed );
1374 1416
 
1375
-	if ( $installed )
1376
-		return true;
1417
+	if ( $installed ) {
1418
+			return true;
1419
+	}
1377 1420
 
1378 1421
 	// If visiting repair.php, return true and let it take over.
1379
-	if ( defined( 'WP_REPAIRING' ) )
1380
-		return true;
1422
+	if ( defined( 'WP_REPAIRING' ) ) {
1423
+			return true;
1424
+	}
1381 1425
 
1382 1426
 	$suppress = $wpdb->suppress_errors();
1383 1427
 
@@ -1389,13 +1433,16 @@  discard block
 block discarded – undo
1389 1433
 	$wp_tables = $wpdb->tables();
1390 1434
 	foreach ( $wp_tables as $table ) {
1391 1435
 		// The existence of custom user tables shouldn't suggest an insane state or prevent a clean install.
1392
-		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table )
1393
-			continue;
1394
-		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table )
1395
-			continue;
1436
+		if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) {
1437
+					continue;
1438
+		}
1439
+		if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) {
1440
+					continue;
1441
+		}
1396 1442
 
1397
-		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) )
1398
-			continue;
1443
+		if ( ! $wpdb->get_results( "DESCRIBE $table;" ) ) {
1444
+					continue;
1445
+		}
1399 1446
 
1400 1447
 		// One or more tables exist. We are insane.
1401 1448
 
@@ -1458,11 +1505,13 @@  discard block
 block discarded – undo
1458 1505
 	$name = esc_attr( $name );
1459 1506
 	$nonce_field = '<input type="hidden" id="' . $name . '" name="' . $name . '" value="' . wp_create_nonce( $action ) . '" />';
1460 1507
 
1461
-	if ( $referer )
1462
-		$nonce_field .= wp_referer_field( false );
1508
+	if ( $referer ) {
1509
+			$nonce_field .= wp_referer_field( false );
1510
+	}
1463 1511
 
1464
-	if ( $echo )
1465
-		echo $nonce_field;
1512
+	if ( $echo ) {
1513
+			echo $nonce_field;
1514
+	}
1466 1515
 
1467 1516
 	return $nonce_field;
1468 1517
 }
@@ -1481,8 +1530,9 @@  discard block
 block discarded – undo
1481 1530
 function wp_referer_field( $echo = true ) {
1482 1531
 	$referer_field = '<input type="hidden" name="_wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
1483 1532
 
1484
-	if ( $echo )
1485
-		echo $referer_field;
1533
+	if ( $echo ) {
1534
+			echo $referer_field;
1535
+	}
1486 1536
 	return $referer_field;
1487 1537
 }
1488 1538
 
@@ -1505,8 +1555,9 @@  discard block
 block discarded – undo
1505 1555
 		$ref = 'previous' == $jump_back_to ? wp_get_referer() : wp_unslash( $_SERVER['REQUEST_URI'] );
1506 1556
 	}
1507 1557
 	$orig_referer_field = '<input type="hidden" name="_wp_original_http_referer" value="' . esc_attr( $ref ) . '" />';
1508
-	if ( $echo )
1509
-		echo $orig_referer_field;
1558
+	if ( $echo ) {
1559
+			echo $orig_referer_field;
1560
+	}
1510 1561
 	return $orig_referer_field;
1511 1562
 }
1512 1563
 
@@ -1560,8 +1611,9 @@  discard block
 block discarded – undo
1560 1611
  * @return string|false False if no original referer or original referer if set.
1561 1612
  */
1562 1613
 function wp_get_original_referer() {
1563
-	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) )
1564
-		return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1614
+	if ( ! empty( $_REQUEST['_wp_original_http_referer'] ) && function_exists( 'wp_validate_redirect' ) ) {
1615
+			return wp_validate_redirect( wp_unslash( $_REQUEST['_wp_original_http_referer'] ), false );
1616
+	}
1565 1617
 	return false;
1566 1618
 }
1567 1619
 
@@ -1596,11 +1648,13 @@  discard block
 block discarded – undo
1596 1648
 	 * Use rtrim() instead of untrailingslashit to avoid formatting.php dependency.
1597 1649
 	 */
1598 1650
 	$target = rtrim($target, '/');
1599
-	if ( empty($target) )
1600
-		$target = '/';
1651
+	if ( empty($target) ) {
1652
+			$target = '/';
1653
+	}
1601 1654
 
1602
-	if ( file_exists( $target ) )
1603
-		return @is_dir( $target );
1655
+	if ( file_exists( $target ) ) {
1656
+			return @is_dir( $target );
1657
+	}
1604 1658
 
1605 1659
 	// We need to find the permissions of the parent folder that exists and inherit that.
1606 1660
 	$target_parent = dirname( $target );
@@ -1649,15 +1703,18 @@  discard block
 block discarded – undo
1649 1703
 	 * This is definitive if true but fails if $path does not exist or contains
1650 1704
 	 * a symbolic link.
1651 1705
 	 */
1652
-	if ( realpath($path) == $path )
1653
-		return true;
1706
+	if ( realpath($path) == $path ) {
1707
+			return true;
1708
+	}
1654 1709
 
1655
-	if ( strlen($path) == 0 || $path[0] == '.' )
1656
-		return false;
1710
+	if ( strlen($path) == 0 || $path[0] == '.' ) {
1711
+			return false;
1712
+	}
1657 1713
 
1658 1714
 	// Windows allows absolute paths like this.
1659
-	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) )
1660
-		return true;
1715
+	if ( preg_match('#^[a-zA-Z]:\\\\#', $path) ) {
1716
+			return true;
1717
+	}
1661 1718
 
1662 1719
 	// A path starting with / or \ is absolute; anything else is relative.
1663 1720
 	return ( $path[0] == '/' || $path[0] == '\\' );
@@ -1676,8 +1733,9 @@  discard block
 block discarded – undo
1676 1733
  * @return string The path with the base or absolute path.
1677 1734
  */
1678 1735
 function path_join( $base, $path ) {
1679
-	if ( path_is_absolute($path) )
1680
-		return $path;
1736
+	if ( path_is_absolute($path) ) {
1737
+			return $path;
1738
+	}
1681 1739
 
1682 1740
 	return rtrim($base, '/') . '/' . ltrim($path, '/');
1683 1741
 }
@@ -1724,25 +1782,30 @@  discard block
 block discarded – undo
1724 1782
  */
1725 1783
 function get_temp_dir() {
1726 1784
 	static $temp = '';
1727
-	if ( defined('WP_TEMP_DIR') )
1728
-		return trailingslashit(WP_TEMP_DIR);
1785
+	if ( defined('WP_TEMP_DIR') ) {
1786
+			return trailingslashit(WP_TEMP_DIR);
1787
+	}
1729 1788
 
1730
-	if ( $temp )
1731
-		return trailingslashit( $temp );
1789
+	if ( $temp ) {
1790
+			return trailingslashit( $temp );
1791
+	}
1732 1792
 
1733 1793
 	if ( function_exists('sys_get_temp_dir') ) {
1734 1794
 		$temp = sys_get_temp_dir();
1735
-		if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1736
-			return trailingslashit( $temp );
1795
+		if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1796
+					return trailingslashit( $temp );
1797
+		}
1737 1798
 	}
1738 1799
 
1739 1800
 	$temp = ini_get('upload_tmp_dir');
1740
-	if ( @is_dir( $temp ) && wp_is_writable( $temp ) )
1741
-		return trailingslashit( $temp );
1801
+	if ( @is_dir( $temp ) && wp_is_writable( $temp ) ) {
1802
+			return trailingslashit( $temp );
1803
+	}
1742 1804
 
1743 1805
 	$temp = WP_CONTENT_DIR . '/';
1744
-	if ( is_dir( $temp ) && wp_is_writable( $temp ) )
1745
-		return $temp;
1806
+	if ( is_dir( $temp ) && wp_is_writable( $temp ) ) {
1807
+			return $temp;
1808
+	}
1746 1809
 
1747 1810
 	return '/tmp/';
1748 1811
 }
@@ -1761,11 +1824,12 @@  discard block
 block discarded – undo
1761 1824
  * @return bool Whether the path is writable.
1762 1825
  */
1763 1826
 function wp_is_writable( $path ) {
1764
-	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) )
1765
-		return win_is_writable( $path );
1766
-	else
1767
-		return @is_writable( $path );
1768
-}
1827
+	if ( 'WIN' === strtoupper( substr( PHP_OS, 0, 3 ) ) ) {
1828
+			return win_is_writable( $path );
1829
+	} else {
1830
+			return @is_writable( $path );
1831
+	}
1832
+	}
1769 1833
 
1770 1834
 /**
1771 1835
  * Workaround for Windows bug in is_writable() function
@@ -1793,11 +1857,13 @@  discard block
 block discarded – undo
1793 1857
 	// check tmp file for read/write capabilities
1794 1858
 	$should_delete_tmp_file = !file_exists( $path );
1795 1859
 	$f = @fopen( $path, 'a' );
1796
-	if ( $f === false )
1797
-		return false;
1860
+	if ( $f === false ) {
1861
+			return false;
1862
+	}
1798 1863
 	fclose( $f );
1799
-	if ( $should_delete_tmp_file )
1800
-		unlink( $path );
1864
+	if ( $should_delete_tmp_file ) {
1865
+			unlink( $path );
1866
+	}
1801 1867
 	return true;
1802 1868
 }
1803 1869
 
@@ -1921,10 +1987,11 @@  discard block
 block discarded – undo
1921 1987
 	}
1922 1988
 
1923 1989
 	if ( !$url = get_option( 'upload_url_path' ) ) {
1924
-		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) )
1925
-			$url = WP_CONTENT_URL . '/uploads';
1926
-		else
1927
-			$url = trailingslashit( $siteurl ) . $upload_path;
1990
+		if ( empty($upload_path) || ( 'wp-content/uploads' == $upload_path ) || ( $upload_path == $dir ) ) {
1991
+					$url = WP_CONTENT_URL . '/uploads';
1992
+		} else {
1993
+					$url = trailingslashit( $siteurl ) . $upload_path;
1994
+		}
1928 1995
 	}
1929 1996
 
1930 1997
 	/*
@@ -1949,10 +2016,11 @@  discard block
 block discarded – undo
1949 2016
 			 * had wp-content/uploads for the main site.)
1950 2017
 			 */
1951 2018
 
1952
-			if ( defined( 'MULTISITE' ) )
1953
-				$ms_dir = '/sites/' . get_current_blog_id();
1954
-			else
1955
-				$ms_dir = '/' . get_current_blog_id();
2019
+			if ( defined( 'MULTISITE' ) ) {
2020
+							$ms_dir = '/sites/' . get_current_blog_id();
2021
+			} else {
2022
+							$ms_dir = '/' . get_current_blog_id();
2023
+			}
1956 2024
 
1957 2025
 			$dir .= $ms_dir;
1958 2026
 			$url .= $ms_dir;
@@ -1972,10 +2040,11 @@  discard block
 block discarded – undo
1972 2040
 			 * rewriting in multisite, the resulting URL is /files. (#WP22702 for background.)
1973 2041
 			 */
1974 2042
 
1975
-			if ( defined( 'BLOGUPLOADDIR' ) )
1976
-				$dir = untrailingslashit( BLOGUPLOADDIR );
1977
-			else
1978
-				$dir = ABSPATH . UPLOADS;
2043
+			if ( defined( 'BLOGUPLOADDIR' ) ) {
2044
+							$dir = untrailingslashit( BLOGUPLOADDIR );
2045
+			} else {
2046
+							$dir = ABSPATH . UPLOADS;
2047
+			}
1979 2048
 			$url = trailingslashit( $siteurl ) . 'files';
1980 2049
 		}
1981 2050
 	}
@@ -1986,8 +2055,9 @@  discard block
 block discarded – undo
1986 2055
 	$subdir = '';
1987 2056
 	if ( get_option( 'uploads_use_yearmonth_folders' ) ) {
1988 2057
 		// Generate the yearly and monthly dirs
1989
-		if ( !$time )
1990
-			$time = current_time( 'mysql' );
2058
+		if ( !$time ) {
2059
+					$time = current_time( 'mysql' );
2060
+		}
1991 2061
 		$y = substr( $time, 0, 4 );
1992 2062
 		$m = substr( $time, 5, 2 );
1993 2063
 		$subdir = "/$y/$m";
@@ -2033,8 +2103,9 @@  discard block
 block discarded – undo
2033 2103
 	$name = basename($filename, $ext);
2034 2104
 
2035 2105
 	// Edge case: if file is named '.ext', treat as an empty name.
2036
-	if ( $name === $ext )
2037
-		$name = '';
2106
+	if ( $name === $ext ) {
2107
+			$name = '';
2108
+	}
2038 2109
 
2039 2110
 	/*
2040 2111
 	 * Increment the file number until we have a unique file to save in $dir.
@@ -2108,20 +2179,24 @@  discard block
 block discarded – undo
2108 2179
  * @return array
2109 2180
  */
2110 2181
 function wp_upload_bits( $name, $deprecated, $bits, $time = null ) {
2111
-	if ( !empty( $deprecated ) )
2112
-		_deprecated_argument( __FUNCTION__, '2.0' );
2182
+	if ( !empty( $deprecated ) ) {
2183
+			_deprecated_argument( __FUNCTION__, '2.0' );
2184
+	}
2113 2185
 
2114
-	if ( empty( $name ) )
2115
-		return array( 'error' => __( 'Empty filename' ) );
2186
+	if ( empty( $name ) ) {
2187
+			return array( 'error' => __( 'Empty filename' ) );
2188
+	}
2116 2189
 
2117 2190
 	$wp_filetype = wp_check_filetype( $name );
2118
-	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) )
2119
-		return array( 'error' => __( 'Invalid file type' ) );
2191
+	if ( ! $wp_filetype['ext'] && ! current_user_can( 'unfiltered_upload' ) ) {
2192
+			return array( 'error' => __( 'Invalid file type' ) );
2193
+	}
2120 2194
 
2121 2195
 	$upload = wp_upload_dir( $time );
2122 2196
 
2123
-	if ( $upload['error'] !== false )
2124
-		return $upload;
2197
+	if ( $upload['error'] !== false ) {
2198
+			return $upload;
2199
+	}
2125 2200
 
2126 2201
 	/**
2127 2202
 	 * Filter whether to treat the upload bits as an error.
@@ -2143,18 +2218,20 @@  discard block
 block discarded – undo
2143 2218
 
2144 2219
 	$new_file = $upload['path'] . "/$filename";
2145 2220
 	if ( ! wp_mkdir_p( dirname( $new_file ) ) ) {
2146
-		if ( 0 === strpos( $upload['basedir'], ABSPATH ) )
2147
-			$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2148
-		else
2149
-			$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2221
+		if ( 0 === strpos( $upload['basedir'], ABSPATH ) ) {
2222
+					$error_path = str_replace( ABSPATH, '', $upload['basedir'] ) . $upload['subdir'];
2223
+		} else {
2224
+					$error_path = basename( $upload['basedir'] ) . $upload['subdir'];
2225
+		}
2150 2226
 
2151 2227
 		$message = sprintf( __( 'Unable to create directory %s. Is its parent directory writable by the server?' ), $error_path );
2152 2228
 		return array( 'error' => $message );
2153 2229
 	}
2154 2230
 
2155 2231
 	$ifp = @ fopen( $new_file, 'wb' );
2156
-	if ( ! $ifp )
2157
-		return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2232
+	if ( ! $ifp ) {
2233
+			return array( 'error' => sprintf( __( 'Could not write file %s' ), $new_file ) );
2234
+	}
2158 2235
 
2159 2236
 	@fwrite( $ifp, $bits );
2160 2237
 	fclose( $ifp );
@@ -2207,10 +2284,11 @@  discard block
 block discarded – undo
2207 2284
 		'code'        => array( 'css', 'htm',  'html', 'php',  'js' ),
2208 2285
 	) );
2209 2286
 
2210
-	foreach ( $ext2type as $type => $exts )
2211
-		if ( in_array( $ext, $exts ) )
2287
+	foreach ( $ext2type as $type => $exts ) {
2288
+			if ( in_array( $ext, $exts ) )
2212 2289
 			return $type;
2213
-}
2290
+	}
2291
+	}
2214 2292
 
2215 2293
 /**
2216 2294
  * Retrieve the file type from the file name.
@@ -2224,8 +2302,9 @@  discard block
 block discarded – undo
2224 2302
  * @return array Values with extension first and mime type.
2225 2303
  */
2226 2304
 function wp_check_filetype( $filename, $mimes = null ) {
2227
-	if ( empty($mimes) )
2228
-		$mimes = get_allowed_mime_types();
2305
+	if ( empty($mimes) ) {
2306
+			$mimes = get_allowed_mime_types();
2307
+	}
2229 2308
 	$type = false;
2230 2309
 	$ext = false;
2231 2310
 
@@ -2464,11 +2543,13 @@  discard block
 block discarded – undo
2464 2543
 	$t = wp_get_mime_types();
2465 2544
 
2466 2545
 	unset( $t['swf'], $t['exe'] );
2467
-	if ( function_exists( 'current_user_can' ) )
2468
-		$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2546
+	if ( function_exists( 'current_user_can' ) ) {
2547
+			$unfiltered = $user ? user_can( $user, 'unfiltered_html' ) : current_user_can( 'unfiltered_html' );
2548
+	}
2469 2549
 
2470
-	if ( empty( $unfiltered ) )
2471
-		unset( $t['htm|html'] );
2550
+	if ( empty( $unfiltered ) ) {
2551
+			unset( $t['htm|html'] );
2552
+	}
2472 2553
 
2473 2554
 	/**
2474 2555
 	 * Filter list of allowed mime types and file extensions.
@@ -2500,8 +2581,9 @@  discard block
 block discarded – undo
2500 2581
 		$html .= sprintf( __( "Do you really want to <a href='%s'>log out</a>?"), wp_logout_url( $redirect_to ) );
2501 2582
 	} else {
2502 2583
 		$html = __( 'Are you sure you want to do this?' );
2503
-		if ( wp_get_referer() )
2504
-			$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2584
+		if ( wp_get_referer() ) {
2585
+					$html .= "</p><p><a href='" . esc_url( remove_query_arg( 'updated', wp_get_referer() ) ) . "'>" . __( 'Please try again.' ) . "</a>";
2586
+		}
2505 2587
 	}
2506 2588
 
2507 2589
 	wp_die( $html, __( 'WordPress Failure Notice' ), 403 );
@@ -2603,8 +2685,9 @@  discard block
 block discarded – undo
2603 2685
 	if ( function_exists( 'is_wp_error' ) && is_wp_error( $message ) ) {
2604 2686
 		if ( empty( $title ) ) {
2605 2687
 			$error_data = $message->get_error_data();
2606
-			if ( is_array( $error_data ) && isset( $error_data['title'] ) )
2607
-				$title = $error_data['title'];
2688
+			if ( is_array( $error_data ) && isset( $error_data['title'] ) ) {
2689
+							$title = $error_data['title'];
2690
+			}
2608 2691
 		}
2609 2692
 		$errors = $message->get_error_messages();
2610 2693
 		switch ( count( $errors ) ) {
@@ -2634,19 +2717,26 @@  discard block
 block discarded – undo
2634 2717
 			header( 'Content-Type: text/html; charset=utf-8' );
2635 2718
 		}
2636 2719
 
2637
-		if ( empty($title) )
2638
-			$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2720
+		if ( empty($title) ) {
2721
+					$title = $have_gettext ? __('WordPress &rsaquo; Error') : 'WordPress &rsaquo; Error';
2722
+		}
2639 2723
 
2640 2724
 		$text_direction = 'ltr';
2641
-		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] )
2642
-			$text_direction = 'rtl';
2643
-		elseif ( function_exists( 'is_rtl' ) && is_rtl() )
2644
-			$text_direction = 'rtl';
2645
-?>
2725
+		if ( isset($r['text_direction']) && 'rtl' == $r['text_direction'] ) {
2726
+					$text_direction = 'rtl';
2727
+		} elseif ( function_exists( 'is_rtl' ) && is_rtl() ) {
2728
+					$text_direction = 'rtl';
2729
+		}
2730
+		?>
2646 2731
 <!DOCTYPE html>
2647 2732
 <!-- Ticket #11289, IE bug fix: always pad the error page with enough characters such that it is greater than 512 bytes, even after gzip compression abcdefghijklmnopqrstuvwxyz1234567890aabbccddeeffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz11223344556677889900abacbcbdcdcededfefegfgfhghgihihjijikjkjlklkmlmlnmnmononpopoqpqprqrqsrsrtstsubcbcdcdedefefgfabcadefbghicjkldmnoepqrfstugvwxhyz1i234j567k890laabmbccnddeoeffpgghqhiirjjksklltmmnunoovppqwqrrxsstytuuzvvw0wxx1yyz2z113223434455666777889890091abc2def3ghi4jkl5mno6pqr7stu8vwx9yz11aab2bcc3dd4ee5ff6gg7hh8ii9j0jk1kl2lmm3nnoo4p5pq6qrr7ss8tt9uuvv0wwx1x2yyzz13aba4cbcb5dcdc6dedfef8egf9gfh0ghg1ihi2hji3jik4jkj5lkl6kml7mln8mnm9ono
2648 2733
 -->
2649
-<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) language_attributes(); else echo "dir='$text_direction'"; ?>>
2734
+<html xmlns="http://www.w3.org/1999/xhtml" <?php if ( function_exists( 'language_attributes' ) && function_exists( 'is_rtl' ) ) {
2735
+	language_attributes();
2736
+} else {
2737
+	echo "dir='$text_direction'";
2738
+}
2739
+?>>
2650 2740
 <head>
2651 2741
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
2652 2742
 	<meta name="viewport" content="width=device-width">
@@ -2815,8 +2905,9 @@  discard block
 block discarded – undo
2815 2905
  * @param string $message Optional. Response to print. Default empty.
2816 2906
  */
2817 2907
 function _ajax_wp_die_handler( $message = '' ) {
2818
-	if ( is_scalar( $message ) )
2819
-		die( (string) $message );
2908
+	if ( is_scalar( $message ) ) {
2909
+			die( (string) $message );
2910
+	}
2820 2911
 	die( '0' );
2821 2912
 }
2822 2913
 
@@ -2831,8 +2922,9 @@  discard block
 block discarded – undo
2831 2922
  * @param string $message Optional. Response to print. Default empty.
2832 2923
  */
2833 2924
 function _scalar_wp_die_handler( $message = '' ) {
2834
-	if ( is_scalar( $message ) )
2835
-		die( (string) $message );
2925
+	if ( is_scalar( $message ) ) {
2926
+			die( (string) $message );
2927
+	}
2836 2928
 	die();
2837 2929
 }
2838 2930
 
@@ -3038,11 +3130,12 @@  discard block
 block discarded – undo
3038 3130
 function wp_send_json( $response ) {
3039 3131
 	@header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
3040 3132
 	echo wp_json_encode( $response );
3041
-	if ( defined( 'DOING_AJAX' ) && DOING_AJAX )
3042
-		wp_die();
3043
-	else
3044
-		die;
3045
-}
3133
+	if ( defined( 'DOING_AJAX' ) && DOING_AJAX ) {
3134
+			wp_die();
3135
+	} else {
3136
+			die;
3137
+	}
3138
+	}
3046 3139
 
3047 3140
 /**
3048 3141
  * Send a JSON response back to an Ajax request, indicating success.
@@ -3054,8 +3147,9 @@  discard block
 block discarded – undo
3054 3147
 function wp_send_json_success( $data = null ) {
3055 3148
 	$response = array( 'success' => true );
3056 3149
 
3057
-	if ( isset( $data ) )
3058
-		$response['data'] = $data;
3150
+	if ( isset( $data ) ) {
3151
+			$response['data'] = $data;
3152
+	}
3059 3153
 
3060 3154
 	wp_send_json( $response );
3061 3155
 }
@@ -3111,8 +3205,9 @@  discard block
 block discarded – undo
3111 3205
  * @return string Homepage location.
3112 3206
  */
3113 3207
 function _config_wp_home( $url = '' ) {
3114
-	if ( defined( 'WP_HOME' ) )
3115
-		return untrailingslashit( WP_HOME );
3208
+	if ( defined( 'WP_HOME' ) ) {
3209
+			return untrailingslashit( WP_HOME );
3210
+	}
3116 3211
 	return $url;
3117 3212
 }
3118 3213
 
@@ -3132,8 +3227,9 @@  discard block
 block discarded – undo
3132 3227
  * @return string The WordPress Site URL.
3133 3228
  */
3134 3229
 function _config_wp_siteurl( $url = '' ) {
3135
-	if ( defined( 'WP_SITEURL' ) )
3136
-		return untrailingslashit( WP_SITEURL );
3230
+	if ( defined( 'WP_SITEURL' ) ) {
3231
+			return untrailingslashit( WP_SITEURL );
3232
+	}
3137 3233
 	return $url;
3138 3234
 }
3139 3235
 
@@ -3197,8 +3293,9 @@  discard block
 block discarded – undo
3197 3293
 	global $wpsmiliestrans, $wp_smiliessearch;
3198 3294
 
3199 3295
 	// don't bother setting up smilies if they are disabled
3200
-	if ( !get_option( 'use_smilies' ) )
3201
-		return;
3296
+	if ( !get_option( 'use_smilies' ) ) {
3297
+			return;
3298
+	}
3202 3299
 
3203 3300
 	if ( !isset( $wpsmiliestrans ) ) {
3204 3301
 		$wpsmiliestrans = array(
@@ -3302,15 +3399,17 @@  discard block
 block discarded – undo
3302 3399
  * @return array Merged user defined values with defaults.
3303 3400
  */
3304 3401
 function wp_parse_args( $args, $defaults = '' ) {
3305
-	if ( is_object( $args ) )
3306
-		$r = get_object_vars( $args );
3307
-	elseif ( is_array( $args ) )
3308
-		$r =& $args;
3309
-	else
3310
-		wp_parse_str( $args, $r );
3311
-
3312
-	if ( is_array( $defaults ) )
3313
-		return array_merge( $defaults, $r );
3402
+	if ( is_object( $args ) ) {
3403
+			$r = get_object_vars( $args );
3404
+	} elseif ( is_array( $args ) ) {
3405
+			$r =& $args;
3406
+	} else {
3407
+			wp_parse_str( $args, $r );
3408
+	}
3409
+
3410
+	if ( is_array( $defaults ) ) {
3411
+			return array_merge( $defaults, $r );
3412
+	}
3314 3413
 	return $r;
3315 3414
 }
3316 3415
 
@@ -3323,8 +3422,9 @@  discard block
 block discarded – undo
3323 3422
  * @return array Sanitized array of IDs.
3324 3423
  */
3325 3424
 function wp_parse_id_list( $list ) {
3326
-	if ( !is_array($list) )
3327
-		$list = preg_split('/[\s,]+/', $list);
3425
+	if ( !is_array($list) ) {
3426
+			$list = preg_split('/[\s,]+/', $list);
3427
+	}
3328 3428
 
3329 3429
 	return array_unique(array_map('absint', $list));
3330 3430
 }
@@ -3340,9 +3440,10 @@  discard block
 block discarded – undo
3340 3440
  */
3341 3441
 function wp_array_slice_assoc( $array, $keys ) {
3342 3442
 	$slice = array();
3343
-	foreach ( $keys as $key )
3344
-		if ( isset( $array[ $key ] ) )
3443
+	foreach ( $keys as $key ) {
3444
+			if ( isset( $array[ $key ] ) )
3345 3445
 			$slice[ $key ] = $array[ $key ];
3446
+	}
3346 3447
 
3347 3448
 	return $slice;
3348 3449
 }
@@ -3382,13 +3483,15 @@  discard block
 block discarded – undo
3382 3483
  * @return array A list of objects or object fields.
3383 3484
  */
3384 3485
 function wp_filter_object_list( $list, $args = array(), $operator = 'and', $field = false ) {
3385
-	if ( ! is_array( $list ) )
3386
-		return array();
3486
+	if ( ! is_array( $list ) ) {
3487
+			return array();
3488
+	}
3387 3489
 
3388 3490
 	$list = wp_list_filter( $list, $args, $operator );
3389 3491
 
3390
-	if ( $field )
3391
-		$list = wp_list_pluck( $list, $field );
3492
+	if ( $field ) {
3493
+			$list = wp_list_pluck( $list, $field );
3494
+	}
3392 3495
 
3393 3496
 	return $list;
3394 3497
 }
@@ -3408,11 +3511,13 @@  discard block
 block discarded – undo
3408 3511
  * @return array Array of found values.
3409 3512
  */
3410 3513
 function wp_list_filter( $list, $args = array(), $operator = 'AND' ) {
3411
-	if ( ! is_array( $list ) )
3412
-		return array();
3514
+	if ( ! is_array( $list ) ) {
3515
+			return array();
3516
+	}
3413 3517
 
3414
-	if ( empty( $args ) )
3415
-		return $list;
3518
+	if ( empty( $args ) ) {
3519
+			return $list;
3520
+	}
3416 3521
 
3417 3522
 	$operator = strtoupper( $operator );
3418 3523
 	$count = count( $args );
@@ -3423,8 +3528,9 @@  discard block
 block discarded – undo
3423 3528
 
3424 3529
 		$matched = 0;
3425 3530
 		foreach ( $args as $m_key => $m_value ) {
3426
-			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] )
3427
-				$matched++;
3531
+			if ( array_key_exists( $m_key, $to_match ) && $m_value == $to_match[ $m_key ] ) {
3532
+							$matched++;
3533
+			}
3428 3534
 		}
3429 3535
 
3430 3536
 		if ( ( 'AND' == $operator && $matched == $count )
@@ -3533,8 +3639,9 @@  discard block
 block discarded – undo
3533 3639
 function wp_widgets_add_menu() {
3534 3640
 	global $submenu;
3535 3641
 
3536
-	if ( ! current_theme_supports( 'widgets' ) )
3537
-		return;
3642
+	if ( ! current_theme_supports( 'widgets' ) ) {
3643
+			return;
3644
+	}
3538 3645
 
3539 3646
 	$submenu['themes.php'][7] = array( __( 'Widgets' ), 'edit_theme_options', 'widgets.php' );
3540 3647
 	ksort( $submenu['themes.php'], SORT_NUMERIC );
@@ -3549,9 +3656,10 @@  discard block
 block discarded – undo
3549 3656
  */
3550 3657
 function wp_ob_end_flush_all() {
3551 3658
 	$levels = ob_get_level();
3552
-	for ($i=0; $i<$levels; $i++)
3553
-		ob_end_flush();
3554
-}
3659
+	for ($i=0; $i<$levels; $i++) {
3660
+			ob_end_flush();
3661
+	}
3662
+	}
3555 3663
 
3556 3664
 /**
3557 3665
  * Load custom DB error or display WordPress DB error.
@@ -3583,8 +3691,9 @@  discard block
 block discarded – undo
3583 3691
 	}
3584 3692
 
3585 3693
 	// If installing or in the admin, provide the verbose message.
3586
-	if ( wp_installing() || defined( 'WP_ADMIN' ) )
3587
-		wp_die($wpdb->error);
3694
+	if ( wp_installing() || defined( 'WP_ADMIN' ) ) {
3695
+			wp_die($wpdb->error);
3696
+	}
3588 3697
 
3589 3698
 	// Otherwise, be terse.
3590 3699
 	status_header( 500 );
@@ -3592,7 +3701,10 @@  discard block
 block discarded – undo
3592 3701
 	header( 'Content-Type: text/html; charset=utf-8' );
3593 3702
 ?>
3594 3703
 <!DOCTYPE html>
3595
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
3704
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
3705
+	echo ' dir="rtl"';
3706
+}
3707
+?>>
3596 3708
 <head>
3597 3709
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
3598 3710
 	<title><?php _e( 'Database Error' ); ?></title>
@@ -3658,15 +3770,17 @@  discard block
 block discarded – undo
3658 3770
 	 */
3659 3771
 	if ( WP_DEBUG && apply_filters( 'deprecated_function_trigger_error', true ) ) {
3660 3772
 		if ( function_exists( '__' ) ) {
3661
-			if ( ! is_null( $replacement ) )
3662
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3663
-			else
3664
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3773
+			if ( ! is_null( $replacement ) ) {
3774
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $function, $version, $replacement ) );
3775
+			} else {
3776
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3777
+			}
3665 3778
 		} else {
3666
-			if ( ! is_null( $replacement ) )
3667
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3668
-			else
3669
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3779
+			if ( ! is_null( $replacement ) ) {
3780
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $function, $version, $replacement ) );
3781
+			} else {
3782
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3783
+			}
3670 3784
 		}
3671 3785
 	}
3672 3786
 }
@@ -3782,15 +3896,17 @@  discard block
 block discarded – undo
3782 3896
 	if ( WP_DEBUG && apply_filters( 'deprecated_file_trigger_error', true ) ) {
3783 3897
 		$message = empty( $message ) ? '' : ' ' . $message;
3784 3898
 		if ( function_exists( '__' ) ) {
3785
-			if ( ! is_null( $replacement ) )
3786
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3787
-			else
3788
-				trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3899
+			if ( ! is_null( $replacement ) ) {
3900
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.'), $file, $version, $replacement ) . $message );
3901
+			} else {
3902
+							trigger_error( sprintf( __('%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.'), $file, $version ) . $message );
3903
+			}
3789 3904
 		} else {
3790
-			if ( ! is_null( $replacement ) )
3791
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3792
-			else
3793
-				trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3905
+			if ( ! is_null( $replacement ) ) {
3906
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.', $file, $version, $replacement ) . $message );
3907
+			} else {
3908
+							trigger_error( sprintf( '%1$s is <strong>deprecated</strong> since version %2$s with no alternative available.', $file, $version ) . $message );
3909
+			}
3794 3910
 		}
3795 3911
 	}
3796 3912
 }
@@ -3842,15 +3958,17 @@  discard block
 block discarded – undo
3842 3958
 	 */
3843 3959
 	if ( WP_DEBUG && apply_filters( 'deprecated_argument_trigger_error', true ) ) {
3844 3960
 		if ( function_exists( '__' ) ) {
3845
-			if ( ! is_null( $message ) )
3846
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3847
-			else
3848
-				trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3961
+			if ( ! is_null( $message ) ) {
3962
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s'), $function, $version, $message ) );
3963
+			} else {
3964
+							trigger_error( sprintf( __('%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.'), $function, $version ) );
3965
+			}
3849 3966
 		} else {
3850
-			if ( ! is_null( $message ) )
3851
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3852
-			else
3853
-				trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3967
+			if ( ! is_null( $message ) ) {
3968
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s! %3$s', $function, $version, $message ) );
3969
+			} else {
3970
+							trigger_error( sprintf( '%1$s was called with an argument that is <strong>deprecated</strong> since version %2$s with no alternative available.', $function, $version ) );
3971
+			}
3854 3972
 		}
3855 3973
 	}
3856 3974
 }
@@ -3936,19 +4054,22 @@  discard block
 block discarded – undo
3936 4054
 function apache_mod_loaded($mod, $default = false) {
3937 4055
 	global $is_apache;
3938 4056
 
3939
-	if ( !$is_apache )
3940
-		return false;
4057
+	if ( !$is_apache ) {
4058
+			return false;
4059
+	}
3941 4060
 
3942 4061
 	if ( function_exists( 'apache_get_modules' ) ) {
3943 4062
 		$mods = apache_get_modules();
3944
-		if ( in_array($mod, $mods) )
3945
-			return true;
4063
+		if ( in_array($mod, $mods) ) {
4064
+					return true;
4065
+		}
3946 4066
 	} elseif ( function_exists( 'phpinfo' ) && false === strpos( ini_get( 'disable_functions' ), 'phpinfo' ) ) {
3947 4067
 			ob_start();
3948 4068
 			phpinfo(8);
3949 4069
 			$phpinfo = ob_get_clean();
3950
-			if ( false !== strpos($phpinfo, $mod) )
3951
-				return true;
4070
+			if ( false !== strpos($phpinfo, $mod) ) {
4071
+							return true;
4072
+			}
3952 4073
 	}
3953 4074
 	return $default;
3954 4075
 }
@@ -4004,17 +4125,21 @@  discard block
 block discarded – undo
4004 4125
  * @return int 0 means nothing is wrong, greater than 0 means something was wrong.
4005 4126
  */
4006 4127
 function validate_file( $file, $allowed_files = '' ) {
4007
-	if ( false !== strpos( $file, '..' ) )
4008
-		return 1;
4128
+	if ( false !== strpos( $file, '..' ) ) {
4129
+			return 1;
4130
+	}
4009 4131
 
4010
-	if ( false !== strpos( $file, './' ) )
4011
-		return 1;
4132
+	if ( false !== strpos( $file, './' ) ) {
4133
+			return 1;
4134
+	}
4012 4135
 
4013
-	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) )
4014
-		return 3;
4136
+	if ( ! empty( $allowed_files ) && ! in_array( $file, $allowed_files ) ) {
4137
+			return 3;
4138
+	}
4015 4139
 
4016
-	if (':' == substr( $file, 1, 1 ) )
4017
-		return 2;
4140
+	if (':' == substr( $file, 1, 1 ) ) {
4141
+			return 2;
4142
+	}
4018 4143
 
4019 4144
 	return 0;
4020 4145
 }
@@ -4028,10 +4153,12 @@  discard block
 block discarded – undo
4028 4153
  */
4029 4154
 function is_ssl() {
4030 4155
 	if ( isset($_SERVER['HTTPS']) ) {
4031
-		if ( 'on' == strtolower($_SERVER['HTTPS']) )
4032
-			return true;
4033
-		if ( '1' == $_SERVER['HTTPS'] )
4034
-			return true;
4156
+		if ( 'on' == strtolower($_SERVER['HTTPS']) ) {
4157
+					return true;
4158
+		}
4159
+		if ( '1' == $_SERVER['HTTPS'] ) {
4160
+					return true;
4161
+		}
4035 4162
 	} elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {
4036 4163
 		return true;
4037 4164
 	}
@@ -4129,8 +4256,9 @@  discard block
 block discarded – undo
4129 4256
 function wp_suspend_cache_addition( $suspend = null ) {
4130 4257
 	static $_suspend = false;
4131 4258
 
4132
-	if ( is_bool( $suspend ) )
4133
-		$_suspend = $suspend;
4259
+	if ( is_bool( $suspend ) ) {
4260
+			$_suspend = $suspend;
4261
+	}
4134 4262
 
4135 4263
 	return $_suspend;
4136 4264
 }
@@ -4173,11 +4301,13 @@  discard block
 block discarded – undo
4173 4301
 	// This is the current network's information; 'site' is old terminology.
4174 4302
 	global $current_site;
4175 4303
 
4176
-	if ( ! is_multisite() )
4177
-		return true;
4304
+	if ( ! is_multisite() ) {
4305
+			return true;
4306
+	}
4178 4307
 
4179
-	if ( ! $site_id )
4180
-		$site_id = get_current_blog_id();
4308
+	if ( ! $site_id ) {
4309
+			$site_id = get_current_blog_id();
4310
+	}
4181 4311
 
4182 4312
 	return (int) $site_id === (int) $current_site->blog_id;
4183 4313
 }
@@ -4256,8 +4386,9 @@  discard block
 block discarded – undo
4256 4386
  * @return bool True if multisite and global terms enabled.
4257 4387
  */
4258 4388
 function global_terms_enabled() {
4259
-	if ( ! is_multisite() )
4260
-		return false;
4389
+	if ( ! is_multisite() ) {
4390
+			return false;
4391
+	}
4261 4392
 
4262 4393
 	static $global_terms = null;
4263 4394
 	if ( is_null( $global_terms ) ) {
@@ -4273,10 +4404,11 @@  discard block
 block discarded – undo
4273 4404
 		 * @param null $enabled Whether global terms are enabled.
4274 4405
 		 */
4275 4406
 		$filter = apply_filters( 'global_terms_enabled', null );
4276
-		if ( ! is_null( $filter ) )
4277
-			$global_terms = (bool) $filter;
4278
-		else
4279
-			$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4407
+		if ( ! is_null( $filter ) ) {
4408
+					$global_terms = (bool) $filter;
4409
+		} else {
4410
+					$global_terms = (bool) get_site_option( 'global_terms_enabled', false );
4411
+		}
4280 4412
 	}
4281 4413
 	return $global_terms;
4282 4414
 }
@@ -4452,8 +4584,9 @@  discard block
 block discarded – undo
4452 4584
 	// Do UTC
4453 4585
 	$structure[] = '<optgroup label="'. esc_attr__( 'UTC' ) .'">';
4454 4586
 	$selected = '';
4455
-	if ( 'UTC' === $selected_zone )
4456
-		$selected = 'selected="selected" ';
4587
+	if ( 'UTC' === $selected_zone ) {
4588
+			$selected = 'selected="selected" ';
4589
+	}
4457 4590
 	$structure[] = '<option ' . $selected . 'value="' . esc_attr( 'UTC' ) . '">' . __('UTC') . '</option>';
4458 4591
 	$structure[] = '</optgroup>';
4459 4592
 
@@ -4462,18 +4595,20 @@  discard block
 block discarded – undo
4462 4595
 	$offset_range = array (-12, -11.5, -11, -10.5, -10, -9.5, -9, -8.5, -8, -7.5, -7, -6.5, -6, -5.5, -5, -4.5, -4, -3.5, -3, -2.5, -2, -1.5, -1, -0.5,
4463 4596
 		0, 0.5, 1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 5.75, 6, 6.5, 7, 7.5, 8, 8.5, 8.75, 9, 9.5, 10, 10.5, 11, 11.5, 12, 12.75, 13, 13.75, 14);
4464 4597
 	foreach ( $offset_range as $offset ) {
4465
-		if ( 0 <= $offset )
4466
-			$offset_name = '+' . $offset;
4467
-		else
4468
-			$offset_name = (string) $offset;
4598
+		if ( 0 <= $offset ) {
4599
+					$offset_name = '+' . $offset;
4600
+		} else {
4601
+					$offset_name = (string) $offset;
4602
+		}
4469 4603
 
4470 4604
 		$offset_value = $offset_name;
4471 4605
 		$offset_name = str_replace(array('.25','.5','.75'), array(':15',':30',':45'), $offset_name);
4472 4606
 		$offset_name = 'UTC' . $offset_name;
4473 4607
 		$offset_value = 'UTC' . $offset_value;
4474 4608
 		$selected = '';
4475
-		if ( $offset_value === $selected_zone )
4476
-			$selected = 'selected="selected" ';
4609
+		if ( $offset_value === $selected_zone ) {
4610
+					$selected = 'selected="selected" ';
4611
+		}
4477 4612
 		$structure[] = '<option ' . $selected . 'value="' . esc_attr( $offset_value ) . '">' . esc_html( $offset_name ) . "</option>";
4478 4613
 
4479 4614
 	}
@@ -4516,8 +4651,9 @@  discard block
 block discarded – undo
4516 4651
 
4517 4652
 	foreach ( (array) $posts_to_delete as $post ) {
4518 4653
 		$post_id = (int) $post['post_id'];
4519
-		if ( !$post_id )
4520
-			continue;
4654
+		if ( !$post_id ) {
4655
+					continue;
4656
+		}
4521 4657
 
4522 4658
 		$del_post = get_post($post_id);
4523 4659
 
@@ -4533,8 +4669,9 @@  discard block
 block discarded – undo
4533 4669
 
4534 4670
 	foreach ( (array) $comments_to_delete as $comment ) {
4535 4671
 		$comment_id = (int) $comment['comment_id'];
4536
-		if ( !$comment_id )
4537
-			continue;
4672
+		if ( !$comment_id ) {
4673
+					continue;
4674
+		}
4538 4675
 
4539 4676
 		$del_comment = get_comment($comment_id);
4540 4677
 
@@ -4598,10 +4735,11 @@  discard block
 block discarded – undo
4598 4735
 	}
4599 4736
 
4600 4737
 	foreach ( $all_headers as $field => $regex ) {
4601
-		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] )
4602
-			$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4603
-		else
4604
-			$all_headers[ $field ] = '';
4738
+		if ( preg_match( '/^[ \t\/*#@]*' . preg_quote( $regex, '/' ) . ':(.*)$/mi', $file_data, $match ) && $match[1] ) {
4739
+					$all_headers[ $field ] = _cleanup_header_comment( $match[1] );
4740
+		} else {
4741
+					$all_headers[ $field ] = '';
4742
+		}
4605 4743
 	}
4606 4744
 
4607 4745
 	return $all_headers;
@@ -4744,8 +4882,9 @@  discard block
 block discarded – undo
4744 4882
 function wp_find_hierarchy_loop( $callback, $start, $start_parent, $callback_args = array() ) {
4745 4883
 	$override = is_null( $start_parent ) ? array() : array( $start => $start_parent );
4746 4884
 
4747
-	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) )
4748
-		return array();
4885
+	if ( !$arbitrary_loop_member = wp_find_hierarchy_loop_tortoise_hare( $callback, $start, $override, $callback_args ) ) {
4886
+			return array();
4887
+	}
4749 4888
 
4750 4889
 	return wp_find_hierarchy_loop_tortoise_hare( $callback, $arbitrary_loop_member, $override, $callback_args, true );
4751 4890
 }
@@ -4783,12 +4922,14 @@  discard block
 block discarded – undo
4783 4922
 	&&
4784 4923
 		( $hare = isset( $override[$evanescent_hare] ) ? $override[$evanescent_hare] : call_user_func_array( $callback, array_merge( array( $evanescent_hare ), $callback_args ) ) )
4785 4924
 	) {
4786
-		if ( $_return_loop )
4787
-			$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4925
+		if ( $_return_loop ) {
4926
+					$return[$tortoise] = $return[$evanescent_hare] = $return[$hare] = true;
4927
+		}
4788 4928
 
4789 4929
 		// tortoise got lapped - must be a loop
4790
-		if ( $tortoise == $evanescent_hare || $tortoise == $hare )
4791
-			return $_return_loop ? $return : $tortoise;
4930
+		if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
4931
+					return $_return_loop ? $return : $tortoise;
4932
+		}
4792 4933
 
4793 4934
 		// Increment tortoise by one step
4794 4935
 		$tortoise = isset( $override[$tortoise] ) ? $override[$tortoise] : call_user_func_array( $callback, array_merge( array( $tortoise ), $callback_args ) );
@@ -4860,10 +5001,11 @@  discard block
 block discarded – undo
4860 5001
  *                      of individual calls.
4861 5002
  */
4862 5003
 function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pretty = true ) {
4863
-	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) )
4864
-		$trace = debug_backtrace( false );
4865
-	else
4866
-		$trace = debug_backtrace();
5004
+	if ( version_compare( PHP_VERSION, '5.2.5', '>=' ) ) {
5005
+			$trace = debug_backtrace( false );
5006
+	} else {
5007
+			$trace = debug_backtrace();
5008
+	}
4867 5009
 
4868 5010
 	$caller = array();
4869 5011
 	$check_class = ! is_null( $ignore_class );
@@ -4873,8 +5015,10 @@  discard block
 block discarded – undo
4873 5015
 		if ( $skip_frames > 0 ) {
4874 5016
 			$skip_frames--;
4875 5017
 		} elseif ( isset( $call['class'] ) ) {
4876
-			if ( $check_class && $ignore_class == $call['class'] )
4877
-				continue; // Filter out calls
5018
+			if ( $check_class && $ignore_class == $call['class'] ) {
5019
+							continue;
5020
+			}
5021
+			// Filter out calls
4878 5022
 
4879 5023
 			$caller[] = "{$call['class']}{$call['type']}{$call['function']}";
4880 5024
 		} else {
@@ -4887,11 +5031,12 @@  discard block
 block discarded – undo
4887 5031
 			}
4888 5032
 		}
4889 5033
 	}
4890
-	if ( $pretty )
4891
-		return join( ', ', array_reverse( $caller ) );
4892
-	else
4893
-		return $caller;
4894
-}
5034
+	if ( $pretty ) {
5035
+			return join( ', ', array_reverse( $caller ) );
5036
+	} else {
5037
+			return $caller;
5038
+	}
5039
+	}
4895 5040
 
4896 5041
 /**
4897 5042
  * Retrieve ids that are not already present in the cache.
@@ -4925,8 +5070,9 @@  discard block
 block discarded – undo
4925 5070
  * @return bool Whether the device is able to upload files.
4926 5071
  */
4927 5072
 function _device_can_upload() {
4928
-	if ( ! wp_is_mobile() )
4929
-		return true;
5073
+	if ( ! wp_is_mobile() ) {
5074
+			return true;
5075
+	}
4930 5076
 
4931 5077
 	$ua = $_SERVER['HTTP_USER_AGENT'];
4932 5078
 
@@ -4989,11 +5135,13 @@  discard block
 block discarded – undo
4989 5135
  * @since 3.6.0
4990 5136
  */
4991 5137
 function wp_auth_check_load() {
4992
-	if ( ! is_admin() && ! is_user_logged_in() )
4993
-		return;
5138
+	if ( ! is_admin() && ! is_user_logged_in() ) {
5139
+			return;
5140
+	}
4994 5141
 
4995
-	if ( defined( 'IFRAME_REQUEST' ) )
4996
-		return;
5142
+	if ( defined( 'IFRAME_REQUEST' ) ) {
5143
+			return;
5144
+	}
4997 5145
 
4998 5146
 	$screen = get_current_screen();
4999 5147
 	$hidden = array( 'update', 'update-network', 'update-core', 'update-core-network', 'upgrade', 'upgrade-network', 'network' );
@@ -5098,8 +5246,9 @@  discard block
 block discarded – undo
5098 5246
  * @return string Tag RegEx.
5099 5247
  */
5100 5248
 function get_tag_regex( $tag ) {
5101
-	if ( empty( $tag ) )
5102
-		return;
5249
+	if ( empty( $tag ) ) {
5250
+			return;
5251
+	}
5103 5252
 	return sprintf( '<%1$s[^<]*(?:>[\s\S]*<\/%1$s>|\s*\/>)', tag_escape( $tag ) );
5104 5253
 }
5105 5254
 
@@ -5117,12 +5266,14 @@  discard block
 block discarded – undo
5117 5266
  */
5118 5267
 function _canonical_charset( $charset ) {
5119 5268
 	if ( 'UTF-8' === $charset || 'utf-8' === $charset || 'utf8' === $charset ||
5120
-		'UTF8' === $charset )
5121
-		return 'UTF-8';
5269
+		'UTF8' === $charset ) {
5270
+			return 'UTF-8';
5271
+	}
5122 5272
 
5123 5273
 	if ( 'ISO-8859-1' === $charset || 'iso-8859-1' === $charset ||
5124
-		'iso8859-1' === $charset || 'ISO8859-1' === $charset )
5125
-		return 'ISO-8859-1';
5274
+		'iso8859-1' === $charset || 'ISO8859-1' === $charset ) {
5275
+			return 'ISO-8859-1';
5276
+	}
5126 5277
 
5127 5278
 	return $charset;
5128 5279
 }
@@ -5157,11 +5308,13 @@  discard block
 block discarded – undo
5157 5308
 	static $encodings = array();
5158 5309
 	static $overloaded = null;
5159 5310
 
5160
-	if ( is_null( $overloaded ) )
5161
-		$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5311
+	if ( is_null( $overloaded ) ) {
5312
+			$overloaded = function_exists( 'mb_internal_encoding' ) && ( ini_get( 'mbstring.func_overload' ) & 2 );
5313
+	}
5162 5314
 
5163
-	if ( false === $overloaded )
5164
-		return;
5315
+	if ( false === $overloaded ) {
5316
+			return;
5317
+	}
5165 5318
 
5166 5319
 	if ( ! $reset ) {
5167 5320
 		$encoding = mb_internal_encoding();
Please login to merge, or discard this patch.
src/wp-includes/class-wp-customize-widgets.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Customize Widgets classes
4
- *
5
- * @package WordPress
6
- * @subpackage Customize
7
- * @since 3.9.0
8
- */
3
+	 * WordPress Customize Widgets classes
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Customize
7
+	 * @since 3.9.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Customize Widgets class.
@@ -1000,7 +1000,7 @@  discard block
 block discarded – undo
1000 1000
 	 *
1001 1001
 	 * @since 3.9.0
1002 1002
 	 * @access public
1003
-     *
1003
+	 *
1004 1004
 	 * @global array $wp_registered_sidebars
1005 1005
 	 * @global array $wp_registered_widgets
1006 1006
 	 */
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -193,7 +193,7 @@
 block discarded – undo
193 193
 	 *
194 194
 	 * @param string $name    Post value.
195 195
 	 * @param mixed  $default Default post value.
196
-	 * @return mixed Unslashed post value or default value.
196
+	 * @return string Unslashed post value or default value.
197 197
 	 */
198 198
 	protected function get_post_value( $name, $default = null ) {
199 199
 		if ( ! isset( $_POST[ $name ] ) ) {
Please login to merge, or discard this patch.
Spacing   +404 added lines, -404 removed lines patch added patch discarded remove patch
@@ -81,34 +81,34 @@  discard block
 block discarded – undo
81 81
 	 *
82 82
 	 * @param WP_Customize_Manager $manager Customize manager bootstrap instance.
83 83
 	 */
84
-	public function __construct( $manager ) {
84
+	public function __construct($manager) {
85 85
 		$this->manager = $manager;
86 86
 
87 87
 		// Skip useless hooks when the user can't manage widgets anyway.
88
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
88
+		if ( ! current_user_can('edit_theme_options')) {
89 89
 			return;
90 90
 		}
91 91
 
92
-		add_filter( 'customize_dynamic_setting_args',          array( $this, 'filter_customize_dynamic_setting_args' ), 10, 2 );
93
-		add_action( 'after_setup_theme',                       array( $this, 'register_settings' ) );
94
-		add_action( 'wp_loaded',                               array( $this, 'override_sidebars_widgets_for_theme_switch' ) );
95
-		add_action( 'customize_controls_init',                 array( $this, 'customize_controls_init' ) );
96
-		add_action( 'customize_register',                      array( $this, 'schedule_customize_register' ), 1 );
97
-		add_action( 'customize_controls_enqueue_scripts',      array( $this, 'enqueue_scripts' ) );
98
-		add_action( 'customize_controls_print_styles',         array( $this, 'print_styles' ) );
99
-		add_action( 'customize_controls_print_scripts',        array( $this, 'print_scripts' ) );
100
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'print_footer_scripts' ) );
101
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'output_widget_control_templates' ) );
102
-		add_action( 'customize_preview_init',                  array( $this, 'customize_preview_init' ) );
103
-		add_filter( 'customize_refresh_nonces',                array( $this, 'refresh_nonces' ) );
104
-
105
-		add_action( 'dynamic_sidebar',                         array( $this, 'tally_rendered_widgets' ) );
106
-		add_filter( 'is_active_sidebar',                       array( $this, 'tally_sidebars_via_is_active_sidebar_calls' ), 10, 2 );
107
-		add_filter( 'dynamic_sidebar_has_widgets',             array( $this, 'tally_sidebars_via_dynamic_sidebar_calls' ), 10, 2 );
92
+		add_filter('customize_dynamic_setting_args', array($this, 'filter_customize_dynamic_setting_args'), 10, 2);
93
+		add_action('after_setup_theme', array($this, 'register_settings'));
94
+		add_action('wp_loaded', array($this, 'override_sidebars_widgets_for_theme_switch'));
95
+		add_action('customize_controls_init', array($this, 'customize_controls_init'));
96
+		add_action('customize_register', array($this, 'schedule_customize_register'), 1);
97
+		add_action('customize_controls_enqueue_scripts', array($this, 'enqueue_scripts'));
98
+		add_action('customize_controls_print_styles', array($this, 'print_styles'));
99
+		add_action('customize_controls_print_scripts', array($this, 'print_scripts'));
100
+		add_action('customize_controls_print_footer_scripts', array($this, 'print_footer_scripts'));
101
+		add_action('customize_controls_print_footer_scripts', array($this, 'output_widget_control_templates'));
102
+		add_action('customize_preview_init', array($this, 'customize_preview_init'));
103
+		add_filter('customize_refresh_nonces', array($this, 'refresh_nonces'));
104
+
105
+		add_action('dynamic_sidebar', array($this, 'tally_rendered_widgets'));
106
+		add_filter('is_active_sidebar', array($this, 'tally_sidebars_via_is_active_sidebar_calls'), 10, 2);
107
+		add_filter('dynamic_sidebar_has_widgets', array($this, 'tally_sidebars_via_dynamic_sidebar_calls'), 10, 2);
108 108
 
109 109
 		// Selective Refresh.
110
-		add_filter( 'customize_dynamic_partial_args',          array( $this, 'customize_dynamic_partial_args' ), 10, 2 );
111
-		add_action( 'customize_preview_init',                  array( $this, 'selective_refresh_init' ) );
110
+		add_filter('customize_dynamic_partial_args', array($this, 'customize_dynamic_partial_args'), 10, 2);
111
+		add_action('customize_preview_init', array($this, 'selective_refresh_init'));
112 112
 	}
113 113
 
114 114
 	/**
@@ -122,14 +122,14 @@  discard block
 block discarded – undo
122 122
 	 * @param $setting_id Setting ID.
123 123
 	 * @return string|void Setting type.
124 124
 	 */
125
-	protected function get_setting_type( $setting_id ) {
125
+	protected function get_setting_type($setting_id) {
126 126
 		static $cache = array();
127
-		if ( isset( $cache[ $setting_id ] ) ) {
128
-			return $cache[ $setting_id ];
127
+		if (isset($cache[$setting_id])) {
128
+			return $cache[$setting_id];
129 129
 		}
130
-		foreach ( $this->setting_id_patterns as $type => $pattern ) {
131
-			if ( preg_match( $pattern, $setting_id ) ) {
132
-				$cache[ $setting_id ] = $type;
130
+		foreach ($this->setting_id_patterns as $type => $pattern) {
131
+			if (preg_match($pattern, $setting_id)) {
132
+				$cache[$setting_id] = $type;
133 133
 				return $type;
134 134
 			}
135 135
 		}
@@ -144,25 +144,25 @@  discard block
 block discarded – undo
144 144
 	 */
145 145
 	public function register_settings() {
146 146
 		$widget_setting_ids = array();
147
-		$incoming_setting_ids = array_keys( $this->manager->unsanitized_post_values() );
148
-		foreach ( $incoming_setting_ids as $setting_id ) {
149
-			if ( ! is_null( $this->get_setting_type( $setting_id ) ) ) {
147
+		$incoming_setting_ids = array_keys($this->manager->unsanitized_post_values());
148
+		foreach ($incoming_setting_ids as $setting_id) {
149
+			if ( ! is_null($this->get_setting_type($setting_id))) {
150 150
 				$widget_setting_ids[] = $setting_id;
151 151
 			}
152 152
 		}
153
-		if ( $this->manager->doing_ajax( 'update-widget' ) && isset( $_REQUEST['widget-id'] ) ) {
154
-			$widget_setting_ids[] = $this->get_setting_id( wp_unslash( $_REQUEST['widget-id'] ) );
153
+		if ($this->manager->doing_ajax('update-widget') && isset($_REQUEST['widget-id'])) {
154
+			$widget_setting_ids[] = $this->get_setting_id(wp_unslash($_REQUEST['widget-id']));
155 155
 		}
156 156
 
157
-		$settings = $this->manager->add_dynamic_settings( array_unique( $widget_setting_ids ) );
157
+		$settings = $this->manager->add_dynamic_settings(array_unique($widget_setting_ids));
158 158
 
159 159
 		/*
160 160
 		 * Preview settings right away so that widgets and sidebars will get registered properly.
161 161
 		 * But don't do this if a customize_save because this will cause WP to think there is nothing
162 162
 		 * changed that needs to be saved.
163 163
 		 */
164
-		if ( ! $this->manager->doing_ajax( 'customize_save' ) ) {
165
-			foreach ( $settings as $setting ) {
164
+		if ( ! $this->manager->doing_ajax('customize_save')) {
165
+			foreach ($settings as $setting) {
166 166
 				$setting->preview();
167 167
 			}
168 168
 		}
@@ -178,9 +178,9 @@  discard block
 block discarded – undo
178 178
 	 * @param string      $setting_id ID for dynamic setting, usually coming from `$_POST['customized']`.
179 179
 	 * @return false|array Setting arguments, false otherwise.
180 180
 	 */
181
-	public function filter_customize_dynamic_setting_args( $args, $setting_id ) {
182
-		if ( $this->get_setting_type( $setting_id ) ) {
183
-			$args = $this->get_setting_args( $setting_id );
181
+	public function filter_customize_dynamic_setting_args($args, $setting_id) {
182
+		if ($this->get_setting_type($setting_id)) {
183
+			$args = $this->get_setting_args($setting_id);
184 184
 		}
185 185
 		return $args;
186 186
 	}
@@ -195,12 +195,12 @@  discard block
 block discarded – undo
195 195
 	 * @param mixed  $default Default post value.
196 196
 	 * @return mixed Unslashed post value or default value.
197 197
 	 */
198
-	protected function get_post_value( $name, $default = null ) {
199
-		if ( ! isset( $_POST[ $name ] ) ) {
198
+	protected function get_post_value($name, $default = null) {
199
+		if ( ! isset($_POST[$name])) {
200 200
 			return $default;
201 201
 		}
202 202
 
203
-		return wp_unslash( $_POST[ $name ] );
203
+		return wp_unslash($_POST[$name]);
204 204
 	}
205 205
 
206 206
 	/**
@@ -221,19 +221,19 @@  discard block
 block discarded – undo
221 221
 	public function override_sidebars_widgets_for_theme_switch() {
222 222
 		global $sidebars_widgets;
223 223
 
224
-		if ( $this->manager->doing_ajax() || $this->manager->is_theme_active() ) {
224
+		if ($this->manager->doing_ajax() || $this->manager->is_theme_active()) {
225 225
 			return;
226 226
 		}
227 227
 
228 228
 		$this->old_sidebars_widgets = wp_get_sidebars_widgets();
229
-		add_filter( 'customize_value_old_sidebars_widgets_data', array( $this, 'filter_customize_value_old_sidebars_widgets_data' ) );
229
+		add_filter('customize_value_old_sidebars_widgets_data', array($this, 'filter_customize_value_old_sidebars_widgets_data'));
230 230
 
231 231
 		// retrieve_widgets() looks at the global $sidebars_widgets
232 232
 		$sidebars_widgets = $this->old_sidebars_widgets;
233
-		$sidebars_widgets = retrieve_widgets( 'customize' );
234
-		add_filter( 'option_sidebars_widgets', array( $this, 'filter_option_sidebars_widgets_for_theme_switch' ), 1 );
233
+		$sidebars_widgets = retrieve_widgets('customize');
234
+		add_filter('option_sidebars_widgets', array($this, 'filter_option_sidebars_widgets_for_theme_switch'), 1);
235 235
 		// reset global cache var used by wp_get_sidebars_widgets()
236
-		unset( $GLOBALS['_wp_sidebars_widgets'] );
236
+		unset($GLOBALS['_wp_sidebars_widgets']);
237 237
 	}
238 238
 
239 239
 	/**
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 	 * @param array $old_sidebars_widgets
253 253
 	 * @return array
254 254
 	 */
255
-	public function filter_customize_value_old_sidebars_widgets_data( $old_sidebars_widgets ) {
255
+	public function filter_customize_value_old_sidebars_widgets_data($old_sidebars_widgets) {
256 256
 		return $this->old_sidebars_widgets;
257 257
 	}
258 258
 
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 	 * @param array $sidebars_widgets
273 273
 	 * @return array
274 274
 	 */
275
-	public function filter_option_sidebars_widgets_for_theme_switch( $sidebars_widgets ) {
275
+	public function filter_option_sidebars_widgets_for_theme_switch($sidebars_widgets) {
276 276
 		$sidebars_widgets = $GLOBALS['sidebars_widgets'];
277 277
 		$sidebars_widgets['array_version'] = 3;
278 278
 		return $sidebars_widgets;
@@ -288,13 +288,13 @@  discard block
 block discarded – undo
288 288
 	 */
289 289
 	public function customize_controls_init() {
290 290
 		/** This action is documented in wp-admin/includes/ajax-actions.php */
291
-		do_action( 'load-widgets.php' );
291
+		do_action('load-widgets.php');
292 292
 
293 293
 		/** This action is documented in wp-admin/includes/ajax-actions.php */
294
-		do_action( 'widgets.php' );
294
+		do_action('widgets.php');
295 295
 
296 296
 		/** This action is documented in wp-admin/widgets.php */
297
-		do_action( 'sidebar_admin_setup' );
297
+		do_action('sidebar_admin_setup');
298 298
 	}
299 299
 
300 300
 	/**
@@ -307,10 +307,10 @@  discard block
 block discarded – undo
307 307
 	 * @access public
308 308
 	 */
309 309
 	public function schedule_customize_register() {
310
-		if ( is_admin() ) {
310
+		if (is_admin()) {
311 311
 			$this->customize_register();
312 312
 		} else {
313
-			add_action( 'wp', array( $this, 'customize_register' ) );
313
+			add_action('wp', array($this, 'customize_register'));
314 314
 		}
315 315
 	}
316 316
 
@@ -328,8 +328,8 @@  discard block
 block discarded – undo
328 328
 		global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_sidebars;
329 329
 
330 330
 		$sidebars_widgets = array_merge(
331
-			array( 'wp_inactive_widgets' => array() ),
332
-			array_fill_keys( array_keys( $wp_registered_sidebars ), array() ),
331
+			array('wp_inactive_widgets' => array()),
332
+			array_fill_keys(array_keys($wp_registered_sidebars), array()),
333 333
 			wp_get_sidebars_widgets()
334 334
 		);
335 335
 
@@ -340,11 +340,11 @@  discard block
 block discarded – undo
340 340
 		 * inactive, and orphaned since a widget may get suppressed from a sidebar
341 341
 		 * via a plugin (like Widget Visibility).
342 342
 		 */
343
-		foreach ( array_keys( $wp_registered_widgets ) as $widget_id ) {
344
-			$setting_id   = $this->get_setting_id( $widget_id );
345
-			$setting_args = $this->get_setting_args( $setting_id );
346
-			if ( ! $this->manager->get_setting( $setting_id ) ) {
347
-				$this->manager->add_setting( $setting_id, $setting_args );
343
+		foreach (array_keys($wp_registered_widgets) as $widget_id) {
344
+			$setting_id   = $this->get_setting_id($widget_id);
345
+			$setting_args = $this->get_setting_args($setting_id);
346
+			if ( ! $this->manager->get_setting($setting_id)) {
347
+				$this->manager->add_setting($setting_id, $setting_args);
348 348
 			}
349 349
 			$new_setting_ids[] = $setting_id;
350 350
 		}
@@ -353,52 +353,52 @@  discard block
 block discarded – undo
353 353
 		 * Add a setting which will be supplied for the theme's sidebars_widgets
354 354
 		 * theme_mod when the theme is switched.
355 355
 		 */
356
-		if ( ! $this->manager->is_theme_active() ) {
356
+		if ( ! $this->manager->is_theme_active()) {
357 357
 			$setting_id = 'old_sidebars_widgets_data';
358
-			$setting_args = $this->get_setting_args( $setting_id, array(
358
+			$setting_args = $this->get_setting_args($setting_id, array(
359 359
 				'type' => 'global_variable',
360 360
 				'dirty' => true,
361
-			) );
362
-			$this->manager->add_setting( $setting_id, $setting_args );
361
+			));
362
+			$this->manager->add_setting($setting_id, $setting_args);
363 363
 		}
364 364
 
365
-		$this->manager->add_panel( 'widgets', array(
365
+		$this->manager->add_panel('widgets', array(
366 366
 			'type'            => 'widgets',
367
-			'title'           => __( 'Widgets' ),
368
-			'description'     => __( 'Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).' ),
367
+			'title'           => __('Widgets'),
368
+			'description'     => __('Widgets are independent sections of content that can be placed into widgetized areas provided by your theme (commonly called sidebars).'),
369 369
 			'priority'        => 110,
370
-			'active_callback' => array( $this, 'is_panel_active' ),
371
-		) );
370
+			'active_callback' => array($this, 'is_panel_active'),
371
+		));
372 372
 
373
-		foreach ( $sidebars_widgets as $sidebar_id => $sidebar_widget_ids ) {
374
-			if ( empty( $sidebar_widget_ids ) ) {
373
+		foreach ($sidebars_widgets as $sidebar_id => $sidebar_widget_ids) {
374
+			if (empty($sidebar_widget_ids)) {
375 375
 				$sidebar_widget_ids = array();
376 376
 			}
377 377
 
378
-			$is_registered_sidebar = is_registered_sidebar( $sidebar_id );
379
-			$is_inactive_widgets   = ( 'wp_inactive_widgets' === $sidebar_id );
380
-			$is_active_sidebar     = ( $is_registered_sidebar && ! $is_inactive_widgets );
378
+			$is_registered_sidebar = is_registered_sidebar($sidebar_id);
379
+			$is_inactive_widgets   = ('wp_inactive_widgets' === $sidebar_id);
380
+			$is_active_sidebar     = ($is_registered_sidebar && ! $is_inactive_widgets);
381 381
 
382 382
 			// Add setting for managing the sidebar's widgets.
383
-			if ( $is_registered_sidebar || $is_inactive_widgets ) {
384
-				$setting_id   = sprintf( 'sidebars_widgets[%s]', $sidebar_id );
385
-				$setting_args = $this->get_setting_args( $setting_id );
386
-				if ( ! $this->manager->get_setting( $setting_id ) ) {
387
-					if ( ! $this->manager->is_theme_active() ) {
383
+			if ($is_registered_sidebar || $is_inactive_widgets) {
384
+				$setting_id   = sprintf('sidebars_widgets[%s]', $sidebar_id);
385
+				$setting_args = $this->get_setting_args($setting_id);
386
+				if ( ! $this->manager->get_setting($setting_id)) {
387
+					if ( ! $this->manager->is_theme_active()) {
388 388
 						$setting_args['dirty'] = true;
389 389
 					}
390
-					$this->manager->add_setting( $setting_id, $setting_args );
390
+					$this->manager->add_setting($setting_id, $setting_args);
391 391
 				}
392 392
 				$new_setting_ids[] = $setting_id;
393 393
 
394 394
 				// Add section to contain controls.
395
-				$section_id = sprintf( 'sidebar-widgets-%s', $sidebar_id );
396
-				if ( $is_active_sidebar ) {
395
+				$section_id = sprintf('sidebar-widgets-%s', $sidebar_id);
396
+				if ($is_active_sidebar) {
397 397
 
398 398
 					$section_args = array(
399
-						'title' => $wp_registered_sidebars[ $sidebar_id ]['name'],
400
-						'description' => $wp_registered_sidebars[ $sidebar_id ]['description'],
401
-						'priority' => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
399
+						'title' => $wp_registered_sidebars[$sidebar_id]['name'],
400
+						'description' => $wp_registered_sidebars[$sidebar_id]['description'],
401
+						'priority' => array_search($sidebar_id, array_keys($wp_registered_sidebars)),
402 402
 						'panel' => 'widgets',
403 403
 						'sidebar_id' => $sidebar_id,
404 404
 					);
@@ -412,35 +412,35 @@  discard block
 block discarded – undo
412 412
 					 * @param string     $section_id   Customizer section ID.
413 413
 					 * @param int|string $sidebar_id   Sidebar ID.
414 414
 					 */
415
-					$section_args = apply_filters( 'customizer_widgets_section_args', $section_args, $section_id, $sidebar_id );
415
+					$section_args = apply_filters('customizer_widgets_section_args', $section_args, $section_id, $sidebar_id);
416 416
 
417
-					$section = new WP_Customize_Sidebar_Section( $this->manager, $section_id, $section_args );
418
-					$this->manager->add_section( $section );
417
+					$section = new WP_Customize_Sidebar_Section($this->manager, $section_id, $section_args);
418
+					$this->manager->add_section($section);
419 419
 
420
-					$control = new WP_Widget_Area_Customize_Control( $this->manager, $setting_id, array(
420
+					$control = new WP_Widget_Area_Customize_Control($this->manager, $setting_id, array(
421 421
 						'section'    => $section_id,
422 422
 						'sidebar_id' => $sidebar_id,
423
-						'priority'   => count( $sidebar_widget_ids ), // place 'Add Widget' and 'Reorder' buttons at end.
424
-					) );
423
+						'priority'   => count($sidebar_widget_ids), // place 'Add Widget' and 'Reorder' buttons at end.
424
+					));
425 425
 					$new_setting_ids[] = $setting_id;
426 426
 
427
-					$this->manager->add_control( $control );
427
+					$this->manager->add_control($control);
428 428
 				}
429 429
 			}
430 430
 
431 431
 			// Add a control for each active widget (located in a sidebar).
432
-			foreach ( $sidebar_widget_ids as $i => $widget_id ) {
432
+			foreach ($sidebar_widget_ids as $i => $widget_id) {
433 433
 
434 434
 				// Skip widgets that may have gone away due to a plugin being deactivated.
435
-				if ( ! $is_active_sidebar || ! isset( $wp_registered_widgets[$widget_id] ) ) {
435
+				if ( ! $is_active_sidebar || ! isset($wp_registered_widgets[$widget_id])) {
436 436
 					continue;
437 437
 				}
438 438
 
439 439
 				$registered_widget = $wp_registered_widgets[$widget_id];
440
-				$setting_id        = $this->get_setting_id( $widget_id );
440
+				$setting_id        = $this->get_setting_id($widget_id);
441 441
 				$id_base           = $wp_registered_widget_controls[$widget_id]['id_base'];
442 442
 
443
-				$control = new WP_Widget_Form_Customize_Control( $this->manager, $setting_id, array(
443
+				$control = new WP_Widget_Form_Customize_Control($this->manager, $setting_id, array(
444 444
 					'label'          => $registered_widget['name'],
445 445
 					'section'        => $section_id,
446 446
 					'sidebar_id'     => $sidebar_id,
@@ -449,19 +449,19 @@  discard block
 block discarded – undo
449 449
 					'priority'       => $i,
450 450
 					'width'          => $wp_registered_widget_controls[$widget_id]['width'],
451 451
 					'height'         => $wp_registered_widget_controls[$widget_id]['height'],
452
-					'is_wide'        => $this->is_wide_widget( $widget_id ),
453
-				) );
454
-				$this->manager->add_control( $control );
452
+					'is_wide'        => $this->is_wide_widget($widget_id),
453
+				));
454
+				$this->manager->add_control($control);
455 455
 			}
456 456
 		}
457 457
 
458
-		if ( ! $this->manager->doing_ajax( 'customize_save' ) ) {
459
-			foreach ( $new_setting_ids as $new_setting_id ) {
460
-				$this->manager->get_setting( $new_setting_id )->preview();
458
+		if ( ! $this->manager->doing_ajax('customize_save')) {
459
+			foreach ($new_setting_ids as $new_setting_id) {
460
+				$this->manager->get_setting($new_setting_id)->preview();
461 461
 			}
462 462
 		}
463 463
 
464
-		add_filter( 'sidebars_widgets', array( $this, 'preview_sidebars_widgets' ), 1 );
464
+		add_filter('sidebars_widgets', array($this, 'preview_sidebars_widgets'), 1);
465 465
 	}
466 466
 
467 467
 	/**
@@ -477,7 +477,7 @@  discard block
 block discarded – undo
477 477
 	 */
478 478
 	public function is_panel_active() {
479 479
 		global $wp_registered_sidebars;
480
-		return ! empty( $wp_registered_sidebars );
480
+		return ! empty($wp_registered_sidebars);
481 481
 	}
482 482
 
483 483
 	/**
@@ -489,12 +489,12 @@  discard block
 block discarded – undo
489 489
 	 * @param string $widget_id Widget ID.
490 490
 	 * @return string Maybe-parsed widget ID.
491 491
 	 */
492
-	public function get_setting_id( $widget_id ) {
493
-		$parsed_widget_id = $this->parse_widget_id( $widget_id );
494
-		$setting_id       = sprintf( 'widget_%s', $parsed_widget_id['id_base'] );
492
+	public function get_setting_id($widget_id) {
493
+		$parsed_widget_id = $this->parse_widget_id($widget_id);
494
+		$setting_id       = sprintf('widget_%s', $parsed_widget_id['id_base']);
495 495
 
496
-		if ( ! is_null( $parsed_widget_id['number'] ) ) {
497
-			$setting_id .= sprintf( '[%d]', $parsed_widget_id['number'] );
496
+		if ( ! is_null($parsed_widget_id['number'])) {
497
+			$setting_id .= sprintf('[%d]', $parsed_widget_id['number']);
498 498
 		}
499 499
 		return $setting_id;
500 500
 	}
@@ -517,13 +517,13 @@  discard block
 block discarded – undo
517 517
 	 * @param string $widget_id Widget ID.
518 518
 	 * @return bool Whether or not the widget is a "wide" widget.
519 519
 	 */
520
-	public function is_wide_widget( $widget_id ) {
520
+	public function is_wide_widget($widget_id) {
521 521
 		global $wp_registered_widget_controls;
522 522
 
523
-		$parsed_widget_id = $this->parse_widget_id( $widget_id );
523
+		$parsed_widget_id = $this->parse_widget_id($widget_id);
524 524
 		$width            = $wp_registered_widget_controls[$widget_id]['width'];
525
-		$is_core          = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases );
526
-		$is_wide          = ( $width > 250 && ! $is_core );
525
+		$is_core          = in_array($parsed_widget_id['id_base'], $this->core_widget_id_bases);
526
+		$is_wide          = ($width > 250 && ! $is_core);
527 527
 
528 528
 		/**
529 529
 		 * Filter whether the given widget is considered "wide".
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 		 * @param bool   $is_wide   Whether the widget is wide, Default false.
534 534
 		 * @param string $widget_id Widget ID.
535 535
 		 */
536
-		return apply_filters( 'is_wide_widget_in_customizer', $is_wide, $widget_id );
536
+		return apply_filters('is_wide_widget_in_customizer', $is_wide, $widget_id);
537 537
 	}
538 538
 
539 539
 	/**
@@ -545,15 +545,15 @@  discard block
 block discarded – undo
545 545
 	 * @param string $widget_id Widget ID.
546 546
 	 * @return array Array containing a widget's id_base and number components.
547 547
 	 */
548
-	public function parse_widget_id( $widget_id ) {
548
+	public function parse_widget_id($widget_id) {
549 549
 		$parsed = array(
550 550
 			'number' => null,
551 551
 			'id_base' => null,
552 552
 		);
553 553
 
554
-		if ( preg_match( '/^(.+)-(\d+)$/', $widget_id, $matches ) ) {
554
+		if (preg_match('/^(.+)-(\d+)$/', $widget_id, $matches)) {
555 555
 			$parsed['id_base'] = $matches[1];
556
-			$parsed['number']  = intval( $matches[2] );
556
+			$parsed['number']  = intval($matches[2]);
557 557
 		} else {
558 558
 			// likely an old single widget
559 559
 			$parsed['id_base'] = $widget_id;
@@ -571,15 +571,15 @@  discard block
 block discarded – undo
571 571
 	 * @return WP_Error|array Array containing a widget's id_base and number components,
572 572
 	 *                        or a WP_Error object.
573 573
 	 */
574
-	public function parse_widget_setting_id( $setting_id ) {
575
-		if ( ! preg_match( '/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches ) ) {
576
-			return new WP_Error( 'widget_setting_invalid_id' );
574
+	public function parse_widget_setting_id($setting_id) {
575
+		if ( ! preg_match('/^(widget_(.+?))(?:\[(\d+)\])?$/', $setting_id, $matches)) {
576
+			return new WP_Error('widget_setting_invalid_id');
577 577
 		}
578 578
 
579 579
 		$id_base = $matches[2];
580
-		$number  = isset( $matches[3] ) ? intval( $matches[3] ) : null;
580
+		$number  = isset($matches[3]) ? intval($matches[3]) : null;
581 581
 
582
-		return compact( 'id_base', 'number' );
582
+		return compact('id_base', 'number');
583 583
 	}
584 584
 
585 585
 	/**
@@ -591,10 +591,10 @@  discard block
 block discarded – undo
591 591
 	 */
592 592
 	public function print_styles() {
593 593
 		/** This action is documented in wp-admin/admin-header.php */
594
-		do_action( 'admin_print_styles-widgets.php' );
594
+		do_action('admin_print_styles-widgets.php');
595 595
 
596 596
 		/** This action is documented in wp-admin/admin-header.php */
597
-		do_action( 'admin_print_styles' );
597
+		do_action('admin_print_styles');
598 598
 	}
599 599
 
600 600
 	/**
@@ -606,10 +606,10 @@  discard block
 block discarded – undo
606 606
 	 */
607 607
 	public function print_scripts() {
608 608
 		/** This action is documented in wp-admin/admin-header.php */
609
-		do_action( 'admin_print_scripts-widgets.php' );
609
+		do_action('admin_print_scripts-widgets.php');
610 610
 
611 611
 		/** This action is documented in wp-admin/admin-header.php */
612
-		do_action( 'admin_print_scripts' );
612
+		do_action('admin_print_scripts');
613 613
 	}
614 614
 
615 615
 	/**
@@ -625,11 +625,11 @@  discard block
 block discarded – undo
625 625
 	public function enqueue_scripts() {
626 626
 		global $wp_scripts, $wp_registered_sidebars, $wp_registered_widgets;
627 627
 
628
-		wp_enqueue_style( 'customize-widgets' );
629
-		wp_enqueue_script( 'customize-widgets' );
628
+		wp_enqueue_style('customize-widgets');
629
+		wp_enqueue_script('customize-widgets');
630 630
 
631 631
 		/** This action is documented in wp-admin/admin-header.php */
632
-		do_action( 'admin_enqueue_scripts', 'widgets.php' );
632
+		do_action('admin_enqueue_scripts', 'widgets.php');
633 633
 
634 634
 		/*
635 635
 		 * Export available widgets with control_tpl removed from model
@@ -637,23 +637,23 @@  discard block
 block discarded – undo
637 637
 		 */
638 638
 		$available_widgets = array();
639 639
 
640
-		foreach ( $this->get_available_widgets() as $available_widget ) {
641
-			unset( $available_widget['control_tpl'] );
640
+		foreach ($this->get_available_widgets() as $available_widget) {
641
+			unset($available_widget['control_tpl']);
642 642
 			$available_widgets[] = $available_widget;
643 643
 		}
644 644
 
645 645
 		$widget_reorder_nav_tpl = sprintf(
646 646
 			'<div class="widget-reorder-nav"><span class="move-widget" tabindex="0">%1$s</span><span class="move-widget-down" tabindex="0">%2$s</span><span class="move-widget-up" tabindex="0">%3$s</span></div>',
647
-			__( 'Move to another area&hellip;' ),
648
-			__( 'Move down' ),
649
-			__( 'Move up' )
647
+			__('Move to another area&hellip;'),
648
+			__('Move down'),
649
+			__('Move up')
650 650
 		);
651 651
 
652 652
 		$move_widget_area_tpl = str_replace(
653
-			array( '{description}', '{btn}' ),
653
+			array('{description}', '{btn}'),
654 654
 			array(
655
-				__( 'Select an area to move this widget into:' ),
656
-				_x( 'Move', 'Move widget' ),
655
+				__('Select an area to move this widget into:'),
656
+				_x('Move', 'Move widget'),
657 657
 			),
658 658
 			'<div class="move-widget-area">
659 659
 				<p class="description">{description}</p>
@@ -669,38 +669,38 @@  discard block
 block discarded – undo
669 669
 		);
670 670
 
671 671
 		$settings = array(
672
-			'registeredSidebars'   => array_values( $wp_registered_sidebars ),
672
+			'registeredSidebars'   => array_values($wp_registered_sidebars),
673 673
 			'registeredWidgets'    => $wp_registered_widgets,
674 674
 			'availableWidgets'     => $available_widgets, // @todo Merge this with registered_widgets
675 675
 			'l10n' => array(
676
-				'saveBtnLabel'     => __( 'Apply' ),
677
-				'saveBtnTooltip'   => __( 'Save and preview changes before publishing them.' ),
678
-				'removeBtnLabel'   => __( 'Remove' ),
679
-				'removeBtnTooltip' => __( 'Trash widget by moving it to the inactive widgets sidebar.' ),
680
-				'error'            => __( 'An error has occurred. Please reload the page and try again.' ),
681
-				'widgetMovedUp'    => __( 'Widget moved up' ),
682
-				'widgetMovedDown'  => __( 'Widget moved down' ),
683
-				'noAreasRendered'  => __( 'There are no widget areas currently rendered in the preview. Navigate in the preview to a template that makes use of a widget area in order to access its widgets here.' ),
684
-				'reorderModeOn'    => __( 'Reorder mode enabled' ),
685
-				'reorderModeOff'   => __( 'Reorder mode closed' ),
686
-				'reorderLabelOn'   => esc_attr__( 'Reorder widgets' ),
687
-				'reorderLabelOff'  => esc_attr__( 'Close reorder mode' ),
676
+				'saveBtnLabel'     => __('Apply'),
677
+				'saveBtnTooltip'   => __('Save and preview changes before publishing them.'),
678
+				'removeBtnLabel'   => __('Remove'),
679
+				'removeBtnTooltip' => __('Trash widget by moving it to the inactive widgets sidebar.'),
680
+				'error'            => __('An error has occurred. Please reload the page and try again.'),
681
+				'widgetMovedUp'    => __('Widget moved up'),
682
+				'widgetMovedDown'  => __('Widget moved down'),
683
+				'noAreasRendered'  => __('There are no widget areas currently rendered in the preview. Navigate in the preview to a template that makes use of a widget area in order to access its widgets here.'),
684
+				'reorderModeOn'    => __('Reorder mode enabled'),
685
+				'reorderModeOff'   => __('Reorder mode closed'),
686
+				'reorderLabelOn'   => esc_attr__('Reorder widgets'),
687
+				'reorderLabelOff'  => esc_attr__('Close reorder mode'),
688 688
 			),
689 689
 			'tpl' => array(
690 690
 				'widgetReorderNav' => $widget_reorder_nav_tpl,
691 691
 				'moveWidgetArea'   => $move_widget_area_tpl,
692 692
 			),
693
-			'selectiveRefresh'     => isset( $this->manager->selective_refresh ),
693
+			'selectiveRefresh'     => isset($this->manager->selective_refresh),
694 694
 		);
695 695
 
696
-		foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
697
-			unset( $registered_widget['callback'] ); // may not be JSON-serializeable
696
+		foreach ($settings['registeredWidgets'] as &$registered_widget) {
697
+			unset($registered_widget['callback']); // may not be JSON-serializeable
698 698
 		}
699 699
 
700 700
 		$wp_scripts->add_data(
701 701
 			'customize-widgets',
702 702
 			'data',
703
-			sprintf( 'var _wpCustomizeWidgetsSettings = %s;', wp_json_encode( $settings ) )
703
+			sprintf('var _wpCustomizeWidgetsSettings = %s;', wp_json_encode($settings))
704 704
 		);
705 705
 	}
706 706
 
@@ -716,23 +716,23 @@  discard block
 block discarded – undo
716 716
 		<div id="available-widgets">
717 717
 			<div class="customize-section-title">
718 718
 				<button class="customize-section-back" tabindex="-1">
719
-					<span class="screen-reader-text"><?php _e( 'Back' ); ?></span>
719
+					<span class="screen-reader-text"><?php _e('Back'); ?></span>
720 720
 				</button>
721 721
 				<h3>
722 722
 					<span class="customize-action"><?php
723 723
 						/* translators: &#9656; is the unicode right-pointing triangle, and %s is the section title in the Customizer */
724
-						echo sprintf( __( 'Customizing &#9656; %s' ), esc_html( $this->manager->get_panel( 'widgets' )->title ) );
724
+						echo sprintf(__('Customizing &#9656; %s'), esc_html($this->manager->get_panel('widgets')->title));
725 725
 					?></span>
726
-					<?php _e( 'Add a Widget' ); ?>
726
+					<?php _e('Add a Widget'); ?>
727 727
 				</h3>
728 728
 			</div>
729 729
 			<div id="available-widgets-filter">
730
-				<label class="screen-reader-text" for="widgets-search"><?php _e( 'Search Widgets' ); ?></label>
731
-				<input type="search" id="widgets-search" placeholder="<?php esc_attr_e( 'Search widgets&hellip;' ) ?>" />
730
+				<label class="screen-reader-text" for="widgets-search"><?php _e('Search Widgets'); ?></label>
731
+				<input type="search" id="widgets-search" placeholder="<?php esc_attr_e('Search widgets&hellip;') ?>" />
732 732
 			</div>
733 733
 			<div id="available-widgets-list">
734
-			<?php foreach ( $this->get_available_widgets() as $available_widget ): ?>
735
-				<div id="widget-tpl-<?php echo esc_attr( $available_widget['id'] ) ?>" data-widget-id="<?php echo esc_attr( $available_widget['id'] ) ?>" class="widget-tpl <?php echo esc_attr( $available_widget['id'] ) ?>" tabindex="0">
734
+			<?php foreach ($this->get_available_widgets() as $available_widget): ?>
735
+				<div id="widget-tpl-<?php echo esc_attr($available_widget['id']) ?>" data-widget-id="<?php echo esc_attr($available_widget['id']) ?>" class="widget-tpl <?php echo esc_attr($available_widget['id']) ?>" tabindex="0">
736 736
 					<?php echo $available_widget['control_tpl']; ?>
737 737
 				</div>
738 738
 			<?php endforeach; ?>
@@ -751,10 +751,10 @@  discard block
 block discarded – undo
751 751
 	 */
752 752
 	public function print_footer_scripts() {
753 753
 		/** This action is documented in wp-admin/admin-footer.php */
754
-		do_action( 'admin_print_footer_scripts' );
754
+		do_action('admin_print_footer_scripts');
755 755
 
756 756
 		/** This action is documented in wp-admin/admin-footer.php */
757
-		do_action( 'admin_footer-widgets.php' );
757
+		do_action('admin_footer-widgets.php');
758 758
 	}
759 759
 
760 760
 	/**
@@ -767,23 +767,23 @@  discard block
 block discarded – undo
767 767
 	 * @param array  $overrides Array of setting overrides.
768 768
 	 * @return array Possibly modified setting arguments.
769 769
 	 */
770
-	public function get_setting_args( $id, $overrides = array() ) {
770
+	public function get_setting_args($id, $overrides = array()) {
771 771
 		$args = array(
772 772
 			'type'       => 'option',
773 773
 			'capability' => 'edit_theme_options',
774
-			'transport'  => isset( $this->manager->selective_refresh ) ? 'postMessage' : 'refresh',
774
+			'transport'  => isset($this->manager->selective_refresh) ? 'postMessage' : 'refresh',
775 775
 			'default'    => array(),
776 776
 		);
777 777
 
778
-		if ( preg_match( $this->setting_id_patterns['sidebar_widgets'], $id, $matches ) ) {
779
-			$args['sanitize_callback'] = array( $this, 'sanitize_sidebar_widgets' );
780
-			$args['sanitize_js_callback'] = array( $this, 'sanitize_sidebar_widgets_js_instance' );
781
-		} elseif ( preg_match( $this->setting_id_patterns['widget_instance'], $id, $matches ) ) {
782
-			$args['sanitize_callback'] = array( $this, 'sanitize_widget_instance' );
783
-			$args['sanitize_js_callback'] = array( $this, 'sanitize_widget_js_instance' );
778
+		if (preg_match($this->setting_id_patterns['sidebar_widgets'], $id, $matches)) {
779
+			$args['sanitize_callback'] = array($this, 'sanitize_sidebar_widgets');
780
+			$args['sanitize_js_callback'] = array($this, 'sanitize_sidebar_widgets_js_instance');
781
+		} elseif (preg_match($this->setting_id_patterns['widget_instance'], $id, $matches)) {
782
+			$args['sanitize_callback'] = array($this, 'sanitize_widget_instance');
783
+			$args['sanitize_js_callback'] = array($this, 'sanitize_widget_js_instance');
784 784
 		}
785 785
 
786
-		$args = array_merge( $args, $overrides );
786
+		$args = array_merge($args, $overrides);
787 787
 
788 788
 		/**
789 789
 		 * Filter the common arguments supplied when constructing a Customizer setting.
@@ -795,7 +795,7 @@  discard block
 block discarded – undo
795 795
 		 * @param array  $args Array of Customizer setting arguments.
796 796
 		 * @param string $id   Widget setting ID.
797 797
 		 */
798
-		return apply_filters( 'widget_customizer_setting_args', $args, $id );
798
+		return apply_filters('widget_customizer_setting_args', $args, $id);
799 799
 	}
800 800
 
801 801
 	/**
@@ -809,11 +809,11 @@  discard block
 block discarded – undo
809 809
 	 * @param array $widget_ids Array of widget IDs.
810 810
 	 * @return array Array of sanitized widget IDs.
811 811
 	 */
812
-	public function sanitize_sidebar_widgets( $widget_ids ) {
813
-		$widget_ids = array_map( 'strval', (array) $widget_ids );
812
+	public function sanitize_sidebar_widgets($widget_ids) {
813
+		$widget_ids = array_map('strval', (array) $widget_ids);
814 814
 		$sanitized_widget_ids = array();
815
-		foreach ( $widget_ids as $widget_id ) {
816
-			$sanitized_widget_ids[] = preg_replace( '/[^a-z0-9_\-]/', '', $widget_id );
815
+		foreach ($widget_ids as $widget_id) {
816
+			$sanitized_widget_ids[] = preg_replace('/[^a-z0-9_\-]/', '', $widget_id);
817 817
 		}
818 818
 		return $sanitized_widget_ids;
819 819
 	}
@@ -834,31 +834,31 @@  discard block
 block discarded – undo
834 834
 	 */
835 835
 	public function get_available_widgets() {
836 836
 		static $available_widgets = array();
837
-		if ( ! empty( $available_widgets ) ) {
837
+		if ( ! empty($available_widgets)) {
838 838
 			return $available_widgets;
839 839
 		}
840 840
 
841 841
 		global $wp_registered_widgets, $wp_registered_widget_controls;
842
-		require_once ABSPATH . '/wp-admin/includes/widgets.php'; // for next_widget_id_number()
842
+		require_once ABSPATH.'/wp-admin/includes/widgets.php'; // for next_widget_id_number()
843 843
 
844 844
 		$sort = $wp_registered_widgets;
845
-		usort( $sort, array( $this, '_sort_name_callback' ) );
845
+		usort($sort, array($this, '_sort_name_callback'));
846 846
 		$done = array();
847 847
 
848
-		foreach ( $sort as $widget ) {
849
-			if ( in_array( $widget['callback'], $done, true ) ) { // We already showed this multi-widget
848
+		foreach ($sort as $widget) {
849
+			if (in_array($widget['callback'], $done, true)) { // We already showed this multi-widget
850 850
 				continue;
851 851
 			}
852 852
 
853
-			$sidebar = is_active_widget( $widget['callback'], $widget['id'], false, false );
853
+			$sidebar = is_active_widget($widget['callback'], $widget['id'], false, false);
854 854
 			$done[]  = $widget['callback'];
855 855
 
856
-			if ( ! isset( $widget['params'][0] ) ) {
856
+			if ( ! isset($widget['params'][0])) {
857 857
 				$widget['params'][0] = array();
858 858
 			}
859 859
 
860 860
 			$available_widget = $widget;
861
-			unset( $available_widget['callback'] ); // not serializable to JSON
861
+			unset($available_widget['callback']); // not serializable to JSON
862 862
 
863 863
 			$args = array(
864 864
 				'widget_id'   => $widget['id'],
@@ -867,37 +867,37 @@  discard block
 block discarded – undo
867 867
 			);
868 868
 
869 869
 			$is_disabled     = false;
870
-			$is_multi_widget = ( isset( $wp_registered_widget_controls[$widget['id']]['id_base'] ) && isset( $widget['params'][0]['number'] ) );
871
-			if ( $is_multi_widget ) {
870
+			$is_multi_widget = (isset($wp_registered_widget_controls[$widget['id']]['id_base']) && isset($widget['params'][0]['number']));
871
+			if ($is_multi_widget) {
872 872
 				$id_base            = $wp_registered_widget_controls[$widget['id']]['id_base'];
873 873
 				$args['_temp_id']   = "$id_base-__i__";
874
-				$args['_multi_num'] = next_widget_id_number( $id_base );
874
+				$args['_multi_num'] = next_widget_id_number($id_base);
875 875
 				$args['_add']       = 'multi';
876 876
 			} else {
877 877
 				$args['_add'] = 'single';
878 878
 
879
-				if ( $sidebar && 'wp_inactive_widgets' !== $sidebar ) {
879
+				if ($sidebar && 'wp_inactive_widgets' !== $sidebar) {
880 880
 					$is_disabled = true;
881 881
 				}
882 882
 				$id_base = $widget['id'];
883 883
 			}
884 884
 
885
-			$list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar( array( 0 => $args, 1 => $widget['params'][0] ) );
886
-			$control_tpl = $this->get_widget_control( $list_widget_controls_args );
885
+			$list_widget_controls_args = wp_list_widget_controls_dynamic_sidebar(array(0 => $args, 1 => $widget['params'][0]));
886
+			$control_tpl = $this->get_widget_control($list_widget_controls_args);
887 887
 
888 888
 			// The properties here are mapped to the Backbone Widget model.
889
-			$available_widget = array_merge( $available_widget, array(
890
-				'temp_id'      => isset( $args['_temp_id'] ) ? $args['_temp_id'] : null,
889
+			$available_widget = array_merge($available_widget, array(
890
+				'temp_id'      => isset($args['_temp_id']) ? $args['_temp_id'] : null,
891 891
 				'is_multi'     => $is_multi_widget,
892 892
 				'control_tpl'  => $control_tpl,
893
-				'multi_number' => ( $args['_add'] === 'multi' ) ? $args['_multi_num'] : false,
893
+				'multi_number' => ($args['_add'] === 'multi') ? $args['_multi_num'] : false,
894 894
 				'is_disabled'  => $is_disabled,
895 895
 				'id_base'      => $id_base,
896
-				'transport'    => isset( $this->manager->selective_refresh ) ? 'postMessage' : 'refresh',
896
+				'transport'    => isset($this->manager->selective_refresh) ? 'postMessage' : 'refresh',
897 897
 				'width'        => $wp_registered_widget_controls[$widget['id']]['width'],
898 898
 				'height'       => $wp_registered_widget_controls[$widget['id']]['height'],
899
-				'is_wide'      => $this->is_wide_widget( $widget['id'] ),
900
-			) );
899
+				'is_wide'      => $this->is_wide_widget($widget['id']),
900
+			));
901 901
 
902 902
 			$available_widgets[] = $available_widget;
903 903
 		}
@@ -915,8 +915,8 @@  discard block
 block discarded – undo
915 915
 	 * @param array $widget_b The second widget to compare.
916 916
 	 * @return int Reorder position for the current widget comparison.
917 917
 	 */
918
-	protected function _sort_name_callback( $widget_a, $widget_b ) {
919
-		return strnatcasecmp( $widget_a['name'], $widget_b['name'] );
918
+	protected function _sort_name_callback($widget_a, $widget_b) {
919
+		return strnatcasecmp($widget_a['name'], $widget_b['name']);
920 920
 	}
921 921
 
922 922
 	/**
@@ -928,13 +928,13 @@  discard block
 block discarded – undo
928 928
 	 * @param array $args Widget control arguments.
929 929
 	 * @return string Widget control form HTML markup.
930 930
 	 */
931
-	public function get_widget_control( $args ) {
931
+	public function get_widget_control($args) {
932 932
 		$args[0]['before_form'] = '<div class="form">';
933 933
 		$args[0]['after_form'] = '</div><!-- .form -->';
934 934
 		$args[0]['before_widget_content'] = '<div class="widget-content">';
935 935
 		$args[0]['after_widget_content'] = '</div><!-- .widget-content -->';
936 936
 		ob_start();
937
-		call_user_func_array( 'wp_widget_control', $args );
937
+		call_user_func_array('wp_widget_control', $args);
938 938
 		$control_tpl = ob_get_clean();
939 939
 		return $control_tpl;
940 940
 	}
@@ -951,23 +951,23 @@  discard block
 block discarded – undo
951 951
 	 *     @type string $content The contents of the widget form itself.
952 952
 	 * }
953 953
 	 */
954
-	public function get_widget_control_parts( $args ) {
954
+	public function get_widget_control_parts($args) {
955 955
 		$args[0]['before_widget_content'] = '<div class="widget-content">';
956 956
 		$args[0]['after_widget_content'] = '</div><!-- .widget-content -->';
957
-		$control_markup = $this->get_widget_control( $args );
957
+		$control_markup = $this->get_widget_control($args);
958 958
 
959
-		$content_start_pos = strpos( $control_markup, $args[0]['before_widget_content'] );
960
-		$content_end_pos = strrpos( $control_markup, $args[0]['after_widget_content'] );
959
+		$content_start_pos = strpos($control_markup, $args[0]['before_widget_content']);
960
+		$content_end_pos = strrpos($control_markup, $args[0]['after_widget_content']);
961 961
 
962
-		$control = substr( $control_markup, 0, $content_start_pos + strlen( $args[0]['before_widget_content'] ) );
963
-		$control .= substr( $control_markup, $content_end_pos );
964
-		$content = trim( substr(
962
+		$control = substr($control_markup, 0, $content_start_pos + strlen($args[0]['before_widget_content']));
963
+		$control .= substr($control_markup, $content_end_pos);
964
+		$content = trim(substr(
965 965
 			$control_markup,
966
-			$content_start_pos + strlen( $args[0]['before_widget_content'] ),
967
-			$content_end_pos - $content_start_pos - strlen( $args[0]['before_widget_content'] )
968
-		) );
966
+			$content_start_pos + strlen($args[0]['before_widget_content']),
967
+			$content_end_pos - $content_start_pos - strlen($args[0]['before_widget_content'])
968
+		));
969 969
 
970
-		return compact( 'control', 'content' );
970
+		return compact('control', 'content');
971 971
 	}
972 972
 
973 973
 	/**
@@ -977,9 +977,9 @@  discard block
 block discarded – undo
977 977
 	 * @access public
978 978
 	 */
979 979
 	public function customize_preview_init() {
980
-		add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue' ) );
981
-		add_action( 'wp_print_styles',    array( $this, 'print_preview_css' ), 1 );
982
-		add_action( 'wp_footer',          array( $this, 'export_preview_data' ), 20 );
980
+		add_action('wp_enqueue_scripts', array($this, 'customize_preview_enqueue'));
981
+		add_action('wp_print_styles', array($this, 'print_preview_css'), 1);
982
+		add_action('wp_footer', array($this, 'export_preview_data'), 20);
983 983
 	}
984 984
 
985 985
 	/**
@@ -991,8 +991,8 @@  discard block
 block discarded – undo
991 991
 	 * @param  array $nonces Array of nonces.
992 992
 	 * @return array $nonces Array of nonces.
993 993
 	 */
994
-	public function refresh_nonces( $nonces ) {
995
-		$nonces['update-widget'] = wp_create_nonce( 'update-widget' );
994
+	public function refresh_nonces($nonces) {
995
+		$nonces['update-widget'] = wp_create_nonce('update-widget');
996 996
 		return $nonces;
997 997
 	}
998 998
 
@@ -1010,10 +1010,10 @@  discard block
 block discarded – undo
1010 1010
 	 * @param array $sidebars_widgets List of widgets for the current sidebar.
1011 1011
 	 * @return array
1012 1012
 	 */
1013
-	public function preview_sidebars_widgets( $sidebars_widgets ) {
1014
-		$sidebars_widgets = get_option( 'sidebars_widgets' );
1013
+	public function preview_sidebars_widgets($sidebars_widgets) {
1014
+		$sidebars_widgets = get_option('sidebars_widgets');
1015 1015
 
1016
-		unset( $sidebars_widgets['array_version'] );
1016
+		unset($sidebars_widgets['array_version']);
1017 1017
 		return $sidebars_widgets;
1018 1018
 	}
1019 1019
 
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
 	 * @access public
1025 1025
 	 */
1026 1026
 	public function customize_preview_enqueue() {
1027
-		wp_enqueue_script( 'customize-preview-widgets' );
1027
+		wp_enqueue_script('customize-preview-widgets');
1028 1028
 	}
1029 1029
 
1030 1030
 	/**
@@ -1062,22 +1062,22 @@  discard block
 block discarded – undo
1062 1062
 		global $wp_registered_sidebars, $wp_registered_widgets;
1063 1063
 		// Prepare Customizer settings to pass to JavaScript.
1064 1064
 		$settings = array(
1065
-			'renderedSidebars'   => array_fill_keys( array_unique( $this->rendered_sidebars ), true ),
1066
-			'renderedWidgets'    => array_fill_keys( array_keys( $this->rendered_widgets ), true ),
1067
-			'registeredSidebars' => array_values( $wp_registered_sidebars ),
1065
+			'renderedSidebars'   => array_fill_keys(array_unique($this->rendered_sidebars), true),
1066
+			'renderedWidgets'    => array_fill_keys(array_keys($this->rendered_widgets), true),
1067
+			'registeredSidebars' => array_values($wp_registered_sidebars),
1068 1068
 			'registeredWidgets'  => $wp_registered_widgets,
1069 1069
 			'l10n'               => array(
1070
-				'widgetTooltip'  => __( 'Shift-click to edit this widget.' ),
1070
+				'widgetTooltip'  => __('Shift-click to edit this widget.'),
1071 1071
 			),
1072
-			'selectiveRefresh'   => isset( $this->manager->selective_refresh ),
1072
+			'selectiveRefresh'   => isset($this->manager->selective_refresh),
1073 1073
 		);
1074
-		foreach ( $settings['registeredWidgets'] as &$registered_widget ) {
1075
-			unset( $registered_widget['callback'] ); // may not be JSON-serializeable
1074
+		foreach ($settings['registeredWidgets'] as &$registered_widget) {
1075
+			unset($registered_widget['callback']); // may not be JSON-serializeable
1076 1076
 		}
1077 1077
 
1078 1078
 		?>
1079 1079
 		<script type="text/javascript">
1080
-			var _wpWidgetCustomizerPreviewSettings = <?php echo wp_json_encode( $settings ); ?>;
1080
+			var _wpWidgetCustomizerPreviewSettings = <?php echo wp_json_encode($settings); ?>;
1081 1081
 		</script>
1082 1082
 		<?php
1083 1083
 	}
@@ -1090,8 +1090,8 @@  discard block
 block discarded – undo
1090 1090
 	 *
1091 1091
 	 * @param array $widget Rendered widget to tally.
1092 1092
 	 */
1093
-	public function tally_rendered_widgets( $widget ) {
1094
-		$this->rendered_widgets[ $widget['id'] ] = true;
1093
+	public function tally_rendered_widgets($widget) {
1094
+		$this->rendered_widgets[$widget['id']] = true;
1095 1095
 	}
1096 1096
 
1097 1097
 	/**
@@ -1103,8 +1103,8 @@  discard block
 block discarded – undo
1103 1103
 	 * @param string $widget_id Widget ID to check.
1104 1104
 	 * @return bool Whether the widget is rendered.
1105 1105
 	 */
1106
-	public function is_widget_rendered( $widget_id ) {
1107
-		return in_array( $widget_id, $this->rendered_widgets );
1106
+	public function is_widget_rendered($widget_id) {
1107
+		return in_array($widget_id, $this->rendered_widgets);
1108 1108
 	}
1109 1109
 
1110 1110
 	/**
@@ -1116,8 +1116,8 @@  discard block
 block discarded – undo
1116 1116
 	 * @param string $sidebar_id Sidebar ID to check.
1117 1117
 	 * @return bool Whether the sidebar is rendered.
1118 1118
 	 */
1119
-	public function is_sidebar_rendered( $sidebar_id ) {
1120
-		return in_array( $sidebar_id, $this->rendered_sidebars );
1119
+	public function is_sidebar_rendered($sidebar_id) {
1120
+		return in_array($sidebar_id, $this->rendered_sidebars);
1121 1121
 	}
1122 1122
 
1123 1123
 	/**
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 	 * @param string $sidebar_id Sidebar ID.
1135 1135
 	 * @return bool Whether the sidebar is active.
1136 1136
 	 */
1137
-	public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
1138
-		if ( is_registered_sidebar( $sidebar_id ) ) {
1137
+	public function tally_sidebars_via_is_active_sidebar_calls($is_active, $sidebar_id) {
1138
+		if (is_registered_sidebar($sidebar_id)) {
1139 1139
 			$this->rendered_sidebars[] = $sidebar_id;
1140 1140
 		}
1141 1141
 		/*
@@ -1160,8 +1160,8 @@  discard block
 block discarded – undo
1160 1160
 	 * @param string $sidebar_id  Sidebar ID.
1161 1161
 	 * @return bool Whether the current sidebar has widgets.
1162 1162
 	 */
1163
-	public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
1164
-		if ( is_registered_sidebar( $sidebar_id ) ) {
1163
+	public function tally_sidebars_via_dynamic_sidebar_calls($has_widgets, $sidebar_id) {
1164
+		if (is_registered_sidebar($sidebar_id)) {
1165 1165
 			$this->rendered_sidebars[] = $sidebar_id;
1166 1166
 		}
1167 1167
 
@@ -1185,8 +1185,8 @@  discard block
 block discarded – undo
1185 1185
 	 * @param string $serialized_instance Widget instance.
1186 1186
 	 * @return string MAC for serialized widget instance.
1187 1187
 	 */
1188
-	protected function get_instance_hash_key( $serialized_instance ) {
1189
-		return wp_hash( $serialized_instance );
1188
+	protected function get_instance_hash_key($serialized_instance) {
1189
+		return wp_hash($serialized_instance);
1190 1190
 	}
1191 1191
 
1192 1192
 	/**
@@ -1201,29 +1201,29 @@  discard block
 block discarded – undo
1201 1201
 	 * @param array $value Widget instance to sanitize.
1202 1202
 	 * @return array|void Sanitized widget instance.
1203 1203
 	 */
1204
-	public function sanitize_widget_instance( $value ) {
1205
-		if ( $value === array() ) {
1204
+	public function sanitize_widget_instance($value) {
1205
+		if ($value === array()) {
1206 1206
 			return $value;
1207 1207
 		}
1208 1208
 
1209
-		if ( empty( $value['is_widget_customizer_js_value'] )
1210
-			|| empty( $value['instance_hash_key'] )
1211
-			|| empty( $value['encoded_serialized_instance'] ) )
1209
+		if (empty($value['is_widget_customizer_js_value'])
1210
+			|| empty($value['instance_hash_key'])
1211
+			|| empty($value['encoded_serialized_instance']))
1212 1212
 		{
1213 1213
 			return;
1214 1214
 		}
1215 1215
 
1216
-		$decoded = base64_decode( $value['encoded_serialized_instance'], true );
1217
-		if ( false === $decoded ) {
1216
+		$decoded = base64_decode($value['encoded_serialized_instance'], true);
1217
+		if (false === $decoded) {
1218 1218
 			return;
1219 1219
 		}
1220 1220
 
1221
-		if ( ! hash_equals( $this->get_instance_hash_key( $decoded ), $value['instance_hash_key'] ) ) {
1221
+		if ( ! hash_equals($this->get_instance_hash_key($decoded), $value['instance_hash_key'])) {
1222 1222
 			return;
1223 1223
 		}
1224 1224
 
1225
-		$instance = unserialize( $decoded );
1226
-		if ( false === $instance ) {
1225
+		$instance = unserialize($decoded);
1226
+		if (false === $instance) {
1227 1227
 			return;
1228 1228
 		}
1229 1229
 
@@ -1239,15 +1239,15 @@  discard block
 block discarded – undo
1239 1239
 	 * @param array $value Widget instance to convert to JSON.
1240 1240
 	 * @return array JSON-converted widget instance.
1241 1241
 	 */
1242
-	public function sanitize_widget_js_instance( $value ) {
1243
-		if ( empty( $value['is_widget_customizer_js_value'] ) ) {
1244
-			$serialized = serialize( $value );
1242
+	public function sanitize_widget_js_instance($value) {
1243
+		if (empty($value['is_widget_customizer_js_value'])) {
1244
+			$serialized = serialize($value);
1245 1245
 
1246 1246
 			$value = array(
1247
-				'encoded_serialized_instance'   => base64_encode( $serialized ),
1248
-				'title'                         => empty( $value['title'] ) ? '' : $value['title'],
1247
+				'encoded_serialized_instance'   => base64_encode($serialized),
1248
+				'title'                         => empty($value['title']) ? '' : $value['title'],
1249 1249
 				'is_widget_customizer_js_value' => true,
1250
-				'instance_hash_key'             => $this->get_instance_hash_key( $serialized ),
1250
+				'instance_hash_key'             => $this->get_instance_hash_key($serialized),
1251 1251
 			);
1252 1252
 		}
1253 1253
 		return $value;
@@ -1267,9 +1267,9 @@  discard block
 block discarded – undo
1267 1267
 	 * @param array $widget_ids List of widget IDs.
1268 1268
 	 * @return array Parsed list of widget IDs.
1269 1269
 	 */
1270
-	public function sanitize_sidebar_widgets_js_instance( $widget_ids ) {
1270
+	public function sanitize_sidebar_widgets_js_instance($widget_ids) {
1271 1271
 		global $wp_registered_widgets;
1272
-		$widget_ids = array_values( array_intersect( $widget_ids, array_keys( $wp_registered_widgets ) ) );
1272
+		$widget_ids = array_values(array_intersect($widget_ids, array_keys($wp_registered_widgets)));
1273 1273
 		return $widget_ids;
1274 1274
 	}
1275 1275
 
@@ -1288,93 +1288,93 @@  discard block
 block discarded – undo
1288 1288
 	 * @return WP_Error|array Array containing the updated widget information.
1289 1289
 	 *                        A WP_Error object, otherwise.
1290 1290
 	 */
1291
-	public function call_widget_update( $widget_id ) {
1291
+	public function call_widget_update($widget_id) {
1292 1292
 		global $wp_registered_widget_updates, $wp_registered_widget_controls;
1293 1293
 
1294
-		$setting_id = $this->get_setting_id( $widget_id );
1294
+		$setting_id = $this->get_setting_id($widget_id);
1295 1295
 
1296 1296
 		/*
1297 1297
 		 * Make sure that other setting changes have previewed since this widget
1298 1298
 		 * may depend on them (e.g. Menus being present for Custom Menu widget).
1299 1299
 		 */
1300
-		if ( ! did_action( 'customize_preview_init' ) ) {
1301
-			foreach ( $this->manager->settings() as $setting ) {
1302
-				if ( $setting->id !== $setting_id ) {
1300
+		if ( ! did_action('customize_preview_init')) {
1301
+			foreach ($this->manager->settings() as $setting) {
1302
+				if ($setting->id !== $setting_id) {
1303 1303
 					$setting->preview();
1304 1304
 				}
1305 1305
 			}
1306 1306
 		}
1307 1307
 
1308 1308
 		$this->start_capturing_option_updates();
1309
-		$parsed_id   = $this->parse_widget_id( $widget_id );
1310
-		$option_name = 'widget_' . $parsed_id['id_base'];
1309
+		$parsed_id   = $this->parse_widget_id($widget_id);
1310
+		$option_name = 'widget_'.$parsed_id['id_base'];
1311 1311
 
1312 1312
 		/*
1313 1313
 		 * If a previously-sanitized instance is provided, populate the input vars
1314 1314
 		 * with its values so that the widget update callback will read this instance
1315 1315
 		 */
1316 1316
 		$added_input_vars = array();
1317
-		if ( ! empty( $_POST['sanitized_widget_setting'] ) ) {
1318
-			$sanitized_widget_setting = json_decode( $this->get_post_value( 'sanitized_widget_setting' ), true );
1319
-			if ( false === $sanitized_widget_setting ) {
1317
+		if ( ! empty($_POST['sanitized_widget_setting'])) {
1318
+			$sanitized_widget_setting = json_decode($this->get_post_value('sanitized_widget_setting'), true);
1319
+			if (false === $sanitized_widget_setting) {
1320 1320
 				$this->stop_capturing_option_updates();
1321
-				return new WP_Error( 'widget_setting_malformed' );
1321
+				return new WP_Error('widget_setting_malformed');
1322 1322
 			}
1323 1323
 
1324
-			$instance = $this->sanitize_widget_instance( $sanitized_widget_setting );
1325
-			if ( is_null( $instance ) ) {
1324
+			$instance = $this->sanitize_widget_instance($sanitized_widget_setting);
1325
+			if (is_null($instance)) {
1326 1326
 				$this->stop_capturing_option_updates();
1327
-				return new WP_Error( 'widget_setting_unsanitized' );
1327
+				return new WP_Error('widget_setting_unsanitized');
1328 1328
 			}
1329 1329
 
1330
-			if ( ! is_null( $parsed_id['number'] ) ) {
1330
+			if ( ! is_null($parsed_id['number'])) {
1331 1331
 				$value = array();
1332 1332
 				$value[$parsed_id['number']] = $instance;
1333
-				$key = 'widget-' . $parsed_id['id_base'];
1334
-				$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
1333
+				$key = 'widget-'.$parsed_id['id_base'];
1334
+				$_REQUEST[$key] = $_POST[$key] = wp_slash($value);
1335 1335
 				$added_input_vars[] = $key;
1336 1336
 			} else {
1337
-				foreach ( $instance as $key => $value ) {
1338
-					$_REQUEST[$key] = $_POST[$key] = wp_slash( $value );
1337
+				foreach ($instance as $key => $value) {
1338
+					$_REQUEST[$key] = $_POST[$key] = wp_slash($value);
1339 1339
 					$added_input_vars[] = $key;
1340 1340
 				}
1341 1341
 			}
1342 1342
 		}
1343 1343
 
1344 1344
 		// Invoke the widget update callback.
1345
-		foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
1346
-			if ( $name === $parsed_id['id_base'] && is_callable( $control['callback'] ) ) {
1345
+		foreach ((array) $wp_registered_widget_updates as $name => $control) {
1346
+			if ($name === $parsed_id['id_base'] && is_callable($control['callback'])) {
1347 1347
 				ob_start();
1348
-				call_user_func_array( $control['callback'], $control['params'] );
1348
+				call_user_func_array($control['callback'], $control['params']);
1349 1349
 				ob_end_clean();
1350 1350
 				break;
1351 1351
 			}
1352 1352
 		}
1353 1353
 
1354 1354
 		// Clean up any input vars that were manually added
1355
-		foreach ( $added_input_vars as $key ) {
1356
-			unset( $_POST[ $key ] );
1357
-			unset( $_REQUEST[ $key ] );
1355
+		foreach ($added_input_vars as $key) {
1356
+			unset($_POST[$key]);
1357
+			unset($_REQUEST[$key]);
1358 1358
 		}
1359 1359
 
1360 1360
 		// Make sure the expected option was updated.
1361
-		if ( 0 !== $this->count_captured_options() ) {
1362
-			if ( $this->count_captured_options() > 1 ) {
1361
+		if (0 !== $this->count_captured_options()) {
1362
+			if ($this->count_captured_options() > 1) {
1363 1363
 				$this->stop_capturing_option_updates();
1364
-				return new WP_Error( 'widget_setting_too_many_options' );
1364
+				return new WP_Error('widget_setting_too_many_options');
1365 1365
 			}
1366 1366
 
1367
-			$updated_option_name = key( $this->get_captured_options() );
1368
-			if ( $updated_option_name !== $option_name ) {
1367
+			$updated_option_name = key($this->get_captured_options());
1368
+			if ($updated_option_name !== $option_name) {
1369 1369
 				$this->stop_capturing_option_updates();
1370
-				return new WP_Error( 'widget_setting_unexpected_option' );
1370
+				return new WP_Error('widget_setting_unexpected_option');
1371 1371
 			}
1372 1372
 		}
1373 1373
 
1374 1374
 		// Obtain the widget instance.
1375
-		$option = $this->get_captured_option( $option_name );
1376
-		if ( null !== $parsed_id['number'] ) {
1377
-			$instance = $option[ $parsed_id['number'] ];
1375
+		$option = $this->get_captured_option($option_name);
1376
+		if (null !== $parsed_id['number']) {
1377
+			$instance = $option[$parsed_id['number']];
1378 1378
 		} else {
1379 1379
 			$instance = $option;
1380 1380
 		}
@@ -1385,19 +1385,19 @@  discard block
 block discarded – undo
1385 1385
 		 * in place from WP_Customize_Setting::preview() will use this value
1386 1386
 		 * instead of the default widget instance value (an empty array).
1387 1387
 		 */
1388
-		$this->manager->set_post_value( $setting_id, $this->sanitize_widget_js_instance( $instance ) );
1388
+		$this->manager->set_post_value($setting_id, $this->sanitize_widget_js_instance($instance));
1389 1389
 
1390 1390
 		// Obtain the widget control with the updated instance in place.
1391 1391
 		ob_start();
1392
-		$form = $wp_registered_widget_controls[ $widget_id ];
1393
-		if ( $form ) {
1394
-			call_user_func_array( $form['callback'], $form['params'] );
1392
+		$form = $wp_registered_widget_controls[$widget_id];
1393
+		if ($form) {
1394
+			call_user_func_array($form['callback'], $form['params']);
1395 1395
 		}
1396 1396
 		$form = ob_get_clean();
1397 1397
 
1398 1398
 		$this->stop_capturing_option_updates();
1399 1399
 
1400
-		return compact( 'instance', 'form' );
1400
+		return compact('instance', 'form');
1401 1401
 	}
1402 1402
 
1403 1403
 	/**
@@ -1415,53 +1415,53 @@  discard block
 block discarded – undo
1415 1415
 	 */
1416 1416
 	public function wp_ajax_update_widget() {
1417 1417
 
1418
-		if ( ! is_user_logged_in() ) {
1419
-			wp_die( 0 );
1418
+		if ( ! is_user_logged_in()) {
1419
+			wp_die(0);
1420 1420
 		}
1421 1421
 
1422
-		check_ajax_referer( 'update-widget', 'nonce' );
1422
+		check_ajax_referer('update-widget', 'nonce');
1423 1423
 
1424
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
1424
+		if ( ! current_user_can('edit_theme_options')) {
1425 1425
 			wp_die( -1 );
1426 1426
 		}
1427 1427
 
1428
-		if ( empty( $_POST['widget-id'] ) ) {
1429
-			wp_send_json_error( 'missing_widget-id' );
1428
+		if (empty($_POST['widget-id'])) {
1429
+			wp_send_json_error('missing_widget-id');
1430 1430
 		}
1431 1431
 
1432 1432
 		/** This action is documented in wp-admin/includes/ajax-actions.php */
1433
-		do_action( 'load-widgets.php' );
1433
+		do_action('load-widgets.php');
1434 1434
 
1435 1435
 		/** This action is documented in wp-admin/includes/ajax-actions.php */
1436
-		do_action( 'widgets.php' );
1436
+		do_action('widgets.php');
1437 1437
 
1438 1438
 		/** This action is documented in wp-admin/widgets.php */
1439
-		do_action( 'sidebar_admin_setup' );
1439
+		do_action('sidebar_admin_setup');
1440 1440
 
1441
-		$widget_id = $this->get_post_value( 'widget-id' );
1442
-		$parsed_id = $this->parse_widget_id( $widget_id );
1441
+		$widget_id = $this->get_post_value('widget-id');
1442
+		$parsed_id = $this->parse_widget_id($widget_id);
1443 1443
 		$id_base = $parsed_id['id_base'];
1444 1444
 
1445 1445
 		$is_updating_widget_template = (
1446
-			isset( $_POST[ 'widget-' . $id_base ] )
1446
+			isset($_POST['widget-'.$id_base])
1447 1447
 			&&
1448
-			is_array( $_POST[ 'widget-' . $id_base ] )
1448
+			is_array($_POST['widget-'.$id_base])
1449 1449
 			&&
1450
-			preg_match( '/__i__|%i%/', key( $_POST[ 'widget-' . $id_base ] ) )
1450
+			preg_match('/__i__|%i%/', key($_POST['widget-'.$id_base]))
1451 1451
 		);
1452
-		if ( $is_updating_widget_template ) {
1453
-			wp_send_json_error( 'template_widget_not_updatable' );
1452
+		if ($is_updating_widget_template) {
1453
+			wp_send_json_error('template_widget_not_updatable');
1454 1454
 		}
1455 1455
 
1456
-		$updated_widget = $this->call_widget_update( $widget_id ); // => {instance,form}
1457
-		if ( is_wp_error( $updated_widget ) ) {
1458
-			wp_send_json_error( $updated_widget->get_error_code() );
1456
+		$updated_widget = $this->call_widget_update($widget_id); // => {instance,form}
1457
+		if (is_wp_error($updated_widget)) {
1458
+			wp_send_json_error($updated_widget->get_error_code());
1459 1459
 		}
1460 1460
 
1461 1461
 		$form = $updated_widget['form'];
1462
-		$instance = $this->sanitize_widget_js_instance( $updated_widget['instance'] );
1462
+		$instance = $this->sanitize_widget_js_instance($updated_widget['instance']);
1463 1463
 
1464
-		wp_send_json_success( compact( 'form', 'instance' ) );
1464
+		wp_send_json_success(compact('form', 'instance'));
1465 1465
 	}
1466 1466
 
1467 1467
 	/*
@@ -1478,19 +1478,19 @@  discard block
 block discarded – undo
1478 1478
 	 * @param string      $partial_id   Partial ID.
1479 1479
 	 * @return array (Maybe) modified partial arguments.
1480 1480
 	 */
1481
-	public function customize_dynamic_partial_args( $partial_args, $partial_id ) {
1481
+	public function customize_dynamic_partial_args($partial_args, $partial_id) {
1482 1482
 
1483
-		if ( preg_match( '/^widget\[(?P<widget_id>.+)\]$/', $partial_id, $matches ) ) {
1484
-			if ( false === $partial_args ) {
1483
+		if (preg_match('/^widget\[(?P<widget_id>.+)\]$/', $partial_id, $matches)) {
1484
+			if (false === $partial_args) {
1485 1485
 				$partial_args = array();
1486 1486
 			}
1487 1487
 			$partial_args = array_merge(
1488 1488
 				$partial_args,
1489 1489
 				array(
1490 1490
 					'type'                => 'widget',
1491
-					'render_callback'     => array( $this, 'render_widget_partial' ),
1491
+					'render_callback'     => array($this, 'render_widget_partial'),
1492 1492
 					'container_inclusive' => true,
1493
-					'settings'            => array( $this->get_setting_id( $matches['widget_id'] ) ),
1493
+					'settings'            => array($this->get_setting_id($matches['widget_id'])),
1494 1494
 					'capability'          => 'edit_theme_options',
1495 1495
 				)
1496 1496
 			);
@@ -1506,15 +1506,15 @@  discard block
 block discarded – undo
1506 1506
 	 * @access public
1507 1507
 	 */
1508 1508
 	public function selective_refresh_init() {
1509
-		if ( ! isset( $this->manager->selective_refresh ) ) {
1509
+		if ( ! isset($this->manager->selective_refresh)) {
1510 1510
 			return;
1511 1511
 		}
1512 1512
 
1513
-		add_action( 'wp_enqueue_scripts', array( $this, 'customize_preview_enqueue_deps' ) );
1514
-		add_filter( 'dynamic_sidebar_params', array( $this, 'filter_dynamic_sidebar_params' ) );
1515
-		add_filter( 'wp_kses_allowed_html', array( $this, 'filter_wp_kses_allowed_data_attributes' ) );
1516
-		add_action( 'dynamic_sidebar_before', array( $this, 'start_dynamic_sidebar' ) );
1517
-		add_action( 'dynamic_sidebar_after', array( $this, 'end_dynamic_sidebar' ) );
1513
+		add_action('wp_enqueue_scripts', array($this, 'customize_preview_enqueue_deps'));
1514
+		add_filter('dynamic_sidebar_params', array($this, 'filter_dynamic_sidebar_params'));
1515
+		add_filter('wp_kses_allowed_html', array($this, 'filter_wp_kses_allowed_data_attributes'));
1516
+		add_action('dynamic_sidebar_before', array($this, 'start_dynamic_sidebar'));
1517
+		add_action('dynamic_sidebar_after', array($this, 'end_dynamic_sidebar'));
1518 1518
 	}
1519 1519
 
1520 1520
 	/**
@@ -1524,13 +1524,13 @@  discard block
 block discarded – undo
1524 1524
 	 * @access public
1525 1525
 	 */
1526 1526
 	public function customize_preview_enqueue_deps() {
1527
-		if ( isset( $this->manager->selective_refresh ) ) {
1527
+		if (isset($this->manager->selective_refresh)) {
1528 1528
 			$script = wp_scripts()->registered['customize-preview-widgets'];
1529 1529
 			$script->deps[] = 'customize-selective-refresh';
1530 1530
 		}
1531 1531
 
1532
-		wp_enqueue_script( 'customize-preview-widgets' );
1533
-		wp_enqueue_style( 'customize-preview' );
1532
+		wp_enqueue_script('customize-preview-widgets');
1533
+		wp_enqueue_style('customize-preview');
1534 1534
 	}
1535 1535
 
1536 1536
 	/**
@@ -1546,7 +1546,7 @@  discard block
 block discarded – undo
1546 1546
 	 *
1547 1547
 	 * @return array Params.
1548 1548
 	 */
1549
-	public function filter_dynamic_sidebar_params( $params ) {
1549
+	public function filter_dynamic_sidebar_params($params) {
1550 1550
 		$sidebar_args = array_merge(
1551 1551
 			array(
1552 1552
 				'before_widget' => '',
@@ -1558,33 +1558,33 @@  discard block
 block discarded – undo
1558 1558
 		// Skip widgets not in a registered sidebar or ones which lack a proper wrapper element to attach the data-* attributes to.
1559 1559
 		$matches = array();
1560 1560
 		$is_valid = (
1561
-			isset( $sidebar_args['id'] )
1561
+			isset($sidebar_args['id'])
1562 1562
 			&&
1563
-			is_registered_sidebar( $sidebar_args['id'] )
1563
+			is_registered_sidebar($sidebar_args['id'])
1564 1564
 			&&
1565
-			( isset( $this->current_dynamic_sidebar_id_stack[0] ) && $this->current_dynamic_sidebar_id_stack[0] === $sidebar_args['id'] )
1565
+			(isset($this->current_dynamic_sidebar_id_stack[0]) && $this->current_dynamic_sidebar_id_stack[0] === $sidebar_args['id'])
1566 1566
 			&&
1567
-			preg_match( '#^<(?P<tag_name>\w+)#', $sidebar_args['before_widget'], $matches )
1567
+			preg_match('#^<(?P<tag_name>\w+)#', $sidebar_args['before_widget'], $matches)
1568 1568
 		);
1569
-		if ( ! $is_valid ) {
1569
+		if ( ! $is_valid) {
1570 1570
 			return $params;
1571 1571
 		}
1572
-		$this->before_widget_tags_seen[ $matches['tag_name'] ] = true;
1572
+		$this->before_widget_tags_seen[$matches['tag_name']] = true;
1573 1573
 
1574 1574
 		$context = array(
1575 1575
 			'sidebar_id' => $sidebar_args['id'],
1576 1576
 		);
1577
-		if ( isset( $this->context_sidebar_instance_number ) ) {
1577
+		if (isset($this->context_sidebar_instance_number)) {
1578 1578
 			$context['sidebar_instance_number'] = $this->context_sidebar_instance_number;
1579
-		} else if ( isset( $sidebar_args['id'] ) && isset( $this->sidebar_instance_count[ $sidebar_args['id'] ] ) ) {
1580
-			$context['sidebar_instance_number'] = $this->sidebar_instance_count[ $sidebar_args['id'] ];
1579
+		} else if (isset($sidebar_args['id']) && isset($this->sidebar_instance_count[$sidebar_args['id']])) {
1580
+			$context['sidebar_instance_number'] = $this->sidebar_instance_count[$sidebar_args['id']];
1581 1581
 		}
1582 1582
 
1583
-		$attributes = sprintf( ' data-customize-partial-id="%s"', esc_attr( 'widget[' . $sidebar_args['widget_id'] . ']' ) );
1583
+		$attributes = sprintf(' data-customize-partial-id="%s"', esc_attr('widget['.$sidebar_args['widget_id'].']'));
1584 1584
 		$attributes .= ' data-customize-partial-type="widget"';
1585
-		$attributes .= sprintf( ' data-customize-partial-placement-context="%s"', esc_attr( wp_json_encode( $context ) ) );
1586
-		$attributes .= sprintf( ' data-customize-widget-id="%s"', esc_attr( $sidebar_args['widget_id'] ) );
1587
-		$sidebar_args['before_widget'] = preg_replace( '#^(<\w+)#', '$1 ' . $attributes, $sidebar_args['before_widget'] );
1585
+		$attributes .= sprintf(' data-customize-partial-placement-context="%s"', esc_attr(wp_json_encode($context)));
1586
+		$attributes .= sprintf(' data-customize-widget-id="%s"', esc_attr($sidebar_args['widget_id']));
1587
+		$sidebar_args['before_widget'] = preg_replace('#^(<\w+)#', '$1 '.$attributes, $sidebar_args['before_widget']);
1588 1588
 
1589 1589
 		$params[0] = $sidebar_args;
1590 1590
 		return $params;
@@ -1613,20 +1613,20 @@  discard block
 block discarded – undo
1613 1613
 	 * @param array $allowed_html Allowed HTML.
1614 1614
 	 * @return array (Maybe) modified allowed HTML.
1615 1615
 	 */
1616
-	public function filter_wp_kses_allowed_data_attributes( $allowed_html ) {
1617
-		foreach ( array_keys( $this->before_widget_tags_seen ) as $tag_name ) {
1618
-			if ( ! isset( $allowed_html[ $tag_name ] ) ) {
1619
-				$allowed_html[ $tag_name ] = array();
1616
+	public function filter_wp_kses_allowed_data_attributes($allowed_html) {
1617
+		foreach (array_keys($this->before_widget_tags_seen) as $tag_name) {
1618
+			if ( ! isset($allowed_html[$tag_name])) {
1619
+				$allowed_html[$tag_name] = array();
1620 1620
 			}
1621
-			$allowed_html[ $tag_name ] = array_merge(
1622
-				$allowed_html[ $tag_name ],
1623
-				array_fill_keys( array(
1621
+			$allowed_html[$tag_name] = array_merge(
1622
+				$allowed_html[$tag_name],
1623
+				array_fill_keys(array(
1624 1624
 					'data-customize-partial-id',
1625 1625
 					'data-customize-partial-type',
1626 1626
 					'data-customize-partial-placement-context',
1627 1627
 					'data-customize-partial-widget-id',
1628 1628
 					'data-customize-partial-options',
1629
-				), true )
1629
+				), true)
1630 1630
 			);
1631 1631
 		}
1632 1632
 		return $allowed_html;
@@ -1671,14 +1671,14 @@  discard block
 block discarded – undo
1671 1671
 	 *
1672 1672
 	 * @param int|string $index Index, name, or ID of the dynamic sidebar.
1673 1673
 	 */
1674
-	public function start_dynamic_sidebar( $index ) {
1675
-		array_unshift( $this->current_dynamic_sidebar_id_stack, $index );
1676
-		if ( ! isset( $this->sidebar_instance_count[ $index ] ) ) {
1677
-			$this->sidebar_instance_count[ $index ] = 0;
1674
+	public function start_dynamic_sidebar($index) {
1675
+		array_unshift($this->current_dynamic_sidebar_id_stack, $index);
1676
+		if ( ! isset($this->sidebar_instance_count[$index])) {
1677
+			$this->sidebar_instance_count[$index] = 0;
1678 1678
 		}
1679
-		$this->sidebar_instance_count[ $index ] += 1;
1680
-		if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
1681
-			printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) );
1679
+		$this->sidebar_instance_count[$index] += 1;
1680
+		if ( ! $this->manager->selective_refresh->is_render_partials_request()) {
1681
+			printf("\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html($index), intval($this->sidebar_instance_count[$index]));
1682 1682
 		}
1683 1683
 	}
1684 1684
 
@@ -1692,10 +1692,10 @@  discard block
 block discarded – undo
1692 1692
 	 *
1693 1693
 	 * @param int|string $index Index, name, or ID of the dynamic sidebar.
1694 1694
 	 */
1695
-	public function end_dynamic_sidebar( $index ) {
1696
-		array_shift( $this->current_dynamic_sidebar_id_stack );
1697
-		if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
1698
-			printf( "\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html( $index ), intval( $this->sidebar_instance_count[ $index ] ) );
1695
+	public function end_dynamic_sidebar($index) {
1696
+		array_shift($this->current_dynamic_sidebar_id_stack);
1697
+		if ( ! $this->manager->selective_refresh->is_render_partials_request()) {
1698
+			printf("\n<!--dynamic_sidebar_after:%s:%d-->\n", esc_html($index), intval($this->sidebar_instance_count[$index]));
1699 1699
 		}
1700 1700
 	}
1701 1701
 
@@ -1726,8 +1726,8 @@  discard block
 block discarded – undo
1726 1726
 	 * @param array $sidebars_widgets Sidebars widgets.
1727 1727
 	 * @return array Filtered sidebars widgets.
1728 1728
 	 */
1729
-	public function filter_sidebars_widgets_for_rendering_widget( $sidebars_widgets ) {
1730
-		$sidebars_widgets[ $this->rendering_sidebar_id ] = array( $this->rendering_widget_id );
1729
+	public function filter_sidebars_widgets_for_rendering_widget($sidebars_widgets) {
1730
+		$sidebars_widgets[$this->rendering_sidebar_id] = array($this->rendering_widget_id);
1731 1731
 		return $sidebars_widgets;
1732 1732
 	}
1733 1733
 
@@ -1748,36 +1748,36 @@  discard block
 block discarded – undo
1748 1748
 	 * }
1749 1749
 	 * @return string|false
1750 1750
 	 */
1751
-	public function render_widget_partial( $partial, $context ) {
1751
+	public function render_widget_partial($partial, $context) {
1752 1752
 		$id_data   = $partial->id_data();
1753
-		$widget_id = array_shift( $id_data['keys'] );
1753
+		$widget_id = array_shift($id_data['keys']);
1754 1754
 
1755
-		if ( ! is_array( $context )
1756
-			|| empty( $context['sidebar_id'] )
1757
-			|| ! is_registered_sidebar( $context['sidebar_id'] )
1755
+		if ( ! is_array($context)
1756
+			|| empty($context['sidebar_id'])
1757
+			|| ! is_registered_sidebar($context['sidebar_id'])
1758 1758
 		) {
1759 1759
 			return false;
1760 1760
 		}
1761 1761
 
1762 1762
 		$this->rendering_sidebar_id = $context['sidebar_id'];
1763 1763
 
1764
-		if ( isset( $context['sidebar_instance_number'] ) ) {
1765
-			$this->context_sidebar_instance_number = intval( $context['sidebar_instance_number'] );
1764
+		if (isset($context['sidebar_instance_number'])) {
1765
+			$this->context_sidebar_instance_number = intval($context['sidebar_instance_number']);
1766 1766
 		}
1767 1767
 
1768 1768
 		// Filter sidebars_widgets so that only the queried widget is in the sidebar.
1769 1769
 		$this->rendering_widget_id = $widget_id;
1770 1770
 
1771
-		$filter_callback = array( $this, 'filter_sidebars_widgets_for_rendering_widget' );
1772
-		add_filter( 'sidebars_widgets', $filter_callback, 1000 );
1771
+		$filter_callback = array($this, 'filter_sidebars_widgets_for_rendering_widget');
1772
+		add_filter('sidebars_widgets', $filter_callback, 1000);
1773 1773
 
1774 1774
 		// Render the widget.
1775 1775
 		ob_start();
1776
-		dynamic_sidebar( $this->rendering_sidebar_id = $context['sidebar_id'] );
1776
+		dynamic_sidebar($this->rendering_sidebar_id = $context['sidebar_id']);
1777 1777
 		$container = ob_get_clean();
1778 1778
 
1779 1779
 		// Reset variables for next partial render.
1780
-		remove_filter( 'sidebars_widgets', $filter_callback, 1000 );
1780
+		remove_filter('sidebars_widgets', $filter_callback, 1000);
1781 1781
 
1782 1782
 		$this->context_sidebar_instance_number = null;
1783 1783
 		$this->rendering_sidebar_id = null;
@@ -1817,8 +1817,8 @@  discard block
 block discarded – undo
1817 1817
 	 * @param string $option_name Option name.
1818 1818
 	 * @return bool Whether the option capture is ignored.
1819 1819
 	 */
1820
-	protected function is_option_capture_ignored( $option_name ) {
1821
-		return ( 0 === strpos( $option_name, '_transient_' ) );
1820
+	protected function is_option_capture_ignored($option_name) {
1821
+		return (0 === strpos($option_name, '_transient_'));
1822 1822
 	}
1823 1823
 
1824 1824
 	/**
@@ -1843,9 +1843,9 @@  discard block
 block discarded – undo
1843 1843
 	 * @param mixed  $default     Optional. Default value to return if the option does not exist. Default false.
1844 1844
 	 * @return mixed Value set for the option.
1845 1845
 	 */
1846
-	protected function get_captured_option( $option_name, $default = false ) {
1847
-		if ( array_key_exists( $option_name, $this->_captured_options ) ) {
1848
-			$value = $this->_captured_options[ $option_name ];
1846
+	protected function get_captured_option($option_name, $default = false) {
1847
+		if (array_key_exists($option_name, $this->_captured_options)) {
1848
+			$value = $this->_captured_options[$option_name];
1849 1849
 		} else {
1850 1850
 			$value = $default;
1851 1851
 		}
@@ -1861,7 +1861,7 @@  discard block
 block discarded – undo
1861 1861
 	 * @return int Number of updated options.
1862 1862
 	 */
1863 1863
 	protected function count_captured_options() {
1864
-		return count( $this->_captured_options );
1864
+		return count($this->_captured_options);
1865 1865
 	}
1866 1866
 
1867 1867
 	/**
@@ -1871,13 +1871,13 @@  discard block
 block discarded – undo
1871 1871
 	 * @access protected
1872 1872
 	 */
1873 1873
 	protected function start_capturing_option_updates() {
1874
-		if ( $this->_is_capturing_option_updates ) {
1874
+		if ($this->_is_capturing_option_updates) {
1875 1875
 			return;
1876 1876
 		}
1877 1877
 
1878 1878
 		$this->_is_capturing_option_updates = true;
1879 1879
 
1880
-		add_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10, 3 );
1880
+		add_filter('pre_update_option', array($this, 'capture_filter_pre_update_option'), 10, 3);
1881 1881
 	}
1882 1882
 
1883 1883
 	/**
@@ -1891,16 +1891,16 @@  discard block
 block discarded – undo
1891 1891
 	 * @param mixed  $old_value   The old option value.
1892 1892
 	 * @return mixed Filtered option value.
1893 1893
 	 */
1894
-	public function capture_filter_pre_update_option( $new_value, $option_name, $old_value ) {
1895
-		if ( $this->is_option_capture_ignored( $option_name ) ) {
1894
+	public function capture_filter_pre_update_option($new_value, $option_name, $old_value) {
1895
+		if ($this->is_option_capture_ignored($option_name)) {
1896 1896
 			return;
1897 1897
 		}
1898 1898
 
1899
-		if ( ! isset( $this->_captured_options[ $option_name ] ) ) {
1900
-			add_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
1899
+		if ( ! isset($this->_captured_options[$option_name])) {
1900
+			add_filter("pre_option_{$option_name}", array($this, 'capture_filter_pre_get_option'));
1901 1901
 		}
1902 1902
 
1903
-		$this->_captured_options[ $option_name ] = $new_value;
1903
+		$this->_captured_options[$option_name] = $new_value;
1904 1904
 
1905 1905
 		return $old_value;
1906 1906
 	}
@@ -1914,14 +1914,14 @@  discard block
 block discarded – undo
1914 1914
 	 * @param mixed $value Value to return instead of the option value.
1915 1915
 	 * @return mixed Filtered option value.
1916 1916
 	 */
1917
-	public function capture_filter_pre_get_option( $value ) {
1918
-		$option_name = preg_replace( '/^pre_option_/', '', current_filter() );
1917
+	public function capture_filter_pre_get_option($value) {
1918
+		$option_name = preg_replace('/^pre_option_/', '', current_filter());
1919 1919
 
1920
-		if ( isset( $this->_captured_options[ $option_name ] ) ) {
1921
-			$value = $this->_captured_options[ $option_name ];
1920
+		if (isset($this->_captured_options[$option_name])) {
1921
+			$value = $this->_captured_options[$option_name];
1922 1922
 
1923 1923
 			/** This filter is documented in wp-includes/option.php */
1924
-			$value = apply_filters( 'option_' . $option_name, $value );
1924
+			$value = apply_filters('option_'.$option_name, $value);
1925 1925
 		}
1926 1926
 
1927 1927
 		return $value;
@@ -1934,14 +1934,14 @@  discard block
 block discarded – undo
1934 1934
 	 * @access protected
1935 1935
 	 */
1936 1936
 	protected function stop_capturing_option_updates() {
1937
-		if ( ! $this->_is_capturing_option_updates ) {
1937
+		if ( ! $this->_is_capturing_option_updates) {
1938 1938
 			return;
1939 1939
 		}
1940 1940
 
1941
-		remove_filter( 'pre_update_option', array( $this, 'capture_filter_pre_update_option' ), 10 );
1941
+		remove_filter('pre_update_option', array($this, 'capture_filter_pre_update_option'), 10);
1942 1942
 
1943
-		foreach ( array_keys( $this->_captured_options ) as $option_name ) {
1944
-			remove_filter( "pre_option_{$option_name}", array( $this, 'capture_filter_pre_get_option' ) );
1943
+		foreach (array_keys($this->_captured_options) as $option_name) {
1944
+			remove_filter("pre_option_{$option_name}", array($this, 'capture_filter_pre_get_option'));
1945 1945
 		}
1946 1946
 
1947 1947
 		$this->_captured_options = array();
@@ -1953,7 +1953,7 @@  discard block
 block discarded – undo
1953 1953
 	 * @deprecated 4.2.0 Deprecated in favor of customize_dynamic_setting_args filter.
1954 1954
 	 */
1955 1955
 	public function setup_widget_addition_previews() {
1956
-		_deprecated_function( __METHOD__, '4.2.0' );
1956
+		_deprecated_function(__METHOD__, '4.2.0');
1957 1957
 	}
1958 1958
 
1959 1959
 	/**
@@ -1961,7 +1961,7 @@  discard block
 block discarded – undo
1961 1961
 	 * @deprecated 4.2.0 Deprecated in favor of customize_dynamic_setting_args filter.
1962 1962
 	 */
1963 1963
 	public function prepreview_added_sidebars_widgets() {
1964
-		_deprecated_function( __METHOD__, '4.2.0' );
1964
+		_deprecated_function(__METHOD__, '4.2.0');
1965 1965
 	}
1966 1966
 
1967 1967
 	/**
@@ -1969,7 +1969,7 @@  discard block
 block discarded – undo
1969 1969
 	 * @deprecated 4.2.0 Deprecated in favor of customize_dynamic_setting_args filter.
1970 1970
 	 */
1971 1971
 	public function prepreview_added_widget_instance() {
1972
-		_deprecated_function( __METHOD__, '4.2.0' );
1972
+		_deprecated_function(__METHOD__, '4.2.0');
1973 1973
 	}
1974 1974
 
1975 1975
 	/**
@@ -1977,6 +1977,6 @@  discard block
 block discarded – undo
1977 1977
 	 * @deprecated 4.2.0 Deprecated in favor of customize_dynamic_setting_args filter.
1978 1978
 	 */
1979 1979
 	public function remove_prepreview_filters() {
1980
-		_deprecated_function( __METHOD__, '4.2.0' );
1980
+		_deprecated_function(__METHOD__, '4.2.0');
1981 1981
 	}
1982 1982
 }
Please login to merge, or discard this patch.
src/wp-includes/class-json.php 4 patches
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@  discard block
 block discarded – undo
1 1
 <?php
2
-if ( ! class_exists( 'Services_JSON' ) ) :
2
+if ( ! class_exists('Services_JSON')) :
3 3
 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4 4
 /**
5 5
  * Converts to and from JSON format.
@@ -59,22 +59,22 @@  discard block
 block discarded – undo
59 59
 /**
60 60
  * Marker constant for Services_JSON::decode(), used to flag stack state
61 61
  */
62
-define('SERVICES_JSON_SLICE',   1);
62
+define('SERVICES_JSON_SLICE', 1);
63 63
 
64 64
 /**
65 65
  * Marker constant for Services_JSON::decode(), used to flag stack state
66 66
  */
67
-define('SERVICES_JSON_IN_STR',  2);
67
+define('SERVICES_JSON_IN_STR', 2);
68 68
 
69 69
 /**
70 70
  * Marker constant for Services_JSON::decode(), used to flag stack state
71 71
  */
72
-define('SERVICES_JSON_IN_ARR',  3);
72
+define('SERVICES_JSON_IN_ARR', 3);
73 73
 
74 74
 /**
75 75
  * Marker constant for Services_JSON::decode(), used to flag stack state
76 76
  */
77
-define('SERVICES_JSON_IN_OBJ',  4);
77
+define('SERVICES_JSON_IN_OBJ', 4);
78 78
 
79 79
 /**
80 80
  * Marker constant for Services_JSON::decode(), used to flag stack state
@@ -140,7 +140,7 @@  discard block
 block discarded – undo
140 140
     *                                   strings or numbers, if you return an object, make sure it does
141 141
     *                                   not have a toJSON method, otherwise an error will occur.
142 142
     */
143
-    function __construct( $use = 0 )
143
+    function __construct($use = 0)
144 144
     {
145 145
         $this->use = $use;
146 146
         $this->_mb_strlen            = function_exists('mb_strlen');
@@ -151,8 +151,8 @@  discard block
 block discarded – undo
151 151
 	/**
152 152
 	 * PHP4 constructor.
153 153
 	 */
154
-	public function Services_JSON( $use = 0 ) {
155
-		self::__construct( $use );
154
+	public function Services_JSON($use = 0) {
155
+		self::__construct($use);
156 156
 	}
157 157
     // private - cache the mbstring lookup results..
158 158
     var $_mb_strlen = false;
@@ -173,13 +173,13 @@  discard block
 block discarded – undo
173 173
     function utf162utf8($utf16)
174 174
     {
175 175
         // oh please oh please oh please oh please oh please
176
-        if($this->_mb_convert_encoding) {
176
+        if ($this->_mb_convert_encoding) {
177 177
             return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
178 178
         }
179 179
 
180 180
         $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
181 181
 
182
-        switch(true) {
182
+        switch (true) {
183 183
             case ((0x7F & $bytes) == $bytes):
184 184
                 // this case should never be reached, because we are in ASCII range
185 185
                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
@@ -217,11 +217,11 @@  discard block
 block discarded – undo
217 217
     function utf82utf16($utf8)
218 218
     {
219 219
         // oh please oh please oh please oh please oh please
220
-        if($this->_mb_convert_encoding) {
220
+        if ($this->_mb_convert_encoding) {
221 221
             return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
222 222
         }
223 223
 
224
-        switch($this->strlen8($utf8)) {
224
+        switch ($this->strlen8($utf8)) {
225 225
             case 1:
226 226
                 // this case should never be reached, because we are in ASCII range
227 227
                 // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
@@ -357,7 +357,7 @@  discard block
 block discarded – undo
357 357
                         case (($ord_var_c & 0xE0) == 0xC0):
358 358
                             // characters U-00000080 - U-000007FF, mask 110XXXXX
359 359
                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
360
-                            if ($c+1 >= $strlen_var) {
360
+                            if ($c + 1 >= $strlen_var) {
361 361
                                 $c += 1;
362 362
                                 $ascii .= '?';
363 363
                                 break;
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
                             break;
371 371
 
372 372
                         case (($ord_var_c & 0xF0) == 0xE0):
373
-                            if ($c+2 >= $strlen_var) {
373
+                            if ($c + 2 >= $strlen_var) {
374 374
                                 $c += 2;
375 375
                                 $ascii .= '?';
376 376
                                 break;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
                             break;
387 387
 
388 388
                         case (($ord_var_c & 0xF8) == 0xF0):
389
-                            if ($c+3 >= $strlen_var) {
389
+                            if ($c + 3 >= $strlen_var) {
390 390
                                 $c += 3;
391 391
                                 $ascii .= '?';
392 392
                                 break;
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                         case (($ord_var_c & 0xFC) == 0xF8):
406 406
                             // characters U-00200000 - U-03FFFFFF, mask 111110XX
407 407
                             // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
408
-                            if ($c+4 >= $strlen_var) {
408
+                            if ($c + 4 >= $strlen_var) {
409 409
                                 $c += 4;
410 410
                                 $ascii .= '?';
411 411
                                 break;
@@ -421,7 +421,7 @@  discard block
 block discarded – undo
421 421
                             break;
422 422
 
423 423
                         case (($ord_var_c & 0xFE) == 0xFC):
424
-                        if ($c+5 >= $strlen_var) {
424
+                        if ($c + 5 >= $strlen_var) {
425 425
                                 $c += 5;
426 426
                                 $ascii .= '?';
427 427
                                 break;
@@ -467,25 +467,25 @@  discard block
 block discarded – undo
467 467
                                             array_keys($var),
468 468
                                             array_values($var));
469 469
 
470
-                    foreach($properties as $property) {
471
-                        if(Services_JSON::isError($property)) {
470
+                    foreach ($properties as $property) {
471
+                        if (Services_JSON::isError($property)) {
472 472
                             return $property;
473 473
                         }
474 474
                     }
475 475
 
476
-                    return '{' . join(',', $properties) . '}';
476
+                    return '{'.join(',', $properties).'}';
477 477
                 }
478 478
 
479 479
                 // treat it like a regular array
480 480
                 $elements = array_map(array($this, '_encode'), $var);
481 481
 
482
-                foreach($elements as $element) {
483
-                    if(Services_JSON::isError($element)) {
482
+                foreach ($elements as $element) {
483
+                    if (Services_JSON::isError($element)) {
484 484
                         return $element;
485 485
                     }
486 486
                 }
487 487
 
488
-                return '[' . join(',', $elements) . ']';
488
+                return '['.join(',', $elements).']';
489 489
 
490 490
             case 'object':
491 491
             
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
                             
505 505
                     }
506 506
                     
507
-                    return $this->_encode( $recode );
507
+                    return $this->_encode($recode);
508 508
                 } 
509 509
                 
510 510
                 $vars = get_object_vars($var);
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
                                         array_keys($vars),
514 514
                                         array_values($vars));
515 515
 
516
-                foreach($properties as $property) {
517
-                    if(Services_JSON::isError($property)) {
516
+                foreach ($properties as $property) {
517
+                    if (Services_JSON::isError($property)) {
518 518
                         return $property;
519 519
                     }
520 520
                 }
521 521
 
522
-                return '{' . join(',', $properties) . '}';
522
+                return '{'.join(',', $properties).'}';
523 523
 
524 524
             default:
525 525
                 return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
@@ -541,11 +541,11 @@  discard block
 block discarded – undo
541 541
     {
542 542
         $encoded_value = $this->_encode($value);
543 543
 
544
-        if(Services_JSON::isError($encoded_value)) {
544
+        if (Services_JSON::isError($encoded_value)) {
545 545
             return $encoded_value;
546 546
         }
547 547
 
548
-        return $this->_encode(strval($name)) . ':' . $encoded_value;
548
+        return $this->_encode(strval($name)).':'.$encoded_value;
549 549
     }
550 550
 
551 551
    /**
@@ -612,9 +612,9 @@  discard block
 block discarded – undo
612 612
                     // return (float)$str;
613 613
 
614 614
                     // Return float or int, as appropriate
615
-                    return ((float)$str == (integer)$str)
616
-                        ? (integer)$str
617
-                        : (float)$str;
615
+                    return ((float) $str == (integer) $str)
616
+                        ? (integer) $str
617
+                        : (float) $str;
618 618
 
619 619
                 } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
620 620
                     // STRINGS RETURNED IN UTF-8 FORMAT
@@ -885,12 +885,12 @@  discard block
 block discarded – undo
885 885
     * @param string 
886 886
     * @return integer length
887 887
     */
888
-    function strlen8( $str ) 
888
+    function strlen8($str) 
889 889
     {
890
-        if ( $this->_mb_strlen ) {
891
-            return mb_strlen( $str, "8bit" );
890
+        if ($this->_mb_strlen) {
891
+            return mb_strlen($str, "8bit");
892 892
         }
893
-        return strlen( $str );
893
+        return strlen($str);
894 894
     }
895 895
     
896 896
     /**
@@ -900,15 +900,15 @@  discard block
 block discarded – undo
900 900
     * @param integer length 
901 901
     * @return integer length
902 902
     */
903
-    function substr8( $string, $start, $length=false ) 
903
+    function substr8($string, $start, $length = false) 
904 904
     {
905
-        if ( $length === false ) {
906
-            $length = $this->strlen8( $string ) - $start;
905
+        if ($length === false) {
906
+            $length = $this->strlen8($string) - $start;
907 907
         }
908
-        if ( $this->_mb_substr ) {
909
-            return mb_substr( $string, $start, $length, "8bit" );
908
+        if ($this->_mb_substr) {
909
+            return mb_substr($string, $start, $length, "8bit");
910 910
         }
911
-        return substr( $string, $start, $length );
911
+        return substr($string, $start, $length);
912 912
     }
913 913
 
914 914
 }
@@ -940,8 +940,8 @@  discard block
 block discarded – undo
940 940
 	    /**
941 941
 	     * PHP5 constructor.
942 942
 	     */
943
-        function __construct( $message = 'unknown error', $code = null,
944
-                                     $mode = null, $options = null, $userinfo = null )
943
+        function __construct($message = 'unknown error', $code = null,
944
+                                     $mode = null, $options = null, $userinfo = null)
945 945
         {
946 946
 
947 947
         }
@@ -949,9 +949,9 @@  discard block
 block discarded – undo
949 949
 	    /**
950 950
 	     * PHP4 constructor.
951 951
 	     */
952
-		public function Services_JSON_Error( $message = 'unknown error', $code = null,
953
-	                                     $mode = null, $options = null, $userinfo = null ) {
954
-			self::__construct( $message, $code, $mode, $options, $userinfo );
952
+		public function Services_JSON_Error($message = 'unknown error', $code = null,
953
+	                                     $mode = null, $options = null, $userinfo = null) {
954
+			self::__construct($message, $code, $mode, $options, $userinfo);
955 955
 		}
956 956
     }
957 957
     
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -844,8 +844,9 @@
 block discarded – undo
844 844
                             array_pop($stk);
845 845
                             $c++;
846 846
 
847
-                            for ($i = $top['where']; $i <= $c; ++$i)
848
-                                $chrs = substr_replace($chrs, ' ', $i, 1);
847
+                            for ($i = $top['where']; $i <= $c; ++$i) {
848
+                                                            $chrs = substr_replace($chrs, ' ', $i, 1);
849
+                            }
849 850
 
850 851
                             //print("Found end of comment at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
851 852
 
Please login to merge, or discard this patch.
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
    /**
552 552
     * reduce a string by removing leading and trailing comments and whitespace
553 553
     *
554
-    * @param    $str    string      string value to strip of comments and whitespace
554
+    * @param    string $str    string      string value to strip of comments and whitespace
555 555
     *
556 556
     * @return   string  string value stripped of comments and whitespace
557 557
     * @access   private
@@ -898,7 +898,7 @@  discard block
 block discarded – undo
898 898
     * @param string 
899 899
     * @param integer start 
900 900
     * @param integer length 
901
-    * @return integer length
901
+    * @return string length
902 902
     */
903 903
     function substr8( $string, $start, $length=false ) 
904 904
     {
Please login to merge, or discard this patch.
Indentation   +726 added lines, -726 removed lines patch added patch discarded remove patch
@@ -2,59 +2,59 @@  discard block
 block discarded – undo
2 2
 if ( ! class_exists( 'Services_JSON' ) ) :
3 3
 /* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
4 4
 /**
5
- * Converts to and from JSON format.
6
- *
7
- * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
- * format. It is easy for humans to read and write. It is easy for machines
9
- * to parse and generate. It is based on a subset of the JavaScript
10
- * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
- * This feature can also be found in  Python. JSON is a text format that is
12
- * completely language independent but uses conventions that are familiar
13
- * to programmers of the C-family of languages, including C, C++, C#, Java,
14
- * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
- * ideal data-interchange language.
16
- *
17
- * This package provides a simple encoder and decoder for JSON notation. It
18
- * is intended for use with client-side Javascript applications that make
19
- * use of HTTPRequest to perform server communication functions - data can
20
- * be encoded into JSON notation for use in a client-side javascript, or
21
- * decoded from incoming Javascript requests. JSON format is native to
22
- * Javascript, and can be directly eval()'ed with no further parsing
23
- * overhead
24
- *
25
- * All strings should be in ASCII or UTF-8 format!
26
- *
27
- * LICENSE: Redistribution and use in source and binary forms, with or
28
- * without modification, are permitted provided that the following
29
- * conditions are met: Redistributions of source code must retain the
30
- * above copyright notice, this list of conditions and the following
31
- * disclaimer. Redistributions in binary form must reproduce the above
32
- * copyright notice, this list of conditions and the following disclaimer
33
- * in the documentation and/or other materials provided with the
34
- * distribution.
35
- *
36
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
- * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
- * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
- * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
- * DAMAGE.
47
- *
48
- * @category
49
- * @package     Services_JSON
50
- * @author      Michal Migurski <[email protected]>
51
- * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
52
- * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
- * @copyright   2005 Michal Migurski
54
- * @version     CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z alan_k $
55
- * @license     http://www.opensource.org/licenses/bsd-license.php
56
- * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
- */
5
+	 * Converts to and from JSON format.
6
+	 *
7
+	 * JSON (JavaScript Object Notation) is a lightweight data-interchange
8
+	 * format. It is easy for humans to read and write. It is easy for machines
9
+	 * to parse and generate. It is based on a subset of the JavaScript
10
+	 * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
11
+	 * This feature can also be found in  Python. JSON is a text format that is
12
+	 * completely language independent but uses conventions that are familiar
13
+	 * to programmers of the C-family of languages, including C, C++, C#, Java,
14
+	 * JavaScript, Perl, TCL, and many others. These properties make JSON an
15
+	 * ideal data-interchange language.
16
+	 *
17
+	 * This package provides a simple encoder and decoder for JSON notation. It
18
+	 * is intended for use with client-side Javascript applications that make
19
+	 * use of HTTPRequest to perform server communication functions - data can
20
+	 * be encoded into JSON notation for use in a client-side javascript, or
21
+	 * decoded from incoming Javascript requests. JSON format is native to
22
+	 * Javascript, and can be directly eval()'ed with no further parsing
23
+	 * overhead
24
+	 *
25
+	 * All strings should be in ASCII or UTF-8 format!
26
+	 *
27
+	 * LICENSE: Redistribution and use in source and binary forms, with or
28
+	 * without modification, are permitted provided that the following
29
+	 * conditions are met: Redistributions of source code must retain the
30
+	 * above copyright notice, this list of conditions and the following
31
+	 * disclaimer. Redistributions in binary form must reproduce the above
32
+	 * copyright notice, this list of conditions and the following disclaimer
33
+	 * in the documentation and/or other materials provided with the
34
+	 * distribution.
35
+	 *
36
+	 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
37
+	 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
38
+	 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
39
+	 * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
40
+	 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
41
+	 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
42
+	 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
43
+	 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
44
+	 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
45
+	 * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
46
+	 * DAMAGE.
47
+	 *
48
+	 * @category
49
+	 * @package     Services_JSON
50
+	 * @author      Michal Migurski <[email protected]>
51
+	 * @author      Matt Knapp <mdknapp[at]gmail[dot]com>
52
+	 * @author      Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
53
+	 * @copyright   2005 Michal Migurski
54
+	 * @version     CVS: $Id: JSON.php 305040 2010-11-02 23:19:03Z alan_k $
55
+	 * @license     http://www.opensource.org/licenses/bsd-license.php
56
+	 * @link        http://pear.php.net/pepr/pepr-proposal-show.php?id=198
57
+	 */
58 58
 
59 59
 /**
60 60
  * Marker constant for Services_JSON::decode(), used to flag stack state
@@ -140,13 +140,13 @@  discard block
 block discarded – undo
140 140
     *                                   strings or numbers, if you return an object, make sure it does
141 141
     *                                   not have a toJSON method, otherwise an error will occur.
142 142
     */
143
-    function __construct( $use = 0 )
144
-    {
145
-        $this->use = $use;
146
-        $this->_mb_strlen            = function_exists('mb_strlen');
147
-        $this->_mb_convert_encoding  = function_exists('mb_convert_encoding');
148
-        $this->_mb_substr            = function_exists('mb_substr');
149
-    }
143
+	function __construct( $use = 0 )
144
+	{
145
+		$this->use = $use;
146
+		$this->_mb_strlen            = function_exists('mb_strlen');
147
+		$this->_mb_convert_encoding  = function_exists('mb_convert_encoding');
148
+		$this->_mb_substr            = function_exists('mb_substr');
149
+	}
150 150
 
151 151
 	/**
152 152
 	 * PHP4 constructor.
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
 	public function Services_JSON( $use = 0 ) {
155 155
 		self::__construct( $use );
156 156
 	}
157
-    // private - cache the mbstring lookup results..
158
-    var $_mb_strlen = false;
159
-    var $_mb_substr = false;
160
-    var $_mb_convert_encoding = false;
157
+	// private - cache the mbstring lookup results..
158
+	var $_mb_strlen = false;
159
+	var $_mb_substr = false;
160
+	var $_mb_convert_encoding = false;
161 161
     
162 162
    /**
163 163
     * convert a string from one UTF-16 char to one UTF-8 char
@@ -170,38 +170,38 @@  discard block
 block discarded – undo
170 170
     * @return   string  UTF-8 character
171 171
     * @access   private
172 172
     */
173
-    function utf162utf8($utf16)
174
-    {
175
-        // oh please oh please oh please oh please oh please
176
-        if($this->_mb_convert_encoding) {
177
-            return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
178
-        }
179
-
180
-        $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
181
-
182
-        switch(true) {
183
-            case ((0x7F & $bytes) == $bytes):
184
-                // this case should never be reached, because we are in ASCII range
185
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
186
-                return chr(0x7F & $bytes);
187
-
188
-            case (0x07FF & $bytes) == $bytes:
189
-                // return a 2-byte UTF-8 character
190
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
191
-                return chr(0xC0 | (($bytes >> 6) & 0x1F))
192
-                     . chr(0x80 | ($bytes & 0x3F));
193
-
194
-            case (0xFFFF & $bytes) == $bytes:
195
-                // return a 3-byte UTF-8 character
196
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
197
-                return chr(0xE0 | (($bytes >> 12) & 0x0F))
198
-                     . chr(0x80 | (($bytes >> 6) & 0x3F))
199
-                     . chr(0x80 | ($bytes & 0x3F));
200
-        }
201
-
202
-        // ignoring UTF-32 for now, sorry
203
-        return '';
204
-    }
173
+	function utf162utf8($utf16)
174
+	{
175
+		// oh please oh please oh please oh please oh please
176
+		if($this->_mb_convert_encoding) {
177
+			return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
178
+		}
179
+
180
+		$bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
181
+
182
+		switch(true) {
183
+			case ((0x7F & $bytes) == $bytes):
184
+				// this case should never be reached, because we are in ASCII range
185
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
186
+				return chr(0x7F & $bytes);
187
+
188
+			case (0x07FF & $bytes) == $bytes:
189
+				// return a 2-byte UTF-8 character
190
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
191
+				return chr(0xC0 | (($bytes >> 6) & 0x1F))
192
+					 . chr(0x80 | ($bytes & 0x3F));
193
+
194
+			case (0xFFFF & $bytes) == $bytes:
195
+				// return a 3-byte UTF-8 character
196
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
197
+				return chr(0xE0 | (($bytes >> 12) & 0x0F))
198
+					 . chr(0x80 | (($bytes >> 6) & 0x3F))
199
+					 . chr(0x80 | ($bytes & 0x3F));
200
+		}
201
+
202
+		// ignoring UTF-32 for now, sorry
203
+		return '';
204
+	}
205 205
 
206 206
    /**
207 207
     * convert a string from one UTF-8 char to one UTF-16 char
@@ -214,38 +214,38 @@  discard block
 block discarded – undo
214 214
     * @return   string  UTF-16 character
215 215
     * @access   private
216 216
     */
217
-    function utf82utf16($utf8)
218
-    {
219
-        // oh please oh please oh please oh please oh please
220
-        if($this->_mb_convert_encoding) {
221
-            return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
222
-        }
223
-
224
-        switch($this->strlen8($utf8)) {
225
-            case 1:
226
-                // this case should never be reached, because we are in ASCII range
227
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
228
-                return $utf8;
229
-
230
-            case 2:
231
-                // return a UTF-16 character from a 2-byte UTF-8 char
232
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
233
-                return chr(0x07 & (ord($utf8{0}) >> 2))
234
-                     . chr((0xC0 & (ord($utf8{0}) << 6))
235
-                         | (0x3F & ord($utf8{1})));
236
-
237
-            case 3:
238
-                // return a UTF-16 character from a 3-byte UTF-8 char
239
-                // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
240
-                return chr((0xF0 & (ord($utf8{0}) << 4))
241
-                         | (0x0F & (ord($utf8{1}) >> 2)))
242
-                     . chr((0xC0 & (ord($utf8{1}) << 6))
243
-                         | (0x7F & ord($utf8{2})));
244
-        }
245
-
246
-        // ignoring UTF-32 for now, sorry
247
-        return '';
248
-    }
217
+	function utf82utf16($utf8)
218
+	{
219
+		// oh please oh please oh please oh please oh please
220
+		if($this->_mb_convert_encoding) {
221
+			return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
222
+		}
223
+
224
+		switch($this->strlen8($utf8)) {
225
+			case 1:
226
+				// this case should never be reached, because we are in ASCII range
227
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
228
+				return $utf8;
229
+
230
+			case 2:
231
+				// return a UTF-16 character from a 2-byte UTF-8 char
232
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
233
+				return chr(0x07 & (ord($utf8{0}) >> 2))
234
+					 . chr((0xC0 & (ord($utf8{0}) << 6))
235
+						 | (0x3F & ord($utf8{1})));
236
+
237
+			case 3:
238
+				// return a UTF-16 character from a 3-byte UTF-8 char
239
+				// see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
240
+				return chr((0xF0 & (ord($utf8{0}) << 4))
241
+						 | (0x0F & (ord($utf8{1}) >> 2)))
242
+					 . chr((0xC0 & (ord($utf8{1}) << 6))
243
+						 | (0x7F & ord($utf8{2})));
244
+		}
245
+
246
+		// ignoring UTF-32 for now, sorry
247
+		return '';
248
+	}
249 249
 
250 250
    /**
251 251
     * encodes an arbitrary variable into JSON format (and sends JSON Header)
@@ -258,192 +258,192 @@  discard block
 block discarded – undo
258 258
     * @return   mixed   JSON string representation of input var or an error if a problem occurs
259 259
     * @access   public
260 260
     */
261
-    function encode($var)
262
-    {
263
-        header('Content-type: application/json');
264
-        return $this->encodeUnsafe($var);
265
-    }
266
-    /**
267
-    * encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
268
-    *
269
-    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
270
-    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
271
-    *                           if var is a strng, note that encode() always expects it
272
-    *                           to be in ASCII or UTF-8 format!
273
-    *
274
-    * @return   mixed   JSON string representation of input var or an error if a problem occurs
275
-    * @access   public
276
-    */
277
-    function encodeUnsafe($var)
278
-    {
279
-        // see bug #16908 - regarding numeric locale printing
280
-        $lc = setlocale(LC_NUMERIC, 0);
281
-        setlocale(LC_NUMERIC, 'C');
282
-        $ret = $this->_encode($var);
283
-        setlocale(LC_NUMERIC, $lc);
284
-        return $ret;
261
+	function encode($var)
262
+	{
263
+		header('Content-type: application/json');
264
+		return $this->encodeUnsafe($var);
265
+	}
266
+	/**
267
+	 * encodes an arbitrary variable into JSON format without JSON Header - warning - may allow XSS!!!!)
268
+	 *
269
+	 * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
270
+	 *                           see argument 1 to Services_JSON() above for array-parsing behavior.
271
+	 *                           if var is a strng, note that encode() always expects it
272
+	 *                           to be in ASCII or UTF-8 format!
273
+	 *
274
+	 * @return   mixed   JSON string representation of input var or an error if a problem occurs
275
+	 * @access   public
276
+	 */
277
+	function encodeUnsafe($var)
278
+	{
279
+		// see bug #16908 - regarding numeric locale printing
280
+		$lc = setlocale(LC_NUMERIC, 0);
281
+		setlocale(LC_NUMERIC, 'C');
282
+		$ret = $this->_encode($var);
283
+		setlocale(LC_NUMERIC, $lc);
284
+		return $ret;
285 285
         
286
-    }
287
-    /**
288
-    * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format 
289
-    *
290
-    * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
291
-    *                           see argument 1 to Services_JSON() above for array-parsing behavior.
292
-    *                           if var is a strng, note that encode() always expects it
293
-    *                           to be in ASCII or UTF-8 format!
294
-    *
295
-    * @return   mixed   JSON string representation of input var or an error if a problem occurs
296
-    * @access   public
297
-    */
298
-    function _encode($var) 
299
-    {
286
+	}
287
+	/**
288
+	 * PRIVATE CODE that does the work of encodes an arbitrary variable into JSON format 
289
+	 *
290
+	 * @param    mixed   $var    any number, boolean, string, array, or object to be encoded.
291
+	 *                           see argument 1 to Services_JSON() above for array-parsing behavior.
292
+	 *                           if var is a strng, note that encode() always expects it
293
+	 *                           to be in ASCII or UTF-8 format!
294
+	 *
295
+	 * @return   mixed   JSON string representation of input var or an error if a problem occurs
296
+	 * @access   public
297
+	 */
298
+	function _encode($var) 
299
+	{
300 300
          
301
-        switch (gettype($var)) {
302
-            case 'boolean':
303
-                return $var ? 'true' : 'false';
301
+		switch (gettype($var)) {
302
+			case 'boolean':
303
+				return $var ? 'true' : 'false';
304 304
 
305
-            case 'NULL':
306
-                return 'null';
305
+			case 'NULL':
306
+				return 'null';
307 307
 
308
-            case 'integer':
309
-                return (int) $var;
308
+			case 'integer':
309
+				return (int) $var;
310 310
 
311
-            case 'double':
312
-            case 'float':
313
-                return  (float) $var;
311
+			case 'double':
312
+			case 'float':
313
+				return  (float) $var;
314 314
 
315
-            case 'string':
316
-                // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
317
-                $ascii = '';
318
-                $strlen_var = $this->strlen8($var);
315
+			case 'string':
316
+				// STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
317
+				$ascii = '';
318
+				$strlen_var = $this->strlen8($var);
319 319
 
320
-               /*
320
+			   /*
321 321
                 * Iterate over every character in the string,
322 322
                 * escaping with a slash or encoding to UTF-8 where necessary
323 323
                 */
324
-                for ($c = 0; $c < $strlen_var; ++$c) {
325
-
326
-                    $ord_var_c = ord($var{$c});
327
-
328
-                    switch (true) {
329
-                        case $ord_var_c == 0x08:
330
-                            $ascii .= '\b';
331
-                            break;
332
-                        case $ord_var_c == 0x09:
333
-                            $ascii .= '\t';
334
-                            break;
335
-                        case $ord_var_c == 0x0A:
336
-                            $ascii .= '\n';
337
-                            break;
338
-                        case $ord_var_c == 0x0C:
339
-                            $ascii .= '\f';
340
-                            break;
341
-                        case $ord_var_c == 0x0D:
342
-                            $ascii .= '\r';
343
-                            break;
344
-
345
-                        case $ord_var_c == 0x22:
346
-                        case $ord_var_c == 0x2F:
347
-                        case $ord_var_c == 0x5C:
348
-                            // double quote, slash, slosh
349
-                            $ascii .= '\\'.$var{$c};
350
-                            break;
351
-
352
-                        case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
353
-                            // characters U-00000000 - U-0000007F (same as ASCII)
354
-                            $ascii .= $var{$c};
355
-                            break;
356
-
357
-                        case (($ord_var_c & 0xE0) == 0xC0):
358
-                            // characters U-00000080 - U-000007FF, mask 110XXXXX
359
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
360
-                            if ($c+1 >= $strlen_var) {
361
-                                $c += 1;
362
-                                $ascii .= '?';
363
-                                break;
364
-                            }
324
+				for ($c = 0; $c < $strlen_var; ++$c) {
325
+
326
+					$ord_var_c = ord($var{$c});
327
+
328
+					switch (true) {
329
+						case $ord_var_c == 0x08:
330
+							$ascii .= '\b';
331
+							break;
332
+						case $ord_var_c == 0x09:
333
+							$ascii .= '\t';
334
+							break;
335
+						case $ord_var_c == 0x0A:
336
+							$ascii .= '\n';
337
+							break;
338
+						case $ord_var_c == 0x0C:
339
+							$ascii .= '\f';
340
+							break;
341
+						case $ord_var_c == 0x0D:
342
+							$ascii .= '\r';
343
+							break;
344
+
345
+						case $ord_var_c == 0x22:
346
+						case $ord_var_c == 0x2F:
347
+						case $ord_var_c == 0x5C:
348
+							// double quote, slash, slosh
349
+							$ascii .= '\\'.$var{$c};
350
+							break;
351
+
352
+						case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
353
+							// characters U-00000000 - U-0000007F (same as ASCII)
354
+							$ascii .= $var{$c};
355
+							break;
356
+
357
+						case (($ord_var_c & 0xE0) == 0xC0):
358
+							// characters U-00000080 - U-000007FF, mask 110XXXXX
359
+							// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
360
+							if ($c+1 >= $strlen_var) {
361
+								$c += 1;
362
+								$ascii .= '?';
363
+								break;
364
+							}
365 365
                             
366
-                            $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
367
-                            $c += 1;
368
-                            $utf16 = $this->utf82utf16($char);
369
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
370
-                            break;
371
-
372
-                        case (($ord_var_c & 0xF0) == 0xE0):
373
-                            if ($c+2 >= $strlen_var) {
374
-                                $c += 2;
375
-                                $ascii .= '?';
376
-                                break;
377
-                            }
378
-                            // characters U-00000800 - U-0000FFFF, mask 1110XXXX
379
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
380
-                            $char = pack('C*', $ord_var_c,
381
-                                         @ord($var{$c + 1}),
382
-                                         @ord($var{$c + 2}));
383
-                            $c += 2;
384
-                            $utf16 = $this->utf82utf16($char);
385
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
386
-                            break;
387
-
388
-                        case (($ord_var_c & 0xF8) == 0xF0):
389
-                            if ($c+3 >= $strlen_var) {
390
-                                $c += 3;
391
-                                $ascii .= '?';
392
-                                break;
393
-                            }
394
-                            // characters U-00010000 - U-001FFFFF, mask 11110XXX
395
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
396
-                            $char = pack('C*', $ord_var_c,
397
-                                         ord($var{$c + 1}),
398
-                                         ord($var{$c + 2}),
399
-                                         ord($var{$c + 3}));
400
-                            $c += 3;
401
-                            $utf16 = $this->utf82utf16($char);
402
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
403
-                            break;
404
-
405
-                        case (($ord_var_c & 0xFC) == 0xF8):
406
-                            // characters U-00200000 - U-03FFFFFF, mask 111110XX
407
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
408
-                            if ($c+4 >= $strlen_var) {
409
-                                $c += 4;
410
-                                $ascii .= '?';
411
-                                break;
412
-                            }
413
-                            $char = pack('C*', $ord_var_c,
414
-                                         ord($var{$c + 1}),
415
-                                         ord($var{$c + 2}),
416
-                                         ord($var{$c + 3}),
417
-                                         ord($var{$c + 4}));
418
-                            $c += 4;
419
-                            $utf16 = $this->utf82utf16($char);
420
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
421
-                            break;
422
-
423
-                        case (($ord_var_c & 0xFE) == 0xFC):
424
-                        if ($c+5 >= $strlen_var) {
425
-                                $c += 5;
426
-                                $ascii .= '?';
427
-                                break;
428
-                            }
429
-                            // characters U-04000000 - U-7FFFFFFF, mask 1111110X
430
-                            // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
431
-                            $char = pack('C*', $ord_var_c,
432
-                                         ord($var{$c + 1}),
433
-                                         ord($var{$c + 2}),
434
-                                         ord($var{$c + 3}),
435
-                                         ord($var{$c + 4}),
436
-                                         ord($var{$c + 5}));
437
-                            $c += 5;
438
-                            $utf16 = $this->utf82utf16($char);
439
-                            $ascii .= sprintf('\u%04s', bin2hex($utf16));
440
-                            break;
441
-                    }
442
-                }
443
-                return  '"'.$ascii.'"';
444
-
445
-            case 'array':
446
-               /*
366
+							$char = pack('C*', $ord_var_c, ord($var{$c + 1}));
367
+							$c += 1;
368
+							$utf16 = $this->utf82utf16($char);
369
+							$ascii .= sprintf('\u%04s', bin2hex($utf16));
370
+							break;
371
+
372
+						case (($ord_var_c & 0xF0) == 0xE0):
373
+							if ($c+2 >= $strlen_var) {
374
+								$c += 2;
375
+								$ascii .= '?';
376
+								break;
377
+							}
378
+							// characters U-00000800 - U-0000FFFF, mask 1110XXXX
379
+							// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
380
+							$char = pack('C*', $ord_var_c,
381
+										 @ord($var{$c + 1}),
382
+										 @ord($var{$c + 2}));
383
+							$c += 2;
384
+							$utf16 = $this->utf82utf16($char);
385
+							$ascii .= sprintf('\u%04s', bin2hex($utf16));
386
+							break;
387
+
388
+						case (($ord_var_c & 0xF8) == 0xF0):
389
+							if ($c+3 >= $strlen_var) {
390
+								$c += 3;
391
+								$ascii .= '?';
392
+								break;
393
+							}
394
+							// characters U-00010000 - U-001FFFFF, mask 11110XXX
395
+							// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
396
+							$char = pack('C*', $ord_var_c,
397
+										 ord($var{$c + 1}),
398
+										 ord($var{$c + 2}),
399
+										 ord($var{$c + 3}));
400
+							$c += 3;
401
+							$utf16 = $this->utf82utf16($char);
402
+							$ascii .= sprintf('\u%04s', bin2hex($utf16));
403
+							break;
404
+
405
+						case (($ord_var_c & 0xFC) == 0xF8):
406
+							// characters U-00200000 - U-03FFFFFF, mask 111110XX
407
+							// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
408
+							if ($c+4 >= $strlen_var) {
409
+								$c += 4;
410
+								$ascii .= '?';
411
+								break;
412
+							}
413
+							$char = pack('C*', $ord_var_c,
414
+										 ord($var{$c + 1}),
415
+										 ord($var{$c + 2}),
416
+										 ord($var{$c + 3}),
417
+										 ord($var{$c + 4}));
418
+							$c += 4;
419
+							$utf16 = $this->utf82utf16($char);
420
+							$ascii .= sprintf('\u%04s', bin2hex($utf16));
421
+							break;
422
+
423
+						case (($ord_var_c & 0xFE) == 0xFC):
424
+						if ($c+5 >= $strlen_var) {
425
+								$c += 5;
426
+								$ascii .= '?';
427
+								break;
428
+							}
429
+							// characters U-04000000 - U-7FFFFFFF, mask 1111110X
430
+							// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
431
+							$char = pack('C*', $ord_var_c,
432
+										 ord($var{$c + 1}),
433
+										 ord($var{$c + 2}),
434
+										 ord($var{$c + 3}),
435
+										 ord($var{$c + 4}),
436
+										 ord($var{$c + 5}));
437
+							$c += 5;
438
+							$utf16 = $this->utf82utf16($char);
439
+							$ascii .= sprintf('\u%04s', bin2hex($utf16));
440
+							break;
441
+					}
442
+				}
443
+				return  '"'.$ascii.'"';
444
+
445
+			case 'array':
446
+			   /*
447 447
                 * As per JSON spec if any array key is not an integer
448 448
                 * we must treat the whole array as an object. We
449 449
                 * also try to catch a sparsely populated associative
@@ -461,72 +461,72 @@  discard block
 block discarded – undo
461 461
                 * bracket notation.
462 462
                 */
463 463
 
464
-                // treat as a JSON object
465
-                if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
466
-                    $properties = array_map(array($this, 'name_value'),
467
-                                            array_keys($var),
468
-                                            array_values($var));
464
+				// treat as a JSON object
465
+				if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
466
+					$properties = array_map(array($this, 'name_value'),
467
+											array_keys($var),
468
+											array_values($var));
469 469
 
470
-                    foreach($properties as $property) {
471
-                        if(Services_JSON::isError($property)) {
472
-                            return $property;
473
-                        }
474
-                    }
470
+					foreach($properties as $property) {
471
+						if(Services_JSON::isError($property)) {
472
+							return $property;
473
+						}
474
+					}
475 475
 
476
-                    return '{' . join(',', $properties) . '}';
477
-                }
476
+					return '{' . join(',', $properties) . '}';
477
+				}
478 478
 
479
-                // treat it like a regular array
480
-                $elements = array_map(array($this, '_encode'), $var);
479
+				// treat it like a regular array
480
+				$elements = array_map(array($this, '_encode'), $var);
481 481
 
482
-                foreach($elements as $element) {
483
-                    if(Services_JSON::isError($element)) {
484
-                        return $element;
485
-                    }
486
-                }
482
+				foreach($elements as $element) {
483
+					if(Services_JSON::isError($element)) {
484
+						return $element;
485
+					}
486
+				}
487 487
 
488
-                return '[' . join(',', $elements) . ']';
488
+				return '[' . join(',', $elements) . ']';
489 489
 
490
-            case 'object':
490
+			case 'object':
491 491
             
492
-                // support toJSON methods.
493
-                if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
494
-                    // this may end up allowing unlimited recursion
495
-                    // so we check the return value to make sure it's not got the same method.
496
-                    $recode = $var->toJSON();
492
+				// support toJSON methods.
493
+				if (($this->use & SERVICES_JSON_USE_TO_JSON) && method_exists($var, 'toJSON')) {
494
+					// this may end up allowing unlimited recursion
495
+					// so we check the return value to make sure it's not got the same method.
496
+					$recode = $var->toJSON();
497 497
                     
498
-                    if (method_exists($recode, 'toJSON')) {
498
+					if (method_exists($recode, 'toJSON')) {
499 499
                         
500
-                        return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
501
-                        ? 'null'
502
-                        : new Services_JSON_Error(get_class($var).
503
-                            " toJSON returned an object with a toJSON method.");
500
+						return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
501
+						? 'null'
502
+						: new Services_JSON_Error(get_class($var).
503
+							" toJSON returned an object with a toJSON method.");
504 504
                             
505
-                    }
505
+					}
506 506
                     
507
-                    return $this->_encode( $recode );
508
-                } 
507
+					return $this->_encode( $recode );
508
+				} 
509 509
                 
510
-                $vars = get_object_vars($var);
510
+				$vars = get_object_vars($var);
511 511
                 
512
-                $properties = array_map(array($this, 'name_value'),
513
-                                        array_keys($vars),
514
-                                        array_values($vars));
515
-
516
-                foreach($properties as $property) {
517
-                    if(Services_JSON::isError($property)) {
518
-                        return $property;
519
-                    }
520
-                }
521
-
522
-                return '{' . join(',', $properties) . '}';
523
-
524
-            default:
525
-                return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
526
-                    ? 'null'
527
-                    : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
528
-        }
529
-    }
512
+				$properties = array_map(array($this, 'name_value'),
513
+										array_keys($vars),
514
+										array_values($vars));
515
+
516
+				foreach($properties as $property) {
517
+					if(Services_JSON::isError($property)) {
518
+						return $property;
519
+					}
520
+				}
521
+
522
+				return '{' . join(',', $properties) . '}';
523
+
524
+			default:
525
+				return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
526
+					? 'null'
527
+					: new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
528
+		}
529
+	}
530 530
 
531 531
    /**
532 532
     * array-walking function for use in generating JSON-formatted name-value pairs
@@ -537,16 +537,16 @@  discard block
 block discarded – undo
537 537
     * @return   string  JSON-formatted name-value pair, like '"name":value'
538 538
     * @access   private
539 539
     */
540
-    function name_value($name, $value)
541
-    {
542
-        $encoded_value = $this->_encode($value);
540
+	function name_value($name, $value)
541
+	{
542
+		$encoded_value = $this->_encode($value);
543 543
 
544
-        if(Services_JSON::isError($encoded_value)) {
545
-            return $encoded_value;
546
-        }
544
+		if(Services_JSON::isError($encoded_value)) {
545
+			return $encoded_value;
546
+		}
547 547
 
548
-        return $this->_encode(strval($name)) . ':' . $encoded_value;
549
-    }
548
+		return $this->_encode(strval($name)) . ':' . $encoded_value;
549
+	}
550 550
 
551 551
    /**
552 552
     * reduce a string by removing leading and trailing comments and whitespace
@@ -556,24 +556,24 @@  discard block
 block discarded – undo
556 556
     * @return   string  string value stripped of comments and whitespace
557 557
     * @access   private
558 558
     */
559
-    function reduce_string($str)
560
-    {
561
-        $str = preg_replace(array(
559
+	function reduce_string($str)
560
+	{
561
+		$str = preg_replace(array(
562 562
 
563
-                // eliminate single line comments in '// ...' form
564
-                '#^\s*//(.+)$#m',
563
+				// eliminate single line comments in '// ...' form
564
+				'#^\s*//(.+)$#m',
565 565
 
566
-                // eliminate multi-line comments in '/* ... */' form, at start of string
567
-                '#^\s*/\*(.+)\*/#Us',
566
+				// eliminate multi-line comments in '/* ... */' form, at start of string
567
+				'#^\s*/\*(.+)\*/#Us',
568 568
 
569
-                // eliminate multi-line comments in '/* ... */' form, at end of string
570
-                '#/\*(.+)\*/\s*$#Us'
569
+				// eliminate multi-line comments in '/* ... */' form, at end of string
570
+				'#/\*(.+)\*/\s*$#Us'
571 571
 
572
-            ), '', $str);
572
+			), '', $str);
573 573
 
574
-        // eliminate extraneous space
575
-        return trim($str);
576
-    }
574
+		// eliminate extraneous space
575
+		return trim($str);
576
+	}
577 577
 
578 578
    /**
579 579
     * decodes a JSON string into appropriate variable
@@ -587,373 +587,373 @@  discard block
 block discarded – undo
587 587
     *                   in ASCII or UTF-8 format!
588 588
     * @access   public
589 589
     */
590
-    function decode($str)
591
-    {
592
-        $str = $this->reduce_string($str);
593
-
594
-        switch (strtolower($str)) {
595
-            case 'true':
596
-                return true;
597
-
598
-            case 'false':
599
-                return false;
600
-
601
-            case 'null':
602
-                return null;
603
-
604
-            default:
605
-                $m = array();
606
-
607
-                if (is_numeric($str)) {
608
-                    // Lookie-loo, it's a number
609
-
610
-                    // This would work on its own, but I'm trying to be
611
-                    // good about returning integers where appropriate:
612
-                    // return (float)$str;
613
-
614
-                    // Return float or int, as appropriate
615
-                    return ((float)$str == (integer)$str)
616
-                        ? (integer)$str
617
-                        : (float)$str;
618
-
619
-                } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
620
-                    // STRINGS RETURNED IN UTF-8 FORMAT
621
-                    $delim = $this->substr8($str, 0, 1);
622
-                    $chrs = $this->substr8($str, 1, -1);
623
-                    $utf8 = '';
624
-                    $strlen_chrs = $this->strlen8($chrs);
625
-
626
-                    for ($c = 0; $c < $strlen_chrs; ++$c) {
627
-
628
-                        $substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
629
-                        $ord_chrs_c = ord($chrs{$c});
630
-
631
-                        switch (true) {
632
-                            case $substr_chrs_c_2 == '\b':
633
-                                $utf8 .= chr(0x08);
634
-                                ++$c;
635
-                                break;
636
-                            case $substr_chrs_c_2 == '\t':
637
-                                $utf8 .= chr(0x09);
638
-                                ++$c;
639
-                                break;
640
-                            case $substr_chrs_c_2 == '\n':
641
-                                $utf8 .= chr(0x0A);
642
-                                ++$c;
643
-                                break;
644
-                            case $substr_chrs_c_2 == '\f':
645
-                                $utf8 .= chr(0x0C);
646
-                                ++$c;
647
-                                break;
648
-                            case $substr_chrs_c_2 == '\r':
649
-                                $utf8 .= chr(0x0D);
650
-                                ++$c;
651
-                                break;
652
-
653
-                            case $substr_chrs_c_2 == '\\"':
654
-                            case $substr_chrs_c_2 == '\\\'':
655
-                            case $substr_chrs_c_2 == '\\\\':
656
-                            case $substr_chrs_c_2 == '\\/':
657
-                                if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
658
-                                   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
659
-                                    $utf8 .= $chrs{++$c};
660
-                                }
661
-                                break;
662
-
663
-                            case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)):
664
-                                // single, escaped unicode character
665
-                                $utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2)))
666
-                                       . chr(hexdec($this->substr8($chrs, ($c + 4), 2)));
667
-                                $utf8 .= $this->utf162utf8($utf16);
668
-                                $c += 5;
669
-                                break;
670
-
671
-                            case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
672
-                                $utf8 .= $chrs{$c};
673
-                                break;
674
-
675
-                            case ($ord_chrs_c & 0xE0) == 0xC0:
676
-                                // characters U-00000080 - U-000007FF, mask 110XXXXX
677
-                                //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
678
-                                $utf8 .= $this->substr8($chrs, $c, 2);
679
-                                ++$c;
680
-                                break;
681
-
682
-                            case ($ord_chrs_c & 0xF0) == 0xE0:
683
-                                // characters U-00000800 - U-0000FFFF, mask 1110XXXX
684
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
685
-                                $utf8 .= $this->substr8($chrs, $c, 3);
686
-                                $c += 2;
687
-                                break;
688
-
689
-                            case ($ord_chrs_c & 0xF8) == 0xF0:
690
-                                // characters U-00010000 - U-001FFFFF, mask 11110XXX
691
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
692
-                                $utf8 .= $this->substr8($chrs, $c, 4);
693
-                                $c += 3;
694
-                                break;
695
-
696
-                            case ($ord_chrs_c & 0xFC) == 0xF8:
697
-                                // characters U-00200000 - U-03FFFFFF, mask 111110XX
698
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
699
-                                $utf8 .= $this->substr8($chrs, $c, 5);
700
-                                $c += 4;
701
-                                break;
702
-
703
-                            case ($ord_chrs_c & 0xFE) == 0xFC:
704
-                                // characters U-04000000 - U-7FFFFFFF, mask 1111110X
705
-                                // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
706
-                                $utf8 .= $this->substr8($chrs, $c, 6);
707
-                                $c += 5;
708
-                                break;
709
-
710
-                        }
711
-
712
-                    }
713
-
714
-                    return $utf8;
715
-
716
-                } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
717
-                    // array, or object notation
718
-
719
-                    if ($str{0} == '[') {
720
-                        $stk = array(SERVICES_JSON_IN_ARR);
721
-                        $arr = array();
722
-                    } else {
723
-                        if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
724
-                            $stk = array(SERVICES_JSON_IN_OBJ);
725
-                            $obj = array();
726
-                        } else {
727
-                            $stk = array(SERVICES_JSON_IN_OBJ);
728
-                            $obj = new stdClass();
729
-                        }
730
-                    }
731
-
732
-                    array_push($stk, array('what'  => SERVICES_JSON_SLICE,
733
-                                           'where' => 0,
734
-                                           'delim' => false));
735
-
736
-                    $chrs = $this->substr8($str, 1, -1);
737
-                    $chrs = $this->reduce_string($chrs);
738
-
739
-                    if ($chrs == '') {
740
-                        if (reset($stk) == SERVICES_JSON_IN_ARR) {
741
-                            return $arr;
742
-
743
-                        } else {
744
-                            return $obj;
745
-
746
-                        }
747
-                    }
748
-
749
-                    //print("\nparsing {$chrs}\n");
750
-
751
-                    $strlen_chrs = $this->strlen8($chrs);
752
-
753
-                    for ($c = 0; $c <= $strlen_chrs; ++$c) {
754
-
755
-                        $top = end($stk);
756
-                        $substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
757
-
758
-                        if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
759
-                            // found a comma that is not inside a string, array, etc.,
760
-                            // OR we've reached the end of the character list
761
-                            $slice = $this->substr8($chrs, $top['where'], ($c - $top['where']));
762
-                            array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
763
-                            //print("Found split at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
764
-
765
-                            if (reset($stk) == SERVICES_JSON_IN_ARR) {
766
-                                // we are in an array, so just push an element onto the stack
767
-                                array_push($arr, $this->decode($slice));
768
-
769
-                            } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
770
-                                // we are in an object, so figure
771
-                                // out the property name and set an
772
-                                // element in an associative array,
773
-                                // for now
774
-                                $parts = array();
590
+	function decode($str)
591
+	{
592
+		$str = $this->reduce_string($str);
593
+
594
+		switch (strtolower($str)) {
595
+			case 'true':
596
+				return true;
597
+
598
+			case 'false':
599
+				return false;
600
+
601
+			case 'null':
602
+				return null;
603
+
604
+			default:
605
+				$m = array();
606
+
607
+				if (is_numeric($str)) {
608
+					// Lookie-loo, it's a number
609
+
610
+					// This would work on its own, but I'm trying to be
611
+					// good about returning integers where appropriate:
612
+					// return (float)$str;
613
+
614
+					// Return float or int, as appropriate
615
+					return ((float)$str == (integer)$str)
616
+						? (integer)$str
617
+						: (float)$str;
618
+
619
+				} elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
620
+					// STRINGS RETURNED IN UTF-8 FORMAT
621
+					$delim = $this->substr8($str, 0, 1);
622
+					$chrs = $this->substr8($str, 1, -1);
623
+					$utf8 = '';
624
+					$strlen_chrs = $this->strlen8($chrs);
625
+
626
+					for ($c = 0; $c < $strlen_chrs; ++$c) {
627
+
628
+						$substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
629
+						$ord_chrs_c = ord($chrs{$c});
630
+
631
+						switch (true) {
632
+							case $substr_chrs_c_2 == '\b':
633
+								$utf8 .= chr(0x08);
634
+								++$c;
635
+								break;
636
+							case $substr_chrs_c_2 == '\t':
637
+								$utf8 .= chr(0x09);
638
+								++$c;
639
+								break;
640
+							case $substr_chrs_c_2 == '\n':
641
+								$utf8 .= chr(0x0A);
642
+								++$c;
643
+								break;
644
+							case $substr_chrs_c_2 == '\f':
645
+								$utf8 .= chr(0x0C);
646
+								++$c;
647
+								break;
648
+							case $substr_chrs_c_2 == '\r':
649
+								$utf8 .= chr(0x0D);
650
+								++$c;
651
+								break;
652
+
653
+							case $substr_chrs_c_2 == '\\"':
654
+							case $substr_chrs_c_2 == '\\\'':
655
+							case $substr_chrs_c_2 == '\\\\':
656
+							case $substr_chrs_c_2 == '\\/':
657
+								if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
658
+								   ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
659
+									$utf8 .= $chrs{++$c};
660
+								}
661
+								break;
662
+
663
+							case preg_match('/\\\u[0-9A-F]{4}/i', $this->substr8($chrs, $c, 6)):
664
+								// single, escaped unicode character
665
+								$utf16 = chr(hexdec($this->substr8($chrs, ($c + 2), 2)))
666
+									   . chr(hexdec($this->substr8($chrs, ($c + 4), 2)));
667
+								$utf8 .= $this->utf162utf8($utf16);
668
+								$c += 5;
669
+								break;
670
+
671
+							case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
672
+								$utf8 .= $chrs{$c};
673
+								break;
674
+
675
+							case ($ord_chrs_c & 0xE0) == 0xC0:
676
+								// characters U-00000080 - U-000007FF, mask 110XXXXX
677
+								//see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
678
+								$utf8 .= $this->substr8($chrs, $c, 2);
679
+								++$c;
680
+								break;
681
+
682
+							case ($ord_chrs_c & 0xF0) == 0xE0:
683
+								// characters U-00000800 - U-0000FFFF, mask 1110XXXX
684
+								// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
685
+								$utf8 .= $this->substr8($chrs, $c, 3);
686
+								$c += 2;
687
+								break;
688
+
689
+							case ($ord_chrs_c & 0xF8) == 0xF0:
690
+								// characters U-00010000 - U-001FFFFF, mask 11110XXX
691
+								// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
692
+								$utf8 .= $this->substr8($chrs, $c, 4);
693
+								$c += 3;
694
+								break;
695
+
696
+							case ($ord_chrs_c & 0xFC) == 0xF8:
697
+								// characters U-00200000 - U-03FFFFFF, mask 111110XX
698
+								// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
699
+								$utf8 .= $this->substr8($chrs, $c, 5);
700
+								$c += 4;
701
+								break;
702
+
703
+							case ($ord_chrs_c & 0xFE) == 0xFC:
704
+								// characters U-04000000 - U-7FFFFFFF, mask 1111110X
705
+								// see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
706
+								$utf8 .= $this->substr8($chrs, $c, 6);
707
+								$c += 5;
708
+								break;
709
+
710
+						}
711
+
712
+					}
713
+
714
+					return $utf8;
715
+
716
+				} elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
717
+					// array, or object notation
718
+
719
+					if ($str{0} == '[') {
720
+						$stk = array(SERVICES_JSON_IN_ARR);
721
+						$arr = array();
722
+					} else {
723
+						if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
724
+							$stk = array(SERVICES_JSON_IN_OBJ);
725
+							$obj = array();
726
+						} else {
727
+							$stk = array(SERVICES_JSON_IN_OBJ);
728
+							$obj = new stdClass();
729
+						}
730
+					}
731
+
732
+					array_push($stk, array('what'  => SERVICES_JSON_SLICE,
733
+										   'where' => 0,
734
+										   'delim' => false));
735
+
736
+					$chrs = $this->substr8($str, 1, -1);
737
+					$chrs = $this->reduce_string($chrs);
738
+
739
+					if ($chrs == '') {
740
+						if (reset($stk) == SERVICES_JSON_IN_ARR) {
741
+							return $arr;
742
+
743
+						} else {
744
+							return $obj;
745
+
746
+						}
747
+					}
748
+
749
+					//print("\nparsing {$chrs}\n");
750
+
751
+					$strlen_chrs = $this->strlen8($chrs);
752
+
753
+					for ($c = 0; $c <= $strlen_chrs; ++$c) {
754
+
755
+						$top = end($stk);
756
+						$substr_chrs_c_2 = $this->substr8($chrs, $c, 2);
757
+
758
+						if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
759
+							// found a comma that is not inside a string, array, etc.,
760
+							// OR we've reached the end of the character list
761
+							$slice = $this->substr8($chrs, $top['where'], ($c - $top['where']));
762
+							array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
763
+							//print("Found split at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
764
+
765
+							if (reset($stk) == SERVICES_JSON_IN_ARR) {
766
+								// we are in an array, so just push an element onto the stack
767
+								array_push($arr, $this->decode($slice));
768
+
769
+							} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
770
+								// we are in an object, so figure
771
+								// out the property name and set an
772
+								// element in an associative array,
773
+								// for now
774
+								$parts = array();
775 775
                                 
776
-                               if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
777
- 	                              // "name":value pair
778
-                                    $key = $this->decode($parts[1]);
779
-                                    $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
780
-                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
781
-                                        $obj[$key] = $val;
782
-                                    } else {
783
-                                        $obj->$key = $val;
784
-                                    }
785
-                                } elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) {
786
-                                    // name:value pair, where name is unquoted
787
-                                    $key = $parts[1];
788
-                                    $val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
789
-
790
-                                    if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
791
-                                        $obj[$key] = $val;
792
-                                    } else {
793
-                                        $obj->$key = $val;
794
-                                    }
795
-                                }
796
-
797
-                            }
798
-
799
-                        } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
800
-                            // found a quote, and we are not inside a string
801
-                            array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
802
-                            //print("Found start of string at {$c}\n");
803
-
804
-                        } elseif (($chrs{$c} == $top['delim']) &&
805
-                                 ($top['what'] == SERVICES_JSON_IN_STR) &&
806
-                                 (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
807
-                            // found a quote, we're in a string, and it's not escaped
808
-                            // we know that it's not escaped becase there is _not_ an
809
-                            // odd number of backslashes at the end of the string so far
810
-                            array_pop($stk);
811
-                            //print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
812
-
813
-                        } elseif (($chrs{$c} == '[') &&
814
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
815
-                            // found a left-bracket, and we are in an array, object, or slice
816
-                            array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
817
-                            //print("Found start of array at {$c}\n");
818
-
819
-                        } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
820
-                            // found a right-bracket, and we're in an array
821
-                            array_pop($stk);
822
-                            //print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
823
-
824
-                        } elseif (($chrs{$c} == '{') &&
825
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
826
-                            // found a left-brace, and we are in an array, object, or slice
827
-                            array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
828
-                            //print("Found start of object at {$c}\n");
829
-
830
-                        } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
831
-                            // found a right-brace, and we're in an object
832
-                            array_pop($stk);
833
-                            //print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
834
-
835
-                        } elseif (($substr_chrs_c_2 == '/*') &&
836
-                                 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
837
-                            // found a comment start, and we are in an array, object, or slice
838
-                            array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
839
-                            $c++;
840
-                            //print("Found start of comment at {$c}\n");
841
-
842
-                        } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
843
-                            // found a comment end, and we're in one now
844
-                            array_pop($stk);
845
-                            $c++;
846
-
847
-                            for ($i = $top['where']; $i <= $c; ++$i)
848
-                                $chrs = substr_replace($chrs, ' ', $i, 1);
849
-
850
-                            //print("Found end of comment at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
851
-
852
-                        }
853
-
854
-                    }
855
-
856
-                    if (reset($stk) == SERVICES_JSON_IN_ARR) {
857
-                        return $arr;
858
-
859
-                    } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
860
-                        return $obj;
861
-
862
-                    }
863
-
864
-                }
865
-        }
866
-    }
867
-
868
-    /**
869
-     * @todo Ultimately, this should just call PEAR::isError()
870
-     */
871
-    function isError($data, $code = null)
872
-    {
873
-        if (class_exists('pear')) {
874
-            return PEAR::isError($data, $code);
875
-        } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
876
-                                 is_subclass_of($data, 'services_json_error'))) {
877
-            return true;
878
-        }
879
-
880
-        return false;
881
-    }
776
+							   if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:/Uis', $slice, $parts)) {
777
+ 								  // "name":value pair
778
+									$key = $this->decode($parts[1]);
779
+									$val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
780
+									if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
781
+										$obj[$key] = $val;
782
+									} else {
783
+										$obj->$key = $val;
784
+									}
785
+								} elseif (preg_match('/^\s*(\w+)\s*:/Uis', $slice, $parts)) {
786
+									// name:value pair, where name is unquoted
787
+									$key = $parts[1];
788
+									$val = $this->decode(trim(substr($slice, strlen($parts[0])), ", \t\n\r\0\x0B"));
789
+
790
+									if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
791
+										$obj[$key] = $val;
792
+									} else {
793
+										$obj->$key = $val;
794
+									}
795
+								}
796
+
797
+							}
798
+
799
+						} elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
800
+							// found a quote, and we are not inside a string
801
+							array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
802
+							//print("Found start of string at {$c}\n");
803
+
804
+						} elseif (($chrs{$c} == $top['delim']) &&
805
+								 ($top['what'] == SERVICES_JSON_IN_STR) &&
806
+								 (($this->strlen8($this->substr8($chrs, 0, $c)) - $this->strlen8(rtrim($this->substr8($chrs, 0, $c), '\\'))) % 2 != 1)) {
807
+							// found a quote, we're in a string, and it's not escaped
808
+							// we know that it's not escaped becase there is _not_ an
809
+							// odd number of backslashes at the end of the string so far
810
+							array_pop($stk);
811
+							//print("Found end of string at {$c}: ".$this->substr8($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
812
+
813
+						} elseif (($chrs{$c} == '[') &&
814
+								 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
815
+							// found a left-bracket, and we are in an array, object, or slice
816
+							array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
817
+							//print("Found start of array at {$c}\n");
818
+
819
+						} elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
820
+							// found a right-bracket, and we're in an array
821
+							array_pop($stk);
822
+							//print("Found end of array at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
823
+
824
+						} elseif (($chrs{$c} == '{') &&
825
+								 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
826
+							// found a left-brace, and we are in an array, object, or slice
827
+							array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
828
+							//print("Found start of object at {$c}\n");
829
+
830
+						} elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
831
+							// found a right-brace, and we're in an object
832
+							array_pop($stk);
833
+							//print("Found end of object at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
834
+
835
+						} elseif (($substr_chrs_c_2 == '/*') &&
836
+								 in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
837
+							// found a comment start, and we are in an array, object, or slice
838
+							array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
839
+							$c++;
840
+							//print("Found start of comment at {$c}\n");
841
+
842
+						} elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
843
+							// found a comment end, and we're in one now
844
+							array_pop($stk);
845
+							$c++;
846
+
847
+							for ($i = $top['where']; $i <= $c; ++$i)
848
+								$chrs = substr_replace($chrs, ' ', $i, 1);
849
+
850
+							//print("Found end of comment at {$c}: ".$this->substr8($chrs, $top['where'], (1 + $c - $top['where']))."\n");
851
+
852
+						}
853
+
854
+					}
855
+
856
+					if (reset($stk) == SERVICES_JSON_IN_ARR) {
857
+						return $arr;
858
+
859
+					} elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
860
+						return $obj;
861
+
862
+					}
863
+
864
+				}
865
+		}
866
+	}
867
+
868
+	/**
869
+	 * @todo Ultimately, this should just call PEAR::isError()
870
+	 */
871
+	function isError($data, $code = null)
872
+	{
873
+		if (class_exists('pear')) {
874
+			return PEAR::isError($data, $code);
875
+		} elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
876
+								 is_subclass_of($data, 'services_json_error'))) {
877
+			return true;
878
+		}
879
+
880
+		return false;
881
+	}
882 882
     
883
-    /**
884
-    * Calculates length of string in bytes
885
-    * @param string 
886
-    * @return integer length
887
-    */
888
-    function strlen8( $str ) 
889
-    {
890
-        if ( $this->_mb_strlen ) {
891
-            return mb_strlen( $str, "8bit" );
892
-        }
893
-        return strlen( $str );
894
-    }
883
+	/**
884
+	 * Calculates length of string in bytes
885
+	 * @param string 
886
+	 * @return integer length
887
+	 */
888
+	function strlen8( $str ) 
889
+	{
890
+		if ( $this->_mb_strlen ) {
891
+			return mb_strlen( $str, "8bit" );
892
+		}
893
+		return strlen( $str );
894
+	}
895 895
     
896
-    /**
897
-    * Returns part of a string, interpreting $start and $length as number of bytes.
898
-    * @param string 
899
-    * @param integer start 
900
-    * @param integer length 
901
-    * @return integer length
902
-    */
903
-    function substr8( $string, $start, $length=false ) 
904
-    {
905
-        if ( $length === false ) {
906
-            $length = $this->strlen8( $string ) - $start;
907
-        }
908
-        if ( $this->_mb_substr ) {
909
-            return mb_substr( $string, $start, $length, "8bit" );
910
-        }
911
-        return substr( $string, $start, $length );
912
-    }
896
+	/**
897
+	 * Returns part of a string, interpreting $start and $length as number of bytes.
898
+	 * @param string 
899
+	 * @param integer start 
900
+	 * @param integer length 
901
+	 * @return integer length
902
+	 */
903
+	function substr8( $string, $start, $length=false ) 
904
+	{
905
+		if ( $length === false ) {
906
+			$length = $this->strlen8( $string ) - $start;
907
+		}
908
+		if ( $this->_mb_substr ) {
909
+			return mb_substr( $string, $start, $length, "8bit" );
910
+		}
911
+		return substr( $string, $start, $length );
912
+	}
913 913
 
914 914
 }
915 915
 
916 916
 if (class_exists('PEAR_Error')) {
917 917
 
918
-    class Services_JSON_Error extends PEAR_Error
919
-    {
920
-        function __construct($message = 'unknown error', $code = null,
921
-                                     $mode = null, $options = null, $userinfo = null)
922
-        {
923
-            parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
924
-        }
918
+	class Services_JSON_Error extends PEAR_Error
919
+	{
920
+		function __construct($message = 'unknown error', $code = null,
921
+									 $mode = null, $options = null, $userinfo = null)
922
+		{
923
+			parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
924
+		}
925 925
 
926 926
 	public function Services_JSON_Error($message = 'unknown error', $code = null,
927
-                                     $mode = null, $options = null, $userinfo = null) {
927
+									 $mode = null, $options = null, $userinfo = null) {
928 928
 		self::__construct($message = 'unknown error', $code = null,
929
-                                     $mode = null, $options = null, $userinfo = null);
929
+									 $mode = null, $options = null, $userinfo = null);
930
+	}
930 931
 	}
931
-    }
932 932
 
933 933
 } else {
934 934
 
935
-    /**
936
-     * @todo Ultimately, this class shall be descended from PEAR_Error
937
-     */
938
-    class Services_JSON_Error
939
-    {
940
-	    /**
941
-	     * PHP5 constructor.
942
-	     */
943
-        function __construct( $message = 'unknown error', $code = null,
944
-                                     $mode = null, $options = null, $userinfo = null )
945
-        {
946
-
947
-        }
948
-
949
-	    /**
950
-	     * PHP4 constructor.
951
-	     */
935
+	/**
936
+	 * @todo Ultimately, this class shall be descended from PEAR_Error
937
+	 */
938
+	class Services_JSON_Error
939
+	{
940
+		/**
941
+		 * PHP5 constructor.
942
+		 */
943
+		function __construct( $message = 'unknown error', $code = null,
944
+									 $mode = null, $options = null, $userinfo = null )
945
+		{
946
+
947
+		}
948
+
949
+		/**
950
+		 * PHP4 constructor.
951
+		 */
952 952
 		public function Services_JSON_Error( $message = 'unknown error', $code = null,
953
-	                                     $mode = null, $options = null, $userinfo = null ) {
953
+										 $mode = null, $options = null, $userinfo = null ) {
954 954
 			self::__construct( $message, $code, $mode, $options, $userinfo );
955 955
 		}
956
-    }
956
+	}
957 957
     
958 958
 }
959 959
 
Please login to merge, or discard this patch.
src/wp-includes/cache.php 4 patches
Braces   +83 added lines, -56 removed lines patch added patch discarded remove patch
@@ -388,18 +388,22 @@  discard block
 block discarded – undo
388 388
 	 * @return bool False if cache key and group already exist, true on success
389 389
 	 */
390 390
 	public function add( $key, $data, $group = 'default', $expire = 0 ) {
391
-		if ( wp_suspend_cache_addition() )
392
-			return false;
391
+		if ( wp_suspend_cache_addition() ) {
392
+					return false;
393
+		}
393 394
 
394
-		if ( empty( $group ) )
395
-			$group = 'default';
395
+		if ( empty( $group ) ) {
396
+					$group = 'default';
397
+		}
396 398
 
397 399
 		$id = $key;
398
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
399
-			$id = $this->blog_prefix . $key;
400
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
401
+					$id = $this->blog_prefix . $key;
402
+		}
400 403
 
401
-		if ( $this->_exists( $id, $group ) )
402
-			return false;
404
+		if ( $this->_exists( $id, $group ) ) {
405
+					return false;
406
+		}
403 407
 
404 408
 		return $this->set( $key, $data, $group, (int) $expire );
405 409
 	}
@@ -429,24 +433,29 @@  discard block
 block discarded – undo
429 433
 	 * @return false|int False on failure, the item's new value on success.
430 434
 	 */
431 435
 	public function decr( $key, $offset = 1, $group = 'default' ) {
432
-		if ( empty( $group ) )
433
-			$group = 'default';
436
+		if ( empty( $group ) ) {
437
+					$group = 'default';
438
+		}
434 439
 
435
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
436
-			$key = $this->blog_prefix . $key;
440
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
441
+					$key = $this->blog_prefix . $key;
442
+		}
437 443
 
438
-		if ( ! $this->_exists( $key, $group ) )
439
-			return false;
444
+		if ( ! $this->_exists( $key, $group ) ) {
445
+					return false;
446
+		}
440 447
 
441
-		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
442
-			$this->cache[ $group ][ $key ] = 0;
448
+		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) {
449
+					$this->cache[ $group ][ $key ] = 0;
450
+		}
443 451
 
444 452
 		$offset = (int) $offset;
445 453
 
446 454
 		$this->cache[ $group ][ $key ] -= $offset;
447 455
 
448
-		if ( $this->cache[ $group ][ $key ] < 0 )
449
-			$this->cache[ $group ][ $key ] = 0;
456
+		if ( $this->cache[ $group ][ $key ] < 0 ) {
457
+					$this->cache[ $group ][ $key ] = 0;
458
+		}
450 459
 
451 460
 		return $this->cache[ $group ][ $key ];
452 461
 	}
@@ -465,14 +474,17 @@  discard block
 block discarded – undo
465 474
 	 * @return bool False if the contents weren't deleted and true on success
466 475
 	 */
467 476
 	public function delete( $key, $group = 'default', $deprecated = false ) {
468
-		if ( empty( $group ) )
469
-			$group = 'default';
477
+		if ( empty( $group ) ) {
478
+					$group = 'default';
479
+		}
470 480
 
471
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
472
-			$key = $this->blog_prefix . $key;
481
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
482
+					$key = $this->blog_prefix . $key;
483
+		}
473 484
 
474
-		if ( ! $this->_exists( $key, $group ) )
475
-			return false;
485
+		if ( ! $this->_exists( $key, $group ) ) {
486
+					return false;
487
+		}
476 488
 
477 489
 		unset( $this->cache[$group][$key] );
478 490
 		return true;
@@ -509,19 +521,22 @@  discard block
 block discarded – undo
509 521
 	 *		               contents on success
510 522
 	 */
511 523
 	public function get( $key, $group = 'default', $force = false, &$found = null ) {
512
-		if ( empty( $group ) )
513
-			$group = 'default';
524
+		if ( empty( $group ) ) {
525
+					$group = 'default';
526
+		}
514 527
 
515
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
516
-			$key = $this->blog_prefix . $key;
528
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
529
+					$key = $this->blog_prefix . $key;
530
+		}
517 531
 
518 532
 		if ( $this->_exists( $key, $group ) ) {
519 533
 			$found = true;
520 534
 			$this->cache_hits += 1;
521
-			if ( is_object($this->cache[$group][$key]) )
522
-				return clone $this->cache[$group][$key];
523
-			else
524
-				return $this->cache[$group][$key];
535
+			if ( is_object($this->cache[$group][$key]) ) {
536
+							return clone $this->cache[$group][$key];
537
+			} else {
538
+							return $this->cache[$group][$key];
539
+			}
525 540
 		}
526 541
 
527 542
 		$found = false;
@@ -540,24 +555,29 @@  discard block
 block discarded – undo
540 555
 	 * @return false|int False on failure, the item's new value on success.
541 556
 	 */
542 557
 	public function incr( $key, $offset = 1, $group = 'default' ) {
543
-		if ( empty( $group ) )
544
-			$group = 'default';
558
+		if ( empty( $group ) ) {
559
+					$group = 'default';
560
+		}
545 561
 
546
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
547
-			$key = $this->blog_prefix . $key;
562
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
563
+					$key = $this->blog_prefix . $key;
564
+		}
548 565
 
549
-		if ( ! $this->_exists( $key, $group ) )
550
-			return false;
566
+		if ( ! $this->_exists( $key, $group ) ) {
567
+					return false;
568
+		}
551 569
 
552
-		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
553
-			$this->cache[ $group ][ $key ] = 0;
570
+		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) ) {
571
+					$this->cache[ $group ][ $key ] = 0;
572
+		}
554 573
 
555 574
 		$offset = (int) $offset;
556 575
 
557 576
 		$this->cache[ $group ][ $key ] += $offset;
558 577
 
559
-		if ( $this->cache[ $group ][ $key ] < 0 )
560
-			$this->cache[ $group ][ $key ] = 0;
578
+		if ( $this->cache[ $group ][ $key ] < 0 ) {
579
+					$this->cache[ $group ][ $key ] = 0;
580
+		}
561 581
 
562 582
 		return $this->cache[ $group ][ $key ];
563 583
 	}
@@ -575,15 +595,18 @@  discard block
 block discarded – undo
575 595
 	 * @return bool False if not exists, true if contents were replaced
576 596
 	 */
577 597
 	public function replace( $key, $data, $group = 'default', $expire = 0 ) {
578
-		if ( empty( $group ) )
579
-			$group = 'default';
598
+		if ( empty( $group ) ) {
599
+					$group = 'default';
600
+		}
580 601
 
581 602
 		$id = $key;
582
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
583
-			$id = $this->blog_prefix . $key;
603
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
604
+					$id = $this->blog_prefix . $key;
605
+		}
584 606
 
585
-		if ( ! $this->_exists( $id, $group ) )
586
-			return false;
607
+		if ( ! $this->_exists( $id, $group ) ) {
608
+					return false;
609
+		}
587 610
 
588 611
 		return $this->set( $key, $data, $group, (int) $expire );
589 612
 	}
@@ -600,8 +623,9 @@  discard block
 block discarded – undo
600 623
 
601 624
 		// Clear out non-global caches since the blog ID has changed.
602 625
 		foreach ( array_keys( $this->cache ) as $group ) {
603
-			if ( ! isset( $this->global_groups[ $group ] ) )
604
-				unset( $this->cache[ $group ] );
626
+			if ( ! isset( $this->global_groups[ $group ] ) ) {
627
+							unset( $this->cache[ $group ] );
628
+			}
605 629
 		}
606 630
 	}
607 631
 
@@ -626,14 +650,17 @@  discard block
 block discarded – undo
626 650
 	 * @return true Always returns true
627 651
 	 */
628 652
 	public function set( $key, $data, $group = 'default', $expire = 0 ) {
629
-		if ( empty( $group ) )
630
-			$group = 'default';
653
+		if ( empty( $group ) ) {
654
+					$group = 'default';
655
+		}
631 656
 
632
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
633
-			$key = $this->blog_prefix . $key;
657
+		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) ) {
658
+					$key = $this->blog_prefix . $key;
659
+		}
634 660
 
635
-		if ( is_object( $data ) )
636
-			$data = clone $data;
661
+		if ( is_object( $data ) ) {
662
+					$data = clone $data;
663
+		}
637 664
 
638 665
 		$this->cache[$group][$key] = $data;
639 666
 		return true;
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @since 2.0.0
43 43
  *
44
- * @return true Always returns true.
44
+ * @return boolean Always returns true.
45 45
  */
46 46
 function wp_cache_close() {
47 47
 	return true;
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	 * @since 2.0.0
511 511
 	 * @access public
512 512
 	 *
513
-	 * @return true Always returns true.
513
+	 * @return boolean Always returns true.
514 514
 	 */
515 515
 	public function flush() {
516 516
 		$this->cache = array();
@@ -659,7 +659,7 @@  discard block
 block discarded – undo
659 659
 	 * @param mixed      $data   The contents to store in the cache.
660 660
 	 * @param string     $group  Optional. Where to group the cache contents. Default 'default'.
661 661
 	 * @param int        $expire Not Used.
662
-	 * @return true Always returns true.
662
+	 * @return boolean Always returns true.
663 663
 	 */
664 664
 	public function set( $key, $data, $group = 'default', $expire = 0 ) {
665 665
 		if ( empty( $group ) )
@@ -753,7 +753,7 @@  discard block
 block discarded – undo
753 753
 	 *
754 754
 	 * @since 2.0.8
755 755
 	 *
756
-	 * @return true Always returns true.
756
+	 * @return boolean Always returns true.
757 757
 	 */
758 758
 	public function __destruct() {
759 759
 		return true;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Object Cache API
4
- *
5
- * @link https://codex.wordpress.org/Function_Reference/WP_Cache
6
- *
7
- * @package WordPress
8
- * @subpackage Cache
9
- */
3
+	 * Object Cache API
4
+	 *
5
+	 * @link https://codex.wordpress.org/Function_Reference/WP_Cache
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Cache
9
+	 */
10 10
 
11 11
 /**
12 12
  * Adds data to the cache, if the cache key doesn't already exist.
@@ -730,7 +730,7 @@  discard block
 block discarded – undo
730 730
 	 *
731 731
 	 * @since 2.0.8
732 732
 	 *
733
-     * @global int $blog_id Global blog ID.
733
+	 * @global int $blog_id Global blog ID.
734 734
 	 */
735 735
 	public function __construct() {
736 736
 		global $blog_id;
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -24,10 +24,10 @@  discard block
 block discarded – undo
24 24
  *                           Default 0 (no expiration).
25 25
  * @return bool False if cache key and group already exist, true on success.
26 26
  */
27
-function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {
27
+function wp_cache_add($key, $data, $group = '', $expire = 0) {
28 28
 	global $wp_object_cache;
29 29
 
30
-	return $wp_object_cache->add( $key, $data, $group, (int) $expire );
30
+	return $wp_object_cache->add($key, $data, $group, (int) $expire);
31 31
 }
32 32
 
33 33
 /**
@@ -60,10 +60,10 @@  discard block
 block discarded – undo
60 60
  * @param string     $group  Optional. The group the key is in. Default empty.
61 61
  * @return false|int False on failure, the item's new value on success.
62 62
  */
63
-function wp_cache_decr( $key, $offset = 1, $group = '' ) {
63
+function wp_cache_decr($key, $offset = 1, $group = '') {
64 64
 	global $wp_object_cache;
65 65
 
66
-	return $wp_object_cache->decr( $key, $offset, $group );
66
+	return $wp_object_cache->decr($key, $offset, $group);
67 67
 }
68 68
 
69 69
 /**
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
  * @param string     $group Optional. Where the cache contents are grouped. Default empty.
79 79
  * @return bool True on successful removal, false on failure.
80 80
  */
81
-function wp_cache_delete( $key, $group = '' ) {
81
+function wp_cache_delete($key, $group = '') {
82 82
 	global $wp_object_cache;
83 83
 
84 84
 	return $wp_object_cache->delete($key, $group);
@@ -117,10 +117,10 @@  discard block
 block discarded – undo
117 117
  * @return bool|mixed False on failure to retrieve contents or the cache
118 118
  *		              contents on success
119 119
  */
120
-function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
120
+function wp_cache_get($key, $group = '', $force = false, &$found = null) {
121 121
 	global $wp_object_cache;
122 122
 
123
-	return $wp_object_cache->get( $key, $group, $force, $found );
123
+	return $wp_object_cache->get($key, $group, $force, $found);
124 124
 }
125 125
 
126 126
 /**
@@ -136,10 +136,10 @@  discard block
 block discarded – undo
136 136
  * @param string     $group  Optional. The group the key is in. Default empty.
137 137
  * @return false|int False on failure, the item's new value on success.
138 138
  */
139
-function wp_cache_incr( $key, $offset = 1, $group = '' ) {
139
+function wp_cache_incr($key, $offset = 1, $group = '') {
140 140
 	global $wp_object_cache;
141 141
 
142
-	return $wp_object_cache->incr( $key, $offset, $group );
142
+	return $wp_object_cache->incr($key, $offset, $group);
143 143
 }
144 144
 
145 145
 /**
@@ -169,10 +169,10 @@  discard block
 block discarded – undo
169 169
  *                           Default 0 (no expiration).
170 170
  * @return bool False if original value does not exist, true if contents were replaced
171 171
  */
172
-function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {
172
+function wp_cache_replace($key, $data, $group = '', $expire = 0) {
173 173
 	global $wp_object_cache;
174 174
 
175
-	return $wp_object_cache->replace( $key, $data, $group, (int) $expire );
175
+	return $wp_object_cache->replace($key, $data, $group, (int) $expire);
176 176
 }
177 177
 
178 178
 /**
@@ -193,10 +193,10 @@  discard block
 block discarded – undo
193 193
  *                           Default 0 (no expiration).
194 194
  * @return bool False on failure, true on success
195 195
  */
196
-function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {
196
+function wp_cache_set($key, $data, $group = '', $expire = 0) {
197 197
 	global $wp_object_cache;
198 198
 
199
-	return $wp_object_cache->set( $key, $data, $group, (int) $expire );
199
+	return $wp_object_cache->set($key, $data, $group, (int) $expire);
200 200
 }
201 201
 
202 202
 /**
@@ -211,10 +211,10 @@  discard block
 block discarded – undo
211 211
  *
212 212
  * @param int $blog_id Site ID.
213 213
  */
214
-function wp_cache_switch_to_blog( $blog_id ) {
214
+function wp_cache_switch_to_blog($blog_id) {
215 215
 	global $wp_object_cache;
216 216
 
217
-	$wp_object_cache->switch_to_blog( $blog_id );
217
+	$wp_object_cache->switch_to_blog($blog_id);
218 218
 }
219 219
 
220 220
 /**
@@ -227,10 +227,10 @@  discard block
 block discarded – undo
227 227
  *
228 228
  * @param string|array $groups A group or an array of groups to add.
229 229
  */
230
-function wp_cache_add_global_groups( $groups ) {
230
+function wp_cache_add_global_groups($groups) {
231 231
 	global $wp_object_cache;
232 232
 
233
-	$wp_object_cache->add_global_groups( $groups );
233
+	$wp_object_cache->add_global_groups($groups);
234 234
 }
235 235
 
236 236
 /**
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
  *
241 241
  * @param string|array $groups A group or an array of groups to add.
242 242
  */
243
-function wp_cache_add_non_persistent_groups( $groups ) {
243
+function wp_cache_add_non_persistent_groups($groups) {
244 244
 	// Default cache doesn't persist so nothing to do here.
245 245
 }
246 246
 
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
  * @global WP_Object_Cache $wp_object_cache Object cache global instance.
265 265
  */
266 266
 function wp_cache_reset() {
267
-	_deprecated_function( __FUNCTION__, '3.5' );
267
+	_deprecated_function(__FUNCTION__, '3.5');
268 268
 
269 269
 	global $wp_object_cache;
270 270
 
@@ -352,7 +352,7 @@  discard block
 block discarded – undo
352 352
 	 * @param string $name Property to get.
353 353
 	 * @return mixed Property.
354 354
 	 */
355
-	public function __get( $name ) {
355
+	public function __get($name) {
356 356
 		return $this->$name;
357 357
 	}
358 358
 
@@ -366,7 +366,7 @@  discard block
 block discarded – undo
366 366
 	 * @param mixed  $value Property value.
367 367
 	 * @return mixed Newly-set property.
368 368
 	 */
369
-	public function __set( $name, $value ) {
369
+	public function __set($name, $value) {
370 370
 		return $this->$name = $value;
371 371
 	}
372 372
 
@@ -379,8 +379,8 @@  discard block
 block discarded – undo
379 379
 	 * @param string $name Property to check if set.
380 380
 	 * @return bool Whether the property is set.
381 381
 	 */
382
-	public function __isset( $name ) {
383
-		return isset( $this->$name );
382
+	public function __isset($name) {
383
+		return isset($this->$name);
384 384
 	}
385 385
 
386 386
 	/**
@@ -391,8 +391,8 @@  discard block
 block discarded – undo
391 391
 	 *
392 392
 	 * @param string $name Property to unset.
393 393
 	 */
394
-	public function __unset( $name ) {
395
-		unset( $this->$name );
394
+	public function __unset($name) {
395
+		unset($this->$name);
396 396
 	}
397 397
 
398 398
 	/**
@@ -411,21 +411,21 @@  discard block
 block discarded – undo
411 411
 	 * @param int        $expire Optional. When to expire the cache contents. Default 0 (no expiration).
412 412
 	 * @return bool False if cache key and group already exist, true on success
413 413
 	 */
414
-	public function add( $key, $data, $group = 'default', $expire = 0 ) {
415
-		if ( wp_suspend_cache_addition() )
414
+	public function add($key, $data, $group = 'default', $expire = 0) {
415
+		if (wp_suspend_cache_addition())
416 416
 			return false;
417 417
 
418
-		if ( empty( $group ) )
418
+		if (empty($group))
419 419
 			$group = 'default';
420 420
 
421 421
 		$id = $key;
422
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
423
-			$id = $this->blog_prefix . $key;
422
+		if ($this->multisite && ! isset($this->global_groups[$group]))
423
+			$id = $this->blog_prefix.$key;
424 424
 
425
-		if ( $this->_exists( $id, $group ) )
425
+		if ($this->_exists($id, $group))
426 426
 			return false;
427 427
 
428
-		return $this->set( $key, $data, $group, (int) $expire );
428
+		return $this->set($key, $data, $group, (int) $expire);
429 429
 	}
430 430
 
431 431
 	/**
@@ -436,11 +436,11 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @param array $groups List of groups that are global.
438 438
 	 */
439
-	public function add_global_groups( $groups ) {
439
+	public function add_global_groups($groups) {
440 440
 		$groups = (array) $groups;
441 441
 
442
-		$groups = array_fill_keys( $groups, true );
443
-		$this->global_groups = array_merge( $this->global_groups, $groups );
442
+		$groups = array_fill_keys($groups, true);
443
+		$this->global_groups = array_merge($this->global_groups, $groups);
444 444
 	}
445 445
 
446 446
 	/**
@@ -454,27 +454,27 @@  discard block
 block discarded – undo
454 454
 	 * @param string     $group  Optional. The group the key is in. Default 'default'.
455 455
 	 * @return false|int False on failure, the item's new value on success.
456 456
 	 */
457
-	public function decr( $key, $offset = 1, $group = 'default' ) {
458
-		if ( empty( $group ) )
457
+	public function decr($key, $offset = 1, $group = 'default') {
458
+		if (empty($group))
459 459
 			$group = 'default';
460 460
 
461
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
462
-			$key = $this->blog_prefix . $key;
461
+		if ($this->multisite && ! isset($this->global_groups[$group]))
462
+			$key = $this->blog_prefix.$key;
463 463
 
464
-		if ( ! $this->_exists( $key, $group ) )
464
+		if ( ! $this->_exists($key, $group))
465 465
 			return false;
466 466
 
467
-		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
468
-			$this->cache[ $group ][ $key ] = 0;
467
+		if ( ! is_numeric($this->cache[$group][$key]))
468
+			$this->cache[$group][$key] = 0;
469 469
 
470 470
 		$offset = (int) $offset;
471 471
 
472
-		$this->cache[ $group ][ $key ] -= $offset;
472
+		$this->cache[$group][$key] -= $offset;
473 473
 
474
-		if ( $this->cache[ $group ][ $key ] < 0 )
475
-			$this->cache[ $group ][ $key ] = 0;
474
+		if ($this->cache[$group][$key] < 0)
475
+			$this->cache[$group][$key] = 0;
476 476
 
477
-		return $this->cache[ $group ][ $key ];
477
+		return $this->cache[$group][$key];
478 478
 	}
479 479
 
480 480
 	/**
@@ -490,17 +490,17 @@  discard block
 block discarded – undo
490 490
 	 * @param bool       $deprecated Optional. Unused. Default false.
491 491
 	 * @return bool False if the contents weren't deleted and true on success.
492 492
 	 */
493
-	public function delete( $key, $group = 'default', $deprecated = false ) {
494
-		if ( empty( $group ) )
493
+	public function delete($key, $group = 'default', $deprecated = false) {
494
+		if (empty($group))
495 495
 			$group = 'default';
496 496
 
497
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
498
-			$key = $this->blog_prefix . $key;
497
+		if ($this->multisite && ! isset($this->global_groups[$group]))
498
+			$key = $this->blog_prefix.$key;
499 499
 
500
-		if ( ! $this->_exists( $key, $group ) )
500
+		if ( ! $this->_exists($key, $group))
501 501
 			return false;
502 502
 
503
-		unset( $this->cache[$group][$key] );
503
+		unset($this->cache[$group][$key]);
504 504
 		return true;
505 505
 	}
506 506
 
@@ -538,17 +538,17 @@  discard block
 block discarded – undo
538 538
 	 *                           false, a storable value. Passed by reference. Default null.
539 539
 	 * @return false|mixed False on failure to retrieve contents or the cache contents on success.
540 540
 	 */
541
-	public function get( $key, $group = 'default', $force = false, &$found = null ) {
542
-		if ( empty( $group ) )
541
+	public function get($key, $group = 'default', $force = false, &$found = null) {
542
+		if (empty($group))
543 543
 			$group = 'default';
544 544
 
545
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
546
-			$key = $this->blog_prefix . $key;
545
+		if ($this->multisite && ! isset($this->global_groups[$group]))
546
+			$key = $this->blog_prefix.$key;
547 547
 
548
-		if ( $this->_exists( $key, $group ) ) {
548
+		if ($this->_exists($key, $group)) {
549 549
 			$found = true;
550 550
 			$this->cache_hits += 1;
551
-			if ( is_object($this->cache[$group][$key]) )
551
+			if (is_object($this->cache[$group][$key]))
552 552
 				return clone $this->cache[$group][$key];
553 553
 			else
554 554
 				return $this->cache[$group][$key];
@@ -570,27 +570,27 @@  discard block
 block discarded – undo
570 570
 	 * @param string     $group  Optional. The group the key is in. Default 'default'.
571 571
 	 * @return false|int False on failure, the item's new value on success.
572 572
 	 */
573
-	public function incr( $key, $offset = 1, $group = 'default' ) {
574
-		if ( empty( $group ) )
573
+	public function incr($key, $offset = 1, $group = 'default') {
574
+		if (empty($group))
575 575
 			$group = 'default';
576 576
 
577
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
578
-			$key = $this->blog_prefix . $key;
577
+		if ($this->multisite && ! isset($this->global_groups[$group]))
578
+			$key = $this->blog_prefix.$key;
579 579
 
580
-		if ( ! $this->_exists( $key, $group ) )
580
+		if ( ! $this->_exists($key, $group))
581 581
 			return false;
582 582
 
583
-		if ( ! is_numeric( $this->cache[ $group ][ $key ] ) )
584
-			$this->cache[ $group ][ $key ] = 0;
583
+		if ( ! is_numeric($this->cache[$group][$key]))
584
+			$this->cache[$group][$key] = 0;
585 585
 
586 586
 		$offset = (int) $offset;
587 587
 
588
-		$this->cache[ $group ][ $key ] += $offset;
588
+		$this->cache[$group][$key] += $offset;
589 589
 
590
-		if ( $this->cache[ $group ][ $key ] < 0 )
591
-			$this->cache[ $group ][ $key ] = 0;
590
+		if ($this->cache[$group][$key] < 0)
591
+			$this->cache[$group][$key] = 0;
592 592
 
593
-		return $this->cache[ $group ][ $key ];
593
+		return $this->cache[$group][$key];
594 594
 	}
595 595
 
596 596
 	/**
@@ -607,18 +607,18 @@  discard block
 block discarded – undo
607 607
 	 * @param int        $expire Optional. When to expire the cache contents. Default 0 (no expiration).
608 608
 	 * @return bool False if not exists, true if contents were replaced.
609 609
 	 */
610
-	public function replace( $key, $data, $group = 'default', $expire = 0 ) {
611
-		if ( empty( $group ) )
610
+	public function replace($key, $data, $group = 'default', $expire = 0) {
611
+		if (empty($group))
612 612
 			$group = 'default';
613 613
 
614 614
 		$id = $key;
615
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
616
-			$id = $this->blog_prefix . $key;
615
+		if ($this->multisite && ! isset($this->global_groups[$group]))
616
+			$id = $this->blog_prefix.$key;
617 617
 
618
-		if ( ! $this->_exists( $id, $group ) )
618
+		if ( ! $this->_exists($id, $group))
619 619
 			return false;
620 620
 
621
-		return $this->set( $key, $data, $group, (int) $expire );
621
+		return $this->set($key, $data, $group, (int) $expire);
622 622
 	}
623 623
 
624 624
 	/**
@@ -631,12 +631,12 @@  discard block
 block discarded – undo
631 631
 	 * @see switch_to_blog()
632 632
 	 */
633 633
 	public function reset() {
634
-		_deprecated_function( __FUNCTION__, '3.5', 'switch_to_blog()' );
634
+		_deprecated_function(__FUNCTION__, '3.5', 'switch_to_blog()');
635 635
 
636 636
 		// Clear out non-global caches since the blog ID has changed.
637
-		foreach ( array_keys( $this->cache ) as $group ) {
638
-			if ( ! isset( $this->global_groups[ $group ] ) )
639
-				unset( $this->cache[ $group ] );
637
+		foreach (array_keys($this->cache) as $group) {
638
+			if ( ! isset($this->global_groups[$group]))
639
+				unset($this->cache[$group]);
640 640
 		}
641 641
 	}
642 642
 
@@ -661,14 +661,14 @@  discard block
 block discarded – undo
661 661
 	 * @param int        $expire Not Used.
662 662
 	 * @return true Always returns true.
663 663
 	 */
664
-	public function set( $key, $data, $group = 'default', $expire = 0 ) {
665
-		if ( empty( $group ) )
664
+	public function set($key, $data, $group = 'default', $expire = 0) {
665
+		if (empty($group))
666 666
 			$group = 'default';
667 667
 
668
-		if ( $this->multisite && ! isset( $this->global_groups[ $group ] ) )
669
-			$key = $this->blog_prefix . $key;
668
+		if ($this->multisite && ! isset($this->global_groups[$group]))
669
+			$key = $this->blog_prefix.$key;
670 670
 
671
-		if ( is_object( $data ) )
671
+		if (is_object($data))
672 672
 			$data = clone $data;
673 673
 
674 674
 		$this->cache[$group][$key] = $data;
@@ -691,7 +691,7 @@  discard block
 block discarded – undo
691 691
 		echo "</p>";
692 692
 		echo '<ul>';
693 693
 		foreach ($this->cache as $group => $cache) {
694
-			echo "<li><strong>Group:</strong> $group - ( " . number_format( strlen( serialize( $cache ) ) / KB_IN_BYTES, 2 ) . 'k )</li>';
694
+			echo "<li><strong>Group:</strong> $group - ( ".number_format(strlen(serialize($cache)) / KB_IN_BYTES, 2).'k )</li>';
695 695
 		}
696 696
 		echo '</ul>';
697 697
 	}
@@ -706,9 +706,9 @@  discard block
 block discarded – undo
706 706
 	 *
707 707
 	 * @param int $blog_id Blog ID.
708 708
 	 */
709
-	public function switch_to_blog( $blog_id ) {
709
+	public function switch_to_blog($blog_id) {
710 710
 		$blog_id = (int) $blog_id;
711
-		$this->blog_prefix = $this->multisite ? $blog_id . ':' : '';
711
+		$this->blog_prefix = $this->multisite ? $blog_id.':' : '';
712 712
 	}
713 713
 
714 714
 	/**
@@ -721,8 +721,8 @@  discard block
 block discarded – undo
721 721
 	 * @param string     $group Cache group for the key existence check.
722 722
 	 * @return bool Whether the key exists in the cache for the given group.
723 723
 	 */
724
-	protected function _exists( $key, $group ) {
725
-		return isset( $this->cache[ $group ] ) && ( isset( $this->cache[ $group ][ $key ] ) || array_key_exists( $key, $this->cache[ $group ] ) );
724
+	protected function _exists($key, $group) {
725
+		return isset($this->cache[$group]) && (isset($this->cache[$group][$key]) || array_key_exists($key, $this->cache[$group]));
726 726
 	}
727 727
 
728 728
 	/**
@@ -736,14 +736,14 @@  discard block
 block discarded – undo
736 736
 		global $blog_id;
737 737
 
738 738
 		$this->multisite = is_multisite();
739
-		$this->blog_prefix =  $this->multisite ? $blog_id . ':' : '';
739
+		$this->blog_prefix = $this->multisite ? $blog_id.':' : '';
740 740
 
741 741
 
742 742
 		/**
743 743
 		 * @todo This should be moved to the PHP4 style constructor, PHP5
744 744
 		 * already calls __destruct()
745 745
 		 */
746
-		register_shutdown_function( array( $this, '__destruct' ) );
746
+		register_shutdown_function(array($this, '__destruct'));
747 747
 	}
748 748
 
749 749
 	/**
Please login to merge, or discard this patch.