Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-admin/includes/class-wp-upgrader-skins.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	 * @param bool   $error
60 60
 	 * @param string $context
61 61
 	 * @param bool   $allow_relaxed_file_ownership
62
-	 * @return type
62
+	 * @return boolean
63 63
 	 */
64 64
 	public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
65 65
 		$url = $this->options['url'];
@@ -885,7 +885,7 @@  discard block
 block discarded – undo
885 885
 	}
886 886
 
887 887
 	/**
888
-	 * @param string|array|WP_Error $data
888
+	 * @param string $data
889 889
 	 */
890 890
 	public function feedback( $data ) {
891 891
 		if ( is_wp_error( $data ) ) {
Please login to merge, or discard this patch.
Spacing   +189 added lines, -189 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @param array $args
28 28
 	 */
29 29
 	public function __construct($args = array()) {
30
-		$defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false );
30
+		$defaults = array('url' => '', 'nonce' => '', 'title' => '', 'context' => false);
31 31
 		$this->options = wp_parse_args($args, $defaults);
32 32
 	}
33 33
 
@@ -35,8 +35,8 @@  discard block
 block discarded – undo
35 35
 	 * @param WP_Upgrader $upgrader
36 36
 	 */
37 37
 	public function set_upgrader(&$upgrader) {
38
-		if ( is_object($upgrader) )
39
-			$this->upgrader =& $upgrader;
38
+		if (is_object($upgrader))
39
+			$this->upgrader = & $upgrader;
40 40
 		$this->add_strings();
41 41
 	}
42 42
 
@@ -61,37 +61,37 @@  discard block
 block discarded – undo
61 61
 	 * @param bool   $allow_relaxed_file_ownership
62 62
 	 * @return type
63 63
 	 */
64
-	public function request_filesystem_credentials( $error = false, $context = false, $allow_relaxed_file_ownership = false ) {
64
+	public function request_filesystem_credentials($error = false, $context = false, $allow_relaxed_file_ownership = false) {
65 65
 		$url = $this->options['url'];
66
-		if ( ! $context ) {
66
+		if ( ! $context) {
67 67
 			$context = $this->options['context'];
68 68
 		}
69
-		if ( !empty($this->options['nonce']) ) {
69
+		if ( ! empty($this->options['nonce'])) {
70 70
 			$url = wp_nonce_url($url, $this->options['nonce']);
71 71
 		}
72 72
 
73 73
 		$extra_fields = array();
74 74
 
75
-		return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership );
75
+		return request_filesystem_credentials($url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership);
76 76
 	}
77 77
 
78 78
 	/**
79 79
 	 * @access public
80 80
 	 */
81 81
 	public function header() {
82
-		if ( $this->done_header ) {
82
+		if ($this->done_header) {
83 83
 			return;
84 84
 		}
85 85
 		$this->done_header = true;
86 86
 		echo '<div class="wrap">';
87
-		echo '<h1>' . $this->options['title'] . '</h1>';
87
+		echo '<h1>'.$this->options['title'].'</h1>';
88 88
 	}
89 89
 
90 90
 	/**
91 91
 	 * @access public
92 92
 	 */
93 93
 	public function footer() {
94
-		if ( $this->done_footer ) {
94
+		if ($this->done_footer) {
95 95
 			return;
96 96
 		}
97 97
 		$this->done_footer = true;
@@ -103,14 +103,14 @@  discard block
 block discarded – undo
103 103
 	 * @param string|WP_Error $errors
104 104
 	 */
105 105
 	public function error($errors) {
106
-		if ( ! $this->done_header )
106
+		if ( ! $this->done_header)
107 107
 			$this->header();
108
-		if ( is_string($errors) ) {
108
+		if (is_string($errors)) {
109 109
 			$this->feedback($errors);
110
-		} elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
111
-			foreach ( $errors->get_error_messages() as $message ) {
112
-				if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) )
113
-					$this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
110
+		} elseif (is_wp_error($errors) && $errors->get_error_code()) {
111
+			foreach ($errors->get_error_messages() as $message) {
112
+				if ($errors->get_error_data() && is_string($errors->get_error_data()))
113
+					$this->feedback($message.' '.esc_html(strip_tags($errors->get_error_data())));
114 114
 				else
115 115
 					$this->feedback($message);
116 116
 			}
@@ -122,19 +122,19 @@  discard block
 block discarded – undo
122 122
 	 * @param string $string
123 123
 	 */
124 124
 	public function feedback($string) {
125
-		if ( isset( $this->upgrader->strings[$string] ) )
125
+		if (isset($this->upgrader->strings[$string]))
126 126
 			$string = $this->upgrader->strings[$string];
127 127
 
128
-		if ( strpos($string, '%') !== false ) {
128
+		if (strpos($string, '%') !== false) {
129 129
 			$args = func_get_args();
130 130
 			$args = array_splice($args, 1);
131
-			if ( $args ) {
132
-				$args = array_map( 'strip_tags', $args );
133
-				$args = array_map( 'esc_html', $args );
131
+			if ($args) {
132
+				$args = array_map('strip_tags', $args);
133
+				$args = array_map('esc_html', $args);
134 134
 				$string = vsprintf($string, $args);
135 135
 			}
136 136
 		}
137
-		if ( empty($string) )
137
+		if (empty($string))
138 138
 			return;
139 139
 		show_message($string);
140 140
 	}
@@ -157,22 +157,22 @@  discard block
 block discarded – undo
157 157
 	 * @param string $type Type of update count to decrement. Likely values include 'plugin',
158 158
 	 *                     'theme', 'translation', etc.
159 159
 	 */
160
-	protected function decrement_update_count( $type ) {
161
-		if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) {
160
+	protected function decrement_update_count($type) {
161
+		if ( ! $this->result || is_wp_error($this->result) || 'up_to_date' === $this->result) {
162 162
 			return;
163 163
 		}
164 164
 
165
-		if ( defined( 'IFRAME_REQUEST' ) ) {
165
+		if (defined('IFRAME_REQUEST')) {
166 166
 			echo '<script type="text/javascript">
167 167
 					if ( window.postMessage && JSON ) {
168
-						window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname );
168
+						window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type.'" } ), window.location.protocol + "//" + window.location.hostname );
169 169
 					}
170 170
 				</script>';
171 171
 		} else {
172 172
 			echo '<script type="text/javascript">
173 173
 					(function( wp ) {
174 174
 						if ( wp && wp.updates.decrementCount ) {
175
-							wp.updates.decrementCount( "' . $type . '" );
175
+							wp.updates.decrementCount( "' . $type.'" );
176 176
 						}
177 177
 					})( window.wp );
178 178
 				</script>';
@@ -206,14 +206,14 @@  discard block
 block discarded – undo
206 206
 	 *
207 207
 	 * @param array $args
208 208
 	 */
209
-	public function __construct( $args = array() ) {
210
-		$defaults = array( 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin') );
209
+	public function __construct($args = array()) {
210
+		$defaults = array('url' => '', 'plugin' => '', 'nonce' => '', 'title' => __('Update Plugin'));
211 211
 		$args = wp_parse_args($args, $defaults);
212 212
 
213 213
 		$this->plugin = $args['plugin'];
214 214
 
215
-		$this->plugin_active = is_plugin_active( $this->plugin );
216
-		$this->plugin_network_active = is_plugin_active_for_network( $this->plugin );
215
+		$this->plugin_active = is_plugin_active($this->plugin);
216
+		$this->plugin_network_active = is_plugin_active_for_network($this->plugin);
217 217
 
218 218
 		parent::__construct($args);
219 219
 	}
@@ -223,19 +223,19 @@  discard block
 block discarded – undo
223 223
 	 */
224 224
 	public function after() {
225 225
 		$this->plugin = $this->upgrader->plugin_info();
226
-		if ( !empty($this->plugin) && !is_wp_error($this->result) && $this->plugin_active ){
226
+		if ( ! empty($this->plugin) && ! is_wp_error($this->result) && $this->plugin_active) {
227 227
 			// Currently used only when JS is off for a single plugin update?
228
-			echo '<iframe title="' . esc_attr__( 'Update progress' ) . '" style="border:0;overflow:hidden" width="100%" height="170" src="' . wp_nonce_url( 'update.php?action=activate-plugin&networkwide=' . $this->plugin_network_active . '&plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin ) . '"></iframe>';
228
+			echo '<iframe title="'.esc_attr__('Update progress').'" style="border:0;overflow:hidden" width="100%" height="170" src="'.wp_nonce_url('update.php?action=activate-plugin&networkwide='.$this->plugin_network_active.'&plugin='.urlencode($this->plugin), 'activate-plugin_'.$this->plugin).'"></iframe>';
229 229
 		}
230 230
 
231
-		$this->decrement_update_count( 'plugin' );
231
+		$this->decrement_update_count('plugin');
232 232
 
233
-		$update_actions =  array(
234
-			'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>',
235
-			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>'
233
+		$update_actions = array(
234
+			'activate_plugin' => '<a href="'.wp_nonce_url('plugins.php?action=activate&amp;plugin='.urlencode($this->plugin), 'activate-plugin_'.$this->plugin).'" target="_parent">'.__('Activate Plugin').'</a>',
235
+			'plugins_page' => '<a href="'.self_admin_url('plugins.php').'" target="_parent">'.__('Return to Plugins page').'</a>'
236 236
 		);
237
-		if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
238
-			unset( $update_actions['activate_plugin'] );
237
+		if ($this->plugin_active || ! $this->result || is_wp_error($this->result) || ! current_user_can('activate_plugins'))
238
+			unset($update_actions['activate_plugin']);
239 239
 
240 240
 		/**
241 241
 		 * Filter the list of action links available following a single plugin update.
@@ -245,10 +245,10 @@  discard block
 block discarded – undo
245 245
 		 * @param array  $update_actions Array of plugin action links.
246 246
 		 * @param string $plugin         Path to the plugin file.
247 247
 		 */
248
-		$update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
248
+		$update_actions = apply_filters('update_plugin_complete_actions', $update_actions, $this->plugin);
249 249
 
250
-		if ( ! empty($update_actions) )
251
-			$this->feedback(implode(' | ', (array)$update_actions));
250
+		if ( ! empty($update_actions))
251
+			$this->feedback(implode(' | ', (array) $update_actions));
252 252
 	}
253 253
 }
254 254
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 * @param array $args
272 272
 	 */
273 273
 	public function __construct($args = array()) {
274
-		$defaults = array( 'url' => '', 'nonce' => '' );
274
+		$defaults = array('url' => '', 'nonce' => '');
275 275
 		$args = wp_parse_args($args, $defaults);
276 276
 
277 277
 		parent::__construct($args);
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 		/* translators: 1: Title of an update */
288 288
 		$this->upgrader->strings['skin_update_failed'] = __('The update of %1$s failed.');
289 289
 		/* translators: 1: Title of an update */
290
-		$this->upgrader->strings['skin_update_successful'] = __( '%1$s updated successfully.' ) . ' <a onclick="%2$s" href="#" class="hide-if-no-js"><span>' . __( 'Show Details' ) . '</span><span class="hidden">' . __( 'Hide Details' ) . '</span></a>';
290
+		$this->upgrader->strings['skin_update_successful'] = __('%1$s updated successfully.').' <a onclick="%2$s" href="#" class="hide-if-no-js"><span>'.__('Show Details').'</span><span class="hidden">'.__('Hide Details').'</span></a>';
291 291
 		$this->upgrader->strings['skin_upgrade_end'] = __('All updates have been completed.');
292 292
 	}
293 293
 
@@ -295,21 +295,21 @@  discard block
 block discarded – undo
295 295
 	 * @param string $string
296 296
 	 */
297 297
 	public function feedback($string) {
298
-		if ( isset( $this->upgrader->strings[$string] ) )
298
+		if (isset($this->upgrader->strings[$string]))
299 299
 			$string = $this->upgrader->strings[$string];
300 300
 
301
-		if ( strpos($string, '%') !== false ) {
301
+		if (strpos($string, '%') !== false) {
302 302
 			$args = func_get_args();
303 303
 			$args = array_splice($args, 1);
304
-			if ( $args ) {
305
-				$args = array_map( 'strip_tags', $args );
306
-				$args = array_map( 'esc_html', $args );
304
+			if ($args) {
305
+				$args = array_map('strip_tags', $args);
306
+				$args = array_map('esc_html', $args);
307 307
 				$string = vsprintf($string, $args);
308 308
 			}
309 309
 		}
310
-		if ( empty($string) )
310
+		if (empty($string))
311 311
 			return;
312
-		if ( $this->in_loop )
312
+		if ($this->in_loop)
313 313
 			echo "$string<br />\n";
314 314
 		else
315 315
 			echo "<p>$string</p>\n";
@@ -334,20 +334,20 @@  discard block
 block discarded – undo
334 334
 	 * @param string|WP_Error $error
335 335
 	 */
336 336
 	public function error($error) {
337
-		if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
337
+		if (is_string($error) && isset($this->upgrader->strings[$error]))
338 338
 			$this->error = $this->upgrader->strings[$error];
339 339
 
340
-		if ( is_wp_error($error) ) {
340
+		if (is_wp_error($error)) {
341 341
 			$messages = array();
342
-			foreach ( $error->get_error_messages() as $emessage ) {
343
-				if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
344
-					$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
342
+			foreach ($error->get_error_messages() as $emessage) {
343
+				if ($error->get_error_data() && is_string($error->get_error_data()))
344
+					$messages[] = $emessage.' '.esc_html(strip_tags($error->get_error_data()));
345 345
 				else
346 346
 					$messages[] = $emessage;
347 347
 			}
348 348
 			$this->error = implode(', ', $messages);
349 349
 		}
350
-		echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
350
+		echo '<script type="text/javascript">jQuery(\'.waiting-'.esc_js($this->upgrader->update_current).'\').hide();</script>';
351 351
 	}
352 352
 
353 353
 	/**
@@ -370,9 +370,9 @@  discard block
 block discarded – undo
370 370
 	 */
371 371
 	public function before($title = '') {
372 372
 		$this->in_loop = true;
373
-		printf( '<h2>' . $this->upgrader->strings['skin_before_update_header'] . ' <span class="spinner waiting-' . $this->upgrader->update_current . '"></span></h2>', $title, $this->upgrader->update_current, $this->upgrader->update_count );
374
-		echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').css("display", "inline-block");</script>';
375
-		echo '<div class="update-messages hide-if-js" id="progress-' . esc_attr($this->upgrader->update_current) . '"><p>';
373
+		printf('<h2>'.$this->upgrader->strings['skin_before_update_header'].' <span class="spinner waiting-'.$this->upgrader->update_current.'"></span></h2>', $title, $this->upgrader->update_current, $this->upgrader->update_count);
374
+		echo '<script type="text/javascript">jQuery(\'.waiting-'.esc_js($this->upgrader->update_current).'\').css("display", "inline-block");</script>';
375
+		echo '<div class="update-messages hide-if-js" id="progress-'.esc_attr($this->upgrader->update_current).'"><p>';
376 376
 		$this->flush_output();
377 377
 	}
378 378
 
@@ -382,19 +382,19 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function after($title = '') {
384 384
 		echo '</p></div>';
385
-		if ( $this->error || ! $this->result ) {
386
-			if ( $this->error ) {
387
-				echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed_error'], $title, '<strong>' . $this->error . '</strong>' ) . '</p></div>';
385
+		if ($this->error || ! $this->result) {
386
+			if ($this->error) {
387
+				echo '<div class="error"><p>'.sprintf($this->upgrader->strings['skin_update_failed_error'], $title, '<strong>'.$this->error.'</strong>').'</p></div>';
388 388
 			} else {
389
-				echo '<div class="error"><p>' . sprintf($this->upgrader->strings['skin_update_failed'], $title) . '</p></div>';
389
+				echo '<div class="error"><p>'.sprintf($this->upgrader->strings['skin_update_failed'], $title).'</p></div>';
390 390
 			}
391 391
 
392
-			echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
392
+			echo '<script type="text/javascript">jQuery(\'#progress-'.esc_js($this->upgrader->update_current).'\').show();</script>';
393 393
 		}
394
-		if ( $this->result && ! is_wp_error( $this->result ) ) {
395
-			if ( ! $this->error )
396
-				echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
397
-			echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
394
+		if ($this->result && ! is_wp_error($this->result)) {
395
+			if ( ! $this->error)
396
+				echo '<div class="updated"><p>'.sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-'.esc_js($this->upgrader->update_current).'\').toggle();jQuery(\'span\', this).toggle(); return false;').'</p></div>';
397
+			echo '<script type="text/javascript">jQuery(\'.waiting-'.esc_js($this->upgrader->update_current).'\').hide();</script>';
398 398
 		}
399 399
 
400 400
 		$this->reset();
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 */
441 441
 	public function after($title = '') {
442 442
 		parent::after($this->plugin_info['Title']);
443
-		$this->decrement_update_count( 'plugin' );
443
+		$this->decrement_update_count('plugin');
444 444
 	}
445 445
 
446 446
 	/**
@@ -448,12 +448,12 @@  discard block
 block discarded – undo
448 448
 	 */
449 449
 	public function bulk_footer() {
450 450
 		parent::bulk_footer();
451
-		$update_actions =  array(
452
-			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
453
-			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
451
+		$update_actions = array(
452
+			'plugins_page' => '<a href="'.self_admin_url('plugins.php').'" target="_parent">'.__('Return to Plugins page').'</a>',
453
+			'updates_page' => '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>'
454 454
 		);
455
-		if ( ! current_user_can( 'activate_plugins' ) )
456
-			unset( $update_actions['plugins_page'] );
455
+		if ( ! current_user_can('activate_plugins'))
456
+			unset($update_actions['plugins_page']);
457 457
 
458 458
 		/**
459 459
 		 * Filter the list of action links available following bulk plugin updates.
@@ -463,10 +463,10 @@  discard block
 block discarded – undo
463 463
 		 * @param array $update_actions Array of plugin action links.
464 464
 		 * @param array $plugin_info    Array of information for the last-updated plugin.
465 465
 		 */
466
-		$update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
466
+		$update_actions = apply_filters('update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info);
467 467
 
468
-		if ( ! empty($update_actions) )
469
-			$this->feedback(implode(' | ', (array)$update_actions));
468
+		if ( ! empty($update_actions))
469
+			$this->feedback(implode(' | ', (array) $update_actions));
470 470
 	}
471 471
 }
472 472
 
@@ -483,7 +483,7 @@  discard block
 block discarded – undo
483 483
 	 * @param string $title
484 484
 	 */
485 485
 	public function before($title = '') {
486
-		parent::before( $this->theme_info->display('Name') );
486
+		parent::before($this->theme_info->display('Name'));
487 487
 	}
488 488
 
489 489
 	/**
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 	 * @param string $title
492 492
 	 */
493 493
 	public function after($title = '') {
494
-		parent::after( $this->theme_info->display('Name') );
495
-		$this->decrement_update_count( 'theme' );
494
+		parent::after($this->theme_info->display('Name'));
495
+		$this->decrement_update_count('theme');
496 496
 	}
497 497
 
498 498
 	/**
@@ -500,12 +500,12 @@  discard block
 block discarded – undo
500 500
 	 */
501 501
 	public function bulk_footer() {
502 502
 		parent::bulk_footer();
503
-		$update_actions =  array(
504
-			'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
505
-			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
503
+		$update_actions = array(
504
+			'themes_page' => '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>',
505
+			'updates_page' => '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>'
506 506
 		);
507
-		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
508
-			unset( $update_actions['themes_page'] );
507
+		if ( ! current_user_can('switch_themes') && ! current_user_can('edit_theme_options'))
508
+			unset($update_actions['themes_page']);
509 509
 
510 510
 		/**
511 511
 		 * Filter the list of action links available following bulk theme updates.
@@ -515,10 +515,10 @@  discard block
 block discarded – undo
515 515
 		 * @param array $update_actions Array of theme action links.
516 516
 		 * @param array $theme_info     Array of information for the last-updated theme.
517 517
 		 */
518
-		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
518
+		$update_actions = apply_filters('update_bulk_theme_complete_actions', $update_actions, $this->theme_info);
519 519
 
520
-		if ( ! empty($update_actions) )
521
-			$this->feedback(implode(' | ', (array)$update_actions));
520
+		if ( ! empty($update_actions))
521
+			$this->feedback(implode(' | ', (array) $update_actions));
522 522
 	}
523 523
 }
524 524
 
@@ -538,7 +538,7 @@  discard block
 block discarded – undo
538 538
 	 * @param array $args
539 539
 	 */
540 540
 	public function __construct($args = array()) {
541
-		$defaults = array( 'type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '' );
541
+		$defaults = array('type' => 'web', 'url' => '', 'plugin' => '', 'nonce' => '', 'title' => '');
542 542
 		$args = wp_parse_args($args, $defaults);
543 543
 
544 544
 		$this->type = $args['type'];
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
 	 * @access public
552 552
 	 */
553 553
 	public function before() {
554
-		if ( !empty($this->api) )
555
-			$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
554
+		if ( ! empty($this->api))
555
+			$this->upgrader->strings['process_success'] = sprintf(__('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
556 556
 	}
557 557
 
558 558
 	/**
@@ -563,30 +563,30 @@  discard block
 block discarded – undo
563 563
 
564 564
 		$install_actions = array();
565 565
 
566
-		$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
566
+		$from = isset($_GET['from']) ? wp_unslash($_GET['from']) : 'plugins';
567 567
 
568
-		if ( 'import' == $from )
569
-			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin &amp; Run Importer' ) . '</a>';
568
+		if ('import' == $from)
569
+			$install_actions['activate_plugin'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&amp;from=import&amp;plugin='.urlencode($plugin_file), 'activate-plugin_'.$plugin_file).'" target="_parent">'.__('Activate Plugin &amp; Run Importer').'</a>';
570 570
 		else
571
-			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>';
571
+			$install_actions['activate_plugin'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&amp;plugin='.urlencode($plugin_file), 'activate-plugin_'.$plugin_file).'" target="_parent">'.__('Activate Plugin').'</a>';
572 572
 
573
-		if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
574
-			$install_actions['network_activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Network Activate' ) . '</a>';
575
-			unset( $install_actions['activate_plugin'] );
573
+		if (is_multisite() && current_user_can('manage_network_plugins')) {
574
+			$install_actions['network_activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&amp;networkwide=1&amp;plugin='.urlencode($plugin_file), 'activate-plugin_'.$plugin_file).'" target="_parent">'.__('Network Activate').'</a>';
575
+			unset($install_actions['activate_plugin']);
576 576
 		}
577 577
 
578
-		if ( 'import' == $from ) {
579
-			$install_actions['importers_page'] = '<a href="' . admin_url( 'import.php' ) . '" target="_parent">' . __( 'Return to Importers' ) . '</a>';
580
-		} elseif ( $this->type == 'web' ) {
581
-			$install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugin-install.php' ) . '" target="_parent">' . __( 'Return to Plugin Installer' ) . '</a>';
578
+		if ('import' == $from) {
579
+			$install_actions['importers_page'] = '<a href="'.admin_url('import.php').'" target="_parent">'.__('Return to Importers').'</a>';
580
+		} elseif ($this->type == 'web') {
581
+			$install_actions['plugins_page'] = '<a href="'.self_admin_url('plugin-install.php').'" target="_parent">'.__('Return to Plugin Installer').'</a>';
582 582
 		} else {
583
-			$install_actions['plugins_page'] = '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>';
583
+			$install_actions['plugins_page'] = '<a href="'.self_admin_url('plugins.php').'" target="_parent">'.__('Return to Plugins page').'</a>';
584 584
 		}
585 585
 
586
-		if ( ! $this->result || is_wp_error($this->result) ) {
587
-			unset( $install_actions['activate_plugin'], $install_actions['network_activate'] );
588
-		} elseif ( ! current_user_can( 'activate_plugins' ) ) {
589
-			unset( $install_actions['activate_plugin'] );
586
+		if ( ! $this->result || is_wp_error($this->result)) {
587
+			unset($install_actions['activate_plugin'], $install_actions['network_activate']);
588
+		} elseif ( ! current_user_can('activate_plugins')) {
589
+			unset($install_actions['activate_plugin']);
590 590
 		}
591 591
 
592 592
 		/**
@@ -600,10 +600,10 @@  discard block
 block discarded – undo
600 600
 		 *                                via upload.
601 601
 		 * @param string $plugin_file     Path to the plugin file.
602 602
 		 */
603
-		$install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file );
603
+		$install_actions = apply_filters('install_plugin_complete_actions', $install_actions, $this->api, $plugin_file);
604 604
 
605
-		if ( ! empty($install_actions) )
606
-			$this->feedback(implode(' | ', (array)$install_actions));
605
+		if ( ! empty($install_actions))
606
+			$this->feedback(implode(' | ', (array) $install_actions));
607 607
 	}
608 608
 }
609 609
 
@@ -623,7 +623,7 @@  discard block
 block discarded – undo
623 623
 	 * @param array $args
624 624
 	 */
625 625
 	public function __construct($args = array()) {
626
-		$defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' );
626
+		$defaults = array('type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '');
627 627
 		$args = wp_parse_args($args, $defaults);
628 628
 
629 629
 		$this->type = $args['type'];
@@ -636,49 +636,49 @@  discard block
 block discarded – undo
636 636
 	 * @access public
637 637
 	 */
638 638
 	public function before() {
639
-		if ( !empty($this->api) )
640
-			$this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
639
+		if ( ! empty($this->api))
640
+			$this->upgrader->strings['process_success'] = sprintf($this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
641 641
 	}
642 642
 
643 643
 	/**
644 644
 	 * @access public
645 645
 	 */
646 646
 	public function after() {
647
-		if ( empty($this->upgrader->result['destination_name']) )
647
+		if (empty($this->upgrader->result['destination_name']))
648 648
 			return;
649 649
 
650 650
 		$theme_info = $this->upgrader->theme_info();
651
-		if ( empty( $theme_info ) )
651
+		if (empty($theme_info))
652 652
 			return;
653 653
 
654 654
 		$name       = $theme_info->display('Name');
655 655
 		$stylesheet = $this->upgrader->result['destination_name'];
656 656
 		$template   = $theme_info->get_template();
657 657
 
658
-		$activate_link = add_query_arg( array(
658
+		$activate_link = add_query_arg(array(
659 659
 			'action'     => 'activate',
660
-			'template'   => urlencode( $template ),
661
-			'stylesheet' => urlencode( $stylesheet ),
662
-		), admin_url('themes.php') );
663
-		$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
660
+			'template'   => urlencode($template),
661
+			'stylesheet' => urlencode($stylesheet),
662
+		), admin_url('themes.php'));
663
+		$activate_link = wp_nonce_url($activate_link, 'switch-theme_'.$stylesheet);
664 664
 
665 665
 		$install_actions = array();
666 666
 
667
-		if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
668
-			$install_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
667
+		if (current_user_can('edit_theme_options') && current_user_can('customize')) {
668
+			$install_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Live Preview').'</span><span class="screen-reader-text">'.sprintf(__('Live Preview &#8220;%s&#8221;'), $name).'</span></a>';
669 669
 		}
670
-		$install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
670
+		$install_actions['activate'] = '<a href="'.esc_url($activate_link).'" class="activatelink"><span aria-hidden="true">'.__('Activate').'</span><span class="screen-reader-text">'.sprintf(__('Activate &#8220;%s&#8221;'), $name).'</span></a>';
671 671
 
672
-		if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
673
-			$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
672
+		if (is_network_admin() && current_user_can('manage_network_themes'))
673
+			$install_actions['network_enable'] = '<a href="'.esc_url(wp_nonce_url('themes.php?action=enable&amp;theme='.urlencode($stylesheet), 'enable-theme_'.$stylesheet)).'" target="_parent">'.__('Network Enable').'</a>';
674 674
 
675
-		if ( $this->type == 'web' )
676
-			$install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>';
677
-		elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
678
-			$install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
675
+		if ($this->type == 'web')
676
+			$install_actions['themes_page'] = '<a href="'.self_admin_url('theme-install.php').'" target="_parent">'.__('Return to Theme Installer').'</a>';
677
+		elseif (current_user_can('switch_themes') || current_user_can('edit_theme_options'))
678
+			$install_actions['themes_page'] = '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>';
679 679
 
680
-		if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
681
-			unset( $install_actions['activate'], $install_actions['preview'] );
680
+		if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can('switch_themes'))
681
+			unset($install_actions['activate'], $install_actions['preview']);
682 682
 
683 683
 		/**
684 684
 		 * Filter the list of action links available following a single theme installation.
@@ -690,9 +690,9 @@  discard block
 block discarded – undo
690 690
 		 * @param string   $stylesheet      Theme directory name.
691 691
 		 * @param WP_Theme $theme_info      Theme object.
692 692
 		 */
693
-		$install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info );
694
-		if ( ! empty($install_actions) )
695
-			$this->feedback(implode(' | ', (array)$install_actions));
693
+		$install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info);
694
+		if ( ! empty($install_actions))
695
+			$this->feedback(implode(' | ', (array) $install_actions));
696 696
 	}
697 697
 }
698 698
 
@@ -711,7 +711,7 @@  discard block
 block discarded – undo
711 711
 	 * @param array $args
712 712
 	 */
713 713
 	public function __construct($args = array()) {
714
-		$defaults = array( 'url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme') );
714
+		$defaults = array('url' => '', 'theme' => '', 'nonce' => '', 'title' => __('Update Theme'));
715 715
 		$args = wp_parse_args($args, $defaults);
716 716
 
717 717
 		$this->theme = $args['theme'];
@@ -723,37 +723,37 @@  discard block
 block discarded – undo
723 723
 	 * @access public
724 724
 	 */
725 725
 	public function after() {
726
-		$this->decrement_update_count( 'theme' );
726
+		$this->decrement_update_count('theme');
727 727
 
728 728
 		$update_actions = array();
729
-		if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) {
729
+		if ( ! empty($this->upgrader->result['destination_name']) && $theme_info = $this->upgrader->theme_info()) {
730 730
 			$name       = $theme_info->display('Name');
731 731
 			$stylesheet = $this->upgrader->result['destination_name'];
732 732
 			$template   = $theme_info->get_template();
733 733
 
734
-			$activate_link = add_query_arg( array(
734
+			$activate_link = add_query_arg(array(
735 735
 				'action'     => 'activate',
736
-				'template'   => urlencode( $template ),
737
-				'stylesheet' => urlencode( $stylesheet ),
738
-			), admin_url('themes.php') );
739
-			$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet );
740
-
741
-			if ( get_stylesheet() == $stylesheet ) {
742
-				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
743
-					$update_actions['preview']  = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Customize' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Customize &#8220;%s&#8221;' ), $name ) . '</span></a>';
736
+				'template'   => urlencode($template),
737
+				'stylesheet' => urlencode($stylesheet),
738
+			), admin_url('themes.php'));
739
+			$activate_link = wp_nonce_url($activate_link, 'switch-theme_'.$stylesheet);
740
+
741
+			if (get_stylesheet() == $stylesheet) {
742
+				if (current_user_can('edit_theme_options') && current_user_can('customize')) {
743
+					$update_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Customize').'</span><span class="screen-reader-text">'.sprintf(__('Customize &#8220;%s&#8221;'), $name).'</span></a>';
744 744
 				}
745
-			} elseif ( current_user_can( 'switch_themes' ) ) {
746
-				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
747
-					$update_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name ) . '</span></a>';
745
+			} elseif (current_user_can('switch_themes')) {
746
+				if (current_user_can('edit_theme_options') && current_user_can('customize')) {
747
+					$update_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Live Preview').'</span><span class="screen-reader-text">'.sprintf(__('Live Preview &#8220;%s&#8221;'), $name).'</span></a>';
748 748
 				}
749
-				$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
749
+				$update_actions['activate'] = '<a href="'.esc_url($activate_link).'" class="activatelink"><span aria-hidden="true">'.__('Activate').'</span><span class="screen-reader-text">'.sprintf(__('Activate &#8220;%s&#8221;'), $name).'</span></a>';
750 750
 			}
751 751
 
752
-			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
753
-				unset( $update_actions['preview'], $update_actions['activate'] );
752
+			if ( ! $this->result || is_wp_error($this->result) || is_network_admin())
753
+				unset($update_actions['preview'], $update_actions['activate']);
754 754
 		}
755 755
 
756
-		$update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
756
+		$update_actions['themes_page'] = '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>';
757 757
 
758 758
 		/**
759 759
 		 * Filter the list of action links available following a single theme update.
@@ -763,10 +763,10 @@  discard block
 block discarded – undo
763 763
 		 * @param array  $update_actions Array of theme action links.
764 764
 		 * @param string $theme          Theme directory name.
765 765
 		 */
766
-		$update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
766
+		$update_actions = apply_filters('update_theme_complete_actions', $update_actions, $this->theme);
767 767
 
768
-		if ( ! empty($update_actions) )
769
-			$this->feedback(implode(' | ', (array)$update_actions));
768
+		if ( ! empty($update_actions))
769
+			$this->feedback(implode(' | ', (array) $update_actions));
770 770
 	}
771 771
 }
772 772
 
@@ -787,35 +787,35 @@  discard block
 block discarded – undo
787 787
 	 *
788 788
 	 * @param array $args
789 789
 	 */
790
-	public function __construct( $args = array() ) {
791
-		$defaults = array( 'url' => '', 'nonce' => '', 'title' => __( 'Update Translations' ), 'skip_header_footer' => false );
792
-		$args = wp_parse_args( $args, $defaults );
793
-		if ( $args['skip_header_footer'] ) {
790
+	public function __construct($args = array()) {
791
+		$defaults = array('url' => '', 'nonce' => '', 'title' => __('Update Translations'), 'skip_header_footer' => false);
792
+		$args = wp_parse_args($args, $defaults);
793
+		if ($args['skip_header_footer']) {
794 794
 			$this->done_header = true;
795 795
 			$this->done_footer = true;
796 796
 			$this->display_footer_actions = false;
797 797
 		}
798
-		parent::__construct( $args );
798
+		parent::__construct($args);
799 799
 	}
800 800
 
801 801
 	/**
802 802
 	 * @access public
803 803
 	 */
804 804
 	public function before() {
805
-		$name = $this->upgrader->get_name_for_update( $this->language_update );
805
+		$name = $this->upgrader->get_name_for_update($this->language_update);
806 806
 
807 807
 		echo '<div class="update-messages lp-show-latest">';
808 808
 
809
-		printf( '<h2>' . __( 'Updating translations for %1$s (%2$s)&#8230;' ) . '</h2>', $name, $this->language_update->language );
809
+		printf('<h2>'.__('Updating translations for %1$s (%2$s)&#8230;').'</h2>', $name, $this->language_update->language);
810 810
 	}
811 811
 
812 812
 	/**
813 813
 	 *
814 814
 	 * @param string|WP_Error $error
815 815
 	 */
816
-	public function error( $error ) {
816
+	public function error($error) {
817 817
 		echo '<div class="lp-error">';
818
-		parent::error( $error );
818
+		parent::error($error);
819 819
 		echo '</div>';
820 820
 	}
821 821
 
@@ -830,9 +830,9 @@  discard block
 block discarded – undo
830 830
 	 * @access public
831 831
 	 */
832 832
 	public function bulk_footer() {
833
-		$this->decrement_update_count( 'translation' );
833
+		$this->decrement_update_count('translation');
834 834
 		$update_actions = array();
835
-		$update_actions['updates_page'] = '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>';
835
+		$update_actions['updates_page'] = '<a href="'.self_admin_url('update-core.php').'" target="_parent">'.__('Return to WordPress Updates page').'</a>';
836 836
 
837 837
 		/**
838 838
 		 * Filter the list of action links available following a translations update.
@@ -841,10 +841,10 @@  discard block
 block discarded – undo
841 841
 		 *
842 842
 		 * @param array $update_actions Array of translations update links.
843 843
 		 */
844
-		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
844
+		$update_actions = apply_filters('update_translations_complete_actions', $update_actions);
845 845
 
846
-		if ( $update_actions && $this->display_footer_actions )
847
-			$this->feedback( implode( ' | ', $update_actions ) );
846
+		if ($update_actions && $this->display_footer_actions)
847
+			$this->feedback(implode(' | ', $update_actions));
848 848
 	}
849 849
 }
850 850
 
@@ -868,14 +868,14 @@  discard block
 block discarded – undo
868 868
 	 * @param bool   $allow_relaxed_file_ownership
869 869
 	 * @return bool
870 870
 	 */
871
-	public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) {
872
-		if ( $context ) {
871
+	public function request_filesystem_credentials($error = false, $context = '', $allow_relaxed_file_ownership = false) {
872
+		if ($context) {
873 873
 			$this->options['context'] = $context;
874 874
 		}
875 875
 		// TODO: fix up request_filesystem_credentials(), or split it, to allow us to request a no-output version
876 876
 		// This will output a credentials form in event of failure, We don't want that, so just hide with a buffer
877 877
 		ob_start();
878
-		$result = parent::request_filesystem_credentials( $error, $context, $allow_relaxed_file_ownership );
878
+		$result = parent::request_filesystem_credentials($error, $context, $allow_relaxed_file_ownership);
879 879
 		ob_end_clean();
880 880
 		return $result;
881 881
 	}
@@ -892,37 +892,37 @@  discard block
 block discarded – undo
892 892
 	/**
893 893
 	 * @param string|array|WP_Error $data
894 894
 	 */
895
-	public function feedback( $data ) {
896
-		if ( is_wp_error( $data ) ) {
895
+	public function feedback($data) {
896
+		if (is_wp_error($data)) {
897 897
 			$string = $data->get_error_message();
898
-		} elseif ( is_array( $data ) ) {
898
+		} elseif (is_array($data)) {
899 899
 			return;
900 900
 		} else {
901 901
 			$string = $data;
902 902
 		}
903
-		if ( ! empty( $this->upgrader->strings[ $string ] ) )
904
-			$string = $this->upgrader->strings[ $string ];
903
+		if ( ! empty($this->upgrader->strings[$string]))
904
+			$string = $this->upgrader->strings[$string];
905 905
 
906
-		if ( strpos( $string, '%' ) !== false ) {
906
+		if (strpos($string, '%') !== false) {
907 907
 			$args = func_get_args();
908
-			$args = array_splice( $args, 1 );
909
-			if ( ! empty( $args ) )
910
-				$string = vsprintf( $string, $args );
908
+			$args = array_splice($args, 1);
909
+			if ( ! empty($args))
910
+				$string = vsprintf($string, $args);
911 911
 		}
912 912
 
913
-		$string = trim( $string );
913
+		$string = trim($string);
914 914
 
915 915
 		// Only allow basic HTML in the messages, as it'll be used in emails/logs rather than direct browser output.
916
-		$string = wp_kses( $string, array(
916
+		$string = wp_kses($string, array(
917 917
 			'a' => array(
918 918
 				'href' => true
919 919
 			),
920 920
 			'br' => true,
921 921
 			'em' => true,
922 922
 			'strong' => true,
923
-		) );
923
+		));
924 924
 
925
-		if ( empty( $string ) )
925
+		if (empty($string))
926 926
 			return;
927 927
 
928 928
 		$this->messages[] = $string;
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 	 */
941 941
 	public function footer() {
942 942
 		$output = ob_get_clean();
943
-		if ( ! empty( $output ) )
944
-			$this->feedback( $output );
943
+		if ( ! empty($output))
944
+			$this->feedback($output);
945 945
 	}
946 946
 }
Please login to merge, or discard this patch.
Braces   +112 added lines, -78 removed lines patch added patch discarded remove patch
@@ -35,8 +35,9 @@  discard block
 block discarded – undo
35 35
 	 * @param WP_Upgrader $upgrader
36 36
 	 */
37 37
 	public function set_upgrader(&$upgrader) {
38
-		if ( is_object($upgrader) )
39
-			$this->upgrader =& $upgrader;
38
+		if ( is_object($upgrader) ) {
39
+					$this->upgrader =& $upgrader;
40
+		}
40 41
 		$this->add_strings();
41 42
 	}
42 43
 
@@ -103,16 +104,18 @@  discard block
 block discarded – undo
103 104
 	 * @param string|WP_Error $errors
104 105
 	 */
105 106
 	public function error($errors) {
106
-		if ( ! $this->done_header )
107
-			$this->header();
107
+		if ( ! $this->done_header ) {
108
+					$this->header();
109
+		}
108 110
 		if ( is_string($errors) ) {
109 111
 			$this->feedback($errors);
110 112
 		} elseif ( is_wp_error($errors) && $errors->get_error_code() ) {
111 113
 			foreach ( $errors->get_error_messages() as $message ) {
112
-				if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) )
113
-					$this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
114
-				else
115
-					$this->feedback($message);
114
+				if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) {
115
+									$this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) );
116
+				} else {
117
+									$this->feedback($message);
118
+				}
116 119
 			}
117 120
 		}
118 121
 	}
@@ -122,8 +125,9 @@  discard block
 block discarded – undo
122 125
 	 * @param string $string
123 126
 	 */
124 127
 	public function feedback($string) {
125
-		if ( isset( $this->upgrader->strings[$string] ) )
126
-			$string = $this->upgrader->strings[$string];
128
+		if ( isset( $this->upgrader->strings[$string] ) ) {
129
+					$string = $this->upgrader->strings[$string];
130
+		}
127 131
 
128 132
 		if ( strpos($string, '%') !== false ) {
129 133
 			$args = func_get_args();
@@ -134,8 +138,9 @@  discard block
 block discarded – undo
134 138
 				$string = vsprintf($string, $args);
135 139
 			}
136 140
 		}
137
-		if ( empty($string) )
138
-			return;
141
+		if ( empty($string) ) {
142
+					return;
143
+		}
139 144
 		show_message($string);
140 145
 	}
141 146
 
@@ -234,8 +239,9 @@  discard block
 block discarded – undo
234 239
 			'activate_plugin' => '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $this->plugin ), 'activate-plugin_' . $this->plugin) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>',
235 240
 			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>'
236 241
 		);
237
-		if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) )
238
-			unset( $update_actions['activate_plugin'] );
242
+		if ( $this->plugin_active || ! $this->result || is_wp_error( $this->result ) || ! current_user_can( 'activate_plugins' ) ) {
243
+					unset( $update_actions['activate_plugin'] );
244
+		}
239 245
 
240 246
 		/**
241 247
 		 * Filter the list of action links available following a single plugin update.
@@ -247,8 +253,9 @@  discard block
 block discarded – undo
247 253
 		 */
248 254
 		$update_actions = apply_filters( 'update_plugin_complete_actions', $update_actions, $this->plugin );
249 255
 
250
-		if ( ! empty($update_actions) )
251
-			$this->feedback(implode(' | ', (array)$update_actions));
256
+		if ( ! empty($update_actions) ) {
257
+					$this->feedback(implode(' | ', (array)$update_actions));
258
+		}
252 259
 	}
253 260
 }
254 261
 
@@ -295,8 +302,9 @@  discard block
 block discarded – undo
295 302
 	 * @param string $string
296 303
 	 */
297 304
 	public function feedback($string) {
298
-		if ( isset( $this->upgrader->strings[$string] ) )
299
-			$string = $this->upgrader->strings[$string];
305
+		if ( isset( $this->upgrader->strings[$string] ) ) {
306
+					$string = $this->upgrader->strings[$string];
307
+		}
300 308
 
301 309
 		if ( strpos($string, '%') !== false ) {
302 310
 			$args = func_get_args();
@@ -307,12 +315,14 @@  discard block
 block discarded – undo
307 315
 				$string = vsprintf($string, $args);
308 316
 			}
309 317
 		}
310
-		if ( empty($string) )
311
-			return;
312
-		if ( $this->in_loop )
313
-			echo "$string<br />\n";
314
-		else
315
-			echo "<p>$string</p>\n";
318
+		if ( empty($string) ) {
319
+					return;
320
+		}
321
+		if ( $this->in_loop ) {
322
+					echo "$string<br />\n";
323
+		} else {
324
+					echo "<p>$string</p>\n";
325
+		}
316 326
 	}
317 327
 
318 328
 	/**
@@ -334,16 +344,18 @@  discard block
 block discarded – undo
334 344
 	 * @param string|WP_Error $error
335 345
 	 */
336 346
 	public function error($error) {
337
-		if ( is_string($error) && isset( $this->upgrader->strings[$error] ) )
338
-			$this->error = $this->upgrader->strings[$error];
347
+		if ( is_string($error) && isset( $this->upgrader->strings[$error] ) ) {
348
+					$this->error = $this->upgrader->strings[$error];
349
+		}
339 350
 
340 351
 		if ( is_wp_error($error) ) {
341 352
 			$messages = array();
342 353
 			foreach ( $error->get_error_messages() as $emessage ) {
343
-				if ( $error->get_error_data() && is_string( $error->get_error_data() ) )
344
-					$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
345
-				else
346
-					$messages[] = $emessage;
354
+				if ( $error->get_error_data() && is_string( $error->get_error_data() ) ) {
355
+									$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
356
+				} else {
357
+									$messages[] = $emessage;
358
+				}
347 359
 			}
348 360
 			$this->error = implode(', ', $messages);
349 361
 		}
@@ -392,8 +404,9 @@  discard block
 block discarded – undo
392 404
 			echo '<script type="text/javascript">jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').show();</script>';
393 405
 		}
394 406
 		if ( $this->result && ! is_wp_error( $this->result ) ) {
395
-			if ( ! $this->error )
396
-				echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
407
+			if ( ! $this->error ) {
408
+							echo '<div class="updated"><p>' . sprintf($this->upgrader->strings['skin_update_successful'], $title, 'jQuery(\'#progress-' . esc_js($this->upgrader->update_current) . '\').toggle();jQuery(\'span\', this).toggle(); return false;') . '</p></div>';
409
+			}
397 410
 			echo '<script type="text/javascript">jQuery(\'.waiting-' . esc_js($this->upgrader->update_current) . '\').hide();</script>';
398 411
 		}
399 412
 
@@ -452,8 +465,9 @@  discard block
 block discarded – undo
452 465
 			'plugins_page' => '<a href="' . self_admin_url( 'plugins.php' ) . '" target="_parent">' . __( 'Return to Plugins page' ) . '</a>',
453 466
 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
454 467
 		);
455
-		if ( ! current_user_can( 'activate_plugins' ) )
456
-			unset( $update_actions['plugins_page'] );
468
+		if ( ! current_user_can( 'activate_plugins' ) ) {
469
+					unset( $update_actions['plugins_page'] );
470
+		}
457 471
 
458 472
 		/**
459 473
 		 * Filter the list of action links available following bulk plugin updates.
@@ -465,8 +479,9 @@  discard block
 block discarded – undo
465 479
 		 */
466 480
 		$update_actions = apply_filters( 'update_bulk_plugins_complete_actions', $update_actions, $this->plugin_info );
467 481
 
468
-		if ( ! empty($update_actions) )
469
-			$this->feedback(implode(' | ', (array)$update_actions));
482
+		if ( ! empty($update_actions) ) {
483
+					$this->feedback(implode(' | ', (array)$update_actions));
484
+		}
470 485
 	}
471 486
 }
472 487
 
@@ -504,8 +519,9 @@  discard block
 block discarded – undo
504 519
 			'themes_page' => '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>',
505 520
 			'updates_page' => '<a href="' . self_admin_url( 'update-core.php' ) . '" target="_parent">' . __( 'Return to WordPress Updates page' ) . '</a>'
506 521
 		);
507
-		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) )
508
-			unset( $update_actions['themes_page'] );
522
+		if ( ! current_user_can( 'switch_themes' ) && ! current_user_can( 'edit_theme_options' ) ) {
523
+					unset( $update_actions['themes_page'] );
524
+		}
509 525
 
510 526
 		/**
511 527
 		 * Filter the list of action links available following bulk theme updates.
@@ -517,8 +533,9 @@  discard block
 block discarded – undo
517 533
 		 */
518 534
 		$update_actions = apply_filters( 'update_bulk_theme_complete_actions', $update_actions, $this->theme_info );
519 535
 
520
-		if ( ! empty($update_actions) )
521
-			$this->feedback(implode(' | ', (array)$update_actions));
536
+		if ( ! empty($update_actions) ) {
537
+					$this->feedback(implode(' | ', (array)$update_actions));
538
+		}
522 539
 	}
523 540
 }
524 541
 
@@ -551,8 +568,9 @@  discard block
 block discarded – undo
551 568
 	 * @access public
552 569
 	 */
553 570
 	public function before() {
554
-		if ( !empty($this->api) )
555
-			$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
571
+		if ( !empty($this->api) ) {
572
+					$this->upgrader->strings['process_success'] = sprintf( __('Successfully installed the plugin <strong>%s %s</strong>.'), $this->api->name, $this->api->version);
573
+		}
556 574
 	}
557 575
 
558 576
 	/**
@@ -565,10 +583,11 @@  discard block
 block discarded – undo
565 583
 
566 584
 		$from = isset($_GET['from']) ? wp_unslash( $_GET['from'] ) : 'plugins';
567 585
 
568
-		if ( 'import' == $from )
569
-			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin &amp; Run Importer' ) . '</a>';
570
-		else
571
-			$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>';
586
+		if ( 'import' == $from ) {
587
+					$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;from=import&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin &amp; Run Importer' ) . '</a>';
588
+		} else {
589
+					$install_actions['activate_plugin'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Activate Plugin' ) . '</a>';
590
+		}
572 591
 
573 592
 		if ( is_multisite() && current_user_can( 'manage_network_plugins' ) ) {
574 593
 			$install_actions['network_activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&amp;networkwide=1&amp;plugin=' . urlencode( $plugin_file ), 'activate-plugin_' . $plugin_file ) . '" target="_parent">' . __( 'Network Activate' ) . '</a>';
@@ -602,8 +621,9 @@  discard block
 block discarded – undo
602 621
 		 */
603 622
 		$install_actions = apply_filters( 'install_plugin_complete_actions', $install_actions, $this->api, $plugin_file );
604 623
 
605
-		if ( ! empty($install_actions) )
606
-			$this->feedback(implode(' | ', (array)$install_actions));
624
+		if ( ! empty($install_actions) ) {
625
+					$this->feedback(implode(' | ', (array)$install_actions));
626
+		}
607 627
 	}
608 628
 }
609 629
 
@@ -636,20 +656,23 @@  discard block
 block discarded – undo
636 656
 	 * @access public
637 657
 	 */
638 658
 	public function before() {
639
-		if ( !empty($this->api) )
640
-			$this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
659
+		if ( !empty($this->api) ) {
660
+					$this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version);
661
+		}
641 662
 	}
642 663
 
643 664
 	/**
644 665
 	 * @access public
645 666
 	 */
646 667
 	public function after() {
647
-		if ( empty($this->upgrader->result['destination_name']) )
648
-			return;
668
+		if ( empty($this->upgrader->result['destination_name']) ) {
669
+					return;
670
+		}
649 671
 
650 672
 		$theme_info = $this->upgrader->theme_info();
651
-		if ( empty( $theme_info ) )
652
-			return;
673
+		if ( empty( $theme_info ) ) {
674
+					return;
675
+		}
653 676
 
654 677
 		$name       = $theme_info->display('Name');
655 678
 		$stylesheet = $this->upgrader->result['destination_name'];
@@ -669,16 +692,19 @@  discard block
 block discarded – undo
669 692
 		}
670 693
 		$install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
671 694
 
672
-		if ( is_network_admin() && current_user_can( 'manage_network_themes' ) )
673
-			$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
695
+		if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) {
696
+					$install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&amp;theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>';
697
+		}
674 698
 
675
-		if ( $this->type == 'web' )
676
-			$install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>';
677
-		elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
678
-			$install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
699
+		if ( $this->type == 'web' ) {
700
+					$install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>';
701
+		} elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) {
702
+					$install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
703
+		}
679 704
 
680
-		if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) )
681
-			unset( $install_actions['activate'], $install_actions['preview'] );
705
+		if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) ) {
706
+					unset( $install_actions['activate'], $install_actions['preview'] );
707
+		}
682 708
 
683 709
 		/**
684 710
 		 * Filter the list of action links available following a single theme installation.
@@ -691,8 +717,9 @@  discard block
 block discarded – undo
691 717
 		 * @param WP_Theme $theme_info      Theme object.
692 718
 		 */
693 719
 		$install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info );
694
-		if ( ! empty($install_actions) )
695
-			$this->feedback(implode(' | ', (array)$install_actions));
720
+		if ( ! empty($install_actions) ) {
721
+					$this->feedback(implode(' | ', (array)$install_actions));
722
+		}
696 723
 	}
697 724
 }
698 725
 
@@ -749,8 +776,9 @@  discard block
 block discarded – undo
749 776
 				$update_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate &#8220;%s&#8221;' ), $name ) . '</span></a>';
750 777
 			}
751 778
 
752
-			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() )
753
-				unset( $update_actions['preview'], $update_actions['activate'] );
779
+			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {
780
+							unset( $update_actions['preview'], $update_actions['activate'] );
781
+			}
754 782
 		}
755 783
 
756 784
 		$update_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>';
@@ -765,8 +793,9 @@  discard block
 block discarded – undo
765 793
 		 */
766 794
 		$update_actions = apply_filters( 'update_theme_complete_actions', $update_actions, $this->theme );
767 795
 
768
-		if ( ! empty($update_actions) )
769
-			$this->feedback(implode(' | ', (array)$update_actions));
796
+		if ( ! empty($update_actions) ) {
797
+					$this->feedback(implode(' | ', (array)$update_actions));
798
+		}
770 799
 	}
771 800
 }
772 801
 
@@ -843,8 +872,9 @@  discard block
 block discarded – undo
843 872
 		 */
844 873
 		$update_actions = apply_filters( 'update_translations_complete_actions', $update_actions );
845 874
 
846
-		if ( $update_actions && $this->display_footer_actions )
847
-			$this->feedback( implode( ' | ', $update_actions ) );
875
+		if ( $update_actions && $this->display_footer_actions ) {
876
+					$this->feedback( implode( ' | ', $update_actions ) );
877
+		}
848 878
 	}
849 879
 }
850 880
 
@@ -900,14 +930,16 @@  discard block
 block discarded – undo
900 930
 		} else {
901 931
 			$string = $data;
902 932
 		}
903
-		if ( ! empty( $this->upgrader->strings[ $string ] ) )
904
-			$string = $this->upgrader->strings[ $string ];
933
+		if ( ! empty( $this->upgrader->strings[ $string ] ) ) {
934
+					$string = $this->upgrader->strings[ $string ];
935
+		}
905 936
 
906 937
 		if ( strpos( $string, '%' ) !== false ) {
907 938
 			$args = func_get_args();
908 939
 			$args = array_splice( $args, 1 );
909
-			if ( ! empty( $args ) )
910
-				$string = vsprintf( $string, $args );
940
+			if ( ! empty( $args ) ) {
941
+							$string = vsprintf( $string, $args );
942
+			}
911 943
 		}
912 944
 
913 945
 		$string = trim( $string );
@@ -922,8 +954,9 @@  discard block
 block discarded – undo
922 954
 			'strong' => true,
923 955
 		) );
924 956
 
925
-		if ( empty( $string ) )
926
-			return;
957
+		if ( empty( $string ) ) {
958
+					return;
959
+		}
927 960
 
928 961
 		$this->messages[] = $string;
929 962
 	}
@@ -940,7 +973,8 @@  discard block
 block discarded – undo
940 973
 	 */
941 974
 	public function footer() {
942 975
 		$output = ob_get_clean();
943
-		if ( ! empty( $output ) )
944
-			$this->feedback( $output );
976
+		if ( ! empty( $output ) ) {
977
+					$this->feedback( $output );
978
+		}
945 979
 	}
946 980
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/dashboard.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1277,7 +1277,7 @@
 block discarded – undo
1277 1277
  *
1278 1278
  * @global string $wp_version
1279 1279
  *
1280
- * @return array|bool False on failure, array of browser data on success.
1280
+ * @return string False on failure, array of browser data on success.
1281 1281
  */
1282 1282
 function wp_check_browser_version() {
1283 1283
 	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
Please login to merge, or discard this patch.
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Dashboard Widget Administration Screen API
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Dashboard Widget Administration Screen API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Registers dashboard widgets.
@@ -1353,13 +1353,13 @@  discard block
 block discarded – undo
1353 1353
 	}
1354 1354
 
1355 1355
 	/**
1356
-	* Filter the notice output for the 'Browse Happy' nag meta box.
1357
-	*
1358
-	* @since 3.2.0
1359
-	*
1360
-	* @param string $notice   The notice content.
1361
-	* @param array  $response An array containing web browser information.
1362
-	*/
1356
+	 * Filter the notice output for the 'Browse Happy' nag meta box.
1357
+	 *
1358
+	 * @since 3.2.0
1359
+	 *
1360
+	 * @param string $notice   The notice content.
1361
+	 * @param array  $response An array containing web browser information.
1362
+	 */
1363 1363
 	echo apply_filters( 'browse-happy-notice', $notice, $response );
1364 1364
 }
1365 1365
 
Please login to merge, or discard this patch.
Spacing   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -26,43 +26,43 @@  discard block
 block discarded – undo
26 26
 
27 27
 	$response = wp_check_browser_version();
28 28
 
29
-	if ( $response && $response['upgrade'] ) {
30
-		add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
31
-		if ( $response['insecure'] )
32
-			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
29
+	if ($response && $response['upgrade']) {
30
+		add_filter('postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class');
31
+		if ($response['insecure'])
32
+			wp_add_dashboard_widget('dashboard_browser_nag', __('You are using an insecure browser!'), 'wp_dashboard_browser_nag');
33 33
 		else
34
-			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
34
+			wp_add_dashboard_widget('dashboard_browser_nag', __('Your browser is out of date!'), 'wp_dashboard_browser_nag');
35 35
 	}
36 36
 
37 37
 	// Right Now
38
-	if ( is_blog_admin() && current_user_can('edit_posts') )
39
-		wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
38
+	if (is_blog_admin() && current_user_can('edit_posts'))
39
+		wp_add_dashboard_widget('dashboard_right_now', __('At a Glance'), 'wp_dashboard_right_now');
40 40
 
41
-	if ( is_network_admin() )
42
-		wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
41
+	if (is_network_admin())
42
+		wp_add_dashboard_widget('network_dashboard_right_now', __('Right Now'), 'wp_network_dashboard_right_now');
43 43
 
44 44
 	// Activity Widget
45
-	if ( is_blog_admin() ) {
46
-		wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' );
45
+	if (is_blog_admin()) {
46
+		wp_add_dashboard_widget('dashboard_activity', __('Activity'), 'wp_dashboard_site_activity');
47 47
 	}
48 48
 
49 49
 	// QuickPress Widget
50
-	if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
51
-		$quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Drafts' ) );
52
-		wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' );
50
+	if (is_blog_admin() && current_user_can(get_post_type_object('post')->cap->create_posts)) {
51
+		$quick_draft_title = sprintf('<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __('Quick Draft'), __('Drafts'));
52
+		wp_add_dashboard_widget('dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press');
53 53
 	}
54 54
 
55 55
 	// WordPress News
56
-	wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress News' ), 'wp_dashboard_primary' );
56
+	wp_add_dashboard_widget('dashboard_primary', __('WordPress News'), 'wp_dashboard_primary');
57 57
 
58
-	if ( is_network_admin() ) {
58
+	if (is_network_admin()) {
59 59
 
60 60
 		/**
61 61
 		 * Fires after core widgets for the Network Admin dashboard have been registered.
62 62
 		 *
63 63
 		 * @since 3.1.0
64 64
 		 */
65
-		do_action( 'wp_network_dashboard_setup' );
65
+		do_action('wp_network_dashboard_setup');
66 66
 
67 67
 		/**
68 68
 		 * Filter the list of widgets to load for the Network Admin dashboard.
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
 		 *
72 72
 		 * @param array $dashboard_widgets An array of dashboard widgets.
73 73
 		 */
74
-		$dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() );
75
-	} elseif ( is_user_admin() ) {
74
+		$dashboard_widgets = apply_filters('wp_network_dashboard_widgets', array());
75
+	} elseif (is_user_admin()) {
76 76
 
77 77
 		/**
78 78
 		 * Fires after core widgets for the User Admin dashboard have been registered.
79 79
 		 *
80 80
 		 * @since 3.1.0
81 81
 		 */
82
-		do_action( 'wp_user_dashboard_setup' );
82
+		do_action('wp_user_dashboard_setup');
83 83
 
84 84
 		/**
85 85
 		 * Filter the list of widgets to load for the User Admin dashboard.
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 		 *
89 89
 		 * @param array $dashboard_widgets An array of dashboard widgets.
90 90
 		 */
91
-		$dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() );
91
+		$dashboard_widgets = apply_filters('wp_user_dashboard_widgets', array());
92 92
 	} else {
93 93
 
94 94
 		/**
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 *
97 97
 		 * @since 2.5.0
98 98
 		 */
99
-		do_action( 'wp_dashboard_setup' );
99
+		do_action('wp_dashboard_setup');
100 100
 
101 101
 		/**
102 102
 		 * Filter the list of widgets to load for the admin dashboard.
@@ -105,28 +105,28 @@  discard block
 block discarded – undo
105 105
 		 *
106 106
 		 * @param array $dashboard_widgets An array of dashboard widgets.
107 107
 		 */
108
-		$dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() );
108
+		$dashboard_widgets = apply_filters('wp_dashboard_widgets', array());
109 109
 	}
110 110
 
111
-	foreach ( $dashboard_widgets as $widget_id ) {
112
-		$name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>';
113
-		wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] );
111
+	foreach ($dashboard_widgets as $widget_id) {
112
+		$name = empty($wp_registered_widgets[$widget_id]['all_link']) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name']." <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>".__('View all').'</a>';
113
+		wp_add_dashboard_widget($widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback']);
114 114
 	}
115 115
 
116
-	if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) {
117
-		check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' );
116
+	if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id'])) {
117
+		check_admin_referer('edit-dashboard-widget_'.$_POST['widget_id'], 'dashboard-widget-nonce');
118 118
 		ob_start(); // hack - but the same hack wp-admin/widgets.php uses
119
-		wp_dashboard_trigger_widget_control( $_POST['widget_id'] );
119
+		wp_dashboard_trigger_widget_control($_POST['widget_id']);
120 120
 		ob_end_clean();
121
-		wp_redirect( remove_query_arg( 'edit' ) );
121
+		wp_redirect(remove_query_arg('edit'));
122 122
 		exit;
123 123
 	}
124 124
 
125 125
 	/** This action is documented in wp-admin/edit-form-advanced.php */
126
-	do_action( 'do_meta_boxes', $screen->id, 'normal', '' );
126
+	do_action('do_meta_boxes', $screen->id, 'normal', '');
127 127
 
128 128
 	/** This action is documented in wp-admin/edit-form-advanced.php */
129
-	do_action( 'do_meta_boxes', $screen->id, 'side', '' );
129
+	do_action('do_meta_boxes', $screen->id, 'side', '');
130 130
 }
131 131
 
132 132
 /**
@@ -144,33 +144,33 @@  discard block
 block discarded – undo
144 144
  * @param array    $callback_args    Optional. Data that should be set as the $args property of the widget array
145 145
  *                                   (which is the second parameter passed to your callback). Default null.
146 146
  */
147
-function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) {
147
+function wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null) {
148 148
 	$screen = get_current_screen();
149 149
 	global $wp_dashboard_control_callbacks;
150 150
 
151
-	if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) {
151
+	if ($control_callback && current_user_can('edit_dashboard') && is_callable($control_callback)) {
152 152
 		$wp_dashboard_control_callbacks[$widget_id] = $control_callback;
153
-		if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) {
154
-			list($url) = explode( '#', add_query_arg( 'edit', false ), 2 );
155
-			$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>';
153
+		if (isset($_GET['edit']) && $widget_id == $_GET['edit']) {
154
+			list($url) = explode('#', add_query_arg('edit', false), 2);
155
+			$widget_name .= ' <span class="postbox-title-action"><a href="'.esc_url($url).'">'.__('Cancel').'</a></span>';
156 156
 			$callback = '_wp_dashboard_control_callback';
157 157
 		} else {
158
-			list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 );
159
-			$widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>';
158
+			list($url) = explode('#', add_query_arg('edit', $widget_id), 2);
159
+			$widget_name .= ' <span class="postbox-title-action"><a href="'.esc_url("$url#$widget_id").'" class="edit-box open-box">'.__('Configure').'</a></span>';
160 160
 		}
161 161
 	}
162 162
 
163
-	$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
163
+	$side_widgets = array('dashboard_quick_press', 'dashboard_primary');
164 164
 
165 165
 	$location = 'normal';
166
-	if ( in_array($widget_id, $side_widgets) )
166
+	if (in_array($widget_id, $side_widgets))
167 167
 		$location = 'side';
168 168
 
169 169
 	$priority = 'core';
170
-	if ( 'dashboard_browser_nag' === $widget_id )
170
+	if ('dashboard_browser_nag' === $widget_id)
171 171
 		$priority = 'high';
172 172
 
173
-	add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
173
+	add_meta_box($widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args);
174 174
 }
175 175
 
176 176
 /**
@@ -182,12 +182,12 @@  discard block
 block discarded – undo
182 182
  * @param mixed $dashboard
183 183
  * @param array $meta_box
184 184
  */
185
-function _wp_dashboard_control_callback( $dashboard, $meta_box ) {
185
+function _wp_dashboard_control_callback($dashboard, $meta_box) {
186 186
 	echo '<form method="post" class="dashboard-widget-control-form">';
187
-	wp_dashboard_trigger_widget_control( $meta_box['id'] );
188
-	wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' );
189
-	echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />';
190
-	submit_button( __('Submit') );
187
+	wp_dashboard_trigger_widget_control($meta_box['id']);
188
+	wp_nonce_field('edit-dashboard-widget_'.$meta_box['id'], 'dashboard-widget-nonce');
189
+	echo '<input type="hidden" name="widget_id" value="'.esc_attr($meta_box['id']).'" />';
190
+	submit_button(__('Submit'));
191 191
 	echo '</form>';
192 192
 }
193 193
 
@@ -198,31 +198,31 @@  discard block
 block discarded – undo
198 198
  */
199 199
 function wp_dashboard() {
200 200
 	$screen = get_current_screen();
201
-	$columns = absint( $screen->get_columns() );
201
+	$columns = absint($screen->get_columns());
202 202
 	$columns_css = '';
203
-	if ( $columns ) {
203
+	if ($columns) {
204 204
 		$columns_css = " columns-$columns";
205 205
 	}
206 206
 
207 207
 ?>
208 208
 <div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>">
209 209
 	<div id="postbox-container-1" class="postbox-container">
210
-	<?php do_meta_boxes( $screen->id, 'normal', '' ); ?>
210
+	<?php do_meta_boxes($screen->id, 'normal', ''); ?>
211 211
 	</div>
212 212
 	<div id="postbox-container-2" class="postbox-container">
213
-	<?php do_meta_boxes( $screen->id, 'side', '' ); ?>
213
+	<?php do_meta_boxes($screen->id, 'side', ''); ?>
214 214
 	</div>
215 215
 	<div id="postbox-container-3" class="postbox-container">
216
-	<?php do_meta_boxes( $screen->id, 'column3', '' ); ?>
216
+	<?php do_meta_boxes($screen->id, 'column3', ''); ?>
217 217
 	</div>
218 218
 	<div id="postbox-container-4" class="postbox-container">
219
-	<?php do_meta_boxes( $screen->id, 'column4', '' ); ?>
219
+	<?php do_meta_boxes($screen->id, 'column4', ''); ?>
220 220
 	</div>
221 221
 </div>
222 222
 
223 223
 <?php
224
-	wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
225
-	wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
224
+	wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
225
+	wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
226 226
 
227 227
 }
228 228
 
@@ -243,42 +243,42 @@  discard block
 block discarded – undo
243 243
 	<ul>
244 244
 	<?php
245 245
 	// Posts and Pages
246
-	foreach ( array( 'post', 'page' ) as $post_type ) {
247
-		$num_posts = wp_count_posts( $post_type );
248
-		if ( $num_posts && $num_posts->publish ) {
249
-			if ( 'post' == $post_type ) {
250
-				$text = _n( '%s Post', '%s Posts', $num_posts->publish );
246
+	foreach (array('post', 'page') as $post_type) {
247
+		$num_posts = wp_count_posts($post_type);
248
+		if ($num_posts && $num_posts->publish) {
249
+			if ('post' == $post_type) {
250
+				$text = _n('%s Post', '%s Posts', $num_posts->publish);
251 251
 			} else {
252
-				$text = _n( '%s Page', '%s Pages', $num_posts->publish );
252
+				$text = _n('%s Page', '%s Pages', $num_posts->publish);
253 253
 			}
254
-			$text = sprintf( $text, number_format_i18n( $num_posts->publish ) );
255
-			$post_type_object = get_post_type_object( $post_type );
256
-			if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) {
257
-				printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text );
254
+			$text = sprintf($text, number_format_i18n($num_posts->publish));
255
+			$post_type_object = get_post_type_object($post_type);
256
+			if ($post_type_object && current_user_can($post_type_object->cap->edit_posts)) {
257
+				printf('<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text);
258 258
 			} else {
259
-				printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text );
259
+				printf('<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text);
260 260
 			}
261 261
 
262 262
 		}
263 263
 	}
264 264
 	// Comments
265 265
 	$num_comm = wp_count_comments();
266
-	if ( $num_comm && $num_comm->approved ) {
267
-		$text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) );
266
+	if ($num_comm && $num_comm->approved) {
267
+		$text = sprintf(_n('%s Comment', '%s Comments', $num_comm->approved), number_format_i18n($num_comm->approved));
268 268
 		?>
269 269
 		<li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li>
270 270
 		<?php
271
-		$moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated );
271
+		$moderated_comments_count_i18n = number_format_i18n($num_comm->moderated);
272 272
 		/* translators: Number of comments in moderation */
273
-		$text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
273
+		$text = sprintf(_nx('%s in moderation', '%s in moderation', $num_comm->moderated, 'comments'), $moderated_comments_count_i18n);
274 274
 		/* translators: Number of comments in moderation */
275
-		$aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n );
275
+		$aria_label = sprintf(_nx('%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments'), $moderated_comments_count_i18n);
276 276
 		?>
277 277
 		<li class="comment-mod-count<?php
278
-			if ( ! $num_comm->moderated ) {
278
+			if ( ! $num_comm->moderated) {
279 279
 				echo ' hidden';
280 280
 			}
281
-		?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e( $aria_label ); ?>"><?php echo $text; ?></a></li>
281
+		?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e($aria_label); ?>"><?php echo $text; ?></a></li>
282 282
 		<?php
283 283
 	}
284 284
 
@@ -293,10 +293,10 @@  discard block
 block discarded – undo
293 293
 	 *
294 294
 	 * @param array $items Array of extra 'At a Glance' widget items.
295 295
 	 */
296
-	$elements = apply_filters( 'dashboard_glance_items', array() );
296
+	$elements = apply_filters('dashboard_glance_items', array());
297 297
 
298
-	if ( $elements ) {
299
-		echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n";
298
+	if ($elements) {
299
+		echo '<li>'.implode("</li>\n<li>", $elements)."</li>\n";
300 300
 	}
301 301
 
302 302
 	?>
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
 	update_right_now_message();
306 306
 
307 307
 	// Check if search engines are asked not to index this site.
308
-	if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) {
308
+	if ( ! is_network_admin() && ! is_user_admin() && current_user_can('manage_options') && '0' == get_option('blog_public')) {
309 309
 
310 310
 		/**
311 311
 		 * Filter the link title attribute for the 'Search Engines Discouraged'
@@ -318,7 +318,7 @@  discard block
 block discarded – undo
318 318
 		 *
319 319
 		 * @param string $title Default attribute text.
320 320
 		 */
321
-		$title = apply_filters( 'privacy_on_link_title', '' );
321
+		$title = apply_filters('privacy_on_link_title', '');
322 322
 
323 323
 		/**
324 324
 		 * Filter the link label for the 'Search Engines Discouraged' message
@@ -330,7 +330,7 @@  discard block
 block discarded – undo
330 330
 		 *
331 331
 		 * @param string $content Default text.
332 332
 		 */
333
-		$content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) );
333
+		$content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged'));
334 334
 		$title_attr = '' === $title ? '' : " title='$title'";
335 335
 
336 336
 		echo "<p><a href='options-reading.php'$title_attr>$content</a></p>";
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @since 2.5.0
353 353
 	 */
354
-	do_action( 'rightnow_end' );
354
+	do_action('rightnow_end');
355 355
 
356 356
 	/**
357 357
 	 * Fires at the end of the 'At a Glance' dashboard widget.
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @since 2.0.0
362 362
 	 */
363
-	do_action( 'activity_box_end' );
363
+	do_action('activity_box_end');
364 364
 
365 365
 	$actions = ob_get_clean();
366 366
 
367
-	if ( !empty( $actions ) ) : ?>
367
+	if ( ! empty($actions)) : ?>
368 368
 	<div class="sub">
369 369
 		<?php echo $actions; ?>
370 370
 	</div>
@@ -376,25 +376,25 @@  discard block
 block discarded – undo
376 376
  */
377 377
 function wp_network_dashboard_right_now() {
378 378
 	$actions = array();
379
-	if ( current_user_can('create_sites') )
380
-		$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
381
-	if ( current_user_can('create_users') )
382
-		$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
379
+	if (current_user_can('create_sites'))
380
+		$actions['create-site'] = '<a href="'.network_admin_url('site-new.php').'">'.__('Create a New Site').'</a>';
381
+	if (current_user_can('create_users'))
382
+		$actions['create-user'] = '<a href="'.network_admin_url('user-new.php').'">'.__('Create a New User').'</a>';
383 383
 
384 384
 	$c_users = get_user_count();
385 385
 	$c_blogs = get_blog_count();
386 386
 
387
-	$user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) );
388
-	$blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) );
387
+	$user_text = sprintf(_n('%s user', '%s users', $c_users), number_format_i18n($c_users));
388
+	$blog_text = sprintf(_n('%s site', '%s sites', $c_blogs), number_format_i18n($c_blogs));
389 389
 
390
-	$sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text );
390
+	$sentence = sprintf(__('You have %1$s and %2$s.'), $blog_text, $user_text);
391 391
 
392
-	if ( $actions ) {
392
+	if ($actions) {
393 393
 		echo '<ul class="subsubsub">';
394
-		foreach ( $actions as $class => $action ) {
395
-			 $actions[ $class ] = "\t<li class='$class'>$action";
394
+		foreach ($actions as $class => $action) {
395
+			 $actions[$class] = "\t<li class='$class'>$action";
396 396
 		}
397
-		echo implode( " |</li>\n", $actions ) . "</li>\n";
397
+		echo implode(" |</li>\n", $actions)."</li>\n";
398 398
 		echo '</ul>';
399 399
 	}
400 400
 ?>
@@ -412,22 +412,22 @@  discard block
 block discarded – undo
412 412
 		 *
413 413
 		 * @param null $unused
414 414
 		 */
415
-		do_action( 'wpmuadminresult', '' );
415
+		do_action('wpmuadminresult', '');
416 416
 	?>
417 417
 
418 418
 	<form action="<?php echo network_admin_url('users.php'); ?>" method="get">
419 419
 		<p>
420
-			<label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label>
420
+			<label class="screen-reader-text" for="search-users"><?php _e('Search Users'); ?></label>
421 421
 			<input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/>
422
-			<?php submit_button( __( 'Search Users' ), 'button', false, false, array( 'id' => 'submit_users' ) ); ?>
422
+			<?php submit_button(__('Search Users'), 'button', false, false, array('id' => 'submit_users')); ?>
423 423
 		</p>
424 424
 	</form>
425 425
 
426 426
 	<form action="<?php echo network_admin_url('sites.php'); ?>" method="get">
427 427
 		<p>
428
-			<label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label>
428
+			<label class="screen-reader-text" for="search-sites"><?php _e('Search Sites'); ?></label>
429 429
 			<input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/>
430
-			<?php submit_button( __( 'Search Sites' ), 'button', false, false, array( 'id' => 'submit_sites' ) ); ?>
430
+			<?php submit_button(__('Search Sites'), 'button', false, false, array('id' => 'submit_sites')); ?>
431 431
 		</p>
432 432
 	</form>
433 433
 <?php
@@ -436,14 +436,14 @@  discard block
 block discarded – undo
436 436
 	 *
437 437
 	 * @since MU
438 438
 	 */
439
-	do_action( 'mu_rightnow_end' );
439
+	do_action('mu_rightnow_end');
440 440
 
441 441
 	/**
442 442
 	 * Fires at the end of the 'Right Now' widget in the Network Admin dashboard.
443 443
 	 *
444 444
 	 * @since MU
445 445
 	 */
446
-	do_action( 'mu_activity_box_end' );
446
+	do_action('mu_activity_box_end');
447 447
 }
448 448
 
449 449
 /**
@@ -455,37 +455,37 @@  discard block
 block discarded – undo
455 455
  *
456 456
  * @param string $error_msg Optional. Error message. Default false.
457 457
  */
458
-function wp_dashboard_quick_press( $error_msg = false ) {
458
+function wp_dashboard_quick_press($error_msg = false) {
459 459
 	global $post_ID;
460 460
 
461
-	if ( ! current_user_can( 'edit_posts' ) ) {
461
+	if ( ! current_user_can('edit_posts')) {
462 462
 		return;
463 463
 	}
464 464
 
465 465
 	/* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */
466
-	$last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID
467
-	if ( $last_post_id ) {
468
-		$post = get_post( $last_post_id );
469
-		if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore
470
-			$post = get_default_post_to_edit( 'post', true );
471
-			update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
466
+	$last_post_id = (int) get_user_option('dashboard_quick_press_last_post_id'); // Get the last post_ID
467
+	if ($last_post_id) {
468
+		$post = get_post($last_post_id);
469
+		if (empty($post) || $post->post_status != 'auto-draft') { // auto-draft doesn't exists anymore
470
+			$post = get_default_post_to_edit('post', true);
471
+			update_user_option(get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID); // Save post_ID
472 472
 		} else {
473 473
 			$post->post_title = ''; // Remove the auto draft title
474 474
 		}
475 475
 	} else {
476
-		$post = get_default_post_to_edit( 'post' , true);
476
+		$post = get_default_post_to_edit('post', true);
477 477
 		$user_id = get_current_user_id();
478 478
 		// Don't create an option if this is a super admin who does not belong to this site.
479
-		if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
480
-			update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
479
+		if ( ! (is_super_admin($user_id) && ! in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user_id)))))
480
+			update_user_option($user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID); // Save post_ID
481 481
 	}
482 482
 
483 483
 	$post_ID = (int) $post->ID;
484 484
 ?>
485 485
 
486
-	<form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
486
+	<form name="post" action="<?php echo esc_url(admin_url('post.php')); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js">
487 487
 
488
-		<?php if ( $error_msg ) : ?>
488
+		<?php if ($error_msg) : ?>
489 489
 		<div class="error"><?php echo $error_msg; ?></div>
490 490
 		<?php endif; ?>
491 491
 
@@ -494,14 +494,14 @@  discard block
 block discarded – undo
494 494
 
495 495
 				<?php
496 496
 				/** This filter is documented in wp-admin/edit-form-advanced.php */
497
-				echo apply_filters( 'enter_title_here', __( 'Title' ), $post );
497
+				echo apply_filters('enter_title_here', __('Title'), $post);
498 498
 				?>
499 499
 			</label>
500 500
 			<input type="text" name="post_title" id="title" autocomplete="off" />
501 501
 		</div>
502 502
 
503 503
 		<div class="textarea-wrap" id="description-wrap">
504
-			<label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What&#8217;s on your mind?' ); ?></label>
504
+			<label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e('What&#8217;s on your mind?'); ?></label>
505 505
 			<textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea>
506 506
 		</div>
507 507
 
@@ -509,8 +509,8 @@  discard block
 block discarded – undo
509 509
 			<input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" />
510 510
 			<input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" />
511 511
 			<input type="hidden" name="post_type" value="post" />
512
-			<?php wp_nonce_field( 'add-post' ); ?>
513
-			<?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?>
512
+			<?php wp_nonce_field('add-post'); ?>
513
+			<?php submit_button(__('Save Draft'), 'primary', 'save', false, array('id' => 'save-post')); ?>
514 514
 			<br class="clear" />
515 515
 		</p>
516 516
 
@@ -526,8 +526,8 @@  discard block
 block discarded – undo
526 526
  *
527 527
  * @param array $drafts
528 528
  */
529
-function wp_dashboard_recent_drafts( $drafts = false ) {
530
-	if ( ! $drafts ) {
529
+function wp_dashboard_recent_drafts($drafts = false) {
530
+	if ( ! $drafts) {
531 531
 		$query_args = array(
532 532
 			'post_type'      => 'post',
533 533
 			'post_status'    => 'draft',
@@ -544,30 +544,30 @@  discard block
 block discarded – undo
544 544
 		 *
545 545
 		 * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget.
546 546
 		 */
547
-		$query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args );
547
+		$query_args = apply_filters('dashboard_recent_drafts_query_args', $query_args);
548 548
 
549
-		$drafts = get_posts( $query_args );
550
-		if ( ! $drafts ) {
549
+		$drafts = get_posts($query_args);
550
+		if ( ! $drafts) {
551 551
 			return;
552 552
  		}
553 553
  	}
554 554
 
555 555
 	echo '<div class="drafts">';
556
-	if ( count( $drafts ) > 3 ) {
557
-		echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '" aria-label="' . __( 'View all drafts' ) . '">' . _x( 'View all', 'drafts' ) . "</a></p>\n";
556
+	if (count($drafts) > 3) {
557
+		echo '<p class="view-all"><a href="'.esc_url(admin_url('edit.php?post_status=draft')).'" aria-label="'.__('View all drafts').'">'._x('View all', 'drafts')."</a></p>\n";
558 558
  	}
559
-	echo '<h2 class="hide-if-no-js">' . __( 'Drafts' ) . "</h2>\n<ul>";
559
+	echo '<h2 class="hide-if-no-js">'.__('Drafts')."</h2>\n<ul>";
560 560
 
561
-	$drafts = array_slice( $drafts, 0, 3 );
562
-	foreach ( $drafts as $draft ) {
563
-		$url = get_edit_post_link( $draft->ID );
564
-		$title = _draft_or_post_title( $draft->ID );
561
+	$drafts = array_slice($drafts, 0, 3);
562
+	foreach ($drafts as $draft) {
563
+		$url = get_edit_post_link($draft->ID);
564
+		$title = _draft_or_post_title($draft->ID);
565 565
 		echo "<li>\n";
566 566
 		/* translators: %s: post title */
567
-		echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . esc_html( $title ) . '</a>';
568
-		echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>';
569
-		if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) {
570
-			echo '<p>' . $the_content . '</p>';
567
+		echo '<div class="draft-title"><a href="'.esc_url($url).'" aria-label="'.esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title)).'">'.esc_html($title).'</a>';
568
+		echo '<time datetime="'.get_the_time('c', $draft).'">'.get_the_time(__('F j, Y'), $draft).'</time></div>';
569
+		if ($the_content = wp_trim_words($draft->post_content, 10)) {
570
+			echo '<p>'.$the_content.'</p>';
571 571
  		}
572 572
 		echo "</li>\n";
573 573
  	}
@@ -585,20 +585,20 @@  discard block
 block discarded – undo
585 585
  * @param WP_Comment $comment   The current comment.
586 586
  * @param bool       $show_date Optional. Whether to display the date.
587 587
  */
588
-function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) {
588
+function _wp_dashboard_recent_comments_row(&$comment, $show_date = true) {
589 589
 	$GLOBALS['comment'] = clone $comment;
590 590
 
591
-	if ( $comment->comment_post_ID > 0 ) {
591
+	if ($comment->comment_post_ID > 0) {
592 592
 
593
-		$comment_post_title = _draft_or_post_title( $comment->comment_post_ID );
594
-		$comment_post_url = get_the_permalink( $comment->comment_post_ID );
593
+		$comment_post_title = _draft_or_post_title($comment->comment_post_ID);
594
+		$comment_post_url = get_the_permalink($comment->comment_post_ID);
595 595
 		$comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>";
596 596
 	} else {
597 597
 		$comment_post_link = '';
598 598
 	}
599 599
 
600 600
 	$actions_string = '';
601
-	if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) {
601
+	if (current_user_can('edit_comment', $comment->comment_ID)) {
602 602
 		// Pre-order it: Approve | Reply | Edit | Spam | Trash.
603 603
 		$actions = array(
604 604
 			'approve' => '', 'unapprove' => '',
@@ -609,29 +609,29 @@  discard block
 block discarded – undo
609 609
 			'view' => '',
610 610
 		);
611 611
 
612
-		$del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) );
613
-		$approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) );
612
+		$del_nonce = esc_html('_wpnonce='.wp_create_nonce("delete-comment_$comment->comment_ID"));
613
+		$approve_nonce = esc_html('_wpnonce='.wp_create_nonce("approve-comment_$comment->comment_ID"));
614 614
 
615
-		$approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
616
-		$unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" );
617
-		$spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
618
-		$trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
619
-		$delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" );
615
+		$approve_url = esc_url("comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce");
616
+		$unapprove_url = esc_url("comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce");
617
+		$spam_url = esc_url("comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce");
618
+		$trash_url = esc_url("comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce");
619
+		$delete_url = esc_url("comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce");
620 620
 
621
-		$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>';
622
-		$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>';
623
-		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>';
624
-		$actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '" href="#">' . __( 'Reply' ) . '</a>';
625
-		$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>';
621
+		$actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='".esc_attr__('Approve this comment')."'>".__('Approve').'</a>';
622
+		$actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='".esc_attr__('Unapprove this comment')."'>".__('Unapprove').'</a>';
623
+		$actions['edit'] = "<a href='comment.php?action=editcomment&amp;c={$comment->comment_ID}' aria-label='".esc_attr__('Edit this comment')."'>".__('Edit').'</a>';
624
+		$actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="'.esc_attr__('Reply to this comment').'" href="#">'.__('Reply').'</a>';
625
+		$actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='".esc_attr__('Mark this comment as spam')."'>"./* translators: mark as spam link */ _x('Spam', 'verb').'</a>';
626 626
 
627
-		if ( ! EMPTY_TRASH_DAYS ) {
628
-			$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>';
627
+		if ( ! EMPTY_TRASH_DAYS) {
628
+			$actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='".esc_attr__('Delete this comment permanently')."'>".__('Delete Permanently').'</a>';
629 629
 		} else {
630
-			$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>';
630
+			$actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='".esc_attr__('Move this comment to the Trash')."'>"._x('Trash', 'verb').'</a>';
631 631
 		}
632 632
 
633
-		if ( '1' === $comment->comment_approved ) {
634
-			$actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>';
633
+		if ('1' === $comment->comment_approved) {
634
+			$actions['view'] = '<a class="comment-link" href="'.esc_url(get_comment_link($comment)).'" aria-label="'.esc_attr__('View this comment').'">'.__('View').'</a>';
635 635
 		}
636 636
 
637 637
 		/**
@@ -645,15 +645,15 @@  discard block
 block discarded – undo
645 645
 		 *                            'Delete', and 'Trash'.
646 646
 		 * @param WP_Comment $comment The comment object.
647 647
 		 */
648
-		$actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment );
648
+		$actions = apply_filters('comment_row_actions', array_filter($actions), $comment);
649 649
 
650 650
 		$i = 0;
651
-		foreach ( $actions as $action => $link ) {
651
+		foreach ($actions as $action => $link) {
652 652
 			++$i;
653
-			( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
653
+			((('approve' == $action || 'unapprove' == $action) && 2 === $i) || 1 === $i) ? $sep = '' : $sep = ' | ';
654 654
 
655 655
 			// Reply and quickedit need a hide-if-no-js span
656
-			if ( 'reply' == $action || 'quickedit' == $action )
656
+			if ('reply' == $action || 'quickedit' == $action)
657 657
 				$action .= ' hide-if-no-js';
658 658
 
659 659
 			$actions_string .= "<span class='$action'>$sep$link</span>";
@@ -661,30 +661,30 @@  discard block
 block discarded – undo
661 661
 	}
662 662
 ?>
663 663
 
664
-		<li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>>
664
+		<li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class(array('comment-item', wp_get_comment_status($comment)), $comment); ?>>
665 665
 
666
-			<?php echo get_avatar( $comment, 50, 'mystery' ); ?>
666
+			<?php echo get_avatar($comment, 50, 'mystery'); ?>
667 667
 
668
-			<?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?>
668
+			<?php if ( ! $comment->comment_type || 'comment' == $comment->comment_type) : ?>
669 669
 
670 670
 			<div class="dashboard-comment-wrap has-row-actions">
671 671
 			<p class="comment-meta">
672 672
 			<?php
673 673
 				// Comments might not have a post they relate to, e.g. programmatically created ones.
674
-				if ( $comment_post_link ) {
674
+				if ($comment_post_link) {
675 675
 					printf(
676 676
 						/* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */
677
-						__( 'From %1$s on %2$s %3$s' ),
678
-						'<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
677
+						__('From %1$s on %2$s %3$s'),
678
+						'<cite class="comment-author">'.get_comment_author_link($comment).'</cite>',
679 679
 						$comment_post_link,
680
-						'<span class="approve">' . __( '[Pending]' ) . '</span>'
680
+						'<span class="approve">'.__('[Pending]').'</span>'
681 681
 					);
682 682
 				} else {
683 683
 					printf(
684 684
 						/* translators: 1: comment author, 2: notification if the comment is pending */
685
-						__( 'From %1$s %2$s' ),
686
-						'<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
687
-						'<span class="approve">' . __( '[Pending]' ) . '</span>'
685
+						__('From %1$s %2$s'),
686
+						'<cite class="comment-author">'.get_comment_author_link($comment).'</cite>',
687
+						'<span class="approve">'.__('[Pending]').'</span>'
688 688
 					);
689 689
 				}
690 690
 			?>
@@ -692,45 +692,45 @@  discard block
 block discarded – undo
692 692
 
693 693
 			<?php
694 694
 			else :
695
-				switch ( $comment->comment_type ) {
695
+				switch ($comment->comment_type) {
696 696
 					case 'pingback' :
697
-						$type = __( 'Pingback' );
697
+						$type = __('Pingback');
698 698
 						break;
699 699
 					case 'trackback' :
700
-						$type = __( 'Trackback' );
700
+						$type = __('Trackback');
701 701
 						break;
702 702
 					default :
703
-						$type = ucwords( $comment->comment_type );
703
+						$type = ucwords($comment->comment_type);
704 704
 				}
705
-				$type = esc_html( $type );
705
+				$type = esc_html($type);
706 706
 			?>
707 707
 			<div class="dashboard-comment-wrap has-row-actions">
708 708
 			<p class="comment-meta">
709 709
 			<?php
710 710
 				// Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones.
711
-				if ( $comment_post_link ) {
711
+				if ($comment_post_link) {
712 712
 					printf(
713 713
 						/* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */
714
-						_x( '%1$s on %2$s %3$s', 'dashboard' ),
714
+						_x('%1$s on %2$s %3$s', 'dashboard'),
715 715
 						"<strong>$type</strong>",
716 716
 						$comment_post_link,
717
-						'<span class="approve">' . __( '[Pending]' ) . '</span>'
717
+						'<span class="approve">'.__('[Pending]').'</span>'
718 718
 					);
719 719
 				} else {
720 720
 					printf(
721 721
 						/* translators: 1: type of comment, 2: notification if the comment is pending */
722
-						_x( '%1$s %2$s', 'dashboard' ),
722
+						_x('%1$s %2$s', 'dashboard'),
723 723
 						"<strong>$type</strong>",
724
-						'<span class="approve">' . __( '[Pending]' ) . '</span>'
724
+						'<span class="approve">'.__('[Pending]').'</span>'
725 725
 					);
726 726
 				}
727 727
 			?>
728 728
 			</p>
729
-			<p class="comment-author"><?php comment_author_link( $comment ); ?></p>
729
+			<p class="comment-author"><?php comment_author_link($comment); ?></p>
730 730
 
731 731
 			<?php endif; // comment_type ?>
732
-			<blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote>
733
-			<?php if ( $actions_string ) : ?>
732
+			<blockquote><p><?php comment_excerpt($comment); ?></p></blockquote>
733
+			<?php if ($actions_string) : ?>
734 734
 			<p class="row-actions"><?php echo $actions_string; ?></p>
735 735
 			<?php endif; ?>
736 736
 			</div>
@@ -748,27 +748,27 @@  discard block
 block discarded – undo
748 748
 
749 749
 	echo '<div id="activity-widget">';
750 750
 
751
-	$future_posts = wp_dashboard_recent_posts( array(
751
+	$future_posts = wp_dashboard_recent_posts(array(
752 752
 		'max'     => 5,
753 753
 		'status'  => 'future',
754 754
 		'order'   => 'ASC',
755
-		'title'   => __( 'Publishing Soon' ),
755
+		'title'   => __('Publishing Soon'),
756 756
 		'id'      => 'future-posts',
757
-	) );
758
-	$recent_posts = wp_dashboard_recent_posts( array(
757
+	));
758
+	$recent_posts = wp_dashboard_recent_posts(array(
759 759
 		'max'     => 5,
760 760
 		'status'  => 'publish',
761 761
 		'order'   => 'DESC',
762
-		'title'   => __( 'Recently Published' ),
762
+		'title'   => __('Recently Published'),
763 763
 		'id'      => 'published-posts',
764
-	) );
764
+	));
765 765
 
766 766
 	$recent_comments = wp_dashboard_recent_comments();
767 767
 
768
-	if ( !$future_posts && !$recent_posts && !$recent_comments ) {
768
+	if ( ! $future_posts && ! $recent_posts && ! $recent_comments) {
769 769
 		echo '<div class="no-activity">';
770 770
 		echo '<p class="smiley"></p>';
771
-		echo '<p>' . __( 'No activity yet!' ) . '</p>';
771
+		echo '<p>'.__('No activity yet!').'</p>';
772 772
 		echo '</div>';
773 773
 	}
774 774
 
@@ -791,16 +791,16 @@  discard block
 block discarded – undo
791 791
  * }
792 792
  * @return bool False if no posts were found. True otherwise.
793 793
  */
794
-function wp_dashboard_recent_posts( $args ) {
794
+function wp_dashboard_recent_posts($args) {
795 795
 	$query_args = array(
796 796
 		'post_type'      => 'post',
797 797
 		'post_status'    => $args['status'],
798 798
 		'orderby'        => 'date',
799 799
 		'order'          => $args['order'],
800
-		'posts_per_page' => intval( $args['max'] ),
800
+		'posts_per_page' => intval($args['max']),
801 801
 		'no_found_rows'  => true,
802 802
 		'cache_results'  => false,
803
-		'perm'           => ( 'future' === $args['status'] ) ? 'editable' : 'readable',
803
+		'perm'           => ('future' === $args['status']) ? 'editable' : 'readable',
804 804
 	);
805 805
 
806 806
 	/**
@@ -810,47 +810,47 @@  discard block
 block discarded – undo
810 810
 	 *
811 811
 	 * @param array $query_args The arguments passed to WP_Query to produce the list of posts.
812 812
 	 */
813
-	$query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args );
814
-	$posts = new WP_Query( $query_args );
813
+	$query_args = apply_filters('dashboard_recent_posts_query_args', $query_args);
814
+	$posts = new WP_Query($query_args);
815 815
 
816
-	if ( $posts->have_posts() ) {
816
+	if ($posts->have_posts()) {
817 817
 
818
-		echo '<div id="' . $args['id'] . '" class="activity-block">';
818
+		echo '<div id="'.$args['id'].'" class="activity-block">';
819 819
 
820
-		echo '<h3>' . $args['title'] . '</h3>';
820
+		echo '<h3>'.$args['title'].'</h3>';
821 821
 
822 822
 		echo '<ul>';
823 823
 
824
-		$today    = date( 'Y-m-d', current_time( 'timestamp' ) );
825
-		$tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) );
824
+		$today    = date('Y-m-d', current_time('timestamp'));
825
+		$tomorrow = date('Y-m-d', strtotime('+1 day', current_time('timestamp')));
826 826
 
827
-		while ( $posts->have_posts() ) {
827
+		while ($posts->have_posts()) {
828 828
 			$posts->the_post();
829 829
 
830
-			$time = get_the_time( 'U' );
831
-			if ( date( 'Y-m-d', $time ) == $today ) {
832
-				$relative = __( 'Today' );
833
-			} elseif ( date( 'Y-m-d', $time ) == $tomorrow ) {
834
-				$relative = __( 'Tomorrow' );
835
-			} elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) {
830
+			$time = get_the_time('U');
831
+			if (date('Y-m-d', $time) == $today) {
832
+				$relative = __('Today');
833
+			} elseif (date('Y-m-d', $time) == $tomorrow) {
834
+				$relative = __('Tomorrow');
835
+			} elseif (date('Y', $time) !== date('Y', current_time('timestamp'))) {
836 836
 				/* translators: date and time format for recent posts on the dashboard, from a different calendar year, see http://php.net/date */
837
-				$relative = date_i18n( __( 'M jS Y' ), $time );
837
+				$relative = date_i18n(__('M jS Y'), $time);
838 838
 			} else {
839 839
 				/* translators: date and time format for recent posts on the dashboard, see http://php.net/date */
840
-				$relative = date_i18n( __( 'M jS' ), $time );
840
+				$relative = date_i18n(__('M jS'), $time);
841 841
 			}
842 842
 
843 843
 			// Use the post edit link for those who can edit, the permalink otherwise.
844
-			$recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink();
844
+			$recent_post_link = current_user_can('edit_post', get_the_ID()) ? get_edit_post_link() : get_permalink();
845 845
 
846 846
 			$draft_or_post_title = _draft_or_post_title();
847 847
 			printf(
848 848
 				'<li><span>%1$s</span> <a href="%2$s" aria-label="%3$s">%4$s</a></li>',
849 849
 				/* translators: 1: relative date, 2: time */
850
-				sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ),
850
+				sprintf(_x('%1$s, %2$s', 'dashboard'), $relative, get_the_time()),
851 851
 				$recent_post_link,
852 852
 				/* translators: %s: post title */
853
-				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $draft_or_post_title ) ),
853
+				esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $draft_or_post_title)),
854 854
 				$draft_or_post_title
855 855
 			);
856 856
 		}
@@ -875,7 +875,7 @@  discard block
 block discarded – undo
875 875
  * @param int $total_items Optional. Number of comments to query. Default 5.
876 876
  * @return bool False if no comments were found. True otherwise.
877 877
  */
878
-function wp_dashboard_recent_comments( $total_items = 5 ) {
878
+function wp_dashboard_recent_comments($total_items = 5) {
879 879
 	// Select all comment types and filter out spam later for better query performance.
880 880
 	$comments = array();
881 881
 
@@ -883,36 +883,36 @@  discard block
 block discarded – undo
883 883
 		'number' => $total_items * 5,
884 884
 		'offset' => 0
885 885
 	);
886
-	if ( ! current_user_can( 'edit_posts' ) )
886
+	if ( ! current_user_can('edit_posts'))
887 887
 		$comments_query['status'] = 'approve';
888 888
 
889
-	while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
890
-		if ( ! is_array( $possible ) ) {
889
+	while (count($comments) < $total_items && $possible = get_comments($comments_query)) {
890
+		if ( ! is_array($possible)) {
891 891
 			break;
892 892
 		}
893
-		foreach ( $possible as $comment ) {
894
-			if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
893
+		foreach ($possible as $comment) {
894
+			if ( ! current_user_can('read_post', $comment->comment_post_ID))
895 895
 				continue;
896 896
 			$comments[] = $comment;
897
-			if ( count( $comments ) == $total_items )
897
+			if (count($comments) == $total_items)
898 898
 				break 2;
899 899
 		}
900 900
 		$comments_query['offset'] += $comments_query['number'];
901 901
 		$comments_query['number'] = $total_items * 10;
902 902
 	}
903 903
 
904
-	if ( $comments ) {
904
+	if ($comments) {
905 905
 		echo '<div id="latest-comments" class="activity-block">';
906
-		echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
906
+		echo '<h3>'.__('Recent Comments').'</h3>';
907 907
 
908 908
 		echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
909
-		foreach ( $comments as $comment )
910
-			_wp_dashboard_recent_comments_row( $comment );
909
+		foreach ($comments as $comment)
910
+			_wp_dashboard_recent_comments_row($comment);
911 911
 		echo '</ul>';
912 912
 
913
-		if ( current_user_can( 'edit_posts' ) ) {
914
-			echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>';
915
-			_get_list_table( 'WP_Comments_List_Table' )->views();
913
+		if (current_user_can('edit_posts')) {
914
+			echo '<h3 class="screen-reader-text">'.__('View more comments').'</h3>';
915
+			_get_list_table('WP_Comments_List_Table')->views();
916 916
 		}
917 917
 
918 918
 		wp_comment_reply( -1, false, 'dashboard', false );
@@ -932,10 +932,10 @@  discard block
 block discarded – undo
932 932
  *
933 933
  * @param string $widget_id
934 934
  */
935
-function wp_dashboard_rss_output( $widget_id ) {
936
-	$widgets = get_option( 'dashboard_widget_options' );
935
+function wp_dashboard_rss_output($widget_id) {
936
+	$widgets = get_option('dashboard_widget_options');
937 937
 	echo '<div class="rss-widget">';
938
-	wp_widget_rss_output( $widgets[ $widget_id ] );
938
+	wp_widget_rss_output($widgets[$widget_id]);
939 939
 	echo "</div>";
940 940
 }
941 941
 
@@ -954,37 +954,37 @@  discard block
 block discarded – undo
954 954
  * @param array $check_urls RSS feeds
955 955
  * @return bool False on failure. True on success.
956 956
  */
957
-function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
958
-	$loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&#8230;' ) . '</p><p class="hide-if-js">' . __( 'This widget requires JavaScript.' ) . '</p>';
959
-	$doing_ajax = ( defined('DOING_AJAX') && DOING_AJAX );
957
+function wp_dashboard_cached_rss_widget($widget_id, $callback, $check_urls = array()) {
958
+	$loading = '<p class="widget-loading hide-if-no-js">'.__('Loading&#8230;').'</p><p class="hide-if-js">'.__('This widget requires JavaScript.').'</p>';
959
+	$doing_ajax = (defined('DOING_AJAX') && DOING_AJAX);
960 960
 
961
-	if ( empty($check_urls) ) {
962
-		$widgets = get_option( 'dashboard_widget_options' );
963
-		if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) {
961
+	if (empty($check_urls)) {
962
+		$widgets = get_option('dashboard_widget_options');
963
+		if (empty($widgets[$widget_id]['url']) && ! $doing_ajax) {
964 964
 			echo $loading;
965 965
 			return false;
966 966
 		}
967
-		$check_urls = array( $widgets[$widget_id]['url'] );
967
+		$check_urls = array($widgets[$widget_id]['url']);
968 968
 	}
969 969
 
970 970
 	$locale = get_locale();
971
-	$cache_key = 'dash_' . md5( $widget_id . '_' . $locale );
972
-	if ( false !== ( $output = get_transient( $cache_key ) ) ) {
971
+	$cache_key = 'dash_'.md5($widget_id.'_'.$locale);
972
+	if (false !== ($output = get_transient($cache_key))) {
973 973
 		echo $output;
974 974
 		return true;
975 975
 	}
976 976
 
977
-	if ( ! $doing_ajax ) {
977
+	if ( ! $doing_ajax) {
978 978
 		echo $loading;
979 979
 		return false;
980 980
 	}
981 981
 
982
-	if ( $callback && is_callable( $callback ) ) {
983
-		$args = array_slice( func_get_args(), 3 );
984
-		array_unshift( $args, $widget_id, $check_urls );
982
+	if ($callback && is_callable($callback)) {
983
+		$args = array_slice(func_get_args(), 3);
984
+		array_unshift($args, $widget_id, $check_urls);
985 985
 		ob_start();
986
-		call_user_func_array( $callback, $args );
987
-		set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds)
986
+		call_user_func_array($callback, $args);
987
+		set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); // Default lifetime in cache of 12 hours (same as the feeds)
988 988
 	}
989 989
 
990 990
 	return true;
@@ -1003,11 +1003,11 @@  discard block
 block discarded – undo
1003 1003
  *
1004 1004
  * @param int $widget_control_id Registered Widget ID.
1005 1005
  */
1006
-function wp_dashboard_trigger_widget_control( $widget_control_id = false ) {
1006
+function wp_dashboard_trigger_widget_control($widget_control_id = false) {
1007 1007
 	global $wp_dashboard_control_callbacks;
1008 1008
 
1009
-	if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) {
1010
-		call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) );
1009
+	if (is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id])) {
1010
+		call_user_func($wp_dashboard_control_callbacks[$widget_control_id], '', array('id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id]));
1011 1011
 	}
1012 1012
 }
1013 1013
 
@@ -1022,25 +1022,25 @@  discard block
 block discarded – undo
1022 1022
  * @param string $widget_id
1023 1023
  * @param array $form_inputs
1024 1024
  */
1025
-function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
1026
-	if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
1025
+function wp_dashboard_rss_control($widget_id, $form_inputs = array()) {
1026
+	if ( ! $widget_options = get_option('dashboard_widget_options'))
1027 1027
 		$widget_options = array();
1028 1028
 
1029
-	if ( !isset($widget_options[$widget_id]) )
1029
+	if ( ! isset($widget_options[$widget_id]))
1030 1030
 		$widget_options[$widget_id] = array();
1031 1031
 
1032 1032
 	$number = 1; // Hack to use wp_widget_rss_form()
1033 1033
 	$widget_options[$widget_id]['number'] = $number;
1034 1034
 
1035
-	if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) {
1036
-		$_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] );
1037
-		$widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] );
1035
+	if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number])) {
1036
+		$_POST['widget-rss'][$number] = wp_unslash($_POST['widget-rss'][$number]);
1037
+		$widget_options[$widget_id] = wp_widget_rss_process($_POST['widget-rss'][$number]);
1038 1038
 		$widget_options[$widget_id]['number'] = $number;
1039 1039
 
1040 1040
 		// Title is optional. If black, fill it if possible.
1041
-		if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) {
1041
+		if ( ! $widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title'])) {
1042 1042
 			$rss = fetch_feed($widget_options[$widget_id]['url']);
1043
-			if ( is_wp_error($rss) ) {
1043
+			if (is_wp_error($rss)) {
1044 1044
 				$widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed'));
1045 1045
 			} else {
1046 1046
 				$widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title()));
@@ -1048,12 +1048,12 @@  discard block
 block discarded – undo
1048 1048
 				unset($rss);
1049 1049
 			}
1050 1050
 		}
1051
-		update_option( 'dashboard_widget_options', $widget_options );
1052
-		$cache_key = 'dash_' . md5( $widget_id );
1053
-		delete_transient( $cache_key );
1051
+		update_option('dashboard_widget_options', $widget_options);
1052
+		$cache_key = 'dash_'.md5($widget_id);
1053
+		delete_transient($cache_key);
1054 1054
 	}
1055 1055
 
1056
-	wp_widget_rss_form( $widget_options[$widget_id], $form_inputs );
1056
+	wp_widget_rss_form($widget_options[$widget_id], $form_inputs);
1057 1057
 }
1058 1058
 
1059 1059
 /**
@@ -1072,7 +1072,7 @@  discard block
 block discarded – undo
1072 1072
 			 *
1073 1073
 			 * @param string $link The widget's primary link URL.
1074 1074
 			 */
1075
-			'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ),
1075
+			'link' => apply_filters('dashboard_primary_link', __('https://wordpress.org/news/')),
1076 1076
 
1077 1077
 			/**
1078 1078
 			 * Filter the primary feed URL for the 'WordPress News' dashboard widget.
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
 			 *
1082 1082
 			 * @param string $url The widget's primary feed URL.
1083 1083
 			 */
1084
-			'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ),
1084
+			'url' => apply_filters('dashboard_primary_feed', __('http://wordpress.org/news/feed/')),
1085 1085
 
1086 1086
 			/**
1087 1087
 			 * Filter the primary link title for the 'WordPress News' dashboard widget.
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
 			 *
1091 1091
 			 * @param string $title Title attribute for the widget's primary link.
1092 1092
 			 */
1093
-			'title'        => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ),
1093
+			'title'        => apply_filters('dashboard_primary_title', __('WordPress Blog')),
1094 1094
 			'items'        => 1,
1095 1095
 			'show_summary' => 1,
1096 1096
 			'show_author'  => 0,
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
 			 *
1106 1106
 			 * @param string $link The widget's secondary link URL.
1107 1107
 			 */
1108
-			'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ),
1108
+			'link' => apply_filters('dashboard_secondary_link', __('https://planet.wordpress.org/')),
1109 1109
 
1110 1110
 			/**
1111 1111
 			 * Filter the secondary feed URL for the 'WordPress News' dashboard widget.
@@ -1114,7 +1114,7 @@  discard block
 block discarded – undo
1114 1114
 			 *
1115 1115
 			 * @param string $url The widget's secondary feed URL.
1116 1116
 			 */
1117
-			'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ),
1117
+			'url' => apply_filters('dashboard_secondary_feed', __('https://planet.wordpress.org/feed/')),
1118 1118
 
1119 1119
 			/**
1120 1120
 			 * Filter the secondary link title for the 'WordPress News' dashboard widget.
@@ -1123,7 +1123,7 @@  discard block
 block discarded – undo
1123 1123
 			 *
1124 1124
 			 * @param string $title Title attribute for the widget's secondary link.
1125 1125
 			 */
1126
-			'title'        => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ),
1126
+			'title'        => apply_filters('dashboard_secondary_title', __('Other WordPress News')),
1127 1127
 
1128 1128
 			/**
1129 1129
 			 * Filter the number of secondary link items for the 'WordPress News' dashboard widget.
@@ -1132,14 +1132,14 @@  discard block
 block discarded – undo
1132 1132
 			 *
1133 1133
 			 * @param string $items How many items to show in the secondary feed.
1134 1134
 			 */
1135
-			'items'        => apply_filters( 'dashboard_secondary_items', 3 ),
1135
+			'items'        => apply_filters('dashboard_secondary_items', 3),
1136 1136
 			'show_summary' => 0,
1137 1137
 			'show_author'  => 0,
1138 1138
 			'show_date'    => 0,
1139 1139
 		)
1140 1140
 	);
1141 1141
 
1142
-	if ( ( ! is_multisite() && is_blog_admin() && current_user_can( 'install_plugins' ) ) || ( is_network_admin() && current_user_can( 'manage_network_plugins' ) && current_user_can( 'install_plugins' ) ) ) {
1142
+	if (( ! is_multisite() && is_blog_admin() && current_user_can('install_plugins')) || (is_network_admin() && current_user_can('manage_network_plugins') && current_user_can('install_plugins'))) {
1143 1143
 		$feeds['plugins'] = array(
1144 1144
 			'link'         => '',
1145 1145
 			'url'          => array(
@@ -1153,7 +1153,7 @@  discard block
 block discarded – undo
1153 1153
 		);
1154 1154
 	}
1155 1155
 
1156
-	wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds );
1156
+	wp_dashboard_cached_rss_widget('dashboard_primary', 'wp_dashboard_primary_output', $feeds);
1157 1157
 }
1158 1158
 
1159 1159
 /**
@@ -1164,14 +1164,14 @@  discard block
 block discarded – undo
1164 1164
  * @param string $widget_id Widget ID.
1165 1165
  * @param array  $feeds     Array of RSS feeds.
1166 1166
  */
1167
-function wp_dashboard_primary_output( $widget_id, $feeds ) {
1168
-	foreach ( $feeds as $type => $args ) {
1167
+function wp_dashboard_primary_output($widget_id, $feeds) {
1168
+	foreach ($feeds as $type => $args) {
1169 1169
 		$args['type'] = $type;
1170 1170
 		echo '<div class="rss-widget">';
1171
-		if ( $type === 'plugins' ) {
1172
-			wp_dashboard_plugins_output( $args['url'], $args );
1171
+		if ($type === 'plugins') {
1172
+			wp_dashboard_plugins_output($args['url'], $args);
1173 1173
 		} else {
1174
-			wp_widget_rss_output( $args['url'], $args );
1174
+			wp_widget_rss_output($args['url'], $args);
1175 1175
 		}
1176 1176
 		echo "</div>";
1177 1177
 	}
@@ -1185,47 +1185,47 @@  discard block
 block discarded – undo
1185 1185
  * @param string $rss  The RSS feed URL.
1186 1186
  * @param array  $args Array of arguments for this RSS feed.
1187 1187
  */
1188
-function wp_dashboard_plugins_output( $rss, $args = array() ) {
1188
+function wp_dashboard_plugins_output($rss, $args = array()) {
1189 1189
 	// Plugin feeds plus link to install them
1190
-	$popular = fetch_feed( $args['url']['popular'] );
1190
+	$popular = fetch_feed($args['url']['popular']);
1191 1191
 
1192
-	if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) {
1193
-		$plugin_slugs = array_keys( get_plugins() );
1194
-		set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS );
1192
+	if (false === $plugin_slugs = get_transient('plugin_slugs')) {
1193
+		$plugin_slugs = array_keys(get_plugins());
1194
+		set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS);
1195 1195
 	}
1196 1196
 
1197 1197
 	echo '<ul>';
1198 1198
 
1199
-	foreach ( array( $popular ) as $feed ) {
1200
-		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1199
+	foreach (array($popular) as $feed) {
1200
+		if (is_wp_error($feed) || ! $feed->get_item_quantity())
1201 1201
 			continue;
1202 1202
 
1203 1203
 		$items = $feed->get_items(0, 5);
1204 1204
 
1205 1205
 		// Pick a random, non-installed plugin
1206
-		while ( true ) {
1206
+		while (true) {
1207 1207
 			// Abort this foreach loop iteration if there's no plugins left of this type
1208
-			if ( 0 == count($items) )
1208
+			if (0 == count($items))
1209 1209
 				continue 2;
1210 1210
 
1211 1211
 			$item_key = array_rand($items);
1212 1212
 			$item = $items[$item_key];
1213 1213
 
1214
-			list($link, $frag) = explode( '#', $item->get_link() );
1214
+			list($link, $frag) = explode('#', $item->get_link());
1215 1215
 
1216 1216
 			$link = esc_url($link);
1217
-			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1217
+			if (preg_match('|/([^/]+?)/?$|', $link, $matches))
1218 1218
 				$slug = $matches[1];
1219 1219
 			else {
1220
-				unset( $items[$item_key] );
1220
+				unset($items[$item_key]);
1221 1221
 				continue;
1222 1222
 			}
1223 1223
 
1224 1224
 			// Is this random plugin's slug already installed? If so, try again.
1225
-			reset( $plugin_slugs );
1226
-			foreach ( $plugin_slugs as $plugin_slug ) {
1227
-				if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) {
1228
-					unset( $items[$item_key] );
1225
+			reset($plugin_slugs);
1226
+			foreach ($plugin_slugs as $plugin_slug) {
1227
+				if ($slug == substr($plugin_slug, 0, strlen($slug))) {
1228
+					unset($items[$item_key]);
1229 1229
 					continue 2;
1230 1230
 				}
1231 1231
 			}
@@ -1235,22 +1235,22 @@  discard block
 block discarded – undo
1235 1235
 		}
1236 1236
 
1237 1237
 		// Eliminate some common badly formed plugin descriptions
1238
-		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1238
+		while ((null !== $item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:'))
1239 1239
 			unset($items[$item_key]);
1240 1240
 
1241
-		if ( !isset($items[$item_key]) )
1241
+		if ( ! isset($items[$item_key]))
1242 1242
 			continue;
1243 1243
 
1244 1244
 		$raw_title = $item->get_title();
1245 1245
 
1246
-		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
1247
-		echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1248
-			'&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1246
+		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin='.$slug, 'install-plugin_'.$slug).'&amp;TB_iframe=true&amp;width=600&amp;height=800';
1247
+		echo '<li class="dashboard-news-plugin"><span>'.__('Popular Plugin').':</span> '.esc_html($raw_title).
1248
+			'&nbsp;<a href="'.$ilink.'" class="thickbox open-plugin-details-modal" aria-label="'.
1249 1249
 			/* translators: %s: plugin name */
1250
-			esc_attr( sprintf( __( 'Install %s' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1250
+			esc_attr(sprintf(__('Install %s'), $raw_title)).'">('.__('Install').')</a></li>';
1251 1251
 
1252 1252
 		$feed->__destruct();
1253
-		unset( $feed );
1253
+		unset($feed);
1254 1254
 	}
1255 1255
 
1256 1256
 	echo '</ul>';
@@ -1266,48 +1266,48 @@  discard block
 block discarded – undo
1266 1266
  * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
1267 1267
  */
1268 1268
 function wp_dashboard_quota() {
1269
-	if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) )
1269
+	if ( ! is_multisite() || ! current_user_can('upload_files') || get_site_option('upload_space_check_disabled'))
1270 1270
 		return true;
1271 1271
 
1272 1272
 	$quota = get_space_allowed();
1273 1273
 	$used = get_space_used();
1274 1274
 
1275
-	if ( $used > $quota )
1275
+	if ($used > $quota)
1276 1276
 		$percentused = '100';
1277 1277
 	else
1278
-		$percentused = ( $used / $quota ) * 100;
1279
-	$used_class = ( $percentused >= 70 ) ? ' warning' : '';
1280
-	$used = round( $used, 2 );
1281
-	$percentused = number_format( $percentused );
1278
+		$percentused = ($used / $quota) * 100;
1279
+	$used_class = ($percentused >= 70) ? ' warning' : '';
1280
+	$used = round($used, 2);
1281
+	$percentused = number_format($percentused);
1282 1282
 
1283 1283
 	?>
1284
-	<h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3>
1284
+	<h3 class="mu-storage"><?php _e('Storage Space'); ?></h3>
1285 1285
 	<div class="mu-storage">
1286 1286
 	<ul>
1287 1287
 		<li class="storage-count">
1288 1288
 			<?php $text = sprintf(
1289 1289
 				/* translators: number of megabytes */
1290
-				__( '%s MB Space Allowed' ),
1291
-				number_format_i18n( $quota )
1290
+				__('%s MB Space Allowed'),
1291
+				number_format_i18n($quota)
1292 1292
 			);
1293 1293
 			printf(
1294 1294
 				'<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
1295
-				esc_url( admin_url( 'upload.php' ) ),
1295
+				esc_url(admin_url('upload.php')),
1296 1296
 				$text,
1297
-				__( 'Manage Uploads' )
1297
+				__('Manage Uploads')
1298 1298
 			); ?>
1299 1299
 		</li><li class="storage-count <?php echo $used_class; ?>">
1300 1300
 			<?php $text = sprintf(
1301 1301
 				/* translators: 1: number of megabytes, 2: percentage */
1302
-				__( '%1$s MB (%2$s%%) Space Used' ),
1303
-				number_format_i18n( $used, 2 ),
1302
+				__('%1$s MB (%2$s%%) Space Used'),
1303
+				number_format_i18n($used, 2),
1304 1304
 				$percentused
1305 1305
 			);
1306 1306
 			printf(
1307 1307
 				'<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>',
1308
-				esc_url( admin_url( 'upload.php' ) ),
1308
+				esc_url(admin_url('upload.php')),
1309 1309
 				$text,
1310
-				__( 'Manage Uploads' )
1310
+				__('Manage Uploads')
1311 1311
 			); ?>
1312 1312
 		</li>
1313 1313
 	</ul>
@@ -1320,35 +1320,35 @@  discard block
 block discarded – undo
1320 1320
 	$notice = '';
1321 1321
 	$response = wp_check_browser_version();
1322 1322
 
1323
-	if ( $response ) {
1324
-		if ( $response['insecure'] ) {
1323
+	if ($response) {
1324
+		if ($response['insecure']) {
1325 1325
 			/* translators: %s: browser name and link */
1326
-			$msg = sprintf( __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ),
1327
-				sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1326
+			$msg = sprintf(__("It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser."),
1327
+				sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name']))
1328 1328
 			);
1329 1329
 		} else {
1330 1330
 			/* translators: %s: browser name and link */
1331
-			$msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ),
1332
-				sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) )
1331
+			$msg = sprintf(__("It looks like you're using an old version of %s. For the best WordPress experience, please update your browser."),
1332
+				sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name']))
1333 1333
 			);
1334 1334
 		}
1335 1335
 
1336 1336
 		$browser_nag_class = '';
1337
-		if ( !empty( $response['img_src'] ) ) {
1338
-			$img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src'];
1337
+		if ( ! empty($response['img_src'])) {
1338
+			$img_src = (is_ssl() && ! empty($response['img_src_ssl'])) ? $response['img_src_ssl'] : $response['img_src'];
1339 1339
 
1340
-			$notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>';
1340
+			$notice .= '<div class="alignright browser-icon"><a href="'.esc_attr($response['update_url']).'"><img src="'.esc_attr($img_src).'" alt="" /></a></div>';
1341 1341
 			$browser_nag_class = ' has-browser-icon';
1342 1342
 		}
1343 1343
 		$notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>";
1344 1344
 
1345 1345
 		$browsehappy = 'http://browsehappy.com/';
1346 1346
 		$locale = get_locale();
1347
-		if ( 'en_US' !== $locale )
1348
-			$browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1347
+		if ('en_US' !== $locale)
1348
+			$browsehappy = add_query_arg('locale', $locale, $browsehappy);
1349 1349
 
1350
-		$notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
1351
-		$notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
1350
+		$notice .= '<p>'.sprintf(__('<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>'), esc_attr($response['update_url']), esc_html($response['name']), esc_url($browsehappy)).'</p>';
1351
+		$notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="'.esc_attr__('Dismiss the browser warning panel').'">'.__('Dismiss').'</a></p>';
1352 1352
 		$notice .= '<div class="clear"></div>';
1353 1353
 	}
1354 1354
 
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
 	* @param string $notice   The notice content.
1361 1361
 	* @param array  $response An array containing web browser information.
1362 1362
 	*/
1363
-	echo apply_filters( 'browse-happy-notice', $notice, $response );
1363
+	echo apply_filters('browse-happy-notice', $notice, $response);
1364 1364
 }
1365 1365
 
1366 1366
 /**
@@ -1369,10 +1369,10 @@  discard block
 block discarded – undo
1369 1369
  * @param array $classes
1370 1370
  * @return array
1371 1371
  */
1372
-function dashboard_browser_nag_class( $classes ) {
1372
+function dashboard_browser_nag_class($classes) {
1373 1373
 	$response = wp_check_browser_version();
1374 1374
 
1375
-	if ( $response && $response['insecure'] )
1375
+	if ($response && $response['insecure'])
1376 1376
 		$classes[] = 'browser-insecure';
1377 1377
 
1378 1378
 	return $classes;
@@ -1388,22 +1388,22 @@  discard block
 block discarded – undo
1388 1388
  * @return array|bool False on failure, array of browser data on success.
1389 1389
  */
1390 1390
 function wp_check_browser_version() {
1391
-	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1391
+	if (empty($_SERVER['HTTP_USER_AGENT']))
1392 1392
 		return false;
1393 1393
 
1394
-	$key = md5( $_SERVER['HTTP_USER_AGENT'] );
1394
+	$key = md5($_SERVER['HTTP_USER_AGENT']);
1395 1395
 
1396
-	if ( false === ($response = get_site_transient('browser_' . $key) ) ) {
1396
+	if (false === ($response = get_site_transient('browser_'.$key))) {
1397 1397
 		global $wp_version;
1398 1398
 
1399 1399
 		$options = array(
1400
-			'body'			=> array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ),
1401
-			'user-agent'	=> 'WordPress/' . $wp_version . '; ' . home_url()
1400
+			'body'			=> array('useragent' => $_SERVER['HTTP_USER_AGENT']),
1401
+			'user-agent'	=> 'WordPress/'.$wp_version.'; '.home_url()
1402 1402
 		);
1403 1403
 
1404
-		$response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options );
1404
+		$response = wp_remote_post('http://api.wordpress.org/core/browse-happy/1.1/', $options);
1405 1405
 
1406
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
1406
+		if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response))
1407 1407
 			return false;
1408 1408
 
1409 1409
 		/**
@@ -1417,12 +1417,12 @@  discard block
 block discarded – undo
1417 1417
 		 *  'img_src' - string - An image representing the browser
1418 1418
 		 *  'img_src_ssl' - string - An image (over SSL) representing the browser
1419 1419
 		 */
1420
-		$response = json_decode( wp_remote_retrieve_body( $response ), true );
1420
+		$response = json_decode(wp_remote_retrieve_body($response), true);
1421 1421
 
1422
-		if ( ! is_array( $response ) )
1422
+		if ( ! is_array($response))
1423 1423
 			return false;
1424 1424
 
1425
-		set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
1425
+		set_site_transient('browser_'.$key, $response, WEEK_IN_SECONDS);
1426 1426
 	}
1427 1427
 
1428 1428
 	return $response;
@@ -1441,55 +1441,55 @@  discard block
 block discarded – undo
1441 1441
 function wp_welcome_panel() {
1442 1442
 	?>
1443 1443
 	<div class="welcome-panel-content">
1444
-	<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>
1445
-	<p class="about-description"><?php _e( 'We&#8217;ve assembled some links to get you started:' ); ?></p>
1444
+	<h2><?php _e('Welcome to WordPress!'); ?></h2>
1445
+	<p class="about-description"><?php _e('We&#8217;ve assembled some links to get you started:'); ?></p>
1446 1446
 	<div class="welcome-panel-column-container">
1447 1447
 	<div class="welcome-panel-column">
1448
-		<?php if ( current_user_can( 'customize' ) ): ?>
1449
-			<h3><?php _e( 'Get Started' ); ?></h3>
1450
-			<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1448
+		<?php if (current_user_can('customize')): ?>
1449
+			<h3><?php _e('Get Started'); ?></h3>
1450
+			<a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e('Customize Your Site'); ?></a>
1451 1451
 		<?php endif; ?>
1452
-		<a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a>
1453
-		<?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?>
1454
-			<p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p>
1452
+		<a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url('themes.php'); ?>"><?php _e('Customize Your Site'); ?></a>
1453
+		<?php if (current_user_can('install_themes') || (current_user_can('switch_themes') && count(wp_get_themes(array('allowed' => true))) > 1)) : ?>
1454
+			<p class="hide-if-no-customize"><?php printf(__('or, <a href="%s">change your theme completely</a>'), admin_url('themes.php')); ?></p>
1455 1455
 		<?php endif; ?>
1456 1456
 	</div>
1457 1457
 	<div class="welcome-panel-column">
1458
-		<h3><?php _e( 'Next Steps' ); ?></h3>
1458
+		<h3><?php _e('Next Steps'); ?></h3>
1459 1459
 		<ul>
1460
-		<?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?>
1461
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
1462
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1463
-		<?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?>
1464
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
1465
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1466
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1460
+		<?php if ('page' == get_option('show_on_front') && ! get_option('page_for_posts')) : ?>
1461
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-edit-page">'.__('Edit your front page').'</a>', get_edit_post_link(get_option('page_on_front'))); ?></li>
1462
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add additional pages').'</a>', admin_url('post-new.php?post_type=page')); ?></li>
1463
+		<?php elseif ('page' == get_option('show_on_front')) : ?>
1464
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-edit-page">'.__('Edit your front page').'</a>', get_edit_post_link(get_option('page_on_front'))); ?></li>
1465
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add additional pages').'</a>', admin_url('post-new.php?post_type=page')); ?></li>
1466
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-write-blog">'.__('Add a blog post').'</a>', admin_url('post-new.php')); ?></li>
1467 1467
 		<?php else : ?>
1468
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1469
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1468
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-write-blog">'.__('Write your first blog post').'</a>', admin_url('post-new.php')); ?></li>
1469
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add an About page').'</a>', admin_url('post-new.php?post_type=page')); ?></li>
1470 1470
 		<?php endif; ?>
1471
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
1471
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-view-site">'.__('View your site').'</a>', home_url('/')); ?></li>
1472 1472
 		</ul>
1473 1473
 	</div>
1474 1474
 	<div class="welcome-panel-column welcome-panel-last">
1475
-		<h3><?php _e( 'More Actions' ); ?></h3>
1475
+		<h3><?php _e('More Actions'); ?></h3>
1476 1476
 		<ul>
1477
-		<?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?>
1477
+		<?php if (current_theme_supports('widgets') || current_theme_supports('menus')) : ?>
1478 1478
 			<li><div class="welcome-icon welcome-widgets-menus"><?php
1479
-				if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) {
1480
-					printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ),
1481
-						admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) );
1482
-				} elseif ( current_theme_supports( 'widgets' ) ) {
1483
-					echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>';
1479
+				if (current_theme_supports('widgets') && current_theme_supports('menus')) {
1480
+					printf(__('Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>'),
1481
+						admin_url('widgets.php'), admin_url('nav-menus.php'));
1482
+				} elseif (current_theme_supports('widgets')) {
1483
+					echo '<a href="'.admin_url('widgets.php').'">'.__('Manage widgets').'</a>';
1484 1484
 				} else {
1485
-					echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>';
1485
+					echo '<a href="'.admin_url('nav-menus.php').'">'.__('Manage menus').'</a>';
1486 1486
 				}
1487 1487
 			?></div></li>
1488 1488
 		<?php endif; ?>
1489
-		<?php if ( current_user_can( 'manage_options' ) ) : ?>
1490
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li>
1489
+		<?php if (current_user_can('manage_options')) : ?>
1490
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-comments">'.__('Turn comments on or off').'</a>', admin_url('options-discussion.php')); ?></li>
1491 1491
 		<?php endif; ?>
1492
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li>
1492
+			<li><?php printf('<a href="%s" class="welcome-icon welcome-learn-more">'.__('Learn more about getting started').'</a>', __('https://codex.wordpress.org/First_Steps_With_WordPress')); ?></li>
1493 1493
 		</ul>
1494 1494
 	</div>
1495 1495
 	</div>
Please login to merge, or discard this patch.
Braces   +94 added lines, -62 removed lines patch added patch discarded remove patch
@@ -28,18 +28,21 @@  discard block
 block discarded – undo
28 28
 
29 29
 	if ( $response && $response['upgrade'] ) {
30 30
 		add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' );
31
-		if ( $response['insecure'] )
32
-			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
33
-		else
34
-			wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
31
+		if ( $response['insecure'] ) {
32
+					wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' );
33
+		} else {
34
+					wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' );
35
+		}
35 36
 	}
36 37
 
37 38
 	// Right Now
38
-	if ( is_blog_admin() && current_user_can('edit_posts') )
39
-		wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
39
+	if ( is_blog_admin() && current_user_can('edit_posts') ) {
40
+			wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' );
41
+	}
40 42
 
41
-	if ( is_network_admin() )
42
-		wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
43
+	if ( is_network_admin() ) {
44
+			wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' );
45
+	}
43 46
 
44 47
 	// Activity Widget
45 48
 	if ( is_blog_admin() ) {
@@ -163,12 +166,14 @@  discard block
 block discarded – undo
163 166
 	$side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' );
164 167
 
165 168
 	$location = 'normal';
166
-	if ( in_array($widget_id, $side_widgets) )
167
-		$location = 'side';
169
+	if ( in_array($widget_id, $side_widgets) ) {
170
+			$location = 'side';
171
+	}
168 172
 
169 173
 	$priority = 'core';
170
-	if ( 'dashboard_browser_nag' === $widget_id )
171
-		$priority = 'high';
174
+	if ( 'dashboard_browser_nag' === $widget_id ) {
175
+			$priority = 'high';
176
+	}
172 177
 
173 178
 	add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args );
174 179
 }
@@ -376,10 +381,12 @@  discard block
 block discarded – undo
376 381
  */
377 382
 function wp_network_dashboard_right_now() {
378 383
 	$actions = array();
379
-	if ( current_user_can('create_sites') )
380
-		$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
381
-	if ( current_user_can('create_users') )
382
-		$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
384
+	if ( current_user_can('create_sites') ) {
385
+			$actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>';
386
+	}
387
+	if ( current_user_can('create_users') ) {
388
+			$actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>';
389
+	}
383 390
 
384 391
 	$c_users = get_user_count();
385 392
 	$c_blogs = get_blog_count();
@@ -476,8 +483,10 @@  discard block
 block discarded – undo
476 483
 		$post = get_default_post_to_edit( 'post' , true);
477 484
 		$user_id = get_current_user_id();
478 485
 		// Don't create an option if this is a super admin who does not belong to this site.
479
-		if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) )
480
-			update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID
486
+		if ( ! ( is_super_admin( $user_id ) && ! in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) ) {
487
+					update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID );
488
+		}
489
+		// Save post_ID
481 490
 	}
482 491
 
483 492
 	$post_ID = (int) $post->ID;
@@ -653,8 +662,9 @@  discard block
 block discarded – undo
653 662
 			( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | ';
654 663
 
655 664
 			// Reply and quickedit need a hide-if-no-js span
656
-			if ( 'reply' == $action || 'quickedit' == $action )
657
-				$action .= ' hide-if-no-js';
665
+			if ( 'reply' == $action || 'quickedit' == $action ) {
666
+							$action .= ' hide-if-no-js';
667
+			}
658 668
 
659 669
 			$actions_string .= "<span class='$action'>$sep$link</span>";
660 670
 		}
@@ -691,10 +701,12 @@  discard block
 block discarded – undo
691 701
 			</p>
692 702
 
693 703
 			<?php
694
-			else :
704
+			else {
705
+				:
695 706
 				switch ( $comment->comment_type ) {
696 707
 					case 'pingback' :
697 708
 						$type = __( 'Pingback' );
709
+			}
698 710
 						break;
699 711
 					case 'trackback' :
700 712
 						$type = __( 'Trackback' );
@@ -883,19 +895,22 @@  discard block
 block discarded – undo
883 895
 		'number' => $total_items * 5,
884 896
 		'offset' => 0
885 897
 	);
886
-	if ( ! current_user_can( 'edit_posts' ) )
887
-		$comments_query['status'] = 'approve';
898
+	if ( ! current_user_can( 'edit_posts' ) ) {
899
+			$comments_query['status'] = 'approve';
900
+	}
888 901
 
889 902
 	while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) {
890 903
 		if ( ! is_array( $possible ) ) {
891 904
 			break;
892 905
 		}
893 906
 		foreach ( $possible as $comment ) {
894
-			if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) )
895
-				continue;
907
+			if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) {
908
+							continue;
909
+			}
896 910
 			$comments[] = $comment;
897
-			if ( count( $comments ) == $total_items )
898
-				break 2;
911
+			if ( count( $comments ) == $total_items ) {
912
+							break 2;
913
+			}
899 914
 		}
900 915
 		$comments_query['offset'] += $comments_query['number'];
901 916
 		$comments_query['number'] = $total_items * 10;
@@ -906,8 +921,9 @@  discard block
 block discarded – undo
906 921
 		echo '<h3>' . __( 'Recent Comments' ) . '</h3>';
907 922
 
908 923
 		echo '<ul id="the-comment-list" data-wp-lists="list:comment">';
909
-		foreach ( $comments as $comment )
910
-			_wp_dashboard_recent_comments_row( $comment );
924
+		foreach ( $comments as $comment ) {
925
+					_wp_dashboard_recent_comments_row( $comment );
926
+		}
911 927
 		echo '</ul>';
912 928
 
913 929
 		if ( current_user_can( 'edit_posts' ) ) {
@@ -1023,11 +1039,13 @@  discard block
 block discarded – undo
1023 1039
  * @param array $form_inputs
1024 1040
  */
1025 1041
 function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) {
1026
-	if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
1027
-		$widget_options = array();
1042
+	if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) {
1043
+			$widget_options = array();
1044
+	}
1028 1045
 
1029
-	if ( !isset($widget_options[$widget_id]) )
1030
-		$widget_options[$widget_id] = array();
1046
+	if ( !isset($widget_options[$widget_id]) ) {
1047
+			$widget_options[$widget_id] = array();
1048
+	}
1031 1049
 
1032 1050
 	$number = 1; // Hack to use wp_widget_rss_form()
1033 1051
 	$widget_options[$widget_id]['number'] = $number;
@@ -1197,16 +1215,18 @@  discard block
 block discarded – undo
1197 1215
 	echo '<ul>';
1198 1216
 
1199 1217
 	foreach ( array( $popular ) as $feed ) {
1200
-		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1201
-			continue;
1218
+		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) {
1219
+					continue;
1220
+		}
1202 1221
 
1203 1222
 		$items = $feed->get_items(0, 5);
1204 1223
 
1205 1224
 		// Pick a random, non-installed plugin
1206 1225
 		while ( true ) {
1207 1226
 			// Abort this foreach loop iteration if there's no plugins left of this type
1208
-			if ( 0 == count($items) )
1209
-				continue 2;
1227
+			if ( 0 == count($items) ) {
1228
+							continue 2;
1229
+			}
1210 1230
 
1211 1231
 			$item_key = array_rand($items);
1212 1232
 			$item = $items[$item_key];
@@ -1214,9 +1234,9 @@  discard block
 block discarded – undo
1214 1234
 			list($link, $frag) = explode( '#', $item->get_link() );
1215 1235
 
1216 1236
 			$link = esc_url($link);
1217
-			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1218
-				$slug = $matches[1];
1219
-			else {
1237
+			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) {
1238
+							$slug = $matches[1];
1239
+			} else {
1220 1240
 				unset( $items[$item_key] );
1221 1241
 				continue;
1222 1242
 			}
@@ -1235,11 +1255,13 @@  discard block
 block discarded – undo
1235 1255
 		}
1236 1256
 
1237 1257
 		// Eliminate some common badly formed plugin descriptions
1238
-		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1239
-			unset($items[$item_key]);
1258
+		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) {
1259
+					unset($items[$item_key]);
1260
+		}
1240 1261
 
1241
-		if ( !isset($items[$item_key]) )
1242
-			continue;
1262
+		if ( !isset($items[$item_key]) ) {
1263
+					continue;
1264
+		}
1243 1265
 
1244 1266
 		$raw_title = $item->get_title();
1245 1267
 
@@ -1266,16 +1288,18 @@  discard block
 block discarded – undo
1266 1288
  * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled.
1267 1289
  */
1268 1290
 function wp_dashboard_quota() {
1269
-	if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) )
1270
-		return true;
1291
+	if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) {
1292
+			return true;
1293
+	}
1271 1294
 
1272 1295
 	$quota = get_space_allowed();
1273 1296
 	$used = get_space_used();
1274 1297
 
1275
-	if ( $used > $quota )
1276
-		$percentused = '100';
1277
-	else
1278
-		$percentused = ( $used / $quota ) * 100;
1298
+	if ( $used > $quota ) {
1299
+			$percentused = '100';
1300
+	} else {
1301
+			$percentused = ( $used / $quota ) * 100;
1302
+	}
1279 1303
 	$used_class = ( $percentused >= 70 ) ? ' warning' : '';
1280 1304
 	$used = round( $used, 2 );
1281 1305
 	$percentused = number_format( $percentused );
@@ -1344,8 +1368,9 @@  discard block
 block discarded – undo
1344 1368
 
1345 1369
 		$browsehappy = 'http://browsehappy.com/';
1346 1370
 		$locale = get_locale();
1347
-		if ( 'en_US' !== $locale )
1348
-			$browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1371
+		if ( 'en_US' !== $locale ) {
1372
+					$browsehappy = add_query_arg( 'locale', $locale, $browsehappy );
1373
+		}
1349 1374
 
1350 1375
 		$notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>';
1351 1376
 		$notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>';
@@ -1372,8 +1397,9 @@  discard block
 block discarded – undo
1372 1397
 function dashboard_browser_nag_class( $classes ) {
1373 1398
 	$response = wp_check_browser_version();
1374 1399
 
1375
-	if ( $response && $response['insecure'] )
1376
-		$classes[] = 'browser-insecure';
1400
+	if ( $response && $response['insecure'] ) {
1401
+			$classes[] = 'browser-insecure';
1402
+	}
1377 1403
 
1378 1404
 	return $classes;
1379 1405
 }
@@ -1388,8 +1414,9 @@  discard block
 block discarded – undo
1388 1414
  * @return array|bool False on failure, array of browser data on success.
1389 1415
  */
1390 1416
 function wp_check_browser_version() {
1391
-	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) )
1392
-		return false;
1417
+	if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) {
1418
+			return false;
1419
+	}
1393 1420
 
1394 1421
 	$key = md5( $_SERVER['HTTP_USER_AGENT'] );
1395 1422
 
@@ -1403,8 +1430,9 @@  discard block
 block discarded – undo
1403 1430
 
1404 1431
 		$response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options );
1405 1432
 
1406
-		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
1407
-			return false;
1433
+		if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
1434
+					return false;
1435
+		}
1408 1436
 
1409 1437
 		/**
1410 1438
 		 * Response should be an array with:
@@ -1419,8 +1447,9 @@  discard block
 block discarded – undo
1419 1447
 		 */
1420 1448
 		$response = json_decode( wp_remote_retrieve_body( $response ), true );
1421 1449
 
1422
-		if ( ! is_array( $response ) )
1423
-			return false;
1450
+		if ( ! is_array( $response ) ) {
1451
+					return false;
1452
+		}
1424 1453
 
1425 1454
 		set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS );
1426 1455
 	}
@@ -1464,8 +1493,11 @@  discard block
 block discarded – undo
1464 1493
 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li>
1465 1494
 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1466 1495
 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1467
-		<?php else : ?>
1468
-			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li>
1496
+		<?php else {
1497
+	: ?>
1498
+			<li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) );
1499
+}
1500
+?></li>
1469 1501
 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li>
1470 1502
 		<?php endif; ?>
1471 1503
 			<li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li>
Please login to merge, or discard this patch.
src/wp-admin/includes/file.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -833,7 +833,7 @@
 block discarded – undo
833 833
  *
834 834
  * @global WP_Filesystem_Base $wp_filesystem Subclass
835 835
  *
836
- * @param array|false  $args                         Optional. Connection args, These are passed directly to
836
+ * @param boolean  $args                         Optional. Connection args, These are passed directly to
837 837
  *                                                   the `WP_Filesystem_*()` classes. Default false.
838 838
  * @param string|false $context                      Optional. Context for get_filesystem_method(). Default false.
839 839
  * @param bool         $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
Please login to merge, or discard this patch.
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Filesystem API: Top-level functionality
4
- *
5
- * Functions for reading, writing, modifying, and deleting files on the file system.
6
- * Includes functionality for theme-specific files as well as operations for uploading,
7
- * archiving, and rendering output when necessary.
8
- *
9
- * @package WordPress
10
- * @subpackage Filesystem
11
- * @since 2.3.0
12
- */
3
+	 * Filesystem API: Top-level functionality
4
+	 *
5
+	 * Functions for reading, writing, modifying, and deleting files on the file system.
6
+	 * Includes functionality for theme-specific files as well as operations for uploading,
7
+	 * archiving, and rendering output when necessary.
8
+	 *
9
+	 * @package WordPress
10
+	 * @subpackage Filesystem
11
+	 * @since 2.3.0
12
+	 */
13 13
 
14 14
 /** The descriptions for theme files. */
15 15
 $wp_file_descriptions = array(
Please login to merge, or discard this patch.
Spacing   +366 added lines, -366 removed lines patch added patch discarded remove patch
@@ -13,48 +13,48 @@  discard block
 block discarded – undo
13 13
 
14 14
 /** The descriptions for theme files. */
15 15
 $wp_file_descriptions = array(
16
-	'functions.php'         => __( 'Theme Functions' ),
17
-	'header.php'            => __( 'Theme Header' ),
18
-	'footer.php'            => __( 'Theme Footer' ),
19
-	'sidebar.php'           => __( 'Sidebar' ),
20
-	'comments.php'          => __( 'Comments' ),
21
-	'searchform.php'        => __( 'Search Form' ),
22
-	'404.php'               => __( '404 Template' ),
23
-	'link.php'              => __( 'Links Template' ),
16
+	'functions.php'         => __('Theme Functions'),
17
+	'header.php'            => __('Theme Header'),
18
+	'footer.php'            => __('Theme Footer'),
19
+	'sidebar.php'           => __('Sidebar'),
20
+	'comments.php'          => __('Comments'),
21
+	'searchform.php'        => __('Search Form'),
22
+	'404.php'               => __('404 Template'),
23
+	'link.php'              => __('Links Template'),
24 24
 	// Archives
25
-	'index.php'             => __( 'Main Index Template' ),
26
-	'archive.php'           => __( 'Archives' ),
27
-	'author.php'            => __( 'Author Template' ),
28
-	'taxonomy.php'          => __( 'Taxonomy Template' ),
29
-	'category.php'          => __( 'Category Template' ),
30
-	'tag.php'               => __( 'Tag Template' ),
31
-	'home.php'              => __( 'Posts Page' ),
32
-	'search.php'            => __( 'Search Results' ),
33
-	'date.php'              => __( 'Date Template' ),
25
+	'index.php'             => __('Main Index Template'),
26
+	'archive.php'           => __('Archives'),
27
+	'author.php'            => __('Author Template'),
28
+	'taxonomy.php'          => __('Taxonomy Template'),
29
+	'category.php'          => __('Category Template'),
30
+	'tag.php'               => __('Tag Template'),
31
+	'home.php'              => __('Posts Page'),
32
+	'search.php'            => __('Search Results'),
33
+	'date.php'              => __('Date Template'),
34 34
 	// Content
35
-	'singular.php'          => __( 'Singular Template' ),
36
-	'single.php'            => __( 'Single Post' ),
37
-	'page.php'              => __( 'Single Page' ),
38
-	'front-page.php'        => __( 'Static Front Page' ),
35
+	'singular.php'          => __('Singular Template'),
36
+	'single.php'            => __('Single Post'),
37
+	'page.php'              => __('Single Page'),
38
+	'front-page.php'        => __('Static Front Page'),
39 39
 	// Attachments
40
-	'attachment.php'        => __( 'Attachment Template' ),
41
-	'image.php'             => __( 'Image Attachment Template' ),
42
-	'video.php'             => __( 'Video Attachment Template' ),
43
-	'audio.php'             => __( 'Audio Attachment Template' ),
44
-	'application.php'       => __( 'Application Attachment Template' ),
40
+	'attachment.php'        => __('Attachment Template'),
41
+	'image.php'             => __('Image Attachment Template'),
42
+	'video.php'             => __('Video Attachment Template'),
43
+	'audio.php'             => __('Audio Attachment Template'),
44
+	'application.php'       => __('Application Attachment Template'),
45 45
 	// Stylesheets
46
-	'style.css'             => __( 'Stylesheet' ),
47
-	'editor-style.css'      => __( 'Visual Editor Stylesheet' ),
48
-	'editor-style-rtl.css'  => __( 'Visual Editor RTL Stylesheet' ),
49
-	'rtl.css'               => __( 'RTL Stylesheet' ),
46
+	'style.css'             => __('Stylesheet'),
47
+	'editor-style.css'      => __('Visual Editor Stylesheet'),
48
+	'editor-style-rtl.css'  => __('Visual Editor RTL Stylesheet'),
49
+	'rtl.css'               => __('RTL Stylesheet'),
50 50
 	// Other
51
-	'my-hacks.php'          => __( 'my-hacks.php (legacy hacks support)' ),
52
-	'.htaccess'             => __( '.htaccess (for rewrite rules )' ),
51
+	'my-hacks.php'          => __('my-hacks.php (legacy hacks support)'),
52
+	'.htaccess'             => __('.htaccess (for rewrite rules )'),
53 53
 	// Deprecated files
54
-	'wp-layout.css'         => __( 'Stylesheet' ),
55
-	'wp-comments.php'       => __( 'Comments Template' ),
56
-	'wp-comments-popup.php' => __( 'Popup Comments Template' ),
57
-	'comments-popup.php'    => __( 'Popup Comments' ),
54
+	'wp-layout.css'         => __('Stylesheet'),
55
+	'wp-comments.php'       => __('Comments Template'),
56
+	'wp-comments-popup.php' => __('Popup Comments Template'),
57
+	'comments-popup.php'    => __('Popup Comments'),
58 58
 );
59 59
 
60 60
 /**
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
  * @return string Description of file from $wp_file_descriptions or basename of $file if description doesn't exist.
69 69
  *                Appends 'Page Template' to basename of $file if the file is a page template
70 70
  */
71
-function get_file_description( $file ) {
71
+function get_file_description($file) {
72 72
 	global $wp_file_descriptions, $allowed_files;
73 73
 
74
-	$relative_pathinfo = pathinfo( $file );
75
-	$file_path = $allowed_files[ $file ];
76
-	if ( isset( $wp_file_descriptions[ basename( $file ) ] ) && '.' === $relative_pathinfo['dirname'] ) {
77
-		return $wp_file_descriptions[ basename( $file ) ];
78
-	} elseif ( file_exists( $file_path ) && is_file( $file_path ) ) {
79
-		$template_data = implode( '', file( $file_path ) );
80
-		if ( preg_match( '|Template Name:(.*)$|mi', $template_data, $name ) ) {
81
-			return sprintf( __( '%s Page Template' ), _cleanup_header_comment( $name[1] ) );
74
+	$relative_pathinfo = pathinfo($file);
75
+	$file_path = $allowed_files[$file];
76
+	if (isset($wp_file_descriptions[basename($file)]) && '.' === $relative_pathinfo['dirname']) {
77
+		return $wp_file_descriptions[basename($file)];
78
+	} elseif (file_exists($file_path) && is_file($file_path)) {
79
+		$template_data = implode('', file($file_path));
80
+		if (preg_match('|Template Name:(.*)$|mi', $template_data, $name)) {
81
+			return sprintf(__('%s Page Template'), _cleanup_header_comment($name[1]));
82 82
 		}
83 83
 	}
84 84
 
85
-	return trim( basename( $file ) );
85
+	return trim(basename($file));
86 86
 }
87 87
 
88 88
 /**
@@ -93,18 +93,18 @@  discard block
 block discarded – undo
93 93
  * @return string Full filesystem path to the root of the WordPress installation
94 94
  */
95 95
 function get_home_path() {
96
-	$home    = set_url_scheme( get_option( 'home' ), 'http' );
97
-	$siteurl = set_url_scheme( get_option( 'siteurl' ), 'http' );
98
-	if ( ! empty( $home ) && 0 !== strcasecmp( $home, $siteurl ) ) {
99
-		$wp_path_rel_to_home = str_ireplace( $home, '', $siteurl ); /* $siteurl - $home */
100
-		$pos = strripos( str_replace( '\\', '/', $_SERVER['SCRIPT_FILENAME'] ), trailingslashit( $wp_path_rel_to_home ) );
101
-		$home_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, $pos );
102
-		$home_path = trailingslashit( $home_path );
96
+	$home    = set_url_scheme(get_option('home'), 'http');
97
+	$siteurl = set_url_scheme(get_option('siteurl'), 'http');
98
+	if ( ! empty($home) && 0 !== strcasecmp($home, $siteurl)) {
99
+		$wp_path_rel_to_home = str_ireplace($home, '', $siteurl); /* $siteurl - $home */
100
+		$pos = strripos(str_replace('\\', '/', $_SERVER['SCRIPT_FILENAME']), trailingslashit($wp_path_rel_to_home));
101
+		$home_path = substr($_SERVER['SCRIPT_FILENAME'], 0, $pos);
102
+		$home_path = trailingslashit($home_path);
103 103
 	} else {
104 104
 		$home_path = ABSPATH;
105 105
 	}
106 106
 
107
-	return str_replace( '\\', '/', $home_path );
107
+	return str_replace('\\', '/', $home_path);
108 108
 }
109 109
 
110 110
 /**
@@ -117,30 +117,30 @@  discard block
 block discarded – undo
117 117
  * @param int    $levels Optional. Levels of folders to follow, Default 100 (PHP Loop limit).
118 118
  * @return bool|array False on failure, Else array of files
119 119
  */
120
-function list_files( $folder = '', $levels = 100 ) {
121
-	if ( empty($folder) )
120
+function list_files($folder = '', $levels = 100) {
121
+	if (empty($folder))
122 122
 		return false;
123 123
 
124
-	if ( ! $levels )
124
+	if ( ! $levels)
125 125
 		return false;
126 126
 
127 127
 	$files = array();
128
-	if ( $dir = @opendir( $folder ) ) {
129
-		while (($file = readdir( $dir ) ) !== false ) {
130
-			if ( in_array($file, array('.', '..') ) )
128
+	if ($dir = @opendir($folder)) {
129
+		while (($file = readdir($dir)) !== false) {
130
+			if (in_array($file, array('.', '..')))
131 131
 				continue;
132
-			if ( is_dir( $folder . '/' . $file ) ) {
133
-				$files2 = list_files( $folder . '/' . $file, $levels - 1);
134
-				if ( $files2 )
135
-					$files = array_merge($files, $files2 );
132
+			if (is_dir($folder.'/'.$file)) {
133
+				$files2 = list_files($folder.'/'.$file, $levels - 1);
134
+				if ($files2)
135
+					$files = array_merge($files, $files2);
136 136
 				else
137
-					$files[] = $folder . '/' . $file . '/';
137
+					$files[] = $folder.'/'.$file.'/';
138 138
 			} else {
139
-				$files[] = $folder . '/' . $file;
139
+				$files[] = $folder.'/'.$file;
140 140
 			}
141 141
 		}
142 142
 	}
143
-	@closedir( $dir );
143
+	@closedir($dir);
144 144
 	return $files;
145 145
 }
146 146
 
@@ -157,35 +157,35 @@  discard block
 block discarded – undo
157 157
  * @param string $dir      Optional. Directory to store the file in. Default empty.
158 158
  * @return string a writable filename
159 159
  */
160
-function wp_tempnam( $filename = '', $dir = '' ) {
161
-	if ( empty( $dir ) ) {
160
+function wp_tempnam($filename = '', $dir = '') {
161
+	if (empty($dir)) {
162 162
 		$dir = get_temp_dir();
163 163
 	}
164 164
 
165
-	if ( empty( $filename ) || '.' == $filename || '/' == $filename ) {
165
+	if (empty($filename) || '.' == $filename || '/' == $filename) {
166 166
 		$filename = time();
167 167
 	}
168 168
 
169 169
 	// Use the basename of the given file without the extension as the name for the temporary directory
170
-	$temp_filename = basename( $filename );
171
-	$temp_filename = preg_replace( '|\.[^.]*$|', '', $temp_filename );
170
+	$temp_filename = basename($filename);
171
+	$temp_filename = preg_replace('|\.[^.]*$|', '', $temp_filename);
172 172
 
173 173
 	// If the folder is falsey, use its parent directory name instead.
174
-	if ( ! $temp_filename ) {
175
-		return wp_tempnam( dirname( $filename ), $dir );
174
+	if ( ! $temp_filename) {
175
+		return wp_tempnam(dirname($filename), $dir);
176 176
 	}
177 177
 
178 178
 	// Suffix some random data to avoid filename conflicts
179
-	$temp_filename .= '-' . wp_generate_password( 6, false );
179
+	$temp_filename .= '-'.wp_generate_password(6, false);
180 180
 	$temp_filename .= '.tmp';
181
-	$temp_filename = $dir . wp_unique_filename( $dir, $temp_filename );
181
+	$temp_filename = $dir.wp_unique_filename($dir, $temp_filename);
182 182
 
183
-	$fp = @fopen( $temp_filename, 'x' );
184
-	if ( ! $fp && is_writable( $dir ) && file_exists( $temp_filename ) ) {
185
-		return wp_tempnam( $filename, $dir );
183
+	$fp = @fopen($temp_filename, 'x');
184
+	if ( ! $fp && is_writable($dir) && file_exists($temp_filename)) {
185
+		return wp_tempnam($filename, $dir);
186 186
 	}
187
-	if ( $fp ) {
188
-		fclose( $fp );
187
+	if ($fp) {
188
+		fclose($fp);
189 189
 	}
190 190
 
191 191
 	return $temp_filename;
@@ -202,21 +202,21 @@  discard block
 block discarded – undo
202 202
  * @param array $allowed_files Array of allowed files to edit, $file must match an entry exactly
203 203
  * @return string|null
204 204
  */
205
-function validate_file_to_edit( $file, $allowed_files = '' ) {
206
-	$code = validate_file( $file, $allowed_files );
205
+function validate_file_to_edit($file, $allowed_files = '') {
206
+	$code = validate_file($file, $allowed_files);
207 207
 
208
-	if (!$code )
208
+	if ( ! $code)
209 209
 		return $file;
210 210
 
211
-	switch ( $code ) {
211
+	switch ($code) {
212 212
 		case 1 :
213
-			wp_die( __( 'Sorry, that file cannot be edited.' ) );
213
+			wp_die(__('Sorry, that file cannot be edited.'));
214 214
 
215 215
 		// case 2 :
216 216
 		// wp_die( __('Sorry, can&#8217;t call files with their real path.' ));
217 217
 
218 218
 		case 3 :
219
-			wp_die( __( 'Sorry, that file cannot be edited.' ) );
219
+			wp_die(__('Sorry, that file cannot be edited.'));
220 220
 	}
221 221
 }
222 222
 
@@ -236,11 +236,11 @@  discard block
 block discarded – undo
236 236
  * @return array On success, returns an associative array of file attributes. On failure, returns
237 237
  *               $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
238 238
  */
239
-function _wp_handle_upload( &$file, $overrides, $time, $action ) {
239
+function _wp_handle_upload(&$file, $overrides, $time, $action) {
240 240
 	// The default error handler.
241
-	if ( ! function_exists( 'wp_handle_upload_error' ) ) {
242
-		function wp_handle_upload_error( &$file, $message ) {
243
-			return array( 'error' => $message );
241
+	if ( ! function_exists('wp_handle_upload_error')) {
242
+		function wp_handle_upload_error(&$file, $message) {
243
+			return array('error' => $message);
244 244
 		}
245 245
 	}
246 246
 
@@ -254,24 +254,24 @@  discard block
 block discarded – undo
254 254
 	 *
255 255
 	 * @param array $file An array of data for a single file.
256 256
 	 */
257
-	$file = apply_filters( "{$action}_prefilter", $file );
257
+	$file = apply_filters("{$action}_prefilter", $file);
258 258
 
259 259
 	// You may define your own function and pass the name in $overrides['upload_error_handler']
260 260
 	$upload_error_handler = 'wp_handle_upload_error';
261
-	if ( isset( $overrides['upload_error_handler'] ) ) {
261
+	if (isset($overrides['upload_error_handler'])) {
262 262
 		$upload_error_handler = $overrides['upload_error_handler'];
263 263
 	}
264 264
 
265 265
 	// You may have had one or more 'wp_handle_upload_prefilter' functions error out the file. Handle that gracefully.
266
-	if ( isset( $file['error'] ) && ! is_numeric( $file['error'] ) && $file['error'] ) {
267
-		return $upload_error_handler( $file, $file['error'] );
266
+	if (isset($file['error']) && ! is_numeric($file['error']) && $file['error']) {
267
+		return $upload_error_handler($file, $file['error']);
268 268
 	}
269 269
 
270 270
 	// Install user overrides. Did we mention that this voids your warranty?
271 271
 
272 272
 	// You may define your own function and pass the name in $overrides['unique_filename_callback']
273 273
 	$unique_filename_callback = null;
274
-	if ( isset( $overrides['unique_filename_callback'] ) ) {
274
+	if (isset($overrides['unique_filename_callback'])) {
275 275
 		$unique_filename_callback = $overrides['unique_filename_callback'];
276 276
 	}
277 277
 
@@ -279,72 +279,72 @@  discard block
 block discarded – undo
279 279
 	 * This may not have orignially been intended to be overrideable,
280 280
 	 * but historically has been.
281 281
 	 */
282
-	if ( isset( $overrides['upload_error_strings'] ) ) {
282
+	if (isset($overrides['upload_error_strings'])) {
283 283
 		$upload_error_strings = $overrides['upload_error_strings'];
284 284
 	} else {
285 285
 		// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
286 286
 		$upload_error_strings = array(
287 287
 			false,
288
-			__( 'The uploaded file exceeds the upload_max_filesize directive in php.ini.' ),
289
-			__( 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.' ),
290
-			__( 'The uploaded file was only partially uploaded.' ),
291
-			__( 'No file was uploaded.' ),
288
+			__('The uploaded file exceeds the upload_max_filesize directive in php.ini.'),
289
+			__('The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form.'),
290
+			__('The uploaded file was only partially uploaded.'),
291
+			__('No file was uploaded.'),
292 292
 			'',
293
-			__( 'Missing a temporary folder.' ),
294
-			__( 'Failed to write file to disk.' ),
295
-			__( 'File upload stopped by extension.' )
293
+			__('Missing a temporary folder.'),
294
+			__('Failed to write file to disk.'),
295
+			__('File upload stopped by extension.')
296 296
 		);
297 297
 	}
298 298
 
299 299
 	// All tests are on by default. Most can be turned off by $overrides[{test_name}] = false;
300
-	$test_form = isset( $overrides['test_form'] ) ? $overrides['test_form'] : true;
301
-	$test_size = isset( $overrides['test_size'] ) ? $overrides['test_size'] : true;
300
+	$test_form = isset($overrides['test_form']) ? $overrides['test_form'] : true;
301
+	$test_size = isset($overrides['test_size']) ? $overrides['test_size'] : true;
302 302
 
303 303
 	// If you override this, you must provide $ext and $type!!
304
-	$test_type = isset( $overrides['test_type'] ) ? $overrides['test_type'] : true;
305
-	$mimes = isset( $overrides['mimes'] ) ? $overrides['mimes'] : false;
304
+	$test_type = isset($overrides['test_type']) ? $overrides['test_type'] : true;
305
+	$mimes = isset($overrides['mimes']) ? $overrides['mimes'] : false;
306 306
 
307 307
 	// A correct form post will pass this test.
308
-	if ( $test_form && ( ! isset( $_POST['action'] ) || ( $_POST['action'] != $action ) ) ) {
309
-		return call_user_func( $upload_error_handler, $file, __( 'Invalid form submission.' ) );
308
+	if ($test_form && ( ! isset($_POST['action']) || ($_POST['action'] != $action))) {
309
+		return call_user_func($upload_error_handler, $file, __('Invalid form submission.'));
310 310
 	}
311 311
 	// A successful upload will pass this test. It makes no sense to override this one.
312
-	if ( isset( $file['error'] ) && $file['error'] > 0 ) {
313
-		return call_user_func( $upload_error_handler, $file, $upload_error_strings[ $file['error'] ] );
312
+	if (isset($file['error']) && $file['error'] > 0) {
313
+		return call_user_func($upload_error_handler, $file, $upload_error_strings[$file['error']]);
314 314
 	}
315 315
 
316
-	$test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize( $file['tmp_name'] );
316
+	$test_file_size = 'wp_handle_upload' === $action ? $file['size'] : filesize($file['tmp_name']);
317 317
 	// A non-empty file will pass this test.
318
-	if ( $test_size && ! ( $test_file_size > 0 ) ) {
319
-		if ( is_multisite() ) {
320
-			$error_msg = __( 'File is empty. Please upload something more substantial.' );
318
+	if ($test_size && ! ($test_file_size > 0)) {
319
+		if (is_multisite()) {
320
+			$error_msg = __('File is empty. Please upload something more substantial.');
321 321
 		} else {
322
-			$error_msg = __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.' );
322
+			$error_msg = __('File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini or by post_max_size being defined as smaller than upload_max_filesize in php.ini.');
323 323
 		}
324
-		return call_user_func( $upload_error_handler, $file, $error_msg );
324
+		return call_user_func($upload_error_handler, $file, $error_msg);
325 325
 	}
326 326
 
327 327
 	// A properly uploaded file will pass this test. There should be no reason to override this one.
328
-	$test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file( $file['tmp_name'] ) : @ is_file( $file['tmp_name'] );
329
-	if ( ! $test_uploaded_file ) {
330
-		return call_user_func( $upload_error_handler, $file, __( 'Specified file failed upload test.' ) );
328
+	$test_uploaded_file = 'wp_handle_upload' === $action ? @ is_uploaded_file($file['tmp_name']) : @ is_file($file['tmp_name']);
329
+	if ( ! $test_uploaded_file) {
330
+		return call_user_func($upload_error_handler, $file, __('Specified file failed upload test.'));
331 331
 	}
332 332
 
333 333
 	// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
334
-	if ( $test_type ) {
335
-		$wp_filetype = wp_check_filetype_and_ext( $file['tmp_name'], $file['name'], $mimes );
336
-		$ext = empty( $wp_filetype['ext'] ) ? '' : $wp_filetype['ext'];
337
-		$type = empty( $wp_filetype['type'] ) ? '' : $wp_filetype['type'];
338
-		$proper_filename = empty( $wp_filetype['proper_filename'] ) ? '' : $wp_filetype['proper_filename'];
334
+	if ($test_type) {
335
+		$wp_filetype = wp_check_filetype_and_ext($file['tmp_name'], $file['name'], $mimes);
336
+		$ext = empty($wp_filetype['ext']) ? '' : $wp_filetype['ext'];
337
+		$type = empty($wp_filetype['type']) ? '' : $wp_filetype['type'];
338
+		$proper_filename = empty($wp_filetype['proper_filename']) ? '' : $wp_filetype['proper_filename'];
339 339
 
340 340
 		// Check to see if wp_check_filetype_and_ext() determined the filename was incorrect
341
-		if ( $proper_filename ) {
341
+		if ($proper_filename) {
342 342
 			$file['name'] = $proper_filename;
343 343
 		}
344
-		if ( ( ! $type || !$ext ) && ! current_user_can( 'unfiltered_upload' ) ) {
345
-			return call_user_func( $upload_error_handler, $file, __( 'Sorry, this file type is not permitted for security reasons.' ) );
344
+		if (( ! $type || ! $ext) && ! current_user_can('unfiltered_upload')) {
345
+			return call_user_func($upload_error_handler, $file, __('Sorry, this file type is not permitted for security reasons.'));
346 346
 		}
347
-		if ( ! $type ) {
347
+		if ( ! $type) {
348 348
 			$type = $file['type'];
349 349
 		}
350 350
 	} else {
@@ -355,41 +355,41 @@  discard block
 block discarded – undo
355 355
 	 * A writable uploads dir will pass this test. Again, there's no point
356 356
 	 * overriding this one.
357 357
 	 */
358
-	if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) {
359
-		return call_user_func( $upload_error_handler, $file, $uploads['error'] );
358
+	if ( ! (($uploads = wp_upload_dir($time)) && false === $uploads['error'])) {
359
+		return call_user_func($upload_error_handler, $file, $uploads['error']);
360 360
 	}
361 361
 
362
-	$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
362
+	$filename = wp_unique_filename($uploads['path'], $file['name'], $unique_filename_callback);
363 363
 
364 364
 	// Move the file to the uploads dir.
365
-	$new_file = $uploads['path'] . "/$filename";
366
-	if ( 'wp_handle_upload' === $action ) {
367
-		$move_new_file = @ move_uploaded_file( $file['tmp_name'], $new_file );
365
+	$new_file = $uploads['path']."/$filename";
366
+	if ('wp_handle_upload' === $action) {
367
+		$move_new_file = @ move_uploaded_file($file['tmp_name'], $new_file);
368 368
 	} else {
369 369
 		// use copy and unlink because rename breaks streams.
370
-		$move_new_file = @ copy( $file['tmp_name'], $new_file );
371
-		unlink( $file['tmp_name'] );
370
+		$move_new_file = @ copy($file['tmp_name'], $new_file);
371
+		unlink($file['tmp_name']);
372 372
 	}
373 373
 
374
-	if ( false === $move_new_file ) {
375
-		if ( 0 === strpos( $uploads['basedir'], ABSPATH ) ) {
376
-			$error_path = str_replace( ABSPATH, '', $uploads['basedir'] ) . $uploads['subdir'];
374
+	if (false === $move_new_file) {
375
+		if (0 === strpos($uploads['basedir'], ABSPATH)) {
376
+			$error_path = str_replace(ABSPATH, '', $uploads['basedir']).$uploads['subdir'];
377 377
 		} else {
378
-			$error_path = basename( $uploads['basedir'] ) . $uploads['subdir'];
378
+			$error_path = basename($uploads['basedir']).$uploads['subdir'];
379 379
 		}
380
-		return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $error_path ) );
380
+		return $upload_error_handler($file, sprintf(__('The uploaded file could not be moved to %s.'), $error_path));
381 381
 	}
382 382
 
383 383
 	// Set correct file permissions.
384
-	$stat = stat( dirname( $new_file ));
384
+	$stat = stat(dirname($new_file));
385 385
 	$perms = $stat['mode'] & 0000666;
386
-	@ chmod( $new_file, $perms );
386
+	@ chmod($new_file, $perms);
387 387
 
388 388
 	// Compute the URL.
389
-	$url = $uploads['url'] . "/$filename";
389
+	$url = $uploads['url']."/$filename";
390 390
 
391
-	if ( is_multisite() ) {
392
-		delete_transient( 'dirsize_cache' );
391
+	if (is_multisite()) {
392
+		delete_transient('dirsize_cache');
393 393
 	}
394 394
 
395 395
 	/**
@@ -406,11 +406,11 @@  discard block
 block discarded – undo
406 406
 	 * }
407 407
 	 * @param string $context The type of upload action. Values include 'upload' or 'sideload'.
408 408
 	 */
409
-	return apply_filters( 'wp_handle_upload', array(
409
+	return apply_filters('wp_handle_upload', array(
410 410
 		'file' => $new_file,
411 411
 		'url'  => $url,
412 412
 		'type' => $type
413
-	), 'wp_handle_sideload' === $action ? 'sideload' : 'upload' );
413
+	), 'wp_handle_sideload' === $action ? 'sideload' : 'upload');
414 414
 }
415 415
 
416 416
 /**
@@ -428,17 +428,17 @@  discard block
 block discarded – undo
428 428
  * @return array On success, returns an associative array of file attributes. On failure, returns
429 429
  *               $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
430 430
  */
431
-function wp_handle_upload( &$file, $overrides = false, $time = null ) {
431
+function wp_handle_upload(&$file, $overrides = false, $time = null) {
432 432
 	/*
433 433
 	 *  $_POST['action'] must be set and its value must equal $overrides['action']
434 434
 	 *  or this:
435 435
 	 */
436 436
 	$action = 'wp_handle_upload';
437
-	if ( isset( $overrides['action'] ) ) {
437
+	if (isset($overrides['action'])) {
438 438
 		$action = $overrides['action'];
439 439
 	}
440 440
 
441
-	return _wp_handle_upload( $file, $overrides, $time, $action );
441
+	return _wp_handle_upload($file, $overrides, $time, $action);
442 442
 }
443 443
 
444 444
 /**
@@ -455,16 +455,16 @@  discard block
 block discarded – undo
455 455
  * @return array On success, returns an associative array of file attributes. On failure, returns
456 456
  *               $overrides['upload_error_handler'](&$file, $message ) or array( 'error'=>$message ).
457 457
  */
458
-function wp_handle_sideload( &$file, $overrides = false, $time = null ) {
458
+function wp_handle_sideload(&$file, $overrides = false, $time = null) {
459 459
 	/*
460 460
 	 *  $_POST['action'] must be set and its value must equal $overrides['action']
461 461
 	 *  or this:
462 462
 	 */
463 463
 	$action = 'wp_handle_sideload';
464
-	if ( isset( $overrides['action'] ) ) {
464
+	if (isset($overrides['action'])) {
465 465
 		$action = $overrides['action'];
466 466
 	}
467
-	return _wp_handle_upload( $file, $overrides, $time, $action );
467
+	return _wp_handle_upload($file, $overrides, $time, $action);
468 468
 }
469 469
 
470 470
 
@@ -478,32 +478,32 @@  discard block
 block discarded – undo
478 478
  * @param int $timeout The timeout for the request to download the file default 300 seconds
479 479
  * @return mixed WP_Error on failure, string Filename on success.
480 480
  */
481
-function download_url( $url, $timeout = 300 ) {
481
+function download_url($url, $timeout = 300) {
482 482
 	//WARNING: The file is not automatically deleted, The script must unlink() the file.
483
-	if ( ! $url )
483
+	if ( ! $url)
484 484
 		return new WP_Error('http_no_url', __('Invalid URL Provided.'));
485 485
 
486 486
 	$tmpfname = wp_tempnam($url);
487
-	if ( ! $tmpfname )
487
+	if ( ! $tmpfname)
488 488
 		return new WP_Error('http_no_file', __('Could not create Temporary file.'));
489 489
 
490
-	$response = wp_safe_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname ) );
490
+	$response = wp_safe_remote_get($url, array('timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname));
491 491
 
492
-	if ( is_wp_error( $response ) ) {
493
-		unlink( $tmpfname );
492
+	if (is_wp_error($response)) {
493
+		unlink($tmpfname);
494 494
 		return $response;
495 495
 	}
496 496
 
497
-	if ( 200 != wp_remote_retrieve_response_code( $response ) ){
498
-		unlink( $tmpfname );
499
-		return new WP_Error( 'http_404', trim( wp_remote_retrieve_response_message( $response ) ) );
497
+	if (200 != wp_remote_retrieve_response_code($response)) {
498
+		unlink($tmpfname);
499
+		return new WP_Error('http_404', trim(wp_remote_retrieve_response_message($response)));
500 500
 	}
501 501
 
502
-	$content_md5 = wp_remote_retrieve_header( $response, 'content-md5' );
503
-	if ( $content_md5 ) {
504
-		$md5_check = verify_file_md5( $tmpfname, $content_md5 );
505
-		if ( is_wp_error( $md5_check ) ) {
506
-			unlink( $tmpfname );
502
+	$content_md5 = wp_remote_retrieve_header($response, 'content-md5');
503
+	if ($content_md5) {
504
+		$md5_check = verify_file_md5($tmpfname, $content_md5);
505
+		if (is_wp_error($md5_check)) {
506
+			unlink($tmpfname);
507 507
 			return $md5_check;
508 508
 		}
509 509
 	}
@@ -520,20 +520,20 @@  discard block
 block discarded – undo
520 520
  * @param string $expected_md5 The expected MD5 of the file, either a base64 encoded raw md5, or a hex-encoded md5
521 521
  * @return bool|object WP_Error on failure, true on success, false when the MD5 format is unknown/unexpected
522 522
  */
523
-function verify_file_md5( $filename, $expected_md5 ) {
524
-	if ( 32 == strlen( $expected_md5 ) )
525
-		$expected_raw_md5 = pack( 'H*', $expected_md5 );
526
-	elseif ( 24 == strlen( $expected_md5 ) )
527
-		$expected_raw_md5 = base64_decode( $expected_md5 );
523
+function verify_file_md5($filename, $expected_md5) {
524
+	if (32 == strlen($expected_md5))
525
+		$expected_raw_md5 = pack('H*', $expected_md5);
526
+	elseif (24 == strlen($expected_md5))
527
+		$expected_raw_md5 = base64_decode($expected_md5);
528 528
 	else
529 529
 		return false; // unknown format
530 530
 
531
-	$file_md5 = md5_file( $filename, true );
531
+	$file_md5 = md5_file($filename, true);
532 532
 
533
-	if ( $file_md5 === $expected_raw_md5 )
533
+	if ($file_md5 === $expected_raw_md5)
534 534
 		return true;
535 535
 
536
-	return new WP_Error( 'md5_mismatch', sprintf( __( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ), bin2hex( $file_md5 ), bin2hex( $expected_raw_md5 ) ) );
536
+	return new WP_Error('md5_mismatch', sprintf(__('The checksum of the file (%1$s) does not match the expected checksum value (%2$s).'), bin2hex($file_md5), bin2hex($expected_raw_md5)));
537 537
 }
538 538
 
539 539
 /**
@@ -554,28 +554,28 @@  discard block
 block discarded – undo
554 554
 function unzip_file($file, $to) {
555 555
 	global $wp_filesystem;
556 556
 
557
-	if ( ! $wp_filesystem || !is_object($wp_filesystem) )
557
+	if ( ! $wp_filesystem || ! is_object($wp_filesystem))
558 558
 		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
559 559
 
560 560
 	// Unzip can use a lot of memory, but not this much hopefully
561 561
 	/** This filter is documented in wp-admin/admin.php */
562
-	@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
562
+	@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
563 563
 
564 564
 	$needed_dirs = array();
565 565
 	$to = trailingslashit($to);
566 566
 
567 567
 	// Determine any parent dir's needed (of the upgrade directory)
568
-	if ( ! $wp_filesystem->is_dir($to) ) { //Only do parents if no children exist
568
+	if ( ! $wp_filesystem->is_dir($to)) { //Only do parents if no children exist
569 569
 		$path = preg_split('![/\\\]!', untrailingslashit($to));
570
-		for ( $i = count($path); $i >= 0; $i-- ) {
571
-			if ( empty($path[$i]) )
570
+		for ($i = count($path); $i >= 0; $i--) {
571
+			if (empty($path[$i]))
572 572
 				continue;
573 573
 
574
-			$dir = implode('/', array_slice($path, 0, $i+1) );
575
-			if ( preg_match('!^[a-z]:$!i', $dir) ) // Skip it if it looks like a Windows Drive letter.
574
+			$dir = implode('/', array_slice($path, 0, $i + 1));
575
+			if (preg_match('!^[a-z]:$!i', $dir)) // Skip it if it looks like a Windows Drive letter.
576 576
 				continue;
577 577
 
578
-			if ( ! $wp_filesystem->is_dir($dir) )
578
+			if ( ! $wp_filesystem->is_dir($dir))
579 579
 				$needed_dirs[] = $dir;
580 580
 			else
581 581
 				break; // A folder exists, therefor, we dont need the check the levels below this
@@ -589,12 +589,12 @@  discard block
 block discarded – undo
589 589
 	 *
590 590
 	 * @param bool $ziparchive Whether to use ZipArchive. Default true.
591 591
 	 */
592
-	if ( class_exists( 'ZipArchive', false ) && apply_filters( 'unzip_file_use_ziparchive', true ) ) {
592
+	if (class_exists('ZipArchive', false) && apply_filters('unzip_file_use_ziparchive', true)) {
593 593
 		$result = _unzip_file_ziparchive($file, $to, $needed_dirs);
594
-		if ( true === $result ) {
594
+		if (true === $result) {
595 595
 			return $result;
596
-		} elseif ( is_wp_error($result) ) {
597
-			if ( 'incompatible_archive' != $result->get_error_code() )
596
+		} elseif (is_wp_error($result)) {
597
+			if ('incompatible_archive' != $result->get_error_code())
598 598
 				return $result;
599 599
 		}
600 600
 	}
@@ -617,30 +617,30 @@  discard block
 block discarded – undo
617 617
  * @param array $needed_dirs A partial list of required folders needed to be created.
618 618
  * @return mixed WP_Error on failure, True on success
619 619
  */
620
-function _unzip_file_ziparchive($file, $to, $needed_dirs = array() ) {
620
+function _unzip_file_ziparchive($file, $to, $needed_dirs = array()) {
621 621
 	global $wp_filesystem;
622 622
 
623 623
 	$z = new ZipArchive();
624 624
 
625
-	$zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS );
626
-	if ( true !== $zopen )
627
-		return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
625
+	$zopen = $z->open($file, ZIPARCHIVE::CHECKCONS);
626
+	if (true !== $zopen)
627
+		return new WP_Error('incompatible_archive', __('Incompatible Archive.'), array('ziparchive_error' => $zopen));
628 628
 
629 629
 	$uncompressed_size = 0;
630 630
 
631
-	for ( $i = 0; $i < $z->numFiles; $i++ ) {
632
-		if ( ! $info = $z->statIndex($i) )
633
-			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
631
+	for ($i = 0; $i < $z->numFiles; $i++) {
632
+		if ( ! $info = $z->statIndex($i))
633
+			return new WP_Error('stat_failed_ziparchive', __('Could not retrieve file from archive.'));
634 634
 
635
-		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
635
+		if ('__MACOSX/' === substr($info['name'], 0, 9)) // Skip the OS X-created __MACOSX directory
636 636
 			continue;
637 637
 
638 638
 		$uncompressed_size += $info['size'];
639 639
 
640
-		if ( '/' == substr($info['name'], -1) ) // directory
641
-			$needed_dirs[] = $to . untrailingslashit($info['name']);
640
+		if ('/' == substr($info['name'], -1)) // directory
641
+			$needed_dirs[] = $to.untrailingslashit($info['name']);
642 642
 		else
643
-			$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
643
+			$needed_dirs[] = $to.untrailingslashit(dirname($info['name']));
644 644
 	}
645 645
 
646 646
 	/*
@@ -648,22 +648,22 @@  discard block
 block discarded – undo
648 648
 	 * A disk that has zero free bytes has bigger problems.
649 649
 	 * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
650 650
 	 */
651
-	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
652
-		$available_space = @disk_free_space( WP_CONTENT_DIR );
653
-		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
654
-			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
651
+	if (defined('DOING_CRON') && DOING_CRON) {
652
+		$available_space = @disk_free_space(WP_CONTENT_DIR);
653
+		if ($available_space && ($uncompressed_size * 2.1) > $available_space)
654
+			return new WP_Error('disk_full_unzip_file', __('Could not copy files. You may have run out of disk space.'), compact('uncompressed_size', 'available_space'));
655 655
 	}
656 656
 
657 657
 	$needed_dirs = array_unique($needed_dirs);
658
-	foreach ( $needed_dirs as $dir ) {
658
+	foreach ($needed_dirs as $dir) {
659 659
 		// Check the parent folders of the folders all exist within the creation array.
660
-		if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
660
+		if (untrailingslashit($to) == $dir) // Skip over the working directory, We know this exists (or will exist)
661 661
 			continue;
662
-		if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
662
+		if (strpos($dir, $to) === false) // If the directory is not within the working directory, Skip it
663 663
 			continue;
664 664
 
665 665
 		$parent_folder = dirname($dir);
666
-		while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
666
+		while ( ! empty($parent_folder) && untrailingslashit($to) != $parent_folder && ! in_array($parent_folder, $needed_dirs)) {
667 667
 			$needed_dirs[] = $parent_folder;
668 668
 			$parent_folder = dirname($parent_folder);
669 669
 		}
@@ -671,30 +671,30 @@  discard block
 block discarded – undo
671 671
 	asort($needed_dirs);
672 672
 
673 673
 	// Create those directories if need be:
674
-	foreach ( $needed_dirs as $_dir ) {
674
+	foreach ($needed_dirs as $_dir) {
675 675
 		// Only check to see if the Dir exists upon creation failure. Less I/O this way.
676
-		if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
677
-			return new WP_Error( 'mkdir_failed_ziparchive', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
676
+		if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir)) {
677
+			return new WP_Error('mkdir_failed_ziparchive', __('Could not create directory.'), substr($_dir, strlen($to)));
678 678
 		}
679 679
 	}
680 680
 	unset($needed_dirs);
681 681
 
682
-	for ( $i = 0; $i < $z->numFiles; $i++ ) {
683
-		if ( ! $info = $z->statIndex($i) )
684
-			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
682
+	for ($i = 0; $i < $z->numFiles; $i++) {
683
+		if ( ! $info = $z->statIndex($i))
684
+			return new WP_Error('stat_failed_ziparchive', __('Could not retrieve file from archive.'));
685 685
 
686
-		if ( '/' == substr($info['name'], -1) ) // directory
686
+		if ('/' == substr($info['name'], -1)) // directory
687 687
 			continue;
688 688
 
689
-		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
689
+		if ('__MACOSX/' === substr($info['name'], 0, 9)) // Don't extract the OS X-created __MACOSX directory files
690 690
 			continue;
691 691
 
692 692
 		$contents = $z->getFromIndex($i);
693
-		if ( false === $contents )
694
-			return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] );
693
+		if (false === $contents)
694
+			return new WP_Error('extract_failed_ziparchive', __('Could not extract file from archive.'), $info['name']);
695 695
 
696
-		if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) )
697
-			return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] );
696
+		if ( ! $wp_filesystem->put_contents($to.$info['name'], $contents, FS_CHMOD_FILE))
697
+			return new WP_Error('copy_failed_ziparchive', __('Could not copy file.'), $info['name']);
698 698
 	}
699 699
 
700 700
 	$z->close();
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 
723 723
 	mbstring_binary_safe_encoding();
724 724
 
725
-	require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
725
+	require_once(ABSPATH.'wp-admin/includes/class-pclzip.php');
726 726
 
727 727
 	$archive = new PclZip($file);
728 728
 
@@ -731,22 +731,22 @@  discard block
 block discarded – undo
731 731
 	reset_mbstring_encoding();
732 732
 
733 733
 	// Is the archive valid?
734
-	if ( !is_array($archive_files) )
734
+	if ( ! is_array($archive_files))
735 735
 		return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true));
736 736
 
737
-	if ( 0 == count($archive_files) )
738
-		return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) );
737
+	if (0 == count($archive_files))
738
+		return new WP_Error('empty_archive_pclzip', __('Empty archive.'));
739 739
 
740 740
 	$uncompressed_size = 0;
741 741
 
742 742
 	// Determine any children directories needed (From within the archive)
743
-	foreach ( $archive_files as $file ) {
744
-		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory
743
+	foreach ($archive_files as $file) {
744
+		if ('__MACOSX/' === substr($file['filename'], 0, 9)) // Skip the OS X-created __MACOSX directory
745 745
 			continue;
746 746
 
747 747
 		$uncompressed_size += $file['size'];
748 748
 
749
-		$needed_dirs[] = $to . untrailingslashit( $file['folder'] ? $file['filename'] : dirname($file['filename']) );
749
+		$needed_dirs[] = $to.untrailingslashit($file['folder'] ? $file['filename'] : dirname($file['filename']));
750 750
 	}
751 751
 
752 752
 	/*
@@ -754,22 +754,22 @@  discard block
 block discarded – undo
754 754
 	 * A disk that has zero free bytes has bigger problems.
755 755
 	 * Require we have enough space to unzip the file and copy its contents, with a 10% buffer.
756 756
 	 */
757
-	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
758
-		$available_space = @disk_free_space( WP_CONTENT_DIR );
759
-		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
760
-			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
757
+	if (defined('DOING_CRON') && DOING_CRON) {
758
+		$available_space = @disk_free_space(WP_CONTENT_DIR);
759
+		if ($available_space && ($uncompressed_size * 2.1) > $available_space)
760
+			return new WP_Error('disk_full_unzip_file', __('Could not copy files. You may have run out of disk space.'), compact('uncompressed_size', 'available_space'));
761 761
 	}
762 762
 
763 763
 	$needed_dirs = array_unique($needed_dirs);
764
-	foreach ( $needed_dirs as $dir ) {
764
+	foreach ($needed_dirs as $dir) {
765 765
 		// Check the parent folders of the folders all exist within the creation array.
766
-		if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
766
+		if (untrailingslashit($to) == $dir) // Skip over the working directory, We know this exists (or will exist)
767 767
 			continue;
768
-		if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
768
+		if (strpos($dir, $to) === false) // If the directory is not within the working directory, Skip it
769 769
 			continue;
770 770
 
771 771
 		$parent_folder = dirname($dir);
772
-		while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
772
+		while ( ! empty($parent_folder) && untrailingslashit($to) != $parent_folder && ! in_array($parent_folder, $needed_dirs)) {
773 773
 			$needed_dirs[] = $parent_folder;
774 774
 			$parent_folder = dirname($parent_folder);
775 775
 		}
@@ -777,23 +777,23 @@  discard block
 block discarded – undo
777 777
 	asort($needed_dirs);
778 778
 
779 779
 	// Create those directories if need be:
780
-	foreach ( $needed_dirs as $_dir ) {
780
+	foreach ($needed_dirs as $_dir) {
781 781
 		// Only check to see if the dir exists upon creation failure. Less I/O this way.
782
-		if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) )
783
-			return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
782
+		if ( ! $wp_filesystem->mkdir($_dir, FS_CHMOD_DIR) && ! $wp_filesystem->is_dir($_dir))
783
+			return new WP_Error('mkdir_failed_pclzip', __('Could not create directory.'), substr($_dir, strlen($to)));
784 784
 	}
785 785
 	unset($needed_dirs);
786 786
 
787 787
 	// Extract the files from the zip
788
-	foreach ( $archive_files as $file ) {
789
-		if ( $file['folder'] )
788
+	foreach ($archive_files as $file) {
789
+		if ($file['folder'])
790 790
 			continue;
791 791
 
792
-		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
792
+		if ('__MACOSX/' === substr($file['filename'], 0, 9)) // Don't extract the OS X-created __MACOSX directory files
793 793
 			continue;
794 794
 
795
-		if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
796
-			return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
795
+		if ( ! $wp_filesystem->put_contents($to.$file['filename'], $file['content'], FS_CHMOD_FILE))
796
+			return new WP_Error('copy_failed_pclzip', __('Could not copy file.'), $file['filename']);
797 797
 	}
798 798
 	return true;
799 799
 }
@@ -811,7 +811,7 @@  discard block
 block discarded – undo
811 811
  * @param array $skip_list a list of files/folders to skip copying
812 812
  * @return mixed WP_Error on failure, True on success.
813 813
  */
814
-function copy_dir($from, $to, $skip_list = array() ) {
814
+function copy_dir($from, $to, $skip_list = array()) {
815 815
 	global $wp_filesystem;
816 816
 
817 817
 	$dirlist = $wp_filesystem->dirlist($from);
@@ -819,32 +819,32 @@  discard block
 block discarded – undo
819 819
 	$from = trailingslashit($from);
820 820
 	$to = trailingslashit($to);
821 821
 
822
-	foreach ( (array) $dirlist as $filename => $fileinfo ) {
823
-		if ( in_array( $filename, $skip_list ) )
822
+	foreach ((array) $dirlist as $filename => $fileinfo) {
823
+		if (in_array($filename, $skip_list))
824 824
 			continue;
825 825
 
826
-		if ( 'f' == $fileinfo['type'] ) {
827
-			if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
826
+		if ('f' == $fileinfo['type']) {
827
+			if ( ! $wp_filesystem->copy($from.$filename, $to.$filename, true, FS_CHMOD_FILE)) {
828 828
 				// If copy failed, chmod file to 0644 and try again.
829
-				$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
830
-				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
831
-					return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
829
+				$wp_filesystem->chmod($to.$filename, FS_CHMOD_FILE);
830
+				if ( ! $wp_filesystem->copy($from.$filename, $to.$filename, true, FS_CHMOD_FILE))
831
+					return new WP_Error('copy_failed_copy_dir', __('Could not copy file.'), $to.$filename);
832 832
 			}
833
-		} elseif ( 'd' == $fileinfo['type'] ) {
834
-			if ( !$wp_filesystem->is_dir($to . $filename) ) {
835
-				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
836
-					return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
833
+		} elseif ('d' == $fileinfo['type']) {
834
+			if ( ! $wp_filesystem->is_dir($to.$filename)) {
835
+				if ( ! $wp_filesystem->mkdir($to.$filename, FS_CHMOD_DIR))
836
+					return new WP_Error('mkdir_failed_copy_dir', __('Could not create directory.'), $to.$filename);
837 837
 			}
838 838
 
839 839
 			// generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
840 840
 			$sub_skip_list = array();
841
-			foreach ( $skip_list as $skip_item ) {
842
-				if ( 0 === strpos( $skip_item, $filename . '/' ) )
843
-					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
841
+			foreach ($skip_list as $skip_item) {
842
+				if (0 === strpos($skip_item, $filename.'/'))
843
+					$sub_skip_list[] = preg_replace('!^'.preg_quote($filename, '!').'/!i', '', $skip_item);
844 844
 			}
845 845
 
846
-			$result = copy_dir($from . $filename, $to . $filename, $sub_skip_list);
847
-			if ( is_wp_error($result) )
846
+			$result = copy_dir($from.$filename, $to.$filename, $sub_skip_list);
847
+			if (is_wp_error($result))
848 848
 				return $result;
849 849
 		}
850 850
 	}
@@ -868,17 +868,17 @@  discard block
 block discarded – undo
868 868
  * @param bool         $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false.
869 869
  * @return null|bool false on failure, true on success.
870 870
  */
871
-function WP_Filesystem( $args = false, $context = false, $allow_relaxed_file_ownership = false ) {
871
+function WP_Filesystem($args = false, $context = false, $allow_relaxed_file_ownership = false) {
872 872
 	global $wp_filesystem;
873 873
 
874
-	require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
874
+	require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php');
875 875
 
876
-	$method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership );
876
+	$method = get_filesystem_method($args, $context, $allow_relaxed_file_ownership);
877 877
 
878
-	if ( ! $method )
878
+	if ( ! $method)
879 879
 		return false;
880 880
 
881
-	if ( ! class_exists( "WP_Filesystem_$method" ) ) {
881
+	if ( ! class_exists("WP_Filesystem_$method")) {
882 882
 
883 883
 		/**
884 884
 		 * Filter the path for a specific filesystem method class file.
@@ -890,9 +890,9 @@  discard block
 block discarded – undo
890 890
 		 * @param string $path   Path to the specific filesystem method class file.
891 891
 		 * @param string $method The filesystem method to use.
892 892
 		 */
893
-		$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
893
+		$abstraction_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
894 894
 
895
-		if ( ! file_exists($abstraction_file) )
895
+		if ( ! file_exists($abstraction_file))
896 896
 			return;
897 897
 
898 898
 		require_once($abstraction_file);
@@ -902,22 +902,22 @@  discard block
 block discarded – undo
902 902
 	$wp_filesystem = new $method($args);
903 903
 
904 904
 	//Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default.
905
-	if ( ! defined('FS_CONNECT_TIMEOUT') )
905
+	if ( ! defined('FS_CONNECT_TIMEOUT'))
906 906
 		define('FS_CONNECT_TIMEOUT', 30);
907
-	if ( ! defined('FS_TIMEOUT') )
907
+	if ( ! defined('FS_TIMEOUT'))
908 908
 		define('FS_TIMEOUT', 30);
909 909
 
910
-	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
910
+	if (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code())
911 911
 		return false;
912 912
 
913
-	if ( !$wp_filesystem->connect() )
913
+	if ( ! $wp_filesystem->connect())
914 914
 		return false; //There was an error connecting to the server.
915 915
 
916 916
 	// Set the permission constants if not already set.
917
-	if ( ! defined('FS_CHMOD_DIR') )
918
-		define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
919
-	if ( ! defined('FS_CHMOD_FILE') )
920
-		define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
917
+	if ( ! defined('FS_CHMOD_DIR'))
918
+		define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755));
919
+	if ( ! defined('FS_CHMOD_FILE'))
920
+		define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644));
921 921
 
922 922
 	return true;
923 923
 }
@@ -948,39 +948,39 @@  discard block
 block discarded – undo
948 948
  *                                             Default false.
949 949
  * @return string The transport to use, see description for valid return values.
950 950
  */
951
-function get_filesystem_method( $args = array(), $context = false, $allow_relaxed_file_ownership = false ) {
951
+function get_filesystem_method($args = array(), $context = false, $allow_relaxed_file_ownership = false) {
952 952
 	$method = defined('FS_METHOD') ? FS_METHOD : false; // Please ensure that this is either 'direct', 'ssh2', 'ftpext' or 'ftpsockets'
953 953
 
954
-	if ( ! $context ) {
954
+	if ( ! $context) {
955 955
 		$context = WP_CONTENT_DIR;
956 956
 	}
957 957
 
958 958
 	// If the directory doesn't exist (wp-content/languages) then use the parent directory as we'll create it.
959
-	if ( WP_LANG_DIR == $context && ! is_dir( $context ) ) {
960
-		$context = dirname( $context );
959
+	if (WP_LANG_DIR == $context && ! is_dir($context)) {
960
+		$context = dirname($context);
961 961
 	}
962 962
 
963
-	$context = trailingslashit( $context );
963
+	$context = trailingslashit($context);
964 964
 
965
-	if ( ! $method ) {
965
+	if ( ! $method) {
966 966
 
967
-		$temp_file_name = $context . 'temp-write-test-' . time();
967
+		$temp_file_name = $context.'temp-write-test-'.time();
968 968
 		$temp_handle = @fopen($temp_file_name, 'w');
969
-		if ( $temp_handle ) {
969
+		if ($temp_handle) {
970 970
 
971 971
 			// Attempt to determine the file owner of the WordPress files, and that of newly created files
972 972
 			$wp_file_owner = $temp_file_owner = false;
973
-			if ( function_exists('fileowner') ) {
974
-				$wp_file_owner = @fileowner( __FILE__ );
975
-				$temp_file_owner = @fileowner( $temp_file_name );
973
+			if (function_exists('fileowner')) {
974
+				$wp_file_owner = @fileowner(__FILE__);
975
+				$temp_file_owner = @fileowner($temp_file_name);
976 976
 			}
977 977
 
978
-			if ( $wp_file_owner !== false && $wp_file_owner === $temp_file_owner ) {
978
+			if ($wp_file_owner !== false && $wp_file_owner === $temp_file_owner) {
979 979
 				// WordPress is creating files as the same owner as the WordPress files,
980 980
 				// this means it's safe to modify & create new files via PHP.
981 981
 				$method = 'direct';
982 982
 				$GLOBALS['_wp_filesystem_direct_method'] = 'file_owner';
983
-			} elseif ( $allow_relaxed_file_ownership ) {
983
+			} elseif ($allow_relaxed_file_ownership) {
984 984
 				// The $context directory is writable, and $allow_relaxed_file_ownership is set, this means we can modify files
985 985
 				// safely in this directory. This mode doesn't create new files, only alter existing ones.
986 986
 				$method = 'direct';
@@ -992,9 +992,9 @@  discard block
 block discarded – undo
992 992
 		}
993 993
  	}
994 994
 
995
-	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2';
996
-	if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
997
-	if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
995
+	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents')) $method = 'ssh2';
996
+	if ( ! $method && extension_loaded('ftp')) $method = 'ftpext';
997
+	if ( ! $method && (extension_loaded('sockets') || function_exists('fsockopen'))) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
998 998
 
999 999
 	/**
1000 1000
 	 * Filter the filesystem method to use.
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 	 * @param string $context Full path to the directory that is tested for being writable.
1007 1007
 	 * @param bool   $allow_relaxed_file_ownership Whether to allow Group/World writable.
1008 1008
 	 */
1009
-	return apply_filters( 'filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership );
1009
+	return apply_filters('filesystem_method', $method, $args, $context, $allow_relaxed_file_ownership);
1010 1010
 }
1011 1011
 
1012 1012
 /**
@@ -1038,7 +1038,7 @@  discard block
 block discarded – undo
1038 1038
  *
1039 1039
  * @return bool False on failure, true on success.
1040 1040
  */
1041
-function request_filesystem_credentials( $form_post, $type = '', $error = false, $context = false, $extra_fields = null, $allow_relaxed_file_ownership = false ) {
1041
+function request_filesystem_credentials($form_post, $type = '', $error = false, $context = false, $extra_fields = null, $allow_relaxed_file_ownership = false) {
1042 1042
 	global $pagenow;
1043 1043
 
1044 1044
 	/**
@@ -1060,87 +1060,87 @@  discard block
 block discarded – undo
1060 1060
 	 *                                             Default false.
1061 1061
 	 * @param array  $extra_fields                 Extra POST fields.
1062 1062
 	 */
1063
-	$req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership );
1064
-	if ( '' !== $req_cred )
1063
+	$req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership);
1064
+	if ('' !== $req_cred)
1065 1065
 		return $req_cred;
1066 1066
 
1067
-	if ( empty($type) ) {
1068
-		$type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership );
1067
+	if (empty($type)) {
1068
+		$type = get_filesystem_method(array(), $context, $allow_relaxed_file_ownership);
1069 1069
 	}
1070 1070
 
1071
-	if ( 'direct' == $type )
1071
+	if ('direct' == $type)
1072 1072
 		return true;
1073 1073
 
1074
-	if ( is_null( $extra_fields ) )
1075
-		$extra_fields = array( 'version', 'locale' );
1074
+	if (is_null($extra_fields))
1075
+		$extra_fields = array('version', 'locale');
1076 1076
 
1077
-	$credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
1077
+	$credentials = get_option('ftp_credentials', array('hostname' => '', 'username' => ''));
1078 1078
 
1079 1079
 	// If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option)
1080
-	$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? wp_unslash( $_POST['hostname'] ) : $credentials['hostname']);
1081
-	$credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? wp_unslash( $_POST['username'] ) : $credentials['username']);
1082
-	$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? wp_unslash( $_POST['password'] ) : '');
1080
+	$credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : ( ! empty($_POST['hostname']) ? wp_unslash($_POST['hostname']) : $credentials['hostname']);
1081
+	$credentials['username'] = defined('FTP_USER') ? FTP_USER : ( ! empty($_POST['username']) ? wp_unslash($_POST['username']) : $credentials['username']);
1082
+	$credentials['password'] = defined('FTP_PASS') ? FTP_PASS : ( ! empty($_POST['password']) ? wp_unslash($_POST['password']) : '');
1083 1083
 
1084 1084
 	// Check to see if we are setting the public/private keys for ssh
1085
-	$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : (!empty($_POST['public_key']) ? wp_unslash( $_POST['public_key'] ) : '');
1086
-	$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : (!empty($_POST['private_key']) ? wp_unslash( $_POST['private_key'] ) : '');
1085
+	$credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : ( ! empty($_POST['public_key']) ? wp_unslash($_POST['public_key']) : '');
1086
+	$credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : ( ! empty($_POST['private_key']) ? wp_unslash($_POST['private_key']) : '');
1087 1087
 
1088 1088
 	// Sanitize the hostname, Some people might pass in odd-data:
1089 1089
 	$credentials['hostname'] = preg_replace('|\w+://|', '', $credentials['hostname']); //Strip any schemes off
1090 1090
 
1091
-	if ( strpos($credentials['hostname'], ':') ) {
1092
-		list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2);
1093
-		if ( ! is_numeric($credentials['port']) )
1091
+	if (strpos($credentials['hostname'], ':')) {
1092
+		list($credentials['hostname'], $credentials['port']) = explode(':', $credentials['hostname'], 2);
1093
+		if ( ! is_numeric($credentials['port']))
1094 1094
 			unset($credentials['port']);
1095 1095
 	} else {
1096 1096
 		unset($credentials['port']);
1097 1097
 	}
1098 1098
 
1099
-	if ( ( defined( 'FTP_SSH' ) && FTP_SSH ) || ( defined( 'FS_METHOD' ) && 'ssh2' == FS_METHOD ) ) {
1099
+	if ((defined('FTP_SSH') && FTP_SSH) || (defined('FS_METHOD') && 'ssh2' == FS_METHOD)) {
1100 1100
 		$credentials['connection_type'] = 'ssh';
1101
-	} elseif ( ( defined( 'FTP_SSL' ) && FTP_SSL ) && 'ftpext' == $type ) { //Only the FTP Extension understands SSL
1101
+	} elseif ((defined('FTP_SSL') && FTP_SSL) && 'ftpext' == $type) { //Only the FTP Extension understands SSL
1102 1102
 		$credentials['connection_type'] = 'ftps';
1103
-	} elseif ( ! empty( $_POST['connection_type'] ) ) {
1104
-		$credentials['connection_type'] = wp_unslash( $_POST['connection_type'] );
1105
-	} elseif ( ! isset( $credentials['connection_type'] ) ) { //All else fails (And it's not defaulted to something else saved), Default to FTP
1103
+	} elseif ( ! empty($_POST['connection_type'])) {
1104
+		$credentials['connection_type'] = wp_unslash($_POST['connection_type']);
1105
+	} elseif ( ! isset($credentials['connection_type'])) { //All else fails (And it's not defaulted to something else saved), Default to FTP
1106 1106
 		$credentials['connection_type'] = 'ftp';
1107 1107
 	}
1108 1108
 	if ( ! $error &&
1109 1109
 			(
1110
-				( !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) ||
1111
-				( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) )
1112
-			) ) {
1110
+				( ! empty($credentials['password']) && ! empty($credentials['username']) && ! empty($credentials['hostname'])) ||
1111
+				('ssh' == $credentials['connection_type'] && ! empty($credentials['public_key']) && ! empty($credentials['private_key']))
1112
+			)) {
1113 1113
 		$stored_credentials = $credentials;
1114
-		if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
1115
-			$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
1114
+		if ( ! empty($stored_credentials['port'])) //save port as part of hostname to simplify above code.
1115
+			$stored_credentials['hostname'] .= ':'.$stored_credentials['port'];
1116 1116
 
1117 1117
 		unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
1118
-		if ( ! wp_installing() ) {
1119
-			update_option( 'ftp_credentials', $stored_credentials );
1118
+		if ( ! wp_installing()) {
1119
+			update_option('ftp_credentials', $stored_credentials);
1120 1120
 		}
1121 1121
 		return $credentials;
1122 1122
 	}
1123
-	$hostname = isset( $credentials['hostname'] ) ? $credentials['hostname'] : '';
1124
-	$username = isset( $credentials['username'] ) ? $credentials['username'] : '';
1125
-	$public_key = isset( $credentials['public_key'] ) ? $credentials['public_key'] : '';
1126
-	$private_key = isset( $credentials['private_key'] ) ? $credentials['private_key'] : '';
1127
-	$port = isset( $credentials['port'] ) ? $credentials['port'] : '';
1128
-	$connection_type = isset( $credentials['connection_type'] ) ? $credentials['connection_type'] : '';
1129
-
1130
-	if ( $error ) {
1123
+	$hostname = isset($credentials['hostname']) ? $credentials['hostname'] : '';
1124
+	$username = isset($credentials['username']) ? $credentials['username'] : '';
1125
+	$public_key = isset($credentials['public_key']) ? $credentials['public_key'] : '';
1126
+	$private_key = isset($credentials['private_key']) ? $credentials['private_key'] : '';
1127
+	$port = isset($credentials['port']) ? $credentials['port'] : '';
1128
+	$connection_type = isset($credentials['connection_type']) ? $credentials['connection_type'] : '';
1129
+
1130
+	if ($error) {
1131 1131
 		$error_string = __('<strong>ERROR:</strong> There was an error connecting to the server, Please verify the settings are correct.');
1132
-		if ( is_wp_error($error) )
1133
-			$error_string = esc_html( $error->get_error_message() );
1134
-		echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
1132
+		if (is_wp_error($error))
1133
+			$error_string = esc_html($error->get_error_message());
1134
+		echo '<div id="message" class="error"><p>'.$error_string.'</p></div>';
1135 1135
 	}
1136 1136
 
1137 1137
 	$types = array();
1138
-	if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') )
1139
-		$types[ 'ftp' ] = __('FTP');
1140
-	if ( extension_loaded('ftp') ) //Only this supports FTPS
1141
-		$types[ 'ftps' ] = __('FTPS (SSL)');
1142
-	if ( extension_loaded('ssh2') && function_exists('stream_get_contents') )
1143
-		$types[ 'ssh' ] = __('SSH2');
1138
+	if (extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen'))
1139
+		$types['ftp'] = __('FTP');
1140
+	if (extension_loaded('ftp')) //Only this supports FTPS
1141
+		$types['ftps'] = __('FTPS (SSL)');
1142
+	if (extension_loaded('ssh2') && function_exists('stream_get_contents'))
1143
+		$types['ssh'] = __('SSH2');
1144 1144
 
1145 1145
 	/**
1146 1146
 	 * Filter the connection types to output to the filesystem credentials form.
@@ -1154,7 +1154,7 @@  discard block
 block discarded – undo
1154 1154
 	 * @param string $context     Full path to the directory that is tested
1155 1155
 	 *                            for being writable.
1156 1156
 	 */
1157
-	$types = apply_filters( 'fs_ftp_connection_types', $types, $credentials, $type, $error, $context );
1157
+	$types = apply_filters('fs_ftp_connection_types', $types, $credentials, $type, $error, $context);
1158 1158
 
1159 1159
 ?>
1160 1160
 <script type="text/javascript">
@@ -1170,23 +1170,23 @@  discard block
 block discarded – undo
1170 1170
 });
1171 1171
 -->
1172 1172
 </script>
1173
-<form action="<?php echo esc_url( $form_post ) ?>" method="post">
1173
+<form action="<?php echo esc_url($form_post) ?>" method="post">
1174 1174
 <div id="request-filesystem-credentials-form" class="request-filesystem-credentials-form">
1175 1175
 <?php
1176 1176
 // Print a H1 heading in the FTP credentials modal dialog, default is a H2.
1177 1177
 $heading_tag = 'h2';
1178
-if ( 'plugins.php' === $pagenow || 'plugin-install.php' === $pagenow ) {
1178
+if ('plugins.php' === $pagenow || 'plugin-install.php' === $pagenow) {
1179 1179
 	$heading_tag = 'h1';
1180 1180
 }
1181
-echo "<$heading_tag id='request-filesystem-credentials-title'>" . __( 'Connection Information' ) . "</$heading_tag>";
1181
+echo "<$heading_tag id='request-filesystem-credentials-title'>".__('Connection Information')."</$heading_tag>";
1182 1182
 ?>
1183 1183
 <p id="request-filesystem-credentials-desc"><?php
1184 1184
 	$label_user = __('Username');
1185 1185
 	$label_pass = __('Password');
1186 1186
 	_e('To perform the requested action, WordPress needs to access your web server.');
1187 1187
 	echo ' ';
1188
-	if ( ( isset( $types['ftp'] ) || isset( $types['ftps'] ) ) ) {
1189
-		if ( isset( $types['ssh'] ) ) {
1188
+	if ((isset($types['ftp']) || isset($types['ftps']))) {
1189
+		if (isset($types['ssh'])) {
1190 1190
 			_e('Please enter your FTP or SSH credentials to proceed.');
1191 1191
 			$label_user = __('FTP/SSH Username');
1192 1192
 			$label_pass = __('FTP/SSH Password');
@@ -1200,41 +1200,41 @@  discard block
 block discarded – undo
1200 1200
 	_e('If you do not remember your credentials, you should contact your web host.');
1201 1201
 ?></p>
1202 1202
 <label for="hostname">
1203
-	<span class="field-title"><?php _e( 'Hostname' ) ?></span>
1204
-	<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ) ?>" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> />
1203
+	<span class="field-title"><?php _e('Hostname') ?></span>
1204
+	<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e('example: www.wordpress.org') ?>" value="<?php echo esc_attr($hostname); if ( ! empty($port)) echo ":$port"; ?>"<?php disabled(defined('FTP_HOST')); ?> />
1205 1205
 </label>
1206 1206
 <div class="ftp-username">
1207 1207
 	<label for="username">
1208 1208
 		<span class="field-title"><?php echo $label_user; ?></span>
1209
-		<input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled( defined('FTP_USER') ); ?> />
1209
+		<input name="username" type="text" id="username" value="<?php echo esc_attr($username) ?>"<?php disabled(defined('FTP_USER')); ?> />
1210 1210
 	</label>
1211 1211
 </div>
1212 1212
 <div class="ftp-password">
1213 1213
 	<label for="password">
1214 1214
 		<span class="field-title"><?php echo $label_pass; ?></span>
1215
-		<input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> />
1216
-		<em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em>
1215
+		<input name="password" type="password" id="password" value="<?php if (defined('FTP_PASS')) echo '*****'; ?>"<?php disabled(defined('FTP_PASS')); ?> />
1216
+		<em><?php if ( ! defined('FTP_PASS')) _e('This password will not be stored on the server.'); ?></em>
1217 1217
 	</label>
1218 1218
 </div>
1219
-<?php if ( isset($types['ssh']) ) : ?>
1219
+<?php if (isset($types['ssh'])) : ?>
1220 1220
 <fieldset>
1221
-<legend><?php _e( 'Authentication Keys' ); ?></legend>
1221
+<legend><?php _e('Authentication Keys'); ?></legend>
1222 1222
 <label for="public_key">
1223 1223
 	<span class="field-title"><?php _e('Public Key:') ?></span>
1224
-	<input name="public_key" type="text" id="public_key" aria-describedby="auth-keys-desc" value="<?php echo esc_attr($public_key) ?>"<?php disabled( defined('FTP_PUBKEY') ); ?> />
1224
+	<input name="public_key" type="text" id="public_key" aria-describedby="auth-keys-desc" value="<?php echo esc_attr($public_key) ?>"<?php disabled(defined('FTP_PUBKEY')); ?> />
1225 1225
 </label>
1226 1226
 <label for="private_key">
1227 1227
 	<span class="field-title"><?php _e('Private Key:') ?></span>
1228
-	<input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled( defined('FTP_PRIKEY') ); ?> />
1228
+	<input name="private_key" type="text" id="private_key" value="<?php echo esc_attr($private_key) ?>"<?php disabled(defined('FTP_PRIKEY')); ?> />
1229 1229
 </label>
1230 1230
 </fieldset>
1231 1231
 <span id="auth-keys-desc"><?php _e('Enter the location on the server where the public and private keys are located. If a passphrase is needed, enter that in the password field above.') ?></span>
1232 1232
 <?php endif; ?>
1233 1233
 <fieldset>
1234
-<legend><?php _e( 'Connection Type' ); ?></legend>
1234
+<legend><?php _e('Connection Type'); ?></legend>
1235 1235
 <?php
1236
-	$disabled = disabled( (defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false );
1237
-	foreach ( $types as $name => $text ) : ?>
1236
+	$disabled = disabled((defined('FTP_SSL') && FTP_SSL) || (defined('FTP_SSH') && FTP_SSH), true, false);
1237
+	foreach ($types as $name => $text) : ?>
1238 1238
 	<label for="<?php echo esc_attr($name) ?>">
1239 1239
 		<input type="radio" name="connection_type" id="<?php echo esc_attr($name) ?>" value="<?php echo esc_attr($name) ?>"<?php checked($name, $connection_type); echo $disabled; ?> />
1240 1240
 		<?php echo $text ?>
@@ -1242,14 +1242,14 @@  discard block
 block discarded – undo
1242 1242
 	<?php endforeach; ?>
1243 1243
 </fieldset>
1244 1244
 <?php
1245
-foreach ( (array) $extra_fields as $field ) {
1246
-	if ( isset( $_POST[ $field ] ) )
1247
-		echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
1245
+foreach ((array) $extra_fields as $field) {
1246
+	if (isset($_POST[$field]))
1247
+		echo '<input type="hidden" name="'.esc_attr($field).'" value="'.esc_attr(wp_unslash($_POST[$field])).'" />';
1248 1248
 }
1249 1249
 ?>
1250 1250
 	<p class="request-filesystem-credentials-action-buttons">
1251
-		<button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button>
1252
-		<?php submit_button( __( 'Proceed' ), 'button', 'upgrade', false ); ?>
1251
+		<button class="button cancel-button" data-js-action="close" type="button"><?php _e('Cancel'); ?></button>
1252
+		<?php submit_button(__('Proceed'), 'button', 'upgrade', false); ?>
1253 1253
 	</p>
1254 1254
 </div>
1255 1255
 </form>
@@ -1265,10 +1265,10 @@  discard block
 block discarded – undo
1265 1265
 function wp_print_request_filesystem_credentials_modal() {
1266 1266
 	$filesystem_method = get_filesystem_method();
1267 1267
 	ob_start();
1268
-	$filesystem_credentials_are_stored = request_filesystem_credentials( self_admin_url() );
1268
+	$filesystem_credentials_are_stored = request_filesystem_credentials(self_admin_url());
1269 1269
 	ob_end_clean();
1270
-	$request_filesystem_credentials = ( $filesystem_method != 'direct' && ! $filesystem_credentials_are_stored );
1271
-	if ( ! $request_filesystem_credentials ) {
1270
+	$request_filesystem_credentials = ($filesystem_method != 'direct' && ! $filesystem_credentials_are_stored);
1271
+	if ( ! $request_filesystem_credentials) {
1272 1272
 		return;
1273 1273
 	}
1274 1274
 	?>
@@ -1276,7 +1276,7 @@  discard block
 block discarded – undo
1276 1276
 		<div class="notification-dialog-background"></div>
1277 1277
 		<div class="notification-dialog" role="dialog" aria-labelledby="request-filesystem-credentials-title" tabindex="0">
1278 1278
 			<div class="request-filesystem-credentials-dialog-content">
1279
-				<?php request_filesystem_credentials( site_url() ); ?>
1279
+				<?php request_filesystem_credentials(site_url()); ?>
1280 1280
 			</div>
1281 1281
 		</div>
1282 1282
 	</div>
Please login to merge, or discard this patch.
Braces   +213 added lines, -122 removed lines patch added patch discarded remove patch
@@ -118,23 +118,27 @@  discard block
 block discarded – undo
118 118
  * @return bool|array False on failure, Else array of files
119 119
  */
120 120
 function list_files( $folder = '', $levels = 100 ) {
121
-	if ( empty($folder) )
122
-		return false;
121
+	if ( empty($folder) ) {
122
+			return false;
123
+	}
123 124
 
124
-	if ( ! $levels )
125
-		return false;
125
+	if ( ! $levels ) {
126
+			return false;
127
+	}
126 128
 
127 129
 	$files = array();
128 130
 	if ( $dir = @opendir( $folder ) ) {
129 131
 		while (($file = readdir( $dir ) ) !== false ) {
130
-			if ( in_array($file, array('.', '..') ) )
131
-				continue;
132
+			if ( in_array($file, array('.', '..') ) ) {
133
+							continue;
134
+			}
132 135
 			if ( is_dir( $folder . '/' . $file ) ) {
133 136
 				$files2 = list_files( $folder . '/' . $file, $levels - 1);
134
-				if ( $files2 )
135
-					$files = array_merge($files, $files2 );
136
-				else
137
-					$files[] = $folder . '/' . $file . '/';
137
+				if ( $files2 ) {
138
+									$files = array_merge($files, $files2 );
139
+				} else {
140
+									$files[] = $folder . '/' . $file . '/';
141
+				}
138 142
 			} else {
139 143
 				$files[] = $folder . '/' . $file;
140 144
 			}
@@ -205,8 +209,9 @@  discard block
 block discarded – undo
205 209
 function validate_file_to_edit( $file, $allowed_files = '' ) {
206 210
 	$code = validate_file( $file, $allowed_files );
207 211
 
208
-	if (!$code )
209
-		return $file;
212
+	if (!$code ) {
213
+			return $file;
214
+	}
210 215
 
211 216
 	switch ( $code ) {
212 217
 		case 1 :
@@ -480,12 +485,14 @@  discard block
 block discarded – undo
480 485
  */
481 486
 function download_url( $url, $timeout = 300 ) {
482 487
 	//WARNING: The file is not automatically deleted, The script must unlink() the file.
483
-	if ( ! $url )
484
-		return new WP_Error('http_no_url', __('Invalid URL Provided.'));
488
+	if ( ! $url ) {
489
+			return new WP_Error('http_no_url', __('Invalid URL Provided.'));
490
+	}
485 491
 
486 492
 	$tmpfname = wp_tempnam($url);
487
-	if ( ! $tmpfname )
488
-		return new WP_Error('http_no_file', __('Could not create Temporary file.'));
493
+	if ( ! $tmpfname ) {
494
+			return new WP_Error('http_no_file', __('Could not create Temporary file.'));
495
+	}
489 496
 
490 497
 	$response = wp_safe_remote_get( $url, array( 'timeout' => $timeout, 'stream' => true, 'filename' => $tmpfname ) );
491 498
 
@@ -521,17 +528,20 @@  discard block
 block discarded – undo
521 528
  * @return bool|object WP_Error on failure, true on success, false when the MD5 format is unknown/unexpected
522 529
  */
523 530
 function verify_file_md5( $filename, $expected_md5 ) {
524
-	if ( 32 == strlen( $expected_md5 ) )
525
-		$expected_raw_md5 = pack( 'H*', $expected_md5 );
526
-	elseif ( 24 == strlen( $expected_md5 ) )
527
-		$expected_raw_md5 = base64_decode( $expected_md5 );
528
-	else
529
-		return false; // unknown format
531
+	if ( 32 == strlen( $expected_md5 ) ) {
532
+			$expected_raw_md5 = pack( 'H*', $expected_md5 );
533
+	} elseif ( 24 == strlen( $expected_md5 ) ) {
534
+			$expected_raw_md5 = base64_decode( $expected_md5 );
535
+	} else {
536
+			return false;
537
+	}
538
+	// unknown format
530 539
 
531 540
 	$file_md5 = md5_file( $filename, true );
532 541
 
533
-	if ( $file_md5 === $expected_raw_md5 )
534
-		return true;
542
+	if ( $file_md5 === $expected_raw_md5 ) {
543
+			return true;
544
+	}
535 545
 
536 546
 	return new WP_Error( 'md5_mismatch', sprintf( __( 'The checksum of the file (%1$s) does not match the expected checksum value (%2$s).' ), bin2hex( $file_md5 ), bin2hex( $expected_raw_md5 ) ) );
537 547
 }
@@ -554,8 +564,9 @@  discard block
 block discarded – undo
554 564
 function unzip_file($file, $to) {
555 565
 	global $wp_filesystem;
556 566
 
557
-	if ( ! $wp_filesystem || !is_object($wp_filesystem) )
558
-		return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
567
+	if ( ! $wp_filesystem || !is_object($wp_filesystem) ) {
568
+			return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
569
+	}
559 570
 
560 571
 	// Unzip can use a lot of memory, but not this much hopefully
561 572
 	/** This filter is documented in wp-admin/admin.php */
@@ -568,17 +579,22 @@  discard block
 block discarded – undo
568 579
 	if ( ! $wp_filesystem->is_dir($to) ) { //Only do parents if no children exist
569 580
 		$path = preg_split('![/\\\]!', untrailingslashit($to));
570 581
 		for ( $i = count($path); $i >= 0; $i-- ) {
571
-			if ( empty($path[$i]) )
572
-				continue;
582
+			if ( empty($path[$i]) ) {
583
+							continue;
584
+			}
573 585
 
574 586
 			$dir = implode('/', array_slice($path, 0, $i+1) );
575
-			if ( preg_match('!^[a-z]:$!i', $dir) ) // Skip it if it looks like a Windows Drive letter.
587
+			if ( preg_match('!^[a-z]:$!i', $dir) ) {
588
+				// Skip it if it looks like a Windows Drive letter.
576 589
 				continue;
590
+			}
577 591
 
578
-			if ( ! $wp_filesystem->is_dir($dir) )
579
-				$needed_dirs[] = $dir;
580
-			else
581
-				break; // A folder exists, therefor, we dont need the check the levels below this
592
+			if ( ! $wp_filesystem->is_dir($dir) ) {
593
+							$needed_dirs[] = $dir;
594
+			} else {
595
+							break;
596
+			}
597
+			// A folder exists, therefor, we dont need the check the levels below this
582 598
 		}
583 599
 	}
584 600
 
@@ -594,8 +610,9 @@  discard block
 block discarded – undo
594 610
 		if ( true === $result ) {
595 611
 			return $result;
596 612
 		} elseif ( is_wp_error($result) ) {
597
-			if ( 'incompatible_archive' != $result->get_error_code() )
598
-				return $result;
613
+			if ( 'incompatible_archive' != $result->get_error_code() ) {
614
+							return $result;
615
+			}
599 616
 		}
600 617
 	}
601 618
 	// Fall through to PclZip if ZipArchive is not available, or encountered an error opening the file.
@@ -623,24 +640,30 @@  discard block
 block discarded – undo
623 640
 	$z = new ZipArchive();
624 641
 
625 642
 	$zopen = $z->open( $file, ZIPARCHIVE::CHECKCONS );
626
-	if ( true !== $zopen )
627
-		return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
643
+	if ( true !== $zopen ) {
644
+			return new WP_Error( 'incompatible_archive', __( 'Incompatible Archive.' ), array( 'ziparchive_error' => $zopen ) );
645
+	}
628 646
 
629 647
 	$uncompressed_size = 0;
630 648
 
631 649
 	for ( $i = 0; $i < $z->numFiles; $i++ ) {
632
-		if ( ! $info = $z->statIndex($i) )
633
-			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
650
+		if ( ! $info = $z->statIndex($i) ) {
651
+					return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
652
+		}
634 653
 
635
-		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Skip the OS X-created __MACOSX directory
654
+		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) {
655
+			// Skip the OS X-created __MACOSX directory
636 656
 			continue;
657
+		}
637 658
 
638 659
 		$uncompressed_size += $info['size'];
639 660
 
640
-		if ( '/' == substr($info['name'], -1) ) // directory
661
+		if ( '/' == substr($info['name'], -1) ) {
662
+			// directory
641 663
 			$needed_dirs[] = $to . untrailingslashit($info['name']);
642
-		else
643
-			$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
664
+		} else {
665
+					$needed_dirs[] = $to . untrailingslashit(dirname($info['name']));
666
+		}
644 667
 	}
645 668
 
646 669
 	/*
@@ -650,17 +673,22 @@  discard block
 block discarded – undo
650 673
 	 */
651 674
 	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
652 675
 		$available_space = @disk_free_space( WP_CONTENT_DIR );
653
-		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
654
-			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
676
+		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
677
+					return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
678
+		}
655 679
 	}
656 680
 
657 681
 	$needed_dirs = array_unique($needed_dirs);
658 682
 	foreach ( $needed_dirs as $dir ) {
659 683
 		// Check the parent folders of the folders all exist within the creation array.
660
-		if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
684
+		if ( untrailingslashit($to) == $dir ) {
685
+			// Skip over the working directory, We know this exists (or will exist)
661 686
 			continue;
662
-		if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
687
+		}
688
+		if ( strpos($dir, $to) === false ) {
689
+			// If the directory is not within the working directory, Skip it
663 690
 			continue;
691
+		}
664 692
 
665 693
 		$parent_folder = dirname($dir);
666 694
 		while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
@@ -680,21 +708,28 @@  discard block
 block discarded – undo
680 708
 	unset($needed_dirs);
681 709
 
682 710
 	for ( $i = 0; $i < $z->numFiles; $i++ ) {
683
-		if ( ! $info = $z->statIndex($i) )
684
-			return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
711
+		if ( ! $info = $z->statIndex($i) ) {
712
+					return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) );
713
+		}
685 714
 
686
-		if ( '/' == substr($info['name'], -1) ) // directory
715
+		if ( '/' == substr($info['name'], -1) ) {
716
+			// directory
687 717
 			continue;
718
+		}
688 719
 
689
-		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
720
+		if ( '__MACOSX/' === substr($info['name'], 0, 9) ) {
721
+			// Don't extract the OS X-created __MACOSX directory files
690 722
 			continue;
723
+		}
691 724
 
692 725
 		$contents = $z->getFromIndex($i);
693
-		if ( false === $contents )
694
-			return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] );
726
+		if ( false === $contents ) {
727
+					return new WP_Error( 'extract_failed_ziparchive', __( 'Could not extract file from archive.' ), $info['name'] );
728
+		}
695 729
 
696
-		if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) )
697
-			return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] );
730
+		if ( ! $wp_filesystem->put_contents( $to . $info['name'], $contents, FS_CHMOD_FILE) ) {
731
+					return new WP_Error( 'copy_failed_ziparchive', __( 'Could not copy file.' ), $info['name'] );
732
+		}
698 733
 	}
699 734
 
700 735
 	$z->close();
@@ -731,18 +766,22 @@  discard block
 block discarded – undo
731 766
 	reset_mbstring_encoding();
732 767
 
733 768
 	// Is the archive valid?
734
-	if ( !is_array($archive_files) )
735
-		return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true));
769
+	if ( !is_array($archive_files) ) {
770
+			return new WP_Error('incompatible_archive', __('Incompatible Archive.'), $archive->errorInfo(true));
771
+	}
736 772
 
737
-	if ( 0 == count($archive_files) )
738
-		return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) );
773
+	if ( 0 == count($archive_files) ) {
774
+			return new WP_Error( 'empty_archive_pclzip', __( 'Empty archive.' ) );
775
+	}
739 776
 
740 777
 	$uncompressed_size = 0;
741 778
 
742 779
 	// Determine any children directories needed (From within the archive)
743 780
 	foreach ( $archive_files as $file ) {
744
-		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Skip the OS X-created __MACOSX directory
781
+		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) {
782
+			// Skip the OS X-created __MACOSX directory
745 783
 			continue;
784
+		}
746 785
 
747 786
 		$uncompressed_size += $file['size'];
748 787
 
@@ -756,17 +795,22 @@  discard block
 block discarded – undo
756 795
 	 */
757 796
 	if ( defined( 'DOING_CRON' ) && DOING_CRON ) {
758 797
 		$available_space = @disk_free_space( WP_CONTENT_DIR );
759
-		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space )
760
-			return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
798
+		if ( $available_space && ( $uncompressed_size * 2.1 ) > $available_space ) {
799
+					return new WP_Error( 'disk_full_unzip_file', __( 'Could not copy files. You may have run out of disk space.' ), compact( 'uncompressed_size', 'available_space' ) );
800
+		}
761 801
 	}
762 802
 
763 803
 	$needed_dirs = array_unique($needed_dirs);
764 804
 	foreach ( $needed_dirs as $dir ) {
765 805
 		// Check the parent folders of the folders all exist within the creation array.
766
-		if ( untrailingslashit($to) == $dir ) // Skip over the working directory, We know this exists (or will exist)
806
+		if ( untrailingslashit($to) == $dir ) {
807
+			// Skip over the working directory, We know this exists (or will exist)
767 808
 			continue;
768
-		if ( strpos($dir, $to) === false ) // If the directory is not within the working directory, Skip it
809
+		}
810
+		if ( strpos($dir, $to) === false ) {
811
+			// If the directory is not within the working directory, Skip it
769 812
 			continue;
813
+		}
770 814
 
771 815
 		$parent_folder = dirname($dir);
772 816
 		while ( !empty($parent_folder) && untrailingslashit($to) != $parent_folder && !in_array($parent_folder, $needed_dirs) ) {
@@ -779,21 +823,26 @@  discard block
 block discarded – undo
779 823
 	// Create those directories if need be:
780 824
 	foreach ( $needed_dirs as $_dir ) {
781 825
 		// Only check to see if the dir exists upon creation failure. Less I/O this way.
782
-		if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) )
783
-			return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
826
+		if ( ! $wp_filesystem->mkdir( $_dir, FS_CHMOD_DIR ) && ! $wp_filesystem->is_dir( $_dir ) ) {
827
+					return new WP_Error( 'mkdir_failed_pclzip', __( 'Could not create directory.' ), substr( $_dir, strlen( $to ) ) );
828
+		}
784 829
 	}
785 830
 	unset($needed_dirs);
786 831
 
787 832
 	// Extract the files from the zip
788 833
 	foreach ( $archive_files as $file ) {
789
-		if ( $file['folder'] )
790
-			continue;
834
+		if ( $file['folder'] ) {
835
+					continue;
836
+		}
791 837
 
792
-		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) // Don't extract the OS X-created __MACOSX directory files
838
+		if ( '__MACOSX/' === substr($file['filename'], 0, 9) ) {
839
+			// Don't extract the OS X-created __MACOSX directory files
793 840
 			continue;
841
+		}
794 842
 
795
-		if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) )
796
-			return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
843
+		if ( ! $wp_filesystem->put_contents( $to . $file['filename'], $file['content'], FS_CHMOD_FILE) ) {
844
+					return new WP_Error( 'copy_failed_pclzip', __( 'Could not copy file.' ), $file['filename'] );
845
+		}
797 846
 	}
798 847
 	return true;
799 848
 }
@@ -820,32 +869,37 @@  discard block
 block discarded – undo
820 869
 	$to = trailingslashit($to);
821 870
 
822 871
 	foreach ( (array) $dirlist as $filename => $fileinfo ) {
823
-		if ( in_array( $filename, $skip_list ) )
824
-			continue;
872
+		if ( in_array( $filename, $skip_list ) ) {
873
+					continue;
874
+		}
825 875
 
826 876
 		if ( 'f' == $fileinfo['type'] ) {
827 877
 			if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
828 878
 				// If copy failed, chmod file to 0644 and try again.
829 879
 				$wp_filesystem->chmod( $to . $filename, FS_CHMOD_FILE );
830
-				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) )
831
-					return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
880
+				if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true, FS_CHMOD_FILE) ) {
881
+									return new WP_Error( 'copy_failed_copy_dir', __( 'Could not copy file.' ), $to . $filename );
882
+				}
832 883
 			}
833 884
 		} elseif ( 'd' == $fileinfo['type'] ) {
834 885
 			if ( !$wp_filesystem->is_dir($to . $filename) ) {
835
-				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) )
836
-					return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
886
+				if ( !$wp_filesystem->mkdir($to . $filename, FS_CHMOD_DIR) ) {
887
+									return new WP_Error( 'mkdir_failed_copy_dir', __( 'Could not create directory.' ), $to . $filename );
888
+				}
837 889
 			}
838 890
 
839 891
 			// generate the $sub_skip_list for the subdirectory as a sub-set of the existing $skip_list
840 892
 			$sub_skip_list = array();
841 893
 			foreach ( $skip_list as $skip_item ) {
842
-				if ( 0 === strpos( $skip_item, $filename . '/' ) )
843
-					$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
894
+				if ( 0 === strpos( $skip_item, $filename . '/' ) ) {
895
+									$sub_skip_list[] = preg_replace( '!^' . preg_quote( $filename, '!' ) . '/!i', '', $skip_item );
896
+				}
844 897
 			}
845 898
 
846 899
 			$result = copy_dir($from . $filename, $to . $filename, $sub_skip_list);
847
-			if ( is_wp_error($result) )
848
-				return $result;
900
+			if ( is_wp_error($result) ) {
901
+							return $result;
902
+			}
849 903
 		}
850 904
 	}
851 905
 	return true;
@@ -875,8 +929,9 @@  discard block
 block discarded – undo
875 929
 
876 930
 	$method = get_filesystem_method( $args, $context, $allow_relaxed_file_ownership );
877 931
 
878
-	if ( ! $method )
879
-		return false;
932
+	if ( ! $method ) {
933
+			return false;
934
+	}
880 935
 
881 936
 	if ( ! class_exists( "WP_Filesystem_$method" ) ) {
882 937
 
@@ -892,8 +947,9 @@  discard block
 block discarded – undo
892 947
 		 */
893 948
 		$abstraction_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method );
894 949
 
895
-		if ( ! file_exists($abstraction_file) )
896
-			return;
950
+		if ( ! file_exists($abstraction_file) ) {
951
+					return;
952
+		}
897 953
 
898 954
 		require_once($abstraction_file);
899 955
 	}
@@ -902,22 +958,29 @@  discard block
 block discarded – undo
902 958
 	$wp_filesystem = new $method($args);
903 959
 
904 960
 	//Define the timeouts for the connections. Only available after the construct is called to allow for per-transport overriding of the default.
905
-	if ( ! defined('FS_CONNECT_TIMEOUT') )
906
-		define('FS_CONNECT_TIMEOUT', 30);
907
-	if ( ! defined('FS_TIMEOUT') )
908
-		define('FS_TIMEOUT', 30);
961
+	if ( ! defined('FS_CONNECT_TIMEOUT') ) {
962
+			define('FS_CONNECT_TIMEOUT', 30);
963
+	}
964
+	if ( ! defined('FS_TIMEOUT') ) {
965
+			define('FS_TIMEOUT', 30);
966
+	}
909 967
 
910
-	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() )
911
-		return false;
968
+	if ( is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code() ) {
969
+			return false;
970
+	}
912 971
 
913
-	if ( !$wp_filesystem->connect() )
914
-		return false; //There was an error connecting to the server.
972
+	if ( !$wp_filesystem->connect() ) {
973
+			return false;
974
+	}
975
+	//There was an error connecting to the server.
915 976
 
916 977
 	// Set the permission constants if not already set.
917
-	if ( ! defined('FS_CHMOD_DIR') )
918
-		define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
919
-	if ( ! defined('FS_CHMOD_FILE') )
920
-		define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
978
+	if ( ! defined('FS_CHMOD_DIR') ) {
979
+			define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) );
980
+	}
981
+	if ( ! defined('FS_CHMOD_FILE') ) {
982
+			define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) );
983
+	}
921 984
 
922 985
 	return true;
923 986
 }
@@ -992,9 +1055,16 @@  discard block
 block discarded – undo
992 1055
 		}
993 1056
  	}
994 1057
 
995
-	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) $method = 'ssh2';
996
-	if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
997
-	if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
1058
+	if ( ! $method && isset($args['connection_type']) && 'ssh' == $args['connection_type'] && extension_loaded('ssh2') && function_exists('stream_get_contents') ) {
1059
+		$method = 'ssh2';
1060
+	}
1061
+	if ( ! $method && extension_loaded('ftp') ) {
1062
+		$method = 'ftpext';
1063
+	}
1064
+	if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) {
1065
+		$method = 'ftpsockets';
1066
+	}
1067
+	//Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
998 1068
 
999 1069
 	/**
1000 1070
 	 * Filter the filesystem method to use.
@@ -1061,18 +1131,21 @@  discard block
 block discarded – undo
1061 1131
 	 * @param array  $extra_fields                 Extra POST fields.
1062 1132
 	 */
1063 1133
 	$req_cred = apply_filters( 'request_filesystem_credentials', '', $form_post, $type, $error, $context, $extra_fields, $allow_relaxed_file_ownership );
1064
-	if ( '' !== $req_cred )
1065
-		return $req_cred;
1134
+	if ( '' !== $req_cred ) {
1135
+			return $req_cred;
1136
+	}
1066 1137
 
1067 1138
 	if ( empty($type) ) {
1068 1139
 		$type = get_filesystem_method( array(), $context, $allow_relaxed_file_ownership );
1069 1140
 	}
1070 1141
 
1071
-	if ( 'direct' == $type )
1072
-		return true;
1142
+	if ( 'direct' == $type ) {
1143
+			return true;
1144
+	}
1073 1145
 
1074
-	if ( is_null( $extra_fields ) )
1075
-		$extra_fields = array( 'version', 'locale' );
1146
+	if ( is_null( $extra_fields ) ) {
1147
+			$extra_fields = array( 'version', 'locale' );
1148
+	}
1076 1149
 
1077 1150
 	$credentials = get_option('ftp_credentials', array( 'hostname' => '', 'username' => ''));
1078 1151
 
@@ -1090,8 +1163,9 @@  discard block
 block discarded – undo
1090 1163
 
1091 1164
 	if ( strpos($credentials['hostname'], ':') ) {
1092 1165
 		list( $credentials['hostname'], $credentials['port'] ) = explode(':', $credentials['hostname'], 2);
1093
-		if ( ! is_numeric($credentials['port']) )
1094
-			unset($credentials['port']);
1166
+		if ( ! is_numeric($credentials['port']) ) {
1167
+					unset($credentials['port']);
1168
+		}
1095 1169
 	} else {
1096 1170
 		unset($credentials['port']);
1097 1171
 	}
@@ -1111,8 +1185,10 @@  discard block
 block discarded – undo
1111 1185
 				( 'ssh' == $credentials['connection_type'] && !empty($credentials['public_key']) && !empty($credentials['private_key']) )
1112 1186
 			) ) {
1113 1187
 		$stored_credentials = $credentials;
1114
-		if ( !empty($stored_credentials['port']) ) //save port as part of hostname to simplify above code.
1188
+		if ( !empty($stored_credentials['port']) ) {
1189
+			//save port as part of hostname to simplify above code.
1115 1190
 			$stored_credentials['hostname'] .= ':' . $stored_credentials['port'];
1191
+		}
1116 1192
 
1117 1193
 		unset($stored_credentials['password'], $stored_credentials['port'], $stored_credentials['private_key'], $stored_credentials['public_key']);
1118 1194
 		if ( ! wp_installing() ) {
@@ -1129,18 +1205,23 @@  discard block
 block discarded – undo
1129 1205
 
1130 1206
 	if ( $error ) {
1131 1207
 		$error_string = __('<strong>ERROR:</strong> There was an error connecting to the server, Please verify the settings are correct.');
1132
-		if ( is_wp_error($error) )
1133
-			$error_string = esc_html( $error->get_error_message() );
1208
+		if ( is_wp_error($error) ) {
1209
+					$error_string = esc_html( $error->get_error_message() );
1210
+		}
1134 1211
 		echo '<div id="message" class="error"><p>' . $error_string . '</p></div>';
1135 1212
 	}
1136 1213
 
1137 1214
 	$types = array();
1138
-	if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') )
1139
-		$types[ 'ftp' ] = __('FTP');
1140
-	if ( extension_loaded('ftp') ) //Only this supports FTPS
1215
+	if ( extension_loaded('ftp') || extension_loaded('sockets') || function_exists('fsockopen') ) {
1216
+			$types[ 'ftp' ] = __('FTP');
1217
+	}
1218
+	if ( extension_loaded('ftp') ) {
1219
+		//Only this supports FTPS
1141 1220
 		$types[ 'ftps' ] = __('FTPS (SSL)');
1142
-	if ( extension_loaded('ssh2') && function_exists('stream_get_contents') )
1143
-		$types[ 'ssh' ] = __('SSH2');
1221
+	}
1222
+	if ( extension_loaded('ssh2') && function_exists('stream_get_contents') ) {
1223
+			$types[ 'ssh' ] = __('SSH2');
1224
+	}
1144 1225
 
1145 1226
 	/**
1146 1227
 	 * Filter the connection types to output to the filesystem credentials form.
@@ -1201,7 +1282,10 @@  discard block
 block discarded – undo
1201 1282
 ?></p>
1202 1283
 <label for="hostname">
1203 1284
 	<span class="field-title"><?php _e( 'Hostname' ) ?></span>
1204
-	<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ) ?>" value="<?php echo esc_attr($hostname); if ( !empty($port) ) echo ":$port"; ?>"<?php disabled( defined('FTP_HOST') ); ?> />
1285
+	<input name="hostname" type="text" id="hostname" aria-describedby="request-filesystem-credentials-desc" class="code" placeholder="<?php esc_attr_e( 'example: www.wordpress.org' ) ?>" value="<?php echo esc_attr($hostname); if ( !empty($port) ) {
1286
+	echo ":$port";
1287
+}
1288
+?>"<?php disabled( defined('FTP_HOST') ); ?> />
1205 1289
 </label>
1206 1290
 <div class="ftp-username">
1207 1291
 	<label for="username">
@@ -1212,8 +1296,14 @@  discard block
 block discarded – undo
1212 1296
 <div class="ftp-password">
1213 1297
 	<label for="password">
1214 1298
 		<span class="field-title"><?php echo $label_pass; ?></span>
1215
-		<input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) echo '*****'; ?>"<?php disabled( defined('FTP_PASS') ); ?> />
1216
-		<em><?php if ( ! defined('FTP_PASS') ) _e( 'This password will not be stored on the server.' ); ?></em>
1299
+		<input name="password" type="password" id="password" value="<?php if ( defined('FTP_PASS') ) {
1300
+	echo '*****';
1301
+}
1302
+?>"<?php disabled( defined('FTP_PASS') ); ?> />
1303
+		<em><?php if ( ! defined('FTP_PASS') ) {
1304
+	_e( 'This password will not be stored on the server.' );
1305
+}
1306
+?></em>
1217 1307
 	</label>
1218 1308
 </div>
1219 1309
 <?php if ( isset($types['ssh']) ) : ?>
@@ -1243,9 +1333,10 @@  discard block
 block discarded – undo
1243 1333
 </fieldset>
1244 1334
 <?php
1245 1335
 foreach ( (array) $extra_fields as $field ) {
1246
-	if ( isset( $_POST[ $field ] ) )
1247
-		echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
1248
-}
1336
+	if ( isset( $_POST[ $field ] ) ) {
1337
+			echo '<input type="hidden" name="' . esc_attr( $field ) . '" value="' . esc_attr( wp_unslash( $_POST[ $field ] ) ) . '" />';
1338
+	}
1339
+	}
1249 1340
 ?>
1250 1341
 	<p class="request-filesystem-credentials-action-buttons">
1251 1342
 		<button class="button cancel-button" data-js-action="close" type="button"><?php _e( 'Cancel' ); ?></button>
Please login to merge, or discard this patch.
src/wp-admin/includes/image-edit.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
  * @ignore
342 342
  * @param int $w Image width in pixels.
343 343
  * @param int $h Image height in pixels.
344
- * @return float|int Image preview ratio.
344
+ * @return integer Image preview ratio.
345 345
  */
346 346
 function _image_get_preview_ratio($w, $h) {
347 347
 	$max = max($w, $h);
@@ -356,7 +356,7 @@  discard block
 block discarded – undo
356 356
  * @ignore
357 357
  * @param resource  $img   Image resource.
358 358
  * @param float|int $angle Image rotation angle, in degrees.
359
- * @return resource|false GD image resource, false otherwise.
359
+ * @return resource GD image resource, false otherwise.
360 360
  */
361 361
 function _rotate_image_resource($img, $angle) {
362 362
 	_deprecated_function( __FUNCTION__, '3.5', __( 'Use WP_Image_Editor::rotate' ) );
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Image Editor
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Image Editor
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Loads the WP image-editing interface.
@@ -520,7 +520,7 @@  discard block
 block discarded – undo
520 520
 		 * @since 3.5.0
521 521
 		 *
522 522
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
523
- 		 * @param array           $changes Array of change operations.
523
+		 * @param array           $changes Array of change operations.
524 524
 		 */
525 525
 		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
526 526
 	} elseif ( is_resource( $image ) ) {
@@ -532,7 +532,7 @@  discard block
 block discarded – undo
532 532
 		 * @deprecated 3.5.0 Use wp_image_editor_before_change instead.
533 533
 		 *
534 534
 		 * @param resource $image   GD image resource.
535
- 		 * @param array    $changes Array of change operations.
535
+		 * @param array    $changes Array of change operations.
536 536
 		 */
537 537
 		$image = apply_filters( 'image_edit_before_change', $image, $changes );
538 538
 	}
Please login to merge, or discard this patch.
Spacing   +220 added lines, -220 removed lines patch added patch discarded remove patch
@@ -20,22 +20,22 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
23
+	if (isset($meta['width'], $meta['height']))
24
+		$big = max($meta['width'], $meta['height']);
25 25
 	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
26
+		die(__('Image data does not exist. Please re-upload the image.'));
27 27
 
28 28
 	$sizer = $big > 400 ? 400 / $big : 1;
29 29
 
30
-	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
30
+	$backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
31 31
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
32
+	if ( ! empty($backup_sizes) && isset($backup_sizes['full-orig'], $meta['file']))
33
+		$can_restore = $backup_sizes['full-orig']['file'] != basename($meta['file']);
34 34
 
35
-	if ( $msg ) {
36
-		if ( isset($msg->error) )
35
+	if ($msg) {
36
+		if (isset($msg->error))
37 37
 			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
38
+		elseif (isset($msg->msg))
39 39
 			$note = "<div class='updated'><p>$msg->msg</p></div>";
40 40
 	}
41 41
 
@@ -46,28 +46,28 @@  discard block
 block discarded – undo
46 46
 	<div class="imgedit-settings">
47 47
 	<div class="imgedit-group">
48 48
 	<div class="imgedit-group-top">
49
-		<h2><?php _e( 'Scale Image' ); ?></h2>
50
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Scale Image Help' ); ?></span></button>
49
+		<h2><?php _e('Scale Image'); ?></h2>
50
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Scale Image Help'); ?></span></button>
51 51
 		<div class="imgedit-help">
52 52
 		<p><?php _e('You can proportionally scale the original image. For best results, scaling should be done before you crop, flip, or rotate. Images can only be scaled down, not up.'); ?></p>
53 53
 		</div>
54
-		<?php if ( isset( $meta['width'], $meta['height'] ) ): ?>
55
-		<p><?php printf( __('Original dimensions %s'), $meta['width'] . ' &times; ' . $meta['height'] ); ?></p>
54
+		<?php if (isset($meta['width'], $meta['height'])): ?>
55
+		<p><?php printf(__('Original dimensions %s'), $meta['width'].' &times; '.$meta['height']); ?></p>
56 56
 		<?php endif ?>
57 57
 		<div class="imgedit-submit">
58 58
 
59 59
 		<fieldset class="imgedit-scale">
60
-		<legend><?php _e( 'New dimensions:' ); ?></legend>
60
+		<legend><?php _e('New dimensions:'); ?></legend>
61 61
 		<div class="nowrap">
62
-		<label><span class="screen-reader-text"><?php _e( 'scale width' ); ?></span>
63
-		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
62
+		<label><span class="screen-reader-text"><?php _e('scale width'); ?></span>
63
+		<input type="text" id="imgedit-scale-width-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 1)" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
64 64
 		</label>
65 65
 		<span class="imgedit-separator">&times;</span>
66
-		<label><span class="screen-reader-text"><?php _e( 'scale height' ); ?></span>
67
-		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
66
+		<label><span class="screen-reader-text"><?php _e('scale height'); ?></span>
67
+		<input type="text" id="imgedit-scale-height-<?php echo $post_id; ?>" onkeyup="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" onblur="imageEdit.scaleChanged(<?php echo $post_id; ?>, 0)" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
68 68
 		</label>
69 69
 		<span class="imgedit-scale-warn" id="imgedit-scale-warn-<?php echo $post_id; ?>">!</span>
70
-		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e( 'Scale' ); ?>" />
70
+		<input id="imgedit-scale-button" type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'scale')" class="button button-primary" value="<?php esc_attr_e('Scale'); ?>" />
71 71
  		</div>
72 72
 		</fieldset>
73 73
 
@@ -75,20 +75,20 @@  discard block
 block discarded – undo
75 75
 	</div>
76 76
 	</div>
77 77
 
78
-<?php if ( $can_restore ) { ?>
78
+<?php if ($can_restore) { ?>
79 79
 
80 80
 	<div class="imgedit-group">
81 81
 	<div class="imgedit-group-top">
82
-		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e( 'Restore Original Image' ); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
82
+		<h2><button type="button" onclick="imageEdit.toggleHelp(this);" class="button-link"><?php _e('Restore Original Image'); ?> <span class="dashicons dashicons-arrow-down imgedit-help-toggle"></span></button></h2>
83 83
 		<div class="imgedit-help">
84 84
 		<p><?php _e('Discard any changes and restore the original image.');
85 85
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
86
+		if ( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE)
87 87
 			echo ' '.__('Previously edited copies of the image will not be deleted.');
88 88
 
89 89
 		?></p>
90 90
 		<div class="imgedit-submit">
91
-		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e( 'Restore image' ); ?>" <?php echo $can_restore; ?> />
91
+		<input type="button" onclick="imageEdit.action(<?php echo "$post_id, '$nonce'"; ?>, 'restore')" class="button button-primary" value="<?php esc_attr_e('Restore image'); ?>" <?php echo $can_restore; ?> />
92 92
 		</div>
93 93
 		</div>
94 94
 	</div>
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
 
99 99
 	<div class="imgedit-group">
100 100
 	<div class="imgedit-group-top">
101
-		<h2><?php _e( 'Image Crop' ); ?></h2>
102
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Image Crop Help' ); ?></span></button>
101
+		<h2><?php _e('Image Crop'); ?></h2>
102
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Image Crop Help'); ?></span></button>
103 103
 
104 104
 		<div class="imgedit-help">
105 105
 		<p><?php _e('To crop the image, click on it and drag to make your selection.'); ?></p>
@@ -113,26 +113,26 @@  discard block
 block discarded – undo
113 113
 	</div>
114 114
 
115 115
 	<fieldset class="imgedit-crop-ratio">
116
-		<legend><?php _e( 'Aspect ratio:' ); ?></legend>
116
+		<legend><?php _e('Aspect ratio:'); ?></legend>
117 117
 		<div class="nowrap">
118
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio width' ); ?></span>
118
+		<label><span class="screen-reader-text"><?php _e('crop ratio width'); ?></span>
119 119
 		<input type="text" id="imgedit-crop-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 0, this)" />
120 120
 		</label>
121 121
 		<span class="imgedit-separator">:</span>
122
-		<label><span class="screen-reader-text"><?php _e( 'crop ratio height' ); ?></span>
122
+		<label><span class="screen-reader-text"><?php _e('crop ratio height'); ?></span>
123 123
 		<input type="text" id="imgedit-crop-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setRatioSelection(<?php echo $post_id; ?>, 1, this)" />
124 124
 		</label>
125 125
 		</div>
126 126
 	</fieldset>
127 127
 
128 128
 	<fieldset id="imgedit-crop-sel-<?php echo $post_id; ?>" class="imgedit-crop-sel">
129
-		<legend><?php _e( 'Selection:' ); ?></legend>
129
+		<legend><?php _e('Selection:'); ?></legend>
130 130
 		<div class="nowrap">
131
-		<label><span class="screen-reader-text"><?php _e( 'selection width' ); ?></span>
131
+		<label><span class="screen-reader-text"><?php _e('selection width'); ?></span>
132 132
 		<input type="text" id="imgedit-sel-width-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>)" />
133 133
 		</label>
134 134
 		<span class="imgedit-separator">&times;</span>
135
-		<label><span class="screen-reader-text"><?php _e( 'selection height' ); ?></span>
135
+		<label><span class="screen-reader-text"><?php _e('selection height'); ?></span>
136 136
 		<input type="text" id="imgedit-sel-height-<?php echo $post_id; ?>" onkeyup="imageEdit.setNumSelection(<?php echo $post_id; ?>)" />
137 137
 		</label>
138 138
 		</div>
@@ -140,25 +140,25 @@  discard block
 block discarded – undo
140 140
 
141 141
 	</div>
142 142
 
143
-	<?php if ( $thumb && $sub_sizes ) {
144
-		$thumb_img = wp_constrain_dimensions( $thumb['width'], $thumb['height'], 160, 120 );
143
+	<?php if ($thumb && $sub_sizes) {
144
+		$thumb_img = wp_constrain_dimensions($thumb['width'], $thumb['height'], 160, 120);
145 145
 	?>
146 146
 
147 147
 	<div class="imgedit-group imgedit-applyto">
148 148
 	<div class="imgedit-group-top">
149
-		<h2><?php _e( 'Thumbnail Settings' ); ?></h2>
150
-		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e( 'Thumbnail Settings Help' ); ?></span></button>
149
+		<h2><?php _e('Thumbnail Settings'); ?></h2>
150
+		<button type="button" class="dashicons dashicons-editor-help imgedit-help-toggle" onclick="imageEdit.toggleHelp(this);return false;" aria-expanded="false"><span class="screen-reader-text"><?php esc_html_e('Thumbnail Settings Help'); ?></span></button>
151 151
 		<p class="imgedit-help"><?php _e('You can edit the image while preserving the thumbnail. For example, you may wish to have a square thumbnail that displays just a section of the image.'); ?></p>
152 152
 	</div>
153 153
 
154 154
 	<figure class="imgedit-thumbnail-preview">
155 155
 		<img src="<?php echo $thumb['url']; ?>" width="<?php echo $thumb_img[0]; ?>" height="<?php echo $thumb_img[1]; ?>" class="imgedit-size-preview" alt="" draggable="false" />
156
-		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e( 'Current thumbnail' ); ?></figcaption>
156
+		<figcaption class="imgedit-thumbnail-preview-caption"><?php _e('Current thumbnail'); ?></figcaption>
157 157
 	</figure>
158 158
 
159 159
 	<div id="imgedit-save-target-<?php echo $post_id; ?>" class="imgedit-save-target">
160 160
 	<fieldset>
161
-		<legend><strong><?php _e( 'Apply changes to:' ); ?></strong></legend>
161
+		<legend><strong><?php _e('Apply changes to:'); ?></strong></legend>
162 162
 
163 163
 		<label class="imgedit-label">
164 164
 		<input type="radio" name="imgedit-target-<?php echo $post_id; ?>" value="all" checked="checked" />
@@ -182,26 +182,26 @@  discard block
 block discarded – undo
182 182
 	<div class="imgedit-panel-content wp-clearfix">
183 183
 		<?php echo $note; ?>
184 184
 		<div class="imgedit-menu wp-clearfix">
185
-			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Crop' ); ?></span></button><?php
185
+			<button type="button" onclick="imageEdit.crop(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-crop button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Crop'); ?></span></button><?php
186 186
 
187 187
 		// On some setups GD library does not provide imagerotate() - Ticket #11536
188
-		if ( wp_image_editor_supports( array( 'mime_type' => get_post_mime_type( $post_id ), 'methods' => array( 'rotate' ) ) ) ) {
188
+		if (wp_image_editor_supports(array('mime_type' => get_post_mime_type($post_id), 'methods' => array('rotate')))) {
189 189
 			$note_no_rotate = '';
190 190
 	?>
191
-			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate counter-clockwise' ); ?></span></button>
192
-			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e( 'Rotate clockwise' ); ?></span></button>
191
+			<button type="button" class="imgedit-rleft button" onclick="imageEdit.rotate( 90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate counter-clockwise'); ?></span></button>
192
+			<button type="button" class="imgedit-rright button" onclick="imageEdit.rotate(-90, <?php echo "$post_id, '$nonce'"; ?>, this)"><span class="screen-reader-text"><?php esc_html_e('Rotate clockwise'); ?></span></button>
193 193
 	<?php } else {
194
-			$note_no_rotate = '<p class="note-no-rotate"><em>' . __( 'Image rotation is not supported by your web host.' ) . '</em></p>';
194
+			$note_no_rotate = '<p class="note-no-rotate"><em>'.__('Image rotation is not supported by your web host.').'</em></p>';
195 195
 	?>
196 196
 			<button type="button" class="imgedit-rleft button disabled" disabled></button>
197 197
 			<button type="button" class="imgedit-rright button disabled" disabled></button>
198 198
 	<?php } ?>
199 199
 
200
-			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e( 'Flip vertically' ); ?></span></button>
201
-			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e( 'Flip horizontally' ); ?></span></button>
200
+			<button type="button" onclick="imageEdit.flip(1, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-flipv button"><span class="screen-reader-text"><?php esc_html_e('Flip vertically'); ?></span></button>
201
+			<button type="button" onclick="imageEdit.flip(2, <?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-fliph button"><span class="screen-reader-text"><?php esc_html_e('Flip horizontally'); ?></span></button>
202 202
 
203
-			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Undo' ); ?></span></button>
204
-			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e( 'Redo' ); ?></span></button>
203
+			<button type="button" id="image-undo-<?php echo $post_id; ?>" onclick="imageEdit.undo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-undo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Undo'); ?></span></button>
204
+			<button type="button" id="image-redo-<?php echo $post_id; ?>" onclick="imageEdit.redo(<?php echo "$post_id, '$nonce'"; ?>, this)" class="imgedit-redo button disabled" disabled><span class="screen-reader-text"><?php esc_html_e('Redo'); ?></span></button>
205 205
 			<?php echo $note_no_rotate; ?>
206 206
 		</div>
207 207
 
@@ -209,16 +209,16 @@  discard block
 block discarded – undo
209 209
 		<input type="hidden" id="imgedit-history-<?php echo $post_id; ?>" value="" />
210 210
 		<input type="hidden" id="imgedit-undone-<?php echo $post_id; ?>" value="0" />
211 211
 		<input type="hidden" id="imgedit-selection-<?php echo $post_id; ?>" value="" />
212
-		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset( $meta['width'] ) ? $meta['width'] : 0; ?>" />
213
-		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset( $meta['height'] ) ? $meta['height'] : 0; ?>" />
212
+		<input type="hidden" id="imgedit-x-<?php echo $post_id; ?>" value="<?php echo isset($meta['width']) ? $meta['width'] : 0; ?>" />
213
+		<input type="hidden" id="imgedit-y-<?php echo $post_id; ?>" value="<?php echo isset($meta['height']) ? $meta['height'] : 0; ?>" />
214 214
 
215 215
 		<div id="imgedit-crop-<?php echo $post_id; ?>" class="imgedit-crop-wrap">
216
-		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
216
+		<img id="image-preview-<?php echo $post_id; ?>" onload="imageEdit.imgLoaded('<?php echo $post_id; ?>')" src="<?php echo admin_url('admin-ajax.php', 'relative'); ?>?action=imgedit-preview&amp;_ajax_nonce=<?php echo $nonce; ?>&amp;postid=<?php echo $post_id; ?>&amp;rand=<?php echo rand(1, 99999); ?>" alt="" />
217 217
 		</div>
218 218
 
219 219
 		<div class="imgedit-submit">
220
-			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e( 'Cancel' ); ?>" />
221
-			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e( 'Save' ); ?>" />
220
+			<input type="button" onclick="imageEdit.close(<?php echo $post_id; ?>, 1)" class="button imgedit-cancel-btn" value="<?php esc_attr_e('Cancel'); ?>" />
221
+			<input type="button" onclick="imageEdit.save(<?php echo "$post_id, '$nonce'"; ?>)" disabled="disabled" class="button button-primary imgedit-submit-btn" value="<?php esc_attr_e('Save'); ?>" />
222 222
 		</div>
223 223
 	</div>
224 224
 
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
  * @param int $post_id
240 240
  * @return bool
241 241
  */
242
-function wp_stream_image( $image, $mime_type, $post_id ) {
243
-	if ( $image instanceof WP_Image_Editor ) {
242
+function wp_stream_image($image, $mime_type, $post_id) {
243
+	if ($image instanceof WP_Image_Editor) {
244 244
 
245 245
 		/**
246 246
 		 * Filter the WP_Image_Editor instance for the image to be streamed to the browser.
@@ -250,14 +250,14 @@  discard block
 block discarded – undo
250 250
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
251 251
 		 * @param int             $post_id Post ID.
252 252
 		 */
253
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
253
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
254 254
 
255
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
255
+		if (is_wp_error($image->stream($mime_type)))
256 256
 			return false;
257 257
 
258 258
 		return true;
259 259
 	} else {
260
-		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
260
+		_deprecated_argument(__FUNCTION__, '3.5', __('$image needs to be an WP_Image_Editor object'));
261 261
 
262 262
 		/**
263 263
 		 * Filter the GD image resource to be streamed to the browser.
@@ -268,18 +268,18 @@  discard block
 block discarded – undo
268 268
 		 * @param resource $image   Image resource to be streamed.
269 269
 		 * @param int      $post_id Post ID.
270 270
 		 */
271
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
271
+		$image = apply_filters('image_save_pre', $image, $post_id);
272 272
 
273
-		switch ( $mime_type ) {
273
+		switch ($mime_type) {
274 274
 			case 'image/jpeg':
275
-				header( 'Content-Type: image/jpeg' );
276
-				return imagejpeg( $image, null, 90 );
275
+				header('Content-Type: image/jpeg');
276
+				return imagejpeg($image, null, 90);
277 277
 			case 'image/png':
278
-				header( 'Content-Type: image/png' );
279
-				return imagepng( $image );
278
+				header('Content-Type: image/png');
279
+				return imagepng($image);
280 280
 			case 'image/gif':
281
-				header( 'Content-Type: image/gif' );
282
-				return imagegif( $image );
281
+				header('Content-Type: image/gif');
282
+				return imagegif($image);
283 283
 			default:
284 284
 				return false;
285 285
 		}
@@ -295,11 +295,11 @@  discard block
 block discarded – undo
295 295
  * @param int $post_id
296 296
  * @return bool
297 297
  */
298
-function wp_save_image_file( $filename, $image, $mime_type, $post_id ) {
299
-	if ( $image instanceof WP_Image_Editor ) {
298
+function wp_save_image_file($filename, $image, $mime_type, $post_id) {
299
+	if ($image instanceof WP_Image_Editor) {
300 300
 
301 301
 		/** This filter is documented in wp-admin/includes/image-edit.php */
302
-		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
302
+		$image = apply_filters('image_editor_save_pre', $image, $post_id);
303 303
 
304 304
 		/**
305 305
 		 * Filter whether to skip saving the image file.
@@ -315,17 +315,17 @@  discard block
 block discarded – undo
315 315
 		 * @param string          $mime_type Image mime type.
316 316
 		 * @param int             $post_id   Post ID.
317 317
 		 */
318
-		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
318
+		$saved = apply_filters('wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id);
319 319
 
320
-		if ( null !== $saved )
320
+		if (null !== $saved)
321 321
 			return $saved;
322 322
 
323
-		return $image->save( $filename, $mime_type );
323
+		return $image->save($filename, $mime_type);
324 324
 	} else {
325
-		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
325
+		_deprecated_argument(__FUNCTION__, '3.5', __('$image needs to be an WP_Image_Editor object'));
326 326
 
327 327
 		/** This filter is documented in wp-admin/includes/image-edit.php */
328
-		$image = apply_filters( 'image_save_pre', $image, $post_id );
328
+		$image = apply_filters('image_save_pre', $image, $post_id);
329 329
 
330 330
 		/**
331 331
 		 * Filter whether to skip saving the image file.
@@ -342,20 +342,20 @@  discard block
 block discarded – undo
342 342
 		 * @param string          $mime_type Image mime type.
343 343
 		 * @param int             $post_id   Post ID.
344 344
 		 */
345
-		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
345
+		$saved = apply_filters('wp_save_image_file', null, $filename, $image, $mime_type, $post_id);
346 346
 
347
-		if ( null !== $saved )
347
+		if (null !== $saved)
348 348
 			return $saved;
349 349
 
350
-		switch ( $mime_type ) {
350
+		switch ($mime_type) {
351 351
 			case 'image/jpeg':
352 352
 
353 353
 				/** This filter is documented in wp-includes/class-wp-image-editor.php */
354
-				return imagejpeg( $image, $filename, apply_filters( 'jpeg_quality', 90, 'edit_image' ) );
354
+				return imagejpeg($image, $filename, apply_filters('jpeg_quality', 90, 'edit_image'));
355 355
 			case 'image/png':
356
-				return imagepng( $image, $filename );
356
+				return imagepng($image, $filename);
357 357
 			case 'image/gif':
358
-				return imagegif( $image, $filename );
358
+				return imagegif($image, $filename);
359 359
 			default:
360 360
 				return false;
361 361
 		}
@@ -388,10 +388,10 @@  discard block
 block discarded – undo
388 388
  * @return resource|false GD image resource, false otherwise.
389 389
  */
390 390
 function _rotate_image_resource($img, $angle) {
391
-	_deprecated_function( __FUNCTION__, '3.5', __( 'Use WP_Image_Editor::rotate' ) );
392
-	if ( function_exists('imagerotate') ) {
391
+	_deprecated_function(__FUNCTION__, '3.5', __('Use WP_Image_Editor::rotate'));
392
+	if (function_exists('imagerotate')) {
393 393
 		$rotated = imagerotate($img, $angle, 0);
394
-		if ( is_resource($rotated) ) {
394
+		if (is_resource($rotated)) {
395 395
 			imagedestroy($img);
396 396
 			$img = $rotated;
397 397
 		}
@@ -411,17 +411,17 @@  discard block
 block discarded – undo
411 411
  * @return resource (maybe) flipped image resource.
412 412
  */
413 413
 function _flip_image_resource($img, $horz, $vert) {
414
-	_deprecated_function( __FUNCTION__, '3.5', __( 'Use WP_Image_Editor::flip' ) );
414
+	_deprecated_function(__FUNCTION__, '3.5', __('Use WP_Image_Editor::flip'));
415 415
 	$w = imagesx($img);
416 416
 	$h = imagesy($img);
417 417
 	$dst = wp_imagecreatetruecolor($w, $h);
418
-	if ( is_resource($dst) ) {
418
+	if (is_resource($dst)) {
419 419
 		$sx = $vert ? ($w - 1) : 0;
420 420
 		$sy = $horz ? ($h - 1) : 0;
421 421
 		$sw = $vert ? -$w : $w;
422 422
 		$sh = $horz ? -$h : $h;
423 423
 
424
-		if ( imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh) ) {
424
+		if (imagecopyresampled($dst, $img, 0, 0, $sx, $sy, $w, $h, $sw, $sh)) {
425 425
 			imagedestroy($img);
426 426
 			$img = $dst;
427 427
 		}
@@ -444,8 +444,8 @@  discard block
 block discarded – undo
444 444
  */
445 445
 function _crop_image_resource($img, $x, $y, $w, $h) {
446 446
 	$dst = wp_imagecreatetruecolor($w, $h);
447
-	if ( is_resource($dst) ) {
448
-		if ( imagecopy($dst, $img, 0, 0, $x, $y, $w, $h) ) {
447
+	if (is_resource($dst)) {
448
+		if (imagecopy($dst, $img, 0, 0, $x, $y, $w, $h)) {
449 449
 			imagedestroy($img);
450 450
 			$img = $dst;
451 451
 		}
@@ -462,24 +462,24 @@  discard block
 block discarded – undo
462 462
  * @param array           $changes Array of change operations.
463 463
  * @return WP_Image_Editor {@see WP_Image_Editor} instance with changes applied.
464 464
  */
465
-function image_edit_apply_changes( $image, $changes ) {
466
-	if ( is_resource( $image ) )
467
-		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
465
+function image_edit_apply_changes($image, $changes) {
466
+	if (is_resource($image))
467
+		_deprecated_argument(__FUNCTION__, '3.5', __('$image needs to be an WP_Image_Editor object'));
468 468
 
469
-	if ( !is_array($changes) )
469
+	if ( ! is_array($changes))
470 470
 		return $image;
471 471
 
472 472
 	// Expand change operations.
473
-	foreach ( $changes as $key => $obj ) {
474
-		if ( isset($obj->r) ) {
473
+	foreach ($changes as $key => $obj) {
474
+		if (isset($obj->r)) {
475 475
 			$obj->type = 'rotate';
476 476
 			$obj->angle = $obj->r;
477 477
 			unset($obj->r);
478
-		} elseif ( isset($obj->f) ) {
478
+		} elseif (isset($obj->f)) {
479 479
 			$obj->type = 'flip';
480 480
 			$obj->axis = $obj->f;
481 481
 			unset($obj->f);
482
-		} elseif ( isset($obj->c) ) {
482
+		} elseif (isset($obj->c)) {
483 483
 			$obj->type = 'crop';
484 484
 			$obj->sel = $obj->c;
485 485
 			unset($obj->c);
@@ -488,12 +488,12 @@  discard block
 block discarded – undo
488 488
 	}
489 489
 
490 490
 	// Combine operations.
491
-	if ( count($changes) > 1 ) {
491
+	if (count($changes) > 1) {
492 492
 		$filtered = array($changes[0]);
493
-		for ( $i = 0, $j = 1, $c = count( $changes ); $j < $c; $j++ ) {
493
+		for ($i = 0, $j = 1, $c = count($changes); $j < $c; $j++) {
494 494
 			$combined = false;
495
-			if ( $filtered[$i]->type == $changes[$j]->type ) {
496
-				switch ( $filtered[$i]->type ) {
495
+			if ($filtered[$i]->type == $changes[$j]->type) {
496
+				switch ($filtered[$i]->type) {
497 497
 					case 'rotate':
498 498
 						$filtered[$i]->angle += $changes[$j]->angle;
499 499
 						$combined = true;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 						break;
505 505
 				}
506 506
 			}
507
-			if ( !$combined )
507
+			if ( ! $combined)
508 508
 				$filtered[++$i] = $changes[$j];
509 509
 		}
510 510
 		$changes = $filtered;
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
 	}
513 513
 
514 514
 	// Image resource before applying the changes.
515
-	if ( $image instanceof WP_Image_Editor ) {
515
+	if ($image instanceof WP_Image_Editor) {
516 516
 
517 517
 		/**
518 518
 		 * Filter the WP_Image_Editor instance before applying changes to the image.
@@ -522,8 +522,8 @@  discard block
 block discarded – undo
522 522
 		 * @param WP_Image_Editor $image   WP_Image_Editor instance.
523 523
  		 * @param array           $changes Array of change operations.
524 524
 		 */
525
-		$image = apply_filters( 'wp_image_editor_before_change', $image, $changes );
526
-	} elseif ( is_resource( $image ) ) {
525
+		$image = apply_filters('wp_image_editor_before_change', $image, $changes);
526
+	} elseif (is_resource($image)) {
527 527
 
528 528
 		/**
529 529
 		 * Filter the GD image resource before applying changes to the image.
@@ -534,39 +534,39 @@  discard block
 block discarded – undo
534 534
 		 * @param resource $image   GD image resource.
535 535
  		 * @param array    $changes Array of change operations.
536 536
 		 */
537
-		$image = apply_filters( 'image_edit_before_change', $image, $changes );
537
+		$image = apply_filters('image_edit_before_change', $image, $changes);
538 538
 	}
539 539
 
540
-	foreach ( $changes as $operation ) {
541
-		switch ( $operation->type ) {
540
+	foreach ($changes as $operation) {
541
+		switch ($operation->type) {
542 542
 			case 'rotate':
543
-				if ( $operation->angle != 0 ) {
544
-					if ( $image instanceof WP_Image_Editor )
545
-						$image->rotate( $operation->angle );
543
+				if ($operation->angle != 0) {
544
+					if ($image instanceof WP_Image_Editor)
545
+						$image->rotate($operation->angle);
546 546
 					else
547
-						$image = _rotate_image_resource( $image, $operation->angle );
547
+						$image = _rotate_image_resource($image, $operation->angle);
548 548
 				}
549 549
 				break;
550 550
 			case 'flip':
551
-				if ( $operation->axis != 0 )
552
-					if ( $image instanceof WP_Image_Editor )
553
-						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
551
+				if ($operation->axis != 0)
552
+					if ($image instanceof WP_Image_Editor)
553
+						$image->flip(($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
554 554
 					else
555
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
555
+						$image = _flip_image_resource($image, ($operation->axis & 1) != 0, ($operation->axis & 2) != 0);
556 556
 				break;
557 557
 			case 'crop':
558 558
 				$sel = $operation->sel;
559 559
 
560
-				if ( $image instanceof WP_Image_Editor ) {
560
+				if ($image instanceof WP_Image_Editor) {
561 561
 					$size = $image->get_size();
562 562
 					$w = $size['width'];
563 563
 					$h = $size['height'];
564 564
 
565
-					$scale = 1 / _image_get_preview_ratio( $w, $h ); // discard preview scaling
566
-					$image->crop( $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
565
+					$scale = 1 / _image_get_preview_ratio($w, $h); // discard preview scaling
566
+					$image->crop($sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
567 567
 				} else {
568
-					$scale = 1 / _image_get_preview_ratio( imagesx( $image ), imagesy( $image ) ); // discard preview scaling
569
-					$image = _crop_image_resource( $image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale );
568
+					$scale = 1 / _image_get_preview_ratio(imagesx($image), imagesy($image)); // discard preview scaling
569
+					$image = _crop_image_resource($image, $sel->x * $scale, $sel->y * $scale, $sel->w * $scale, $sel->h * $scale);
570 570
 				}
571 571
 				break;
572 572
 		}
@@ -583,35 +583,35 @@  discard block
 block discarded – undo
583 583
  * @param int $post_id
584 584
  * @return bool
585 585
  */
586
-function stream_preview_image( $post_id ) {
587
-	$post = get_post( $post_id );
586
+function stream_preview_image($post_id) {
587
+	$post = get_post($post_id);
588 588
 
589 589
 	/** This filter is documented in wp-admin/admin.php */
590
-	@ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', WP_MAX_MEMORY_LIMIT ) );
590
+	@ini_set('memory_limit', apply_filters('admin_memory_limit', WP_MAX_MEMORY_LIMIT));
591 591
 
592
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
592
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id));
593 593
 
594
-	if ( is_wp_error( $img ) ) {
594
+	if (is_wp_error($img)) {
595 595
 		return false;
596 596
 	}
597 597
 
598
-	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
599
-	if ( $changes )
600
-		$img = image_edit_apply_changes( $img, $changes );
598
+	$changes = ! empty($_REQUEST['history']) ? json_decode(wp_unslash($_REQUEST['history'])) : null;
599
+	if ($changes)
600
+		$img = image_edit_apply_changes($img, $changes);
601 601
 
602 602
 	// Scale the image.
603 603
 	$size = $img->get_size();
604 604
 	$w = $size['width'];
605 605
 	$h = $size['height'];
606 606
 
607
-	$ratio = _image_get_preview_ratio( $w, $h );
608
-	$w2 = max ( 1, $w * $ratio );
609
-	$h2 = max ( 1, $h * $ratio );
607
+	$ratio = _image_get_preview_ratio($w, $h);
608
+	$w2 = max(1, $w * $ratio);
609
+	$h2 = max(1, $h * $ratio);
610 610
 
611
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
611
+	if (is_wp_error($img->resize($w2, $h2)))
612 612
 		return false;
613 613
 
614
-	return wp_stream_image( $img, $post->post_mime_type, $post_id );
614
+	return wp_stream_image($img, $post->post_mime_type, $post_id);
615 615
 }
616 616
 
617 617
 /**
@@ -625,30 +625,30 @@  discard block
 block discarded – undo
625 625
 function wp_restore_image($post_id) {
626 626
 	$meta = wp_get_attachment_metadata($post_id);
627 627
 	$file = get_attached_file($post_id);
628
-	$backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
628
+	$backup_sizes = $old_backup_sizes = get_post_meta($post_id, '_wp_attachment_backup_sizes', true);
629 629
 	$restored = false;
630 630
 	$msg = new stdClass;
631 631
 
632
-	if ( !is_array($backup_sizes) ) {
632
+	if ( ! is_array($backup_sizes)) {
633 633
 		$msg->error = __('Cannot load image metadata.');
634 634
 		return $msg;
635 635
 	}
636 636
 
637 637
 	$parts = pathinfo($file);
638
-	$suffix = time() . rand(100, 999);
638
+	$suffix = time().rand(100, 999);
639 639
 	$default_sizes = get_intermediate_image_sizes();
640 640
 
641
-	if ( isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig']) ) {
641
+	if (isset($backup_sizes['full-orig']) && is_array($backup_sizes['full-orig'])) {
642 642
 		$data = $backup_sizes['full-orig'];
643 643
 
644
-		if ( $parts['basename'] != $data['file'] ) {
645
-			if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
644
+		if ($parts['basename'] != $data['file']) {
645
+			if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
646 646
 
647 647
 				// Delete only if it's an edited image.
648
-				if ( preg_match('/-e[0-9]{13}\./', $parts['basename']) ) {
649
-					wp_delete_file( $file );
648
+				if (preg_match('/-e[0-9]{13}\./', $parts['basename'])) {
649
+					wp_delete_file($file);
650 650
 				}
651
-			} elseif ( isset( $meta['width'], $meta['height'] ) ) {
651
+			} elseif (isset($meta['width'], $meta['height'])) {
652 652
 				$backup_sizes["full-$suffix"] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $parts['basename']);
653 653
 			}
654 654
 		}
@@ -656,21 +656,21 @@  discard block
 block discarded – undo
656 656
 		$restored_file = path_join($parts['dirname'], $data['file']);
657 657
 		$restored = update_attached_file($post_id, $restored_file);
658 658
 
659
-		$meta['file'] = _wp_relative_upload_path( $restored_file );
659
+		$meta['file'] = _wp_relative_upload_path($restored_file);
660 660
 		$meta['width'] = $data['width'];
661 661
 		$meta['height'] = $data['height'];
662 662
 	}
663 663
 
664
-	foreach ( $default_sizes as $default_size ) {
665
-		if ( isset($backup_sizes["$default_size-orig"]) ) {
664
+	foreach ($default_sizes as $default_size) {
665
+		if (isset($backup_sizes["$default_size-orig"])) {
666 666
 			$data = $backup_sizes["$default_size-orig"];
667
-			if ( isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file'] ) {
668
-				if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE ) {
667
+			if (isset($meta['sizes'][$default_size]) && $meta['sizes'][$default_size]['file'] != $data['file']) {
668
+				if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE) {
669 669
 
670 670
 					// Delete only if it's an edited image.
671
-					if ( preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file']) ) {
672
-						$delete_file = path_join( $parts['dirname'], $meta['sizes'][$default_size]['file'] );
673
-						wp_delete_file( $delete_file );
671
+					if (preg_match('/-e[0-9]{13}-/', $meta['sizes'][$default_size]['file'])) {
672
+						$delete_file = path_join($parts['dirname'], $meta['sizes'][$default_size]['file']);
673
+						wp_delete_file($delete_file);
674 674
 					}
675 675
 				} else {
676 676
 					$backup_sizes["$default_size-{$suffix}"] = $meta['sizes'][$default_size];
@@ -683,14 +683,14 @@  discard block
 block discarded – undo
683 683
 		}
684 684
 	}
685 685
 
686
-	if ( ! wp_update_attachment_metadata( $post_id, $meta ) ||
687
-		( $old_backup_sizes !== $backup_sizes && ! update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes ) ) ) {
686
+	if ( ! wp_update_attachment_metadata($post_id, $meta) ||
687
+		($old_backup_sizes !== $backup_sizes && ! update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes))) {
688 688
 
689 689
 		$msg->error = __('Cannot save image metadata.');
690 690
 		return $msg;
691 691
 	}
692 692
 
693
-	if ( !$restored )
693
+	if ( ! $restored)
694 694
 		$msg->error = __('Image metadata is inconsistent.');
695 695
 	else
696 696
 		$msg->msg = __('Image restored successfully.');
@@ -707,25 +707,25 @@  discard block
 block discarded – undo
707 707
  * @param int $post_id
708 708
  * @return \stdClass
709 709
  */
710
-function wp_save_image( $post_id ) {
710
+function wp_save_image($post_id) {
711 711
 	global $_wp_additional_image_sizes;
712 712
 
713 713
 	$return = new stdClass;
714 714
 	$success = $delete = $scaled = $nocrop = false;
715
-	$post = get_post( $post_id );
715
+	$post = get_post($post_id);
716 716
 
717
-	$img = wp_get_image_editor( _load_image_to_edit_path( $post_id, 'full' ) );
718
-	if ( is_wp_error( $img ) ) {
719
-		$return->error = esc_js( __('Unable to create new image.') );
717
+	$img = wp_get_image_editor(_load_image_to_edit_path($post_id, 'full'));
718
+	if (is_wp_error($img)) {
719
+		$return->error = esc_js(__('Unable to create new image.'));
720 720
 		return $return;
721 721
 	}
722 722
 
723
-	$fwidth = !empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
724
-	$fheight = !empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
725
-	$target = !empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
726
-	$scale = !empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
723
+	$fwidth = ! empty($_REQUEST['fwidth']) ? intval($_REQUEST['fwidth']) : 0;
724
+	$fheight = ! empty($_REQUEST['fheight']) ? intval($_REQUEST['fheight']) : 0;
725
+	$target = ! empty($_REQUEST['target']) ? preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['target']) : '';
726
+	$scale = ! empty($_REQUEST['do']) && 'scale' == $_REQUEST['do'];
727 727
 
728
-	if ( $scale && $fwidth > 0 && $fheight > 0 ) {
728
+	if ($scale && $fwidth > 0 && $fheight > 0) {
729 729
 		$size = $img->get_size();
730 730
 		$sX = $size['width'];
731 731
 		$sY = $size['height'];
@@ -734,54 +734,54 @@  discard block
 block discarded – undo
734 734
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
735 735
 		if ( -0.1 < $diff && $diff < 0.1 ) {
736 736
 			// Scale the full size image.
737
-			if ( $img->resize( $fwidth, $fheight ) )
737
+			if ($img->resize($fwidth, $fheight))
738 738
 				$scaled = true;
739 739
 		}
740 740
 
741
-		if ( !$scaled ) {
742
-			$return->error = esc_js( __('Error while saving the scaled image. Please reload the page and try again.') );
741
+		if ( ! $scaled) {
742
+			$return->error = esc_js(__('Error while saving the scaled image. Please reload the page and try again.'));
743 743
 			return $return;
744 744
 		}
745
-	} elseif ( !empty($_REQUEST['history']) ) {
746
-		$changes = json_decode( wp_unslash($_REQUEST['history']) );
747
-		if ( $changes )
745
+	} elseif ( ! empty($_REQUEST['history'])) {
746
+		$changes = json_decode(wp_unslash($_REQUEST['history']));
747
+		if ($changes)
748 748
 			$img = image_edit_apply_changes($img, $changes);
749 749
 	} else {
750
-		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
750
+		$return->error = esc_js(__('Nothing to save, the image has not changed.'));
751 751
 		return $return;
752 752
 	}
753 753
 
754 754
 	$meta = wp_get_attachment_metadata($post_id);
755
-	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
755
+	$backup_sizes = get_post_meta($post->ID, '_wp_attachment_backup_sizes', true);
756 756
 
757
-	if ( !is_array($meta) ) {
758
-		$return->error = esc_js( __('Image data does not exist. Please re-upload the image.') );
757
+	if ( ! is_array($meta)) {
758
+		$return->error = esc_js(__('Image data does not exist. Please re-upload the image.'));
759 759
 		return $return;
760 760
 	}
761 761
 
762
-	if ( !is_array($backup_sizes) )
762
+	if ( ! is_array($backup_sizes))
763 763
 		$backup_sizes = array();
764 764
 
765 765
 	// Generate new filename.
766 766
 	$path = get_attached_file($post_id);
767
-	$path_parts = pathinfo( $path );
767
+	$path_parts = pathinfo($path);
768 768
 	$filename = $path_parts['filename'];
769
-	$suffix = time() . rand(100, 999);
769
+	$suffix = time().rand(100, 999);
770 770
 
771
-	if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
772
-		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
771
+	if (defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
772
+		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename']) {
773 773
 
774
-		if ( 'thumbnail' == $target )
774
+		if ('thumbnail' == $target)
775 775
 			$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
776 776
 		else
777 777
 			$new_path = $path;
778 778
 	} else {
779
-		while( true ) {
780
-			$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
779
+		while (true) {
780
+			$filename = preg_replace('/-e([0-9]+)$/', '', $filename);
781 781
 			$filename .= "-e{$suffix}";
782 782
 			$new_filename = "{$filename}.{$path_parts['extension']}";
783 783
 			$new_path = "{$path_parts['dirname']}/$new_filename";
784
-			if ( file_exists($new_path) )
784
+			if (file_exists($new_path))
785 785
 				$suffix++;
786 786
 			else
787 787
 				break;
@@ -789,92 +789,92 @@  discard block
 block discarded – undo
789 789
 	}
790 790
 
791 791
 	// Save the full-size file, also needed to create sub-sizes.
792
-	if ( !wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id) ) {
793
-		$return->error = esc_js( __('Unable to save the image.') );
792
+	if ( ! wp_save_image_file($new_path, $img, $post->post_mime_type, $post_id)) {
793
+		$return->error = esc_js(__('Unable to save the image.'));
794 794
 		return $return;
795 795
 	}
796 796
 
797
-	if ( 'nothumb' == $target || 'all' == $target || 'full' == $target || $scaled ) {
797
+	if ('nothumb' == $target || 'all' == $target || 'full' == $target || $scaled) {
798 798
 		$tag = false;
799
-		if ( isset($backup_sizes['full-orig']) ) {
800
-			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] )
799
+		if (isset($backup_sizes['full-orig'])) {
800
+			if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes['full-orig']['file'] != $path_parts['basename'])
801 801
 				$tag = "full-$suffix";
802 802
 		} else {
803 803
 			$tag = 'full-orig';
804 804
 		}
805 805
 
806
-		if ( $tag )
806
+		if ($tag)
807 807
 			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
808 808
 
809
-		$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
809
+		$success = ($path === $new_path) || update_attached_file($post_id, $new_path);
810 810
 
811
-		$meta['file'] = _wp_relative_upload_path( $new_path );
811
+		$meta['file'] = _wp_relative_upload_path($new_path);
812 812
 
813 813
 		$size = $img->get_size();
814 814
 		$meta['width'] = $size['width'];
815 815
 		$meta['height'] = $size['height'];
816 816
 
817
-		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
817
+		if ($success && ('nothumb' == $target || 'all' == $target)) {
818 818
 			$sizes = get_intermediate_image_sizes();
819
-			if ( 'nothumb' == $target )
820
-				$sizes = array_diff( $sizes, array('thumbnail') );
819
+			if ('nothumb' == $target)
820
+				$sizes = array_diff($sizes, array('thumbnail'));
821 821
 		}
822 822
 
823 823
 		$return->fw = $meta['width'];
824 824
 		$return->fh = $meta['height'];
825
-	} elseif ( 'thumbnail' == $target ) {
826
-		$sizes = array( 'thumbnail' );
825
+	} elseif ('thumbnail' == $target) {
826
+		$sizes = array('thumbnail');
827 827
 		$success = $delete = $nocrop = true;
828 828
 	}
829 829
 
830
-	if ( isset( $sizes ) ) {
830
+	if (isset($sizes)) {
831 831
 		$_sizes = array();
832 832
 
833
-		foreach ( $sizes as $size ) {
833
+		foreach ($sizes as $size) {
834 834
 			$tag = false;
835
-			if ( isset( $meta['sizes'][$size] ) ) {
836
-				if ( isset($backup_sizes["$size-orig"]) ) {
837
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
835
+			if (isset($meta['sizes'][$size])) {
836
+				if (isset($backup_sizes["$size-orig"])) {
837
+					if (( ! defined('IMAGE_EDIT_OVERWRITE') || ! IMAGE_EDIT_OVERWRITE) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'])
838 838
 						$tag = "$size-$suffix";
839 839
 				} else {
840 840
 					$tag = "$size-orig";
841 841
 				}
842 842
 
843
-				if ( $tag )
843
+				if ($tag)
844 844
 					$backup_sizes[$tag] = $meta['sizes'][$size];
845 845
 			}
846 846
 
847
-			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
848
-				$width  = intval( $_wp_additional_image_sizes[ $size ]['width'] );
849
-				$height = intval( $_wp_additional_image_sizes[ $size ]['height'] );
850
-				$crop   = ( $nocrop ) ? false : $_wp_additional_image_sizes[ $size ]['crop'];
847
+			if (isset($_wp_additional_image_sizes[$size])) {
848
+				$width  = intval($_wp_additional_image_sizes[$size]['width']);
849
+				$height = intval($_wp_additional_image_sizes[$size]['height']);
850
+				$crop   = ($nocrop) ? false : $_wp_additional_image_sizes[$size]['crop'];
851 851
 			} else {
852
-				$height = get_option( "{$size}_size_h" );
853
-				$width  = get_option( "{$size}_size_w" );
854
-				$crop   = ( $nocrop ) ? false : get_option( "{$size}_crop" );
852
+				$height = get_option("{$size}_size_h");
853
+				$width  = get_option("{$size}_size_w");
854
+				$crop   = ($nocrop) ? false : get_option("{$size}_crop");
855 855
 			}
856 856
 
857
-			$_sizes[ $size ] = array( 'width' => $width, 'height' => $height, 'crop' => $crop );
857
+			$_sizes[$size] = array('width' => $width, 'height' => $height, 'crop' => $crop);
858 858
 		}
859 859
 
860
-		$meta['sizes'] = array_merge( $meta['sizes'], $img->multi_resize( $_sizes ) );
860
+		$meta['sizes'] = array_merge($meta['sizes'], $img->multi_resize($_sizes));
861 861
 	}
862 862
 
863
-	unset( $img );
863
+	unset($img);
864 864
 
865
-	if ( $success ) {
866
-		wp_update_attachment_metadata( $post_id, $meta );
867
-		update_post_meta( $post_id, '_wp_attachment_backup_sizes', $backup_sizes);
865
+	if ($success) {
866
+		wp_update_attachment_metadata($post_id, $meta);
867
+		update_post_meta($post_id, '_wp_attachment_backup_sizes', $backup_sizes);
868 868
 
869
-		if ( $target == 'thumbnail' || $target == 'all' || $target == 'full' ) {
869
+		if ($target == 'thumbnail' || $target == 'all' || $target == 'full') {
870 870
 			// Check if it's an image edit from attachment edit screen
871
-			if ( ! empty( $_REQUEST['context'] ) && 'edit-attachment' == $_REQUEST['context'] ) {
872
-				$thumb_url = wp_get_attachment_image_src( $post_id, array( 900, 600 ), true );
871
+			if ( ! empty($_REQUEST['context']) && 'edit-attachment' == $_REQUEST['context']) {
872
+				$thumb_url = wp_get_attachment_image_src($post_id, array(900, 600), true);
873 873
 				$return->thumbnail = $thumb_url[0];
874 874
 			} else {
875 875
 				$file_url = wp_get_attachment_url($post_id);
876
-				if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) {
877
-					$return->thumbnail = path_join( dirname($file_url), $thumb['file'] );
876
+				if ( ! empty($meta['sizes']['thumbnail']) && $thumb = $meta['sizes']['thumbnail']) {
877
+					$return->thumbnail = path_join(dirname($file_url), $thumb['file']);
878 878
 				} else {
879 879
 					$return->thumbnail = "$file_url?w=128&h=128";
880 880
 				}
@@ -884,10 +884,10 @@  discard block
 block discarded – undo
884 884
 		$delete = true;
885 885
 	}
886 886
 
887
-	if ( $delete ) {
888
-		wp_delete_file( $new_path );
887
+	if ($delete) {
888
+		wp_delete_file($new_path);
889 889
 	}
890 890
 
891
-	$return->msg = esc_js( __('Image saved') );
891
+	$return->msg = esc_js(__('Image saved'));
892 892
 	return $return;
893 893
 }
Please login to merge, or discard this patch.
Braces   +89 added lines, -64 removed lines patch added patch discarded remove patch
@@ -20,23 +20,26 @@  discard block
 block discarded – undo
20 20
 	$sub_sizes = isset($meta['sizes']) && is_array($meta['sizes']);
21 21
 	$note = '';
22 22
 
23
-	if ( isset( $meta['width'], $meta['height'] ) )
24
-		$big = max( $meta['width'], $meta['height'] );
25
-	else
26
-		die( __('Image data does not exist. Please re-upload the image.') );
23
+	if ( isset( $meta['width'], $meta['height'] ) ) {
24
+			$big = max( $meta['width'], $meta['height'] );
25
+	} else {
26
+			die( __('Image data does not exist. Please re-upload the image.') );
27
+	}
27 28
 
28 29
 	$sizer = $big > 400 ? 400 / $big : 1;
29 30
 
30 31
 	$backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true );
31 32
 	$can_restore = false;
32
-	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) )
33
-		$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
33
+	if ( ! empty( $backup_sizes ) && isset( $backup_sizes['full-orig'], $meta['file'] ) ) {
34
+			$can_restore = $backup_sizes['full-orig']['file'] != basename( $meta['file'] );
35
+	}
34 36
 
35 37
 	if ( $msg ) {
36
-		if ( isset($msg->error) )
37
-			$note = "<div class='error'><p>$msg->error</p></div>";
38
-		elseif ( isset($msg->msg) )
39
-			$note = "<div class='updated'><p>$msg->msg</p></div>";
38
+		if ( isset($msg->error) ) {
39
+					$note = "<div class='error'><p>$msg->error</p></div>";
40
+		} elseif ( isset($msg->msg) ) {
41
+					$note = "<div class='updated'><p>$msg->msg</p></div>";
42
+		}
40 43
 	}
41 44
 
42 45
 	?>
@@ -83,8 +86,9 @@  discard block
 block discarded – undo
83 86
 		<div class="imgedit-help">
84 87
 		<p><?php _e('Discard any changes and restore the original image.');
85 88
 
86
-		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE )
87
-			echo ' '.__('Previously edited copies of the image will not be deleted.');
89
+		if ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) {
90
+					echo ' '.__('Previously edited copies of the image will not be deleted.');
91
+		}
88 92
 
89 93
 		?></p>
90 94
 		<div class="imgedit-submit">
@@ -252,8 +256,9 @@  discard block
 block discarded – undo
252 256
 		 */
253 257
 		$image = apply_filters( 'image_editor_save_pre', $image, $post_id );
254 258
 
255
-		if ( is_wp_error( $image->stream( $mime_type ) ) )
256
-			return false;
259
+		if ( is_wp_error( $image->stream( $mime_type ) ) ) {
260
+					return false;
261
+		}
257 262
 
258 263
 		return true;
259 264
 	} else {
@@ -317,8 +322,9 @@  discard block
 block discarded – undo
317 322
 		 */
318 323
 		$saved = apply_filters( 'wp_save_image_editor_file', null, $filename, $image, $mime_type, $post_id );
319 324
 
320
-		if ( null !== $saved )
321
-			return $saved;
325
+		if ( null !== $saved ) {
326
+					return $saved;
327
+		}
322 328
 
323 329
 		return $image->save( $filename, $mime_type );
324 330
 	} else {
@@ -344,8 +350,9 @@  discard block
 block discarded – undo
344 350
 		 */
345 351
 		$saved = apply_filters( 'wp_save_image_file', null, $filename, $image, $mime_type, $post_id );
346 352
 
347
-		if ( null !== $saved )
348
-			return $saved;
353
+		if ( null !== $saved ) {
354
+					return $saved;
355
+		}
349 356
 
350 357
 		switch ( $mime_type ) {
351 358
 			case 'image/jpeg':
@@ -463,11 +470,13 @@  discard block
 block discarded – undo
463 470
  * @return WP_Image_Editor {@see WP_Image_Editor} instance with changes applied.
464 471
  */
465 472
 function image_edit_apply_changes( $image, $changes ) {
466
-	if ( is_resource( $image ) )
467
-		_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
473
+	if ( is_resource( $image ) ) {
474
+			_deprecated_argument( __FUNCTION__, '3.5', __( '$image needs to be an WP_Image_Editor object' ) );
475
+	}
468 476
 
469
-	if ( !is_array($changes) )
470
-		return $image;
477
+	if ( !is_array($changes) ) {
478
+			return $image;
479
+	}
471 480
 
472 481
 	// Expand change operations.
473 482
 	foreach ( $changes as $key => $obj ) {
@@ -504,8 +513,9 @@  discard block
 block discarded – undo
504 513
 						break;
505 514
 				}
506 515
 			}
507
-			if ( !$combined )
508
-				$filtered[++$i] = $changes[$j];
516
+			if ( !$combined ) {
517
+							$filtered[++$i] = $changes[$j];
518
+			}
509 519
 		}
510 520
 		$changes = $filtered;
511 521
 		unset($filtered);
@@ -541,18 +551,20 @@  discard block
 block discarded – undo
541 551
 		switch ( $operation->type ) {
542 552
 			case 'rotate':
543 553
 				if ( $operation->angle != 0 ) {
544
-					if ( $image instanceof WP_Image_Editor )
545
-						$image->rotate( $operation->angle );
546
-					else
547
-						$image = _rotate_image_resource( $image, $operation->angle );
554
+					if ( $image instanceof WP_Image_Editor ) {
555
+											$image->rotate( $operation->angle );
556
+					} else {
557
+											$image = _rotate_image_resource( $image, $operation->angle );
558
+					}
548 559
 				}
549 560
 				break;
550 561
 			case 'flip':
551
-				if ( $operation->axis != 0 )
552
-					if ( $image instanceof WP_Image_Editor )
562
+				if ( $operation->axis != 0 ) {
563
+									if ( $image instanceof WP_Image_Editor )
553 564
 						$image->flip( ($operation->axis & 1) != 0, ($operation->axis & 2) != 0 );
554
-					else
555
-						$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
565
+				} else {
566
+											$image = _flip_image_resource( $image, ( $operation->axis & 1 ) != 0, ( $operation->axis & 2 ) != 0 );
567
+					}
556 568
 				break;
557 569
 			case 'crop':
558 570
 				$sel = $operation->sel;
@@ -596,8 +608,9 @@  discard block
 block discarded – undo
596 608
 	}
597 609
 
598 610
 	$changes = !empty($_REQUEST['history']) ? json_decode( wp_unslash($_REQUEST['history']) ) : null;
599
-	if ( $changes )
600
-		$img = image_edit_apply_changes( $img, $changes );
611
+	if ( $changes ) {
612
+			$img = image_edit_apply_changes( $img, $changes );
613
+	}
601 614
 
602 615
 	// Scale the image.
603 616
 	$size = $img->get_size();
@@ -608,8 +621,9 @@  discard block
 block discarded – undo
608 621
 	$w2 = max ( 1, $w * $ratio );
609 622
 	$h2 = max ( 1, $h * $ratio );
610 623
 
611
-	if ( is_wp_error( $img->resize( $w2, $h2 ) ) )
612
-		return false;
624
+	if ( is_wp_error( $img->resize( $w2, $h2 ) ) ) {
625
+			return false;
626
+	}
613 627
 
614 628
 	return wp_stream_image( $img, $post->post_mime_type, $post_id );
615 629
 }
@@ -690,10 +704,11 @@  discard block
 block discarded – undo
690 704
 		return $msg;
691 705
 	}
692 706
 
693
-	if ( !$restored )
694
-		$msg->error = __('Image metadata is inconsistent.');
695
-	else
696
-		$msg->msg = __('Image restored successfully.');
707
+	if ( !$restored ) {
708
+			$msg->error = __('Image metadata is inconsistent.');
709
+	} else {
710
+			$msg->msg = __('Image restored successfully.');
711
+	}
697 712
 
698 713
 	return $msg;
699 714
 }
@@ -734,8 +749,9 @@  discard block
 block discarded – undo
734 749
 		$diff = round($sX / $sY, 2) - round($fwidth / $fheight, 2);
735 750
 		if ( -0.1 < $diff && $diff < 0.1 ) {
736 751
 			// Scale the full size image.
737
-			if ( $img->resize( $fwidth, $fheight ) )
738
-				$scaled = true;
752
+			if ( $img->resize( $fwidth, $fheight ) ) {
753
+							$scaled = true;
754
+			}
739 755
 		}
740 756
 
741 757
 		if ( !$scaled ) {
@@ -744,8 +760,9 @@  discard block
 block discarded – undo
744 760
 		}
745 761
 	} elseif ( !empty($_REQUEST['history']) ) {
746 762
 		$changes = json_decode( wp_unslash($_REQUEST['history']) );
747
-		if ( $changes )
748
-			$img = image_edit_apply_changes($img, $changes);
763
+		if ( $changes ) {
764
+					$img = image_edit_apply_changes($img, $changes);
765
+		}
749 766
 	} else {
750 767
 		$return->error = esc_js( __('Nothing to save, the image has not changed.') );
751 768
 		return $return;
@@ -759,8 +776,9 @@  discard block
 block discarded – undo
759 776
 		return $return;
760 777
 	}
761 778
 
762
-	if ( !is_array($backup_sizes) )
763
-		$backup_sizes = array();
779
+	if ( !is_array($backup_sizes) ) {
780
+			$backup_sizes = array();
781
+	}
764 782
 
765 783
 	// Generate new filename.
766 784
 	$path = get_attached_file($post_id);
@@ -771,20 +789,22 @@  discard block
 block discarded – undo
771 789
 	if ( defined('IMAGE_EDIT_OVERWRITE') && IMAGE_EDIT_OVERWRITE &&
772 790
 		isset($backup_sizes['full-orig']) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
773 791
 
774
-		if ( 'thumbnail' == $target )
775
-			$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
776
-		else
777
-			$new_path = $path;
792
+		if ( 'thumbnail' == $target ) {
793
+					$new_path = "{$path_parts['dirname']}/{$filename}-temp.{$path_parts['extension']}";
794
+		} else {
795
+					$new_path = $path;
796
+		}
778 797
 	} else {
779 798
 		while( true ) {
780 799
 			$filename = preg_replace( '/-e([0-9]+)$/', '', $filename );
781 800
 			$filename .= "-e{$suffix}";
782 801
 			$new_filename = "{$filename}.{$path_parts['extension']}";
783 802
 			$new_path = "{$path_parts['dirname']}/$new_filename";
784
-			if ( file_exists($new_path) )
785
-				$suffix++;
786
-			else
787
-				break;
803
+			if ( file_exists($new_path) ) {
804
+							$suffix++;
805
+			} else {
806
+							break;
807
+			}
788 808
 		}
789 809
 	}
790 810
 
@@ -797,14 +817,16 @@  discard block
 block discarded – undo
797 817
 	if ( 'nothumb' == $target || 'all' == $target || 'full' == $target || $scaled ) {
798 818
 		$tag = false;
799 819
 		if ( isset($backup_sizes['full-orig']) ) {
800
-			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] )
801
-				$tag = "full-$suffix";
820
+			if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes['full-orig']['file'] != $path_parts['basename'] ) {
821
+							$tag = "full-$suffix";
822
+			}
802 823
 		} else {
803 824
 			$tag = 'full-orig';
804 825
 		}
805 826
 
806
-		if ( $tag )
807
-			$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
827
+		if ( $tag ) {
828
+					$backup_sizes[$tag] = array('width' => $meta['width'], 'height' => $meta['height'], 'file' => $path_parts['basename']);
829
+		}
808 830
 
809 831
 		$success = ( $path === $new_path ) || update_attached_file( $post_id, $new_path );
810 832
 
@@ -816,8 +838,9 @@  discard block
 block discarded – undo
816 838
 
817 839
 		if ( $success && ('nothumb' == $target || 'all' == $target) ) {
818 840
 			$sizes = get_intermediate_image_sizes();
819
-			if ( 'nothumb' == $target )
820
-				$sizes = array_diff( $sizes, array('thumbnail') );
841
+			if ( 'nothumb' == $target ) {
842
+							$sizes = array_diff( $sizes, array('thumbnail') );
843
+			}
821 844
 		}
822 845
 
823 846
 		$return->fw = $meta['width'];
@@ -834,14 +857,16 @@  discard block
 block discarded – undo
834 857
 			$tag = false;
835 858
 			if ( isset( $meta['sizes'][$size] ) ) {
836 859
 				if ( isset($backup_sizes["$size-orig"]) ) {
837
-					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] )
838
-						$tag = "$size-$suffix";
860
+					if ( ( !defined('IMAGE_EDIT_OVERWRITE') || !IMAGE_EDIT_OVERWRITE ) && $backup_sizes["$size-orig"]['file'] != $meta['sizes'][$size]['file'] ) {
861
+											$tag = "$size-$suffix";
862
+					}
839 863
 				} else {
840 864
 					$tag = "$size-orig";
841 865
 				}
842 866
 
843
-				if ( $tag )
844
-					$backup_sizes[$tag] = $meta['sizes'][$size];
867
+				if ( $tag ) {
868
+									$backup_sizes[$tag] = $meta['sizes'][$size];
869
+				}
845 870
 			}
846 871
 
847 872
 			if ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
Please login to merge, or discard this patch.
src/wp-admin/includes/media.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2960,7 +2960,7 @@
 block discarded – undo
2960 2960
  * @since 3.6.0
2961 2961
  *
2962 2962
  * @param string $file Path to file.
2963
- * @return array|bool Returns array of metadata, if found.
2963
+ * @return string Returns array of metadata, if found.
2964 2964
  */
2965 2965
 function wp_read_video_metadata( $file ) {
2966 2966
 	if ( ! file_exists( $file ) )
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Administration Media API.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Administration Media API.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Defines the default media upload tabs
@@ -1901,11 +1901,11 @@  discard block
 block discarded – undo
1901 1901
 <div id="plupload-upload-ui" class="hide-if-no-js">
1902 1902
 <?php
1903 1903
 /**
1904
- * Fires before the upload interface loads.
1905
- *
1906
- * @since 2.6.0 As 'pre-flash-upload-ui'
1907
- * @since 3.3.0
1908
- */
1904
+	 * Fires before the upload interface loads.
1905
+	 *
1906
+	 * @since 2.6.0 As 'pre-flash-upload-ui'
1907
+	 * @since 3.3.0
1908
+	 */
1909 1909
 do_action( 'pre-plupload-upload-ui' ); ?>
1910 1910
 <div id="drag-drop-area">
1911 1911
 	<div class="drag-drop-inside">
@@ -1916,11 +1916,11 @@  discard block
 block discarded – undo
1916 1916
 </div>
1917 1917
 <?php
1918 1918
 /**
1919
- * Fires after the upload interface loads.
1920
- *
1921
- * @since 2.6.0 As 'post-flash-upload-ui'
1922
- * @since 3.3.0
1923
- */
1919
+	 * Fires after the upload interface loads.
1920
+	 *
1921
+	 * @since 2.6.0 As 'post-flash-upload-ui'
1922
+	 * @since 3.3.0
1923
+	 */
1924 1924
 do_action( 'post-plupload-upload-ui' ); ?>
1925 1925
 </div>
1926 1926
 
@@ -1942,10 +1942,10 @@  discard block
 block discarded – undo
1942 1942
 	<div class="clear"></div>
1943 1943
 <?php
1944 1944
 /**
1945
- * Fires after the upload button in the media upload interface.
1946
- *
1947
- * @since 2.6.0
1948
- */
1945
+	 * Fires after the upload button in the media upload interface.
1946
+	 *
1947
+	 * @since 2.6.0
1948
+	 */
1949 1949
 do_action( 'post-html-upload-ui' );
1950 1950
 ?>
1951 1951
 </div>
@@ -2161,12 +2161,12 @@  discard block
 block discarded – undo
2161 2161
 <div class="media-item media-blank">
2162 2162
 <?php
2163 2163
 /**
2164
- * Filter the insert media from URL form HTML.
2165
- *
2166
- * @since 3.3.0
2167
- *
2168
- * @param string $form_html The insert from URL form HTML.
2169
- */
2164
+		 * Filter the insert media from URL form HTML.
2165
+		 *
2166
+		 * @since 3.3.0
2167
+		 *
2168
+		 * @param string $form_html The insert from URL form HTML.
2169
+		 */
2170 2170
 echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
2171 2171
 ?>
2172 2172
 </div>
@@ -2414,14 +2414,14 @@  discard block
 block discarded – undo
2414 2414
 	$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
2415 2415
 }
2416 2416
 /**
2417
- * Filter the media upload mime type list items.
2418
- *
2419
- * Returned values should begin with an `<li>` tag.
2420
- *
2421
- * @since 3.1.0
2422
- *
2423
- * @param array $type_links An array of list items containing mime type link HTML.
2424
- */
2417
+	 * Filter the media upload mime type list items.
2418
+	 *
2419
+	 * Returned values should begin with an `<li>` tag.
2420
+	 *
2421
+	 * @since 3.1.0
2422
+	 *
2423
+	 * @param array $type_links An array of list items containing mime type link HTML.
2424
+	 */
2425 2425
 echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
2426 2426
 unset($type_links);
2427 2427
 ?>
Please login to merge, or discard this patch.
Spacing   +708 added lines, -708 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param array $_default_tabs An array of media tabs.
30 30
 	 */
31
-	return apply_filters( 'media_upload_tabs', $_default_tabs );
31
+	return apply_filters('media_upload_tabs', $_default_tabs);
32 32
 }
33 33
 
34 34
 /**
@@ -44,17 +44,17 @@  discard block
 block discarded – undo
44 44
 function update_gallery_tab($tabs) {
45 45
 	global $wpdb;
46 46
 
47
-	if ( !isset($_REQUEST['post_id']) ) {
47
+	if ( ! isset($_REQUEST['post_id'])) {
48 48
 		unset($tabs['gallery']);
49 49
 		return $tabs;
50 50
 	}
51 51
 
52 52
 	$post_id = intval($_REQUEST['post_id']);
53 53
 
54
-	if ( $post_id )
55
-		$attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) );
54
+	if ($post_id)
55
+		$attachments = intval($wpdb->get_var($wpdb->prepare("SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id)));
56 56
 
57
-	if ( empty($attachments) ) {
57
+	if (empty($attachments)) {
58 58
 		unset($tabs['gallery']);
59 59
 		return $tabs;
60 60
 	}
@@ -76,26 +76,26 @@  discard block
 block discarded – undo
76 76
 	$tabs = media_upload_tabs();
77 77
 	$default = 'type';
78 78
 
79
-	if ( !empty($tabs) ) {
79
+	if ( ! empty($tabs)) {
80 80
 		echo "<ul id='sidemenu'>\n";
81
-		if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) ) {
81
+		if (isset($redir_tab) && array_key_exists($redir_tab, $tabs)) {
82 82
 			$current = $redir_tab;
83
-		} elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) ) {
83
+		} elseif (isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs)) {
84 84
 			$current = $_GET['tab'];
85 85
 		} else {
86 86
 			/** This filter is documented in wp-admin/media-upload.php */
87
-			$current = apply_filters( 'media_upload_default_tab', $default );
87
+			$current = apply_filters('media_upload_default_tab', $default);
88 88
 		}
89 89
 
90
-		foreach ( $tabs as $callback => $text ) {
90
+		foreach ($tabs as $callback => $text) {
91 91
 			$class = '';
92 92
 
93
-			if ( $current == $callback )
93
+			if ($current == $callback)
94 94
 				$class = " class='current'";
95 95
 
96 96
 			$href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
97
-			$link = "<a href='" . esc_url($href) . "'$class>$text</a>";
98
-			echo "\t<li id='" . esc_attr("tab-$callback") . "'>$link</li>\n";
97
+			$link = "<a href='".esc_url($href)."'$class>$text</a>";
98
+			echo "\t<li id='".esc_attr("tab-$callback")."'>$link</li>\n";
99 99
 		}
100 100
 		echo "</ul>\n";
101 101
 	}
@@ -117,18 +117,18 @@  discard block
 block discarded – undo
117 117
  * @param string       $alt     Optional. Image alt attribute. Default empty.
118 118
  * @return string The HTML output to insert into the editor.
119 119
  */
120
-function get_image_send_to_editor( $id, $caption, $title, $align, $url = '', $rel = '', $size = 'medium', $alt = '' ) {
120
+function get_image_send_to_editor($id, $caption, $title, $align, $url = '', $rel = '', $size = 'medium', $alt = '') {
121 121
 
122 122
 	$html = get_image_tag($id, $alt, '', $align, $size);
123 123
 
124
-	if ( ! $rel ) {
125
-		$rel = ' rel="attachment wp-att-' . esc_attr( $id ) . '"';
124
+	if ( ! $rel) {
125
+		$rel = ' rel="attachment wp-att-'.esc_attr($id).'"';
126 126
 	} else {
127
-		$rel = ' rel="' . esc_attr( $rel ) . '"';
127
+		$rel = ' rel="'.esc_attr($rel).'"';
128 128
 	}
129 129
 
130
-	if ( $url )
131
-		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
130
+	if ($url)
131
+		$html = '<a href="'.esc_attr($url)."\"$rel>$html</a>";
132 132
 
133 133
 	/**
134 134
 	 * Filter the image HTML markup to send to the editor.
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 	 *                              (in that order). Default 'medium'.
146 146
 	 * @param string       $alt     The image alternative, or alt, text.
147 147
 	 */
148
-	$html = apply_filters( 'image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt );
148
+	$html = apply_filters('image_send_to_editor', $html, $id, $caption, $title, $align, $url, $size, $alt);
149 149
 
150 150
 	return $html;
151 151
 }
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
  * @param string $alt image alt attribute
166 166
  * @return string
167 167
  */
168
-function image_add_caption( $html, $id, $caption, $title, $align, $url, $size, $alt = '' ) {
168
+function image_add_caption($html, $id, $caption, $title, $align, $url, $size, $alt = '') {
169 169
 
170 170
 	/**
171 171
 	 * Filter the caption text.
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param string $caption The original caption text.
182 182
 	 * @param int    $id      The attachment ID.
183 183
 	 */
184
-	$caption = apply_filters( 'image_add_caption_text', $caption, $id );
184
+	$caption = apply_filters('image_add_caption_text', $caption, $id);
185 185
 
186 186
 	/**
187 187
 	 * Filter whether to disable captions.
@@ -193,27 +193,27 @@  discard block
 block discarded – undo
193 193
 	 * @param bool $bool Whether to disable appending captions. Returning true to the filter
194 194
 	 *                   will disable captions. Default empty string.
195 195
 	 */
196
-	if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
196
+	if (empty($caption) || apply_filters('disable_captions', ''))
197 197
 		return $html;
198 198
 
199
-	$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
199
+	$id = (0 < (int) $id) ? 'attachment_'.$id : '';
200 200
 
201
-	if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) )
201
+	if ( ! preg_match('/width=["\']([0-9]+)/', $html, $matches))
202 202
 		return $html;
203 203
 
204 204
 	$width = $matches[1];
205 205
 
206
-	$caption = str_replace( array("\r\n", "\r"), "\n", $caption);
207
-	$caption = preg_replace_callback( '/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption );
206
+	$caption = str_replace(array("\r\n", "\r"), "\n", $caption);
207
+	$caption = preg_replace_callback('/<[a-zA-Z0-9]+(?: [^<>]+>)*/', '_cleanup_image_add_caption', $caption);
208 208
 
209 209
 	// Convert any remaining line breaks to <br>.
210
-	$caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
210
+	$caption = preg_replace('/[ \n\t]*\n[ \t]*/', '<br />', $caption);
211 211
 
212
-	$html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
213
-	if ( empty($align) )
212
+	$html = preg_replace('/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html);
213
+	if (empty($align))
214 214
 		$align = 'none';
215 215
 
216
-	$shcode = '[caption id="' . $id . '" align="align' . $align	. '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
216
+	$shcode = '[caption id="'.$id.'" align="align'.$align.'" width="'.$width.'"]'.$html.' '.$caption.'[/caption]';
217 217
 
218 218
 	/**
219 219
 	 * Filter the image HTML markup including the caption shortcode.
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 	 * @param string $shcode The image HTML markup with caption shortcode.
224 224
 	 * @param string $html   The image HTML markup.
225 225
 	 */
226
-	return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
226
+	return apply_filters('image_add_caption_shortcode', $shcode, $html);
227 227
 }
228 228
 
229 229
 /**
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
  * @access private
233 233
  * @since 3.4.0
234 234
  */
235
-function _cleanup_image_add_caption( $matches ) {
235
+function _cleanup_image_add_caption($matches) {
236 236
 	// Remove any line breaks from inside the tags.
237
-	return preg_replace( '/[\r\n\t]+/', ' ', $matches[0] );
237
+	return preg_replace('/[\r\n\t]+/', ' ', $matches[0]);
238 238
 }
239 239
 
240 240
 /**
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
 ?>
249 249
 <script type="text/javascript">
250 250
 var win = window.dialogArguments || opener || parent || top;
251
-win.send_to_editor( <?php echo wp_json_encode( $html ); ?> );
251
+win.send_to_editor( <?php echo wp_json_encode($html); ?> );
252 252
 </script>
253 253
 <?php
254 254
 	exit;
@@ -266,22 +266,22 @@  discard block
 block discarded – undo
266 266
  * @param array  $overrides Override the {@link wp_handle_upload()} behavior. Optional.
267 267
  * @return int|WP_Error ID of the attachment or a WP_Error object on failure.
268 268
  */
269
-function media_handle_upload($file_id, $post_id, $post_data = array(), $overrides = array( 'test_form' => false )) {
269
+function media_handle_upload($file_id, $post_id, $post_data = array(), $overrides = array('test_form' => false)) {
270 270
 
271 271
 	$time = current_time('mysql');
272
-	if ( $post = get_post($post_id) ) {
273
-		if ( substr( $post->post_date, 0, 4 ) > 0 )
272
+	if ($post = get_post($post_id)) {
273
+		if (substr($post->post_date, 0, 4) > 0)
274 274
 			$time = $post->post_date;
275 275
 	}
276 276
 
277 277
 	$name = $_FILES[$file_id]['name'];
278 278
 	$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
279 279
 
280
-	if ( isset($file['error']) )
281
-		return new WP_Error( 'upload_error', $file['error'] );
280
+	if (isset($file['error']))
281
+		return new WP_Error('upload_error', $file['error']);
282 282
 
283 283
 	$name_parts = pathinfo($name);
284
-	$name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
284
+	$name = trim(substr($name, 0, -(1 + strlen($name_parts['extension']))));
285 285
 
286 286
 	$url = $file['url'];
287 287
 	$type = $file['type'];
@@ -290,85 +290,85 @@  discard block
 block discarded – undo
290 290
 	$content = '';
291 291
 	$excerpt = '';
292 292
 
293
-	if ( preg_match( '#^audio#', $type ) ) {
294
-		$meta = wp_read_audio_metadata( $file );
293
+	if (preg_match('#^audio#', $type)) {
294
+		$meta = wp_read_audio_metadata($file);
295 295
 
296
-		if ( ! empty( $meta['title'] ) ) {
296
+		if ( ! empty($meta['title'])) {
297 297
 			$title = $meta['title'];
298 298
 		}
299 299
 
300
-		if ( ! empty( $title ) ) {
300
+		if ( ! empty($title)) {
301 301
 
302
-			if ( ! empty( $meta['album'] ) && ! empty( $meta['artist'] ) ) {
302
+			if ( ! empty($meta['album']) && ! empty($meta['artist'])) {
303 303
 				/* translators: 1: audio track title, 2: album title, 3: artist name */
304
-				$content .= sprintf( __( '"%1$s" from %2$s by %3$s.' ), $title, $meta['album'], $meta['artist'] );
305
-			} elseif ( ! empty( $meta['album'] ) ) {
304
+				$content .= sprintf(__('"%1$s" from %2$s by %3$s.'), $title, $meta['album'], $meta['artist']);
305
+			} elseif ( ! empty($meta['album'])) {
306 306
 				/* translators: 1: audio track title, 2: album title */
307
-				$content .= sprintf( __( '"%1$s" from %2$s.' ), $title, $meta['album'] );
308
-			} elseif ( ! empty( $meta['artist'] ) ) {
307
+				$content .= sprintf(__('"%1$s" from %2$s.'), $title, $meta['album']);
308
+			} elseif ( ! empty($meta['artist'])) {
309 309
 				/* translators: 1: audio track title, 2: artist name */
310
-				$content .= sprintf( __( '"%1$s" by %2$s.' ), $title, $meta['artist'] );
310
+				$content .= sprintf(__('"%1$s" by %2$s.'), $title, $meta['artist']);
311 311
 			} else {
312
-				$content .= sprintf( __( '"%s".' ), $title );
312
+				$content .= sprintf(__('"%s".'), $title);
313 313
 			}
314 314
 
315
-		} elseif ( ! empty( $meta['album'] ) ) {
315
+		} elseif ( ! empty($meta['album'])) {
316 316
 
317
-			if ( ! empty( $meta['artist'] ) ) {
317
+			if ( ! empty($meta['artist'])) {
318 318
 				/* translators: 1: audio album title, 2: artist name */
319
-				$content .= sprintf( __( '%1$s by %2$s.' ), $meta['album'], $meta['artist'] );
319
+				$content .= sprintf(__('%1$s by %2$s.'), $meta['album'], $meta['artist']);
320 320
 			} else {
321
-				$content .= $meta['album'] . '.';
321
+				$content .= $meta['album'].'.';
322 322
 			}
323 323
 
324
-		} elseif ( ! empty( $meta['artist'] ) ) {
324
+		} elseif ( ! empty($meta['artist'])) {
325 325
 
326
-			$content .= $meta['artist'] . '.';
326
+			$content .= $meta['artist'].'.';
327 327
 
328 328
 		}
329 329
 
330
-		if ( ! empty( $meta['year'] ) )
331
-			$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
330
+		if ( ! empty($meta['year']))
331
+			$content .= ' '.sprintf(__('Released: %d.'), $meta['year']);
332 332
 
333
-		if ( ! empty( $meta['track_number'] ) ) {
334
-			$track_number = explode( '/', $meta['track_number'] );
335
-			if ( isset( $track_number[1] ) )
336
-				$content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) );
333
+		if ( ! empty($meta['track_number'])) {
334
+			$track_number = explode('/', $meta['track_number']);
335
+			if (isset($track_number[1]))
336
+				$content .= ' '.sprintf(__('Track %1$s of %2$s.'), number_format_i18n($track_number[0]), number_format_i18n($track_number[1]));
337 337
 			else
338
-				$content .= ' ' . sprintf( __( 'Track %1$s.' ), number_format_i18n( $track_number[0] ) );
338
+				$content .= ' '.sprintf(__('Track %1$s.'), number_format_i18n($track_number[0]));
339 339
 		}
340 340
 
341
-		if ( ! empty( $meta['genre'] ) )
342
-			$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
341
+		if ( ! empty($meta['genre']))
342
+			$content .= ' '.sprintf(__('Genre: %s.'), $meta['genre']);
343 343
 
344 344
 	// Use image exif/iptc data for title and caption defaults if possible.
345
-	} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = @wp_read_image_metadata( $file ) ) {
346
-		if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
345
+	} elseif (0 === strpos($type, 'image/') && $image_meta = @wp_read_image_metadata($file)) {
346
+		if (trim($image_meta['title']) && ! is_numeric(sanitize_title($image_meta['title']))) {
347 347
 			$title = $image_meta['title'];
348 348
 		}
349 349
 
350
-		if ( trim( $image_meta['caption'] ) ) {
350
+		if (trim($image_meta['caption'])) {
351 351
 			$excerpt = $image_meta['caption'];
352 352
 		}
353 353
 	}
354 354
 
355 355
 	// Construct the attachment array
356
-	$attachment = array_merge( array(
356
+	$attachment = array_merge(array(
357 357
 		'post_mime_type' => $type,
358 358
 		'guid' => $url,
359 359
 		'post_parent' => $post_id,
360 360
 		'post_title' => $title,
361 361
 		'post_content' => $content,
362 362
 		'post_excerpt' => $excerpt,
363
-	), $post_data );
363
+	), $post_data);
364 364
 
365 365
 	// This should never be set as it would then overwrite an existing attachment.
366
-	unset( $attachment['ID'] );
366
+	unset($attachment['ID']);
367 367
 
368 368
 	// Save the data
369 369
 	$id = wp_insert_attachment($attachment, $file, $post_id);
370
-	if ( !is_wp_error($id) ) {
371
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
370
+	if ( ! is_wp_error($id)) {
371
+		wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
372 372
 	}
373 373
 
374 374
 	return $id;
@@ -389,15 +389,15 @@  discard block
 block discarded – undo
389 389
 function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
390 390
 	$overrides = array('test_form'=>false);
391 391
 
392
-	$time = current_time( 'mysql' );
393
-	if ( $post = get_post( $post_id ) ) {
394
-		if ( substr( $post->post_date, 0, 4 ) > 0 )
392
+	$time = current_time('mysql');
393
+	if ($post = get_post($post_id)) {
394
+		if (substr($post->post_date, 0, 4) > 0)
395 395
 			$time = $post->post_date;
396 396
 	}
397 397
 
398
-	$file = wp_handle_sideload( $file_array, $overrides, $time );
399
-	if ( isset($file['error']) )
400
-		return new WP_Error( 'upload_error', $file['error'] );
398
+	$file = wp_handle_sideload($file_array, $overrides, $time);
399
+	if (isset($file['error']))
400
+		return new WP_Error('upload_error', $file['error']);
401 401
 
402 402
 	$url = $file['url'];
403 403
 	$type = $file['type'];
@@ -406,32 +406,32 @@  discard block
 block discarded – undo
406 406
 	$content = '';
407 407
 
408 408
 	// Use image exif/iptc data for title and caption defaults if possible.
409
-	if ( $image_meta = @wp_read_image_metadata($file) ) {
410
-		if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
409
+	if ($image_meta = @wp_read_image_metadata($file)) {
410
+		if (trim($image_meta['title']) && ! is_numeric(sanitize_title($image_meta['title'])))
411 411
 			$title = $image_meta['title'];
412
-		if ( trim( $image_meta['caption'] ) )
412
+		if (trim($image_meta['caption']))
413 413
 			$content = $image_meta['caption'];
414 414
 	}
415 415
 
416
-	if ( isset( $desc ) )
416
+	if (isset($desc))
417 417
 		$title = $desc;
418 418
 
419 419
 	// Construct the attachment array.
420
-	$attachment = array_merge( array(
420
+	$attachment = array_merge(array(
421 421
 		'post_mime_type' => $type,
422 422
 		'guid' => $url,
423 423
 		'post_parent' => $post_id,
424 424
 		'post_title' => $title,
425 425
 		'post_content' => $content,
426
-	), $post_data );
426
+	), $post_data);
427 427
 
428 428
 	// This should never be set as it would then overwrite an existing attachment.
429
-	unset( $attachment['ID'] );
429
+	unset($attachment['ID']);
430 430
 
431 431
 	// Save the attachment metadata
432 432
 	$id = wp_insert_attachment($attachment, $file, $post_id);
433
-	if ( !is_wp_error($id) )
434
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
433
+	if ( ! is_wp_error($id))
434
+		wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
435 435
 
436 436
 	return $id;
437 437
 }
@@ -451,41 +451,41 @@  discard block
 block discarded – undo
451 451
 <title><?php bloginfo('name') ?> &rsaquo; <?php _e('Uploads'); ?> &#8212; <?php _e('WordPress'); ?></title>
452 452
 <?php
453 453
 
454
-wp_enqueue_style( 'colors' );
454
+wp_enqueue_style('colors');
455 455
 // Check callback name for 'media'
456
-if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) )
457
-	|| ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) )
458
-	wp_enqueue_style( 'deprecated-media' );
459
-wp_enqueue_style( 'ie' );
456
+if ((is_array($content_func) && ! empty($content_func[1]) && 0 === strpos((string) $content_func[1], 'media'))
457
+	|| ( ! is_array($content_func) && 0 === strpos($content_func, 'media')))
458
+	wp_enqueue_style('deprecated-media');
459
+wp_enqueue_style('ie');
460 460
 ?>
461 461
 <script type="text/javascript">
462 462
 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
463
-var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
463
+var ajaxurl = '<?php echo admin_url('admin-ajax.php', 'relative'); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',
464 464
 isRtl = <?php echo (int) is_rtl(); ?>;
465 465
 </script>
466 466
 <?php
467 467
 	/** This action is documented in wp-admin/admin-header.php */
468
-	do_action( 'admin_enqueue_scripts', 'media-upload-popup' );
468
+	do_action('admin_enqueue_scripts', 'media-upload-popup');
469 469
 
470 470
 	/**
471 471
 	 * Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.
472 472
 	 *
473 473
 	 * @since 2.9.0
474 474
 	 */
475
-	do_action( 'admin_print_styles-media-upload-popup' );
475
+	do_action('admin_print_styles-media-upload-popup');
476 476
 
477 477
 	/** This action is documented in wp-admin/admin-header.php */
478
-	do_action( 'admin_print_styles' );
478
+	do_action('admin_print_styles');
479 479
 
480 480
 	/**
481 481
 	 * Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.
482 482
 	 *
483 483
 	 * @since 2.9.0
484 484
 	 */
485
-	do_action( 'admin_print_scripts-media-upload-popup' );
485
+	do_action('admin_print_scripts-media-upload-popup');
486 486
 
487 487
 	/** This action is documented in wp-admin/admin-header.php */
488
-	do_action( 'admin_print_scripts' );
488
+	do_action('admin_print_scripts');
489 489
 
490 490
 	/**
491 491
 	 * Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0)
@@ -493,12 +493,12 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @since 2.9.0
495 495
 	 */
496
-	do_action( 'admin_head-media-upload-popup' );
496
+	do_action('admin_head-media-upload-popup');
497 497
 
498 498
 	/** This action is documented in wp-admin/admin-header.php */
499
-	do_action( 'admin_head' );
499
+	do_action('admin_head');
500 500
 
501
-if ( is_string( $content_func ) ) {
501
+if (is_string($content_func)) {
502 502
 	/**
503 503
 	 * Fires in the admin header for each specific form tab in the legacy
504 504
 	 * (pre-3.5.0) media upload popup.
@@ -510,11 +510,11 @@  discard block
 block discarded – undo
510 510
 	 *
511 511
 	 * @since 2.5.0
512 512
 	 */
513
-	do_action( "admin_head_{$content_func}" );
513
+	do_action("admin_head_{$content_func}");
514 514
 }
515 515
 ?>
516 516
 </head>
517
-<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
517
+<body<?php if (isset($GLOBALS['body_id'])) echo ' id="'.$GLOBALS['body_id'].'"'; ?> class="wp-core-ui no-js">
518 518
 <script type="text/javascript">
519 519
 document.body.className = document.body.className.replace('no-js', 'js');
520 520
 </script>
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
 	call_user_func_array($content_func, $args);
525 525
 
526 526
 	/** This action is documented in wp-admin/admin-footer.php */
527
-	do_action( 'admin_print_footer_scripts' );
527
+	do_action('admin_print_footer_scripts');
528 528
 ?>
529 529
 <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
530 530
 </body>
@@ -548,20 +548,20 @@  discard block
 block discarded – undo
548 548
 	$instance++;
549 549
 
550 550
 	$post = get_post();
551
-	if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
551
+	if ( ! $post && ! empty($GLOBALS['post_ID']))
552 552
 		$post = $GLOBALS['post_ID'];
553 553
 
554
-	wp_enqueue_media( array(
554
+	wp_enqueue_media(array(
555 555
 		'post' => $post
556
-	) );
556
+	));
557 557
 
558 558
 	$img = '<span class="wp-media-buttons-icon"></span> ';
559 559
 
560 560
 	$id_attribute = $instance === 1 ? ' id="insert-media-button"' : '';
561
-	printf( '<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>',
561
+	printf('<button type="button"%s class="button insert-media add_media" data-editor="%s">%s</button>',
562 562
 		$id_attribute,
563
-		esc_attr( $editor_id ),
564
-		$img . __( 'Add Media' )
563
+		esc_attr($editor_id),
564
+		$img.__('Add Media')
565 565
 	);
566 566
 	/**
567 567
 	 * Filter the legacy (pre-3.5.0) media buttons.
@@ -571,11 +571,11 @@  discard block
 block discarded – undo
571 571
 	 *
572 572
 	 * @param string $string Media buttons context. Default empty.
573 573
 	 */
574
-	$legacy_filter = apply_filters( 'media_buttons_context', '' );
574
+	$legacy_filter = apply_filters('media_buttons_context', '');
575 575
 
576
-	if ( $legacy_filter ) {
576
+	if ($legacy_filter) {
577 577
 		// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
578
-		if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) )
578
+		if (0 === stripos(trim($legacy_filter), '</a>'))
579 579
 			$legacy_filter .= '</a>';
580 580
 		echo $legacy_filter;
581 581
 	}
@@ -589,18 +589,18 @@  discard block
 block discarded – undo
589 589
  * @param string $tab
590 590
  * @return string
591 591
  */
592
-function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
592
+function get_upload_iframe_src($type = null, $post_id = null, $tab = null) {
593 593
 	global $post_ID;
594 594
 
595
-	if ( empty( $post_id ) )
595
+	if (empty($post_id))
596 596
 		$post_id = $post_ID;
597 597
 
598
-	$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url('media-upload.php') );
598
+	$upload_iframe_src = add_query_arg('post_id', (int) $post_id, admin_url('media-upload.php'));
599 599
 
600
-	if ( $type && 'media' != $type )
600
+	if ($type && 'media' != $type)
601 601
 		$upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
602 602
 
603
-	if ( ! empty( $tab ) )
603
+	if ( ! empty($tab))
604 604
 		$upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
605 605
 
606 606
 	/**
@@ -613,7 +613,7 @@  discard block
 block discarded – undo
613 613
 	 *
614 614
 	 * @param string $upload_iframe_src The upload iframe source URL by type.
615 615
 	 */
616
-	$upload_iframe_src = apply_filters( $type . '_upload_iframe_src', $upload_iframe_src );
616
+	$upload_iframe_src = apply_filters($type.'_upload_iframe_src', $upload_iframe_src);
617 617
 
618 618
 	return add_query_arg('TB_iframe', true, $upload_iframe_src);
619 619
 }
@@ -630,28 +630,28 @@  discard block
 block discarded – undo
630 630
 
631 631
 	$errors = null;
632 632
 
633
-	if ( isset($_POST['send']) ) {
634
-		$keys = array_keys( $_POST['send'] );
635
-		$send_id = (int) reset( $keys );
633
+	if (isset($_POST['send'])) {
634
+		$keys = array_keys($_POST['send']);
635
+		$send_id = (int) reset($keys);
636 636
 	}
637 637
 
638
-	if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
638
+	if ( ! empty($_POST['attachments'])) foreach ($_POST['attachments'] as $attachment_id => $attachment) {
639 639
 		$post = $_post = get_post($attachment_id, ARRAY_A);
640 640
 
641
-		if ( !current_user_can( 'edit_post', $attachment_id ) )
641
+		if ( ! current_user_can('edit_post', $attachment_id))
642 642
 			continue;
643 643
 
644
-		if ( isset($attachment['post_content']) )
644
+		if (isset($attachment['post_content']))
645 645
 			$post['post_content'] = $attachment['post_content'];
646
-		if ( isset($attachment['post_title']) )
646
+		if (isset($attachment['post_title']))
647 647
 			$post['post_title'] = $attachment['post_title'];
648
-		if ( isset($attachment['post_excerpt']) )
648
+		if (isset($attachment['post_excerpt']))
649 649
 			$post['post_excerpt'] = $attachment['post_excerpt'];
650
-		if ( isset($attachment['menu_order']) )
650
+		if (isset($attachment['menu_order']))
651 651
 			$post['menu_order'] = $attachment['menu_order'];
652 652
 
653
-		if ( isset($send_id) && $attachment_id == $send_id ) {
654
-			if ( isset($attachment['post_parent']) )
653
+		if (isset($send_id) && $attachment_id == $send_id) {
654
+			if (isset($attachment['post_parent']))
655 655
 				$post['post_parent'] = $attachment['post_parent'];
656 656
 		}
657 657
 
@@ -665,33 +665,33 @@  discard block
 block discarded – undo
665 665
 		 * @param array $post       An array of post data.
666 666
 		 * @param array $attachment An array of attachment metadata.
667 667
 		 */
668
-		$post = apply_filters( 'attachment_fields_to_save', $post, $attachment );
668
+		$post = apply_filters('attachment_fields_to_save', $post, $attachment);
669 669
 
670
-		if ( isset($attachment['image_alt']) ) {
671
-			$image_alt = wp_unslash( $attachment['image_alt'] );
672
-			if ( $image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true) ) {
673
-				$image_alt = wp_strip_all_tags( $image_alt, true );
670
+		if (isset($attachment['image_alt'])) {
671
+			$image_alt = wp_unslash($attachment['image_alt']);
672
+			if ($image_alt != get_post_meta($attachment_id, '_wp_attachment_image_alt', true)) {
673
+				$image_alt = wp_strip_all_tags($image_alt, true);
674 674
 
675 675
 				// Update_meta expects slashed.
676
-				update_post_meta( $attachment_id, '_wp_attachment_image_alt', wp_slash( $image_alt ) );
676
+				update_post_meta($attachment_id, '_wp_attachment_image_alt', wp_slash($image_alt));
677 677
 			}
678 678
 		}
679 679
 
680
-		if ( isset($post['errors']) ) {
680
+		if (isset($post['errors'])) {
681 681
 			$errors[$attachment_id] = $post['errors'];
682 682
 			unset($post['errors']);
683 683
 		}
684 684
 
685
-		if ( $post != $_post )
685
+		if ($post != $_post)
686 686
 			wp_update_post($post);
687 687
 
688
-		foreach ( get_attachment_taxonomies($post) as $t ) {
689
-			if ( isset($attachment[$t]) )
688
+		foreach (get_attachment_taxonomies($post) as $t) {
689
+			if (isset($attachment[$t]))
690 690
 				wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
691 691
 		}
692 692
 	}
693 693
 
694
-	if ( isset($_POST['insert-gallery']) || isset($_POST['update-gallery']) ) { ?>
694
+	if (isset($_POST['insert-gallery']) || isset($_POST['update-gallery'])) { ?>
695 695
 		<script type="text/javascript">
696 696
 		var win = window.dialogArguments || opener || parent || top;
697 697
 		win.tb_remove();
@@ -700,14 +700,14 @@  discard block
 block discarded – undo
700 700
 		exit;
701 701
 	}
702 702
 
703
-	if ( isset($send_id) ) {
704
-		$attachment = wp_unslash( $_POST['attachments'][$send_id] );
703
+	if (isset($send_id)) {
704
+		$attachment = wp_unslash($_POST['attachments'][$send_id]);
705 705
 
706
-		$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
707
-		if ( !empty($attachment['url']) ) {
706
+		$html = isset($attachment['post_title']) ? $attachment['post_title'] : '';
707
+		if ( ! empty($attachment['url'])) {
708 708
 			$rel = '';
709
-			if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'] )
710
-				$rel = " rel='attachment wp-att-" . esc_attr($send_id) . "'";
709
+			if (strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'])
710
+				$rel = " rel='attachment wp-att-".esc_attr($send_id)."'";
711 711
 			$html = "<a href='{$attachment['url']}'$rel>$html</a>";
712 712
 		}
713 713
 
@@ -722,7 +722,7 @@  discard block
 block discarded – undo
722 722
 		 * @param int    $send_id    The first key from the $_POST['send'] data.
723 723
 		 * @param array  $attachment Array of attachment metadata.
724 724
 		 */
725
-		$html = apply_filters( 'media_send_to_editor', $html, $send_id, $attachment );
725
+		$html = apply_filters('media_send_to_editor', $html, $send_id, $attachment);
726 726
 		return media_send_to_editor($html);
727 727
 	}
728 728
 
@@ -740,33 +740,33 @@  discard block
 block discarded – undo
740 740
 	$errors = array();
741 741
 	$id = 0;
742 742
 
743
-	if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
743
+	if (isset($_POST['html-upload']) && ! empty($_FILES)) {
744 744
 		check_admin_referer('media-form');
745 745
 		// Upload File button was clicked
746 746
 		$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
747 747
 		unset($_FILES);
748
-		if ( is_wp_error($id) ) {
748
+		if (is_wp_error($id)) {
749 749
 			$errors['upload_error'] = $id;
750 750
 			$id = false;
751 751
 		}
752 752
 	}
753 753
 
754
-	if ( !empty($_POST['insertonlybutton']) ) {
754
+	if ( ! empty($_POST['insertonlybutton'])) {
755 755
 		$src = $_POST['src'];
756
-		if ( !empty($src) && !strpos($src, '://') )
756
+		if ( ! empty($src) && ! strpos($src, '://'))
757 757
 			$src = "http://$src";
758 758
 
759
-		if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
760
-			$title = esc_html( wp_unslash( $_POST['title'] ) );
761
-			if ( empty( $title ) )
762
-				$title = esc_html( basename( $src ) );
759
+		if (isset($_POST['media_type']) && 'image' != $_POST['media_type']) {
760
+			$title = esc_html(wp_unslash($_POST['title']));
761
+			if (empty($title))
762
+				$title = esc_html(basename($src));
763 763
 
764
-			if ( $title && $src )
765
-				$html = "<a href='" . esc_url($src) . "'>$title</a>";
764
+			if ($title && $src)
765
+				$html = "<a href='".esc_url($src)."'>$title</a>";
766 766
 
767 767
 			$type = 'file';
768
-			if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
769
-				&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
768
+			if (($ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $src)) && ($ext_type = wp_ext2type($ext))
769
+				&& ('audio' == $ext_type || 'video' == $ext_type))
770 770
 					$type = $ext_type;
771 771
 
772 772
 			/**
@@ -781,16 +781,16 @@  discard block
 block discarded – undo
781 781
 			 * @param string $src   Media source URL.
782 782
 			 * @param string $title Media title.
783 783
 			 */
784
-			$html = apply_filters( $type . '_send_to_editor_url', $html, esc_url_raw( $src ), $title );
784
+			$html = apply_filters($type.'_send_to_editor_url', $html, esc_url_raw($src), $title);
785 785
 		} else {
786 786
 			$align = '';
787
-			$alt = esc_attr( wp_unslash( $_POST['alt'] ) );
788
-			if ( isset($_POST['align']) ) {
789
-				$align = esc_attr( wp_unslash( $_POST['align'] ) );
787
+			$alt = esc_attr(wp_unslash($_POST['alt']));
788
+			if (isset($_POST['align'])) {
789
+				$align = esc_attr(wp_unslash($_POST['align']));
790 790
 				$class = " class='align$align'";
791 791
 			}
792
-			if ( !empty($src) )
793
-				$html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
792
+			if ( ! empty($src))
793
+				$html = "<img src='".esc_url($src)."' alt='$alt'$class />";
794 794
 
795 795
 			/**
796 796
 			 * Filter the image URL sent to the editor.
@@ -803,34 +803,34 @@  discard block
 block discarded – undo
803 803
 			 * @param string $align The image alignment. Default 'alignnone'. Possible values include
804 804
 			 *                      'alignleft', 'aligncenter', 'alignright', 'alignnone'.
805 805
 			 */
806
-			$html = apply_filters( 'image_send_to_editor_url', $html, esc_url_raw( $src ), $alt, $align );
806
+			$html = apply_filters('image_send_to_editor_url', $html, esc_url_raw($src), $alt, $align);
807 807
 		}
808 808
 
809 809
 		return media_send_to_editor($html);
810 810
 	}
811 811
 
812
-	if ( isset( $_POST['save'] ) ) {
812
+	if (isset($_POST['save'])) {
813 813
 		$errors['upload_notice'] = __('Saved.');
814
-		wp_enqueue_script( 'admin-gallery' );
815
- 		return wp_iframe( 'media_upload_gallery_form', $errors );
814
+		wp_enqueue_script('admin-gallery');
815
+ 		return wp_iframe('media_upload_gallery_form', $errors);
816 816
 
817
-	} elseif ( ! empty( $_POST ) ) {
817
+	} elseif ( ! empty($_POST)) {
818 818
 		$return = media_upload_form_handler();
819 819
 
820
-		if ( is_string($return) )
820
+		if (is_string($return))
821 821
 			return $return;
822
-		if ( is_array($return) )
822
+		if (is_array($return))
823 823
 			$errors = $return;
824 824
 	}
825 825
 
826
-	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) {
826
+	if (isset($_GET['tab']) && $_GET['tab'] == 'type_url') {
827 827
 		$type = 'image';
828
-		if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )
828
+		if (isset($_GET['type']) && in_array($_GET['type'], array('video', 'audio', 'file')))
829 829
 			$type = $_GET['type'];
830
-		return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
830
+		return wp_iframe('media_upload_type_url_form', $type, $errors, $id);
831 831
 	}
832 832
 
833
-	return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
833
+	return wp_iframe('media_upload_type_form', 'image', $errors, $id);
834 834
 }
835 835
 
836 836
 /**
@@ -845,49 +845,49 @@  discard block
 block discarded – undo
845 845
  * @param string $return  Optional. Accepts 'html' (image tag html) or 'src' (URL). Default 'html'.
846 846
  * @return string|WP_Error Populated HTML img tag on success, WP_Error object otherwise.
847 847
  */
848
-function media_sideload_image( $file, $post_id, $desc = null, $return = 'html' ) {
849
-	if ( ! empty( $file ) ) {
848
+function media_sideload_image($file, $post_id, $desc = null, $return = 'html') {
849
+	if ( ! empty($file)) {
850 850
 
851 851
 		// Set variables for storage, fix file filename for query strings.
852
-		preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches );
853
-		if ( ! $matches ) {
854
-			return new WP_Error( 'image_sideload_failed', __( 'Invalid image URL' ) );
852
+		preg_match('/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $file, $matches);
853
+		if ( ! $matches) {
854
+			return new WP_Error('image_sideload_failed', __('Invalid image URL'));
855 855
 		}
856 856
 
857 857
 		$file_array = array();
858
-		$file_array['name'] = basename( $matches[0] );
858
+		$file_array['name'] = basename($matches[0]);
859 859
 
860 860
 		// Download file to temp location.
861
-		$file_array['tmp_name'] = download_url( $file );
861
+		$file_array['tmp_name'] = download_url($file);
862 862
 
863 863
 		// If error storing temporarily, return the error.
864
-		if ( is_wp_error( $file_array['tmp_name'] ) ) {
864
+		if (is_wp_error($file_array['tmp_name'])) {
865 865
 			return $file_array['tmp_name'];
866 866
 		}
867 867
 
868 868
 		// Do the validation and storage stuff.
869
-		$id = media_handle_sideload( $file_array, $post_id, $desc );
869
+		$id = media_handle_sideload($file_array, $post_id, $desc);
870 870
 
871 871
 		// If error storing permanently, unlink.
872
-		if ( is_wp_error( $id ) ) {
873
-			@unlink( $file_array['tmp_name'] );
872
+		if (is_wp_error($id)) {
873
+			@unlink($file_array['tmp_name']);
874 874
 			return $id;
875 875
 		}
876 876
 
877
-		$src = wp_get_attachment_url( $id );
877
+		$src = wp_get_attachment_url($id);
878 878
 	}
879 879
 
880 880
 	// Finally, check to make sure the file has been saved, then return the HTML.
881
-	if ( ! empty( $src ) ) {
882
-		if ( $return === 'src' ) {
881
+	if ( ! empty($src)) {
882
+		if ($return === 'src') {
883 883
 			return $src;
884 884
 		}
885 885
 
886
-		$alt = isset( $desc ) ? esc_attr( $desc ) : '';
886
+		$alt = isset($desc) ? esc_attr($desc) : '';
887 887
 		$html = "<img src='$src' alt='$alt' />";
888 888
 		return $html;
889 889
 	} else {
890
-		return new WP_Error( 'image_sideload_failed' );
890
+		return new WP_Error('image_sideload_failed');
891 891
 	}
892 892
 }
893 893
 
@@ -901,17 +901,17 @@  discard block
 block discarded – undo
901 901
 function media_upload_gallery() {
902 902
 	$errors = array();
903 903
 
904
-	if ( !empty($_POST) ) {
904
+	if ( ! empty($_POST)) {
905 905
 		$return = media_upload_form_handler();
906 906
 
907
-		if ( is_string($return) )
907
+		if (is_string($return))
908 908
 			return $return;
909
-		if ( is_array($return) )
909
+		if (is_array($return))
910 910
 			$errors = $return;
911 911
 	}
912 912
 
913 913
 	wp_enqueue_script('admin-gallery');
914
-	return wp_iframe( 'media_upload_gallery_form', $errors );
914
+	return wp_iframe('media_upload_gallery_form', $errors);
915 915
 }
916 916
 
917 917
 /**
@@ -923,16 +923,16 @@  discard block
 block discarded – undo
923 923
  */
924 924
 function media_upload_library() {
925 925
 	$errors = array();
926
-	if ( !empty($_POST) ) {
926
+	if ( ! empty($_POST)) {
927 927
 		$return = media_upload_form_handler();
928 928
 
929
-		if ( is_string($return) )
929
+		if (is_string($return))
930 930
 			return $return;
931
-		if ( is_array($return) )
931
+		if (is_array($return))
932 932
 			$errors = $return;
933 933
 	}
934 934
 
935
-	return wp_iframe( 'media_upload_library_form', $errors );
935
+	return wp_iframe('media_upload_library_form', $errors);
936 936
 }
937 937
 
938 938
 /**
@@ -944,20 +944,20 @@  discard block
 block discarded – undo
944 944
  * @param string $checked
945 945
  * @return string
946 946
  */
947
-function image_align_input_fields( $post, $checked = '' ) {
947
+function image_align_input_fields($post, $checked = '') {
948 948
 
949
-	if ( empty($checked) )
949
+	if (empty($checked))
950 950
 		$checked = get_user_setting('align', 'none');
951 951
 
952 952
 	$alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));
953
-	if ( !array_key_exists( (string) $checked, $alignments ) )
953
+	if ( ! array_key_exists((string) $checked, $alignments))
954 954
 		$checked = 'none';
955 955
 
956 956
 	$out = array();
957
-	foreach ( $alignments as $name => $label ) {
957
+	foreach ($alignments as $name => $label) {
958 958
 		$name = esc_attr($name);
959 959
 		$out[] = "<input type='radio' name='attachments[{$post->ID}][align]' id='image-align-{$name}-{$post->ID}' value='$name'".
960
-			( $checked == $name ? " checked='checked'" : "" ) .
960
+			($checked == $name ? " checked='checked'" : "").
961 961
 			" /><label for='image-align-{$name}-{$post->ID}' class='align image-align-{$name}-label'>$label</label>";
962 962
 	}
963 963
 	return join("\n", $out);
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
  * @param bool|string $check
973 973
  * @return array
974 974
  */
975
-function image_size_input_fields( $post, $check = '' ) {
975
+function image_size_input_fields($post, $check = '') {
976 976
 	/**
977 977
 	 * Filter the names and labels of the default image sizes.
978 978
 	 *
@@ -981,34 +981,34 @@  discard block
 block discarded – undo
981 981
 	 * @param array $size_names Array of image sizes and their names. Default values
982 982
 	 *                          include 'Thumbnail', 'Medium', 'Large', 'Full Size'.
983 983
 	 */
984
-	$size_names = apply_filters( 'image_size_names_choose', array(
985
-		'thumbnail' => __( 'Thumbnail' ),
986
-		'medium'    => __( 'Medium' ),
987
-		'large'     => __( 'Large' ),
988
-		'full'      => __( 'Full Size' )
989
-	) );
990
-
991
-	if ( empty( $check ) ) {
984
+	$size_names = apply_filters('image_size_names_choose', array(
985
+		'thumbnail' => __('Thumbnail'),
986
+		'medium'    => __('Medium'),
987
+		'large'     => __('Large'),
988
+		'full'      => __('Full Size')
989
+	));
990
+
991
+	if (empty($check)) {
992 992
 		$check = get_user_setting('imgsize', 'medium');
993 993
 	}
994 994
 	$out = array();
995 995
 
996
-	foreach ( $size_names as $size => $label ) {
997
-		$downsize = image_downsize( $post->ID, $size );
996
+	foreach ($size_names as $size => $label) {
997
+		$downsize = image_downsize($post->ID, $size);
998 998
 		$checked = '';
999 999
 
1000 1000
 		// Is this size selectable?
1001
-		$enabled = ( $downsize[3] || 'full' == $size );
1001
+		$enabled = ($downsize[3] || 'full' == $size);
1002 1002
 		$css_id = "image-size-{$size}-{$post->ID}";
1003 1003
 
1004 1004
 		// If this size is the default but that's not available, don't select it.
1005
-		if ( $size == $check ) {
1006
-			if ( $enabled ) {
1005
+		if ($size == $check) {
1006
+			if ($enabled) {
1007 1007
 				$checked = " checked='checked'";
1008 1008
 			} else {
1009 1009
 				$check = '';
1010 1010
 			}
1011
-		} elseif ( ! $check && $enabled && 'thumbnail' != $size ) {
1011
+		} elseif ( ! $check && $enabled && 'thumbnail' != $size) {
1012 1012
 			/*
1013 1013
 			 * If $check is not enabled, default to the first available size
1014 1014
 			 * that's bigger than a thumbnail.
@@ -1017,13 +1017,13 @@  discard block
 block discarded – undo
1017 1017
 			$checked = " checked='checked'";
1018 1018
 		}
1019 1019
 
1020
-		$html = "<div class='image-size-item'><input type='radio' " . disabled( $enabled, false, false ) . "name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
1020
+		$html = "<div class='image-size-item'><input type='radio' ".disabled($enabled, false, false)."name='attachments[$post->ID][image-size]' id='{$css_id}' value='{$size}'$checked />";
1021 1021
 
1022 1022
 		$html .= "<label for='{$css_id}'>$label</label>";
1023 1023
 
1024 1024
 		// Only show the dimensions if that choice is available.
1025
-		if ( $enabled ) {
1026
-			$html .= " <label for='{$css_id}' class='help'>" . sprintf( "(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2] ). "</label>";
1025
+		if ($enabled) {
1026
+			$html .= " <label for='{$css_id}' class='help'>".sprintf("(%d&nbsp;&times;&nbsp;%d)", $downsize[1], $downsize[2])."</label>";
1027 1027
 		}
1028 1028
 		$html .= '</div>';
1029 1029
 
@@ -1031,9 +1031,9 @@  discard block
 block discarded – undo
1031 1031
 	}
1032 1032
 
1033 1033
 	return array(
1034
-		'label' => __( 'Size' ),
1034
+		'label' => __('Size'),
1035 1035
 		'input' => 'html',
1036
-		'html'  => join( "\n", $out ),
1036
+		'html'  => join("\n", $out),
1037 1037
 	);
1038 1038
 }
1039 1039
 
@@ -1051,20 +1051,20 @@  discard block
 block discarded – undo
1051 1051
 	$file = wp_get_attachment_url($post->ID);
1052 1052
 	$link = get_attachment_link($post->ID);
1053 1053
 
1054
-	if ( empty($url_type) )
1054
+	if (empty($url_type))
1055 1055
 		$url_type = get_user_setting('urlbutton', 'post');
1056 1056
 
1057 1057
 	$url = '';
1058
-	if ( $url_type == 'file' )
1058
+	if ($url_type == 'file')
1059 1059
 		$url = $file;
1060
-	elseif ( $url_type == 'post' )
1060
+	elseif ($url_type == 'post')
1061 1061
 		$url = $link;
1062 1062
 
1063 1063
 	return "
1064
-	<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
1065
-	<button type='button' class='button urlnone' data-link-url=''>" . __('None') . "</button>
1066
-	<button type='button' class='button urlfile' data-link-url='" . esc_attr($file) . "'>" . __('File URL') . "</button>
1067
-	<button type='button' class='button urlpost' data-link-url='" . esc_attr($link) . "'>" . __('Attachment Post URL') . "</button>
1064
+	<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='".esc_attr($url)."' /><br />
1065
+	<button type='button' class='button urlnone' data-link-url=''>" . __('None')."</button>
1066
+	<button type='button' class='button urlfile' data-link-url='" . esc_attr($file)."'>".__('File URL')."</button>
1067
+	<button type='button' class='button urlpost' data-link-url='" . esc_attr($link)."'>".__('Attachment Post URL')."</button>
1068 1068
 ";
1069 1069
 }
1070 1070
 
@@ -1080,7 +1080,7 @@  discard block
 block discarded – undo
1080 1080
 	// Post data is already escaped.
1081 1081
 	$name = "attachments[{$edit_post->ID}][post_excerpt]";
1082 1082
 
1083
-	return '<textarea name="' . $name . '" id="' . $name . '">' . $edit_post->post_excerpt . '</textarea>';
1083
+	return '<textarea name="'.$name.'" id="'.$name.'">'.$edit_post->post_excerpt.'</textarea>';
1084 1084
 }
1085 1085
 
1086 1086
 /**
@@ -1105,7 +1105,7 @@  discard block
 block discarded – undo
1105 1105
  * @param WP_Post $post        The WP_Post attachment object.
1106 1106
  * @return array Filtered attachment form fields.
1107 1107
  */
1108
-function media_single_attachment_fields_to_edit( $form_fields, $post ) {
1108
+function media_single_attachment_fields_to_edit($form_fields, $post) {
1109 1109
 	unset($form_fields['url'], $form_fields['align'], $form_fields['image-size']);
1110 1110
 	return $form_fields;
1111 1111
 }
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
  * @param WP_Post $post        The WP_Post attachment object.
1120 1120
  * @return array Filtered attachment form fields.
1121 1121
  */
1122
-function media_post_single_attachment_fields_to_edit( $form_fields, $post ) {
1122
+function media_post_single_attachment_fields_to_edit($form_fields, $post) {
1123 1123
 	unset($form_fields['image_url']);
1124 1124
 	return $form_fields;
1125 1125
 }
@@ -1137,12 +1137,12 @@  discard block
 block discarded – undo
1137 1137
  * @param array $attachment An array of attachment metadata.
1138 1138
  * @return array Filtered attachment post object.
1139 1139
  */
1140
-function image_attachment_fields_to_save( $post, $attachment ) {
1141
-	if ( substr( $post['post_mime_type'], 0, 5 ) == 'image' ) {
1142
-		if ( strlen( trim( $post['post_title'] ) ) == 0 ) {
1143
-			$attachment_url = ( isset( $post['attachment_url'] ) ) ? $post['attachment_url'] : $post['guid'];
1144
-			$post['post_title'] = preg_replace( '/\.\w+$/', '', wp_basename( $attachment_url ) );
1145
-			$post['errors']['post_title']['errors'][] = __( 'Empty Title filled from filename.' );
1140
+function image_attachment_fields_to_save($post, $attachment) {
1141
+	if (substr($post['post_mime_type'], 0, 5) == 'image') {
1142
+		if (strlen(trim($post['post_title'])) == 0) {
1143
+			$attachment_url = (isset($post['attachment_url'])) ? $post['attachment_url'] : $post['guid'];
1144
+			$post['post_title'] = preg_replace('/\.\w+$/', '', wp_basename($attachment_url));
1145
+			$post['errors']['post_title']['errors'][] = __('Empty Title filled from filename.');
1146 1146
 		}
1147 1147
 	}
1148 1148
 
@@ -1161,12 +1161,12 @@  discard block
 block discarded – undo
1161 1161
  */
1162 1162
 function image_media_send_to_editor($html, $attachment_id, $attachment) {
1163 1163
 	$post = get_post($attachment_id);
1164
-	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
1164
+	if (substr($post->post_mime_type, 0, 5) == 'image') {
1165 1165
 		$url = $attachment['url'];
1166
-		$align = !empty($attachment['align']) ? $attachment['align'] : 'none';
1167
-		$size = !empty($attachment['image-size']) ? $attachment['image-size'] : 'medium';
1168
-		$alt = !empty($attachment['image_alt']) ? $attachment['image_alt'] : '';
1169
-		$rel = ( $url == get_attachment_link($attachment_id) );
1166
+		$align = ! empty($attachment['align']) ? $attachment['align'] : 'none';
1167
+		$size = ! empty($attachment['image-size']) ? $attachment['image-size'] : 'medium';
1168
+		$alt = ! empty($attachment['image_alt']) ? $attachment['image_alt'] : '';
1169
+		$rel = ($url == get_attachment_link($attachment_id));
1170 1170
 
1171 1171
 		return get_image_send_to_editor($attachment_id, $attachment['post_excerpt'], $attachment['post_title'], $align, $url, $rel, $size, $alt);
1172 1172
 	}
@@ -1184,10 +1184,10 @@  discard block
 block discarded – undo
1184 1184
  * @return array
1185 1185
  */
1186 1186
 function get_attachment_fields_to_edit($post, $errors = null) {
1187
-	if ( is_int($post) )
1187
+	if (is_int($post))
1188 1188
 		$post = get_post($post);
1189
-	if ( is_array($post) )
1190
-		$post = new WP_Post( (object) $post );
1189
+	if (is_array($post))
1190
+		$post = new WP_Post((object) $post);
1191 1191
 
1192 1192
 	$image_url = wp_get_attachment_url($post->ID);
1193 1193
 
@@ -1222,28 +1222,28 @@  discard block
 block discarded – undo
1222 1222
 		'image_url'	=> array(
1223 1223
 			'label'      => __('File URL'),
1224 1224
 			'input'      => 'html',
1225
-			'html'       => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . esc_attr($image_url) . "' /><br />",
1225
+			'html'       => "<input type='text' class='text urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='".esc_attr($image_url)."' /><br />",
1226 1226
 			'value'      => wp_get_attachment_url($post->ID),
1227 1227
 			'helps'      => __('Location of the uploaded file.')
1228 1228
 		)
1229 1229
 	);
1230 1230
 
1231
-	foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1231
+	foreach (get_attachment_taxonomies($post) as $taxonomy) {
1232 1232
 		$t = (array) get_taxonomy($taxonomy);
1233
-		if ( ! $t['public'] || ! $t['show_ui'] )
1233
+		if ( ! $t['public'] || ! $t['show_ui'])
1234 1234
 			continue;
1235
-		if ( empty($t['label']) )
1235
+		if (empty($t['label']))
1236 1236
 			$t['label'] = $taxonomy;
1237
-		if ( empty($t['args']) )
1237
+		if (empty($t['args']))
1238 1238
 			$t['args'] = array();
1239 1239
 
1240 1240
 		$terms = get_object_term_cache($post->ID, $taxonomy);
1241
-		if ( false === $terms )
1241
+		if (false === $terms)
1242 1242
 			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1243 1243
 
1244 1244
 		$values = array();
1245 1245
 
1246
-		foreach ( $terms as $term )
1246
+		foreach ($terms as $term)
1247 1247
 			$values[] = $term->slug;
1248 1248
 		$t['value'] = join(', ', $values);
1249 1249
 
@@ -1255,9 +1255,9 @@  discard block
 block discarded – undo
1255 1255
 	$form_fields = array_merge_recursive($form_fields, (array) $errors);
1256 1256
 
1257 1257
 	// This was formerly in image_attachment_fields_to_edit().
1258
-	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
1258
+	if (substr($post->post_mime_type, 0, 5) == 'image') {
1259 1259
 		$alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
1260
-		if ( empty($alt) )
1260
+		if (empty($alt))
1261 1261
 			$alt = '';
1262 1262
 
1263 1263
 		$form_fields['post_title']['required'] = true;
@@ -1274,10 +1274,10 @@  discard block
 block discarded – undo
1274 1274
 			'html'  => image_align_input_fields($post, get_option('image_default_align')),
1275 1275
 		);
1276 1276
 
1277
-		$form_fields['image-size'] = image_size_input_fields( $post, get_option('image_default_size', 'medium') );
1277
+		$form_fields['image-size'] = image_size_input_fields($post, get_option('image_default_size', 'medium'));
1278 1278
 
1279 1279
 	} else {
1280
-		unset( $form_fields['image_alt'] );
1280
+		unset($form_fields['image_alt']);
1281 1281
 	}
1282 1282
 
1283 1283
 	/**
@@ -1288,7 +1288,7 @@  discard block
 block discarded – undo
1288 1288
 	 * @param array   $form_fields An array of attachment form fields.
1289 1289
 	 * @param WP_Post $post        The WP_Post attachment object.
1290 1290
 	 */
1291
-	$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1291
+	$form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
1292 1292
 
1293 1293
 	return $form_fields;
1294 1294
 }
@@ -1308,25 +1308,25 @@  discard block
 block discarded – undo
1308 1308
  * @param array $errors Errors for attachment, if any.
1309 1309
  * @return string
1310 1310
  */
1311
-function get_media_items( $post_id, $errors ) {
1311
+function get_media_items($post_id, $errors) {
1312 1312
 	$attachments = array();
1313
-	if ( $post_id ) {
1313
+	if ($post_id) {
1314 1314
 		$post = get_post($post_id);
1315
-		if ( $post && $post->post_type == 'attachment' )
1315
+		if ($post && $post->post_type == 'attachment')
1316 1316
 			$attachments = array($post->ID => $post);
1317 1317
 		else
1318
-			$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
1318
+			$attachments = get_children(array('post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC'));
1319 1319
 	} else {
1320
-		if ( is_array($GLOBALS['wp_the_query']->posts) )
1321
-			foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
1320
+		if (is_array($GLOBALS['wp_the_query']->posts))
1321
+			foreach ($GLOBALS['wp_the_query']->posts as $attachment)
1322 1322
 				$attachments[$attachment->ID] = $attachment;
1323 1323
 	}
1324 1324
 
1325 1325
 	$output = '';
1326
-	foreach ( (array) $attachments as $id => $attachment ) {
1327
-		if ( $attachment->post_status == 'trash' )
1326
+	foreach ((array) $attachments as $id => $attachment) {
1327
+		if ($attachment->post_status == 'trash')
1328 1328
 			continue;
1329
-		if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
1329
+		if ($item = get_media_item($id, array('errors' => isset($errors[$id]) ? $errors[$id] : null)))
1330 1330
 			$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
1331 1331
 	}
1332 1332
 
@@ -1344,25 +1344,25 @@  discard block
 block discarded – undo
1344 1344
  * @param string|array $args Optional. Override defaults.
1345 1345
  * @return string HTML form for attachment.
1346 1346
  */
1347
-function get_media_item( $attachment_id, $args = null ) {
1347
+function get_media_item($attachment_id, $args = null) {
1348 1348
 	global $redir_tab;
1349 1349
 
1350
-	if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
1350
+	if (($attachment_id = intval($attachment_id)) && $thumb_url = wp_get_attachment_image_src($attachment_id, 'thumbnail', true))
1351 1351
 		$thumb_url = $thumb_url[0];
1352 1352
 	else
1353 1353
 		$thumb_url = false;
1354 1354
 
1355
-	$post = get_post( $attachment_id );
1356
-	$current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
1355
+	$post = get_post($attachment_id);
1356
+	$current_post_id = ! empty($_GET['post_id']) ? (int) $_GET['post_id'] : 0;
1357 1357
 
1358 1358
 	$default_args = array(
1359 1359
 		'errors' => null,
1360
-		'send' => $current_post_id ? post_type_supports( get_post_type( $current_post_id ), 'editor' ) : true,
1360
+		'send' => $current_post_id ? post_type_supports(get_post_type($current_post_id), 'editor') : true,
1361 1361
 		'delete' => true,
1362 1362
 		'toggle' => true,
1363 1363
 		'show_title' => true
1364 1364
 	);
1365
-	$args = wp_parse_args( $args, $default_args );
1365
+	$args = wp_parse_args($args, $default_args);
1366 1366
 
1367 1367
 	/**
1368 1368
 	 * Filter the arguments used to retrieve an image for the edit image form.
@@ -1373,24 +1373,24 @@  discard block
 block discarded – undo
1373 1373
 	 *
1374 1374
 	 * @param array $args An array of arguments.
1375 1375
 	 */
1376
-	$r = apply_filters( 'get_media_item_args', $args );
1376
+	$r = apply_filters('get_media_item_args', $args);
1377 1377
 
1378
-	$toggle_on  = __( 'Show' );
1379
-	$toggle_off = __( 'Hide' );
1378
+	$toggle_on  = __('Show');
1379
+	$toggle_off = __('Hide');
1380 1380
 
1381
-	$file = get_attached_file( $post->ID );
1382
-	$filename = esc_html( wp_basename( $file ) );
1383
-	$title = esc_attr( $post->post_title );
1381
+	$file = get_attached_file($post->ID);
1382
+	$filename = esc_html(wp_basename($file));
1383
+	$title = esc_attr($post->post_title);
1384 1384
 
1385 1385
 	$post_mime_types = get_post_mime_types();
1386
-	$keys = array_keys( wp_match_mime_types( array_keys( $post_mime_types ), $post->post_mime_type ) );
1387
-	$type = reset( $keys );
1388
-	$type_html = "<input type='hidden' id='type-of-$attachment_id' value='" . esc_attr( $type ) . "' />";
1386
+	$keys = array_keys(wp_match_mime_types(array_keys($post_mime_types), $post->post_mime_type));
1387
+	$type = reset($keys);
1388
+	$type_html = "<input type='hidden' id='type-of-$attachment_id' value='".esc_attr($type)."' />";
1389 1389
 
1390
-	$form_fields = get_attachment_fields_to_edit( $post, $r['errors'] );
1390
+	$form_fields = get_attachment_fields_to_edit($post, $r['errors']);
1391 1391
 
1392
-	if ( $r['toggle'] ) {
1393
-		$class = empty( $r['errors'] ) ? 'startclosed' : 'startopen';
1392
+	if ($r['toggle']) {
1393
+		$class = empty($r['errors']) ? 'startclosed' : 'startopen';
1394 1394
 		$toggle_links = "
1395 1395
 	<a class='toggle describe-toggle-on' href='#'>$toggle_on</a>
1396 1396
 	<a class='toggle describe-toggle-off' href='#'>$toggle_off</a>";
@@ -1399,27 +1399,27 @@  discard block
 block discarded – undo
1399 1399
 		$toggle_links = '';
1400 1400
 	}
1401 1401
 
1402
-	$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
1403
-	$display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>" . wp_html_excerpt( $display_title, 60, '&hellip;' ) . "</span></div>" : '';
1402
+	$display_title = ( ! empty($title)) ? $title : $filename; // $title shouldn't ever be empty, but just in case
1403
+	$display_title = $r['show_title'] ? "<div class='filename new'><span class='title'>".wp_html_excerpt($display_title, 60, '&hellip;')."</span></div>" : '';
1404 1404
 
1405
-	$gallery = ( ( isset( $_REQUEST['tab'] ) && 'gallery' == $_REQUEST['tab'] ) || ( isset( $redir_tab ) && 'gallery' == $redir_tab ) );
1405
+	$gallery = ((isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab));
1406 1406
 	$order = '';
1407 1407
 
1408
-	foreach ( $form_fields as $key => $val ) {
1409
-		if ( 'menu_order' == $key ) {
1410
-			if ( $gallery )
1411
-				$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ). "' /></div>";
1408
+	foreach ($form_fields as $key => $val) {
1409
+		if ('menu_order' == $key) {
1410
+			if ($gallery)
1411
+				$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='".esc_attr($val['value'])."' /></div>";
1412 1412
 			else
1413
-				$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
1413
+				$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='".esc_attr($val['value'])."' />";
1414 1414
 
1415
-			unset( $form_fields['menu_order'] );
1415
+			unset($form_fields['menu_order']);
1416 1416
 			break;
1417 1417
 		}
1418 1418
 	}
1419 1419
 
1420 1420
 	$media_dims = '';
1421
-	$meta = wp_get_attachment_metadata( $post->ID );
1422
-	if ( isset( $meta['width'], $meta['height'] ) )
1421
+	$meta = wp_get_attachment_metadata($post->ID);
1422
+	if (isset($meta['width'], $meta['height']))
1423 1423
 		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
1424 1424
 
1425 1425
 	/**
@@ -1430,15 +1430,15 @@  discard block
 block discarded – undo
1430 1430
 	 * @param string  $media_dims The HTML markup containing the media dimensions.
1431 1431
 	 * @param WP_Post $post       The WP_Post attachment object.
1432 1432
 	 */
1433
-	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
1433
+	$media_dims = apply_filters('media_meta', $media_dims, $post);
1434 1434
 
1435 1435
 	$image_edit_button = '';
1436
-	if ( wp_attachment_is_image( $post->ID ) && wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
1437
-		$nonce = wp_create_nonce( "image_editor-$post->ID" );
1438
-		$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
1436
+	if (wp_attachment_is_image($post->ID) && wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
1437
+		$nonce = wp_create_nonce("image_editor-$post->ID");
1438
+		$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='".esc_attr__('Edit Image')."' /> <span class='spinner'></span>";
1439 1439
 	}
1440 1440
 
1441
-	$attachment_url = get_permalink( $attachment_id );
1441
+	$attachment_url = get_permalink($attachment_id);
1442 1442
 
1443 1443
 	$item = "
1444 1444
 	$type_html
@@ -1453,11 +1453,11 @@  discard block
 block discarded – undo
1453 1453
 			<p>$image_edit_button</p>
1454 1454
 			</td>
1455 1455
 			<td>
1456
-			<p><strong>" . __('File name:') . "</strong> $filename</p>
1457
-			<p><strong>" . __('File type:') . "</strong> $post->post_mime_type</p>
1458
-			<p><strong>" . __('Upload date:') . "</strong> " . mysql2date( __( 'F j, Y' ), $post->post_date ). '</p>';
1459
-			if ( !empty( $media_dims ) )
1460
-				$item .= "<p><strong>" . __('Dimensions:') . "</strong> $media_dims</p>\n";
1456
+			<p><strong>".__('File name:')."</strong> $filename</p>
1457
+			<p><strong>".__('File type:')."</strong> $post->post_mime_type</p>
1458
+			<p><strong>".__('Upload date:')."</strong> ".mysql2date(__('F j, Y'), $post->post_date).'</p>';
1459
+			if ( ! empty($media_dims))
1460
+				$item .= "<p><strong>".__('Dimensions:')."</strong> $media_dims</p>\n";
1461 1461
 
1462 1462
 			$item .= "</td></tr>\n";
1463 1463
 
@@ -1466,7 +1466,7 @@  discard block
 block discarded – undo
1466 1466
 		<tbody>
1467 1467
 		<tr><td colspan='2' class='imgedit-response' id='imgedit-response-$post->ID'></td></tr>\n
1468 1468
 		<tr><td style='display:none' colspan='2' class='image-editor' id='image-editor-$post->ID'></td></tr>\n
1469
-		<tr><td colspan='2'><p class='media-types media-types-required-info'>" . sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . "</p></td></tr>\n";
1469
+		<tr><td colspan='2'><p class='media-types media-types-required-info'>".sprintf(__('Required fields are marked %s'), '<span class="required">*</span>')."</p></td></tr>\n";
1470 1470
 
1471 1471
 	$defaults = array(
1472 1472
 		'input'      => 'text',
@@ -1475,25 +1475,25 @@  discard block
 block discarded – undo
1475 1475
 		'extra_rows' => array(),
1476 1476
 	);
1477 1477
 
1478
-	if ( $r['send'] ) {
1479
-		$r['send'] = get_submit_button( __( 'Insert into Post' ), 'button', "send[$attachment_id]", false );
1478
+	if ($r['send']) {
1479
+		$r['send'] = get_submit_button(__('Insert into Post'), 'button', "send[$attachment_id]", false);
1480 1480
 	}
1481 1481
 
1482
-	$delete = empty( $r['delete'] ) ? '' : $r['delete'];
1483
-	if ( $delete && current_user_can( 'delete_post', $attachment_id ) ) {
1484
-		if ( !EMPTY_TRASH_DAYS ) {
1485
-			$delete = "<a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete-permanently'>" . __( 'Delete Permanently' ) . '</a>';
1486
-		} elseif ( !MEDIA_TRASH ) {
1487
-			$delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __( 'Delete' ) . "</a>
1488
-			 <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'>" .
1482
+	$delete = empty($r['delete']) ? '' : $r['delete'];
1483
+	if ($delete && current_user_can('delete_post', $attachment_id)) {
1484
+		if ( ! EMPTY_TRASH_DAYS) {
1485
+			$delete = "<a href='".wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_'.$attachment_id)."' id='del[$attachment_id]' class='delete-permanently'>".__('Delete Permanently').'</a>';
1486
+		} elseif ( ! MEDIA_TRASH) {
1487
+			$delete = "<a href='#' class='del-link' onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">".__('Delete')."</a>
1488
+			 <div id='del_attachment_$attachment_id' class='del-attachment' style='display:none;'>".
1489 1489
 			 /* translators: %s: file name */
1490
-			'<p>' . sprintf( __( 'You are about to delete %s.' ), '<strong>' . $filename . '</strong>' ) . "</p>
1491
-			 <a href='" . wp_nonce_url( "post.php?action=delete&amp;post=$attachment_id", 'delete-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='button'>" . __( 'Continue' ) . "</a>
1492
-			 <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __( 'Cancel' ) . "</a>
1490
+			'<p>'.sprintf(__('You are about to delete %s.'), '<strong>'.$filename.'</strong>')."</p>
1491
+			 <a href='" . wp_nonce_url("post.php?action=delete&amp;post=$attachment_id", 'delete-post_'.$attachment_id)."' id='del[$attachment_id]' class='button'>".__('Continue')."</a>
1492
+			 <a href='#' class='button' onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel')."</a>
1493 1493
 			 </div>";
1494 1494
 		} else {
1495
-			$delete = "<a href='" . wp_nonce_url( "post.php?action=trash&amp;post=$attachment_id", 'trash-post_' . $attachment_id ) . "' id='del[$attachment_id]' class='delete'>" . __( 'Move to Trash' ) . "</a>
1496
-			<a href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_' . $attachment_id ) . "' id='undo[$attachment_id]' class='undo hidden'>" . __( 'Undo' ) . "</a>";
1495
+			$delete = "<a href='".wp_nonce_url("post.php?action=trash&amp;post=$attachment_id", 'trash-post_'.$attachment_id)."' id='del[$attachment_id]' class='delete'>".__('Move to Trash')."</a>
1496
+			<a href='" . wp_nonce_url("post.php?action=untrash&amp;post=$attachment_id", 'untrash-post_'.$attachment_id)."' id='undo[$attachment_id]' class='undo hidden'>".__('Undo')."</a>";
1497 1497
 		}
1498 1498
 	} else {
1499 1499
 		$delete = '';
@@ -1501,39 +1501,39 @@  discard block
 block discarded – undo
1501 1501
 
1502 1502
 	$thumbnail = '';
1503 1503
 	$calling_post_id = 0;
1504
-	if ( isset( $_GET['post_id'] ) ) {
1505
-		$calling_post_id = absint( $_GET['post_id'] );
1506
-	} elseif ( isset( $_POST ) && count( $_POST ) ) {// Like for async-upload where $_GET['post_id'] isn't set
1504
+	if (isset($_GET['post_id'])) {
1505
+		$calling_post_id = absint($_GET['post_id']);
1506
+	} elseif (isset($_POST) && count($_POST)) {// Like for async-upload where $_GET['post_id'] isn't set
1507 1507
 		$calling_post_id = $post->post_parent;
1508 1508
 	}
1509
-	if ( 'image' == $type && $calling_post_id && current_theme_supports( 'post-thumbnails', get_post_type( $calling_post_id ) )
1510
-		&& post_type_supports( get_post_type( $calling_post_id ), 'thumbnail' ) && get_post_thumbnail_id( $calling_post_id ) != $attachment_id ) {
1509
+	if ('image' == $type && $calling_post_id && current_theme_supports('post-thumbnails', get_post_type($calling_post_id))
1510
+		&& post_type_supports(get_post_type($calling_post_id), 'thumbnail') && get_post_thumbnail_id($calling_post_id) != $attachment_id) {
1511 1511
 
1512
-		$calling_post = get_post( $calling_post_id );
1513
-		$calling_post_type_object = get_post_type_object( $calling_post->post_type );
1512
+		$calling_post = get_post($calling_post_id);
1513
+		$calling_post_type_object = get_post_type_object($calling_post->post_type);
1514 1514
 
1515
-		$ajax_nonce = wp_create_nonce( "set_post_thumbnail-$calling_post_id" );
1516
-		$thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-" . $attachment_id . "' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>" . esc_html( $calling_post_type_object->labels->use_featured_image ) . "</a>";
1515
+		$ajax_nonce = wp_create_nonce("set_post_thumbnail-$calling_post_id");
1516
+		$thumbnail = "<a class='wp-post-thumbnail' id='wp-post-thumbnail-".$attachment_id."' href='#' onclick='WPSetAsThumbnail(\"$attachment_id\", \"$ajax_nonce\");return false;'>".esc_html($calling_post_type_object->labels->use_featured_image)."</a>";
1517 1517
 	}
1518 1518
 
1519
-	if ( ( $r['send'] || $thumbnail || $delete ) && !isset( $form_fields['buttons'] ) ) {
1520
-		$form_fields['buttons'] = array( 'tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>" . $r['send'] . " $thumbnail $delete</td></tr>\n" );
1519
+	if (($r['send'] || $thumbnail || $delete) && ! isset($form_fields['buttons'])) {
1520
+		$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>".$r['send']." $thumbnail $delete</td></tr>\n");
1521 1521
 	}
1522 1522
 	$hidden_fields = array();
1523 1523
 
1524
-	foreach ( $form_fields as $id => $field ) {
1525
-		if ( $id[0] == '_' )
1524
+	foreach ($form_fields as $id => $field) {
1525
+		if ($id[0] == '_')
1526 1526
 			continue;
1527 1527
 
1528
-		if ( !empty( $field['tr'] ) ) {
1528
+		if ( ! empty($field['tr'])) {
1529 1529
 			$item .= $field['tr'];
1530 1530
 			continue;
1531 1531
 		}
1532 1532
 
1533
-		$field = array_merge( $defaults, $field );
1533
+		$field = array_merge($defaults, $field);
1534 1534
 		$name = "attachments[$attachment_id][$id]";
1535 1535
 
1536
-		if ( $field['input'] == 'hidden' ) {
1536
+		if ($field['input'] == 'hidden') {
1537 1537
 			$hidden_fields[$name] = $field['value'];
1538 1538
 			continue;
1539 1539
 		}
@@ -1545,47 +1545,47 @@  discard block
 block discarded – undo
1545 1545
 		$class .= $field['required'] ? ' form-required' : '';
1546 1546
 
1547 1547
 		$item .= "\t\t<tr class='$class'>\n\t\t\t<th scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}{$required}</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
1548
-		if ( !empty( $field[ $field['input'] ] ) )
1549
-			$item .= $field[ $field['input'] ];
1550
-		elseif ( $field['input'] == 'textarea' ) {
1551
-			if ( 'post_content' == $id && user_can_richedit() ) {
1548
+		if ( ! empty($field[$field['input']]))
1549
+			$item .= $field[$field['input']];
1550
+		elseif ($field['input'] == 'textarea') {
1551
+			if ('post_content' == $id && user_can_richedit()) {
1552 1552
 				// Sanitize_post() skips the post_content when user_can_richedit.
1553
-				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
1553
+				$field['value'] = htmlspecialchars($field['value'], ENT_QUOTES);
1554 1554
 			}
1555 1555
 			// Post_excerpt is already escaped by sanitize_post() in get_attachment_fields_to_edit().
1556
-			$item .= "<textarea id='$name' name='$name'{$required_attr}{$aria_required}>" . $field['value'] . '</textarea>';
1556
+			$item .= "<textarea id='$name' name='$name'{$required_attr}{$aria_required}>".$field['value'].'</textarea>';
1557 1557
 		} else {
1558
-			$item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'{$required_attr}{$aria_required} />";
1558
+			$item .= "<input type='text' class='text' id='$name' name='$name' value='".esc_attr($field['value'])."'{$required_attr}{$aria_required} />";
1559 1559
 		}
1560
-		if ( !empty( $field['helps'] ) )
1561
-			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1560
+		if ( ! empty($field['helps']))
1561
+			$item .= "<p class='help'>".join("</p>\n<p class='help'>", array_unique((array) $field['helps'])).'</p>';
1562 1562
 		$item .= "</td>\n\t\t</tr>\n";
1563 1563
 
1564 1564
 		$extra_rows = array();
1565 1565
 
1566
-		if ( !empty( $field['errors'] ) )
1567
-			foreach ( array_unique( (array) $field['errors'] ) as $error )
1566
+		if ( ! empty($field['errors']))
1567
+			foreach (array_unique((array) $field['errors']) as $error)
1568 1568
 				$extra_rows['error'][] = $error;
1569 1569
 
1570
-		if ( !empty( $field['extra_rows'] ) )
1571
-			foreach ( $field['extra_rows'] as $class => $rows )
1572
-				foreach ( (array) $rows as $html )
1570
+		if ( ! empty($field['extra_rows']))
1571
+			foreach ($field['extra_rows'] as $class => $rows)
1572
+				foreach ((array) $rows as $html)
1573 1573
 					$extra_rows[$class][] = $html;
1574 1574
 
1575
-		foreach ( $extra_rows as $class => $rows )
1576
-			foreach ( $rows as $html )
1575
+		foreach ($extra_rows as $class => $rows)
1576
+			foreach ($rows as $html)
1577 1577
 				$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
1578 1578
 	}
1579 1579
 
1580
-	if ( !empty( $form_fields['_final'] ) )
1580
+	if ( ! empty($form_fields['_final']))
1581 1581
 		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1582 1582
 	$item .= "\t</tbody>\n";
1583 1583
 	$item .= "\t</table>\n";
1584 1584
 
1585
-	foreach ( $hidden_fields as $name => $value )
1586
-		$item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
1585
+	foreach ($hidden_fields as $name => $value)
1586
+		$item .= "\t<input type='hidden' name='$name' id='$name' value='".esc_attr($value)."' />\n";
1587 1587
 
1588
-	if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) {
1588
+	if ($post->post_parent < 1 && isset($_REQUEST['post_id'])) {
1589 1589
 		$parent = (int) $_REQUEST['post_id'];
1590 1590
 		$parent_name = "attachments[$attachment_id][post_parent]";
1591 1591
 		$item .= "\t<input type='hidden' name='$parent_name' id='$parent_name' value='$parent' />\n";
@@ -1601,40 +1601,40 @@  discard block
 block discarded – undo
1601 1601
  * @param array $args
1602 1602
  * @return array
1603 1603
  */
1604
-function get_compat_media_markup( $attachment_id, $args = null ) {
1605
-	$post = get_post( $attachment_id );
1604
+function get_compat_media_markup($attachment_id, $args = null) {
1605
+	$post = get_post($attachment_id);
1606 1606
 
1607 1607
 	$default_args = array(
1608 1608
 		'errors' => null,
1609 1609
 		'in_modal' => false,
1610 1610
 	);
1611 1611
 
1612
-	$user_can_edit = current_user_can( 'edit_post', $attachment_id );
1612
+	$user_can_edit = current_user_can('edit_post', $attachment_id);
1613 1613
 
1614
-	$args = wp_parse_args( $args, $default_args );
1614
+	$args = wp_parse_args($args, $default_args);
1615 1615
 
1616 1616
 	/** This filter is documented in wp-admin/includes/media.php */
1617
-	$args = apply_filters( 'get_media_item_args', $args );
1617
+	$args = apply_filters('get_media_item_args', $args);
1618 1618
 
1619 1619
 	$form_fields = array();
1620 1620
 
1621
-	if ( $args['in_modal'] ) {
1622
-		foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1621
+	if ($args['in_modal']) {
1622
+		foreach (get_attachment_taxonomies($post) as $taxonomy) {
1623 1623
 			$t = (array) get_taxonomy($taxonomy);
1624
-			if ( ! $t['public'] || ! $t['show_ui'] )
1624
+			if ( ! $t['public'] || ! $t['show_ui'])
1625 1625
 				continue;
1626
-			if ( empty($t['label']) )
1626
+			if (empty($t['label']))
1627 1627
 				$t['label'] = $taxonomy;
1628
-			if ( empty($t['args']) )
1628
+			if (empty($t['args']))
1629 1629
 				$t['args'] = array();
1630 1630
 
1631 1631
 			$terms = get_object_term_cache($post->ID, $taxonomy);
1632
-			if ( false === $terms )
1632
+			if (false === $terms)
1633 1633
 				$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1634 1634
 
1635 1635
 			$values = array();
1636 1636
 
1637
-			foreach ( $terms as $term )
1637
+			foreach ($terms as $term)
1638 1638
 				$values[] = $term->slug;
1639 1639
 			$t['value'] = join(', ', $values);
1640 1640
 			$t['taxonomy'] = true;
@@ -1645,17 +1645,17 @@  discard block
 block discarded – undo
1645 1645
 
1646 1646
 	// Merge default fields with their errors, so any key passed with the error (e.g. 'error', 'helps', 'value') will replace the default
1647 1647
 	// The recursive merge is easily traversed with array casting: foreach ( (array) $things as $thing )
1648
-	$form_fields = array_merge_recursive($form_fields, (array) $args['errors'] );
1648
+	$form_fields = array_merge_recursive($form_fields, (array) $args['errors']);
1649 1649
 
1650 1650
 	/** This filter is documented in wp-admin/includes/media.php */
1651
-	$form_fields = apply_filters( 'attachment_fields_to_edit', $form_fields, $post );
1651
+	$form_fields = apply_filters('attachment_fields_to_edit', $form_fields, $post);
1652 1652
 
1653
-	unset( $form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
1653
+	unset($form_fields['image-size'], $form_fields['align'], $form_fields['image_alt'],
1654 1654
 		$form_fields['post_title'], $form_fields['post_excerpt'], $form_fields['post_content'],
1655
-		$form_fields['url'], $form_fields['menu_order'], $form_fields['image_url'] );
1655
+		$form_fields['url'], $form_fields['menu_order'], $form_fields['image_url']);
1656 1656
 
1657 1657
 	/** This filter is documented in wp-admin/includes/media.php */
1658
-	$media_meta = apply_filters( 'media_meta', '', $post );
1658
+	$media_meta = apply_filters('media_meta', '', $post);
1659 1659
 
1660 1660
 	$defaults = array(
1661 1661
 		'input'         => 'text',
@@ -1669,85 +1669,85 @@  discard block
 block discarded – undo
1669 1669
 	$hidden_fields = array();
1670 1670
 
1671 1671
 	$item = '';
1672
-	foreach ( $form_fields as $id => $field ) {
1673
-		if ( $id[0] == '_' )
1672
+	foreach ($form_fields as $id => $field) {
1673
+		if ($id[0] == '_')
1674 1674
 			continue;
1675 1675
 
1676 1676
 		$name = "attachments[$attachment_id][$id]";
1677 1677
 		$id_attr = "attachments-$attachment_id-$id";
1678 1678
 
1679
-		if ( !empty( $field['tr'] ) ) {
1679
+		if ( ! empty($field['tr'])) {
1680 1680
 			$item .= $field['tr'];
1681 1681
 			continue;
1682 1682
 		}
1683 1683
 
1684
-		$field = array_merge( $defaults, $field );
1684
+		$field = array_merge($defaults, $field);
1685 1685
 
1686
-		if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) )
1686
+		if (( ! $field['show_in_edit'] && ! $args['in_modal']) || ( ! $field['show_in_modal'] && $args['in_modal']))
1687 1687
 			continue;
1688 1688
 
1689
-		if ( $field['input'] == 'hidden' ) {
1689
+		if ($field['input'] == 'hidden') {
1690 1690
 			$hidden_fields[$name] = $field['value'];
1691 1691
 			continue;
1692 1692
 		}
1693 1693
 
1694
-		$readonly      = ! $user_can_edit && ! empty( $field['taxonomy'] ) ? " readonly='readonly' " : '';
1694
+		$readonly      = ! $user_can_edit && ! empty($field['taxonomy']) ? " readonly='readonly' " : '';
1695 1695
 		$required      = $field['required'] ? '<span class="required">*</span>' : '';
1696 1696
 		$required_attr = $field['required'] ? ' required' : '';
1697 1697
 		$aria_required = $field['required'] ? " aria-required='true'" : '';
1698
-		$class  = 'compat-field-' . $id;
1698
+		$class  = 'compat-field-'.$id;
1699 1699
 		$class .= $field['required'] ? ' form-required' : '';
1700 1700
 
1701 1701
 		$item .= "\t\t<tr class='$class'>";
1702 1702
 		$item .= "\t\t\t<th scope='row' class='label'><label for='$id_attr'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label>";
1703 1703
 		$item .= "</th>\n\t\t\t<td class='field'>";
1704 1704
 
1705
-		if ( !empty( $field[ $field['input'] ] ) )
1706
-			$item .= $field[ $field['input'] ];
1707
-		elseif ( $field['input'] == 'textarea' ) {
1708
-			if ( 'post_content' == $id && user_can_richedit() ) {
1705
+		if ( ! empty($field[$field['input']]))
1706
+			$item .= $field[$field['input']];
1707
+		elseif ($field['input'] == 'textarea') {
1708
+			if ('post_content' == $id && user_can_richedit()) {
1709 1709
 				// sanitize_post() skips the post_content when user_can_richedit.
1710
-				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
1710
+				$field['value'] = htmlspecialchars($field['value'], ENT_QUOTES);
1711 1711
 			}
1712
-			$item .= "<textarea id='$id_attr' name='$name'{$required_attr}{$aria_required}>" . $field['value'] . '</textarea>';
1712
+			$item .= "<textarea id='$id_attr' name='$name'{$required_attr}{$aria_required}>".$field['value'].'</textarea>';
1713 1713
 		} else {
1714
-			$item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly{$required_attr}{$aria_required} />";
1714
+			$item .= "<input type='text' class='text' id='$id_attr' name='$name' value='".esc_attr($field['value'])."' $readonly{$required_attr}{$aria_required} />";
1715 1715
 		}
1716
-		if ( !empty( $field['helps'] ) )
1717
-			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1716
+		if ( ! empty($field['helps']))
1717
+			$item .= "<p class='help'>".join("</p>\n<p class='help'>", array_unique((array) $field['helps'])).'</p>';
1718 1718
 		$item .= "</td>\n\t\t</tr>\n";
1719 1719
 
1720 1720
 		$extra_rows = array();
1721 1721
 
1722
-		if ( !empty( $field['errors'] ) )
1723
-			foreach ( array_unique( (array) $field['errors'] ) as $error )
1722
+		if ( ! empty($field['errors']))
1723
+			foreach (array_unique((array) $field['errors']) as $error)
1724 1724
 				$extra_rows['error'][] = $error;
1725 1725
 
1726
-		if ( !empty( $field['extra_rows'] ) )
1727
-			foreach ( $field['extra_rows'] as $class => $rows )
1728
-				foreach ( (array) $rows as $html )
1726
+		if ( ! empty($field['extra_rows']))
1727
+			foreach ($field['extra_rows'] as $class => $rows)
1728
+				foreach ((array) $rows as $html)
1729 1729
 					$extra_rows[$class][] = $html;
1730 1730
 
1731
-		foreach ( $extra_rows as $class => $rows )
1732
-			foreach ( $rows as $html )
1731
+		foreach ($extra_rows as $class => $rows)
1732
+			foreach ($rows as $html)
1733 1733
 				$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
1734 1734
 	}
1735 1735
 
1736
-	if ( !empty( $form_fields['_final'] ) )
1736
+	if ( ! empty($form_fields['_final']))
1737 1737
 		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1738 1738
 
1739
-	if ( $item ) {
1740
-		$item = '<p class="media-types media-types-required-info">' .
1741
-			sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . '</p>
1742
-			<table class="compat-attachment-fields">' . $item . '</table>';
1739
+	if ($item) {
1740
+		$item = '<p class="media-types media-types-required-info">'.
1741
+			sprintf(__('Required fields are marked %s'), '<span class="required">*</span>').'</p>
1742
+			<table class="compat-attachment-fields">' . $item.'</table>';
1743 1743
 	}
1744 1744
 
1745
-	foreach ( $hidden_fields as $hidden_field => $value ) {
1746
-		$item .= '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
1745
+	foreach ($hidden_fields as $hidden_field => $value) {
1746
+		$item .= '<input type="hidden" name="'.esc_attr($hidden_field).'" value="'.esc_attr($value).'" />'."\n";
1747 1747
 	}
1748 1748
 
1749
-	if ( $item )
1750
-		$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
1749
+	if ($item)
1750
+		$item = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.esc_attr($post->menu_order).'" />'.$item;
1751 1751
 
1752 1752
 	return array(
1753 1753
 		'item'   => $item,
@@ -1761,10 +1761,10 @@  discard block
 block discarded – undo
1761 1761
  * @since 2.5.0
1762 1762
  */
1763 1763
 function media_upload_header() {
1764
-	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
1764
+	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
1765 1765
 
1766
-	echo '<script type="text/javascript">post_id = ' . $post_id . ';</script>';
1767
-	if ( empty( $_GET['chromeless'] ) ) {
1766
+	echo '<script type="text/javascript">post_id = '.$post_id.';</script>';
1767
+	if (empty($_GET['chromeless'])) {
1768 1768
 		echo '<div id="media-upload-header">';
1769 1769
 		the_media_upload_tabs();
1770 1770
 		echo '</div>';
@@ -1783,11 +1783,11 @@  discard block
 block discarded – undo
1783 1783
  *
1784 1784
  * @param array $errors
1785 1785
  */
1786
-function media_upload_form( $errors = null ) {
1786
+function media_upload_form($errors = null) {
1787 1787
 	global $type, $tab, $is_IE, $is_opera;
1788 1788
 
1789
-	if ( ! _device_can_upload() ) {
1790
-		echo '<p>' . sprintf( __('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/' ) . '</p>';
1789
+	if ( ! _device_can_upload()) {
1790
+		echo '<p>'.sprintf(__('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/').'</p>';
1791 1791
 		return;
1792 1792
 	}
1793 1793
 
@@ -1797,14 +1797,14 @@  discard block
 block discarded – undo
1797 1797
 	$_tab = isset($tab) ? $tab : '';
1798 1798
 
1799 1799
 	$max_upload_size = wp_max_upload_size();
1800
-	if ( ! $max_upload_size ) {
1800
+	if ( ! $max_upload_size) {
1801 1801
 		$max_upload_size = 0;
1802 1802
 	}
1803 1803
 ?>
1804 1804
 
1805 1805
 <div id="media-upload-notice"><?php
1806 1806
 
1807
-	if (isset($errors['upload_notice']) )
1807
+	if (isset($errors['upload_notice']))
1808 1808
 		echo $errors['upload_notice'];
1809 1809
 
1810 1810
 ?></div>
@@ -1815,13 +1815,13 @@  discard block
 block discarded – undo
1815 1815
 
1816 1816
 ?></div>
1817 1817
 <?php
1818
-if ( is_multisite() && !is_upload_space_available() ) {
1818
+if (is_multisite() && ! is_upload_space_available()) {
1819 1819
 	/**
1820 1820
 	 * Fires when an upload will exceed the defined upload space quota for a network site.
1821 1821
 	 *
1822 1822
 	 * @since 3.5.0
1823 1823
 	 */
1824
-	do_action( 'upload_ui_over_quota' );
1824
+	do_action('upload_ui_over_quota');
1825 1825
 	return;
1826 1826
 }
1827 1827
 
@@ -1830,7 +1830,7 @@  discard block
 block discarded – undo
1830 1830
  *
1831 1831
  * @since 2.6.0
1832 1832
  */
1833
-do_action( 'pre-upload-ui' );
1833
+do_action('pre-upload-ui');
1834 1834
 
1835 1835
 $post_params = array(
1836 1836
 	"post_id" => $post_id,
@@ -1848,7 +1848,7 @@  discard block
 block discarded – undo
1848 1848
  *
1849 1849
  * @param array $post_params An array of media upload parameters used by Plupload.
1850 1850
  */
1851
-$post_params = apply_filters( 'upload_post_params', $post_params );
1851
+$post_params = apply_filters('upload_post_params', $post_params);
1852 1852
 
1853 1853
 $plupload_init = array(
1854 1854
 	'runtimes'            => 'html5,flash,silverlight,html4',
@@ -1857,18 +1857,18 @@  discard block
 block discarded – undo
1857 1857
 	'drop_element'        => 'drag-drop-area',
1858 1858
 	'file_data_name'      => 'async-upload',
1859 1859
 	'url'                 => $upload_action_url,
1860
-	'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
1861
-	'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
1860
+	'flash_swf_url'       => includes_url('js/plupload/plupload.flash.swf'),
1861
+	'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
1862 1862
 	'filters' => array(
1863
-		'max_file_size'   => $max_upload_size . 'b',
1863
+		'max_file_size'   => $max_upload_size.'b',
1864 1864
 	),
1865 1865
 	'multipart_params'    => $post_params,
1866 1866
 );
1867 1867
 
1868 1868
 // Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos
1869 1869
 // when enabled. See #29602.
1870
-if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
1871
-	strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
1870
+if (wp_is_mobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'OS 7_') !== false &&
1871
+	strpos($_SERVER['HTTP_USER_AGENT'], 'like Mac OS X') !== false) {
1872 1872
 
1873 1873
 	$plupload_init['multi_selection'] = false;
1874 1874
 }
@@ -1880,22 +1880,22 @@  discard block
 block discarded – undo
1880 1880
  *
1881 1881
  * @param array $plupload_init An array of default settings used by Plupload.
1882 1882
  */
1883
-$plupload_init = apply_filters( 'plupload_init', $plupload_init );
1883
+$plupload_init = apply_filters('plupload_init', $plupload_init);
1884 1884
 
1885 1885
 ?>
1886 1886
 
1887 1887
 <script type="text/javascript">
1888 1888
 <?php
1889 1889
 // Verify size is an int. If not return default value.
1890
-$large_size_h = absint( get_option('large_size_h') );
1891
-if( !$large_size_h )
1890
+$large_size_h = absint(get_option('large_size_h'));
1891
+if ( ! $large_size_h)
1892 1892
 	$large_size_h = 1024;
1893
-$large_size_w = absint( get_option('large_size_w') );
1894
-if( !$large_size_w )
1893
+$large_size_w = absint(get_option('large_size_w'));
1894
+if ( ! $large_size_w)
1895 1895
 	$large_size_w = 1024;
1896 1896
 ?>
1897 1897
 var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>,
1898
-wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>;
1898
+wpUploaderInit = <?php echo wp_json_encode($plupload_init); ?>;
1899 1899
 </script>
1900 1900
 
1901 1901
 <div id="plupload-upload-ui" class="hide-if-no-js">
@@ -1906,7 +1906,7 @@  discard block
 block discarded – undo
1906 1906
  * @since 2.6.0 As 'pre-flash-upload-ui'
1907 1907
  * @since 3.3.0
1908 1908
  */
1909
-do_action( 'pre-plupload-upload-ui' ); ?>
1909
+do_action('pre-plupload-upload-ui'); ?>
1910 1910
 <div id="drag-drop-area">
1911 1911
 	<div class="drag-drop-inside">
1912 1912
 	<p class="drag-drop-info"><?php _e('Drop files here'); ?></p>
@@ -1921,7 +1921,7 @@  discard block
 block discarded – undo
1921 1921
  * @since 2.6.0 As 'post-flash-upload-ui'
1922 1922
  * @since 3.3.0
1923 1923
  */
1924
-do_action( 'post-plupload-upload-ui' ); ?>
1924
+do_action('post-plupload-upload-ui'); ?>
1925 1925
 </div>
1926 1926
 
1927 1927
 <div id="html-upload-ui" class="hide-if-js">
@@ -1931,12 +1931,12 @@  discard block
 block discarded – undo
1931 1931
 	 *
1932 1932
 	 * @since 2.6.0
1933 1933
 	 */
1934
-	do_action( 'pre-html-upload-ui' );
1934
+	do_action('pre-html-upload-ui');
1935 1935
 	?>
1936 1936
 	<p id="async-upload-wrap">
1937 1937
 		<label class="screen-reader-text" for="async-upload"><?php _e('Upload'); ?></label>
1938 1938
 		<input type="file" name="async-upload" id="async-upload" />
1939
-		<?php submit_button( __( 'Upload' ), 'primary', 'html-upload', false ); ?>
1939
+		<?php submit_button(__('Upload'), 'primary', 'html-upload', false); ?>
1940 1940
 		<a href="#" onclick="try{top.tb_remove();}catch(e){}; return false;"><?php _e('Cancel'); ?></a>
1941 1941
 	</p>
1942 1942
 	<div class="clear"></div>
@@ -1946,11 +1946,11 @@  discard block
 block discarded – undo
1946 1946
  *
1947 1947
  * @since 2.6.0
1948 1948
  */
1949
-do_action( 'post-html-upload-ui' );
1949
+do_action('post-html-upload-ui');
1950 1950
 ?>
1951 1951
 </div>
1952 1952
 
1953
-<p class="max-upload-size"><?php printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) ); ?></p>
1953
+<p class="max-upload-size"><?php printf(__('Maximum upload file size: %s.'), esc_html(size_format($max_upload_size))); ?></p>
1954 1954
 <?php
1955 1955
 
1956 1956
 	/**
@@ -1960,7 +1960,7 @@  discard block
 block discarded – undo
1960 1960
 	 *
1961 1961
 	 * @since 2.6.0
1962 1962
 	 */
1963
-	do_action( 'post-upload-ui' );
1963
+	do_action('post-upload-ui');
1964 1964
 }
1965 1965
 
1966 1966
 /**
@@ -1976,7 +1976,7 @@  discard block
 block discarded – undo
1976 1976
 
1977 1977
 	media_upload_header();
1978 1978
 
1979
-	$post_id = isset( $_REQUEST['post_id'] )? intval( $_REQUEST['post_id'] ) : 0;
1979
+	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
1980 1980
 
1981 1981
 	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
1982 1982
 
@@ -1988,21 +1988,21 @@  discard block
 block discarded – undo
1988 1988
 	 * @param string $form_action_url The media upload form action URL.
1989 1989
 	 * @param string $type            The type of media. Default 'file'.
1990 1990
 	 */
1991
-	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1991
+	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
1992 1992
 	$form_class = 'media-upload-form type-form validate';
1993 1993
 
1994
-	if ( get_user_setting('uploader') )
1994
+	if (get_user_setting('uploader'))
1995 1995
 		$form_class .= ' html-uploader';
1996 1996
 ?>
1997 1997
 
1998
-<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
1999
-<?php submit_button( '', 'hidden', 'save', false ); ?>
1998
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url($form_action_url); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
1999
+<?php submit_button('', 'hidden', 'save', false); ?>
2000 2000
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2001 2001
 <?php wp_nonce_field('media-form'); ?>
2002 2002
 
2003 2003
 <h3 class="media-title"><?php _e('Add media files from your computer'); ?></h3>
2004 2004
 
2005
-<?php media_upload_form( $errors ); ?>
2005
+<?php media_upload_form($errors); ?>
2006 2006
 
2007 2007
 <script type="text/javascript">
2008 2008
 jQuery(function($){
@@ -2015,10 +2015,10 @@  discard block
 block discarded – undo
2015 2015
 </script>
2016 2016
 <div id="media-items"><?php
2017 2017
 
2018
-if ( $id ) {
2019
-	if ( !is_wp_error($id) ) {
2018
+if ($id) {
2019
+	if ( ! is_wp_error($id)) {
2020 2020
 		add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
2021
-		echo get_media_items( $id, $errors );
2021
+		echo get_media_items($id, $errors);
2022 2022
 	} else {
2023 2023
 		echo '<div id="media-upload-error">'.esc_html($id->get_error_message()).'</div></div>';
2024 2024
 		exit;
@@ -2027,7 +2027,7 @@  discard block
 block discarded – undo
2027 2027
 ?></div>
2028 2028
 
2029 2029
 <p class="savebutton ml-submit">
2030
-<?php submit_button( __( 'Save all changes' ), 'button', 'save', false ); ?>
2030
+<?php submit_button(__('Save all changes'), 'button', 'save', false); ?>
2031 2031
 </p>
2032 2032
 </form>
2033 2033
 <?php
@@ -2043,23 +2043,23 @@  discard block
 block discarded – undo
2043 2043
  * @param integer $id
2044 2044
  */
2045 2045
 function media_upload_type_url_form($type = null, $errors = null, $id = null) {
2046
-	if ( null === $type )
2046
+	if (null === $type)
2047 2047
 		$type = 'image';
2048 2048
 
2049 2049
 	media_upload_header();
2050 2050
 
2051
-	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2051
+	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
2052 2052
 
2053 2053
 	$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
2054 2054
 	/** This filter is documented in wp-admin/includes/media.php */
2055
-	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2055
+	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
2056 2056
 	$form_class = 'media-upload-form type-form validate';
2057 2057
 
2058
-	if ( get_user_setting('uploader') )
2058
+	if (get_user_setting('uploader'))
2059 2059
 		$form_class .= ' html-uploader';
2060 2060
 ?>
2061 2061
 
2062
-<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
2062
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url($form_action_url); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
2063 2063
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2064 2064
 <?php wp_nonce_field('media-form'); ?>
2065 2065
 
@@ -2083,7 +2083,7 @@  discard block
 block discarded – undo
2083 2083
 
2084 2084
 <?php
2085 2085
 	/** This filter is documented in wp-admin/includes/media.php */
2086
-	if ( ! apply_filters( 'disable_captions', '' ) ) {
2086
+	if ( ! apply_filters('disable_captions', '')) {
2087 2087
 		?>
2088 2088
 		if ( f.caption.value ) {
2089 2089
 			caption = f.caption.value.replace(/\r\n|\r/g, '\n');
@@ -2119,7 +2119,7 @@  discard block
 block discarded – undo
2119 2119
 		document.getElementById('go_button').style.color = '#bbb';
2120 2120
 		if ( ! document.forms[0].src.value )
2121 2121
 			document.getElementById('status_img').innerHTML = '';
2122
-		else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/no.png' ) ); ?>" alt="" />';
2122
+		else document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url(admin_url('images/no.png')); ?>" alt="" />';
2123 2123
 	},
2124 2124
 
2125 2125
 	updateImageData : function() {
@@ -2128,7 +2128,7 @@  discard block
 block discarded – undo
2128 2128
 		t.width = t.preloadImg.width;
2129 2129
 		t.height = t.preloadImg.height;
2130 2130
 		document.getElementById('go_button').style.color = '#333';
2131
-		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/yes.png' ) ); ?>" alt="" />';
2131
+		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url(admin_url('images/yes.png')); ?>" alt="" />';
2132 2132
 	},
2133 2133
 
2134 2134
 	getImageData : function() {
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 			return false;
2143 2143
 		}
2144 2144
 
2145
-		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url( admin_url( 'images/spinner-2x.gif' ) ); ?>" alt="" width="16" height="16" />';
2145
+		document.getElementById('status_img').innerHTML = '<img src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="" width="16" height="16" />';
2146 2146
 		t.preloadImg = new Image();
2147 2147
 		t.preloadImg.onload = t.updateImageData;
2148 2148
 		t.preloadImg.onerror = t.resetImageData;
@@ -2167,7 +2167,7 @@  discard block
 block discarded – undo
2167 2167
  *
2168 2168
  * @param string $form_html The insert from URL form HTML.
2169 2169
  */
2170
-echo apply_filters( 'type_url_form_media', wp_media_insert_url_form( $type ) );
2170
+echo apply_filters('type_url_form_media', wp_media_insert_url_form($type));
2171 2171
 ?>
2172 2172
 </div>
2173 2173
 </div>
@@ -2195,10 +2195,10 @@  discard block
 block discarded – undo
2195 2195
 	$post_id = intval($_REQUEST['post_id']);
2196 2196
 	$form_action_url = admin_url("media-upload.php?type=$type&tab=gallery&post_id=$post_id");
2197 2197
 	/** This filter is documented in wp-admin/includes/media.php */
2198
-	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2198
+	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
2199 2199
 	$form_class = 'media-upload-form validate';
2200 2200
 
2201
-	if ( get_user_setting('uploader') )
2201
+	if (get_user_setting('uploader'))
2202 2202
 		$form_class .= ' html-uploader';
2203 2203
 ?>
2204 2204
 
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
 <a href="#" id="desc"><?php _e('Descending'); ?></a> |
2223 2223
 <a href="#" id="clear"><?php _ex('Clear', 'verb'); ?></a>
2224 2224
 </div>
2225
-<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
2225
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url($form_action_url); ?>" class="<?php echo $form_class; ?>" id="gallery-form">
2226 2226
 <?php wp_nonce_field('media-form'); ?>
2227 2227
 <?php //media_upload_form( $errors ); ?>
2228 2228
 <table class="widefat">
@@ -2238,10 +2238,10 @@  discard block
 block discarded – undo
2238 2238
 </div>
2239 2239
 
2240 2240
 <p class="ml-submit">
2241
-<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false, array( 'id' => 'save-all', 'style' => 'display: none;' ) ); ?>
2241
+<?php submit_button(__('Save all changes'), 'button savebutton', 'save', false, array('id' => 'save-all', 'style' => 'display: none;')); ?>
2242 2242
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2243
-<input type="hidden" name="type" value="<?php echo esc_attr( $GLOBALS['type'] ); ?>" />
2244
-<input type="hidden" name="tab" value="<?php echo esc_attr( $GLOBALS['tab'] ); ?>" />
2243
+<input type="hidden" name="type" value="<?php echo esc_attr($GLOBALS['type']); ?>" />
2244
+<input type="hidden" name="tab" value="<?php echo esc_attr($GLOBALS['tab']); ?>" />
2245 2245
 </p>
2246 2246
 
2247 2247
 <div id="gallery-settings" style="display:none;">
@@ -2316,8 +2316,8 @@  discard block
 block discarded – undo
2316 2316
 </tbody></table>
2317 2317
 
2318 2318
 <p class="ml-submit">
2319
-<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e( 'Insert gallery' ); ?>" />
2320
-<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e( 'Update gallery settings' ); ?>" />
2319
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="insert-gallery" id="insert-gallery" value="<?php esc_attr_e('Insert gallery'); ?>" />
2320
+<input type="button" class="button" style="display:none;" onMouseDown="wpgallery.update();" name="update-gallery" id="update-gallery" value="<?php esc_attr_e('Update gallery settings'); ?>" />
2321 2321
 </p>
2322 2322
 </div>
2323 2323
 </form>
@@ -2343,42 +2343,42 @@  discard block
 block discarded – undo
2343 2343
 
2344 2344
 	media_upload_header();
2345 2345
 
2346
-	$post_id = isset( $_REQUEST['post_id'] ) ? intval( $_REQUEST['post_id'] ) : 0;
2346
+	$post_id = isset($_REQUEST['post_id']) ? intval($_REQUEST['post_id']) : 0;
2347 2347
 
2348 2348
 	$form_action_url = admin_url("media-upload.php?type=$type&tab=library&post_id=$post_id");
2349 2349
 	/** This filter is documented in wp-admin/includes/media.php */
2350
-	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2350
+	$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
2351 2351
 	$form_class = 'media-upload-form validate';
2352 2352
 
2353
-	if ( get_user_setting('uploader') )
2353
+	if (get_user_setting('uploader'))
2354 2354
 		$form_class .= ' html-uploader';
2355 2355
 
2356 2356
 	$q = $_GET;
2357 2357
 	$q['posts_per_page'] = 10;
2358
-	$q['paged'] = isset( $q['paged'] ) ? intval( $q['paged'] ) : 0;
2359
-	if ( $q['paged'] < 1 ) {
2358
+	$q['paged'] = isset($q['paged']) ? intval($q['paged']) : 0;
2359
+	if ($q['paged'] < 1) {
2360 2360
 		$q['paged'] = 1;
2361 2361
 	}
2362
-	$q['offset'] = ( $q['paged'] - 1 ) * 10;
2363
-	if ( $q['offset'] < 1 ) {
2362
+	$q['offset'] = ($q['paged'] - 1) * 10;
2363
+	if ($q['offset'] < 1) {
2364 2364
 		$q['offset'] = 0;
2365 2365
 	}
2366 2366
 
2367
-	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query( $q );
2367
+	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query($q);
2368 2368
 
2369 2369
 ?>
2370 2370
 
2371 2371
 <form id="filter" method="get">
2372
-<input type="hidden" name="type" value="<?php echo esc_attr( $type ); ?>" />
2373
-<input type="hidden" name="tab" value="<?php echo esc_attr( $tab ); ?>" />
2372
+<input type="hidden" name="type" value="<?php echo esc_attr($type); ?>" />
2373
+<input type="hidden" name="tab" value="<?php echo esc_attr($tab); ?>" />
2374 2374
 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" />
2375
-<input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? esc_attr( $_GET['post_mime_type'] ) : ''; ?>" />
2376
-<input type="hidden" name="context" value="<?php echo isset( $_GET['context'] ) ? esc_attr( $_GET['context'] ) : ''; ?>" />
2375
+<input type="hidden" name="post_mime_type" value="<?php echo isset($_GET['post_mime_type']) ? esc_attr($_GET['post_mime_type']) : ''; ?>" />
2376
+<input type="hidden" name="context" value="<?php echo isset($_GET['context']) ? esc_attr($_GET['context']) : ''; ?>" />
2377 2377
 
2378 2378
 <p id="media-search" class="search-box">
2379
-	<label class="screen-reader-text" for="media-search-input"><?php _e('Search Media');?>:</label>
2379
+	<label class="screen-reader-text" for="media-search-input"><?php _e('Search Media'); ?>:</label>
2380 2380
 	<input type="search" id="media-search-input" name="s" value="<?php the_search_query(); ?>" />
2381
-	<?php submit_button( __( 'Search Media' ), 'button', '', false ); ?>
2381
+	<?php submit_button(__('Search Media'), 'button', '', false); ?>
2382 2382
 </p>
2383 2383
 
2384 2384
 <ul class="subsubsub">
@@ -2386,32 +2386,32 @@  discard block
 block discarded – undo
2386 2386
 $type_links = array();
2387 2387
 $_num_posts = (array) wp_count_attachments();
2388 2388
 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
2389
-foreach ( $matches as $_type => $reals )
2390
-	foreach ( $reals as $real )
2391
-		if ( isset($num_posts[$_type]) )
2389
+foreach ($matches as $_type => $reals)
2390
+	foreach ($reals as $real)
2391
+		if (isset($num_posts[$_type]))
2392 2392
 			$num_posts[$_type] += $_num_posts[$real];
2393 2393
 		else
2394 2394
 			$num_posts[$_type] = $_num_posts[$real];
2395 2395
 // If available type specified by media button clicked, filter by that type
2396
-if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
2396
+if (empty($_GET['post_mime_type']) && ! empty($num_posts[$type])) {
2397 2397
 	$_GET['post_mime_type'] = $type;
2398 2398
 	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
2399 2399
 }
2400
-if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
2400
+if (empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all')
2401 2401
 	$class = ' class="current"';
2402 2402
 else
2403 2403
 	$class = '';
2404
-$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . '"' . $class . '>' . __('All Types') . '</a>';
2405
-foreach ( $post_mime_types as $mime_type => $label ) {
2404
+$type_links[] = '<li><a href="'.esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))).'"'.$class.'>'.__('All Types').'</a>';
2405
+foreach ($post_mime_types as $mime_type => $label) {
2406 2406
 	$class = '';
2407 2407
 
2408
-	if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
2408
+	if ( ! wp_match_mime_types($mime_type, $avail_post_mime_types))
2409 2409
 		continue;
2410 2410
 
2411
-	if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
2411
+	if (isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']))
2412 2412
 		$class = ' class="current"';
2413 2413
 
2414
-	$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
2414
+	$type_links[] = '<li><a href="'.esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))).'"'.$class.'>'.sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), '<span id="'.$mime_type.'-counter">'.number_format_i18n($num_posts[$mime_type]).'</span>').'</a>';
2415 2415
 }
2416 2416
 /**
2417 2417
  * Filter the media upload mime type list items.
@@ -2422,7 +2422,7 @@  discard block
 block discarded – undo
2422 2422
  *
2423 2423
  * @param array $type_links An array of list items containing mime type link HTML.
2424 2424
  */
2425
-echo implode(' | </li>', apply_filters( 'media_upload_mime_type_links', $type_links ) ) . '</li>';
2425
+echo implode(' | </li>', apply_filters('media_upload_mime_type_links', $type_links)).'</li>';
2426 2426
 unset($type_links);
2427 2427
 ?>
2428 2428
 </ul>
@@ -2430,8 +2430,8 @@  discard block
 block discarded – undo
2430 2430
 <div class="tablenav">
2431 2431
 
2432 2432
 <?php
2433
-$page_links = paginate_links( array(
2434
-	'base' => add_query_arg( 'paged', '%#%' ),
2433
+$page_links = paginate_links(array(
2434
+	'base' => add_query_arg('paged', '%#%'),
2435 2435
 	'format' => '',
2436 2436
 	'prev_text' => __('&laquo;'),
2437 2437
 	'next_text' => __('&raquo;'),
@@ -2439,7 +2439,7 @@  discard block
 block discarded – undo
2439 2439
 	'current' => $q['paged'],
2440 2440
 ));
2441 2441
 
2442
-if ( $page_links )
2442
+if ($page_links)
2443 2443
 	echo "<div class='tablenav-pages'>$page_links</div>";
2444 2444
 ?>
2445 2445
 
@@ -2448,34 +2448,34 @@  discard block
 block discarded – undo
2448 2448
 
2449 2449
 $arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
2450 2450
 
2451
-$arc_result = $wpdb->get_results( $arc_query );
2451
+$arc_result = $wpdb->get_results($arc_query);
2452 2452
 
2453 2453
 $month_count = count($arc_result);
2454
-$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;
2454
+$selected_month = isset($_GET['m']) ? $_GET['m'] : 0;
2455 2455
 
2456
-if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { ?>
2456
+if ($month_count && ! (1 == $month_count && 0 == $arc_result[0]->mmonth)) { ?>
2457 2457
 <select name='m'>
2458
-<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
2458
+<option<?php selected($selected_month, 0); ?> value='0'><?php _e('All dates'); ?></option>
2459 2459
 <?php
2460 2460
 foreach ($arc_result as $arc_row) {
2461
-	if ( $arc_row->yyear == 0 )
2461
+	if ($arc_row->yyear == 0)
2462 2462
 		continue;
2463
-	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
2463
+	$arc_row->mmonth = zeroise($arc_row->mmonth, 2);
2464 2464
 
2465
-	if ( $arc_row->yyear . $arc_row->mmonth == $selected_month )
2465
+	if ($arc_row->yyear.$arc_row->mmonth == $selected_month)
2466 2466
 		$default = ' selected="selected"';
2467 2467
 	else
2468 2468
 		$default = '';
2469 2469
 
2470
-	echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
2471
-	echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
2470
+	echo "<option$default value='".esc_attr($arc_row->yyear.$arc_row->mmonth)."'>";
2471
+	echo esc_html($wp_locale->get_month($arc_row->mmonth)." $arc_row->yyear");
2472 2472
 	echo "</option>\n";
2473 2473
 }
2474 2474
 ?>
2475 2475
 </select>
2476 2476
 <?php } ?>
2477 2477
 
2478
-<?php submit_button( __( 'Filter &#187;' ), 'button', 'post-query-submit', false ); ?>
2478
+<?php submit_button(__('Filter &#187;'), 'button', 'post-query-submit', false); ?>
2479 2479
 
2480 2480
 </div>
2481 2481
 
@@ -2483,7 +2483,7 @@  discard block
 block discarded – undo
2483 2483
 </div>
2484 2484
 </form>
2485 2485
 
2486
-<form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="library-form">
2486
+<form enctype="multipart/form-data" method="post" action="<?php echo esc_url($form_action_url); ?>" class="<?php echo $form_class; ?>" id="library-form">
2487 2487
 
2488 2488
 <?php wp_nonce_field('media-form'); ?>
2489 2489
 <?php //media_upload_form( $errors ); ?>
@@ -2505,7 +2505,7 @@  discard block
 block discarded – undo
2505 2505
 <?php echo get_media_items(null, $errors); ?>
2506 2506
 </div>
2507 2507
 <p class="ml-submit">
2508
-<?php submit_button( __( 'Save all changes' ), 'button savebutton', 'save', false ); ?>
2508
+<?php submit_button(__('Save all changes'), 'button savebutton', 'save', false); ?>
2509 2509
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
2510 2510
 </p>
2511 2511
 </form>
@@ -2520,13 +2520,13 @@  discard block
 block discarded – undo
2520 2520
  * @param string $default_view
2521 2521
  * @return string the form html
2522 2522
  */
2523
-function wp_media_insert_url_form( $default_view = 'image' ) {
2523
+function wp_media_insert_url_form($default_view = 'image') {
2524 2524
 	/** This filter is documented in wp-admin/includes/media.php */
2525
-	if ( ! apply_filters( 'disable_captions', '' ) ) {
2525
+	if ( ! apply_filters('disable_captions', '')) {
2526 2526
 		$caption = '
2527 2527
 		<tr class="image-only">
2528 2528
 			<th scope="row" class="label">
2529
-				<label for="caption"><span class="alignleft">' . __('Image Caption') . '</span></label>
2529
+				<label for="caption"><span class="alignleft">' . __('Image Caption').'</span></label>
2530 2530
 			</th>
2531 2531
 			<td class="field"><textarea id="caption" name="caption"></textarea></td>
2532 2532
 		</tr>
@@ -2536,10 +2536,10 @@  discard block
 block discarded – undo
2536 2536
 	}
2537 2537
 
2538 2538
 	$default_align = get_option('image_default_align');
2539
-	if ( empty($default_align) )
2539
+	if (empty($default_align))
2540 2540
 		$default_align = 'none';
2541 2541
 
2542
-	if ( 'image' == $default_view ) {
2542
+	if ('image' == $default_view) {
2543 2543
 		$view = 'image-only';
2544 2544
 		$table_class = '';
2545 2545
 	} else {
@@ -2547,12 +2547,12 @@  discard block
 block discarded – undo
2547 2547
 	}
2548 2548
 
2549 2549
 	return '
2550
-	<p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked( 'image-only', $view, false ) . ' /> ' . __( 'Image' ) . '</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"' . checked( 'not-image', $view, false ) . ' /> ' . __( 'Audio, Video, or Other File' ) . '</label></p>
2551
-	<p class="media-types media-types-required-info">' . sprintf( __( 'Required fields are marked %s' ), '<span class="required">*</span>' ) . '</p>
2552
-	<table class="describe ' . $table_class . '"><tbody>
2550
+	<p class="media-types"><label><input type="radio" name="media_type" value="image" id="image-only"' . checked('image-only', $view, false).' /> '.__('Image').'</label> &nbsp; &nbsp; <label><input type="radio" name="media_type" value="generic" id="not-image"'.checked('not-image', $view, false).' /> '.__('Audio, Video, or Other File').'</label></p>
2551
+	<p class="media-types media-types-required-info">' . sprintf(__('Required fields are marked %s'), '<span class="required">*</span>').'</p>
2552
+	<table class="describe ' . $table_class.'"><tbody>
2553 2553
 		<tr>
2554 2554
 			<th scope="row" class="label" style="width:130px;">
2555
-				<label for="src"><span class="alignleft">' . __( 'URL' ) . '</span> <span class="required">*</span></label>
2555
+				<label for="src"><span class="alignleft">' . __('URL').'</span> <span class="required">*</span></label>
2556 2556
 				<span class="alignright" id="status_img"></span>
2557 2557
 			</th>
2558 2558
 			<td class="field"><input id="src" name="src" value="" type="text" required aria-required="true" onblur="addExtImage.getImageData()" /></td>
@@ -2560,55 +2560,55 @@  discard block
 block discarded – undo
2560 2560
 
2561 2561
 		<tr>
2562 2562
 			<th scope="row" class="label">
2563
-				<label for="title"><span class="alignleft">' . __( 'Title' ) . '</span> <span class="required">*</span></label>
2563
+				<label for="title"><span class="alignleft">' . __('Title').'</span> <span class="required">*</span></label>
2564 2564
 			</th>
2565 2565
 			<td class="field"><input id="title" name="title" value="" type="text" required aria-required="true" /></td>
2566 2566
 		</tr>
2567 2567
 
2568
-		<tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;') . '</p></td></tr>
2568
+		<tr class="not-image"><td></td><td><p class="help">' . __('Link text, e.g. &#8220;Ransom Demands (PDF)&#8221;').'</p></td></tr>
2569 2569
 
2570 2570
 		<tr class="image-only">
2571 2571
 			<th scope="row" class="label">
2572
-				<label for="alt"><span class="alignleft">' . __('Alternative Text') . '</span></label>
2572
+				<label for="alt"><span class="alignleft">' . __('Alternative Text').'</span></label>
2573 2573
 			</th>
2574 2574
 			<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
2575
-			<p class="help">' . __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;') . '</p></td>
2575
+			<p class="help">' . __('Alt text for the image, e.g. &#8220;The Mona Lisa&#8221;').'</p></td>
2576 2576
 		</tr>
2577
-		' . $caption . '
2577
+		' . $caption.'
2578 2578
 		<tr class="align image-only">
2579
-			<th scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
2579
+			<th scope="row" class="label"><p><label for="align">' . __('Alignment').'</label></p></th>
2580 2580
 			<td class="field">
2581 2581
 				<input name="align" id="align-none" value="none" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'none' ? ' checked="checked"' : '').' />
2582
-				<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
2582
+				<label for="align-none" class="align image-align-none-label">' . __('None').'</label>
2583 2583
 				<input name="align" id="align-left" value="left" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'left' ? ' checked="checked"' : '').' />
2584
-				<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
2584
+				<label for="align-left" class="align image-align-left-label">' . __('Left').'</label>
2585 2585
 				<input name="align" id="align-center" value="center" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'center' ? ' checked="checked"' : '').' />
2586
-				<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
2586
+				<label for="align-center" class="align image-align-center-label">' . __('Center').'</label>
2587 2587
 				<input name="align" id="align-right" value="right" onclick="addExtImage.align=\'align\'+this.value" type="radio"' . ($default_align == 'right' ? ' checked="checked"' : '').' />
2588
-				<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
2588
+				<label for="align-right" class="align image-align-right-label">' . __('Right').'</label>
2589 2589
 			</td>
2590 2590
 		</tr>
2591 2591
 
2592 2592
 		<tr class="image-only">
2593 2593
 			<th scope="row" class="label">
2594
-				<label for="url"><span class="alignleft">' . __('Link Image To:') . '</span></label>
2594
+				<label for="url"><span class="alignleft">' . __('Link Image To:').'</span></label>
2595 2595
 			</th>
2596 2596
 			<td class="field"><input id="url" name="url" value="" type="text" /><br />
2597 2597
 
2598
-			<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
2599
-			<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
2600
-			<p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
2598
+			<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None').'</button>
2599
+			<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image').'</button>
2600
+			<p class="help">' . __('Enter a link URL or click above for presets.').'</p></td>
2601 2601
 		</tr>
2602 2602
 		<tr class="image-only">
2603 2603
 			<td></td>
2604 2604
 			<td>
2605
-				<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post') . '" />
2605
+				<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . esc_attr__('Insert into Post').'" />
2606 2606
 			</td>
2607 2607
 		</tr>
2608 2608
 		<tr class="not-image">
2609 2609
 			<td></td>
2610 2610
 			<td>
2611
-				' . get_submit_button( __( 'Insert into Post' ), 'button', 'insertonlybutton', false ) . '
2611
+				' . get_submit_button(__('Insert into Post'), 'button', 'insertonlybutton', false).'
2612 2612
 			</td>
2613 2613
 		</tr>
2614 2614
 	</tbody></table>
@@ -2624,16 +2624,16 @@  discard block
 block discarded – undo
2624 2624
  * @global int $post_ID
2625 2625
  */
2626 2626
 function media_upload_flash_bypass() {
2627
-	$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
2627
+	$browser_uploader = admin_url('media-new.php?browser-uploader');
2628 2628
 
2629
-	if ( $post = get_post() )
2630
-		$browser_uploader .= '&amp;post_id=' . intval( $post->ID );
2631
-	elseif ( ! empty( $GLOBALS['post_ID'] ) )
2632
-		$browser_uploader .= '&amp;post_id=' . intval( $GLOBALS['post_ID'] );
2629
+	if ($post = get_post())
2630
+		$browser_uploader .= '&amp;post_id='.intval($post->ID);
2631
+	elseif ( ! empty($GLOBALS['post_ID']))
2632
+		$browser_uploader .= '&amp;post_id='.intval($GLOBALS['post_ID']);
2633 2633
 
2634 2634
 	?>
2635 2635
 	<p class="upload-flash-bypass">
2636
-	<?php printf( __( 'You are using the multi-file uploader. Problems? Try the <a href="%1$s" target="%2$s">browser uploader</a> instead.' ), $browser_uploader, '_blank' ); ?>
2636
+	<?php printf(__('You are using the multi-file uploader. Problems? Try the <a href="%1$s" target="%2$s">browser uploader</a> instead.'), $browser_uploader, '_blank'); ?>
2637 2637
 	</p>
2638 2638
 	<?php
2639 2639
 }
@@ -2667,8 +2667,8 @@  discard block
 block discarded – undo
2667 2667
 	$checked = get_user_setting('upload_resize') ? ' checked="true"' : '';
2668 2668
 	$a = $end = '';
2669 2669
 
2670
-	if ( current_user_can( 'manage_options' ) ) {
2671
-		$a = '<a href="' . esc_url( admin_url( 'options-media.php' ) ) . '" target="_blank">';
2670
+	if (current_user_can('manage_options')) {
2671
+		$a = '<a href="'.esc_url(admin_url('options-media.php')).'" target="_blank">';
2672 2672
 		$end = '</a>';
2673 2673
 	}
2674 2674
 ?>
@@ -2676,7 +2676,7 @@  discard block
 block discarded – undo
2676 2676
 <input name="image_resize" type="checkbox" id="image_resize" value="true"<?php echo $checked; ?> />
2677 2677
 <?php
2678 2678
 	/* translators: %1$s is link start tag, %2$s is link end tag, %3$d is width, %4$d is height*/
2679
-	printf( __( 'Scale images to match the large size selected in %1$simage options%2$s (%3$d &times; %4$d).' ), $a, $end, (int) get_option( 'large_size_w', '1024' ), (int) get_option( 'large_size_h', '1024' ) );
2679
+	printf(__('Scale images to match the large size selected in %1$simage options%2$s (%3$d &times; %4$d).'), $a, $end, (int) get_option('large_size_w', '1024'), (int) get_option('large_size_h', '1024'));
2680 2680
 ?>
2681 2681
 </label></p>
2682 2682
 <?php
@@ -2688,7 +2688,7 @@  discard block
 block discarded – undo
2688 2688
  * @since 3.5.0
2689 2689
  */
2690 2690
 function multisite_over_quota_message() {
2691
-	echo '<p>' . sprintf( __( 'Sorry, you have used all of your storage quota of %s MB.' ), get_space_allowed() ) . '</p>';
2691
+	echo '<p>'.sprintf(__('Sorry, you have used all of your storage quota of %s MB.'), get_space_allowed()).'</p>';
2692 2692
 }
2693 2693
 
2694 2694
 /**
@@ -2698,86 +2698,86 @@  discard block
 block discarded – undo
2698 2698
  *
2699 2699
  * @param WP_Post $post A post object.
2700 2700
  */
2701
-function edit_form_image_editor( $post ) {
2702
-	$open = isset( $_GET['image-editor'] );
2703
-	if ( $open )
2704
-		require_once ABSPATH . 'wp-admin/includes/image-edit.php';
2701
+function edit_form_image_editor($post) {
2702
+	$open = isset($_GET['image-editor']);
2703
+	if ($open)
2704
+		require_once ABSPATH.'wp-admin/includes/image-edit.php';
2705 2705
 
2706 2706
 	$thumb_url = false;
2707
-	if ( $attachment_id = intval( $post->ID ) )
2708
-		$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
2707
+	if ($attachment_id = intval($post->ID))
2708
+		$thumb_url = wp_get_attachment_image_src($attachment_id, array(900, 450), true);
2709 2709
 
2710
-	$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
2710
+	$alt_text = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
2711 2711
 
2712
-	$att_url = wp_get_attachment_url( $post->ID ); ?>
2712
+	$att_url = wp_get_attachment_url($post->ID); ?>
2713 2713
 	<div class="wp_attachment_holder wp-clearfix">
2714 2714
 	<?php
2715
-	if ( wp_attachment_is_image( $post->ID ) ) :
2715
+	if (wp_attachment_is_image($post->ID)) :
2716 2716
 		$image_edit_button = '';
2717
-		if ( wp_image_editor_supports( array( 'mime_type' => $post->post_mime_type ) ) ) {
2718
-			$nonce = wp_create_nonce( "image_editor-$post->ID" );
2719
-			$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='" . esc_attr__( 'Edit Image' ) . "' /> <span class='spinner'></span>";
2717
+		if (wp_image_editor_supports(array('mime_type' => $post->post_mime_type))) {
2718
+			$nonce = wp_create_nonce("image_editor-$post->ID");
2719
+			$image_edit_button = "<input type='button' id='imgedit-open-btn-$post->ID' onclick='imageEdit.open( $post->ID, \"$nonce\" )' class='button' value='".esc_attr__('Edit Image')."' /> <span class='spinner'></span>";
2720 2720
 		}
2721 2721
 	?>
2722 2722
 
2723 2723
 		<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
2724 2724
 
2725
-		<div<?php if ( $open ) echo ' style="display:none"'; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
2726
-			<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
2725
+		<div<?php if ($open) echo ' style="display:none"'; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
2726
+			<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme($thumb_url[0]); ?>" style="max-width:100%" alt="" /></p>
2727 2727
 			<p><?php echo $image_edit_button; ?></p>
2728 2728
 		</div>
2729
-		<div<?php if ( ! $open ) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
2730
-			<?php if ( $open ) wp_image_editor( $attachment_id ); ?>
2729
+		<div<?php if ( ! $open) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
2730
+			<?php if ($open) wp_image_editor($attachment_id); ?>
2731 2731
 		</div>
2732 2732
 	<?php
2733
-	elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ):
2733
+	elseif ($attachment_id && wp_attachment_is('audio', $post)):
2734 2734
 
2735
-		wp_maybe_generate_attachment_metadata( $post );
2735
+		wp_maybe_generate_attachment_metadata($post);
2736 2736
 
2737
-		echo wp_audio_shortcode( array( 'src' => $att_url ) );
2737
+		echo wp_audio_shortcode(array('src' => $att_url));
2738 2738
 
2739
-	elseif ( $attachment_id && wp_attachment_is( 'video', $post ) ):
2739
+	elseif ($attachment_id && wp_attachment_is('video', $post)):
2740 2740
 
2741
-		wp_maybe_generate_attachment_metadata( $post );
2741
+		wp_maybe_generate_attachment_metadata($post);
2742 2742
 
2743
-		$meta = wp_get_attachment_metadata( $attachment_id );
2744
-		$w = ! empty( $meta['width'] ) ? min( $meta['width'], 640 ) : 0;
2745
-		$h = ! empty( $meta['height'] ) ? $meta['height'] : 0;
2746
-		if ( $h && $w < $meta['width'] ) {
2747
-			$h = round( ( $meta['height'] * $w ) / $meta['width'] );
2743
+		$meta = wp_get_attachment_metadata($attachment_id);
2744
+		$w = ! empty($meta['width']) ? min($meta['width'], 640) : 0;
2745
+		$h = ! empty($meta['height']) ? $meta['height'] : 0;
2746
+		if ($h && $w < $meta['width']) {
2747
+			$h = round(($meta['height'] * $w) / $meta['width']);
2748 2748
 		}
2749 2749
 
2750
-		$attr = array( 'src' => $att_url );
2751
-		if ( ! empty( $w ) && ! empty( $h ) ) {
2750
+		$attr = array('src' => $att_url);
2751
+		if ( ! empty($w) && ! empty($h)) {
2752 2752
 			$attr['width'] = $w;
2753 2753
 			$attr['height'] = $h;
2754 2754
 		}
2755 2755
 
2756
-		$thumb_id = get_post_thumbnail_id( $attachment_id );
2757
-		if ( ! empty( $thumb_id ) ) {
2758
-			$attr['poster'] = wp_get_attachment_url( $thumb_id );
2756
+		$thumb_id = get_post_thumbnail_id($attachment_id);
2757
+		if ( ! empty($thumb_id)) {
2758
+			$attr['poster'] = wp_get_attachment_url($thumb_id);
2759 2759
 		}
2760 2760
 
2761
-		echo wp_video_shortcode( $attr );
2761
+		echo wp_video_shortcode($attr);
2762 2762
 
2763 2763
 	endif; ?>
2764 2764
 	</div>
2765 2765
 	<div class="wp_attachment_details edit-form-section">
2766 2766
 		<p>
2767
-			<label for="attachment_caption"><strong><?php _e( 'Caption' ); ?></strong></label><br />
2767
+			<label for="attachment_caption"><strong><?php _e('Caption'); ?></strong></label><br />
2768 2768
 			<textarea class="widefat" name="excerpt" id="attachment_caption"><?php echo $post->post_excerpt; ?></textarea>
2769 2769
 		</p>
2770 2770
 
2771 2771
 
2772
-	<?php if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) : ?>
2772
+	<?php if ('image' === substr($post->post_mime_type, 0, 5)) : ?>
2773 2773
 		<p>
2774
-			<label for="attachment_alt"><strong><?php _e( 'Alternative Text' ); ?></strong></label><br />
2775
-			<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php echo esc_attr( $alt_text ); ?>" />
2774
+			<label for="attachment_alt"><strong><?php _e('Alternative Text'); ?></strong></label><br />
2775
+			<input type="text" class="widefat" name="_wp_attachment_image_alt" id="attachment_alt" value="<?php echo esc_attr($alt_text); ?>" />
2776 2776
 		</p>
2777 2777
 	<?php endif; ?>
2778 2778
 
2779 2779
 	<?php
2780
-		$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
2780
+		$quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
2781 2781
 		$editor_args = array(
2782 2782
 			'textarea_name' => 'content',
2783 2783
 			'textarea_rows' => 5,
@@ -2787,17 +2787,17 @@  discard block
 block discarded – undo
2787 2787
 		);
2788 2788
 	?>
2789 2789
 
2790
-	<label for="attachment_content"><strong><?php _e( 'Description' ); ?></strong><?php
2791
-	if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
2792
-		echo ': ' . __( 'Displayed on attachment pages.' );
2790
+	<label for="attachment_content"><strong><?php _e('Description'); ?></strong><?php
2791
+	if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
2792
+		echo ': '.__('Displayed on attachment pages.');
2793 2793
 	} ?></label>
2794
-	<?php wp_editor( $post->post_content, 'attachment_content', $editor_args ); ?>
2794
+	<?php wp_editor($post->post_content, 'attachment_content', $editor_args); ?>
2795 2795
 
2796 2796
 	</div>
2797 2797
 	<?php
2798
-	$extras = get_compat_media_markup( $post->ID );
2798
+	$extras = get_compat_media_markup($post->ID);
2799 2799
 	echo $extras['item'];
2800
-	echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />' . "\n";
2800
+	echo '<input type="hidden" id="image-edit-context" value="edit-attachment" />'."\n";
2801 2801
 }
2802 2802
 
2803 2803
 /**
@@ -2808,37 +2808,37 @@  discard block
 block discarded – undo
2808 2808
 function attachment_submitbox_metadata() {
2809 2809
 	$post = get_post();
2810 2810
 
2811
-	$file = get_attached_file( $post->ID );
2812
-	$filename = esc_html( wp_basename( $file ) );
2811
+	$file = get_attached_file($post->ID);
2812
+	$filename = esc_html(wp_basename($file));
2813 2813
 
2814 2814
 	$media_dims = '';
2815
-	$meta = wp_get_attachment_metadata( $post->ID );
2816
-	if ( isset( $meta['width'], $meta['height'] ) )
2815
+	$meta = wp_get_attachment_metadata($post->ID);
2816
+	if (isset($meta['width'], $meta['height']))
2817 2817
 		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
2818 2818
 	/** This filter is documented in wp-admin/includes/media.php */
2819
-	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
2819
+	$media_dims = apply_filters('media_meta', $media_dims, $post);
2820 2820
 
2821
-	$att_url = wp_get_attachment_url( $post->ID );
2821
+	$att_url = wp_get_attachment_url($post->ID);
2822 2822
 ?>
2823 2823
 	<div class="misc-pub-section misc-pub-attachment">
2824
-		<label for="attachment_url"><?php _e( 'File URL:' ); ?></label>
2825
-		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr( $att_url ); ?>" />
2824
+		<label for="attachment_url"><?php _e('File URL:'); ?></label>
2825
+		<input type="text" class="widefat urlfield" readonly="readonly" name="attachment_url" id="attachment_url" value="<?php echo esc_attr($att_url); ?>" />
2826 2826
 	</div>
2827 2827
 	<div class="misc-pub-section misc-pub-filename">
2828
-		<?php _e( 'File name:' ); ?> <strong><?php echo $filename; ?></strong>
2828
+		<?php _e('File name:'); ?> <strong><?php echo $filename; ?></strong>
2829 2829
 	</div>
2830 2830
 	<div class="misc-pub-section misc-pub-filetype">
2831
-		<?php _e( 'File type:' ); ?> <strong><?php
2832
-			if ( preg_match( '/^.*?\.(\w+)$/', get_attached_file( $post->ID ), $matches ) ) {
2833
-				echo esc_html( strtoupper( $matches[1] ) );
2834
-				list( $mime_type ) = explode( '/', $post->post_mime_type );
2835
-				if ( $mime_type !== 'image' && ! empty( $meta['mime_type'] ) ) {
2836
-					if ( $meta['mime_type'] !== "$mime_type/" . strtolower( $matches[1] ) ) {
2837
-						echo ' (' . $meta['mime_type'] . ')';
2831
+		<?php _e('File type:'); ?> <strong><?php
2832
+			if (preg_match('/^.*?\.(\w+)$/', get_attached_file($post->ID), $matches)) {
2833
+				echo esc_html(strtoupper($matches[1]));
2834
+				list($mime_type) = explode('/', $post->post_mime_type);
2835
+				if ($mime_type !== 'image' && ! empty($meta['mime_type'])) {
2836
+					if ($meta['mime_type'] !== "$mime_type/".strtolower($matches[1])) {
2837
+						echo ' ('.$meta['mime_type'].')';
2838 2838
 					}
2839 2839
 				}
2840 2840
 			} else {
2841
-				echo strtoupper( str_replace( 'image/', '', $post->post_mime_type ) );
2841
+				echo strtoupper(str_replace('image/', '', $post->post_mime_type));
2842 2842
 			}
2843 2843
 		?></strong>
2844 2844
 	</div>
@@ -2846,19 +2846,19 @@  discard block
 block discarded – undo
2846 2846
 	<?php
2847 2847
 		$file_size = false;
2848 2848
 
2849
-		if ( isset( $meta['filesize'] ) )
2849
+		if (isset($meta['filesize']))
2850 2850
 			$file_size = $meta['filesize'];
2851
-		elseif ( file_exists( $file ) )
2852
-			$file_size = filesize( $file );
2851
+		elseif (file_exists($file))
2852
+			$file_size = filesize($file);
2853 2853
 
2854
-		if ( ! empty( $file_size ) ) : ?>
2854
+		if ( ! empty($file_size)) : ?>
2855 2855
 			<div class="misc-pub-section misc-pub-filesize">
2856
-				<?php _e( 'File size:' ); ?> <strong><?php echo size_format( $file_size ); ?></strong>
2856
+				<?php _e('File size:'); ?> <strong><?php echo size_format($file_size); ?></strong>
2857 2857
 			</div>
2858 2858
 			<?php
2859 2859
 		endif;
2860 2860
 
2861
-	if ( preg_match( '#^(audio|video)/#', $post->post_mime_type ) ) {
2861
+	if (preg_match('#^(audio|video)/#', $post->post_mime_type)) {
2862 2862
 
2863 2863
 		/**
2864 2864
 		 * Filter the audio and video metadata fields to be shown in the publish meta box.
@@ -2870,27 +2870,27 @@  discard block
 block discarded – undo
2870 2870
 		 *
2871 2871
 		 * @param array $fields An array of the attachment metadata keys and labels.
2872 2872
 		 */
2873
-		$fields = apply_filters( 'media_submitbox_misc_sections', array(
2874
-			'length_formatted' => __( 'Length:' ),
2875
-			'bitrate'          => __( 'Bitrate:' ),
2876
-		) );
2873
+		$fields = apply_filters('media_submitbox_misc_sections', array(
2874
+			'length_formatted' => __('Length:'),
2875
+			'bitrate'          => __('Bitrate:'),
2876
+		));
2877 2877
 
2878
-		foreach ( $fields as $key => $label ) {
2879
-			if ( empty( $meta[ $key ] ) ) {
2878
+		foreach ($fields as $key => $label) {
2879
+			if (empty($meta[$key])) {
2880 2880
 				continue;
2881 2881
 			}
2882 2882
 	?>
2883
-		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class( $key ); ?>">
2883
+		<div class="misc-pub-section misc-pub-mime-meta misc-pub-<?php echo sanitize_html_class($key); ?>">
2884 2884
 			<?php echo $label ?> <strong><?php
2885
-				switch ( $key ) {
2885
+				switch ($key) {
2886 2886
 					case 'bitrate' :
2887
-						echo round( $meta['bitrate'] / 1000 ) . 'kb/s';
2888
-						if ( ! empty( $meta['bitrate_mode'] ) ) {
2889
-							echo ' ' . strtoupper( esc_html( $meta['bitrate_mode'] ) );
2887
+						echo round($meta['bitrate'] / 1000).'kb/s';
2888
+						if ( ! empty($meta['bitrate_mode'])) {
2889
+							echo ' '.strtoupper(esc_html($meta['bitrate_mode']));
2890 2890
 						}
2891 2891
 						break;
2892 2892
 					default:
2893
-						echo esc_html( $meta[ $key ] );
2893
+						echo esc_html($meta[$key]);
2894 2894
 						break;
2895 2895
 				}
2896 2896
 			?></strong>
@@ -2908,27 +2908,27 @@  discard block
 block discarded – undo
2908 2908
 		 *
2909 2909
 		 * @param array $fields An array of the attachment metadata keys and labels.
2910 2910
 		 */
2911
-		$audio_fields = apply_filters( 'audio_submitbox_misc_sections', array(
2912
-			'dataformat' => __( 'Audio Format:' ),
2913
-			'codec'      => __( 'Audio Codec:' )
2914
-		) );
2911
+		$audio_fields = apply_filters('audio_submitbox_misc_sections', array(
2912
+			'dataformat' => __('Audio Format:'),
2913
+			'codec'      => __('Audio Codec:')
2914
+		));
2915 2915
 
2916
-		foreach ( $audio_fields as $key => $label ) {
2917
-			if ( empty( $meta['audio'][ $key ] ) ) {
2916
+		foreach ($audio_fields as $key => $label) {
2917
+			if (empty($meta['audio'][$key])) {
2918 2918
 				continue;
2919 2919
 			}
2920 2920
 	?>
2921
-		<div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class( $key ); ?>">
2922
-			<?php echo $label; ?> <strong><?php echo esc_html( $meta['audio'][$key] ); ?></strong>
2921
+		<div class="misc-pub-section misc-pub-audio misc-pub-<?php echo sanitize_html_class($key); ?>">
2922
+			<?php echo $label; ?> <strong><?php echo esc_html($meta['audio'][$key]); ?></strong>
2923 2923
 		</div>
2924 2924
 	<?php
2925 2925
 		}
2926 2926
 
2927 2927
 	}
2928 2928
 
2929
-	if ( $media_dims ) : ?>
2929
+	if ($media_dims) : ?>
2930 2930
 	<div class="misc-pub-section misc-pub-dimensions">
2931
-		<?php _e( 'Dimensions:' ); ?> <strong><?php echo $media_dims; ?></strong>
2931
+		<?php _e('Dimensions:'); ?> <strong><?php echo $media_dims; ?></strong>
2932 2932
 	</div>
2933 2933
 <?php
2934 2934
 	endif;
@@ -2942,24 +2942,24 @@  discard block
 block discarded – undo
2942 2942
  * @param array $metadata An existing array with data
2943 2943
  * @param array $data Data supplied by ID3 tags
2944 2944
  */
2945
-function wp_add_id3_tag_data( &$metadata, $data ) {
2946
-	foreach ( array( 'id3v2', 'id3v1' ) as $version ) {
2947
-		if ( ! empty( $data[$version]['comments'] ) ) {
2948
-			foreach ( $data[$version]['comments'] as $key => $list ) {
2949
-				if ( 'length' !== $key && ! empty( $list ) ) {
2950
-					$metadata[$key] = reset( $list );
2945
+function wp_add_id3_tag_data(&$metadata, $data) {
2946
+	foreach (array('id3v2', 'id3v1') as $version) {
2947
+		if ( ! empty($data[$version]['comments'])) {
2948
+			foreach ($data[$version]['comments'] as $key => $list) {
2949
+				if ('length' !== $key && ! empty($list)) {
2950
+					$metadata[$key] = reset($list);
2951 2951
 					// Fix bug in byte stream analysis.
2952
-					if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
2953
-						$metadata[$key] = 'Cop' . $metadata[$key];
2952
+					if ('terms_of_use' === $key && 0 === strpos($metadata[$key], 'yright notice.'))
2953
+						$metadata[$key] = 'Cop'.$metadata[$key];
2954 2954
 				}
2955 2955
 			}
2956 2956
 			break;
2957 2957
 		}
2958 2958
 	}
2959 2959
 
2960
-	if ( ! empty( $data['id3v2']['APIC'] ) ) {
2961
-		$image = reset( $data['id3v2']['APIC']);
2962
-		if ( ! empty( $image['data'] ) ) {
2960
+	if ( ! empty($data['id3v2']['APIC'])) {
2961
+		$image = reset($data['id3v2']['APIC']);
2962
+		if ( ! empty($image['data'])) {
2963 2963
 			$metadata['image'] = array(
2964 2964
 				'data' => $image['data'],
2965 2965
 				'mime' => $image['image_mime'],
@@ -2967,9 +2967,9 @@  discard block
 block discarded – undo
2967 2967
 				'height' => $image['image_height']
2968 2968
 			);
2969 2969
 		}
2970
-	} elseif ( ! empty( $data['comments']['picture'] ) ) {
2971
-		$image = reset( $data['comments']['picture'] );
2972
-		if ( ! empty( $image['data'] ) ) {
2970
+	} elseif ( ! empty($data['comments']['picture'])) {
2971
+		$image = reset($data['comments']['picture']);
2972
+		if ( ! empty($image['data'])) {
2973 2973
 			$metadata['image'] = array(
2974 2974
 				'data' => $image['data'],
2975 2975
 				'mime' => $image['image_mime']
@@ -2986,56 +2986,56 @@  discard block
 block discarded – undo
2986 2986
  * @param string $file Path to file.
2987 2987
  * @return array|bool Returns array of metadata, if found.
2988 2988
  */
2989
-function wp_read_video_metadata( $file ) {
2990
-	if ( ! file_exists( $file ) ) {
2989
+function wp_read_video_metadata($file) {
2990
+	if ( ! file_exists($file)) {
2991 2991
 		return false;
2992 2992
 	}
2993 2993
 
2994 2994
 	$metadata = array();
2995 2995
 
2996
-	if ( ! defined( 'GETID3_TEMP_DIR' ) ) {
2997
-		define( 'GETID3_TEMP_DIR', get_temp_dir() );
2996
+	if ( ! defined('GETID3_TEMP_DIR')) {
2997
+		define('GETID3_TEMP_DIR', get_temp_dir());
2998 2998
 	}
2999 2999
 
3000
-	if ( ! class_exists( 'getID3', false ) ) {
3001
-		require( ABSPATH . WPINC . '/ID3/getid3.php' );
3000
+	if ( ! class_exists('getID3', false)) {
3001
+		require(ABSPATH.WPINC.'/ID3/getid3.php');
3002 3002
 	}
3003 3003
 	$id3 = new getID3();
3004
-	$data = $id3->analyze( $file );
3004
+	$data = $id3->analyze($file);
3005 3005
 
3006
-	if ( isset( $data['video']['lossless'] ) )
3006
+	if (isset($data['video']['lossless']))
3007 3007
 		$metadata['lossless'] = $data['video']['lossless'];
3008
-	if ( ! empty( $data['video']['bitrate'] ) )
3008
+	if ( ! empty($data['video']['bitrate']))
3009 3009
 		$metadata['bitrate'] = (int) $data['video']['bitrate'];
3010
-	if ( ! empty( $data['video']['bitrate_mode'] ) )
3010
+	if ( ! empty($data['video']['bitrate_mode']))
3011 3011
 		$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
3012
-	if ( ! empty( $data['filesize'] ) )
3012
+	if ( ! empty($data['filesize']))
3013 3013
 		$metadata['filesize'] = (int) $data['filesize'];
3014
-	if ( ! empty( $data['mime_type'] ) )
3014
+	if ( ! empty($data['mime_type']))
3015 3015
 		$metadata['mime_type'] = $data['mime_type'];
3016
-	if ( ! empty( $data['playtime_seconds'] ) )
3017
-		$metadata['length'] = (int) round( $data['playtime_seconds'] );
3018
-	if ( ! empty( $data['playtime_string'] ) )
3016
+	if ( ! empty($data['playtime_seconds']))
3017
+		$metadata['length'] = (int) round($data['playtime_seconds']);
3018
+	if ( ! empty($data['playtime_string']))
3019 3019
 		$metadata['length_formatted'] = $data['playtime_string'];
3020
-	if ( ! empty( $data['video']['resolution_x'] ) )
3020
+	if ( ! empty($data['video']['resolution_x']))
3021 3021
 		$metadata['width'] = (int) $data['video']['resolution_x'];
3022
-	if ( ! empty( $data['video']['resolution_y'] ) )
3022
+	if ( ! empty($data['video']['resolution_y']))
3023 3023
 		$metadata['height'] = (int) $data['video']['resolution_y'];
3024
-	if ( ! empty( $data['fileformat'] ) )
3024
+	if ( ! empty($data['fileformat']))
3025 3025
 		$metadata['fileformat'] = $data['fileformat'];
3026
-	if ( ! empty( $data['video']['dataformat'] ) )
3026
+	if ( ! empty($data['video']['dataformat']))
3027 3027
 		$metadata['dataformat'] = $data['video']['dataformat'];
3028
-	if ( ! empty( $data['video']['encoder'] ) )
3028
+	if ( ! empty($data['video']['encoder']))
3029 3029
 		$metadata['encoder'] = $data['video']['encoder'];
3030
-	if ( ! empty( $data['video']['codec'] ) )
3030
+	if ( ! empty($data['video']['codec']))
3031 3031
 		$metadata['codec'] = $data['video']['codec'];
3032 3032
 
3033
-	if ( ! empty( $data['audio'] ) ) {
3034
-		unset( $data['audio']['streams'] );
3033
+	if ( ! empty($data['audio'])) {
3034
+		unset($data['audio']['streams']);
3035 3035
 		$metadata['audio'] = $data['audio'];
3036 3036
 	}
3037 3037
 
3038
-	wp_add_id3_tag_data( $metadata, $data );
3038
+	wp_add_id3_tag_data($metadata, $data);
3039 3039
 
3040 3040
 	return $metadata;
3041 3041
 }
@@ -3048,39 +3048,39 @@  discard block
 block discarded – undo
3048 3048
  * @param string $file Path to file.
3049 3049
  * @return array|bool Returns array of metadata, if found.
3050 3050
  */
3051
-function wp_read_audio_metadata( $file ) {
3052
-	if ( ! file_exists( $file ) ) {
3051
+function wp_read_audio_metadata($file) {
3052
+	if ( ! file_exists($file)) {
3053 3053
 		return false;
3054 3054
 	}
3055 3055
 	$metadata = array();
3056 3056
 
3057
-	if ( ! defined( 'GETID3_TEMP_DIR' ) ) {
3058
-		define( 'GETID3_TEMP_DIR', get_temp_dir() );
3057
+	if ( ! defined('GETID3_TEMP_DIR')) {
3058
+		define('GETID3_TEMP_DIR', get_temp_dir());
3059 3059
 	}
3060 3060
 
3061
-	if ( ! class_exists( 'getID3', false ) ) {
3062
-		require( ABSPATH . WPINC . '/ID3/getid3.php' );
3061
+	if ( ! class_exists('getID3', false)) {
3062
+		require(ABSPATH.WPINC.'/ID3/getid3.php');
3063 3063
 	}
3064 3064
 	$id3 = new getID3();
3065
-	$data = $id3->analyze( $file );
3065
+	$data = $id3->analyze($file);
3066 3066
 
3067
-	if ( ! empty( $data['audio'] ) ) {
3068
-		unset( $data['audio']['streams'] );
3067
+	if ( ! empty($data['audio'])) {
3068
+		unset($data['audio']['streams']);
3069 3069
 		$metadata = $data['audio'];
3070 3070
 	}
3071 3071
 
3072
-	if ( ! empty( $data['fileformat'] ) )
3072
+	if ( ! empty($data['fileformat']))
3073 3073
 		$metadata['fileformat'] = $data['fileformat'];
3074
-	if ( ! empty( $data['filesize'] ) )
3074
+	if ( ! empty($data['filesize']))
3075 3075
 		$metadata['filesize'] = (int) $data['filesize'];
3076
-	if ( ! empty( $data['mime_type'] ) )
3076
+	if ( ! empty($data['mime_type']))
3077 3077
 		$metadata['mime_type'] = $data['mime_type'];
3078
-	if ( ! empty( $data['playtime_seconds'] ) )
3079
-		$metadata['length'] = (int) round( $data['playtime_seconds'] );
3080
-	if ( ! empty( $data['playtime_string'] ) )
3078
+	if ( ! empty($data['playtime_seconds']))
3079
+		$metadata['length'] = (int) round($data['playtime_seconds']);
3080
+	if ( ! empty($data['playtime_string']))
3081 3081
 		$metadata['length_formatted'] = $data['playtime_string'];
3082 3082
 
3083
-	wp_add_id3_tag_data( $metadata, $data );
3083
+	wp_add_id3_tag_data($metadata, $data);
3084 3084
 
3085 3085
 	return $metadata;
3086 3086
 }
@@ -3096,51 +3096,51 @@  discard block
 block discarded – undo
3096 3096
  * @param string $action    Optional. Attach/detach action. Accepts 'attach' or 'detach'.
3097 3097
  *                          Default 'attach'.
3098 3098
  */
3099
-function wp_media_attach_action( $parent_id, $action = 'attach' ) {
3099
+function wp_media_attach_action($parent_id, $action = 'attach') {
3100 3100
 	global $wpdb;
3101 3101
 
3102
-	if ( ! $parent_id ) {
3102
+	if ( ! $parent_id) {
3103 3103
 		return;
3104 3104
 	}
3105 3105
 
3106
-	if ( ! current_user_can( 'edit_post', $parent_id ) ) {
3107
-		wp_die( __( 'You are not allowed to edit this post.' ) );
3106
+	if ( ! current_user_can('edit_post', $parent_id)) {
3107
+		wp_die(__('You are not allowed to edit this post.'));
3108 3108
 	}
3109 3109
 	$ids = array();
3110
-	foreach ( (array) $_REQUEST['media'] as $att_id ) {
3110
+	foreach ((array) $_REQUEST['media'] as $att_id) {
3111 3111
 		$att_id = (int) $att_id;
3112 3112
 
3113
-		if ( ! current_user_can( 'edit_post', $att_id ) ) {
3113
+		if ( ! current_user_can('edit_post', $att_id)) {
3114 3114
 			continue;
3115 3115
 		}
3116 3116
 
3117 3117
 		$ids[] = $att_id;
3118 3118
 	}
3119 3119
 
3120
-	if ( ! empty( $ids ) ) {
3121
-		$ids_string = implode( ',', $ids );
3122
-		if ( 'attach' === $action ) {
3123
-			$result = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $ids_string )", $parent_id ) );
3120
+	if ( ! empty($ids)) {
3121
+		$ids_string = implode(',', $ids);
3122
+		if ('attach' === $action) {
3123
+			$result = $wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $ids_string )", $parent_id));
3124 3124
 		} else {
3125
-			$result = $wpdb->query( "UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )" );
3125
+			$result = $wpdb->query("UPDATE $wpdb->posts SET post_parent = 0 WHERE post_type = 'attachment' AND ID IN ( $ids_string )");
3126 3126
 		}
3127 3127
 
3128
-		foreach ( $ids as $att_id ) {
3129
-			clean_attachment_cache( $att_id );
3128
+		foreach ($ids as $att_id) {
3129
+			clean_attachment_cache($att_id);
3130 3130
 		}
3131 3131
 	}
3132 3132
 
3133
-	if ( isset( $result ) ) {
3133
+	if (isset($result)) {
3134 3134
 		$location = 'upload.php';
3135
-		if ( $referer = wp_get_referer() ) {
3136
-			if ( false !== strpos( $referer, 'upload.php' ) ) {
3137
-				$location = remove_query_arg( array( 'attached', 'detach' ), $referer );
3135
+		if ($referer = wp_get_referer()) {
3136
+			if (false !== strpos($referer, 'upload.php')) {
3137
+				$location = remove_query_arg(array('attached', 'detach'), $referer);
3138 3138
 			}
3139 3139
 		}
3140 3140
 
3141 3141
 		$key = 'attach' === $action ? 'attached' : 'detach';
3142
-		$location = add_query_arg( array( $key => $result ), $location );
3143
-		wp_redirect( $location );
3142
+		$location = add_query_arg(array($key => $result), $location);
3143
+		wp_redirect($location);
3144 3144
 		exit;
3145 3145
 	}
3146 3146
 }
Please login to merge, or discard this patch.
Braces   +418 added lines, -278 removed lines patch added patch discarded remove patch
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 
52 52
 	$post_id = intval($_REQUEST['post_id']);
53 53
 
54
-	if ( $post_id )
55
-		$attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) );
54
+	if ( $post_id ) {
55
+			$attachments = intval( $wpdb->get_var( $wpdb->prepare( "SELECT count(*) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent = %d", $post_id ) ) );
56
+	}
56 57
 
57 58
 	if ( empty($attachments) ) {
58 59
 		unset($tabs['gallery']);
@@ -90,8 +91,9 @@  discard block
 block discarded – undo
90 91
 		foreach ( $tabs as $callback => $text ) {
91 92
 			$class = '';
92 93
 
93
-			if ( $current == $callback )
94
-				$class = " class='current'";
94
+			if ( $current == $callback ) {
95
+							$class = " class='current'";
96
+			}
95 97
 
96 98
 			$href = add_query_arg(array('tab' => $callback, 's' => false, 'paged' => false, 'post_mime_type' => false, 'm' => false));
97 99
 			$link = "<a href='" . esc_url($href) . "'$class>$text</a>";
@@ -127,8 +129,9 @@  discard block
 block discarded – undo
127 129
 		$rel = ' rel="' . esc_attr( $rel ) . '"';
128 130
 	}
129 131
 
130
-	if ( $url )
131
-		$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
132
+	if ( $url ) {
133
+			$html = '<a href="' . esc_attr($url) . "\"$rel>$html</a>";
134
+	}
132 135
 
133 136
 	/**
134 137
 	 * Filter the image HTML markup to send to the editor.
@@ -193,13 +196,15 @@  discard block
 block discarded – undo
193 196
 	 * @param bool $bool Whether to disable appending captions. Returning true to the filter
194 197
 	 *                   will disable captions. Default empty string.
195 198
 	 */
196
-	if ( empty($caption) || apply_filters( 'disable_captions', '' ) )
197
-		return $html;
199
+	if ( empty($caption) || apply_filters( 'disable_captions', '' ) ) {
200
+			return $html;
201
+	}
198 202
 
199 203
 	$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
200 204
 
201
-	if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) )
202
-		return $html;
205
+	if ( ! preg_match( '/width=["\']([0-9]+)/', $html, $matches ) ) {
206
+			return $html;
207
+	}
203 208
 
204 209
 	$width = $matches[1];
205 210
 
@@ -210,8 +215,9 @@  discard block
 block discarded – undo
210 215
 	$caption = preg_replace( '/[ \n\t]*\n[ \t]*/', '<br />', $caption );
211 216
 
212 217
 	$html = preg_replace( '/(class=["\'][^\'"]*)align(none|left|right|center)\s?/', '$1', $html );
213
-	if ( empty($align) )
214
-		$align = 'none';
218
+	if ( empty($align) ) {
219
+			$align = 'none';
220
+	}
215 221
 
216 222
 	$shcode = '[caption id="' . $id . '" align="align' . $align	. '" width="' . $width . '"]' . $html . ' ' . $caption . '[/caption]';
217 223
 
@@ -270,15 +276,17 @@  discard block
 block discarded – undo
270 276
 
271 277
 	$time = current_time('mysql');
272 278
 	if ( $post = get_post($post_id) ) {
273
-		if ( substr( $post->post_date, 0, 4 ) > 0 )
274
-			$time = $post->post_date;
279
+		if ( substr( $post->post_date, 0, 4 ) > 0 ) {
280
+					$time = $post->post_date;
281
+		}
275 282
 	}
276 283
 
277 284
 	$name = $_FILES[$file_id]['name'];
278 285
 	$file = wp_handle_upload($_FILES[$file_id], $overrides, $time);
279 286
 
280
-	if ( isset($file['error']) )
281
-		return new WP_Error( 'upload_error', $file['error'] );
287
+	if ( isset($file['error']) ) {
288
+			return new WP_Error( 'upload_error', $file['error'] );
289
+	}
282 290
 
283 291
 	$name_parts = pathinfo($name);
284 292
 	$name = trim( substr( $name, 0, -(1 + strlen($name_parts['extension'])) ) );
@@ -327,19 +335,22 @@  discard block
 block discarded – undo
327 335
 
328 336
 		}
329 337
 
330
-		if ( ! empty( $meta['year'] ) )
331
-			$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
338
+		if ( ! empty( $meta['year'] ) ) {
339
+					$content .= ' ' . sprintf( __( 'Released: %d.' ), $meta['year'] );
340
+		}
332 341
 
333 342
 		if ( ! empty( $meta['track_number'] ) ) {
334 343
 			$track_number = explode( '/', $meta['track_number'] );
335
-			if ( isset( $track_number[1] ) )
336
-				$content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) );
337
-			else
338
-				$content .= ' ' . sprintf( __( 'Track %1$s.' ), number_format_i18n( $track_number[0] ) );
344
+			if ( isset( $track_number[1] ) ) {
345
+							$content .= ' ' . sprintf( __( 'Track %1$s of %2$s.' ), number_format_i18n( $track_number[0] ), number_format_i18n( $track_number[1] ) );
346
+			} else {
347
+							$content .= ' ' . sprintf( __( 'Track %1$s.' ), number_format_i18n( $track_number[0] ) );
348
+			}
339 349
 		}
340 350
 
341
-		if ( ! empty( $meta['genre'] ) )
342
-			$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
351
+		if ( ! empty( $meta['genre'] ) ) {
352
+					$content .= ' ' . sprintf( __( 'Genre: %s.' ), $meta['genre'] );
353
+		}
343 354
 
344 355
 	// Use image exif/iptc data for title and caption defaults if possible.
345 356
 	} elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = @wp_read_image_metadata( $file ) ) {
@@ -391,13 +402,15 @@  discard block
 block discarded – undo
391 402
 
392 403
 	$time = current_time( 'mysql' );
393 404
 	if ( $post = get_post( $post_id ) ) {
394
-		if ( substr( $post->post_date, 0, 4 ) > 0 )
395
-			$time = $post->post_date;
405
+		if ( substr( $post->post_date, 0, 4 ) > 0 ) {
406
+					$time = $post->post_date;
407
+		}
396 408
 	}
397 409
 
398 410
 	$file = wp_handle_sideload( $file_array, $overrides, $time );
399
-	if ( isset($file['error']) )
400
-		return new WP_Error( 'upload_error', $file['error'] );
411
+	if ( isset($file['error']) ) {
412
+			return new WP_Error( 'upload_error', $file['error'] );
413
+	}
401 414
 
402 415
 	$url = $file['url'];
403 416
 	$type = $file['type'];
@@ -407,14 +420,17 @@  discard block
 block discarded – undo
407 420
 
408 421
 	// Use image exif/iptc data for title and caption defaults if possible.
409 422
 	if ( $image_meta = @wp_read_image_metadata($file) ) {
410
-		if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) )
411
-			$title = $image_meta['title'];
412
-		if ( trim( $image_meta['caption'] ) )
413
-			$content = $image_meta['caption'];
423
+		if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) {
424
+					$title = $image_meta['title'];
425
+		}
426
+		if ( trim( $image_meta['caption'] ) ) {
427
+					$content = $image_meta['caption'];
428
+		}
414 429
 	}
415 430
 
416
-	if ( isset( $desc ) )
417
-		$title = $desc;
431
+	if ( isset( $desc ) ) {
432
+			$title = $desc;
433
+	}
418 434
 
419 435
 	// Construct the attachment array.
420 436
 	$attachment = array_merge( array(
@@ -430,8 +446,9 @@  discard block
 block discarded – undo
430 446
 
431 447
 	// Save the attachment metadata
432 448
 	$id = wp_insert_attachment($attachment, $file, $post_id);
433
-	if ( !is_wp_error($id) )
434
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
449
+	if ( !is_wp_error($id) ) {
450
+			wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
451
+	}
435 452
 
436 453
 	return $id;
437 454
 }
@@ -454,8 +471,9 @@  discard block
 block discarded – undo
454 471
 wp_enqueue_style( 'colors' );
455 472
 // Check callback name for 'media'
456 473
 if ( ( is_array( $content_func ) && ! empty( $content_func[1] ) && 0 === strpos( (string) $content_func[1], 'media' ) )
457
-	|| ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) )
474
+	|| ( ! is_array( $content_func ) && 0 === strpos( $content_func, 'media' ) ) ) {
458 475
 	wp_enqueue_style( 'deprecated-media' );
476
+}
459 477
 wp_enqueue_style( 'ie' );
460 478
 ?>
461 479
 <script type="text/javascript">
@@ -514,7 +532,10 @@  discard block
 block discarded – undo
514 532
 }
515 533
 ?>
516 534
 </head>
517
-<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-core-ui no-js">
535
+<body<?php if ( isset($GLOBALS['body_id']) ) {
536
+	echo ' id="' . $GLOBALS['body_id'] . '"';
537
+}
538
+?> class="wp-core-ui no-js">
518 539
 <script type="text/javascript">
519 540
 document.body.className = document.body.className.replace('no-js', 'js');
520 541
 </script>
@@ -548,8 +569,9 @@  discard block
 block discarded – undo
548 569
 	$instance++;
549 570
 
550 571
 	$post = get_post();
551
-	if ( ! $post && ! empty( $GLOBALS['post_ID'] ) )
552
-		$post = $GLOBALS['post_ID'];
572
+	if ( ! $post && ! empty( $GLOBALS['post_ID'] ) ) {
573
+			$post = $GLOBALS['post_ID'];
574
+	}
553 575
 
554 576
 	wp_enqueue_media( array(
555 577
 		'post' => $post
@@ -575,8 +597,9 @@  discard block
 block discarded – undo
575 597
 
576 598
 	if ( $legacy_filter ) {
577 599
 		// #WP22559. Close <a> if a plugin started by closing <a> to open their own <a> tag.
578
-		if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) )
579
-			$legacy_filter .= '</a>';
600
+		if ( 0 === stripos( trim( $legacy_filter ), '</a>' ) ) {
601
+					$legacy_filter .= '</a>';
602
+		}
580 603
 		echo $legacy_filter;
581 604
 	}
582 605
 }
@@ -592,16 +615,19 @@  discard block
 block discarded – undo
592 615
 function get_upload_iframe_src( $type = null, $post_id = null, $tab = null ) {
593 616
 	global $post_ID;
594 617
 
595
-	if ( empty( $post_id ) )
596
-		$post_id = $post_ID;
618
+	if ( empty( $post_id ) ) {
619
+			$post_id = $post_ID;
620
+	}
597 621
 
598 622
 	$upload_iframe_src = add_query_arg( 'post_id', (int) $post_id, admin_url('media-upload.php') );
599 623
 
600
-	if ( $type && 'media' != $type )
601
-		$upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
624
+	if ( $type && 'media' != $type ) {
625
+			$upload_iframe_src = add_query_arg('type', $type, $upload_iframe_src);
626
+	}
602 627
 
603
-	if ( ! empty( $tab ) )
604
-		$upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
628
+	if ( ! empty( $tab ) ) {
629
+			$upload_iframe_src = add_query_arg('tab', $tab, $upload_iframe_src);
630
+	}
605 631
 
606 632
 	/**
607 633
 	 * Filter the upload iframe source URL for a specific media type.
@@ -635,24 +661,32 @@  discard block
 block discarded – undo
635 661
 		$send_id = (int) reset( $keys );
636 662
 	}
637 663
 
638
-	if ( !empty($_POST['attachments']) ) foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
664
+	if ( !empty($_POST['attachments']) ) {
665
+		foreach ( $_POST['attachments'] as $attachment_id => $attachment ) {
639 666
 		$post = $_post = get_post($attachment_id, ARRAY_A);
667
+	}
640 668
 
641
-		if ( !current_user_can( 'edit_post', $attachment_id ) )
642
-			continue;
669
+		if ( !current_user_can( 'edit_post', $attachment_id ) ) {
670
+					continue;
671
+		}
643 672
 
644
-		if ( isset($attachment['post_content']) )
645
-			$post['post_content'] = $attachment['post_content'];
646
-		if ( isset($attachment['post_title']) )
647
-			$post['post_title'] = $attachment['post_title'];
648
-		if ( isset($attachment['post_excerpt']) )
649
-			$post['post_excerpt'] = $attachment['post_excerpt'];
650
-		if ( isset($attachment['menu_order']) )
651
-			$post['menu_order'] = $attachment['menu_order'];
673
+		if ( isset($attachment['post_content']) ) {
674
+					$post['post_content'] = $attachment['post_content'];
675
+		}
676
+		if ( isset($attachment['post_title']) ) {
677
+					$post['post_title'] = $attachment['post_title'];
678
+		}
679
+		if ( isset($attachment['post_excerpt']) ) {
680
+					$post['post_excerpt'] = $attachment['post_excerpt'];
681
+		}
682
+		if ( isset($attachment['menu_order']) ) {
683
+					$post['menu_order'] = $attachment['menu_order'];
684
+		}
652 685
 
653 686
 		if ( isset($send_id) && $attachment_id == $send_id ) {
654
-			if ( isset($attachment['post_parent']) )
655
-				$post['post_parent'] = $attachment['post_parent'];
687
+			if ( isset($attachment['post_parent']) ) {
688
+							$post['post_parent'] = $attachment['post_parent'];
689
+			}
656 690
 		}
657 691
 
658 692
 		/**
@@ -682,12 +716,14 @@  discard block
 block discarded – undo
682 716
 			unset($post['errors']);
683 717
 		}
684 718
 
685
-		if ( $post != $_post )
686
-			wp_update_post($post);
719
+		if ( $post != $_post ) {
720
+					wp_update_post($post);
721
+		}
687 722
 
688 723
 		foreach ( get_attachment_taxonomies($post) as $t ) {
689
-			if ( isset($attachment[$t]) )
690
-				wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
724
+			if ( isset($attachment[$t]) ) {
725
+							wp_set_object_terms($attachment_id, array_map('trim', preg_split('/,+/', $attachment[$t])), $t, false);
726
+			}
691 727
 		}
692 728
 	}
693 729
 
@@ -706,8 +742,9 @@  discard block
 block discarded – undo
706 742
 		$html = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
707 743
 		if ( !empty($attachment['url']) ) {
708 744
 			$rel = '';
709
-			if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'] )
710
-				$rel = " rel='attachment wp-att-" . esc_attr($send_id) . "'";
745
+			if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link($send_id) == $attachment['url'] ) {
746
+							$rel = " rel='attachment wp-att-" . esc_attr($send_id) . "'";
747
+			}
711 748
 			$html = "<a href='{$attachment['url']}'$rel>$html</a>";
712 749
 		}
713 750
 
@@ -753,21 +790,25 @@  discard block
 block discarded – undo
753 790
 
754 791
 	if ( !empty($_POST['insertonlybutton']) ) {
755 792
 		$src = $_POST['src'];
756
-		if ( !empty($src) && !strpos($src, '://') )
757
-			$src = "http://$src";
793
+		if ( !empty($src) && !strpos($src, '://') ) {
794
+					$src = "http://$src";
795
+		}
758 796
 
759 797
 		if ( isset( $_POST['media_type'] ) && 'image' != $_POST['media_type'] ) {
760 798
 			$title = esc_html( wp_unslash( $_POST['title'] ) );
761
-			if ( empty( $title ) )
762
-				$title = esc_html( basename( $src ) );
799
+			if ( empty( $title ) ) {
800
+							$title = esc_html( basename( $src ) );
801
+			}
763 802
 
764
-			if ( $title && $src )
765
-				$html = "<a href='" . esc_url($src) . "'>$title</a>";
803
+			if ( $title && $src ) {
804
+							$html = "<a href='" . esc_url($src) . "'>$title</a>";
805
+			}
766 806
 
767 807
 			$type = 'file';
768 808
 			if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) )
769
-				&& ( 'audio' == $ext_type || 'video' == $ext_type ) )
770
-					$type = $ext_type;
809
+				&& ( 'audio' == $ext_type || 'video' == $ext_type ) ) {
810
+								$type = $ext_type;
811
+			}
771 812
 
772 813
 			/**
773 814
 			 * Filter the URL sent to the editor for a specific media type.
@@ -789,8 +830,9 @@  discard block
 block discarded – undo
789 830
 				$align = esc_attr( wp_unslash( $_POST['align'] ) );
790 831
 				$class = " class='align$align'";
791 832
 			}
792
-			if ( !empty($src) )
793
-				$html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
833
+			if ( !empty($src) ) {
834
+							$html = "<img src='" . esc_url($src) . "' alt='$alt'$class />";
835
+			}
794 836
 
795 837
 			/**
796 838
 			 * Filter the image URL sent to the editor.
@@ -817,16 +859,19 @@  discard block
 block discarded – undo
817 859
 	} elseif ( ! empty( $_POST ) ) {
818 860
 		$return = media_upload_form_handler();
819 861
 
820
-		if ( is_string($return) )
821
-			return $return;
822
-		if ( is_array($return) )
823
-			$errors = $return;
862
+		if ( is_string($return) ) {
863
+					return $return;
864
+		}
865
+		if ( is_array($return) ) {
866
+					$errors = $return;
867
+		}
824 868
 	}
825 869
 
826 870
 	if ( isset($_GET['tab']) && $_GET['tab'] == 'type_url' ) {
827 871
 		$type = 'image';
828
-		if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) )
829
-			$type = $_GET['type'];
872
+		if ( isset( $_GET['type'] ) && in_array( $_GET['type'], array( 'video', 'audio', 'file' ) ) ) {
873
+					$type = $_GET['type'];
874
+		}
830 875
 		return wp_iframe( 'media_upload_type_url_form', $type, $errors, $id );
831 876
 	}
832 877
 
@@ -904,10 +949,12 @@  discard block
 block discarded – undo
904 949
 	if ( !empty($_POST) ) {
905 950
 		$return = media_upload_form_handler();
906 951
 
907
-		if ( is_string($return) )
908
-			return $return;
909
-		if ( is_array($return) )
910
-			$errors = $return;
952
+		if ( is_string($return) ) {
953
+					return $return;
954
+		}
955
+		if ( is_array($return) ) {
956
+					$errors = $return;
957
+		}
911 958
 	}
912 959
 
913 960
 	wp_enqueue_script('admin-gallery');
@@ -926,10 +973,12 @@  discard block
 block discarded – undo
926 973
 	if ( !empty($_POST) ) {
927 974
 		$return = media_upload_form_handler();
928 975
 
929
-		if ( is_string($return) )
930
-			return $return;
931
-		if ( is_array($return) )
932
-			$errors = $return;
976
+		if ( is_string($return) ) {
977
+					return $return;
978
+		}
979
+		if ( is_array($return) ) {
980
+					$errors = $return;
981
+		}
933 982
 	}
934 983
 
935 984
 	return wp_iframe( 'media_upload_library_form', $errors );
@@ -946,12 +995,14 @@  discard block
 block discarded – undo
946 995
  */
947 996
 function image_align_input_fields( $post, $checked = '' ) {
948 997
 
949
-	if ( empty($checked) )
950
-		$checked = get_user_setting('align', 'none');
998
+	if ( empty($checked) ) {
999
+			$checked = get_user_setting('align', 'none');
1000
+	}
951 1001
 
952 1002
 	$alignments = array('none' => __('None'), 'left' => __('Left'), 'center' => __('Center'), 'right' => __('Right'));
953
-	if ( !array_key_exists( (string) $checked, $alignments ) )
954
-		$checked = 'none';
1003
+	if ( !array_key_exists( (string) $checked, $alignments ) ) {
1004
+			$checked = 'none';
1005
+	}
955 1006
 
956 1007
 	$out = array();
957 1008
 	foreach ( $alignments as $name => $label ) {
@@ -1051,14 +1102,16 @@  discard block
 block discarded – undo
1051 1102
 	$file = wp_get_attachment_url($post->ID);
1052 1103
 	$link = get_attachment_link($post->ID);
1053 1104
 
1054
-	if ( empty($url_type) )
1055
-		$url_type = get_user_setting('urlbutton', 'post');
1105
+	if ( empty($url_type) ) {
1106
+			$url_type = get_user_setting('urlbutton', 'post');
1107
+	}
1056 1108
 
1057 1109
 	$url = '';
1058
-	if ( $url_type == 'file' )
1059
-		$url = $file;
1060
-	elseif ( $url_type == 'post' )
1061
-		$url = $link;
1110
+	if ( $url_type == 'file' ) {
1111
+			$url = $file;
1112
+	} elseif ( $url_type == 'post' ) {
1113
+			$url = $link;
1114
+	}
1062 1115
 
1063 1116
 	return "
1064 1117
 	<input type='text' class='text urlfield' name='attachments[$post->ID][url]' value='" . esc_attr($url) . "' /><br />
@@ -1184,10 +1237,12 @@  discard block
 block discarded – undo
1184 1237
  * @return array
1185 1238
  */
1186 1239
 function get_attachment_fields_to_edit($post, $errors = null) {
1187
-	if ( is_int($post) )
1188
-		$post = get_post($post);
1189
-	if ( is_array($post) )
1190
-		$post = new WP_Post( (object) $post );
1240
+	if ( is_int($post) ) {
1241
+			$post = get_post($post);
1242
+	}
1243
+	if ( is_array($post) ) {
1244
+			$post = new WP_Post( (object) $post );
1245
+	}
1191 1246
 
1192 1247
 	$image_url = wp_get_attachment_url($post->ID);
1193 1248
 
@@ -1230,21 +1285,26 @@  discard block
 block discarded – undo
1230 1285
 
1231 1286
 	foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1232 1287
 		$t = (array) get_taxonomy($taxonomy);
1233
-		if ( ! $t['public'] || ! $t['show_ui'] )
1234
-			continue;
1235
-		if ( empty($t['label']) )
1236
-			$t['label'] = $taxonomy;
1237
-		if ( empty($t['args']) )
1238
-			$t['args'] = array();
1288
+		if ( ! $t['public'] || ! $t['show_ui'] ) {
1289
+					continue;
1290
+		}
1291
+		if ( empty($t['label']) ) {
1292
+					$t['label'] = $taxonomy;
1293
+		}
1294
+		if ( empty($t['args']) ) {
1295
+					$t['args'] = array();
1296
+		}
1239 1297
 
1240 1298
 		$terms = get_object_term_cache($post->ID, $taxonomy);
1241
-		if ( false === $terms )
1242
-			$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1299
+		if ( false === $terms ) {
1300
+					$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1301
+		}
1243 1302
 
1244 1303
 		$values = array();
1245 1304
 
1246
-		foreach ( $terms as $term )
1247
-			$values[] = $term->slug;
1305
+		foreach ( $terms as $term ) {
1306
+					$values[] = $term->slug;
1307
+		}
1248 1308
 		$t['value'] = join(', ', $values);
1249 1309
 
1250 1310
 		$form_fields[$taxonomy] = $t;
@@ -1257,8 +1317,9 @@  discard block
 block discarded – undo
1257 1317
 	// This was formerly in image_attachment_fields_to_edit().
1258 1318
 	if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
1259 1319
 		$alt = get_post_meta($post->ID, '_wp_attachment_image_alt', true);
1260
-		if ( empty($alt) )
1261
-			$alt = '';
1320
+		if ( empty($alt) ) {
1321
+					$alt = '';
1322
+		}
1262 1323
 
1263 1324
 		$form_fields['post_title']['required'] = true;
1264 1325
 
@@ -1312,22 +1373,26 @@  discard block
 block discarded – undo
1312 1373
 	$attachments = array();
1313 1374
 	if ( $post_id ) {
1314 1375
 		$post = get_post($post_id);
1315
-		if ( $post && $post->post_type == 'attachment' )
1316
-			$attachments = array($post->ID => $post);
1317
-		else
1318
-			$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
1376
+		if ( $post && $post->post_type == 'attachment' ) {
1377
+					$attachments = array($post->ID => $post);
1378
+		} else {
1379
+					$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
1380
+		}
1319 1381
 	} else {
1320
-		if ( is_array($GLOBALS['wp_the_query']->posts) )
1321
-			foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
1382
+		if ( is_array($GLOBALS['wp_the_query']->posts) ) {
1383
+					foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
1322 1384
 				$attachments[$attachment->ID] = $attachment;
1385
+		}
1323 1386
 	}
1324 1387
 
1325 1388
 	$output = '';
1326 1389
 	foreach ( (array) $attachments as $id => $attachment ) {
1327
-		if ( $attachment->post_status == 'trash' )
1328
-			continue;
1329
-		if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) )
1330
-			$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
1390
+		if ( $attachment->post_status == 'trash' ) {
1391
+					continue;
1392
+		}
1393
+		if ( $item = get_media_item( $id, array( 'errors' => isset($errors[$id]) ? $errors[$id] : null) ) ) {
1394
+					$output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>";
1395
+		}
1331 1396
 	}
1332 1397
 
1333 1398
 	return $output;
@@ -1347,10 +1412,11 @@  discard block
 block discarded – undo
1347 1412
 function get_media_item( $attachment_id, $args = null ) {
1348 1413
 	global $redir_tab;
1349 1414
 
1350
-	if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) )
1351
-		$thumb_url = $thumb_url[0];
1352
-	else
1353
-		$thumb_url = false;
1415
+	if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) {
1416
+			$thumb_url = $thumb_url[0];
1417
+	} else {
1418
+			$thumb_url = false;
1419
+	}
1354 1420
 
1355 1421
 	$post = get_post( $attachment_id );
1356 1422
 	$current_post_id = !empty( $_GET['post_id'] ) ? (int) $_GET['post_id'] : 0;
@@ -1407,10 +1473,11 @@  discard block
 block discarded – undo
1407 1473
 
1408 1474
 	foreach ( $form_fields as $key => $val ) {
1409 1475
 		if ( 'menu_order' == $key ) {
1410
-			if ( $gallery )
1411
-				$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ). "' /></div>";
1412
-			else
1413
-				$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
1476
+			if ( $gallery ) {
1477
+							$order = "<div class='menu_order'> <input class='menu_order_input' type='text' id='attachments[$attachment_id][menu_order]' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ). "' /></div>";
1478
+			} else {
1479
+							$order = "<input type='hidden' name='attachments[$attachment_id][menu_order]' value='" . esc_attr( $val['value'] ) . "' />";
1480
+			}
1414 1481
 
1415 1482
 			unset( $form_fields['menu_order'] );
1416 1483
 			break;
@@ -1419,8 +1486,9 @@  discard block
 block discarded – undo
1419 1486
 
1420 1487
 	$media_dims = '';
1421 1488
 	$meta = wp_get_attachment_metadata( $post->ID );
1422
-	if ( isset( $meta['width'], $meta['height'] ) )
1423
-		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
1489
+	if ( isset( $meta['width'], $meta['height'] ) ) {
1490
+			$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
1491
+	}
1424 1492
 
1425 1493
 	/**
1426 1494
 	 * Filter the media metadata.
@@ -1456,8 +1524,9 @@  discard block
 block discarded – undo
1456 1524
 			<p><strong>" . __('File name:') . "</strong> $filename</p>
1457 1525
 			<p><strong>" . __('File type:') . "</strong> $post->post_mime_type</p>
1458 1526
 			<p><strong>" . __('Upload date:') . "</strong> " . mysql2date( __( 'F j, Y' ), $post->post_date ). '</p>';
1459
-			if ( !empty( $media_dims ) )
1460
-				$item .= "<p><strong>" . __('Dimensions:') . "</strong> $media_dims</p>\n";
1527
+			if ( !empty( $media_dims ) ) {
1528
+							$item .= "<p><strong>" . __('Dimensions:') . "</strong> $media_dims</p>\n";
1529
+			}
1461 1530
 
1462 1531
 			$item .= "</td></tr>\n";
1463 1532
 
@@ -1522,8 +1591,9 @@  discard block
 block discarded – undo
1522 1591
 	$hidden_fields = array();
1523 1592
 
1524 1593
 	foreach ( $form_fields as $id => $field ) {
1525
-		if ( $id[0] == '_' )
1526
-			continue;
1594
+		if ( $id[0] == '_' ) {
1595
+					continue;
1596
+		}
1527 1597
 
1528 1598
 		if ( !empty( $field['tr'] ) ) {
1529 1599
 			$item .= $field['tr'];
@@ -1545,9 +1615,9 @@  discard block
 block discarded – undo
1545 1615
 		$class .= $field['required'] ? ' form-required' : '';
1546 1616
 
1547 1617
 		$item .= "\t\t<tr class='$class'>\n\t\t\t<th scope='row' class='label'><label for='$name'><span class='alignleft'>{$field['label']}{$required}</span><br class='clear' /></label></th>\n\t\t\t<td class='field'>";
1548
-		if ( !empty( $field[ $field['input'] ] ) )
1549
-			$item .= $field[ $field['input'] ];
1550
-		elseif ( $field['input'] == 'textarea' ) {
1618
+		if ( !empty( $field[ $field['input'] ] ) ) {
1619
+					$item .= $field[ $field['input'] ];
1620
+		} elseif ( $field['input'] == 'textarea' ) {
1551 1621
 			if ( 'post_content' == $id && user_can_richedit() ) {
1552 1622
 				// Sanitize_post() skips the post_content when user_can_richedit.
1553 1623
 				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
@@ -1557,33 +1627,39 @@  discard block
 block discarded – undo
1557 1627
 		} else {
1558 1628
 			$item .= "<input type='text' class='text' id='$name' name='$name' value='" . esc_attr( $field['value'] ) . "'{$required_attr}{$aria_required} />";
1559 1629
 		}
1560
-		if ( !empty( $field['helps'] ) )
1561
-			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1630
+		if ( !empty( $field['helps'] ) ) {
1631
+					$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1632
+		}
1562 1633
 		$item .= "</td>\n\t\t</tr>\n";
1563 1634
 
1564 1635
 		$extra_rows = array();
1565 1636
 
1566
-		if ( !empty( $field['errors'] ) )
1567
-			foreach ( array_unique( (array) $field['errors'] ) as $error )
1637
+		if ( !empty( $field['errors'] ) ) {
1638
+					foreach ( array_unique( (array) $field['errors'] ) as $error )
1568 1639
 				$extra_rows['error'][] = $error;
1640
+		}
1569 1641
 
1570
-		if ( !empty( $field['extra_rows'] ) )
1571
-			foreach ( $field['extra_rows'] as $class => $rows )
1642
+		if ( !empty( $field['extra_rows'] ) ) {
1643
+					foreach ( $field['extra_rows'] as $class => $rows )
1572 1644
 				foreach ( (array) $rows as $html )
1573 1645
 					$extra_rows[$class][] = $html;
1646
+		}
1574 1647
 
1575
-		foreach ( $extra_rows as $class => $rows )
1576
-			foreach ( $rows as $html )
1648
+		foreach ( $extra_rows as $class => $rows ) {
1649
+					foreach ( $rows as $html )
1577 1650
 				$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
1651
+		}
1578 1652
 	}
1579 1653
 
1580
-	if ( !empty( $form_fields['_final'] ) )
1581
-		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1654
+	if ( !empty( $form_fields['_final'] ) ) {
1655
+			$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1656
+	}
1582 1657
 	$item .= "\t</tbody>\n";
1583 1658
 	$item .= "\t</table>\n";
1584 1659
 
1585
-	foreach ( $hidden_fields as $name => $value )
1586
-		$item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
1660
+	foreach ( $hidden_fields as $name => $value ) {
1661
+			$item .= "\t<input type='hidden' name='$name' id='$name' value='" . esc_attr( $value ) . "' />\n";
1662
+	}
1587 1663
 
1588 1664
 	if ( $post->post_parent < 1 && isset( $_REQUEST['post_id'] ) ) {
1589 1665
 		$parent = (int) $_REQUEST['post_id'];
@@ -1621,21 +1697,26 @@  discard block
 block discarded – undo
1621 1697
 	if ( $args['in_modal'] ) {
1622 1698
 		foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
1623 1699
 			$t = (array) get_taxonomy($taxonomy);
1624
-			if ( ! $t['public'] || ! $t['show_ui'] )
1625
-				continue;
1626
-			if ( empty($t['label']) )
1627
-				$t['label'] = $taxonomy;
1628
-			if ( empty($t['args']) )
1629
-				$t['args'] = array();
1700
+			if ( ! $t['public'] || ! $t['show_ui'] ) {
1701
+							continue;
1702
+			}
1703
+			if ( empty($t['label']) ) {
1704
+							$t['label'] = $taxonomy;
1705
+			}
1706
+			if ( empty($t['args']) ) {
1707
+							$t['args'] = array();
1708
+			}
1630 1709
 
1631 1710
 			$terms = get_object_term_cache($post->ID, $taxonomy);
1632
-			if ( false === $terms )
1633
-				$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1711
+			if ( false === $terms ) {
1712
+							$terms = wp_get_object_terms($post->ID, $taxonomy, $t['args']);
1713
+			}
1634 1714
 
1635 1715
 			$values = array();
1636 1716
 
1637
-			foreach ( $terms as $term )
1638
-				$values[] = $term->slug;
1717
+			foreach ( $terms as $term ) {
1718
+							$values[] = $term->slug;
1719
+			}
1639 1720
 			$t['value'] = join(', ', $values);
1640 1721
 			$t['taxonomy'] = true;
1641 1722
 
@@ -1670,8 +1751,9 @@  discard block
 block discarded – undo
1670 1751
 
1671 1752
 	$item = '';
1672 1753
 	foreach ( $form_fields as $id => $field ) {
1673
-		if ( $id[0] == '_' )
1674
-			continue;
1754
+		if ( $id[0] == '_' ) {
1755
+					continue;
1756
+		}
1675 1757
 
1676 1758
 		$name = "attachments[$attachment_id][$id]";
1677 1759
 		$id_attr = "attachments-$attachment_id-$id";
@@ -1683,8 +1765,9 @@  discard block
 block discarded – undo
1683 1765
 
1684 1766
 		$field = array_merge( $defaults, $field );
1685 1767
 
1686
-		if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) )
1687
-			continue;
1768
+		if ( ( ! $field['show_in_edit'] && ! $args['in_modal'] ) || ( ! $field['show_in_modal'] && $args['in_modal'] ) ) {
1769
+					continue;
1770
+		}
1688 1771
 
1689 1772
 		if ( $field['input'] == 'hidden' ) {
1690 1773
 			$hidden_fields[$name] = $field['value'];
@@ -1702,9 +1785,9 @@  discard block
 block discarded – undo
1702 1785
 		$item .= "\t\t\t<th scope='row' class='label'><label for='$id_attr'><span class='alignleft'>{$field['label']}</span>$required<br class='clear' /></label>";
1703 1786
 		$item .= "</th>\n\t\t\t<td class='field'>";
1704 1787
 
1705
-		if ( !empty( $field[ $field['input'] ] ) )
1706
-			$item .= $field[ $field['input'] ];
1707
-		elseif ( $field['input'] == 'textarea' ) {
1788
+		if ( !empty( $field[ $field['input'] ] ) ) {
1789
+					$item .= $field[ $field['input'] ];
1790
+		} elseif ( $field['input'] == 'textarea' ) {
1708 1791
 			if ( 'post_content' == $id && user_can_richedit() ) {
1709 1792
 				// sanitize_post() skips the post_content when user_can_richedit.
1710 1793
 				$field['value'] = htmlspecialchars( $field['value'], ENT_QUOTES );
@@ -1713,28 +1796,33 @@  discard block
 block discarded – undo
1713 1796
 		} else {
1714 1797
 			$item .= "<input type='text' class='text' id='$id_attr' name='$name' value='" . esc_attr( $field['value'] ) . "' $readonly{$required_attr}{$aria_required} />";
1715 1798
 		}
1716
-		if ( !empty( $field['helps'] ) )
1717
-			$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1799
+		if ( !empty( $field['helps'] ) ) {
1800
+					$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique( (array) $field['helps'] ) ) . '</p>';
1801
+		}
1718 1802
 		$item .= "</td>\n\t\t</tr>\n";
1719 1803
 
1720 1804
 		$extra_rows = array();
1721 1805
 
1722
-		if ( !empty( $field['errors'] ) )
1723
-			foreach ( array_unique( (array) $field['errors'] ) as $error )
1806
+		if ( !empty( $field['errors'] ) ) {
1807
+					foreach ( array_unique( (array) $field['errors'] ) as $error )
1724 1808
 				$extra_rows['error'][] = $error;
1809
+		}
1725 1810
 
1726
-		if ( !empty( $field['extra_rows'] ) )
1727
-			foreach ( $field['extra_rows'] as $class => $rows )
1811
+		if ( !empty( $field['extra_rows'] ) ) {
1812
+					foreach ( $field['extra_rows'] as $class => $rows )
1728 1813
 				foreach ( (array) $rows as $html )
1729 1814
 					$extra_rows[$class][] = $html;
1815
+		}
1730 1816
 
1731
-		foreach ( $extra_rows as $class => $rows )
1732
-			foreach ( $rows as $html )
1817
+		foreach ( $extra_rows as $class => $rows ) {
1818
+					foreach ( $rows as $html )
1733 1819
 				$item .= "\t\t<tr><td></td><td class='$class'>$html</td></tr>\n";
1820
+		}
1734 1821
 	}
1735 1822
 
1736
-	if ( !empty( $form_fields['_final'] ) )
1737
-		$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1823
+	if ( !empty( $form_fields['_final'] ) ) {
1824
+			$item .= "\t\t<tr class='final'><td colspan='2'>{$form_fields['_final']}</td></tr>\n";
1825
+	}
1738 1826
 
1739 1827
 	if ( $item ) {
1740 1828
 		$item = '<p class="media-types media-types-required-info">' .
@@ -1746,8 +1834,9 @@  discard block
 block discarded – undo
1746 1834
 		$item .= '<input type="hidden" name="' . esc_attr( $hidden_field ) . '" value="' . esc_attr( $value ) . '" />' . "\n";
1747 1835
 	}
1748 1836
 
1749
-	if ( $item )
1750
-		$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
1837
+	if ( $item ) {
1838
+			$item = '<input type="hidden" name="attachments[' . $attachment_id . '][menu_order]" value="' . esc_attr( $post->menu_order ) . '" />' . $item;
1839
+	}
1751 1840
 
1752 1841
 	return array(
1753 1842
 		'item'   => $item,
@@ -1804,14 +1893,16 @@  discard block
 block discarded – undo
1804 1893
 
1805 1894
 <div id="media-upload-notice"><?php
1806 1895
 
1807
-	if (isset($errors['upload_notice']) )
1808
-		echo $errors['upload_notice'];
1896
+	if (isset($errors['upload_notice']) ) {
1897
+			echo $errors['upload_notice'];
1898
+	}
1809 1899
 
1810 1900
 ?></div>
1811 1901
 <div id="media-upload-error"><?php
1812 1902
 
1813
-	if (isset($errors['upload_error']) && is_wp_error($errors['upload_error']))
1814
-		echo $errors['upload_error']->get_error_message();
1903
+	if (isset($errors['upload_error']) && is_wp_error($errors['upload_error'])) {
1904
+			echo $errors['upload_error']->get_error_message();
1905
+	}
1815 1906
 
1816 1907
 ?></div>
1817 1908
 <?php
@@ -1888,11 +1979,13 @@  discard block
 block discarded – undo
1888 1979
 <?php
1889 1980
 // Verify size is an int. If not return default value.
1890 1981
 $large_size_h = absint( get_option('large_size_h') );
1891
-if( !$large_size_h )
1982
+if( !$large_size_h ) {
1892 1983
 	$large_size_h = 1024;
1984
+}
1893 1985
 $large_size_w = absint( get_option('large_size_w') );
1894
-if( !$large_size_w )
1986
+if( !$large_size_w ) {
1895 1987
 	$large_size_w = 1024;
1988
+}
1896 1989
 ?>
1897 1990
 var resize_height = <?php echo $large_size_h; ?>, resize_width = <?php echo $large_size_w; ?>,
1898 1991
 wpUploaderInit = <?php echo wp_json_encode( $plupload_init ); ?>;
@@ -1991,9 +2084,10 @@  discard block
 block discarded – undo
1991 2084
 	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
1992 2085
 	$form_class = 'media-upload-form type-form validate';
1993 2086
 
1994
-	if ( get_user_setting('uploader') )
1995
-		$form_class .= ' html-uploader';
1996
-?>
2087
+	if ( get_user_setting('uploader') ) {
2088
+			$form_class .= ' html-uploader';
2089
+	}
2090
+	?>
1997 2091
 
1998 2092
 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
1999 2093
 <?php submit_button( '', 'hidden', 'save', false ); ?>
@@ -2043,8 +2137,9 @@  discard block
 block discarded – undo
2043 2137
  * @param integer $id
2044 2138
  */
2045 2139
 function media_upload_type_url_form($type = null, $errors = null, $id = null) {
2046
-	if ( null === $type )
2047
-		$type = 'image';
2140
+	if ( null === $type ) {
2141
+			$type = 'image';
2142
+	}
2048 2143
 
2049 2144
 	media_upload_header();
2050 2145
 
@@ -2055,9 +2150,10 @@  discard block
 block discarded – undo
2055 2150
 	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2056 2151
 	$form_class = 'media-upload-form type-form validate';
2057 2152
 
2058
-	if ( get_user_setting('uploader') )
2059
-		$form_class .= ' html-uploader';
2060
-?>
2153
+	if ( get_user_setting('uploader') ) {
2154
+			$form_class .= ' html-uploader';
2155
+	}
2156
+	?>
2061 2157
 
2062 2158
 <form enctype="multipart/form-data" method="post" action="<?php echo esc_url( $form_action_url ); ?>" class="<?php echo $form_class; ?>" id="<?php echo $type; ?>-form">
2063 2159
 <input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
@@ -2198,9 +2294,10 @@  discard block
 block discarded – undo
2198 2294
 	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2199 2295
 	$form_class = 'media-upload-form validate';
2200 2296
 
2201
-	if ( get_user_setting('uploader') )
2202
-		$form_class .= ' html-uploader';
2203
-?>
2297
+	if ( get_user_setting('uploader') ) {
2298
+			$form_class .= ' html-uploader';
2299
+	}
2300
+	?>
2204 2301
 
2205 2302
 <script type="text/javascript">
2206 2303
 jQuery(function($){
@@ -2350,8 +2447,9 @@  discard block
 block discarded – undo
2350 2447
 	$form_action_url = apply_filters( 'media_upload_form_url', $form_action_url, $type );
2351 2448
 	$form_class = 'media-upload-form validate';
2352 2449
 
2353
-	if ( get_user_setting('uploader') )
2354
-		$form_class .= ' html-uploader';
2450
+	if ( get_user_setting('uploader') ) {
2451
+			$form_class .= ' html-uploader';
2452
+	}
2355 2453
 
2356 2454
 	$q = $_GET;
2357 2455
 	$q['posts_per_page'] = 10;
@@ -2386,30 +2484,35 @@  discard block
 block discarded – undo
2386 2484
 $type_links = array();
2387 2485
 $_num_posts = (array) wp_count_attachments();
2388 2486
 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
2389
-foreach ( $matches as $_type => $reals )
2487
+foreach ( $matches as $_type => $reals ) {
2390 2488
 	foreach ( $reals as $real )
2391 2489
 		if ( isset($num_posts[$_type]) )
2392 2490
 			$num_posts[$_type] += $_num_posts[$real];
2393
-		else
2394
-			$num_posts[$_type] = $_num_posts[$real];
2395
-// If available type specified by media button clicked, filter by that type
2491
+}
2492
+		else {
2493
+					$num_posts[$_type] = $_num_posts[$real];
2494
+		}
2495
+		// If available type specified by media button clicked, filter by that type
2396 2496
 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
2397 2497
 	$_GET['post_mime_type'] = $type;
2398 2498
 	list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query();
2399 2499
 }
2400
-if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
2500
+if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) {
2401 2501
 	$class = ' class="current"';
2402
-else
2502
+} else {
2403 2503
 	$class = '';
2504
+}
2404 2505
 $type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . '"' . $class . '>' . __('All Types') . '</a>';
2405 2506
 foreach ( $post_mime_types as $mime_type => $label ) {
2406 2507
 	$class = '';
2407 2508
 
2408
-	if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
2409
-		continue;
2509
+	if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) {
2510
+			continue;
2511
+	}
2410 2512
 
2411
-	if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
2412
-		$class = ' class="current"';
2513
+	if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) {
2514
+			$class = ' class="current"';
2515
+	}
2413 2516
 
2414 2517
 	$type_links[] = '<li><a href="' . esc_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . '"' . $class . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), '<span id="' . $mime_type . '-counter">' . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
2415 2518
 }
@@ -2439,8 +2542,9 @@  discard block
 block discarded – undo
2439 2542
 	'current' => $q['paged'],
2440 2543
 ));
2441 2544
 
2442
-if ( $page_links )
2545
+if ( $page_links ) {
2443 2546
 	echo "<div class='tablenav-pages'>$page_links</div>";
2547
+}
2444 2548
 ?>
2445 2549
 
2446 2550
 <div class="alignleft actions">
@@ -2458,14 +2562,16 @@  discard block
 block discarded – undo
2458 2562
 <option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
2459 2563
 <?php
2460 2564
 foreach ($arc_result as $arc_row) {
2461
-	if ( $arc_row->yyear == 0 )
2462
-		continue;
2565
+	if ( $arc_row->yyear == 0 ) {
2566
+			continue;
2567
+	}
2463 2568
 	$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
2464 2569
 
2465
-	if ( $arc_row->yyear . $arc_row->mmonth == $selected_month )
2466
-		$default = ' selected="selected"';
2467
-	else
2468
-		$default = '';
2570
+	if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) {
2571
+			$default = ' selected="selected"';
2572
+	} else {
2573
+			$default = '';
2574
+	}
2469 2575
 
2470 2576
 	echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
2471 2577
 	echo esc_html( $wp_locale->get_month($arc_row->mmonth) . " $arc_row->yyear" );
@@ -2536,8 +2642,9 @@  discard block
 block discarded – undo
2536 2642
 	}
2537 2643
 
2538 2644
 	$default_align = get_option('image_default_align');
2539
-	if ( empty($default_align) )
2540
-		$default_align = 'none';
2645
+	if ( empty($default_align) ) {
2646
+			$default_align = 'none';
2647
+	}
2541 2648
 
2542 2649
 	if ( 'image' == $default_view ) {
2543 2650
 		$view = 'image-only';
@@ -2626,10 +2733,11 @@  discard block
 block discarded – undo
2626 2733
 function media_upload_flash_bypass() {
2627 2734
 	$browser_uploader = admin_url( 'media-new.php?browser-uploader' );
2628 2735
 
2629
-	if ( $post = get_post() )
2630
-		$browser_uploader .= '&amp;post_id=' . intval( $post->ID );
2631
-	elseif ( ! empty( $GLOBALS['post_ID'] ) )
2632
-		$browser_uploader .= '&amp;post_id=' . intval( $GLOBALS['post_ID'] );
2736
+	if ( $post = get_post() ) {
2737
+			$browser_uploader .= '&amp;post_id=' . intval( $post->ID );
2738
+	} elseif ( ! empty( $GLOBALS['post_ID'] ) ) {
2739
+			$browser_uploader .= '&amp;post_id=' . intval( $GLOBALS['post_ID'] );
2740
+	}
2633 2741
 
2634 2742
 	?>
2635 2743
 	<p class="upload-flash-bypass">
@@ -2700,12 +2808,14 @@  discard block
 block discarded – undo
2700 2808
  */
2701 2809
 function edit_form_image_editor( $post ) {
2702 2810
 	$open = isset( $_GET['image-editor'] );
2703
-	if ( $open )
2704
-		require_once ABSPATH . 'wp-admin/includes/image-edit.php';
2811
+	if ( $open ) {
2812
+			require_once ABSPATH . 'wp-admin/includes/image-edit.php';
2813
+	}
2705 2814
 
2706 2815
 	$thumb_url = false;
2707
-	if ( $attachment_id = intval( $post->ID ) )
2708
-		$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
2816
+	if ( $attachment_id = intval( $post->ID ) ) {
2817
+			$thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true );
2818
+	}
2709 2819
 
2710 2820
 	$alt_text = get_post_meta( $post->ID, '_wp_attachment_image_alt', true );
2711 2821
 
@@ -2722,12 +2832,21 @@  discard block
 block discarded – undo
2722 2832
 
2723 2833
 		<div class="imgedit-response" id="imgedit-response-<?php echo $attachment_id; ?>"></div>
2724 2834
 
2725
-		<div<?php if ( $open ) echo ' style="display:none"'; ?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
2835
+		<div<?php if ( $open ) {
2836
+	echo ' style="display:none"';
2837
+}
2838
+?> class="wp_attachment_image wp-clearfix" id="media-head-<?php echo $attachment_id; ?>">
2726 2839
 			<p id="thumbnail-head-<?php echo $attachment_id; ?>"><img class="thumbnail" src="<?php echo set_url_scheme( $thumb_url[0] ); ?>" style="max-width:100%" alt="" /></p>
2727 2840
 			<p><?php echo $image_edit_button; ?></p>
2728 2841
 		</div>
2729
-		<div<?php if ( ! $open ) echo ' style="display:none"'; ?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
2730
-			<?php if ( $open ) wp_image_editor( $attachment_id ); ?>
2842
+		<div<?php if ( ! $open ) {
2843
+	echo ' style="display:none"';
2844
+}
2845
+?> class="image-editor" id="image-editor-<?php echo $attachment_id; ?>">
2846
+			<?php if ( $open ) {
2847
+	wp_image_editor( $attachment_id );
2848
+}
2849
+?>
2731 2850
 		</div>
2732 2851
 	<?php
2733 2852
 	elseif ( $attachment_id && wp_attachment_is( 'audio', $post ) ):
@@ -2813,8 +2932,9 @@  discard block
 block discarded – undo
2813 2932
 
2814 2933
 	$media_dims = '';
2815 2934
 	$meta = wp_get_attachment_metadata( $post->ID );
2816
-	if ( isset( $meta['width'], $meta['height'] ) )
2817
-		$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
2935
+	if ( isset( $meta['width'], $meta['height'] ) ) {
2936
+			$media_dims .= "<span id='media-dims-$post->ID'>{$meta['width']}&nbsp;&times;&nbsp;{$meta['height']}</span> ";
2937
+	}
2818 2938
 	/** This filter is documented in wp-admin/includes/media.php */
2819 2939
 	$media_dims = apply_filters( 'media_meta', $media_dims, $post );
2820 2940
 
@@ -2846,10 +2966,11 @@  discard block
 block discarded – undo
2846 2966
 	<?php
2847 2967
 		$file_size = false;
2848 2968
 
2849
-		if ( isset( $meta['filesize'] ) )
2850
-			$file_size = $meta['filesize'];
2851
-		elseif ( file_exists( $file ) )
2852
-			$file_size = filesize( $file );
2969
+		if ( isset( $meta['filesize'] ) ) {
2970
+					$file_size = $meta['filesize'];
2971
+		} elseif ( file_exists( $file ) ) {
2972
+					$file_size = filesize( $file );
2973
+		}
2853 2974
 
2854 2975
 		if ( ! empty( $file_size ) ) : ?>
2855 2976
 			<div class="misc-pub-section misc-pub-filesize">
@@ -2949,8 +3070,9 @@  discard block
 block discarded – undo
2949 3070
 				if ( 'length' !== $key && ! empty( $list ) ) {
2950 3071
 					$metadata[$key] = reset( $list );
2951 3072
 					// Fix bug in byte stream analysis.
2952
-					if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) )
2953
-						$metadata[$key] = 'Cop' . $metadata[$key];
3073
+					if ( 'terms_of_use' === $key && 0 === strpos( $metadata[$key], 'yright notice.' ) ) {
3074
+											$metadata[$key] = 'Cop' . $metadata[$key];
3075
+					}
2954 3076
 				}
2955 3077
 			}
2956 3078
 			break;
@@ -3003,32 +3125,45 @@  discard block
 block discarded – undo
3003 3125
 	$id3 = new getID3();
3004 3126
 	$data = $id3->analyze( $file );
3005 3127
 
3006
-	if ( isset( $data['video']['lossless'] ) )
3007
-		$metadata['lossless'] = $data['video']['lossless'];
3008
-	if ( ! empty( $data['video']['bitrate'] ) )
3009
-		$metadata['bitrate'] = (int) $data['video']['bitrate'];
3010
-	if ( ! empty( $data['video']['bitrate_mode'] ) )
3011
-		$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
3012
-	if ( ! empty( $data['filesize'] ) )
3013
-		$metadata['filesize'] = (int) $data['filesize'];
3014
-	if ( ! empty( $data['mime_type'] ) )
3015
-		$metadata['mime_type'] = $data['mime_type'];
3016
-	if ( ! empty( $data['playtime_seconds'] ) )
3017
-		$metadata['length'] = (int) round( $data['playtime_seconds'] );
3018
-	if ( ! empty( $data['playtime_string'] ) )
3019
-		$metadata['length_formatted'] = $data['playtime_string'];
3020
-	if ( ! empty( $data['video']['resolution_x'] ) )
3021
-		$metadata['width'] = (int) $data['video']['resolution_x'];
3022
-	if ( ! empty( $data['video']['resolution_y'] ) )
3023
-		$metadata['height'] = (int) $data['video']['resolution_y'];
3024
-	if ( ! empty( $data['fileformat'] ) )
3025
-		$metadata['fileformat'] = $data['fileformat'];
3026
-	if ( ! empty( $data['video']['dataformat'] ) )
3027
-		$metadata['dataformat'] = $data['video']['dataformat'];
3028
-	if ( ! empty( $data['video']['encoder'] ) )
3029
-		$metadata['encoder'] = $data['video']['encoder'];
3030
-	if ( ! empty( $data['video']['codec'] ) )
3031
-		$metadata['codec'] = $data['video']['codec'];
3128
+	if ( isset( $data['video']['lossless'] ) ) {
3129
+			$metadata['lossless'] = $data['video']['lossless'];
3130
+	}
3131
+	if ( ! empty( $data['video']['bitrate'] ) ) {
3132
+			$metadata['bitrate'] = (int) $data['video']['bitrate'];
3133
+	}
3134
+	if ( ! empty( $data['video']['bitrate_mode'] ) ) {
3135
+			$metadata['bitrate_mode'] = $data['video']['bitrate_mode'];
3136
+	}
3137
+	if ( ! empty( $data['filesize'] ) ) {
3138
+			$metadata['filesize'] = (int) $data['filesize'];
3139
+	}
3140
+	if ( ! empty( $data['mime_type'] ) ) {
3141
+			$metadata['mime_type'] = $data['mime_type'];
3142
+	}
3143
+	if ( ! empty( $data['playtime_seconds'] ) ) {
3144
+			$metadata['length'] = (int) round( $data['playtime_seconds'] );
3145
+	}
3146
+	if ( ! empty( $data['playtime_string'] ) ) {
3147
+			$metadata['length_formatted'] = $data['playtime_string'];
3148
+	}
3149
+	if ( ! empty( $data['video']['resolution_x'] ) ) {
3150
+			$metadata['width'] = (int) $data['video']['resolution_x'];
3151
+	}
3152
+	if ( ! empty( $data['video']['resolution_y'] ) ) {
3153
+			$metadata['height'] = (int) $data['video']['resolution_y'];
3154
+	}
3155
+	if ( ! empty( $data['fileformat'] ) ) {
3156
+			$metadata['fileformat'] = $data['fileformat'];
3157
+	}
3158
+	if ( ! empty( $data['video']['dataformat'] ) ) {
3159
+			$metadata['dataformat'] = $data['video']['dataformat'];
3160
+	}
3161
+	if ( ! empty( $data['video']['encoder'] ) ) {
3162
+			$metadata['encoder'] = $data['video']['encoder'];
3163
+	}
3164
+	if ( ! empty( $data['video']['codec'] ) ) {
3165
+			$metadata['codec'] = $data['video']['codec'];
3166
+	}
3032 3167
 
3033 3168
 	if ( ! empty( $data['audio'] ) ) {
3034 3169
 		unset( $data['audio']['streams'] );
@@ -3069,16 +3204,21 @@  discard block
 block discarded – undo
3069 3204
 		$metadata = $data['audio'];
3070 3205
 	}
3071 3206
 
3072
-	if ( ! empty( $data['fileformat'] ) )
3073
-		$metadata['fileformat'] = $data['fileformat'];
3074
-	if ( ! empty( $data['filesize'] ) )
3075
-		$metadata['filesize'] = (int) $data['filesize'];
3076
-	if ( ! empty( $data['mime_type'] ) )
3077
-		$metadata['mime_type'] = $data['mime_type'];
3078
-	if ( ! empty( $data['playtime_seconds'] ) )
3079
-		$metadata['length'] = (int) round( $data['playtime_seconds'] );
3080
-	if ( ! empty( $data['playtime_string'] ) )
3081
-		$metadata['length_formatted'] = $data['playtime_string'];
3207
+	if ( ! empty( $data['fileformat'] ) ) {
3208
+			$metadata['fileformat'] = $data['fileformat'];
3209
+	}
3210
+	if ( ! empty( $data['filesize'] ) ) {
3211
+			$metadata['filesize'] = (int) $data['filesize'];
3212
+	}
3213
+	if ( ! empty( $data['mime_type'] ) ) {
3214
+			$metadata['mime_type'] = $data['mime_type'];
3215
+	}
3216
+	if ( ! empty( $data['playtime_seconds'] ) ) {
3217
+			$metadata['length'] = (int) round( $data['playtime_seconds'] );
3218
+	}
3219
+	if ( ! empty( $data['playtime_string'] ) ) {
3220
+			$metadata['length_formatted'] = $data['playtime_string'];
3221
+	}
3082 3222
 
3083 3223
 	wp_add_id3_tag_data( $metadata, $data );
3084 3224
 
Please login to merge, or discard this patch.
src/wp-admin/includes/misc.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
  *
190 190
  * @global WP_Rewrite $wp_rewrite
191 191
  *
192
- * @return bool True if web.config was updated successfully
192
+ * @return null|boolean True if web.config was updated successfully
193 193
  */
194 194
 function iis7_save_url_rewrite_rules(){
195 195
 	if ( is_multisite() )
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
  *
276 276
  * @since 2.0.0
277 277
  *
278
- * @param array $vars An array of globals to reset.
278
+ * @param string[] $vars An array of globals to reset.
279 279
  */
280 280
 function wp_reset_vars( $vars ) {
281 281
 	foreach ( $vars as $var ) {
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Misc WordPress Administration API.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Misc WordPress Administration API.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Returns whether the server is running Apache with the mod_rewrite module loaded.
Please login to merge, or discard this patch.
Spacing   +188 added lines, -188 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
 	 *
29 29
 	 * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
30 30
 	 */
31
-	return apply_filters( 'got_rewrite', $got_rewrite );
31
+	return apply_filters('got_rewrite', $got_rewrite);
32 32
 }
33 33
 
34 34
 /**
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
  * @return bool Whether the server supports URL rewriting.
44 44
  */
45 45
 function got_url_rewrite() {
46
-	$got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
46
+	$got_url_rewrite = (got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks());
47 47
 
48 48
 	/**
49 49
 	 * Filter whether URL rewriting is available.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 	 *
53 53
 	 * @param bool $got_url_rewrite Whether URL rewriting is available.
54 54
 	 */
55
-	return apply_filters( 'got_url_rewrite', $got_url_rewrite );
55
+	return apply_filters('got_url_rewrite', $got_url_rewrite);
56 56
 }
57 57
 
58 58
 /**
@@ -64,22 +64,22 @@  discard block
 block discarded – undo
64 64
  * @param string $marker
65 65
  * @return array An array of strings from a file (.htaccess ) from between BEGIN and END markers.
66 66
  */
67
-function extract_from_markers( $filename, $marker ) {
68
-	$result = array ();
67
+function extract_from_markers($filename, $marker) {
68
+	$result = array();
69 69
 
70
-	if (!file_exists( $filename ) ) {
70
+	if ( ! file_exists($filename)) {
71 71
 		return $result;
72 72
 	}
73 73
 
74
-	if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
74
+	if ($markerdata = explode("\n", implode('', file($filename))));
75 75
 	{
76 76
 		$state = false;
77
-		foreach ( $markerdata as $markerline ) {
78
-			if (strpos($markerline, '# END ' . $marker) !== false)
77
+		foreach ($markerdata as $markerline) {
78
+			if (strpos($markerline, '# END '.$marker) !== false)
79 79
 				$state = false;
80
-			if ( $state )
80
+			if ($state)
81 81
 				$result[] = $markerline;
82
-			if (strpos($markerline, '# BEGIN ' . $marker) !== false)
82
+			if (strpos($markerline, '# BEGIN '.$marker) !== false)
83 83
 				$state = true;
84 84
 		}
85 85
 	}
@@ -101,52 +101,52 @@  discard block
 block discarded – undo
101 101
  * @param array|string $insertion The new content to insert.
102 102
  * @return bool True on write success, false on failure.
103 103
  */
104
-function insert_with_markers( $filename, $marker, $insertion ) {
105
-	if ( ! file_exists( $filename ) ) {
106
-		if ( ! is_writable( dirname( $filename ) ) ) {
104
+function insert_with_markers($filename, $marker, $insertion) {
105
+	if ( ! file_exists($filename)) {
106
+		if ( ! is_writable(dirname($filename))) {
107 107
 			return false;
108 108
 		}
109
-		if ( ! touch( $filename ) ) {
109
+		if ( ! touch($filename)) {
110 110
 			return false;
111 111
 		}
112
-	} elseif ( ! is_writeable( $filename ) ) {
112
+	} elseif ( ! is_writeable($filename)) {
113 113
 		return false;
114 114
 	}
115 115
 
116
-	if ( ! is_array( $insertion ) ) {
117
-		$insertion = explode( "\n", $insertion );
116
+	if ( ! is_array($insertion)) {
117
+		$insertion = explode("\n", $insertion);
118 118
 	}
119 119
 
120 120
 	$start_marker = "# BEGIN {$marker}";
121 121
 	$end_marker   = "# END {$marker}";
122 122
 
123
-	$fp = fopen( $filename, 'r+' );
124
-	if ( ! $fp ) {
123
+	$fp = fopen($filename, 'r+');
124
+	if ( ! $fp) {
125 125
 		return false;
126 126
 	}
127 127
 
128 128
 	// Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired.
129
-	flock( $fp, LOCK_EX );
129
+	flock($fp, LOCK_EX);
130 130
 
131 131
 	$lines = array();
132
-	while ( ! feof( $fp ) ) {
133
-		$lines[] = rtrim( fgets( $fp ), "\r\n" );
132
+	while ( ! feof($fp)) {
133
+		$lines[] = rtrim(fgets($fp), "\r\n");
134 134
 	}
135 135
 
136 136
 	// Split out the existing file into the preceeding lines, and those that appear after the marker
137 137
 	$pre_lines = $post_lines = $existing_lines = array();
138 138
 	$found_marker = $found_end_marker = false;
139
-	foreach ( $lines as $line ) {
140
-		if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
139
+	foreach ($lines as $line) {
140
+		if ( ! $found_marker && false !== strpos($line, $start_marker)) {
141 141
 			$found_marker = true;
142 142
 			continue;
143
-		} elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) {
143
+		} elseif ( ! $found_end_marker && false !== strpos($line, $end_marker)) {
144 144
 			$found_end_marker = true;
145 145
 			continue;
146 146
 		}
147
-		if ( ! $found_marker ) {
147
+		if ( ! $found_marker) {
148 148
 			$pre_lines[] = $line;
149
-		} elseif ( $found_marker && $found_end_marker ) {
149
+		} elseif ($found_marker && $found_end_marker) {
150 150
 			$post_lines[] = $line;
151 151
 		} else {
152 152
 			$existing_lines[] = $line;
@@ -154,31 +154,31 @@  discard block
 block discarded – undo
154 154
 	}
155 155
 
156 156
 	// Check to see if there was a change
157
-	if ( $existing_lines === $insertion ) {
158
-		flock( $fp, LOCK_UN );
159
-		fclose( $fp );
157
+	if ($existing_lines === $insertion) {
158
+		flock($fp, LOCK_UN);
159
+		fclose($fp);
160 160
 
161 161
 		return true;
162 162
 	}
163 163
 
164 164
 	// Generate the new file data
165
-	$new_file_data = implode( "\n", array_merge(
165
+	$new_file_data = implode("\n", array_merge(
166 166
 		$pre_lines,
167
-		array( $start_marker ),
167
+		array($start_marker),
168 168
 		$insertion,
169
-		array( $end_marker ),
169
+		array($end_marker),
170 170
 		$post_lines
171
-	) );
171
+	));
172 172
 
173 173
 	// Write to the start of the file, and truncate it to that length
174
-	fseek( $fp, 0 );
175
-	$bytes = fwrite( $fp, $new_file_data );
176
-	if ( $bytes ) {
177
-		ftruncate( $fp, ftell( $fp ) );
174
+	fseek($fp, 0);
175
+	$bytes = fwrite($fp, $new_file_data);
176
+	if ($bytes) {
177
+		ftruncate($fp, ftell($fp));
178 178
 	}
179
-	fflush( $fp );
180
-	flock( $fp, LOCK_UN );
181
-	fclose( $fp );
179
+	fflush($fp);
180
+	flock($fp, LOCK_UN);
181
+	fclose($fp);
182 182
 
183 183
 	return (bool) $bytes;
184 184
 }
@@ -194,7 +194,7 @@  discard block
 block discarded – undo
194 194
  * @global WP_Rewrite $wp_rewrite
195 195
  */
196 196
 function save_mod_rewrite_rules() {
197
-	if ( is_multisite() )
197
+	if (is_multisite())
198 198
 		return;
199 199
 
200 200
 	global $wp_rewrite;
@@ -206,10 +206,10 @@  discard block
 block discarded – undo
206 206
 	 * If the file doesn't already exist check for write access to the directory
207 207
 	 * and whether we have some rules. Else check for write access to the file.
208 208
 	 */
209
-	if ((!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
210
-		if ( got_mod_rewrite() ) {
211
-			$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
212
-			return insert_with_markers( $htaccess_file, 'WordPress', $rules );
209
+	if (( ! file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || is_writable($htaccess_file)) {
210
+		if (got_mod_rewrite()) {
211
+			$rules = explode("\n", $wp_rewrite->mod_rewrite_rules());
212
+			return insert_with_markers($htaccess_file, 'WordPress', $rules);
213 213
 		}
214 214
 	}
215 215
 
@@ -226,19 +226,19 @@  discard block
 block discarded – undo
226 226
  *
227 227
  * @return bool True if web.config was updated successfully
228 228
  */
229
-function iis7_save_url_rewrite_rules(){
230
-	if ( is_multisite() )
229
+function iis7_save_url_rewrite_rules() {
230
+	if (is_multisite())
231 231
 		return;
232 232
 
233 233
 	global $wp_rewrite;
234 234
 
235 235
 	$home_path = get_home_path();
236
-	$web_config_file = $home_path . 'web.config';
236
+	$web_config_file = $home_path.'web.config';
237 237
 
238 238
 	// Using win_is_writable() instead of is_writable() because of a bug in Windows PHP
239
-	if ( iis7_supports_permalinks() && ( ( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() ) || win_is_writable($web_config_file) ) ) {
239
+	if (iis7_supports_permalinks() && (( ! file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks()) || win_is_writable($web_config_file))) {
240 240
 		$rule = $wp_rewrite->iis7_url_rewrite_rules(false, '', '');
241
-		if ( ! empty($rule) ) {
241
+		if ( ! empty($rule)) {
242 242
 			return iis7_add_rewrite_rule($web_config_file, $rule);
243 243
 		} else {
244 244
 			return iis7_delete_rewrite_rule($web_config_file);
@@ -254,19 +254,19 @@  discard block
 block discarded – undo
254 254
  *
255 255
  * @param string $file
256 256
  */
257
-function update_recently_edited( $file ) {
258
-	$oldfiles = (array ) get_option( 'recently_edited' );
259
-	if ( $oldfiles ) {
260
-		$oldfiles = array_reverse( $oldfiles );
257
+function update_recently_edited($file) {
258
+	$oldfiles = (array) get_option('recently_edited');
259
+	if ($oldfiles) {
260
+		$oldfiles = array_reverse($oldfiles);
261 261
 		$oldfiles[] = $file;
262
-		$oldfiles = array_reverse( $oldfiles );
263
-		$oldfiles = array_unique( $oldfiles );
264
-		if ( 5 < count( $oldfiles ))
265
-			array_pop( $oldfiles );
262
+		$oldfiles = array_reverse($oldfiles);
263
+		$oldfiles = array_unique($oldfiles);
264
+		if (5 < count($oldfiles))
265
+			array_pop($oldfiles);
266 266
 	} else {
267 267
 		$oldfiles[] = $file;
268 268
 	}
269
-	update_option( 'recently_edited', $oldfiles );
269
+	update_option('recently_edited', $oldfiles);
270 270
 }
271 271
 
272 272
 /**
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
  * @param string $old_value
278 278
  * @param string $value
279 279
  */
280
-function update_home_siteurl( $old_value, $value ) {
281
-	if ( wp_installing() )
280
+function update_home_siteurl($old_value, $value) {
281
+	if (wp_installing())
282 282
 		return;
283 283
 
284
-	if ( is_multisite() && ms_is_switched() ) {
285
-		delete_option( 'rewrite_rules' );
284
+	if (is_multisite() && ms_is_switched()) {
285
+		delete_option('rewrite_rules');
286 286
 	} else {
287 287
 		flush_rewrite_rules();
288 288
 	}
@@ -300,16 +300,16 @@  discard block
 block discarded – undo
300 300
  *
301 301
  * @param array $vars An array of globals to reset.
302 302
  */
303
-function wp_reset_vars( $vars ) {
304
-	foreach ( $vars as $var ) {
305
-		if ( empty( $_POST[ $var ] ) ) {
306
-			if ( empty( $_GET[ $var ] ) ) {
307
-				$GLOBALS[ $var ] = '';
303
+function wp_reset_vars($vars) {
304
+	foreach ($vars as $var) {
305
+		if (empty($_POST[$var])) {
306
+			if (empty($_GET[$var])) {
307
+				$GLOBALS[$var] = '';
308 308
 			} else {
309
-				$GLOBALS[ $var ] = $_GET[ $var ];
309
+				$GLOBALS[$var] = $_GET[$var];
310 310
 			}
311 311
 		} else {
312
-			$GLOBALS[ $var ] = $_POST[ $var ];
312
+			$GLOBALS[$var] = $_POST[$var];
313 313
 		}
314 314
 	}
315 315
 }
@@ -322,9 +322,9 @@  discard block
 block discarded – undo
322 322
  * @param string|WP_Error $message
323 323
  */
324 324
 function show_message($message) {
325
-	if ( is_wp_error($message) ){
326
-		if ( $message->get_error_data() && is_string( $message->get_error_data() ) )
327
-			$message = $message->get_error_message() . ': ' . $message->get_error_data();
325
+	if (is_wp_error($message)) {
326
+		if ($message->get_error_data() && is_string($message->get_error_data()))
327
+			$message = $message->get_error_message().': '.$message->get_error_data();
328 328
 		else
329 329
 			$message = $message->get_error_message();
330 330
 	}
@@ -339,25 +339,25 @@  discard block
 block discarded – undo
339 339
  * @param string $content
340 340
  * @return array
341 341
  */
342
-function wp_doc_link_parse( $content ) {
343
-	if ( !is_string( $content ) || empty( $content ) )
342
+function wp_doc_link_parse($content) {
343
+	if ( ! is_string($content) || empty($content))
344 344
 		return array();
345 345
 
346
-	if ( !function_exists('token_get_all') )
346
+	if ( ! function_exists('token_get_all'))
347 347
 		return array();
348 348
 
349
-	$tokens = token_get_all( $content );
350
-	$count = count( $tokens );
349
+	$tokens = token_get_all($content);
350
+	$count = count($tokens);
351 351
 	$functions = array();
352 352
 	$ignore_functions = array();
353
-	for ( $t = 0; $t < $count - 2; $t++ ) {
354
-		if ( ! is_array( $tokens[ $t ] ) ) {
353
+	for ($t = 0; $t < $count - 2; $t++) {
354
+		if ( ! is_array($tokens[$t])) {
355 355
 			continue;
356 356
 		}
357 357
 
358
-		if ( T_STRING == $tokens[ $t ][0] && ( '(' == $tokens[ $t + 1 ] || '(' == $tokens[ $t + 2 ] ) ) {
358
+		if (T_STRING == $tokens[$t][0] && ('(' == $tokens[$t + 1] || '(' == $tokens[$t + 2])) {
359 359
 			// If it's a function or class defined locally, there's not going to be any docs available
360
-			if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ) ) ) || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR == $tokens[ $t - 1 ][0] ) ) {
360
+			if ((isset($tokens[$t - 2][1]) && in_array($tokens[$t - 2][1], array('function', 'class'))) || (isset($tokens[$t - 2][0]) && T_OBJECT_OPERATOR == $tokens[$t - 1][0])) {
361 361
 				$ignore_functions[] = $tokens[$t][1];
362 362
 			}
363 363
 			// Add this to our stack of unique references
@@ -365,8 +365,8 @@  discard block
 block discarded – undo
365 365
 		}
366 366
 	}
367 367
 
368
-	$functions = array_unique( $functions );
369
-	sort( $functions );
368
+	$functions = array_unique($functions);
369
+	sort($functions);
370 370
 
371 371
 	/**
372 372
 	 * Filter the list of functions and classes to be ignored from the documentation lookup.
@@ -375,13 +375,13 @@  discard block
 block discarded – undo
375 375
 	 *
376 376
 	 * @param array $ignore_functions Functions and classes to be ignored.
377 377
 	 */
378
-	$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
378
+	$ignore_functions = apply_filters('documentation_ignore_functions', $ignore_functions);
379 379
 
380
-	$ignore_functions = array_unique( $ignore_functions );
380
+	$ignore_functions = array_unique($ignore_functions);
381 381
 
382 382
 	$out = array();
383
-	foreach ( $functions as $function ) {
384
-		if ( in_array( $function, $ignore_functions ) )
383
+	foreach ($functions as $function) {
384
+		if (in_array($function, $ignore_functions))
385 385
 			continue;
386 386
 		$out[] = $function;
387 387
 	}
@@ -396,28 +396,28 @@  discard block
 block discarded – undo
396 396
  */
397 397
 function set_screen_options() {
398 398
 
399
-	if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
400
-		check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
399
+	if (isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options'])) {
400
+		check_admin_referer('screen-options-nonce', 'screenoptionnonce');
401 401
 
402
-		if ( !$user = wp_get_current_user() )
402
+		if ( ! $user = wp_get_current_user())
403 403
 			return;
404 404
 		$option = $_POST['wp_screen_options']['option'];
405 405
 		$value = $_POST['wp_screen_options']['value'];
406 406
 
407
-		if ( $option != sanitize_key( $option ) )
407
+		if ($option != sanitize_key($option))
408 408
 			return;
409 409
 
410 410
 		$map_option = $option;
411 411
 		$type = str_replace('edit_', '', $map_option);
412 412
 		$type = str_replace('_per_page', '', $type);
413
-		if ( in_array( $type, get_taxonomies() ) )
413
+		if (in_array($type, get_taxonomies()))
414 414
 			$map_option = 'edit_tags_per_page';
415
-		elseif ( in_array( $type, get_post_types() ) )
415
+		elseif (in_array($type, get_post_types()))
416 416
 			$map_option = 'edit_per_page';
417 417
 		else
418 418
 			$option = str_replace('-', '_', $option);
419 419
 
420
-		switch ( $map_option ) {
420
+		switch ($map_option) {
421 421
 			case 'edit_per_page':
422 422
 			case 'users_per_page':
423 423
 			case 'edit_comments_per_page':
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			case 'themes_network_per_page':
433 433
 			case 'site_themes_network_per_page':
434 434
 				$value = (int) $value;
435
-				if ( $value < 1 || $value > 999 )
435
+				if ($value < 1 || $value > 999)
436 436
 					return;
437 437
 				break;
438 438
 			default:
@@ -453,21 +453,21 @@  discard block
 block discarded – undo
453 453
 				 * @param string   $option The option name.
454 454
 				 * @param int      $value  The number of rows to use.
455 455
 				 */
456
-				$value = apply_filters( 'set-screen-option', false, $option, $value );
456
+				$value = apply_filters('set-screen-option', false, $option, $value);
457 457
 
458
-				if ( false === $value )
458
+				if (false === $value)
459 459
 					return;
460 460
 				break;
461 461
 		}
462 462
 
463 463
 		update_user_meta($user->ID, $option, $value);
464 464
 
465
-		$url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
466
-		if ( isset( $_POST['mode'] ) ) {
467
-			$url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url );
465
+		$url = remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer());
466
+		if (isset($_POST['mode'])) {
467
+			$url = add_query_arg(array('mode' => $_POST['mode']), $url);
468 468
 		}
469 469
 
470
-		wp_safe_redirect( $url );
470
+		wp_safe_redirect($url);
471 471
 		exit;
472 472
 	}
473 473
 }
@@ -481,18 +481,18 @@  discard block
 block discarded – undo
481 481
  * @param string $filename The file path to the configuration file
482 482
  */
483 483
 function iis7_rewrite_rule_exists($filename) {
484
-	if ( ! file_exists($filename) )
484
+	if ( ! file_exists($filename))
485 485
 		return false;
486
-	if ( ! class_exists( 'DOMDocument', false ) ) {
486
+	if ( ! class_exists('DOMDocument', false)) {
487 487
 		return false;
488 488
 	}
489 489
 
490 490
 	$doc = new DOMDocument();
491
-	if ( $doc->load($filename) === false )
491
+	if ($doc->load($filename) === false)
492 492
 		return false;
493 493
 	$xpath = new DOMXPath($doc);
494 494
 	$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
495
-	if ( $rules->length == 0 )
495
+	if ($rules->length == 0)
496 496
 		return false;
497 497
 	else
498 498
 		return true;
@@ -508,21 +508,21 @@  discard block
 block discarded – undo
508 508
  */
509 509
 function iis7_delete_rewrite_rule($filename) {
510 510
 	// If configuration file does not exist then rules also do not exist so there is nothing to delete
511
-	if ( ! file_exists($filename) )
511
+	if ( ! file_exists($filename))
512 512
 		return true;
513 513
 
514
-	if ( ! class_exists( 'DOMDocument', false ) ) {
514
+	if ( ! class_exists('DOMDocument', false)) {
515 515
 		return false;
516 516
 	}
517 517
 
518 518
 	$doc = new DOMDocument();
519 519
 	$doc->preserveWhiteSpace = false;
520 520
 
521
-	if ( $doc -> load($filename) === false )
521
+	if ($doc -> load($filename) === false)
522 522
 		return false;
523 523
 	$xpath = new DOMXPath($doc);
524 524
 	$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
525
-	if ( $rules->length > 0 ) {
525
+	if ($rules->length > 0) {
526 526
 		$child = $rules->item(0);
527 527
 		$parent = $child->parentNode;
528 528
 		$parent->removeChild($child);
@@ -542,13 +542,13 @@  discard block
 block discarded – undo
542 542
  * @return bool
543 543
  */
544 544
 function iis7_add_rewrite_rule($filename, $rewrite_rule) {
545
-	if ( ! class_exists( 'DOMDocument', false ) ) {
545
+	if ( ! class_exists('DOMDocument', false)) {
546 546
 		return false;
547 547
 	}
548 548
 
549 549
 	// If configuration file does not exist then we create one.
550
-	if ( ! file_exists($filename) ) {
551
-		$fp = fopen( $filename, 'w');
550
+	if ( ! file_exists($filename)) {
551
+		$fp = fopen($filename, 'w');
552 552
 		fwrite($fp, '<configuration/>');
553 553
 		fclose($fp);
554 554
 	}
@@ -556,25 +556,25 @@  discard block
 block discarded – undo
556 556
 	$doc = new DOMDocument();
557 557
 	$doc->preserveWhiteSpace = false;
558 558
 
559
-	if ( $doc->load($filename) === false )
559
+	if ($doc->load($filename) === false)
560 560
 		return false;
561 561
 
562 562
 	$xpath = new DOMXPath($doc);
563 563
 
564 564
 	// First check if the rule already exists as in that case there is no need to re-add it
565 565
 	$wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
566
-	if ( $wordpress_rules->length > 0 )
566
+	if ($wordpress_rules->length > 0)
567 567
 		return true;
568 568
 
569 569
 	// Check the XPath to the rewrite rule and create XML nodes if they do not exist
570 570
 	$xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules');
571
-	if ( $xmlnodes->length > 0 ) {
571
+	if ($xmlnodes->length > 0) {
572 572
 		$rules_node = $xmlnodes->item(0);
573 573
 	} else {
574 574
 		$rules_node = $doc->createElement('rules');
575 575
 
576 576
 		$xmlnodes = $xpath->query('/configuration/system.webServer/rewrite');
577
-		if ( $xmlnodes->length > 0 ) {
577
+		if ($xmlnodes->length > 0) {
578 578
 			$rewrite_node = $xmlnodes->item(0);
579 579
 			$rewrite_node->appendChild($rules_node);
580 580
 		} else {
@@ -582,7 +582,7 @@  discard block
 block discarded – undo
582 582
 			$rewrite_node->appendChild($rules_node);
583 583
 
584 584
 			$xmlnodes = $xpath->query('/configuration/system.webServer');
585
-			if ( $xmlnodes->length > 0 ) {
585
+			if ($xmlnodes->length > 0) {
586 586
 				$system_webServer_node = $xmlnodes->item(0);
587 587
 				$system_webServer_node->appendChild($rewrite_node);
588 588
 			} else {
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 				$system_webServer_node->appendChild($rewrite_node);
591 591
 
592 592
 				$xmlnodes = $xpath->query('/configuration');
593
-				if ( $xmlnodes->length > 0 ) {
593
+				if ($xmlnodes->length > 0) {
594 594
 					$config_node = $xmlnodes->item(0);
595 595
 					$config_node->appendChild($system_webServer_node);
596 596
 				} else {
@@ -638,42 +638,42 @@  discard block
 block discarded – undo
638 638
  *
639 639
  * @param int $user_id User ID.
640 640
  */
641
-function admin_color_scheme_picker( $user_id ) {
641
+function admin_color_scheme_picker($user_id) {
642 642
 	global $_wp_admin_css_colors;
643 643
 
644
-	ksort( $_wp_admin_css_colors );
644
+	ksort($_wp_admin_css_colors);
645 645
 
646
-	if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
646
+	if (isset($_wp_admin_css_colors['fresh'])) {
647 647
 		// Set Default ('fresh') and Light should go first.
648
-		$_wp_admin_css_colors = array_filter( array_merge( array( 'fresh' => '', 'light' => '' ), $_wp_admin_css_colors ) );
648
+		$_wp_admin_css_colors = array_filter(array_merge(array('fresh' => '', 'light' => ''), $_wp_admin_css_colors));
649 649
 	}
650 650
 
651
-	$current_color = get_user_option( 'admin_color', $user_id );
651
+	$current_color = get_user_option('admin_color', $user_id);
652 652
 
653
-	if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
653
+	if (empty($current_color) || ! isset($_wp_admin_css_colors[$current_color])) {
654 654
 		$current_color = 'fresh';
655 655
 	}
656 656
 
657 657
 	?>
658 658
 	<fieldset id="color-picker" class="scheme-list">
659
-		<legend class="screen-reader-text"><span><?php _e( 'Admin Color Scheme' ); ?></span></legend>
659
+		<legend class="screen-reader-text"><span><?php _e('Admin Color Scheme'); ?></span></legend>
660 660
 		<?php
661
-		wp_nonce_field( 'save-color-scheme', 'color-nonce', false );
662
-		foreach ( $_wp_admin_css_colors as $color => $color_info ) :
661
+		wp_nonce_field('save-color-scheme', 'color-nonce', false);
662
+		foreach ($_wp_admin_css_colors as $color => $color_info) :
663 663
 
664 664
 			?>
665
-			<div class="color-option <?php echo ( $color == $current_color ) ? 'selected' : ''; ?>">
666
-				<input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> />
667
-				<input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" />
668
-				<input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" />
669
-				<label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label>
665
+			<div class="color-option <?php echo ($color == $current_color) ? 'selected' : ''; ?>">
666
+				<input name="admin_color" id="admin_color_<?php echo esc_attr($color); ?>" type="radio" value="<?php echo esc_attr($color); ?>" class="tog" <?php checked($color, $current_color); ?> />
667
+				<input type="hidden" class="css_url" value="<?php echo esc_url($color_info->url); ?>" />
668
+				<input type="hidden" class="icon_colors" value="<?php echo esc_attr(wp_json_encode(array('icons' => $color_info->icon_colors))); ?>" />
669
+				<label for="admin_color_<?php echo esc_attr($color); ?>"><?php echo esc_html($color_info->name); ?></label>
670 670
 				<table class="color-palette">
671 671
 					<tr>
672 672
 					<?php
673 673
 
674
-					foreach ( $color_info->colors as $html_color ) {
674
+					foreach ($color_info->colors as $html_color) {
675 675
 						?>
676
-						<td style="background-color: <?php echo esc_attr( $html_color ); ?>">&nbsp;</td>
676
+						<td style="background-color: <?php echo esc_attr($html_color); ?>">&nbsp;</td>
677 677
 						<?php
678 678
 					}
679 679
 
@@ -697,30 +697,30 @@  discard block
 block discarded – undo
697 697
 function wp_color_scheme_settings() {
698 698
 	global $_wp_admin_css_colors;
699 699
 
700
-	$color_scheme = get_user_option( 'admin_color' );
700
+	$color_scheme = get_user_option('admin_color');
701 701
 
702 702
 	// It's possible to have a color scheme set that is no longer registered.
703
-	if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
703
+	if (empty($_wp_admin_css_colors[$color_scheme])) {
704 704
 		$color_scheme = 'fresh';
705 705
 	}
706 706
 
707
-	if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) {
708
-		$icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors;
709
-	} elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) {
707
+	if ( ! empty($_wp_admin_css_colors[$color_scheme]->icon_colors)) {
708
+		$icon_colors = $_wp_admin_css_colors[$color_scheme]->icon_colors;
709
+	} elseif ( ! empty($_wp_admin_css_colors['fresh']->icon_colors)) {
710 710
 		$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
711 711
 	} else {
712 712
 		// Fall back to the default set of icon colors if the default scheme is missing.
713
-		$icon_colors = array( 'base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff' );
713
+		$icon_colors = array('base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff');
714 714
 	}
715 715
 
716
-	echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
716
+	echo '<script type="text/javascript">var _wpColorScheme = '.wp_json_encode(array('icons' => $icon_colors)).";</script>\n";
717 717
 }
718 718
 
719 719
 /**
720 720
  * @since 3.3.0
721 721
  */
722 722
 function _ipad_meta() {
723
-	if ( wp_is_mobile() ) {
723
+	if (wp_is_mobile()) {
724 724
 		?>
725 725
 		<meta name="viewport" id="viewport-meta" content="width=device-width, initial-scale=1">
726 726
 		<?php
@@ -737,18 +737,18 @@  discard block
 block discarded – undo
737 737
  * @param string $screen_id The screen id.
738 738
  * @return array The Heartbeat response.
739 739
  */
740
-function wp_check_locked_posts( $response, $data, $screen_id ) {
740
+function wp_check_locked_posts($response, $data, $screen_id) {
741 741
 	$checked = array();
742 742
 
743
-	if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
744
-		foreach ( $data['wp-check-locked-posts'] as $key ) {
745
-			if ( ! $post_id = absint( substr( $key, 5 ) ) )
743
+	if (array_key_exists('wp-check-locked-posts', $data) && is_array($data['wp-check-locked-posts'])) {
744
+		foreach ($data['wp-check-locked-posts'] as $key) {
745
+			if ( ! $post_id = absint(substr($key, 5)))
746 746
 				continue;
747 747
 
748
-			if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
749
-				$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
748
+			if (($user_id = wp_check_post_lock($post_id)) && ($user = get_userdata($user_id)) && current_user_can('edit_post', $post_id)) {
749
+				$send = array('text' => sprintf(__('%s is currently editing'), $user->display_name));
750 750
 
751
-				if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
751
+				if (($avatar = get_avatar($user->ID, 18)) && preg_match("|src='([^']+)'|", $avatar, $matches))
752 752
 					$send['avatar_src'] = $matches[1];
753 753
 
754 754
 				$checked[$key] = $send;
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
 		}
757 757
 	}
758 758
 
759
-	if ( ! empty( $checked ) )
759
+	if ( ! empty($checked))
760 760
 		$response['wp-check-locked-posts'] = $checked;
761 761
 
762 762
 	return $response;
@@ -772,31 +772,31 @@  discard block
 block discarded – undo
772 772
  * @param string $screen_id The screen id.
773 773
  * @return array The Heartbeat response.
774 774
  */
775
-function wp_refresh_post_lock( $response, $data, $screen_id ) {
776
-	if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
775
+function wp_refresh_post_lock($response, $data, $screen_id) {
776
+	if (array_key_exists('wp-refresh-post-lock', $data)) {
777 777
 		$received = $data['wp-refresh-post-lock'];
778 778
 		$send = array();
779 779
 
780
-		if ( ! $post_id = absint( $received['post_id'] ) )
780
+		if ( ! $post_id = absint($received['post_id']))
781 781
 			return $response;
782 782
 
783
-		if ( ! current_user_can('edit_post', $post_id) )
783
+		if ( ! current_user_can('edit_post', $post_id))
784 784
 			return $response;
785 785
 
786
-		if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
786
+		if (($user_id = wp_check_post_lock($post_id)) && ($user = get_userdata($user_id))) {
787 787
 			$error = array(
788
-				'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name )
788
+				'text' => sprintf(__('%s has taken over and is currently editing.'), $user->display_name)
789 789
 			);
790 790
 
791
-			if ( $avatar = get_avatar( $user->ID, 64 ) ) {
792
-				if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) )
791
+			if ($avatar = get_avatar($user->ID, 64)) {
792
+				if (preg_match("|src='([^']+)'|", $avatar, $matches))
793 793
 					$error['avatar_src'] = $matches[1];
794 794
 			}
795 795
 
796 796
 			$send['lock_error'] = $error;
797 797
 		} else {
798
-			if ( $new_lock = wp_set_post_lock( $post_id ) )
799
-				$send['new_lock'] = implode( ':', $new_lock );
798
+			if ($new_lock = wp_set_post_lock($post_id))
799
+				$send['new_lock'] = implode(':', $new_lock);
800 800
 		}
801 801
 
802 802
 		$response['wp-refresh-post-lock'] = $send;
@@ -815,16 +815,16 @@  discard block
 block discarded – undo
815 815
  * @param string $screen_id The screen id.
816 816
  * @return array The Heartbeat response.
817 817
  */
818
-function wp_refresh_post_nonces( $response, $data, $screen_id ) {
819
-	if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
818
+function wp_refresh_post_nonces($response, $data, $screen_id) {
819
+	if (array_key_exists('wp-refresh-post-nonces', $data)) {
820 820
 		$received = $data['wp-refresh-post-nonces'];
821
-		$response['wp-refresh-post-nonces'] = array( 'check' => 1 );
821
+		$response['wp-refresh-post-nonces'] = array('check' => 1);
822 822
 
823
-		if ( ! $post_id = absint( $received['post_id'] ) ) {
823
+		if ( ! $post_id = absint($received['post_id'])) {
824 824
 			return $response;
825 825
 		}
826 826
 
827
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
827
+		if ( ! current_user_can('edit_post', $post_id)) {
828 828
 			return $response;
829 829
 		}
830 830
 
@@ -833,10 +833,10 @@  discard block
 block discarded – undo
833 833
 				'getpermalinknonce' => wp_create_nonce('getpermalink'),
834 834
 				'samplepermalinknonce' => wp_create_nonce('samplepermalink'),
835 835
 				'closedpostboxesnonce' => wp_create_nonce('closedpostboxes'),
836
-				'_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ),
837
-				'_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ),
836
+				'_ajax_linking_nonce' => wp_create_nonce('internal-linking'),
837
+				'_wpnonce' => wp_create_nonce('update-post_'.$post_id),
838 838
 			),
839
-			'heartbeatNonce' => wp_create_nonce( 'heartbeat-nonce' ),
839
+			'heartbeatNonce' => wp_create_nonce('heartbeat-nonce'),
840 840
 		);
841 841
 	}
842 842
 
@@ -853,10 +853,10 @@  discard block
 block discarded – undo
853 853
  * @param array $settings An array of Heartbeat settings.
854 854
  * @return array Filtered Heartbeat settings.
855 855
  */
856
-function wp_heartbeat_set_suspension( $settings ) {
856
+function wp_heartbeat_set_suspension($settings) {
857 857
 	global $pagenow;
858 858
 
859
-	if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
859
+	if ('post.php' === $pagenow || 'post-new.php' === $pagenow) {
860 860
 		$settings['suspension'] = 'disable';
861 861
 	}
862 862
 
@@ -872,19 +872,19 @@  discard block
 block discarded – undo
872 872
  * @param array $data     The $_POST data sent.
873 873
  * @return array The Heartbeat response.
874 874
  */
875
-function heartbeat_autosave( $response, $data ) {
876
-	if ( ! empty( $data['wp_autosave'] ) ) {
877
-		$saved = wp_autosave( $data['wp_autosave'] );
878
-
879
-		if ( is_wp_error( $saved ) ) {
880
-			$response['wp_autosave'] = array( 'success' => false, 'message' => $saved->get_error_message() );
881
-		} elseif ( empty( $saved ) ) {
882
-			$response['wp_autosave'] = array( 'success' => false, 'message' => __( 'Error while saving.' ) );
875
+function heartbeat_autosave($response, $data) {
876
+	if ( ! empty($data['wp_autosave'])) {
877
+		$saved = wp_autosave($data['wp_autosave']);
878
+
879
+		if (is_wp_error($saved)) {
880
+			$response['wp_autosave'] = array('success' => false, 'message' => $saved->get_error_message());
881
+		} elseif (empty($saved)) {
882
+			$response['wp_autosave'] = array('success' => false, 'message' => __('Error while saving.'));
883 883
 		} else {
884 884
 			/* translators: draft saved date format, see http://php.net/date */
885
-			$draft_saved_date_format = __( 'g:i:s a' );
885
+			$draft_saved_date_format = __('g:i:s a');
886 886
 			/* translators: %s: date and time */
887
-			$response['wp_autosave'] = array( 'success' => true, 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ) );
887
+			$response['wp_autosave'] = array('success' => true, 'message' => sprintf(__('Draft saved at %s.'), date_i18n($draft_saved_date_format)));
888 888
 		}
889 889
 	}
890 890
 
@@ -904,7 +904,7 @@  discard block
 block discarded – undo
904 904
 function post_form_autocomplete_off() {
905 905
 	global $is_safari, $is_chrome;
906 906
 
907
-	if ( $is_safari || $is_chrome ) {
907
+	if ($is_safari || $is_chrome) {
908 908
 		echo ' autocomplete="off"';
909 909
 	}
910 910
 }
@@ -920,15 +920,15 @@  discard block
 block discarded – undo
920 920
 function wp_admin_canonical_url() {
921 921
 	$removable_query_args = wp_removable_query_args();
922 922
 
923
-	if ( empty( $removable_query_args ) ) {
923
+	if (empty($removable_query_args)) {
924 924
 		return;
925 925
 	}
926 926
 
927 927
 	// Ensure we're using an absolute URL.
928
-	$current_url  = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
929
-	$filtered_url = remove_query_arg( $removable_query_args, $current_url );
928
+	$current_url  = set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
929
+	$filtered_url = remove_query_arg($removable_query_args, $current_url);
930 930
 	?>
931
-	<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
931
+	<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url($filtered_url); ?>" />
932 932
 	<script>
933 933
 		if ( window.history.replaceState ) {
934 934
 			window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash );
Please login to merge, or discard this patch.
Braces   +99 added lines, -69 removed lines patch added patch discarded remove patch
@@ -75,12 +75,15 @@  discard block
 block discarded – undo
75 75
 	{
76 76
 		$state = false;
77 77
 		foreach ( $markerdata as $markerline ) {
78
-			if (strpos($markerline, '# END ' . $marker) !== false)
79
-				$state = false;
80
-			if ( $state )
81
-				$result[] = $markerline;
82
-			if (strpos($markerline, '# BEGIN ' . $marker) !== false)
83
-				$state = true;
78
+			if (strpos($markerline, '# END ' . $marker) !== false) {
79
+							$state = false;
80
+			}
81
+			if ( $state ) {
82
+							$result[] = $markerline;
83
+			}
84
+			if (strpos($markerline, '# BEGIN ' . $marker) !== false) {
85
+							$state = true;
86
+			}
84 87
 		}
85 88
 	}
86 89
 
@@ -194,8 +197,9 @@  discard block
 block discarded – undo
194 197
  * @global WP_Rewrite $wp_rewrite
195 198
  */
196 199
 function save_mod_rewrite_rules() {
197
-	if ( is_multisite() )
198
-		return;
200
+	if ( is_multisite() ) {
201
+			return;
202
+	}
199 203
 
200 204
 	global $wp_rewrite;
201 205
 
@@ -227,8 +231,9 @@  discard block
 block discarded – undo
227 231
  * @return bool True if web.config was updated successfully
228 232
  */
229 233
 function iis7_save_url_rewrite_rules(){
230
-	if ( is_multisite() )
231
-		return;
234
+	if ( is_multisite() ) {
235
+			return;
236
+	}
232 237
 
233 238
 	global $wp_rewrite;
234 239
 
@@ -261,8 +266,9 @@  discard block
 block discarded – undo
261 266
 		$oldfiles[] = $file;
262 267
 		$oldfiles = array_reverse( $oldfiles );
263 268
 		$oldfiles = array_unique( $oldfiles );
264
-		if ( 5 < count( $oldfiles ))
265
-			array_pop( $oldfiles );
269
+		if ( 5 < count( $oldfiles )) {
270
+					array_pop( $oldfiles );
271
+		}
266 272
 	} else {
267 273
 		$oldfiles[] = $file;
268 274
 	}
@@ -278,8 +284,9 @@  discard block
 block discarded – undo
278 284
  * @param string $value
279 285
  */
280 286
 function update_home_siteurl( $old_value, $value ) {
281
-	if ( wp_installing() )
282
-		return;
287
+	if ( wp_installing() ) {
288
+			return;
289
+	}
283 290
 
284 291
 	if ( is_multisite() && ms_is_switched() ) {
285 292
 		delete_option( 'rewrite_rules' );
@@ -323,10 +330,11 @@  discard block
 block discarded – undo
323 330
  */
324 331
 function show_message($message) {
325 332
 	if ( is_wp_error($message) ){
326
-		if ( $message->get_error_data() && is_string( $message->get_error_data() ) )
327
-			$message = $message->get_error_message() . ': ' . $message->get_error_data();
328
-		else
329
-			$message = $message->get_error_message();
333
+		if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
334
+					$message = $message->get_error_message() . ': ' . $message->get_error_data();
335
+		} else {
336
+					$message = $message->get_error_message();
337
+		}
330 338
 	}
331 339
 	echo "<p>$message</p>\n";
332 340
 	wp_ob_end_flush_all();
@@ -340,11 +348,13 @@  discard block
 block discarded – undo
340 348
  * @return array
341 349
  */
342 350
 function wp_doc_link_parse( $content ) {
343
-	if ( !is_string( $content ) || empty( $content ) )
344
-		return array();
351
+	if ( !is_string( $content ) || empty( $content ) ) {
352
+			return array();
353
+	}
345 354
 
346
-	if ( !function_exists('token_get_all') )
347
-		return array();
355
+	if ( !function_exists('token_get_all') ) {
356
+			return array();
357
+	}
348 358
 
349 359
 	$tokens = token_get_all( $content );
350 360
 	$count = count( $tokens );
@@ -381,8 +391,9 @@  discard block
 block discarded – undo
381 391
 
382 392
 	$out = array();
383 393
 	foreach ( $functions as $function ) {
384
-		if ( in_array( $function, $ignore_functions ) )
385
-			continue;
394
+		if ( in_array( $function, $ignore_functions ) ) {
395
+					continue;
396
+		}
386 397
 		$out[] = $function;
387 398
 	}
388 399
 
@@ -399,23 +410,26 @@  discard block
 block discarded – undo
399 410
 	if ( isset($_POST['wp_screen_options']) && is_array($_POST['wp_screen_options']) ) {
400 411
 		check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
401 412
 
402
-		if ( !$user = wp_get_current_user() )
403
-			return;
413
+		if ( !$user = wp_get_current_user() ) {
414
+					return;
415
+		}
404 416
 		$option = $_POST['wp_screen_options']['option'];
405 417
 		$value = $_POST['wp_screen_options']['value'];
406 418
 
407
-		if ( $option != sanitize_key( $option ) )
408
-			return;
419
+		if ( $option != sanitize_key( $option ) ) {
420
+					return;
421
+		}
409 422
 
410 423
 		$map_option = $option;
411 424
 		$type = str_replace('edit_', '', $map_option);
412 425
 		$type = str_replace('_per_page', '', $type);
413
-		if ( in_array( $type, get_taxonomies() ) )
414
-			$map_option = 'edit_tags_per_page';
415
-		elseif ( in_array( $type, get_post_types() ) )
416
-			$map_option = 'edit_per_page';
417
-		else
418
-			$option = str_replace('-', '_', $option);
426
+		if ( in_array( $type, get_taxonomies() ) ) {
427
+					$map_option = 'edit_tags_per_page';
428
+		} elseif ( in_array( $type, get_post_types() ) ) {
429
+					$map_option = 'edit_per_page';
430
+		} else {
431
+					$option = str_replace('-', '_', $option);
432
+		}
419 433
 
420 434
 		switch ( $map_option ) {
421 435
 			case 'edit_per_page':
@@ -432,8 +446,9 @@  discard block
 block discarded – undo
432 446
 			case 'themes_network_per_page':
433 447
 			case 'site_themes_network_per_page':
434 448
 				$value = (int) $value;
435
-				if ( $value < 1 || $value > 999 )
436
-					return;
449
+				if ( $value < 1 || $value > 999 ) {
450
+									return;
451
+				}
437 452
 				break;
438 453
 			default:
439 454
 
@@ -455,8 +470,9 @@  discard block
 block discarded – undo
455 470
 				 */
456 471
 				$value = apply_filters( 'set-screen-option', false, $option, $value );
457 472
 
458
-				if ( false === $value )
459
-					return;
473
+				if ( false === $value ) {
474
+									return;
475
+				}
460 476
 				break;
461 477
 		}
462 478
 
@@ -481,22 +497,25 @@  discard block
 block discarded – undo
481 497
  * @param string $filename The file path to the configuration file
482 498
  */
483 499
 function iis7_rewrite_rule_exists($filename) {
484
-	if ( ! file_exists($filename) )
485
-		return false;
500
+	if ( ! file_exists($filename) ) {
501
+			return false;
502
+	}
486 503
 	if ( ! class_exists( 'DOMDocument', false ) ) {
487 504
 		return false;
488 505
 	}
489 506
 
490 507
 	$doc = new DOMDocument();
491
-	if ( $doc->load($filename) === false )
492
-		return false;
508
+	if ( $doc->load($filename) === false ) {
509
+			return false;
510
+	}
493 511
 	$xpath = new DOMXPath($doc);
494 512
 	$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
495
-	if ( $rules->length == 0 )
496
-		return false;
497
-	else
498
-		return true;
499
-}
513
+	if ( $rules->length == 0 ) {
514
+			return false;
515
+	} else {
516
+			return true;
517
+	}
518
+	}
500 519
 
501 520
 /**
502 521
  * Delete WordPress rewrite rule from web.config file if it exists there
@@ -508,8 +527,9 @@  discard block
 block discarded – undo
508 527
  */
509 528
 function iis7_delete_rewrite_rule($filename) {
510 529
 	// If configuration file does not exist then rules also do not exist so there is nothing to delete
511
-	if ( ! file_exists($filename) )
512
-		return true;
530
+	if ( ! file_exists($filename) ) {
531
+			return true;
532
+	}
513 533
 
514 534
 	if ( ! class_exists( 'DOMDocument', false ) ) {
515 535
 		return false;
@@ -518,8 +538,9 @@  discard block
 block discarded – undo
518 538
 	$doc = new DOMDocument();
519 539
 	$doc->preserveWhiteSpace = false;
520 540
 
521
-	if ( $doc -> load($filename) === false )
522
-		return false;
541
+	if ( $doc -> load($filename) === false ) {
542
+			return false;
543
+	}
523 544
 	$xpath = new DOMXPath($doc);
524 545
 	$rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
525 546
 	if ( $rules->length > 0 ) {
@@ -556,15 +577,17 @@  discard block
 block discarded – undo
556 577
 	$doc = new DOMDocument();
557 578
 	$doc->preserveWhiteSpace = false;
558 579
 
559
-	if ( $doc->load($filename) === false )
560
-		return false;
580
+	if ( $doc->load($filename) === false ) {
581
+			return false;
582
+	}
561 583
 
562 584
 	$xpath = new DOMXPath($doc);
563 585
 
564 586
 	// First check if the rule already exists as in that case there is no need to re-add it
565 587
 	$wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')]');
566
-	if ( $wordpress_rules->length > 0 )
567
-		return true;
588
+	if ( $wordpress_rules->length > 0 ) {
589
+			return true;
590
+	}
568 591
 
569 592
 	// Check the XPath to the rewrite rule and create XML nodes if they do not exist
570 593
 	$xmlnodes = $xpath->query('/configuration/system.webServer/rewrite/rules');
@@ -742,22 +765,25 @@  discard block
 block discarded – undo
742 765
 
743 766
 	if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) {
744 767
 		foreach ( $data['wp-check-locked-posts'] as $key ) {
745
-			if ( ! $post_id = absint( substr( $key, 5 ) ) )
746
-				continue;
768
+			if ( ! $post_id = absint( substr( $key, 5 ) ) ) {
769
+							continue;
770
+			}
747 771
 
748 772
 			if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) {
749 773
 				$send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) );
750 774
 
751
-				if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) )
752
-					$send['avatar_src'] = $matches[1];
775
+				if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
776
+									$send['avatar_src'] = $matches[1];
777
+				}
753 778
 
754 779
 				$checked[$key] = $send;
755 780
 			}
756 781
 		}
757 782
 	}
758 783
 
759
-	if ( ! empty( $checked ) )
760
-		$response['wp-check-locked-posts'] = $checked;
784
+	if ( ! empty( $checked ) ) {
785
+			$response['wp-check-locked-posts'] = $checked;
786
+	}
761 787
 
762 788
 	return $response;
763 789
 }
@@ -777,11 +803,13 @@  discard block
 block discarded – undo
777 803
 		$received = $data['wp-refresh-post-lock'];
778 804
 		$send = array();
779 805
 
780
-		if ( ! $post_id = absint( $received['post_id'] ) )
781
-			return $response;
806
+		if ( ! $post_id = absint( $received['post_id'] ) ) {
807
+					return $response;
808
+		}
782 809
 
783
-		if ( ! current_user_can('edit_post', $post_id) )
784
-			return $response;
810
+		if ( ! current_user_can('edit_post', $post_id) ) {
811
+					return $response;
812
+		}
785 813
 
786 814
 		if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) {
787 815
 			$error = array(
@@ -789,14 +817,16 @@  discard block
 block discarded – undo
789 817
 			);
790 818
 
791 819
 			if ( $avatar = get_avatar( $user->ID, 64 ) ) {
792
-				if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) )
793
-					$error['avatar_src'] = $matches[1];
820
+				if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) ) {
821
+									$error['avatar_src'] = $matches[1];
822
+				}
794 823
 			}
795 824
 
796 825
 			$send['lock_error'] = $error;
797 826
 		} else {
798
-			if ( $new_lock = wp_set_post_lock( $post_id ) )
799
-				$send['new_lock'] = implode( ':', $new_lock );
827
+			if ( $new_lock = wp_set_post_lock( $post_id ) ) {
828
+							$send['new_lock'] = implode( ':', $new_lock );
829
+			}
800 830
 		}
801 831
 
802 832
 		$response['wp-refresh-post-lock'] = $send;
Please login to merge, or discard this patch.
src/wp-admin/includes/ms.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -736,7 +736,7 @@
 block discarded – undo
736 736
  *
737 737
  * @global int $wp_db_version The version number of the database.
738 738
  *
739
- * @return false False if the current user is not a super admin.
739
+ * @return false|null False if the current user is not a super admin.
740 740
  */
741 741
 function site_admin_notice() {
742 742
 	global $wp_db_version;
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite administration functions.
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite administration functions.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 /**
11 11
  * Determine if uploaded file exceeds space quota.
Please login to merge, or discard this patch.
Spacing   +272 added lines, -272 removed lines patch added patch discarded remove patch
@@ -15,33 +15,33 @@  discard block
 block discarded – undo
15 15
  * @param array $file $_FILES array for a given file.
16 16
  * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
17 17
  */
18
-function check_upload_size( $file ) {
19
-	if ( get_site_option( 'upload_space_check_disabled' ) )
18
+function check_upload_size($file) {
19
+	if (get_site_option('upload_space_check_disabled'))
20 20
 		return $file;
21 21
 
22
-	if ( $file['error'] != '0' ) // there's already an error
22
+	if ($file['error'] != '0') // there's already an error
23 23
 		return $file;
24 24
 
25
-	if ( defined( 'WP_IMPORTING' ) )
25
+	if (defined('WP_IMPORTING'))
26 26
 		return $file;
27 27
 
28 28
 	$space_left = get_upload_space_available();
29 29
 
30
-	$file_size = filesize( $file['tmp_name'] );
31
-	if ( $space_left < $file_size ) {
32
-		$file['error'] = sprintf( __( 'Not enough space to upload. %1$s KB needed.' ), number_format( ( $file_size - $space_left ) / KB_IN_BYTES ) );
30
+	$file_size = filesize($file['tmp_name']);
31
+	if ($space_left < $file_size) {
32
+		$file['error'] = sprintf(__('Not enough space to upload. %1$s KB needed.'), number_format(($file_size - $space_left) / KB_IN_BYTES));
33 33
 	}
34 34
 
35
-	if ( $file_size > ( KB_IN_BYTES * get_site_option( 'fileupload_maxk', 1500 ) ) ) {
36
-		$file['error'] = sprintf( __( 'This file is too big. Files must be less than %1$s KB in size.' ), get_site_option( 'fileupload_maxk', 1500 ) );
35
+	if ($file_size > (KB_IN_BYTES * get_site_option('fileupload_maxk', 1500))) {
36
+		$file['error'] = sprintf(__('This file is too big. Files must be less than %1$s KB in size.'), get_site_option('fileupload_maxk', 1500));
37 37
 	}
38 38
 
39
-	if ( upload_is_user_over_quota( false ) ) {
40
-		$file['error'] = __( 'You have used your space quota. Please delete files before uploading.' );
39
+	if (upload_is_user_over_quota(false)) {
40
+		$file['error'] = __('You have used your space quota. Please delete files before uploading.');
41 41
 	}
42 42
 
43
-	if ( $file['error'] != '0' && ! isset( $_POST['html-upload'] ) && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
44
-		wp_die( $file['error'] . ' <a href="javascript:history.go(-1)">' . __( 'Back' ) . '</a>' );
43
+	if ($file['error'] != '0' && ! isset($_POST['html-upload']) && ( ! defined('DOING_AJAX') || ! DOING_AJAX)) {
44
+		wp_die($file['error'].' <a href="javascript:history.go(-1)">'.__('Back').'</a>');
45 45
 	}
46 46
 
47 47
 	return $file;
@@ -57,16 +57,16 @@  discard block
 block discarded – undo
57 57
  * @param int  $blog_id Site ID.
58 58
  * @param bool $drop    True if site's database tables should be dropped. Default is false.
59 59
  */
60
-function wpmu_delete_blog( $blog_id, $drop = false ) {
60
+function wpmu_delete_blog($blog_id, $drop = false) {
61 61
 	global $wpdb;
62 62
 
63 63
 	$switch = false;
64
-	if ( get_current_blog_id() != $blog_id ) {
64
+	if (get_current_blog_id() != $blog_id) {
65 65
 		$switch = true;
66
-		switch_to_blog( $blog_id );
66
+		switch_to_blog($blog_id);
67 67
 	}
68 68
 
69
-	$blog = get_blog_details( $blog_id );
69
+	$blog = get_blog_details($blog_id);
70 70
 	/**
71 71
 	 * Fires before a site is deleted.
72 72
 	 *
@@ -75,42 +75,42 @@  discard block
 block discarded – undo
75 75
 	 * @param int  $blog_id The site ID.
76 76
 	 * @param bool $drop    True if site's table should be dropped. Default is false.
77 77
 	 */
78
-	do_action( 'delete_blog', $blog_id, $drop );
78
+	do_action('delete_blog', $blog_id, $drop);
79 79
 
80
-	$users = get_users( array( 'blog_id' => $blog_id, 'fields' => 'ids' ) );
80
+	$users = get_users(array('blog_id' => $blog_id, 'fields' => 'ids'));
81 81
 
82 82
 	// Remove users from this blog.
83
-	if ( ! empty( $users ) ) {
84
-		foreach ( $users as $user_id ) {
85
-			remove_user_from_blog( $user_id, $blog_id );
83
+	if ( ! empty($users)) {
84
+		foreach ($users as $user_id) {
85
+			remove_user_from_blog($user_id, $blog_id);
86 86
 		}
87 87
 	}
88 88
 
89
-	update_blog_status( $blog_id, 'deleted', 1 );
89
+	update_blog_status($blog_id, 'deleted', 1);
90 90
 
91 91
 	$current_site = get_current_site();
92 92
 
93 93
 	// If a full blog object is not available, do not destroy anything.
94
-	if ( $drop && ! $blog ) {
94
+	if ($drop && ! $blog) {
95 95
 		$drop = false;
96 96
 	}
97 97
 
98 98
 	// Don't destroy the initial, main, or root blog.
99
-	if ( $drop && ( 1 == $blog_id || is_main_site( $blog_id ) || ( $blog->path == $current_site->path && $blog->domain == $current_site->domain ) ) ) {
99
+	if ($drop && (1 == $blog_id || is_main_site($blog_id) || ($blog->path == $current_site->path && $blog->domain == $current_site->domain))) {
100 100
 		$drop = false;
101 101
 	}
102 102
 
103
-	$upload_path = trim( get_option( 'upload_path' ) );
103
+	$upload_path = trim(get_option('upload_path'));
104 104
 
105 105
 	// If ms_files_rewriting is enabled and upload_path is empty, wp_upload_dir is not reliable.
106
-	if ( $drop && get_site_option( 'ms_files_rewriting' ) && empty( $upload_path ) ) {
106
+	if ($drop && get_site_option('ms_files_rewriting') && empty($upload_path)) {
107 107
 		$drop = false;
108 108
 	}
109 109
 
110
-	if ( $drop ) {
110
+	if ($drop) {
111 111
 		$uploads = wp_get_upload_dir();
112 112
 
113
-		$tables = $wpdb->tables( 'blog' );
113
+		$tables = $wpdb->tables('blog');
114 114
 		/**
115 115
 		 * Filter the tables to drop when the site is deleted.
116 116
 		 *
@@ -119,13 +119,13 @@  discard block
 block discarded – undo
119 119
 		 * @param array $tables  The site tables to be dropped.
120 120
 		 * @param int   $blog_id The ID of the site to drop tables for.
121 121
 		 */
122
-		$drop_tables = apply_filters( 'wpmu_drop_tables', $tables, $blog_id );
122
+		$drop_tables = apply_filters('wpmu_drop_tables', $tables, $blog_id);
123 123
 
124
-		foreach ( (array) $drop_tables as $table ) {
125
-			$wpdb->query( "DROP TABLE IF EXISTS `$table`" );
124
+		foreach ((array) $drop_tables as $table) {
125
+			$wpdb->query("DROP TABLE IF EXISTS `$table`");
126 126
 		}
127 127
 
128
-		$wpdb->delete( $wpdb->blogs, array( 'blog_id' => $blog_id ) );
128
+		$wpdb->delete($wpdb->blogs, array('blog_id' => $blog_id));
129 129
 
130 130
 		/**
131 131
 		 * Filter the upload base directory to delete when the site is deleted.
@@ -135,43 +135,43 @@  discard block
 block discarded – undo
135 135
 		 * @param string $uploads['basedir'] Uploads path without subdirectory. @see wp_upload_dir()
136 136
 		 * @param int    $blog_id            The site ID.
137 137
 		 */
138
-		$dir = apply_filters( 'wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id );
139
-		$dir = rtrim( $dir, DIRECTORY_SEPARATOR );
138
+		$dir = apply_filters('wpmu_delete_blog_upload_dir', $uploads['basedir'], $blog_id);
139
+		$dir = rtrim($dir, DIRECTORY_SEPARATOR);
140 140
 		$top_dir = $dir;
141 141
 		$stack = array($dir);
142 142
 		$index = 0;
143 143
 
144
-		while ( $index < count( $stack ) ) {
144
+		while ($index < count($stack)) {
145 145
 			// Get indexed directory from stack
146 146
 			$dir = $stack[$index];
147 147
 
148
-			$dh = @opendir( $dir );
149
-			if ( $dh ) {
150
-				while ( ( $file = @readdir( $dh ) ) !== false ) {
151
-					if ( $file == '.' || $file == '..' )
148
+			$dh = @opendir($dir);
149
+			if ($dh) {
150
+				while (($file = @readdir($dh)) !== false) {
151
+					if ($file == '.' || $file == '..')
152 152
 						continue;
153 153
 
154
-					if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) {
155
-						$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
156
-					} elseif ( @is_file( $dir . DIRECTORY_SEPARATOR . $file ) ) {
157
-						@unlink( $dir . DIRECTORY_SEPARATOR . $file );
154
+					if (@is_dir($dir.DIRECTORY_SEPARATOR.$file)) {
155
+						$stack[] = $dir.DIRECTORY_SEPARATOR.$file;
156
+					} elseif (@is_file($dir.DIRECTORY_SEPARATOR.$file)) {
157
+						@unlink($dir.DIRECTORY_SEPARATOR.$file);
158 158
 					}
159 159
 				}
160
-				@closedir( $dh );
160
+				@closedir($dh);
161 161
 			}
162 162
 			$index++;
163 163
 		}
164 164
 
165
-		$stack = array_reverse( $stack ); // Last added dirs are deepest
166
-		foreach ( (array) $stack as $dir ) {
167
-			if ( $dir != $top_dir)
168
-			@rmdir( $dir );
165
+		$stack = array_reverse($stack); // Last added dirs are deepest
166
+		foreach ((array) $stack as $dir) {
167
+			if ($dir != $top_dir)
168
+			@rmdir($dir);
169 169
 		}
170 170
 
171
-		clean_blog_cache( $blog );
171
+		clean_blog_cache($blog);
172 172
 	}
173 173
 
174
-	if ( $switch )
174
+	if ($switch)
175 175
 		restore_current_blog();
176 176
 }
177 177
 
@@ -187,22 +187,22 @@  discard block
 block discarded – undo
187 187
  * @param int $id The user ID.
188 188
  * @return bool True if the user was deleted, otherwise false.
189 189
  */
190
-function wpmu_delete_user( $id ) {
190
+function wpmu_delete_user($id) {
191 191
 	global $wpdb;
192 192
 
193
-	if ( ! is_numeric( $id ) ) {
193
+	if ( ! is_numeric($id)) {
194 194
 		return false;
195 195
 	}
196 196
 
197 197
 	$id = (int) $id;
198
-	$user = new WP_User( $id );
198
+	$user = new WP_User($id);
199 199
 
200
-	if ( !$user->exists() )
200
+	if ( ! $user->exists())
201 201
 		return false;
202 202
 
203 203
 	// Global super-administrators are protected, and cannot be deleted.
204 204
 	$_super_admins = get_super_admins();
205
-	if ( in_array( $user->user_login, $_super_admins, true ) ) {
205
+	if (in_array($user->user_login, $_super_admins, true)) {
206 206
 		return false;
207 207
 	}
208 208
 
@@ -213,42 +213,42 @@  discard block
 block discarded – undo
213 213
 	 *
214 214
 	 * @param int $id ID of the user about to be deleted from the network.
215 215
 	 */
216
-	do_action( 'wpmu_delete_user', $id );
216
+	do_action('wpmu_delete_user', $id);
217 217
 
218
-	$blogs = get_blogs_of_user( $id );
218
+	$blogs = get_blogs_of_user($id);
219 219
 
220
-	if ( ! empty( $blogs ) ) {
221
-		foreach ( $blogs as $blog ) {
222
-			switch_to_blog( $blog->userblog_id );
223
-			remove_user_from_blog( $id, $blog->userblog_id );
220
+	if ( ! empty($blogs)) {
221
+		foreach ($blogs as $blog) {
222
+			switch_to_blog($blog->userblog_id);
223
+			remove_user_from_blog($id, $blog->userblog_id);
224 224
 
225
-			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) );
226
-			foreach ( (array) $post_ids as $post_id ) {
227
-				wp_delete_post( $post_id );
225
+			$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id));
226
+			foreach ((array) $post_ids as $post_id) {
227
+				wp_delete_post($post_id);
228 228
 			}
229 229
 
230 230
 			// Clean links
231
-			$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
231
+			$link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id));
232 232
 
233
-			if ( $link_ids ) {
234
-				foreach ( $link_ids as $link_id )
235
-					wp_delete_link( $link_id );
233
+			if ($link_ids) {
234
+				foreach ($link_ids as $link_id)
235
+					wp_delete_link($link_id);
236 236
 			}
237 237
 
238 238
 			restore_current_blog();
239 239
 		}
240 240
 	}
241 241
 
242
-	$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
243
-	foreach ( $meta as $mid )
244
-		delete_metadata_by_mid( 'user', $mid );
242
+	$meta = $wpdb->get_col($wpdb->prepare("SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id));
243
+	foreach ($meta as $mid)
244
+		delete_metadata_by_mid('user', $mid);
245 245
 
246
-	$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
246
+	$wpdb->delete($wpdb->users, array('ID' => $id));
247 247
 
248
-	clean_user_cache( $user );
248
+	clean_user_cache($user);
249 249
 
250 250
 	/** This action is documented in wp-admin/includes/user.php */
251
-	do_action( 'deleted_user', $id );
251
+	do_action('deleted_user', $id);
252 252
 
253 253
 	return true;
254 254
 }
@@ -261,19 +261,19 @@  discard block
 block discarded – undo
261 261
  * @param string $old_value The old email address. Not currently used.
262 262
  * @param string $value     The new email address.
263 263
  */
264
-function update_option_new_admin_email( $old_value, $value ) {
265
-	if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
264
+function update_option_new_admin_email($old_value, $value) {
265
+	if ($value == get_option('admin_email') || ! is_email($value))
266 266
 		return;
267 267
 
268
-	$hash = md5( $value. time() .mt_rand() );
268
+	$hash = md5($value.time().mt_rand());
269 269
 	$new_admin_email = array(
270 270
 		'hash' => $hash,
271 271
 		'newemail' => $value
272 272
 	);
273
-	update_option( 'adminhash', $new_admin_email );
273
+	update_option('adminhash', $new_admin_email);
274 274
 
275 275
 	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
276
-	$email_text = __( 'Howdy ###USERNAME###,
276
+	$email_text = __('Howdy ###USERNAME###,
277 277
 
278 278
 You recently requested to have the administration email address on
279 279
 your site changed.
@@ -305,16 +305,16 @@  discard block
 block discarded – undo
305 305
 	 * @param string $email_text      Text in the email.
306 306
 	 * @param string $new_admin_email New admin email that the current administration email was changed to.
307 307
 	 */
308
-	$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
308
+	$content = apply_filters('new_admin_email_content', $email_text, $new_admin_email);
309 309
 
310 310
 	$current_user = wp_get_current_user();
311
-	$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
312
-	$content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash='.$hash ) ), $content );
313
-	$content = str_replace( '###EMAIL###', $value, $content );
314
-	$content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
315
-	$content = str_replace( '###SITEURL###', network_home_url(), $content );
311
+	$content = str_replace('###USERNAME###', $current_user->user_login, $content);
312
+	$content = str_replace('###ADMIN_URL###', esc_url(self_admin_url('options.php?adminhash='.$hash)), $content);
313
+	$content = str_replace('###EMAIL###', $value, $content);
314
+	$content = str_replace('###SITENAME###', get_site_option('site_name'), $content);
315
+	$content = str_replace('###SITEURL###', network_home_url(), $content);
316 316
 
317
-	wp_mail( $value, sprintf( __( '[%s] New Admin Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content );
317
+	wp_mail($value, sprintf(__('[%s] New Admin Email Address'), wp_specialchars_decode(get_option('blogname'))), $content);
318 318
 }
319 319
 
320 320
 /**
@@ -328,33 +328,33 @@  discard block
 block discarded – undo
328 328
 function send_confirmation_on_profile_email() {
329 329
 	global $errors, $wpdb;
330 330
 	$current_user = wp_get_current_user();
331
-	if ( ! is_object($errors) )
331
+	if ( ! is_object($errors))
332 332
 		$errors = new WP_Error();
333 333
 
334
-	if ( $current_user->ID != $_POST['user_id'] )
334
+	if ($current_user->ID != $_POST['user_id'])
335 335
 		return false;
336 336
 
337
-	if ( $current_user->user_email != $_POST['email'] ) {
338
-		if ( !is_email( $_POST['email'] ) ) {
339
-			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address isn&#8217;t correct." ), array( 'form-field' => 'email' ) );
337
+	if ($current_user->user_email != $_POST['email']) {
338
+		if ( ! is_email($_POST['email'])) {
339
+			$errors->add('user_email', __("<strong>ERROR</strong>: The email address isn&#8217;t correct."), array('form-field' => 'email'));
340 340
 			return;
341 341
 		}
342 342
 
343
-		if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email'] ) ) ) {
344
-			$errors->add( 'user_email', __( "<strong>ERROR</strong>: The email address is already used." ), array( 'form-field' => 'email' ) );
345
-			delete_user_meta( $current_user->ID, '_new_email' );
343
+		if ($wpdb->get_var($wpdb->prepare("SELECT user_email FROM {$wpdb->users} WHERE user_email=%s", $_POST['email']))) {
344
+			$errors->add('user_email', __("<strong>ERROR</strong>: The email address is already used."), array('form-field' => 'email'));
345
+			delete_user_meta($current_user->ID, '_new_email');
346 346
 			return;
347 347
 		}
348 348
 
349
-		$hash = md5( $_POST['email'] . time() . mt_rand() );
349
+		$hash = md5($_POST['email'].time().mt_rand());
350 350
 		$new_user_email = array(
351 351
 			'hash' => $hash,
352 352
 			'newemail' => $_POST['email']
353 353
 		);
354
-		update_user_meta( $current_user->ID, '_new_email', $new_user_email );
354
+		update_user_meta($current_user->ID, '_new_email', $new_user_email);
355 355
 
356 356
 		/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
357
-		$email_text = __( 'Howdy ###USERNAME###,
357
+		$email_text = __('Howdy ###USERNAME###,
358 358
 
359 359
 You recently requested to have the email address on your account changed.
360 360
 
@@ -385,15 +385,15 @@  discard block
 block discarded – undo
385 385
 		 * @param string $email_text     Text in the email.
386 386
 		 * @param string $new_user_email New user email that the current user has changed to.
387 387
 		 */
388
-		$content = apply_filters( 'new_user_email_content', $email_text, $new_user_email );
388
+		$content = apply_filters('new_user_email_content', $email_text, $new_user_email);
389 389
 
390
-		$content = str_replace( '###USERNAME###', $current_user->user_login, $content );
391
-		$content = str_replace( '###ADMIN_URL###', esc_url( admin_url( 'profile.php?newuseremail='.$hash ) ), $content );
392
-		$content = str_replace( '###EMAIL###', $_POST['email'], $content);
393
-		$content = str_replace( '###SITENAME###', get_site_option( 'site_name' ), $content );
394
-		$content = str_replace( '###SITEURL###', network_home_url(), $content );
390
+		$content = str_replace('###USERNAME###', $current_user->user_login, $content);
391
+		$content = str_replace('###ADMIN_URL###', esc_url(admin_url('profile.php?newuseremail='.$hash)), $content);
392
+		$content = str_replace('###EMAIL###', $_POST['email'], $content);
393
+		$content = str_replace('###SITENAME###', get_site_option('site_name'), $content);
394
+		$content = str_replace('###SITEURL###', network_home_url(), $content);
395 395
 
396
-		wp_mail( $_POST['email'], sprintf( __( '[%s] New Email Address' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), $content );
396
+		wp_mail($_POST['email'], sprintf(__('[%s] New Email Address'), wp_specialchars_decode(get_option('blogname'))), $content);
397 397
 		$_POST['email'] = $current_user->user_email;
398 398
 	}
399 399
 }
@@ -408,9 +408,9 @@  discard block
 block discarded – undo
408 408
  */
409 409
 function new_user_email_admin_notice() {
410 410
 	global $pagenow;
411
-	if ( 'profile.php' === $pagenow && isset( $_GET['updated'] ) && $email = get_user_meta( get_current_user_id(), '_new_email', true ) ) {
411
+	if ('profile.php' === $pagenow && isset($_GET['updated']) && $email = get_user_meta(get_current_user_id(), '_new_email', true)) {
412 412
 		/* translators: %s: New email address */
413
-		echo '<div class="notice notice-info"><p>' . sprintf( __( 'Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.' ), '<code>' . esc_html( $email['newemail'] ) . '</code>' ) . '</p></div>';
413
+		echo '<div class="notice notice-info"><p>'.sprintf(__('Your email address has not been updated yet. Please check your inbox at %s for a confirmation email.'), '<code>'.esc_html($email['newemail']).'</code>').'</p></div>';
414 414
 	}
415 415
 }
416 416
 
@@ -422,19 +422,19 @@  discard block
 block discarded – undo
422 422
  * @param bool $echo Optional. If $echo is set and the quota is exceeded, a warning message is echoed. Default is true.
423 423
  * @return bool True if user is over upload space quota, otherwise false.
424 424
  */
425
-function upload_is_user_over_quota( $echo = true ) {
426
-	if ( get_site_option( 'upload_space_check_disabled' ) )
425
+function upload_is_user_over_quota($echo = true) {
426
+	if (get_site_option('upload_space_check_disabled'))
427 427
 		return false;
428 428
 
429 429
 	$space_allowed = get_space_allowed();
430
-	if ( ! is_numeric( $space_allowed ) ) {
430
+	if ( ! is_numeric($space_allowed)) {
431 431
 		$space_allowed = 10; // Default space allowed is 10 MB
432 432
 	}
433 433
 	$space_used = get_space_used();
434 434
 
435
-	if ( ( $space_allowed - $space_used ) < 0 ) {
436
-		if ( $echo )
437
-			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
435
+	if (($space_allowed - $space_used) < 0) {
436
+		if ($echo)
437
+			_e('Sorry, you have used your space allocation. Please delete some files to upload more files.');
438 438
 		return true;
439 439
 	} else {
440 440
 		return false;
@@ -450,19 +450,19 @@  discard block
 block discarded – undo
450 450
 	$space_allowed = get_space_allowed();
451 451
 	$space_used = get_space_used();
452 452
 
453
-	$percent_used = ( $space_used / $space_allowed ) * 100;
453
+	$percent_used = ($space_used / $space_allowed) * 100;
454 454
 
455
-	if ( $space_allowed > 1000 ) {
456
-		$space = number_format( $space_allowed / KB_IN_BYTES );
455
+	if ($space_allowed > 1000) {
456
+		$space = number_format($space_allowed / KB_IN_BYTES);
457 457
 		/* translators: Gigabytes */
458
-		$space .= __( 'GB' );
458
+		$space .= __('GB');
459 459
 	} else {
460
-		$space = number_format( $space_allowed );
460
+		$space = number_format($space_allowed);
461 461
 		/* translators: Megabytes */
462
-		$space .= __( 'MB' );
462
+		$space .= __('MB');
463 463
 	}
464 464
 	?>
465
-	<strong><?php printf( __( 'Used: %1$s%% of %2$s' ), number_format( $percent_used ), $space ); ?></strong>
465
+	<strong><?php printf(__('Used: %1$s%% of %2$s'), number_format($percent_used), $space); ?></strong>
466 466
 	<?php
467 467
 }
468 468
 
@@ -474,12 +474,12 @@  discard block
 block discarded – undo
474 474
  * @param int $size Current max size in bytes
475 475
  * @return int Max size in bytes
476 476
  */
477
-function fix_import_form_size( $size ) {
478
-	if ( upload_is_user_over_quota( false ) ) {
477
+function fix_import_form_size($size) {
478
+	if (upload_is_user_over_quota(false)) {
479 479
 		return 0;
480 480
 	}
481 481
 	$available = get_upload_space_available();
482
-	return min( $size, $available );
482
+	return min($size, $available);
483 483
 }
484 484
 
485 485
 /**
@@ -489,20 +489,20 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @param int $id The ID of the site to display the setting for.
491 491
  */
492
-function upload_space_setting( $id ) {
493
-	switch_to_blog( $id );
494
-	$quota = get_option( 'blog_upload_space' );
492
+function upload_space_setting($id) {
493
+	switch_to_blog($id);
494
+	$quota = get_option('blog_upload_space');
495 495
 	restore_current_blog();
496 496
 
497
-	if ( !$quota )
497
+	if ( ! $quota)
498 498
 		$quota = '';
499 499
 
500 500
 	?>
501 501
 	<tr>
502
-		<th><label for="blog-upload-space-number"><?php _e( 'Site Upload Space Quota' ); ?></label></th>
502
+		<th><label for="blog-upload-space-number"><?php _e('Site Upload Space Quota'); ?></label></th>
503 503
 		<td>
504 504
 			<input type="number" step="1" min="0" style="width: 100px" name="option[blog_upload_space]" id="blog-upload-space-number" aria-describedby="blog-upload-space-desc" value="<?php echo $quota; ?>" />
505
-			<span id="blog-upload-space-desc"><span class="screen-reader-text"><?php _e( 'Size in megabytes' ); ?></span> <?php _e( 'MB (Leave blank for network default)' ); ?></span>
505
+			<span id="blog-upload-space-desc"><span class="screen-reader-text"><?php _e('Size in megabytes'); ?></span> <?php _e('MB (Leave blank for network default)'); ?></span>
506 506
 		</td>
507 507
 	</tr>
508 508
 	<?php
@@ -524,19 +524,19 @@  discard block
 block discarded – undo
524 524
  * @param null   $deprecated Deprecated as of 3.0.2 and should not be used.
525 525
  * @return int   The initially passed $value.
526 526
  */
527
-function update_user_status( $id, $pref, $value, $deprecated = null ) {
527
+function update_user_status($id, $pref, $value, $deprecated = null) {
528 528
 	global $wpdb;
529 529
 
530
-	if ( null !== $deprecated )
531
-		_deprecated_argument( __FUNCTION__, '3.1' );
530
+	if (null !== $deprecated)
531
+		_deprecated_argument(__FUNCTION__, '3.1');
532 532
 
533
-	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
533
+	$wpdb->update($wpdb->users, array(sanitize_key($pref) => $value), array('ID' => $id));
534 534
 
535
-	$user = new WP_User( $id );
536
-	clean_user_cache( $user );
535
+	$user = new WP_User($id);
536
+	clean_user_cache($user);
537 537
 
538
-	if ( $pref == 'spam' ) {
539
-		if ( $value == 1 ) {
538
+	if ($pref == 'spam') {
539
+		if ($value == 1) {
540 540
 			/**
541 541
 			 * Fires after the user is marked as a SPAM user.
542 542
 			 *
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 			 *
545 545
 			 * @param int $id ID of the user marked as SPAM.
546 546
 			 */
547
-			do_action( 'make_spam_user', $id );
547
+			do_action('make_spam_user', $id);
548 548
 		} else {
549 549
 			/**
550 550
 			 * Fires after the user is marked as a HAM user. Opposite of SPAM.
@@ -553,7 +553,7 @@  discard block
 block discarded – undo
553 553
 			 *
554 554
 			 * @param int $id ID of the user marked as HAM.
555 555
 			 */
556
-			do_action( 'make_ham_user', $id );
556
+			do_action('make_ham_user', $id);
557 557
 		}
558 558
 	}
559 559
 
@@ -568,13 +568,13 @@  discard block
 block discarded – undo
568 568
  * @param int $id The user ID.
569 569
  * @return bool|int The ID of the refreshed user or false if the user does not exist.
570 570
  */
571
-function refresh_user_details( $id ) {
571
+function refresh_user_details($id) {
572 572
 	$id = (int) $id;
573 573
 
574
-	if ( !$user = get_userdata( $id ) )
574
+	if ( ! $user = get_userdata($id))
575 575
 		return false;
576 576
 
577
-	clean_user_cache( $user );
577
+	clean_user_cache($user);
578 578
 
579 579
 	return $id;
580 580
 }
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
  * @return string The language corresponding to $code if it exists. If it does not exist,
589 589
  *                then the first two letters of $code is returned.
590 590
  */
591
-function format_code_lang( $code = '' ) {
592
-	$code = strtolower( substr( $code, 0, 2 ) );
591
+function format_code_lang($code = '') {
592
+	$code = strtolower(substr($code, 0, 2));
593 593
 	$lang_codes = array(
594 594
 		'aa' => 'Afar', 'ab' => 'Abkhazian', 'af' => 'Afrikaans', 'ak' => 'Akan', 'sq' => 'Albanian', 'am' => 'Amharic', 'ar' => 'Arabic', 'an' => 'Aragonese', 'hy' => 'Armenian', 'as' => 'Assamese', 'av' => 'Avaric', 'ae' => 'Avestan', 'ay' => 'Aymara', 'az' => 'Azerbaijani', 'ba' => 'Bashkir', 'bm' => 'Bambara', 'eu' => 'Basque', 'be' => 'Belarusian', 'bn' => 'Bengali',
595 595
 		'bh' => 'Bihari', 'bi' => 'Bislama', 'bs' => 'Bosnian', 'br' => 'Breton', 'bg' => 'Bulgarian', 'my' => 'Burmese', 'ca' => 'Catalan; Valencian', 'ch' => 'Chamorro', 'ce' => 'Chechen', 'zh' => 'Chinese', 'cu' => 'Church Slavic; Old Slavonic; Church Slavonic; Old Bulgarian; Old Church Slavonic', 'cv' => 'Chuvash', 'kw' => 'Cornish', 'co' => 'Corsican', 'cr' => 'Cree',
@@ -601,7 +601,7 @@  discard block
 block discarded – undo
601 601
 		'no' => 'Norwegian', 'ny' => 'Chichewa; Chewa; Nyanja', 'oc' => 'Occitan, Provençal', 'oj' => 'Ojibwa', 'or' => 'Oriya', 'om' => 'Oromo', 'os' => 'Ossetian; Ossetic', 'pa' => 'Panjabi; Punjabi', 'fa' => 'Persian', 'pi' => 'Pali', 'pl' => 'Polish', 'pt' => 'Portuguese', 'ps' => 'Pushto', 'qu' => 'Quechua', 'rm' => 'Romansh', 'ro' => 'Romanian', 'rn' => 'Rundi', 'ru' => 'Russian',
602 602
 		'sg' => 'Sango', 'sa' => 'Sanskrit', 'sr' => 'Serbian', 'hr' => 'Croatian', 'si' => 'Sinhala; Sinhalese', 'sk' => 'Slovak', 'sl' => 'Slovenian', 'se' => 'Northern Sami', 'sm' => 'Samoan', 'sn' => 'Shona', 'sd' => 'Sindhi', 'so' => 'Somali', 'st' => 'Sotho, Southern', 'es' => 'Spanish; Castilian', 'sc' => 'Sardinian', 'ss' => 'Swati', 'su' => 'Sundanese', 'sw' => 'Swahili',
603 603
 		'sv' => 'Swedish', 'ty' => 'Tahitian', 'ta' => 'Tamil', 'tt' => 'Tatar', 'te' => 'Telugu', 'tg' => 'Tajik', 'tl' => 'Tagalog', 'th' => 'Thai', 'bo' => 'Tibetan', 'ti' => 'Tigrinya', 'to' => 'Tonga (Tonga Islands)', 'tn' => 'Tswana', 'ts' => 'Tsonga', 'tk' => 'Turkmen', 'tr' => 'Turkish', 'tw' => 'Twi', 'ug' => 'Uighur; Uyghur', 'uk' => 'Ukrainian', 'ur' => 'Urdu', 'uz' => 'Uzbek',
604
-		've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh','wa' => 'Walloon','wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
604
+		've' => 'Venda', 'vi' => 'Vietnamese', 'vo' => 'Volapük', 'cy' => 'Welsh', 'wa' => 'Walloon', 'wo' => 'Wolof', 'xh' => 'Xhosa', 'yi' => 'Yiddish', 'yo' => 'Yoruba', 'za' => 'Zhuang; Chuang', 'zu' => 'Zulu' );
605 605
 
606 606
 	/**
607 607
 	 * Filter the language codes.
@@ -611,8 +611,8 @@  discard block
 block discarded – undo
611 611
 	 * @param array  $lang_codes Key/value pair of language codes where key is the short version.
612 612
 	 * @param string $code       A two-letter designation of the language.
613 613
 	 */
614
-	$lang_codes = apply_filters( 'lang_codes', $lang_codes, $code );
615
-	return strtr( $code, $lang_codes );
614
+	$lang_codes = apply_filters('lang_codes', $lang_codes, $code);
615
+	return strtr($code, $lang_codes);
616 616
 }
617 617
 
618 618
 /**
@@ -627,12 +627,12 @@  discard block
 block discarded – undo
627 627
  * @return object|array Returns `$term`, after filtering the 'slug' field with {@see sanitize_title()}
628 628
  *                      if $taxonomy is 'category' or 'post_tag'.
629 629
  */
630
-function sync_category_tag_slugs( $term, $taxonomy ) {
631
-	if ( global_terms_enabled() && ( $taxonomy == 'category' || $taxonomy == 'post_tag' ) ) {
632
-		if ( is_object( $term ) ) {
633
-			$term->slug = sanitize_title( $term->name );
630
+function sync_category_tag_slugs($term, $taxonomy) {
631
+	if (global_terms_enabled() && ($taxonomy == 'category' || $taxonomy == 'post_tag')) {
632
+		if (is_object($term)) {
633
+			$term->slug = sanitize_title($term->name);
634 634
 		} else {
635
-			$term['slug'] = sanitize_title( $term['name'] );
635
+			$term['slug'] = sanitize_title($term['name']);
636 636
 		}
637 637
 	}
638 638
 	return $term;
@@ -646,36 +646,36 @@  discard block
 block discarded – undo
646 646
  * @access private
647 647
  */
648 648
 function _access_denied_splash() {
649
-	if ( ! is_user_logged_in() || is_network_admin() )
649
+	if ( ! is_user_logged_in() || is_network_admin())
650 650
 		return;
651 651
 
652
-	$blogs = get_blogs_of_user( get_current_user_id() );
652
+	$blogs = get_blogs_of_user(get_current_user_id());
653 653
 
654
-	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) )
654
+	if (wp_list_filter($blogs, array('userblog_id' => get_current_blog_id())))
655 655
 		return;
656 656
 
657
-	$blog_name = get_bloginfo( 'name' );
657
+	$blog_name = get_bloginfo('name');
658 658
 
659
-	if ( empty( $blogs ) )
660
-		wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
659
+	if (empty($blogs))
660
+		wp_die(sprintf(__('You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.'), $blog_name), 403);
661 661
 
662
-	$output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
663
-	$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
662
+	$output = '<p>'.sprintf(__('You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.'), $blog_name).'</p>';
663
+	$output .= '<p>'.__('If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.').'</p>';
664 664
 
665
-	$output .= '<h3>' . __('Your Sites') . '</h3>';
665
+	$output .= '<h3>'.__('Your Sites').'</h3>';
666 666
 	$output .= '<table>';
667 667
 
668
-	foreach ( $blogs as $blog ) {
668
+	foreach ($blogs as $blog) {
669 669
 		$output .= '<tr>';
670 670
 		$output .= "<td>{$blog->blogname}</td>";
671
-		$output .= '<td><a href="' . esc_url( get_admin_url( $blog->userblog_id ) ) . '">' . __( 'Visit Dashboard' ) . '</a> | ' .
672
-			'<a href="' . esc_url( get_home_url( $blog->userblog_id ) ). '">' . __( 'View Site' ) . '</a></td>';
671
+		$output .= '<td><a href="'.esc_url(get_admin_url($blog->userblog_id)).'">'.__('Visit Dashboard').'</a> | '.
672
+			'<a href="'.esc_url(get_home_url($blog->userblog_id)).'">'.__('View Site').'</a></td>';
673 673
 		$output .= '</tr>';
674 674
 	}
675 675
 
676 676
 	$output .= '</table>';
677 677
 
678
-	wp_die( $output, 403 );
678
+	wp_die($output, 403);
679 679
 }
680 680
 
681 681
 /**
@@ -686,8 +686,8 @@  discard block
 block discarded – undo
686 686
  * @param string $permission A permission to be checked. Currently not used.
687 687
  * @return bool True if the user has proper permissions, false if they do not.
688 688
  */
689
-function check_import_new_users( $permission ) {
690
-	if ( !is_super_admin() )
689
+function check_import_new_users($permission) {
690
+	if ( ! is_super_admin())
691 691
 		return false;
692 692
 	return true;
693 693
 }
@@ -701,33 +701,33 @@  discard block
 block discarded – undo
701 701
  * @param array  $lang_files Optional. An array of the language files. Default empty array.
702 702
  * @param string $current    Optional. The current language code. Default empty.
703 703
  */
704
-function mu_dropdown_languages( $lang_files = array(), $current = '' ) {
704
+function mu_dropdown_languages($lang_files = array(), $current = '') {
705 705
 	$flag = false;
706 706
 	$output = array();
707 707
 
708
-	foreach ( (array) $lang_files as $val ) {
709
-		$code_lang = basename( $val, '.mo' );
708
+	foreach ((array) $lang_files as $val) {
709
+		$code_lang = basename($val, '.mo');
710 710
 
711
-		if ( $code_lang == 'en_US' ) { // American English
711
+		if ($code_lang == 'en_US') { // American English
712 712
 			$flag = true;
713
-			$ae = __( 'American English' );
714
-			$output[$ae] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $ae . '</option>';
715
-		} elseif ( $code_lang == 'en_GB' ) { // British English
713
+			$ae = __('American English');
714
+			$output[$ae] = '<option value="'.esc_attr($code_lang).'"'.selected($current, $code_lang, false).'> '.$ae.'</option>';
715
+		} elseif ($code_lang == 'en_GB') { // British English
716 716
 			$flag = true;
717
-			$be = __( 'British English' );
718
-			$output[$be] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . $be . '</option>';
717
+			$be = __('British English');
718
+			$output[$be] = '<option value="'.esc_attr($code_lang).'"'.selected($current, $code_lang, false).'> '.$be.'</option>';
719 719
 		} else {
720
-			$translated = format_code_lang( $code_lang );
721
-			$output[$translated] = '<option value="' . esc_attr( $code_lang ) . '"' . selected( $current, $code_lang, false ) . '> ' . esc_html ( $translated ) . '</option>';
720
+			$translated = format_code_lang($code_lang);
721
+			$output[$translated] = '<option value="'.esc_attr($code_lang).'"'.selected($current, $code_lang, false).'> '.esc_html($translated).'</option>';
722 722
 		}
723 723
 
724 724
 	}
725 725
 
726
-	if ( $flag === false ) // WordPress english
727
-		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";
726
+	if ($flag === false) // WordPress english
727
+		$output[] = '<option value=""'.selected($current, '', false).'>'.__('English')."</option>";
728 728
 
729 729
 	// Order by name
730
-	uksort( $output, 'strnatcasecmp' );
730
+	uksort($output, 'strnatcasecmp');
731 731
 
732 732
 	/**
733 733
 	 * Filter the languages available in the dropdown.
@@ -738,9 +738,9 @@  discard block
 block discarded – undo
738 738
 	 * @param array $lang_files Available language files.
739 739
 	 * @param string $current   The current language code.
740 740
 	 */
741
-	$output = apply_filters( 'mu_dropdown_languages', $output, $lang_files, $current );
741
+	$output = apply_filters('mu_dropdown_languages', $output, $lang_files, $current);
742 742
 
743
-	echo implode( "\n\t", $output );
743
+	echo implode("\n\t", $output);
744 744
 }
745 745
 
746 746
 /**
@@ -756,16 +756,16 @@  discard block
 block discarded – undo
756 756
 function site_admin_notice() {
757 757
 	global $wp_db_version, $pagenow;
758 758
 
759
-	if ( ! is_super_admin() ) {
759
+	if ( ! is_super_admin()) {
760 760
 		return false;
761 761
 	}
762 762
 
763
-	if ( 'upgrade.php' == $pagenow ) {
763
+	if ('upgrade.php' == $pagenow) {
764 764
 		return;
765 765
 	}
766 766
 
767
-	if ( get_site_option( 'wpmu_upgrade_site' ) != $wp_db_version ) {
768
-		echo "<div class='update-nag'>" . sprintf( __( 'Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.' ), esc_url( network_admin_url( 'upgrade.php' ) ) ) . "</div>";
767
+	if (get_site_option('wpmu_upgrade_site') != $wp_db_version) {
768
+		echo "<div class='update-nag'>".sprintf(__('Thank you for Updating! Please visit the <a href="%s">Upgrade Network</a> page to update all your sites.'), esc_url(network_admin_url('upgrade.php')))."</div>";
769 769
 	}
770 770
 }
771 771
 
@@ -781,23 +781,23 @@  discard block
 block discarded – undo
781 781
  * @param array $postarr An array of posts. Not currently used.
782 782
  * @return array The new array of post data after checking for collisions.
783 783
  */
784
-function avoid_blog_page_permalink_collision( $data, $postarr ) {
785
-	if ( is_subdomain_install() )
784
+function avoid_blog_page_permalink_collision($data, $postarr) {
785
+	if (is_subdomain_install())
786 786
 		return $data;
787
-	if ( $data['post_type'] != 'page' )
787
+	if ($data['post_type'] != 'page')
788 788
 		return $data;
789
-	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
789
+	if ( ! isset($data['post_name']) || $data['post_name'] == '')
790 790
 		return $data;
791
-	if ( !is_main_site() )
791
+	if ( ! is_main_site())
792 792
 		return $data;
793 793
 
794 794
 	$post_name = $data['post_name'];
795 795
 	$c = 0;
796
-	while( $c < 10 && get_id_from_blogname( $post_name ) ) {
797
-		$post_name .= mt_rand( 1, 10 );
798
-		$c ++;
796
+	while ($c < 10 && get_id_from_blogname($post_name)) {
797
+		$post_name .= mt_rand(1, 10);
798
+		$c++;
799 799
 	}
800
-	if ( $post_name != $data['post_name'] ) {
800
+	if ($post_name != $data['post_name']) {
801 801
 		$data['post_name'] = $post_name;
802 802
 	}
803 803
 	return $data;
@@ -816,31 +816,31 @@  discard block
 block discarded – undo
816 816
 	<table class="form-table">
817 817
 	<tr>
818 818
 	<?php /* translators: My sites label */ ?>
819
-		<th scope="row"><label for="primary_blog"><?php _e( 'Primary Site' ); ?></label></th>
819
+		<th scope="row"><label for="primary_blog"><?php _e('Primary Site'); ?></label></th>
820 820
 		<td>
821 821
 		<?php
822
-		$all_blogs = get_blogs_of_user( get_current_user_id() );
823
-		$primary_blog = get_user_meta( get_current_user_id(), 'primary_blog', true );
824
-		if ( count( $all_blogs ) > 1 ) {
822
+		$all_blogs = get_blogs_of_user(get_current_user_id());
823
+		$primary_blog = get_user_meta(get_current_user_id(), 'primary_blog', true);
824
+		if (count($all_blogs) > 1) {
825 825
 			$found = false;
826 826
 			?>
827 827
 			<select name="primary_blog" id="primary_blog">
828
-				<?php foreach ( (array) $all_blogs as $blog ) {
829
-					if ( $primary_blog == $blog->userblog_id )
828
+				<?php foreach ((array) $all_blogs as $blog) {
829
+					if ($primary_blog == $blog->userblog_id)
830 830
 						$found = true;
831
-					?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
831
+					?><option value="<?php echo $blog->userblog_id ?>"<?php selected($primary_blog, $blog->userblog_id); ?>><?php echo esc_url(get_home_url($blog->userblog_id)) ?></option><?php
832 832
 				} ?>
833 833
 			</select>
834 834
 			<?php
835
-			if ( !$found ) {
836
-				$blog = reset( $all_blogs );
837
-				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
835
+			if ( ! $found) {
836
+				$blog = reset($all_blogs);
837
+				update_user_meta(get_current_user_id(), 'primary_blog', $blog->userblog_id);
838 838
 			}
839
-		} elseif ( count( $all_blogs ) == 1 ) {
840
-			$blog = reset( $all_blogs );
841
-			echo esc_url( get_home_url( $blog->userblog_id ) );
842
-			if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
843
-				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
839
+		} elseif (count($all_blogs) == 1) {
840
+			$blog = reset($all_blogs);
841
+			echo esc_url(get_home_url($blog->userblog_id));
842
+			if ($primary_blog != $blog->userblog_id) // Set the primary blog again if it's out of sync with blog list.
843
+				update_user_meta(get_current_user_id(), 'primary_blog', $blog->userblog_id);
844 844
 		} else {
845 845
 			echo "N/A";
846 846
 		}
@@ -862,9 +862,9 @@  discard block
 block discarded – undo
862 862
  * @return bool True on success, false on failure. This can fail when the user is
863 863
  *              already a super admin or when the `$super_admins` global is defined.
864 864
  */
865
-function grant_super_admin( $user_id ) {
865
+function grant_super_admin($user_id) {
866 866
 	// If global super_admins override is defined, there is nothing to do here.
867
-	if ( isset( $GLOBALS['super_admins'] ) ) {
867
+	if (isset($GLOBALS['super_admins'])) {
868 868
 		return false;
869 869
 	}
870 870
 
@@ -875,15 +875,15 @@  discard block
 block discarded – undo
875 875
 	 *
876 876
 	 * @param int $user_id ID of the user that is about to be granted Super Admin privileges.
877 877
 	 */
878
-	do_action( 'grant_super_admin', $user_id );
878
+	do_action('grant_super_admin', $user_id);
879 879
 
880 880
 	// Directly fetch site_admins instead of using get_super_admins()
881
-	$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
881
+	$super_admins = get_site_option('site_admins', array('admin'));
882 882
 
883
-	$user = get_userdata( $user_id );
884
-	if ( $user && ! in_array( $user->user_login, $super_admins ) ) {
883
+	$user = get_userdata($user_id);
884
+	if ($user && ! in_array($user->user_login, $super_admins)) {
885 885
 		$super_admins[] = $user->user_login;
886
-		update_site_option( 'site_admins' , $super_admins );
886
+		update_site_option('site_admins', $super_admins);
887 887
 
888 888
 		/**
889 889
 		 * Fires after the user is granted Super Admin privileges.
@@ -892,7 +892,7 @@  discard block
 block discarded – undo
892 892
 		 *
893 893
 		 * @param int $user_id ID of the user that was granted Super Admin privileges.
894 894
 		 */
895
-		do_action( 'granted_super_admin', $user_id );
895
+		do_action('granted_super_admin', $user_id);
896 896
 		return true;
897 897
 	}
898 898
 	return false;
@@ -909,9 +909,9 @@  discard block
 block discarded – undo
909 909
  * @return bool True on success, false on failure. This can fail when the user's email
910 910
  *              is the network admin email or when the `$super_admins` global is defined.
911 911
  */
912
-function revoke_super_admin( $user_id ) {
912
+function revoke_super_admin($user_id) {
913 913
 	// If global super_admins override is defined, there is nothing to do here.
914
-	if ( isset( $GLOBALS['super_admins'] ) ) {
914
+	if (isset($GLOBALS['super_admins'])) {
915 915
 		return false;
916 916
 	}
917 917
 
@@ -922,16 +922,16 @@  discard block
 block discarded – undo
922 922
 	 *
923 923
 	 * @param int $user_id ID of the user Super Admin privileges are being revoked from.
924 924
 	 */
925
-	do_action( 'revoke_super_admin', $user_id );
925
+	do_action('revoke_super_admin', $user_id);
926 926
 
927 927
 	// Directly fetch site_admins instead of using get_super_admins()
928
-	$super_admins = get_site_option( 'site_admins', array( 'admin' ) );
928
+	$super_admins = get_site_option('site_admins', array('admin'));
929 929
 
930
-	$user = get_userdata( $user_id );
931
-	if ( $user && 0 !== strcasecmp( $user->user_email, get_site_option( 'admin_email' ) ) ) {
932
-		if ( false !== ( $key = array_search( $user->user_login, $super_admins ) ) ) {
933
-			unset( $super_admins[$key] );
934
-			update_site_option( 'site_admins', $super_admins );
930
+	$user = get_userdata($user_id);
931
+	if ($user && 0 !== strcasecmp($user->user_email, get_site_option('admin_email'))) {
932
+		if (false !== ($key = array_search($user->user_login, $super_admins))) {
933
+			unset($super_admins[$key]);
934
+			update_site_option('site_admins', $super_admins);
935 935
 
936 936
 			/**
937 937
 			 * Fires after the user's Super Admin privileges are revoked.
@@ -940,7 +940,7 @@  discard block
 block discarded – undo
940 940
 			 *
941 941
 			 * @param int $user_id ID of the user Super Admin privileges were revoked from.
942 942
 			 */
943
-			do_action( 'revoked_super_admin', $user_id );
943
+			do_action('revoked_super_admin', $user_id);
944 944
 			return true;
945 945
 		}
946 946
 	}
@@ -960,10 +960,10 @@  discard block
 block discarded – undo
960 960
  * @param int $site_id The network/site ID to check.
961 961
  * @return bool True if network can be edited, otherwise false.
962 962
  */
963
-function can_edit_network( $site_id ) {
963
+function can_edit_network($site_id) {
964 964
 	global $wpdb;
965 965
 
966
-	if ( $site_id == $wpdb->siteid )
966
+	if ($site_id == $wpdb->siteid)
967 967
 		$result = true;
968 968
 	else
969 969
 		$result = false;
@@ -976,7 +976,7 @@  discard block
 block discarded – undo
976 976
 	 * @param bool $result  Whether the network can be edited from this page.
977 977
 	 * @param int  $site_id The network/site ID to check.
978 978
 	 */
979
-	return apply_filters( 'can_edit_network', $result, $site_id );
979
+	return apply_filters('can_edit_network', $result, $site_id);
980 980
 }
981 981
 
982 982
 /**
@@ -989,7 +989,7 @@  discard block
 block discarded – undo
989 989
 function _thickbox_path_admin_subfolder() {
990 990
 ?>
991 991
 <script type="text/javascript">
992
-var tb_pathToImage = "<?php echo includes_url( 'js/thickbox/loadingAnimation.gif', 'relative' ); ?>";
992
+var tb_pathToImage = "<?php echo includes_url('js/thickbox/loadingAnimation.gif', 'relative'); ?>";
993 993
 </script>
994 994
 <?php
995 995
 }
@@ -998,77 +998,77 @@  discard block
 block discarded – undo
998 998
  *
999 999
  * @param array $users
1000 1000
  */
1001
-function confirm_delete_users( $users ) {
1001
+function confirm_delete_users($users) {
1002 1002
 	$current_user = wp_get_current_user();
1003
-	if ( ! is_array( $users ) || empty( $users ) ) {
1003
+	if ( ! is_array($users) || empty($users)) {
1004 1004
 		return false;
1005 1005
 	}
1006 1006
 	?>
1007
-	<h1><?php esc_html_e( 'Users' ); ?></h1>
1007
+	<h1><?php esc_html_e('Users'); ?></h1>
1008 1008
 
1009
-	<?php if ( 1 == count( $users ) ) : ?>
1010
-		<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
1009
+	<?php if (1 == count($users)) : ?>
1010
+		<p><?php _e('You have chosen to delete the user from all networks and sites.'); ?></p>
1011 1011
 	<?php else : ?>
1012
-		<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
1012
+		<p><?php _e('You have chosen to delete the following users from all networks and sites.'); ?></p>
1013 1013
 	<?php endif; ?>
1014 1014
 
1015 1015
 	<form action="users.php?action=dodelete" method="post">
1016 1016
 	<input type="hidden" name="dodelete" />
1017 1017
 	<?php
1018
-	wp_nonce_field( 'ms-users-delete' );
1018
+	wp_nonce_field('ms-users-delete');
1019 1019
 	$site_admins = get_super_admins();
1020
-	$admin_out = '<option value="' . esc_attr( $current_user->ID ) . '">' . $current_user->user_login . '</option>'; ?>
1020
+	$admin_out = '<option value="'.esc_attr($current_user->ID).'">'.$current_user->user_login.'</option>'; ?>
1021 1021
 	<table class="form-table">
1022
-	<?php foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) {
1023
-		if ( $user_id != '' && $user_id != '0' ) {
1024
-			$delete_user = get_userdata( $user_id );
1022
+	<?php foreach (($allusers = (array) $_POST['allusers']) as $user_id) {
1023
+		if ($user_id != '' && $user_id != '0') {
1024
+			$delete_user = get_userdata($user_id);
1025 1025
 
1026
-			if ( ! current_user_can( 'delete_user', $delete_user->ID ) ) {
1027
-				wp_die( sprintf( __( 'Warning! User %s cannot be deleted.' ), $delete_user->user_login ) );
1026
+			if ( ! current_user_can('delete_user', $delete_user->ID)) {
1027
+				wp_die(sprintf(__('Warning! User %s cannot be deleted.'), $delete_user->user_login));
1028 1028
 			}
1029 1029
 
1030
-			if ( in_array( $delete_user->user_login, $site_admins ) ) {
1031
-				wp_die( sprintf( __( 'Warning! User cannot be deleted. The user %s is a network administrator.' ), '<em>' . $delete_user->user_login . '</em>' ) );
1030
+			if (in_array($delete_user->user_login, $site_admins)) {
1031
+				wp_die(sprintf(__('Warning! User cannot be deleted. The user %s is a network administrator.'), '<em>'.$delete_user->user_login.'</em>'));
1032 1032
 			}
1033 1033
 			?>
1034 1034
 			<tr>
1035 1035
 				<th scope="row"><?php echo $delete_user->user_login; ?>
1036
-					<?php echo '<input type="hidden" name="user[]" value="' . esc_attr( $user_id ) . '" />' . "\n"; ?>
1036
+					<?php echo '<input type="hidden" name="user[]" value="'.esc_attr($user_id).'" />'."\n"; ?>
1037 1037
 				</th>
1038
-			<?php $blogs = get_blogs_of_user( $user_id, true );
1038
+			<?php $blogs = get_blogs_of_user($user_id, true);
1039 1039
 
1040
-			if ( ! empty( $blogs ) ) {
1040
+			if ( ! empty($blogs)) {
1041 1041
 				?>
1042 1042
 				<td><fieldset><p><legend><?php printf(
1043 1043
 					/* translators: user login */
1044
-					__( 'What should be done with content owned by %s?' ),
1045
-					'<em>' . $delete_user->user_login . '</em>'
1044
+					__('What should be done with content owned by %s?'),
1045
+					'<em>'.$delete_user->user_login.'</em>'
1046 1046
 				); ?></legend></p>
1047 1047
 				<?php
1048
-				foreach ( (array) $blogs as $key => $details ) {
1049
-					$blog_users = get_users( array( 'blog_id' => $details->userblog_id, 'fields' => array( 'ID', 'user_login' ) ) );
1050
-					if ( is_array( $blog_users ) && !empty( $blog_users ) ) {
1051
-						$user_site = "<a href='" . esc_url( get_home_url( $details->userblog_id ) ) . "'>{$details->blogname}</a>";
1052
-						$user_dropdown = '<label for="reassign_user" class="screen-reader-text">' . __( 'Select a user' ) . '</label>';
1048
+				foreach ((array) $blogs as $key => $details) {
1049
+					$blog_users = get_users(array('blog_id' => $details->userblog_id, 'fields' => array('ID', 'user_login')));
1050
+					if (is_array($blog_users) && ! empty($blog_users)) {
1051
+						$user_site = "<a href='".esc_url(get_home_url($details->userblog_id))."'>{$details->blogname}</a>";
1052
+						$user_dropdown = '<label for="reassign_user" class="screen-reader-text">'.__('Select a user').'</label>';
1053 1053
 						$user_dropdown .= "<select name='blog[$user_id][$key]' id='reassign_user'>";
1054 1054
 						$user_list = '';
1055
-						foreach ( $blog_users as $user ) {
1056
-							if ( ! in_array( $user->ID, $allusers ) ) {
1055
+						foreach ($blog_users as $user) {
1056
+							if ( ! in_array($user->ID, $allusers)) {
1057 1057
 								$user_list .= "<option value='{$user->ID}'>{$user->user_login}</option>";
1058 1058
 							}
1059 1059
 						}
1060
-						if ( '' == $user_list ) {
1060
+						if ('' == $user_list) {
1061 1061
 							$user_list = $admin_out;
1062 1062
 						}
1063 1063
 						$user_dropdown .= $user_list;
1064 1064
 						$user_dropdown .= "</select>\n";
1065 1065
 						?>
1066 1066
 						<ul style="list-style:none;">
1067
-							<li><?php printf( __( 'Site: %s' ), $user_site ); ?></li>
1068
-							<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="delete" checked="checked" />
1069
-							<?php _e( 'Delete all content.' ); ?></label></li>
1070
-							<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id . '][' . $delete_user->ID ?>]" value="reassign" />
1071
-							<?php _e( 'Attribute all content to:' ); ?></label>
1067
+							<li><?php printf(__('Site: %s'), $user_site); ?></li>
1068
+							<li><label><input type="radio" id="delete_option0" name="delete[<?php echo $details->userblog_id.']['.$delete_user->ID ?>]" value="delete" checked="checked" />
1069
+							<?php _e('Delete all content.'); ?></label></li>
1070
+							<li><label><input type="radio" id="delete_option1" name="delete[<?php echo $details->userblog_id.']['.$delete_user->ID ?>]" value="reassign" />
1071
+							<?php _e('Attribute all content to:'); ?></label>
1072 1072
 							<?php echo $user_dropdown; ?></li>
1073 1073
 						</ul>
1074 1074
 						<?php
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 				echo "</fieldset></td></tr>";
1078 1078
 			} else {
1079 1079
 				?>
1080
-				<td><fieldset><p><legend><?php _e( 'User has no sites or content and will be deleted.' ); ?></legend></p>
1080
+				<td><fieldset><p><legend><?php _e('User has no sites or content and will be deleted.'); ?></legend></p>
1081 1081
 			<?php } ?>
1082 1082
 			</tr>
1083 1083
 		<?php
@@ -1088,15 +1088,15 @@  discard block
 block discarded – undo
1088 1088
 	</table>
1089 1089
 	<?php
1090 1090
 	/** This action is documented in wp-admin/users.php */
1091
-	do_action( 'delete_user_form', $current_user, $allusers );
1091
+	do_action('delete_user_form', $current_user, $allusers);
1092 1092
 
1093
-	if ( 1 == count( $users ) ) : ?>
1094
-		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
1093
+	if (1 == count($users)) : ?>
1094
+		<p><?php _e('Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.'); ?></p>
1095 1095
 	<?php else : ?>
1096
-		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
1096
+		<p><?php _e('Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.'); ?></p>
1097 1097
 	<?php endif;
1098 1098
 
1099
-	submit_button( __('Confirm Deletion'), 'primary' );
1099
+	submit_button(__('Confirm Deletion'), 'primary');
1100 1100
 	?>
1101 1101
 	</form>
1102 1102
 	<?php
Please login to merge, or discard this patch.
Braces   +100 added lines, -62 removed lines patch added patch discarded remove patch
@@ -16,14 +16,18 @@  discard block
 block discarded – undo
16 16
  * @return array $_FILES array with 'error' key set if file exceeds quota. 'error' is empty otherwise.
17 17
  */
18 18
 function check_upload_size( $file ) {
19
-	if ( get_site_option( 'upload_space_check_disabled' ) )
20
-		return $file;
19
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
20
+			return $file;
21
+	}
21 22
 
22
-	if ( $file['error'] != '0' ) // there's already an error
23
+	if ( $file['error'] != '0' ) {
24
+		// there's already an error
23 25
 		return $file;
26
+	}
24 27
 
25
-	if ( defined( 'WP_IMPORTING' ) )
26
-		return $file;
28
+	if ( defined( 'WP_IMPORTING' ) ) {
29
+			return $file;
30
+	}
27 31
 
28 32
 	$space_left = get_upload_space_available();
29 33
 
@@ -148,8 +152,9 @@  discard block
 block discarded – undo
148 152
 			$dh = @opendir( $dir );
149 153
 			if ( $dh ) {
150 154
 				while ( ( $file = @readdir( $dh ) ) !== false ) {
151
-					if ( $file == '.' || $file == '..' )
152
-						continue;
155
+					if ( $file == '.' || $file == '..' ) {
156
+											continue;
157
+					}
153 158
 
154 159
 					if ( @is_dir( $dir . DIRECTORY_SEPARATOR . $file ) ) {
155 160
 						$stack[] = $dir . DIRECTORY_SEPARATOR . $file;
@@ -164,16 +169,18 @@  discard block
 block discarded – undo
164 169
 
165 170
 		$stack = array_reverse( $stack ); // Last added dirs are deepest
166 171
 		foreach ( (array) $stack as $dir ) {
167
-			if ( $dir != $top_dir)
168
-			@rmdir( $dir );
172
+			if ( $dir != $top_dir) {
173
+						@rmdir( $dir );
174
+			}
169 175
 		}
170 176
 
171 177
 		clean_blog_cache( $blog );
172 178
 	}
173 179
 
174
-	if ( $switch )
175
-		restore_current_blog();
176
-}
180
+	if ( $switch ) {
181
+			restore_current_blog();
182
+	}
183
+	}
177 184
 
178 185
 /**
179 186
  * Delete a user from the network and remove from all sites.
@@ -197,8 +204,9 @@  discard block
 block discarded – undo
197 204
 	$id = (int) $id;
198 205
 	$user = new WP_User( $id );
199 206
 
200
-	if ( !$user->exists() )
201
-		return false;
207
+	if ( !$user->exists() ) {
208
+			return false;
209
+	}
202 210
 
203 211
 	// Global super-administrators are protected, and cannot be deleted.
204 212
 	$_super_admins = get_super_admins();
@@ -231,8 +239,9 @@  discard block
 block discarded – undo
231 239
 			$link_ids = $wpdb->get_col( $wpdb->prepare( "SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id ) );
232 240
 
233 241
 			if ( $link_ids ) {
234
-				foreach ( $link_ids as $link_id )
235
-					wp_delete_link( $link_id );
242
+				foreach ( $link_ids as $link_id ) {
243
+									wp_delete_link( $link_id );
244
+				}
236 245
 			}
237 246
 
238 247
 			restore_current_blog();
@@ -240,8 +249,9 @@  discard block
 block discarded – undo
240 249
 	}
241 250
 
242 251
 	$meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) );
243
-	foreach ( $meta as $mid )
244
-		delete_metadata_by_mid( 'user', $mid );
252
+	foreach ( $meta as $mid ) {
253
+			delete_metadata_by_mid( 'user', $mid );
254
+	}
245 255
 
246 256
 	$wpdb->delete( $wpdb->users, array( 'ID' => $id ) );
247 257
 
@@ -262,8 +272,9 @@  discard block
 block discarded – undo
262 272
  * @param string $value     The new email address.
263 273
  */
264 274
 function update_option_new_admin_email( $old_value, $value ) {
265
-	if ( $value == get_option( 'admin_email' ) || !is_email( $value ) )
266
-		return;
275
+	if ( $value == get_option( 'admin_email' ) || !is_email( $value ) ) {
276
+			return;
277
+	}
267 278
 
268 279
 	$hash = md5( $value. time() .mt_rand() );
269 280
 	$new_admin_email = array(
@@ -328,11 +339,13 @@  discard block
 block discarded – undo
328 339
 function send_confirmation_on_profile_email() {
329 340
 	global $errors, $wpdb;
330 341
 	$current_user = wp_get_current_user();
331
-	if ( ! is_object($errors) )
332
-		$errors = new WP_Error();
342
+	if ( ! is_object($errors) ) {
343
+			$errors = new WP_Error();
344
+	}
333 345
 
334
-	if ( $current_user->ID != $_POST['user_id'] )
335
-		return false;
346
+	if ( $current_user->ID != $_POST['user_id'] ) {
347
+			return false;
348
+	}
336 349
 
337 350
 	if ( $current_user->user_email != $_POST['email'] ) {
338 351
 		if ( !is_email( $_POST['email'] ) ) {
@@ -423,8 +436,9 @@  discard block
 block discarded – undo
423 436
  * @return bool True if user is over upload space quota, otherwise false.
424 437
  */
425 438
 function upload_is_user_over_quota( $echo = true ) {
426
-	if ( get_site_option( 'upload_space_check_disabled' ) )
427
-		return false;
439
+	if ( get_site_option( 'upload_space_check_disabled' ) ) {
440
+			return false;
441
+	}
428 442
 
429 443
 	$space_allowed = get_space_allowed();
430 444
 	if ( ! is_numeric( $space_allowed ) ) {
@@ -433,8 +447,9 @@  discard block
 block discarded – undo
433 447
 	$space_used = get_space_used();
434 448
 
435 449
 	if ( ( $space_allowed - $space_used ) < 0 ) {
436
-		if ( $echo )
437
-			_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
450
+		if ( $echo ) {
451
+					_e( 'Sorry, you have used your space allocation. Please delete some files to upload more files.' );
452
+		}
438 453
 		return true;
439 454
 	} else {
440 455
 		return false;
@@ -494,8 +509,9 @@  discard block
 block discarded – undo
494 509
 	$quota = get_option( 'blog_upload_space' );
495 510
 	restore_current_blog();
496 511
 
497
-	if ( !$quota )
498
-		$quota = '';
512
+	if ( !$quota ) {
513
+			$quota = '';
514
+	}
499 515
 
500 516
 	?>
501 517
 	<tr>
@@ -527,8 +543,9 @@  discard block
 block discarded – undo
527 543
 function update_user_status( $id, $pref, $value, $deprecated = null ) {
528 544
 	global $wpdb;
529 545
 
530
-	if ( null !== $deprecated )
531
-		_deprecated_argument( __FUNCTION__, '3.1' );
546
+	if ( null !== $deprecated ) {
547
+			_deprecated_argument( __FUNCTION__, '3.1' );
548
+	}
532 549
 
533 550
 	$wpdb->update( $wpdb->users, array( sanitize_key( $pref ) => $value ), array( 'ID' => $id ) );
534 551
 
@@ -571,8 +588,9 @@  discard block
 block discarded – undo
571 588
 function refresh_user_details( $id ) {
572 589
 	$id = (int) $id;
573 590
 
574
-	if ( !$user = get_userdata( $id ) )
575
-		return false;
591
+	if ( !$user = get_userdata( $id ) ) {
592
+			return false;
593
+	}
576 594
 
577 595
 	clean_user_cache( $user );
578 596
 
@@ -646,18 +664,21 @@  discard block
 block discarded – undo
646 664
  * @access private
647 665
  */
648 666
 function _access_denied_splash() {
649
-	if ( ! is_user_logged_in() || is_network_admin() )
650
-		return;
667
+	if ( ! is_user_logged_in() || is_network_admin() ) {
668
+			return;
669
+	}
651 670
 
652 671
 	$blogs = get_blogs_of_user( get_current_user_id() );
653 672
 
654
-	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) )
655
-		return;
673
+	if ( wp_list_filter( $blogs, array( 'userblog_id' => get_current_blog_id() ) ) ) {
674
+			return;
675
+	}
656 676
 
657 677
 	$blog_name = get_bloginfo( 'name' );
658 678
 
659
-	if ( empty( $blogs ) )
660
-		wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
679
+	if ( empty( $blogs ) ) {
680
+			wp_die( sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ), 403 );
681
+	}
661 682
 
662 683
 	$output = '<p>' . sprintf( __( 'You attempted to access the "%1$s" dashboard, but you do not currently have privileges on this site. If you believe you should be able to access the "%1$s" dashboard, please contact your network administrator.' ), $blog_name ) . '</p>';
663 684
 	$output .= '<p>' . __( 'If you reached this screen by accident and meant to visit one of your own sites, here are some shortcuts to help you find your way.' ) . '</p>';
@@ -687,8 +708,9 @@  discard block
 block discarded – undo
687 708
  * @return bool True if the user has proper permissions, false if they do not.
688 709
  */
689 710
 function check_import_new_users( $permission ) {
690
-	if ( !is_super_admin() )
691
-		return false;
711
+	if ( !is_super_admin() ) {
712
+			return false;
713
+	}
692 714
 	return true;
693 715
 }
694 716
 // See "import_allow_fetch_attachments" and "import_attachment_size_limit" filters too.
@@ -723,8 +745,10 @@  discard block
 block discarded – undo
723 745
 
724 746
 	}
725 747
 
726
-	if ( $flag === false ) // WordPress english
748
+	if ( $flag === false ) {
749
+		// WordPress english
727 750
 		$output[] = '<option value=""' . selected( $current, '', false ) . '>' . __( 'English' ) . "</option>";
751
+	}
728 752
 
729 753
 	// Order by name
730 754
 	uksort( $output, 'strnatcasecmp' );
@@ -782,14 +806,18 @@  discard block
 block discarded – undo
782 806
  * @return array The new array of post data after checking for collisions.
783 807
  */
784 808
 function avoid_blog_page_permalink_collision( $data, $postarr ) {
785
-	if ( is_subdomain_install() )
786
-		return $data;
787
-	if ( $data['post_type'] != 'page' )
788
-		return $data;
789
-	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' )
790
-		return $data;
791
-	if ( !is_main_site() )
792
-		return $data;
809
+	if ( is_subdomain_install() ) {
810
+			return $data;
811
+	}
812
+	if ( $data['post_type'] != 'page' ) {
813
+			return $data;
814
+	}
815
+	if ( !isset( $data['post_name'] ) || $data['post_name'] == '' ) {
816
+			return $data;
817
+	}
818
+	if ( !is_main_site() ) {
819
+			return $data;
820
+	}
793 821
 
794 822
 	$post_name = $data['post_name'];
795 823
 	$c = 0;
@@ -826,8 +854,9 @@  discard block
 block discarded – undo
826 854
 			?>
827 855
 			<select name="primary_blog" id="primary_blog">
828 856
 				<?php foreach ( (array) $all_blogs as $blog ) {
829
-					if ( $primary_blog == $blog->userblog_id )
830
-						$found = true;
857
+					if ( $primary_blog == $blog->userblog_id ) {
858
+											$found = true;
859
+					}
831 860
 					?><option value="<?php echo $blog->userblog_id ?>"<?php selected( $primary_blog, $blog->userblog_id ); ?>><?php echo esc_url( get_home_url( $blog->userblog_id ) ) ?></option><?php
832 861
 				} ?>
833 862
 			</select>
@@ -839,8 +868,10 @@  discard block
 block discarded – undo
839 868
 		} elseif ( count( $all_blogs ) == 1 ) {
840 869
 			$blog = reset( $all_blogs );
841 870
 			echo esc_url( get_home_url( $blog->userblog_id ) );
842
-			if ( $primary_blog != $blog->userblog_id ) // Set the primary blog again if it's out of sync with blog list.
871
+			if ( $primary_blog != $blog->userblog_id ) {
872
+				// Set the primary blog again if it's out of sync with blog list.
843 873
 				update_user_meta( get_current_user_id(), 'primary_blog', $blog->userblog_id );
874
+			}
844 875
 		} else {
845 876
 			echo "N/A";
846 877
 		}
@@ -963,10 +994,11 @@  discard block
 block discarded – undo
963 994
 function can_edit_network( $site_id ) {
964 995
 	global $wpdb;
965 996
 
966
-	if ( $site_id == $wpdb->siteid )
967
-		$result = true;
968
-	else
969
-		$result = false;
997
+	if ( $site_id == $wpdb->siteid ) {
998
+			$result = true;
999
+	} else {
1000
+			$result = false;
1001
+	}
970 1002
 
971 1003
 	/**
972 1004
 	 * Filter whether this network can be edited from this page.
@@ -1008,8 +1040,11 @@  discard block
 block discarded – undo
1008 1040
 
1009 1041
 	<?php if ( 1 == count( $users ) ) : ?>
1010 1042
 		<p><?php _e( 'You have chosen to delete the user from all networks and sites.' ); ?></p>
1011
-	<?php else : ?>
1012
-		<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' ); ?></p>
1043
+	<?php else {
1044
+	: ?>
1045
+		<p><?php _e( 'You have chosen to delete the following users from all networks and sites.' );
1046
+}
1047
+?></p>
1013 1048
 	<?php endif; ?>
1014 1049
 
1015 1050
 	<form action="users.php?action=dodelete" method="post">
@@ -1092,8 +1127,11 @@  discard block
 block discarded – undo
1092 1127
 
1093 1128
 	if ( 1 == count( $users ) ) : ?>
1094 1129
 		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, the user will be permanently removed.' ); ?></p>
1095
-	<?php else : ?>
1096
-		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' ); ?></p>
1130
+	<?php else {
1131
+	: ?>
1132
+		<p><?php _e( 'Once you hit &#8220;Confirm Deletion&#8221;, these users will be permanently removed.' );
1133
+}
1134
+?></p>
1097 1135
 	<?php endif;
1098 1136
 
1099 1137
 	submit_button( __('Confirm Deletion'), 'primary' );
Please login to merge, or discard this patch.
src/wp-admin/includes/nav-menu.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1282,7 +1282,7 @@
 block discarded – undo
1282 1282
  *
1283 1283
  * @param int|string $nav_menu_selected_id (id, slug, or name ) of the currently-selected menu
1284 1284
  * @param string $nav_menu_selected_title Title of the currently-selected menu
1285
- * @return array $messages The menu updated message
1285
+ * @return string[] $messages The menu updated message
1286 1286
  */
1287 1287
 function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
1288 1288
 	$unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
Please login to merge, or discard this patch.
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Core Navigation Menu API
4
- *
5
- * @package WordPress
6
- * @subpackage Nav_Menus
7
- * @since 3.0.0
8
- */
3
+	 * Core Navigation Menu API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Nav_Menus
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 /** Walker_Nav_Menu_Edit class */
11 11
 require_once( ABSPATH . 'wp-admin/includes/class-walker-nav-menu-edit.php' );
Please login to merge, or discard this patch.
Spacing   +269 added lines, -269 removed lines patch added patch discarded remove patch
@@ -8,10 +8,10 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Walker_Nav_Menu_Edit class */
11
-require_once( ABSPATH . 'wp-admin/includes/class-walker-nav-menu-edit.php' );
11
+require_once(ABSPATH.'wp-admin/includes/class-walker-nav-menu-edit.php');
12 12
 
13 13
 /** Walker_Nav_Menu_Checklist class */
14
-require_once( ABSPATH . 'wp-admin/includes/class-walker-nav-menu-checklist.php' );
14
+require_once(ABSPATH.'wp-admin/includes/class-walker-nav-menu-checklist.php');
15 15
 
16 16
 /**
17 17
  * Prints the appropriate response to a menu quick search.
@@ -20,41 +20,41 @@  discard block
 block discarded – undo
20 20
  *
21 21
  * @param array $request The unsanitized request values.
22 22
  */
23
-function _wp_ajax_menu_quick_search( $request = array() ) {
23
+function _wp_ajax_menu_quick_search($request = array()) {
24 24
 	$args = array();
25
-	$type = isset( $request['type'] ) ? $request['type'] : '';
26
-	$object_type = isset( $request['object_type'] ) ? $request['object_type'] : '';
27
-	$query = isset( $request['q'] ) ? $request['q'] : '';
28
-	$response_format = isset( $request['response-format'] ) && in_array( $request['response-format'], array( 'json', 'markup' ) ) ? $request['response-format'] : 'json';
25
+	$type = isset($request['type']) ? $request['type'] : '';
26
+	$object_type = isset($request['object_type']) ? $request['object_type'] : '';
27
+	$query = isset($request['q']) ? $request['q'] : '';
28
+	$response_format = isset($request['response-format']) && in_array($request['response-format'], array('json', 'markup')) ? $request['response-format'] : 'json';
29 29
 
30
-	if ( 'markup' == $response_format ) {
30
+	if ('markup' == $response_format) {
31 31
 		$args['walker'] = new Walker_Nav_Menu_Checklist;
32 32
 	}
33 33
 
34
-	if ( 'get-post-item' == $type ) {
35
-		if ( post_type_exists( $object_type ) ) {
36
-			if ( isset( $request['ID'] ) ) {
34
+	if ('get-post-item' == $type) {
35
+		if (post_type_exists($object_type)) {
36
+			if (isset($request['ID'])) {
37 37
 				$object_id = (int) $request['ID'];
38
-				if ( 'markup' == $response_format ) {
39
-					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $object_id ) ) ), 0, (object) $args );
40
-				} elseif ( 'json' == $response_format ) {
38
+				if ('markup' == $response_format) {
39
+					echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', array(get_post($object_id))), 0, (object) $args);
40
+				} elseif ('json' == $response_format) {
41 41
 					echo wp_json_encode(
42 42
 						array(
43 43
 							'ID' => $object_id,
44
-							'post_title' => get_the_title( $object_id ),
45
-							'post_type' => get_post_type( $object_id ),
44
+							'post_title' => get_the_title($object_id),
45
+							'post_type' => get_post_type($object_id),
46 46
 						)
47 47
 					);
48 48
 					echo "\n";
49 49
 				}
50 50
 			}
51
-		} elseif ( taxonomy_exists( $object_type ) ) {
52
-			if ( isset( $request['ID'] ) ) {
51
+		} elseif (taxonomy_exists($object_type)) {
52
+			if (isset($request['ID'])) {
53 53
 				$object_id = (int) $request['ID'];
54
-				if ( 'markup' == $response_format ) {
55
-					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_term( $object_id, $object_type ) ) ), 0, (object) $args );
56
-				} elseif ( 'json' == $response_format ) {
57
-					$post_obj = get_term( $object_id, $object_type );
54
+				if ('markup' == $response_format) {
55
+					echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', array(get_term($object_id, $object_type))), 0, (object) $args);
56
+				} elseif ('json' == $response_format) {
57
+					$post_obj = get_term($object_id, $object_type);
58 58
 					echo wp_json_encode(
59 59
 						array(
60 60
 							'ID' => $object_id,
@@ -68,21 +68,21 @@  discard block
 block discarded – undo
68 68
 
69 69
 		}
70 70
 
71
-	} elseif ( preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches) ) {
72
-		if ( 'posttype' == $matches[1] && get_post_type_object( $matches[2] ) ) {
71
+	} elseif (preg_match('/quick-search-(posttype|taxonomy)-([a-zA-Z_-]*\b)/', $type, $matches)) {
72
+		if ('posttype' == $matches[1] && get_post_type_object($matches[2])) {
73 73
 			query_posts(array(
74 74
 				'posts_per_page' => 10,
75 75
 				'post_type' => $matches[2],
76 76
 				's' => $query,
77 77
 			));
78
-			if ( ! have_posts() )
78
+			if ( ! have_posts())
79 79
 				return;
80
-			while ( have_posts() ) {
80
+			while (have_posts()) {
81 81
 				the_post();
82
-				if ( 'markup' == $response_format ) {
82
+				if ('markup' == $response_format) {
83 83
 					$var_by_ref = get_the_ID();
84
-					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( get_post( $var_by_ref ) ) ), 0, (object) $args );
85
-				} elseif ( 'json' == $response_format ) {
84
+					echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', array(get_post($var_by_ref))), 0, (object) $args);
85
+				} elseif ('json' == $response_format) {
86 86
 					echo wp_json_encode(
87 87
 						array(
88 88
 							'ID' => get_the_ID(),
@@ -93,17 +93,17 @@  discard block
 block discarded – undo
93 93
 					echo "\n";
94 94
 				}
95 95
 			}
96
-		} elseif ( 'taxonomy' == $matches[1] ) {
97
-			$terms = get_terms( $matches[2], array(
96
+		} elseif ('taxonomy' == $matches[1]) {
97
+			$terms = get_terms($matches[2], array(
98 98
 				'name__like' => $query,
99 99
 				'number' => 10,
100 100
 			));
101
-			if ( empty( $terms ) || is_wp_error( $terms ) )
101
+			if (empty($terms) || is_wp_error($terms))
102 102
 				return;
103
-			foreach ( (array) $terms as $term ) {
104
-				if ( 'markup' == $response_format ) {
105
-					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
106
-				} elseif ( 'json' == $response_format ) {
103
+			foreach ((array) $terms as $term) {
104
+				if ('markup' == $response_format) {
105
+					echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', array($term)), 0, (object) $args);
106
+				} elseif ('json' == $response_format) {
107 107
 					echo wp_json_encode(
108 108
 						array(
109 109
 							'ID' => $term->term_id,
@@ -126,17 +126,17 @@  discard block
 block discarded – undo
126 126
 function wp_nav_menu_setup() {
127 127
 	// Register meta boxes
128 128
 	wp_nav_menu_post_type_meta_boxes();
129
-	add_meta_box( 'add-custom-links', __( 'Custom Links' ), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default' );
129
+	add_meta_box('add-custom-links', __('Custom Links'), 'wp_nav_menu_item_link_meta_box', 'nav-menus', 'side', 'default');
130 130
 	wp_nav_menu_taxonomy_meta_boxes();
131 131
 
132 132
 	// Register advanced menu items (columns)
133
-	add_filter( 'manage_nav-menus_columns', 'wp_nav_menu_manage_columns' );
133
+	add_filter('manage_nav-menus_columns', 'wp_nav_menu_manage_columns');
134 134
 
135 135
 	// If first time editing, disable advanced items by default.
136
-	if ( false === get_user_option( 'managenav-menuscolumnshidden' ) ) {
136
+	if (false === get_user_option('managenav-menuscolumnshidden')) {
137 137
 		$user = wp_get_current_user();
138 138
 		update_user_option($user->ID, 'managenav-menuscolumnshidden',
139
-			array( 0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', 4 => 'title-attribute', ),
139
+			array(0 => 'link-target', 1 => 'css-classes', 2 => 'xfn', 3 => 'description', 4 => 'title-attribute',),
140 140
 			true);
141 141
 	}
142 142
 }
@@ -151,17 +151,17 @@  discard block
 block discarded – undo
151 151
 function wp_initial_nav_menu_meta_boxes() {
152 152
 	global $wp_meta_boxes;
153 153
 
154
-	if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
154
+	if (get_user_option('metaboxhidden_nav-menus') !== false || ! is_array($wp_meta_boxes))
155 155
 		return;
156 156
 
157
-	$initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' );
157
+	$initial_meta_boxes = array('add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category');
158 158
 	$hidden_meta_boxes = array();
159 159
 
160
-	foreach ( array_keys($wp_meta_boxes['nav-menus']) as $context ) {
161
-		foreach ( array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority ) {
162
-			foreach ( $wp_meta_boxes['nav-menus'][$context][$priority] as $box ) {
163
-				if ( in_array( $box['id'], $initial_meta_boxes ) ) {
164
-					unset( $box['id'] );
160
+	foreach (array_keys($wp_meta_boxes['nav-menus']) as $context) {
161
+		foreach (array_keys($wp_meta_boxes['nav-menus'][$context]) as $priority) {
162
+			foreach ($wp_meta_boxes['nav-menus'][$context][$priority] as $box) {
163
+				if (in_array($box['id'], $initial_meta_boxes)) {
164
+					unset($box['id']);
165 165
 				} else {
166 166
 					$hidden_meta_boxes[] = $box['id'];
167 167
 				}
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 	}
171 171
 
172 172
 	$user = wp_get_current_user();
173
-	update_user_option( $user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true );
173
+	update_user_option($user->ID, 'metaboxhidden_nav-menus', $hidden_meta_boxes, true);
174 174
 }
175 175
 
176 176
 /**
@@ -179,12 +179,12 @@  discard block
 block discarded – undo
179 179
  * @since 3.0.0
180 180
  */
181 181
 function wp_nav_menu_post_type_meta_boxes() {
182
-	$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
182
+	$post_types = get_post_types(array('show_in_nav_menus' => true), 'object');
183 183
 
184
-	if ( ! $post_types )
184
+	if ( ! $post_types)
185 185
 		return;
186 186
 
187
-	foreach ( $post_types as $post_type ) {
187
+	foreach ($post_types as $post_type) {
188 188
 		/**
189 189
 		 * Filter whether a menu items meta box will be added for the current
190 190
 		 * object type.
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 		 * @param object $meta_box_object The current object to add a menu items
198 198
 		 *                                meta box for.
199 199
 		 */
200
-		$post_type = apply_filters( 'nav_menu_meta_box_object', $post_type );
201
-		if ( $post_type ) {
200
+		$post_type = apply_filters('nav_menu_meta_box_object', $post_type);
201
+		if ($post_type) {
202 202
 			$id = $post_type->name;
203 203
 			// Give pages a higher priority.
204
-			$priority = ( 'page' == $post_type->name ? 'core' : 'default' );
205
-			add_meta_box( "add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type );
204
+			$priority = ('page' == $post_type->name ? 'core' : 'default');
205
+			add_meta_box("add-post-type-{$id}", $post_type->labels->name, 'wp_nav_menu_item_post_type_meta_box', 'nav-menus', 'side', $priority, $post_type);
206 206
 		}
207 207
 	}
208 208
 }
@@ -213,17 +213,17 @@  discard block
 block discarded – undo
213 213
  * @since 3.0.0
214 214
  */
215 215
 function wp_nav_menu_taxonomy_meta_boxes() {
216
-	$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
216
+	$taxonomies = get_taxonomies(array('show_in_nav_menus' => true), 'object');
217 217
 
218
-	if ( !$taxonomies )
218
+	if ( ! $taxonomies)
219 219
 		return;
220 220
 
221
-	foreach ( $taxonomies as $tax ) {
221
+	foreach ($taxonomies as $tax) {
222 222
 		/** This filter is documented in wp-admin/includes/nav-menu.php */
223
-		$tax = apply_filters( 'nav_menu_meta_box_object', $tax );
224
-		if ( $tax ) {
223
+		$tax = apply_filters('nav_menu_meta_box_object', $tax);
224
+		if ($tax) {
225 225
 			$id = $tax->name;
226
-			add_meta_box( "add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax );
226
+			add_meta_box("add-{$id}", $tax->labels->name, 'wp_nav_menu_item_taxonomy_meta_box', 'nav-menus', 'side', 'default', $tax);
227 227
 		}
228 228
 	}
229 229
 }
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
  * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu
239 239
  * @return string Disabled attribute if at least one menu exists, false if not
240 240
  */
241
-function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
241
+function wp_nav_menu_disabled_check($nav_menu_selected_id) {
242 242
 	global $one_theme_location_no_menus;
243 243
 
244
-	if ( $one_theme_location_no_menus )
244
+	if ($one_theme_location_no_menus)
245 245
 		return false;
246 246
 
247
-	return disabled( $nav_menu_selected_id, 0 );
247
+	return disabled($nav_menu_selected_id, 0);
248 248
 }
249 249
 
250 250
 /**
@@ -264,18 +264,18 @@  discard block
 block discarded – undo
264 264
 	<div class="customlinkdiv" id="customlinkdiv">
265 265
 		<input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
266 266
 		<p id="menu-item-url-wrap" class="wp-clearfix">
267
-			<label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label>
267
+			<label class="howto" for="custom-menu-item-url"><?php _e('URL'); ?></label>
268 268
 			<input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" value="http://" />
269 269
 		</p>
270 270
 
271 271
 		<p id="menu-item-name-wrap" class="wp-clearfix">
272
-			<label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label>
272
+			<label class="howto" for="custom-menu-item-name"><?php _e('Link Text'); ?></label>
273 273
 			<input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" />
274 274
 		</p>
275 275
 
276 276
 		<p class="button-controls wp-clearfix">
277 277
 			<span class="add-to-menu">
278
-				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
278
+				<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-custom-menu-item" id="submit-customlinkdiv" />
279 279
 				<span class="spinner"></span>
280 280
 			</span>
281 281
 		</p>
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
  * @param string $object Not used.
296 296
  * @param string $post_type The post type object.
297 297
  */
298
-function wp_nav_menu_item_post_type_meta_box( $object, $post_type ) {
298
+function wp_nav_menu_item_post_type_meta_box($object, $post_type) {
299 299
 	global $_nav_menu_placeholder, $nav_menu_selected_id;
300 300
 
301 301
 	$post_type_name = $post_type['args']->name;
302 302
 
303 303
 	// Paginate browsing for large numbers of post objects.
304 304
 	$per_page = 50;
305
-	$pagenum = isset( $_REQUEST[$post_type_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
306
-	$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
305
+	$pagenum = isset($_REQUEST[$post_type_name.'-tab']) && isset($_REQUEST['paged']) ? absint($_REQUEST['paged']) : 1;
306
+	$offset = 0 < $pagenum ? $per_page * ($pagenum - 1) : 0;
307 307
 
308 308
 	$args = array(
309 309
 		'offset' => $offset,
@@ -316,23 +316,23 @@  discard block
 block discarded – undo
316 316
 		'update_post_meta_cache' => false
317 317
 	);
318 318
 
319
-	if ( isset( $post_type['args']->_default_query ) )
320
-		$args = array_merge($args, (array) $post_type['args']->_default_query );
319
+	if (isset($post_type['args']->_default_query))
320
+		$args = array_merge($args, (array) $post_type['args']->_default_query);
321 321
 
322 322
 	// @todo transient caching of these results with proper invalidation on updating of a post of this type
323 323
 	$get_posts = new WP_Query;
324
-	$posts = $get_posts->query( $args );
325
-	if ( ! $get_posts->post_count ) {
326
-		echo '<p>' . __( 'No items.' ) . '</p>';
324
+	$posts = $get_posts->query($args);
325
+	if ( ! $get_posts->post_count) {
326
+		echo '<p>'.__('No items.').'</p>';
327 327
 		return;
328 328
 	}
329 329
 
330 330
 	$num_pages = $get_posts->max_num_pages;
331 331
 
332
-	$page_links = paginate_links( array(
332
+	$page_links = paginate_links(array(
333 333
 		'base' => add_query_arg(
334 334
 			array(
335
-				$post_type_name . '-tab' => 'all',
335
+				$post_type_name.'-tab' => 'all',
336 336
 				'paged' => '%#%',
337 337
 				'item-type' => 'post_type',
338 338
 				'item-object' => $post_type_name,
@@ -346,18 +346,18 @@  discard block
 block discarded – undo
346 346
 	));
347 347
 
348 348
 	$db_fields = false;
349
-	if ( is_post_type_hierarchical( $post_type_name ) ) {
350
-		$db_fields = array( 'parent' => 'post_parent', 'id' => 'ID' );
349
+	if (is_post_type_hierarchical($post_type_name)) {
350
+		$db_fields = array('parent' => 'post_parent', 'id' => 'ID');
351 351
 	}
352 352
 
353
-	$walker = new Walker_Nav_Menu_Checklist( $db_fields );
353
+	$walker = new Walker_Nav_Menu_Checklist($db_fields);
354 354
 
355 355
 	$current_tab = 'most-recent';
356
-	if ( isset( $_REQUEST[$post_type_name . '-tab'] ) && in_array( $_REQUEST[$post_type_name . '-tab'], array('all', 'search') ) ) {
357
-		$current_tab = $_REQUEST[$post_type_name . '-tab'];
356
+	if (isset($_REQUEST[$post_type_name.'-tab']) && in_array($_REQUEST[$post_type_name.'-tab'], array('all', 'search'))) {
357
+		$current_tab = $_REQUEST[$post_type_name.'-tab'];
358 358
 	}
359 359
 
360
-	if ( ! empty( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
360
+	if ( ! empty($_REQUEST['quick-search-posttype-'.$post_type_name])) {
361 361
 		$current_tab = 'search';
362 362
 	}
363 363
 
@@ -373,30 +373,30 @@  discard block
 block discarded – undo
373 373
 	?>
374 374
 	<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
375 375
 		<ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
376
-			<li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
377
-				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
378
-					<?php _e( 'Most Recent' ); ?>
376
+			<li <?php echo ('most-recent' == $current_tab ? ' class="tabs"' : ''); ?>>
377
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr($post_type_name); ?>-most-recent" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($post_type_name.'-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
378
+					<?php _e('Most Recent'); ?>
379 379
 				</a>
380 380
 			</li>
381
-			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
382
-				<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
383
-					<?php _e( 'View All' ); ?>
381
+			<li <?php echo ('all' == $current_tab ? ' class="tabs"' : ''); ?>>
382
+				<a class="nav-tab-link" data-type="<?php echo esc_attr($post_type_name); ?>-all" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($post_type_name.'-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
383
+					<?php _e('View All'); ?>
384 384
 				</a>
385 385
 			</li>
386
-			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
387
-				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
388
-					<?php _e( 'Search'); ?>
386
+			<li <?php echo ('search' == $current_tab ? ' class="tabs"' : ''); ?>>
387
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr($post_type_name); ?>-search" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($post_type_name.'-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
388
+					<?php _e('Search'); ?>
389 389
 				</a>
390 390
 			</li>
391 391
 		</ul><!-- .posttype-tabs -->
392 392
 
393 393
 		<div id="tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent" class="tabs-panel <?php
394
-			echo ( 'most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
394
+			echo ('most-recent' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
395 395
 		?>">
396 396
 			<ul id="<?php echo $post_type_name; ?>checklist-most-recent" class="categorychecklist form-no-clear">
397 397
 				<?php
398
-				$recent_args = array_merge( $args, array( 'orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15 ) );
399
-				$most_recent = $get_posts->query( $recent_args );
398
+				$recent_args = array_merge($args, array('orderby' => 'post_date', 'order' => 'DESC', 'posts_per_page' => 15));
399
+				$most_recent = $get_posts->query($recent_args);
400 400
 				$args['walker'] = $walker;
401 401
 
402 402
 				/**
@@ -411,50 +411,50 @@  discard block
 block discarded – undo
411 411
 				 * @param array  $args        An array of WP_Query arguments.
412 412
 				 * @param object $post_type   The current post type object for this menu item meta box.
413 413
 				 */
414
-				$most_recent = apply_filters( "nav_menu_items_{$post_type_name}_recent", $most_recent, $args, $post_type );
414
+				$most_recent = apply_filters("nav_menu_items_{$post_type_name}_recent", $most_recent, $args, $post_type);
415 415
 
416
-				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args );
416
+				echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $most_recent), 0, (object) $args);
417 417
 				?>
418 418
 			</ul>
419 419
 		</div><!-- /.tabs-panel -->
420 420
 
421 421
 		<div class="tabs-panel <?php
422
-			echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
422
+			echo ('search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
423 423
 		?>" id="tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
424 424
 			<?php
425
-			if ( isset( $_REQUEST['quick-search-posttype-' . $post_type_name] ) ) {
426
-				$searched = esc_attr( $_REQUEST['quick-search-posttype-' . $post_type_name] );
427
-				$search_results = get_posts( array( 's' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC', ) );
425
+			if (isset($_REQUEST['quick-search-posttype-'.$post_type_name])) {
426
+				$searched = esc_attr($_REQUEST['quick-search-posttype-'.$post_type_name]);
427
+				$search_results = get_posts(array('s' => $searched, 'post_type' => $post_type_name, 'fields' => 'all', 'order' => 'DESC',));
428 428
 			} else {
429 429
 				$searched = '';
430 430
 				$search_results = array();
431 431
 			}
432 432
 			?>
433 433
 			<p class="quick-search-wrap">
434
-				<label for="quick-search-posttype-<?php echo $post_type_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label>
434
+				<label for="quick-search-posttype-<?php echo $post_type_name; ?>" class="screen-reader-text"><?php _e('Search'); ?></label>
435 435
 				<input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" id="quick-search-posttype-<?php echo $post_type_name; ?>" />
436 436
 				<span class="spinner"></span>
437
-				<?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
437
+				<?php submit_button(__('Search'), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array('id' => 'submit-quick-search-posttype-'.$post_type_name)); ?>
438 438
 			</p>
439 439
 
440 440
 			<ul id="<?php echo $post_type_name; ?>-search-checklist" data-wp-lists="list:<?php echo $post_type_name?>" class="categorychecklist form-no-clear">
441
-			<?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
441
+			<?php if ( ! empty($search_results) && ! is_wp_error($search_results)) : ?>
442 442
 				<?php
443 443
 				$args['walker'] = $walker;
444
-				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
444
+				echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args);
445 445
 				?>
446
-			<?php elseif ( is_wp_error( $search_results ) ) : ?>
446
+			<?php elseif (is_wp_error($search_results)) : ?>
447 447
 				<li><?php echo $search_results->get_error_message(); ?></li>
448
-			<?php elseif ( ! empty( $searched ) ) : ?>
448
+			<?php elseif ( ! empty($searched)) : ?>
449 449
 				<li><?php _e('No results found.'); ?></li>
450 450
 			<?php endif; ?>
451 451
 			</ul>
452 452
 		</div><!-- /.tabs-panel -->
453 453
 
454 454
 		<div id="<?php echo $post_type_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
455
-			echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
455
+			echo ('all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
456 456
 		?>">
457
-			<?php if ( ! empty( $page_links ) ) : ?>
457
+			<?php if ( ! empty($page_links)) : ?>
458 458
 				<div class="add-menu-item-pagelinks">
459 459
 					<?php echo $page_links; ?>
460 460
 				</div>
@@ -467,15 +467,15 @@  discard block
 block discarded – undo
467 467
 				 * If we're dealing with pages, let's put a checkbox for the front
468 468
 				 * page at the top of the list.
469 469
 				 */
470
-				if ( 'page' == $post_type_name ) {
471
-					$front_page = 'page' == get_option('show_on_front') ? (int) get_option( 'page_on_front' ) : 0;
472
-					if ( ! empty( $front_page ) ) {
473
-						$front_page_obj = get_post( $front_page );
470
+				if ('page' == $post_type_name) {
471
+					$front_page = 'page' == get_option('show_on_front') ? (int) get_option('page_on_front') : 0;
472
+					if ( ! empty($front_page)) {
473
+						$front_page_obj = get_post($front_page);
474 474
 						$front_page_obj->front_or_home = true;
475
-						array_unshift( $posts, $front_page_obj );
475
+						array_unshift($posts, $front_page_obj);
476 476
 					} else {
477
-						$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
478
-						array_unshift( $posts, (object) array(
477
+						$_nav_menu_placeholder = (0 > $_nav_menu_placeholder) ? intval($_nav_menu_placeholder) - 1 : -1;
478
+						array_unshift($posts, (object) array(
479 479
 							'front_or_home' => true,
480 480
 							'ID' => 0,
481 481
 							'object_id' => $_nav_menu_placeholder,
@@ -486,15 +486,15 @@  discard block
 block discarded – undo
486 486
 							'post_type' => 'nav_menu_item',
487 487
 							'type' => 'custom',
488 488
 							'url' => home_url('/'),
489
-						) );
489
+						));
490 490
 					}
491 491
 				}
492 492
 
493
-				$post_type = get_post_type_object( $post_type_name );
494
-				$archive_link = get_post_type_archive_link( $post_type_name );
495
-				if ( $post_type->has_archive ) {
496
-					$_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval($_nav_menu_placeholder) - 1 : -1;
497
-					array_unshift( $posts, (object) array(
493
+				$post_type = get_post_type_object($post_type_name);
494
+				$archive_link = get_post_type_archive_link($post_type_name);
495
+				if ($post_type->has_archive) {
496
+					$_nav_menu_placeholder = (0 > $_nav_menu_placeholder) ? intval($_nav_menu_placeholder) - 1 : -1;
497
+					array_unshift($posts, (object) array(
498 498
 						'ID' => 0,
499 499
 						'object_id' => $_nav_menu_placeholder,
500 500
 						'object'     => $post_type_name,
@@ -503,8 +503,8 @@  discard block
 block discarded – undo
503 503
 						'post_title' => $post_type->labels->archives,
504 504
 						'post_type' => 'nav_menu_item',
505 505
 						'type' => 'post_type_archive',
506
-						'url' => get_post_type_archive_link( $post_type_name ),
507
-					) );
506
+						'url' => get_post_type_archive_link($post_type_name),
507
+					));
508 508
 				}
509 509
 
510 510
 				/**
@@ -522,10 +522,10 @@  discard block
 block discarded – undo
522 522
 				 * @param array  $args      An array of WP_Query arguments.
523 523
 				 * @param object $post_type The current post type object for this menu item meta box.
524 524
 				 */
525
-				$posts = apply_filters( "nav_menu_items_{$post_type_name}", $posts, $args, $post_type );
526
-				$checkbox_items = walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args );
525
+				$posts = apply_filters("nav_menu_items_{$post_type_name}", $posts, $args, $post_type);
526
+				$checkbox_items = walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $posts), 0, (object) $args);
527 527
 
528
-				if ( 'all' == $current_tab && ! empty( $_REQUEST['selectall'] ) ) {
528
+				if ('all' == $current_tab && ! empty($_REQUEST['selectall'])) {
529 529
 					$checkbox_items = preg_replace('/(type=(.)checkbox(\2))/', '$1 checked=$2checked$2', $checkbox_items);
530 530
 
531 531
 				}
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 				echo $checkbox_items;
534 534
 				?>
535 535
 			</ul>
536
-			<?php if ( ! empty( $page_links ) ) : ?>
536
+			<?php if ( ! empty($page_links)) : ?>
537 537
 				<div class="add-menu-item-pagelinks">
538 538
 					<?php echo $page_links; ?>
539 539
 				</div>
@@ -543,18 +543,18 @@  discard block
 block discarded – undo
543 543
 		<p class="button-controls wp-clearfix">
544 544
 			<span class="list-controls">
545 545
 				<a href="<?php
546
-					echo esc_url( add_query_arg(
546
+					echo esc_url(add_query_arg(
547 547
 						array(
548
-							$post_type_name . '-tab' => 'all',
548
+							$post_type_name.'-tab' => 'all',
549 549
 							'selectall' => 1,
550 550
 						),
551
-						remove_query_arg( $removed_args )
551
+						remove_query_arg($removed_args)
552 552
 					));
553 553
 				?>#posttype-<?php echo $post_type_name; ?>" class="select-all"><?php _e('Select All'); ?></a>
554 554
 			</span>
555 555
 
556 556
 			<span class="add-to-menu">
557
-				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-post-type-menu-item" id="<?php echo esc_attr( 'submit-posttype-' . $post_type_name ); ?>" />
557
+				<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-post-type-menu-item" id="<?php echo esc_attr('submit-posttype-'.$post_type_name); ?>" />
558 558
 				<span class="spinner"></span>
559 559
 			</span>
560 560
 		</p>
@@ -573,14 +573,14 @@  discard block
 block discarded – undo
573 573
  * @param string $object Not used.
574 574
  * @param string $taxonomy The taxonomy object.
575 575
  */
576
-function wp_nav_menu_item_taxonomy_meta_box( $object, $taxonomy ) {
576
+function wp_nav_menu_item_taxonomy_meta_box($object, $taxonomy) {
577 577
 	global $nav_menu_selected_id;
578 578
 	$taxonomy_name = $taxonomy['args']->name;
579 579
 
580 580
 	// Paginate browsing for large numbers of objects.
581 581
 	$per_page = 50;
582
-	$pagenum = isset( $_REQUEST[$taxonomy_name . '-tab'] ) && isset( $_REQUEST['paged'] ) ? absint( $_REQUEST['paged'] ) : 1;
583
-	$offset = 0 < $pagenum ? $per_page * ( $pagenum - 1 ) : 0;
582
+	$pagenum = isset($_REQUEST[$taxonomy_name.'-tab']) && isset($_REQUEST['paged']) ? absint($_REQUEST['paged']) : 1;
583
+	$offset = 0 < $pagenum ? $per_page * ($pagenum - 1) : 0;
584 584
 
585 585
 	$args = array(
586 586
 		'child_of' => 0,
@@ -595,19 +595,19 @@  discard block
 block discarded – undo
595 595
 		'pad_counts' => false,
596 596
 	);
597 597
 
598
-	$terms = get_terms( $taxonomy_name, $args );
598
+	$terms = get_terms($taxonomy_name, $args);
599 599
 
600
-	if ( ! $terms || is_wp_error($terms) ) {
601
-		echo '<p>' . __( 'No items.' ) . '</p>';
600
+	if ( ! $terms || is_wp_error($terms)) {
601
+		echo '<p>'.__('No items.').'</p>';
602 602
 		return;
603 603
 	}
604 604
 
605
-	$num_pages = ceil( wp_count_terms( $taxonomy_name , array_merge( $args, array('number' => '', 'offset' => '') ) ) / $per_page );
605
+	$num_pages = ceil(wp_count_terms($taxonomy_name, array_merge($args, array('number' => '', 'offset' => ''))) / $per_page);
606 606
 
607
-	$page_links = paginate_links( array(
607
+	$page_links = paginate_links(array(
608 608
 		'base' => add_query_arg(
609 609
 			array(
610
-				$taxonomy_name . '-tab' => 'all',
610
+				$taxonomy_name.'-tab' => 'all',
611 611
 				'paged' => '%#%',
612 612
 				'item-type' => 'taxonomy',
613 613
 				'item-object' => $taxonomy_name,
@@ -621,18 +621,18 @@  discard block
 block discarded – undo
621 621
 	));
622 622
 
623 623
 	$db_fields = false;
624
-	if ( is_taxonomy_hierarchical( $taxonomy_name ) ) {
625
-		$db_fields = array( 'parent' => 'parent', 'id' => 'term_id' );
624
+	if (is_taxonomy_hierarchical($taxonomy_name)) {
625
+		$db_fields = array('parent' => 'parent', 'id' => 'term_id');
626 626
 	}
627 627
 
628
-	$walker = new Walker_Nav_Menu_Checklist( $db_fields );
628
+	$walker = new Walker_Nav_Menu_Checklist($db_fields);
629 629
 
630 630
 	$current_tab = 'most-used';
631
-	if ( isset( $_REQUEST[$taxonomy_name . '-tab'] ) && in_array( $_REQUEST[$taxonomy_name . '-tab'], array('all', 'most-used', 'search') ) ) {
632
-		$current_tab = $_REQUEST[$taxonomy_name . '-tab'];
631
+	if (isset($_REQUEST[$taxonomy_name.'-tab']) && in_array($_REQUEST[$taxonomy_name.'-tab'], array('all', 'most-used', 'search'))) {
632
+		$current_tab = $_REQUEST[$taxonomy_name.'-tab'];
633 633
 	}
634 634
 
635
-	if ( ! empty( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
635
+	if ( ! empty($_REQUEST['quick-search-taxonomy-'.$taxonomy_name])) {
636 636
 		$current_tab = 'search';
637 637
 	}
638 638
 
@@ -648,39 +648,39 @@  discard block
 block discarded – undo
648 648
 	?>
649 649
 	<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
650 650
 		<ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
651
-			<li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
652
-				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
653
-					<?php _e( 'Most Used' ); ?>
651
+			<li <?php echo ('most-used' == $current_tab ? ' class="tabs"' : ''); ?>>
652
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr($taxonomy_name); ?>-pop" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($taxonomy_name.'-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
653
+					<?php _e('Most Used'); ?>
654 654
 				</a>
655 655
 			</li>
656
-			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
657
-				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
658
-					<?php _e( 'View All' ); ?>
656
+			<li <?php echo ('all' == $current_tab ? ' class="tabs"' : ''); ?>>
657
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr($taxonomy_name); ?>-all" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($taxonomy_name.'-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
658
+					<?php _e('View All'); ?>
659 659
 				</a>
660 660
 			</li>
661
-			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
662
-				<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
663
-					<?php _e( 'Search' ); ?>
661
+			<li <?php echo ('search' == $current_tab ? ' class="tabs"' : ''); ?>>
662
+				<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr($taxonomy_name); ?>" href="<?php if ($nav_menu_selected_id) echo esc_url(add_query_arg($taxonomy_name.'-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
663
+					<?php _e('Search'); ?>
664 664
 				</a>
665 665
 			</li>
666 666
 		</ul><!-- .taxonomy-tabs -->
667 667
 
668 668
 		<div id="tabs-panel-<?php echo $taxonomy_name; ?>-pop" class="tabs-panel <?php
669
-			echo ( 'most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
669
+			echo ('most-used' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
670 670
 		?>">
671 671
 			<ul id="<?php echo $taxonomy_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
672 672
 				<?php
673
-				$popular_terms = get_terms( $taxonomy_name, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
673
+				$popular_terms = get_terms($taxonomy_name, array('orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false));
674 674
 				$args['walker'] = $walker;
675
-				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args );
675
+				echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $popular_terms), 0, (object) $args);
676 676
 				?>
677 677
 			</ul>
678 678
 		</div><!-- /.tabs-panel -->
679 679
 
680 680
 		<div id="tabs-panel-<?php echo $taxonomy_name; ?>-all" class="tabs-panel tabs-panel-view-all <?php
681
-			echo ( 'all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
681
+			echo ('all' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
682 682
 		?>">
683
-			<?php if ( ! empty( $page_links ) ) : ?>
683
+			<?php if ( ! empty($page_links)) : ?>
684 684
 				<div class="add-menu-item-pagelinks">
685 685
 					<?php echo $page_links; ?>
686 686
 				</div>
@@ -688,10 +688,10 @@  discard block
 block discarded – undo
688 688
 			<ul id="<?php echo $taxonomy_name; ?>checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
689 689
 				<?php
690 690
 				$args['walker'] = $walker;
691
-				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args );
691
+				echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $terms), 0, (object) $args);
692 692
 				?>
693 693
 			</ul>
694
-			<?php if ( ! empty( $page_links ) ) : ?>
694
+			<?php if ( ! empty($page_links)) : ?>
695 695
 				<div class="add-menu-item-pagelinks">
696 696
 					<?php echo $page_links; ?>
697 697
 				</div>
@@ -699,33 +699,33 @@  discard block
 block discarded – undo
699 699
 		</div><!-- /.tabs-panel -->
700 700
 
701 701
 		<div class="tabs-panel <?php
702
-			echo ( 'search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive' );
702
+			echo ('search' == $current_tab ? 'tabs-panel-active' : 'tabs-panel-inactive');
703 703
 		?>" id="tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
704 704
 			<?php
705
-			if ( isset( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] ) ) {
706
-				$searched = esc_attr( $_REQUEST['quick-search-taxonomy-' . $taxonomy_name] );
707
-				$search_results = get_terms( $taxonomy_name, array( 'name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false ) );
705
+			if (isset($_REQUEST['quick-search-taxonomy-'.$taxonomy_name])) {
706
+				$searched = esc_attr($_REQUEST['quick-search-taxonomy-'.$taxonomy_name]);
707
+				$search_results = get_terms($taxonomy_name, array('name__like' => $searched, 'fields' => 'all', 'orderby' => 'count', 'order' => 'DESC', 'hierarchical' => false));
708 708
 			} else {
709 709
 				$searched = '';
710 710
 				$search_results = array();
711 711
 			}
712 712
 			?>
713 713
 			<p class="quick-search-wrap">
714
-				<label for="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label>
714
+				<label for="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" class="screen-reader-text"><?php _e('Search'); ?></label>
715 715
 				<input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" id="quick-search-taxonomy-<?php echo $taxonomy_name; ?>" />
716 716
 				<span class="spinner"></span>
717
-				<?php submit_button( __( 'Search' ), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-taxonomy-' . $taxonomy_name ) ); ?>
717
+				<?php submit_button(__('Search'), 'button-small quick-search-submit button-secondary hide-if-js', 'submit', false, array('id' => 'submit-quick-search-taxonomy-'.$taxonomy_name)); ?>
718 718
 			</p>
719 719
 
720 720
 			<ul id="<?php echo $taxonomy_name; ?>-search-checklist" data-wp-lists="list:<?php echo $taxonomy_name?>" class="categorychecklist form-no-clear">
721
-			<?php if ( ! empty( $search_results ) && ! is_wp_error( $search_results ) ) : ?>
721
+			<?php if ( ! empty($search_results) && ! is_wp_error($search_results)) : ?>
722 722
 				<?php
723 723
 				$args['walker'] = $walker;
724
-				echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args );
724
+				echo walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $search_results), 0, (object) $args);
725 725
 				?>
726
-			<?php elseif ( is_wp_error( $search_results ) ) : ?>
726
+			<?php elseif (is_wp_error($search_results)) : ?>
727 727
 				<li><?php echo $search_results->get_error_message(); ?></li>
728
-			<?php elseif ( ! empty( $searched ) ) : ?>
728
+			<?php elseif ( ! empty($searched)) : ?>
729 729
 				<li><?php _e('No results found.'); ?></li>
730 730
 			<?php endif; ?>
731 731
 			</ul>
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 				<a href="<?php
737 737
 					echo esc_url(add_query_arg(
738 738
 						array(
739
-							$taxonomy_name . '-tab' => 'all',
739
+							$taxonomy_name.'-tab' => 'all',
740 740
 							'selectall' => 1,
741 741
 						),
742 742
 						remove_query_arg($removed_args)
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 			</span>
746 746
 
747 747
 			<span class="add-to-menu">
748
-				<input type="submit"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e( 'Add to Menu' ); ?>" name="add-taxonomy-menu-item" id="<?php echo esc_attr( 'submit-taxonomy-' . $taxonomy_name ); ?>" />
748
+				<input type="submit"<?php wp_nav_menu_disabled_check($nav_menu_selected_id); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-taxonomy-menu-item" id="<?php echo esc_attr('submit-taxonomy-'.$taxonomy_name); ?>" />
749 749
 				<span class="spinner"></span>
750 750
 			</span>
751 751
 		</p>
@@ -763,25 +763,25 @@  discard block
 block discarded – undo
763 763
  * @param array $menu_data The unsanitized posted menu item data.
764 764
  * @return array The database IDs of the items saved
765 765
  */
766
-function wp_save_nav_menu_items( $menu_id = 0, $menu_data = array() ) {
766
+function wp_save_nav_menu_items($menu_id = 0, $menu_data = array()) {
767 767
 	$menu_id = (int) $menu_id;
768 768
 	$items_saved = array();
769 769
 
770
-	if ( 0 == $menu_id || is_nav_menu( $menu_id ) ) {
770
+	if (0 == $menu_id || is_nav_menu($menu_id)) {
771 771
 
772 772
 		// Loop through all the menu items' POST values.
773
-		foreach ( (array) $menu_data as $_possible_db_id => $_item_object_data ) {
773
+		foreach ((array) $menu_data as $_possible_db_id => $_item_object_data) {
774 774
 			if (
775 775
 				// Checkbox is not checked.
776
-				empty( $_item_object_data['menu-item-object-id'] ) &&
776
+				empty($_item_object_data['menu-item-object-id']) &&
777 777
 				(
778 778
 					// And item type either isn't set.
779
-					! isset( $_item_object_data['menu-item-type'] ) ||
779
+					! isset($_item_object_data['menu-item-type']) ||
780 780
 					// Or URL is the default.
781
-					in_array( $_item_object_data['menu-item-url'], array( 'http://', '' ) ) ||
782
-					! ( 'custom' == $_item_object_data['menu-item-type'] && ! isset( $_item_object_data['menu-item-db-id'] ) ) || // or it's not a custom menu item (but not the custom home page)
781
+					in_array($_item_object_data['menu-item-url'], array('http://', '')) ||
782
+					! ('custom' == $_item_object_data['menu-item-type'] && ! isset($_item_object_data['menu-item-db-id'])) || // or it's not a custom menu item (but not the custom home page)
783 783
 					// Or it *is* a custom menu item that already exists.
784
-					! empty( $_item_object_data['menu-item-db-id'] )
784
+					! empty($_item_object_data['menu-item-db-id'])
785 785
 				)
786 786
 			) {
787 787
 				// Then this potential menu item is not getting added to this menu.
@@ -790,8 +790,8 @@  discard block
 block discarded – undo
790 790
 
791 791
 			// If this possible menu item doesn't actually have a menu database ID yet.
792 792
 			if (
793
-				empty( $_item_object_data['menu-item-db-id'] ) ||
794
-				( 0 > $_possible_db_id ) ||
793
+				empty($_item_object_data['menu-item-db-id']) ||
794
+				(0 > $_possible_db_id) ||
795 795
 				$_possible_db_id != $_item_object_data['menu-item-db-id']
796 796
 			) {
797 797
 				$_actual_db_id = 0;
@@ -800,22 +800,22 @@  discard block
 block discarded – undo
800 800
 			}
801 801
 
802 802
 			$args = array(
803
-				'menu-item-db-id' => ( isset( $_item_object_data['menu-item-db-id'] ) ? $_item_object_data['menu-item-db-id'] : '' ),
804
-				'menu-item-object-id' => ( isset( $_item_object_data['menu-item-object-id'] ) ? $_item_object_data['menu-item-object-id'] : '' ),
805
-				'menu-item-object' => ( isset( $_item_object_data['menu-item-object'] ) ? $_item_object_data['menu-item-object'] : '' ),
806
-				'menu-item-parent-id' => ( isset( $_item_object_data['menu-item-parent-id'] ) ? $_item_object_data['menu-item-parent-id'] : '' ),
807
-				'menu-item-position' => ( isset( $_item_object_data['menu-item-position'] ) ? $_item_object_data['menu-item-position'] : '' ),
808
-				'menu-item-type' => ( isset( $_item_object_data['menu-item-type'] ) ? $_item_object_data['menu-item-type'] : '' ),
809
-				'menu-item-title' => ( isset( $_item_object_data['menu-item-title'] ) ? $_item_object_data['menu-item-title'] : '' ),
810
-				'menu-item-url' => ( isset( $_item_object_data['menu-item-url'] ) ? $_item_object_data['menu-item-url'] : '' ),
811
-				'menu-item-description' => ( isset( $_item_object_data['menu-item-description'] ) ? $_item_object_data['menu-item-description'] : '' ),
812
-				'menu-item-attr-title' => ( isset( $_item_object_data['menu-item-attr-title'] ) ? $_item_object_data['menu-item-attr-title'] : '' ),
813
-				'menu-item-target' => ( isset( $_item_object_data['menu-item-target'] ) ? $_item_object_data['menu-item-target'] : '' ),
814
-				'menu-item-classes' => ( isset( $_item_object_data['menu-item-classes'] ) ? $_item_object_data['menu-item-classes'] : '' ),
815
-				'menu-item-xfn' => ( isset( $_item_object_data['menu-item-xfn'] ) ? $_item_object_data['menu-item-xfn'] : '' ),
803
+				'menu-item-db-id' => (isset($_item_object_data['menu-item-db-id']) ? $_item_object_data['menu-item-db-id'] : ''),
804
+				'menu-item-object-id' => (isset($_item_object_data['menu-item-object-id']) ? $_item_object_data['menu-item-object-id'] : ''),
805
+				'menu-item-object' => (isset($_item_object_data['menu-item-object']) ? $_item_object_data['menu-item-object'] : ''),
806
+				'menu-item-parent-id' => (isset($_item_object_data['menu-item-parent-id']) ? $_item_object_data['menu-item-parent-id'] : ''),
807
+				'menu-item-position' => (isset($_item_object_data['menu-item-position']) ? $_item_object_data['menu-item-position'] : ''),
808
+				'menu-item-type' => (isset($_item_object_data['menu-item-type']) ? $_item_object_data['menu-item-type'] : ''),
809
+				'menu-item-title' => (isset($_item_object_data['menu-item-title']) ? $_item_object_data['menu-item-title'] : ''),
810
+				'menu-item-url' => (isset($_item_object_data['menu-item-url']) ? $_item_object_data['menu-item-url'] : ''),
811
+				'menu-item-description' => (isset($_item_object_data['menu-item-description']) ? $_item_object_data['menu-item-description'] : ''),
812
+				'menu-item-attr-title' => (isset($_item_object_data['menu-item-attr-title']) ? $_item_object_data['menu-item-attr-title'] : ''),
813
+				'menu-item-target' => (isset($_item_object_data['menu-item-target']) ? $_item_object_data['menu-item-target'] : ''),
814
+				'menu-item-classes' => (isset($_item_object_data['menu-item-classes']) ? $_item_object_data['menu-item-classes'] : ''),
815
+				'menu-item-xfn' => (isset($_item_object_data['menu-item-xfn']) ? $_item_object_data['menu-item-xfn'] : ''),
816 816
 			);
817 817
 
818
-			$items_saved[] = wp_update_nav_menu_item( $menu_id, $_actual_db_id, $args );
818
+			$items_saved[] = wp_update_nav_menu_item($menu_id, $_actual_db_id, $args);
819 819
 
820 820
 		}
821 821
 	}
@@ -832,23 +832,23 @@  discard block
 block discarded – undo
832 832
  * @param object $object The post type or taxonomy meta-object.
833 833
  * @return object The post type of taxonomy object.
834 834
  */
835
-function _wp_nav_menu_meta_box_object( $object = null ) {
836
-	if ( isset( $object->name ) ) {
835
+function _wp_nav_menu_meta_box_object($object = null) {
836
+	if (isset($object->name)) {
837 837
 
838
-		if ( 'page' == $object->name ) {
838
+		if ('page' == $object->name) {
839 839
 			$object->_default_query = array(
840 840
 				'orderby' => 'menu_order title',
841 841
 				'post_status' => 'publish',
842 842
 			);
843 843
 
844 844
 		// Posts should show only published items.
845
-		} elseif ( 'post' == $object->name ) {
845
+		} elseif ('post' == $object->name) {
846 846
 			$object->_default_query = array(
847 847
 				'post_status' => 'publish',
848 848
 			);
849 849
 
850 850
 		// Categories should be in reverse chronological order.
851
-		} elseif ( 'category' == $object->name ) {
851
+		} elseif ('category' == $object->name) {
852 852
 			$object->_default_query = array(
853 853
 				'orderby' => 'id',
854 854
 				'order' => 'DESC',
@@ -873,19 +873,19 @@  discard block
 block discarded – undo
873 873
  * @param int $menu_id Optional. The ID of the menu to format. Default 0.
874 874
  * @return string|WP_Error $output The menu formatted to edit or error object on failure.
875 875
  */
876
-function wp_get_nav_menu_to_edit( $menu_id = 0 ) {
877
-	$menu = wp_get_nav_menu_object( $menu_id );
876
+function wp_get_nav_menu_to_edit($menu_id = 0) {
877
+	$menu = wp_get_nav_menu_object($menu_id);
878 878
 
879 879
 	// If the menu exists, get its items.
880
-	if ( is_nav_menu( $menu ) ) {
881
-		$menu_items = wp_get_nav_menu_items( $menu->term_id, array('post_status' => 'any') );
880
+	if (is_nav_menu($menu)) {
881
+		$menu_items = wp_get_nav_menu_items($menu->term_id, array('post_status' => 'any'));
882 882
 		$result = '<div id="menu-instructions" class="post-body-plain';
883
-		$result .= ( ! empty($menu_items) ) ? ' menu-instructions-inactive">' : '">';
884
-		$result .= '<p>' . __( 'Add menu items from the column on the left.' ) . '</p>';
883
+		$result .= ( ! empty($menu_items)) ? ' menu-instructions-inactive">' : '">';
884
+		$result .= '<p>'.__('Add menu items from the column on the left.').'</p>';
885 885
 		$result .= '</div>';
886 886
 
887
-		if ( empty($menu_items) )
888
-			return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
887
+		if (empty($menu_items))
888
+			return $result.' <ul class="menu" id="menu-to-edit"> </ul>';
889 889
 
890 890
 		/**
891 891
 		 * Filter the Walker class used when adding nav menu items.
@@ -895,38 +895,38 @@  discard block
 block discarded – undo
895 895
 		 * @param string $class   The walker class to use. Default 'Walker_Nav_Menu_Edit'.
896 896
 		 * @param int    $menu_id ID of the menu being rendered.
897 897
 		 */
898
-		$walker_class_name = apply_filters( 'wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id );
898
+		$walker_class_name = apply_filters('wp_edit_nav_menu_walker', 'Walker_Nav_Menu_Edit', $menu_id);
899 899
 
900
-		if ( class_exists( $walker_class_name ) ) {
900
+		if (class_exists($walker_class_name)) {
901 901
 			$walker = new $walker_class_name;
902 902
 		} else {
903
-			return new WP_Error( 'menu_walker_not_exist',
903
+			return new WP_Error('menu_walker_not_exist',
904 904
 				/* translators: %s: walker class name */
905
-				sprintf( __( 'The Walker class named %s does not exist.' ),
906
-					'<strong>' . $walker_class_name . '</strong>'
905
+				sprintf(__('The Walker class named %s does not exist.'),
906
+					'<strong>'.$walker_class_name.'</strong>'
907 907
 				)
908 908
 			);
909 909
 		}
910 910
 
911 911
 		$some_pending_menu_items = $some_invalid_menu_items = false;
912
-		foreach ( (array) $menu_items as $menu_item ) {
913
-			if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
912
+		foreach ((array) $menu_items as $menu_item) {
913
+			if (isset($menu_item->post_status) && 'draft' == $menu_item->post_status)
914 914
 				$some_pending_menu_items = true;
915
-			if ( ! empty( $menu_item->_invalid ) )
915
+			if ( ! empty($menu_item->_invalid))
916 916
 				$some_invalid_menu_items = true;
917 917
 		}
918 918
 
919
-		if ( $some_pending_menu_items )
920
-			$result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
919
+		if ($some_pending_menu_items)
920
+			$result .= '<div class="updated inline"><p>'.__('Click Save Menu to make pending menu items public.').'</p></div>';
921 921
 
922
-		if ( $some_invalid_menu_items )
923
-			$result .= '<div class="error inline"><p>' . __('There are some invalid menu items. Please check or delete them.') . '</p></div>';
922
+		if ($some_invalid_menu_items)
923
+			$result .= '<div class="error inline"><p>'.__('There are some invalid menu items. Please check or delete them.').'</p></div>';
924 924
 
925 925
 		$result .= '<ul class="menu" id="menu-to-edit"> ';
926
-		$result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
926
+		$result .= walk_nav_menu_tree(array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker));
927 927
 		$result .= ' </ul> ';
928 928
 		return $result;
929
-	} elseif ( is_wp_error( $menu ) ) {
929
+	} elseif (is_wp_error($menu)) {
930 930
 		return $menu;
931 931
 	}
932 932
 
@@ -941,13 +941,13 @@  discard block
 block discarded – undo
941 941
  */
942 942
 function wp_nav_menu_manage_columns() {
943 943
 	return array(
944
-		'_title'      => __( 'Show advanced menu properties' ),
944
+		'_title'      => __('Show advanced menu properties'),
945 945
 		'cb'          => '<input type="checkbox" />',
946
-		'link-target' => __( 'Link Target' ),
947
-		'attr-title'  => __( 'Title Attribute' ),
948
-		'css-classes' => __( 'CSS Classes' ),
949
-		'xfn'         => __( 'Link Relationship (XFN)' ),
950
-		'description' => __( 'Description' ),
946
+		'link-target' => __('Link Target'),
947
+		'attr-title'  => __('Title Attribute'),
948
+		'css-classes' => __('CSS Classes'),
949
+		'xfn'         => __('Link Relationship (XFN)'),
950
+		'description' => __('Description'),
951 951
 	);
952 952
 }
953 953
 
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
  */
962 962
 function _wp_delete_orphaned_draft_menu_items() {
963 963
 	global $wpdb;
964
-	$delete_timestamp = time() - ( DAY_IN_SECONDS * EMPTY_TRASH_DAYS );
964
+	$delete_timestamp = time() - (DAY_IN_SECONDS * EMPTY_TRASH_DAYS);
965 965
 
966 966
 	// Delete orphaned draft menu items.
967
-	$menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
967
+	$menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp));
968 968
 
969
-	foreach ( (array) $menu_items_to_delete as $menu_item_id )
970
-		wp_delete_post( $menu_item_id, true );
969
+	foreach ((array) $menu_items_to_delete as $menu_item_id)
970
+		wp_delete_post($menu_item_id, true);
971 971
 }
972 972
 
973 973
 /**
@@ -979,12 +979,12 @@  discard block
 block discarded – undo
979 979
  * @param string $nav_menu_selected_title Title of the currently-selected menu
980 980
  * @return array $messages The menu updated message
981 981
  */
982
-function wp_nav_menu_update_menu_items ( $nav_menu_selected_id, $nav_menu_selected_title ) {
983
-	$unsorted_menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish' ) );
982
+function wp_nav_menu_update_menu_items($nav_menu_selected_id, $nav_menu_selected_title) {
983
+	$unsorted_menu_items = wp_get_nav_menu_items($nav_menu_selected_id, array('orderby' => 'ID', 'output' => ARRAY_A, 'output_key' => 'ID', 'post_status' => 'draft,publish'));
984 984
 	$messages = array();
985 985
 	$menu_items = array();
986 986
 	// Index menu items by db ID
987
-	foreach ( $unsorted_menu_items as $_item )
987
+	foreach ($unsorted_menu_items as $_item)
988 988
 		$menu_items[$_item->db_id] = $_item;
989 989
 
990 990
 	$post_fields = array(
@@ -994,66 +994,66 @@  discard block
 block discarded – undo
994 994
 		'menu-item-attr-title', 'menu-item-target', 'menu-item-classes', 'menu-item-xfn'
995 995
 	);
996 996
 
997
-	wp_defer_term_counting( true );
997
+	wp_defer_term_counting(true);
998 998
 	// Loop through all the menu items' POST variables
999
-	if ( ! empty( $_POST['menu-item-db-id'] ) ) {
1000
-		foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
999
+	if ( ! empty($_POST['menu-item-db-id'])) {
1000
+		foreach ((array) $_POST['menu-item-db-id'] as $_key => $k) {
1001 1001
 
1002 1002
 			// Menu item title can't be blank
1003
-			if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] )
1003
+			if ( ! isset($_POST['menu-item-title'][$_key]) || '' == $_POST['menu-item-title'][$_key])
1004 1004
 				continue;
1005 1005
 
1006 1006
 			$args = array();
1007
-			foreach ( $post_fields as $field )
1008
-				$args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
1007
+			foreach ($post_fields as $field)
1008
+				$args[$field] = isset($_POST[$field][$_key]) ? $_POST[$field][$_key] : '';
1009 1009
 
1010
-			$menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
1010
+			$menu_item_db_id = wp_update_nav_menu_item($nav_menu_selected_id, ($_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key), $args);
1011 1011
 
1012
-			if ( is_wp_error( $menu_item_db_id ) ) {
1013
-				$messages[] = '<div id="message" class="error"><p>' . $menu_item_db_id->get_error_message() . '</p></div>';
1012
+			if (is_wp_error($menu_item_db_id)) {
1013
+				$messages[] = '<div id="message" class="error"><p>'.$menu_item_db_id->get_error_message().'</p></div>';
1014 1014
 			} else {
1015
-				unset( $menu_items[ $menu_item_db_id ] );
1015
+				unset($menu_items[$menu_item_db_id]);
1016 1016
 			}
1017 1017
 		}
1018 1018
 	}
1019 1019
 
1020 1020
 	// Remove menu items from the menu that weren't in $_POST
1021
-	if ( ! empty( $menu_items ) ) {
1022
-		foreach ( array_keys( $menu_items ) as $menu_item_id ) {
1023
-			if ( is_nav_menu_item( $menu_item_id ) ) {
1024
-				wp_delete_post( $menu_item_id );
1021
+	if ( ! empty($menu_items)) {
1022
+		foreach (array_keys($menu_items) as $menu_item_id) {
1023
+			if (is_nav_menu_item($menu_item_id)) {
1024
+				wp_delete_post($menu_item_id);
1025 1025
 			}
1026 1026
 		}
1027 1027
 	}
1028 1028
 
1029 1029
 	// Store 'auto-add' pages.
1030
-	$auto_add = ! empty( $_POST['auto-add-pages'] );
1031
-	$nav_menu_option = (array) get_option( 'nav_menu_options' );
1032
-	if ( ! isset( $nav_menu_option['auto_add'] ) )
1030
+	$auto_add = ! empty($_POST['auto-add-pages']);
1031
+	$nav_menu_option = (array) get_option('nav_menu_options');
1032
+	if ( ! isset($nav_menu_option['auto_add']))
1033 1033
 		$nav_menu_option['auto_add'] = array();
1034
-	if ( $auto_add ) {
1035
-		if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
1034
+	if ($auto_add) {
1035
+		if ( ! in_array($nav_menu_selected_id, $nav_menu_option['auto_add']))
1036 1036
 			$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
1037 1037
 	} else {
1038
-		if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
1039
-			unset( $nav_menu_option['auto_add'][$key] );
1038
+		if (false !== ($key = array_search($nav_menu_selected_id, $nav_menu_option['auto_add'])))
1039
+			unset($nav_menu_option['auto_add'][$key]);
1040 1040
 	}
1041 1041
 	// Remove nonexistent/deleted menus
1042
-	$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
1043
-	update_option( 'nav_menu_options', $nav_menu_option );
1042
+	$nav_menu_option['auto_add'] = array_intersect($nav_menu_option['auto_add'], wp_get_nav_menus(array('fields' => 'ids')));
1043
+	update_option('nav_menu_options', $nav_menu_option);
1044 1044
 
1045
-	wp_defer_term_counting( false );
1045
+	wp_defer_term_counting(false);
1046 1046
 
1047 1047
 	/** This action is documented in wp-includes/nav-menu.php */
1048
-	do_action( 'wp_update_nav_menu', $nav_menu_selected_id );
1048
+	do_action('wp_update_nav_menu', $nav_menu_selected_id);
1049 1049
 
1050
-	$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' .
1050
+	$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.
1051 1051
 		/* translators: %s: nav menu title */
1052
-		sprintf( __( '%s has been updated.' ),
1053
-			'<strong>' . $nav_menu_selected_title . '</strong>'
1054
-		) . '</p></div>';
1052
+		sprintf(__('%s has been updated.'),
1053
+			'<strong>'.$nav_menu_selected_title.'</strong>'
1054
+		).'</p></div>';
1055 1055
 
1056
-	unset( $menu_items, $unsorted_menu_items );
1056
+	unset($menu_items, $unsorted_menu_items);
1057 1057
 
1058 1058
 	return $messages;
1059 1059
 }
Please login to merge, or discard this patch.
Braces   +82 added lines, -45 removed lines patch added patch discarded remove patch
@@ -75,8 +75,9 @@  discard block
 block discarded – undo
75 75
 				'post_type' => $matches[2],
76 76
 				's' => $query,
77 77
 			));
78
-			if ( ! have_posts() )
79
-				return;
78
+			if ( ! have_posts() ) {
79
+							return;
80
+			}
80 81
 			while ( have_posts() ) {
81 82
 				the_post();
82 83
 				if ( 'markup' == $response_format ) {
@@ -98,8 +99,9 @@  discard block
 block discarded – undo
98 99
 				'name__like' => $query,
99 100
 				'number' => 10,
100 101
 			));
101
-			if ( empty( $terms ) || is_wp_error( $terms ) )
102
-				return;
102
+			if ( empty( $terms ) || is_wp_error( $terms ) ) {
103
+							return;
104
+			}
103 105
 			foreach ( (array) $terms as $term ) {
104 106
 				if ( 'markup' == $response_format ) {
105 107
 					echo walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', array( $term ) ), 0, (object) $args );
@@ -151,8 +153,9 @@  discard block
 block discarded – undo
151 153
 function wp_initial_nav_menu_meta_boxes() {
152 154
 	global $wp_meta_boxes;
153 155
 
154
-	if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) )
155
-		return;
156
+	if ( get_user_option( 'metaboxhidden_nav-menus' ) !== false || ! is_array($wp_meta_boxes) ) {
157
+			return;
158
+	}
156 159
 
157 160
 	$initial_meta_boxes = array( 'add-post-type-page', 'add-post-type-post', 'add-custom-links', 'add-category' );
158 161
 	$hidden_meta_boxes = array();
@@ -181,8 +184,9 @@  discard block
 block discarded – undo
181 184
 function wp_nav_menu_post_type_meta_boxes() {
182 185
 	$post_types = get_post_types( array( 'show_in_nav_menus' => true ), 'object' );
183 186
 
184
-	if ( ! $post_types )
185
-		return;
187
+	if ( ! $post_types ) {
188
+			return;
189
+	}
186 190
 
187 191
 	foreach ( $post_types as $post_type ) {
188 192
 		/**
@@ -215,8 +219,9 @@  discard block
 block discarded – undo
215 219
 function wp_nav_menu_taxonomy_meta_boxes() {
216 220
 	$taxonomies = get_taxonomies( array( 'show_in_nav_menus' => true ), 'object' );
217 221
 
218
-	if ( !$taxonomies )
219
-		return;
222
+	if ( !$taxonomies ) {
223
+			return;
224
+	}
220 225
 
221 226
 	foreach ( $taxonomies as $tax ) {
222 227
 		/** This filter is documented in wp-admin/includes/nav-menu.php */
@@ -241,8 +246,9 @@  discard block
 block discarded – undo
241 246
 function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
242 247
 	global $one_theme_location_no_menus;
243 248
 
244
-	if ( $one_theme_location_no_menus )
245
-		return false;
249
+	if ( $one_theme_location_no_menus ) {
250
+			return false;
251
+	}
246 252
 
247 253
 	return disabled( $nav_menu_selected_id, 0 );
248 254
 }
@@ -316,8 +322,9 @@  discard block
 block discarded – undo
316 322
 		'update_post_meta_cache' => false
317 323
 	);
318 324
 
319
-	if ( isset( $post_type['args']->_default_query ) )
320
-		$args = array_merge($args, (array) $post_type['args']->_default_query );
325
+	if ( isset( $post_type['args']->_default_query ) ) {
326
+			$args = array_merge($args, (array) $post_type['args']->_default_query );
327
+	}
321 328
 
322 329
 	// @todo transient caching of these results with proper invalidation on updating of a post of this type
323 330
 	$get_posts = new WP_Query;
@@ -374,17 +381,26 @@  discard block
 block discarded – undo
374 381
 	<div id="posttype-<?php echo $post_type_name; ?>" class="posttypediv">
375 382
 		<ul id="posttype-<?php echo $post_type_name; ?>-tabs" class="posttype-tabs add-menu-item-tabs">
376 383
 			<li <?php echo ( 'most-recent' == $current_tab ? ' class="tabs"' : '' ); ?>>
377
-				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
384
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-most-recent" href="<?php if ( $nav_menu_selected_id ) {
385
+	echo esc_url(add_query_arg($post_type_name . '-tab', 'most-recent', remove_query_arg($removed_args)));
386
+}
387
+?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-most-recent">
378 388
 					<?php _e( 'Most Recent' ); ?>
379 389
 				</a>
380 390
 			</li>
381 391
 			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
382
-				<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#<?php echo $post_type_name; ?>-all">
392
+				<a class="nav-tab-link" data-type="<?php echo esc_attr( $post_type_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) {
393
+	echo esc_url(add_query_arg($post_type_name . '-tab', 'all', remove_query_arg($removed_args)));
394
+}
395
+?>#<?php echo $post_type_name; ?>-all">
383 396
 					<?php _e( 'View All' ); ?>
384 397
 				</a>
385 398
 			</li>
386 399
 			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
387
-				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
400
+				<a class="nav-tab-link" data-type="tabs-panel-posttype-<?php echo esc_attr( $post_type_name ); ?>-search" href="<?php if ( $nav_menu_selected_id ) {
401
+	echo esc_url(add_query_arg($post_type_name . '-tab', 'search', remove_query_arg($removed_args)));
402
+}
403
+?>#tabs-panel-posttype-<?php echo $post_type_name; ?>-search">
388 404
 					<?php _e( 'Search'); ?>
389 405
 				</a>
390 406
 			</li>
@@ -649,17 +665,26 @@  discard block
 block discarded – undo
649 665
 	<div id="taxonomy-<?php echo $taxonomy_name; ?>" class="taxonomydiv">
650 666
 		<ul id="taxonomy-<?php echo $taxonomy_name; ?>-tabs" class="taxonomy-tabs add-menu-item-tabs">
651 667
 			<li <?php echo ( 'most-used' == $current_tab ? ' class="tabs"' : '' ); ?>>
652
-				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
668
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-pop" href="<?php if ( $nav_menu_selected_id ) {
669
+	echo esc_url(add_query_arg($taxonomy_name . '-tab', 'most-used', remove_query_arg($removed_args)));
670
+}
671
+?>#tabs-panel-<?php echo $taxonomy_name; ?>-pop">
653 672
 					<?php _e( 'Most Used' ); ?>
654 673
 				</a>
655 674
 			</li>
656 675
 			<li <?php echo ( 'all' == $current_tab ? ' class="tabs"' : '' ); ?>>
657
-				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args))); ?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
676
+				<a class="nav-tab-link" data-type="tabs-panel-<?php echo esc_attr( $taxonomy_name ); ?>-all" href="<?php if ( $nav_menu_selected_id ) {
677
+	echo esc_url(add_query_arg($taxonomy_name . '-tab', 'all', remove_query_arg($removed_args)));
678
+}
679
+?>#tabs-panel-<?php echo $taxonomy_name; ?>-all">
658 680
 					<?php _e( 'View All' ); ?>
659 681
 				</a>
660 682
 			</li>
661 683
 			<li <?php echo ( 'search' == $current_tab ? ' class="tabs"' : '' ); ?>>
662
-				<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args))); ?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
684
+				<a class="nav-tab-link" data-type="tabs-panel-search-taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>" href="<?php if ( $nav_menu_selected_id ) {
685
+	echo esc_url(add_query_arg($taxonomy_name . '-tab', 'search', remove_query_arg($removed_args)));
686
+}
687
+?>#tabs-panel-search-taxonomy-<?php echo $taxonomy_name; ?>">
663 688
 					<?php _e( 'Search' ); ?>
664 689
 				</a>
665 690
 			</li>
@@ -884,8 +909,9 @@  discard block
 block discarded – undo
884 909
 		$result .= '<p>' . __( 'Add menu items from the column on the left.' ) . '</p>';
885 910
 		$result .= '</div>';
886 911
 
887
-		if ( empty($menu_items) )
888
-			return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
912
+		if ( empty($menu_items) ) {
913
+					return $result . ' <ul class="menu" id="menu-to-edit"> </ul>';
914
+		}
889 915
 
890 916
 		/**
891 917
 		 * Filter the Walker class used when adding nav menu items.
@@ -910,17 +936,21 @@  discard block
 block discarded – undo
910 936
 
911 937
 		$some_pending_menu_items = $some_invalid_menu_items = false;
912 938
 		foreach ( (array) $menu_items as $menu_item ) {
913
-			if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status )
914
-				$some_pending_menu_items = true;
915
-			if ( ! empty( $menu_item->_invalid ) )
916
-				$some_invalid_menu_items = true;
939
+			if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) {
940
+							$some_pending_menu_items = true;
941
+			}
942
+			if ( ! empty( $menu_item->_invalid ) ) {
943
+							$some_invalid_menu_items = true;
944
+			}
917 945
 		}
918 946
 
919
-		if ( $some_pending_menu_items )
920
-			$result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
947
+		if ( $some_pending_menu_items ) {
948
+					$result .= '<div class="updated inline"><p>' . __('Click Save Menu to make pending menu items public.') . '</p></div>';
949
+		}
921 950
 
922
-		if ( $some_invalid_menu_items )
923
-			$result .= '<div class="error inline"><p>' . __('There are some invalid menu items. Please check or delete them.') . '</p></div>';
951
+		if ( $some_invalid_menu_items ) {
952
+					$result .= '<div class="error inline"><p>' . __('There are some invalid menu items. Please check or delete them.') . '</p></div>';
953
+		}
924 954
 
925 955
 		$result .= '<ul class="menu" id="menu-to-edit"> ';
926 956
 		$result .= walk_nav_menu_tree( array_map('wp_setup_nav_menu_item', $menu_items), 0, (object) array('walker' => $walker ) );
@@ -966,9 +996,10 @@  discard block
 block discarded – undo
966 996
 	// Delete orphaned draft menu items.
967 997
 	$menu_items_to_delete = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts AS p LEFT JOIN $wpdb->postmeta AS m ON p.ID = m.post_id WHERE post_type = 'nav_menu_item' AND post_status = 'draft' AND meta_key = '_menu_item_orphaned' AND meta_value < '%d'", $delete_timestamp ) );
968 998
 
969
-	foreach ( (array) $menu_items_to_delete as $menu_item_id )
970
-		wp_delete_post( $menu_item_id, true );
971
-}
999
+	foreach ( (array) $menu_items_to_delete as $menu_item_id ) {
1000
+			wp_delete_post( $menu_item_id, true );
1001
+	}
1002
+	}
972 1003
 
973 1004
 /**
974 1005
  * Saves nav menu items
@@ -984,8 +1015,9 @@  discard block
 block discarded – undo
984 1015
 	$messages = array();
985 1016
 	$menu_items = array();
986 1017
 	// Index menu items by db ID
987
-	foreach ( $unsorted_menu_items as $_item )
988
-		$menu_items[$_item->db_id] = $_item;
1018
+	foreach ( $unsorted_menu_items as $_item ) {
1019
+			$menu_items[$_item->db_id] = $_item;
1020
+	}
989 1021
 
990 1022
 	$post_fields = array(
991 1023
 		'menu-item-db-id', 'menu-item-object-id', 'menu-item-object',
@@ -1000,12 +1032,14 @@  discard block
 block discarded – undo
1000 1032
 		foreach ( (array) $_POST['menu-item-db-id'] as $_key => $k ) {
1001 1033
 
1002 1034
 			// Menu item title can't be blank
1003
-			if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] )
1004
-				continue;
1035
+			if ( ! isset( $_POST['menu-item-title'][ $_key ] ) || '' == $_POST['menu-item-title'][ $_key ] ) {
1036
+							continue;
1037
+			}
1005 1038
 
1006 1039
 			$args = array();
1007
-			foreach ( $post_fields as $field )
1008
-				$args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
1040
+			foreach ( $post_fields as $field ) {
1041
+							$args[$field] = isset( $_POST[$field][$_key] ) ? $_POST[$field][$_key] : '';
1042
+			}
1009 1043
 
1010 1044
 			$menu_item_db_id = wp_update_nav_menu_item( $nav_menu_selected_id, ( $_POST['menu-item-db-id'][$_key] != $_key ? 0 : $_key ), $args );
1011 1045
 
@@ -1029,14 +1063,17 @@  discard block
 block discarded – undo
1029 1063
 	// Store 'auto-add' pages.
1030 1064
 	$auto_add = ! empty( $_POST['auto-add-pages'] );
1031 1065
 	$nav_menu_option = (array) get_option( 'nav_menu_options' );
1032
-	if ( ! isset( $nav_menu_option['auto_add'] ) )
1033
-		$nav_menu_option['auto_add'] = array();
1066
+	if ( ! isset( $nav_menu_option['auto_add'] ) ) {
1067
+			$nav_menu_option['auto_add'] = array();
1068
+	}
1034 1069
 	if ( $auto_add ) {
1035
-		if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) )
1036
-			$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
1070
+		if ( ! in_array( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) {
1071
+					$nav_menu_option['auto_add'][] = $nav_menu_selected_id;
1072
+		}
1037 1073
 	} else {
1038
-		if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) )
1039
-			unset( $nav_menu_option['auto_add'][$key] );
1074
+		if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) ) {
1075
+					unset( $nav_menu_option['auto_add'][$key] );
1076
+		}
1040 1077
 	}
1041 1078
 	// Remove nonexistent/deleted menus
1042 1079
 	$nav_menu_option['auto_add'] = array_intersect( $nav_menu_option['auto_add'], wp_get_nav_menus( array( 'fields' => 'ids' ) ) );
Please login to merge, or discard this patch.
src/wp-admin/includes/template.php 4 patches
Doc Comments   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -746,10 +746,10 @@  discard block
 block discarded – undo
746 746
  * @global WP_Locale $wp_locale
747 747
  * @global object    $comment
748 748
  *
749
- * @param int|bool $edit      Accepts 1|true for editing the date, 0|false for adding the date.
750
- * @param int|bool $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
749
+ * @param integer $edit      Accepts 1|true for editing the date, 0|false for adding the date.
750
+ * @param integer $for_post  Accepts 1|true for applying the date to a post, 0|false for a comment.
751 751
  * @param int      $tab_index The tabindex attribute to add. Default 0.
752
- * @param int|bool $multi     Optional. Whether the additional fields and buttons should be added.
752
+ * @param integer $multi     Optional. Whether the additional fields and buttons should be added.
753 753
  *                            Default 0|false.
754 754
  */
755 755
 function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
@@ -1039,9 +1039,9 @@  discard block
 block discarded – undo
1039 1039
  * @global array $wp_meta_boxes
1040 1040
  *
1041 1041
  * @staticvar bool $already_sorted
1042
- * @param string|WP_Screen $screen  Screen identifier
1042
+ * @param string $screen  Screen identifier
1043 1043
  * @param string           $context box context
1044
- * @param mixed            $object  gets passed to the box callback function as first parameter
1044
+ * @param string            $object  gets passed to the box callback function as first parameter
1045 1045
  * @return int number of meta_boxes
1046 1046
  */
1047 1047
 function do_meta_boxes( $screen, $context, $object ) {
@@ -1567,7 +1567,7 @@  discard block
 block discarded – undo
1567 1567
  *
1568 1568
  * @since 2.7.0
1569 1569
  *
1570
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1570
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
1571 1571
  * @return string The post title if set.
1572 1572
  */
1573 1573
 function _draft_or_post_title( $post = 0 ) {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Template WordPress Administration API.
4
- *
5
- * A Big Mess. Also some neat functions that are nicely written.
6
- *
7
- * @package WordPress
8
- * @subpackage Administration
9
- */
3
+	 * Template WordPress Administration API.
4
+	 *
5
+	 * A Big Mess. Also some neat functions that are nicely written.
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Administration
9
+	 */
10 10
 
11 11
 /** Walker_Category_Checklist class */
12 12
 require_once( ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php' );
Please login to merge, or discard this patch.
Spacing   +457 added lines, -457 removed lines patch added patch discarded remove patch
@@ -9,10 +9,10 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 /** Walker_Category_Checklist class */
12
-require_once( ABSPATH . 'wp-admin/includes/class-walker-category-checklist.php' );
12
+require_once(ABSPATH.'wp-admin/includes/class-walker-category-checklist.php');
13 13
 
14 14
 /** WP_Internal_Pointers class */
15
-require_once( ABSPATH . 'wp-admin/includes/class-wp-internal-pointers.php' );
15
+require_once(ABSPATH.'wp-admin/includes/class-wp-internal-pointers.php');
16 16
 
17 17
 //
18 18
 // Category Checklists
@@ -37,15 +37,15 @@  discard block
 block discarded – undo
37 37
  * @param bool   $checked_ontop        Optional. Whether to move checked items out of the hierarchy and to
38 38
  *                                     the top of the list. Default true.
39 39
  */
40
-function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true ) {
41
-	wp_terms_checklist( $post_id, array(
40
+function wp_category_checklist($post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false, $walker = null, $checked_ontop = true) {
41
+	wp_terms_checklist($post_id, array(
42 42
 		'taxonomy' => 'category',
43 43
 		'descendants_and_self' => $descendants_and_self,
44 44
 		'selected_cats' => $selected_cats,
45 45
 		'popular_cats' => $popular_cats,
46 46
 		'walker' => $walker,
47 47
 		'checked_ontop' => $checked_ontop
48
-	) );
48
+	));
49 49
 }
50 50
 
51 51
 /**
@@ -74,7 +74,7 @@  discard block
 block discarded – undo
74 74
  *                                        of echoing it. Default true.
75 75
  * }
76 76
  */
77
-function wp_terms_checklist( $post_id = 0, $args = array() ) {
77
+function wp_terms_checklist($post_id = 0, $args = array()) {
78 78
  	$defaults = array(
79 79
 		'descendants_and_self' => 0,
80 80
 		'selected_cats' => false,
@@ -95,11 +95,11 @@  discard block
 block discarded – undo
95 95
 	 * @param array $args    An array of arguments.
96 96
 	 * @param int   $post_id The post ID.
97 97
 	 */
98
-	$params = apply_filters( 'wp_terms_checklist_args', $args, $post_id );
98
+	$params = apply_filters('wp_terms_checklist_args', $args, $post_id);
99 99
 
100
-	$r = wp_parse_args( $params, $defaults );
100
+	$r = wp_parse_args($params, $defaults);
101 101
 
102
-	if ( empty( $r['walker'] ) || ! ( $r['walker'] instanceof Walker ) ) {
102
+	if (empty($r['walker']) || ! ($r['walker'] instanceof Walker)) {
103 103
 		$walker = new Walker_Category_Checklist;
104 104
 	} else {
105 105
 		$walker = $r['walker'];
@@ -108,64 +108,64 @@  discard block
 block discarded – undo
108 108
 	$taxonomy = $r['taxonomy'];
109 109
 	$descendants_and_self = (int) $r['descendants_and_self'];
110 110
 
111
-	$args = array( 'taxonomy' => $taxonomy );
111
+	$args = array('taxonomy' => $taxonomy);
112 112
 
113
-	$tax = get_taxonomy( $taxonomy );
114
-	$args['disabled'] = ! current_user_can( $tax->cap->assign_terms );
113
+	$tax = get_taxonomy($taxonomy);
114
+	$args['disabled'] = ! current_user_can($tax->cap->assign_terms);
115 115
 
116
-	$args['list_only'] = ! empty( $r['list_only'] );
116
+	$args['list_only'] = ! empty($r['list_only']);
117 117
 
118
-	if ( is_array( $r['selected_cats'] ) ) {
118
+	if (is_array($r['selected_cats'])) {
119 119
 		$args['selected_cats'] = $r['selected_cats'];
120
-	} elseif ( $post_id ) {
121
-		$args['selected_cats'] = wp_get_object_terms( $post_id, $taxonomy, array_merge( $args, array( 'fields' => 'ids' ) ) );
120
+	} elseif ($post_id) {
121
+		$args['selected_cats'] = wp_get_object_terms($post_id, $taxonomy, array_merge($args, array('fields' => 'ids')));
122 122
 	} else {
123 123
 		$args['selected_cats'] = array();
124 124
 	}
125
-	if ( is_array( $r['popular_cats'] ) ) {
125
+	if (is_array($r['popular_cats'])) {
126 126
 		$args['popular_cats'] = $r['popular_cats'];
127 127
 	} else {
128
-		$args['popular_cats'] = get_terms( $taxonomy, array(
128
+		$args['popular_cats'] = get_terms($taxonomy, array(
129 129
 			'fields' => 'ids',
130 130
 			'orderby' => 'count',
131 131
 			'order' => 'DESC',
132 132
 			'number' => 10,
133 133
 			'hierarchical' => false
134
-		) );
134
+		));
135 135
 	}
136
-	if ( $descendants_and_self ) {
137
-		$categories = (array) get_terms( $taxonomy, array(
136
+	if ($descendants_and_self) {
137
+		$categories = (array) get_terms($taxonomy, array(
138 138
 			'child_of' => $descendants_and_self,
139 139
 			'hierarchical' => 0,
140 140
 			'hide_empty' => 0
141
-		) );
142
-		$self = get_term( $descendants_and_self, $taxonomy );
143
-		array_unshift( $categories, $self );
141
+		));
142
+		$self = get_term($descendants_and_self, $taxonomy);
143
+		array_unshift($categories, $self);
144 144
 	} else {
145
-		$categories = (array) get_terms( $taxonomy, array( 'get' => 'all' ) );
145
+		$categories = (array) get_terms($taxonomy, array('get' => 'all'));
146 146
 	}
147 147
 
148 148
 	$output = '';
149 149
 
150
-	if ( $r['checked_ontop'] ) {
150
+	if ($r['checked_ontop']) {
151 151
 		// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
152 152
 		$checked_categories = array();
153
-		$keys = array_keys( $categories );
153
+		$keys = array_keys($categories);
154 154
 
155
-		foreach ( $keys as $k ) {
156
-			if ( in_array( $categories[$k]->term_id, $args['selected_cats'] ) ) {
155
+		foreach ($keys as $k) {
156
+			if (in_array($categories[$k]->term_id, $args['selected_cats'])) {
157 157
 				$checked_categories[] = $categories[$k];
158
-				unset( $categories[$k] );
158
+				unset($categories[$k]);
159 159
 			}
160 160
 		}
161 161
 
162 162
 		// Put checked cats on top
163
-		$output .= call_user_func_array( array( $walker, 'walk' ), array( $checked_categories, 0, $args ) );
163
+		$output .= call_user_func_array(array($walker, 'walk'), array($checked_categories, 0, $args));
164 164
 	}
165 165
 	// Then the rest of them
166
-	$output .= call_user_func_array( array( $walker, 'walk' ), array( $categories, 0, $args ) );
166
+	$output .= call_user_func_array(array($walker, 'walk'), array($categories, 0, $args));
167 167
 
168
-	if ( $r['echo'] ) {
168
+	if ($r['echo']) {
169 169
 		echo $output;
170 170
 	}
171 171
 
@@ -188,33 +188,33 @@  discard block
 block discarded – undo
188 188
  * @param bool $echo Optionally output the list as well. Defaults to true.
189 189
  * @return array List of popular term IDs.
190 190
  */
191
-function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
191
+function wp_popular_terms_checklist($taxonomy, $default = 0, $number = 10, $echo = true) {
192 192
 	$post = get_post();
193 193
 
194
-	if ( $post && $post->ID )
194
+	if ($post && $post->ID)
195 195
 		$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196 196
 	else
197 197
 		$checked_terms = array();
198 198
 
199
-	$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
199
+	$terms = get_terms($taxonomy, array('orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false));
200 200
 
201 201
 	$tax = get_taxonomy($taxonomy);
202 202
 
203 203
 	$popular_ids = array();
204
-	foreach ( (array) $terms as $term ) {
204
+	foreach ((array) $terms as $term) {
205 205
 		$popular_ids[] = $term->term_id;
206
-		if ( !$echo ) // hack for AJAX use
206
+		if ( ! $echo) // hack for AJAX use
207 207
 			continue;
208 208
 		$id = "popular-$taxonomy-$term->term_id";
209
-		$checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
209
+		$checked = in_array($term->term_id, $checked_terms) ? 'checked="checked"' : '';
210 210
 		?>
211 211
 
212 212
 		<li id="<?php echo $id; ?>" class="popular-category">
213 213
 			<label class="selectit">
214
-				<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can( $tax->cap->assign_terms ) ); ?> />
214
+				<input id="in-<?php echo $id; ?>" type="checkbox" <?php echo $checked; ?> value="<?php echo (int) $term->term_id; ?>" <?php disabled( ! current_user_can($tax->cap->assign_terms)); ?> />
215 215
 				<?php
216 216
 				/** This filter is documented in wp-includes/category-template.php */
217
-				echo esc_html( apply_filters( 'the_category', $term->name ) );
217
+				echo esc_html(apply_filters('the_category', $term->name));
218 218
 				?>
219 219
 			</label>
220 220
 		</li>
@@ -231,32 +231,32 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @param int $link_id
233 233
  */
234
-function wp_link_category_checklist( $link_id = 0 ) {
234
+function wp_link_category_checklist($link_id = 0) {
235 235
 	$default = 1;
236 236
 
237 237
 	$checked_categories = array();
238 238
 
239
-	if ( $link_id ) {
240
-		$checked_categories = wp_get_link_cats( $link_id );
239
+	if ($link_id) {
240
+		$checked_categories = wp_get_link_cats($link_id);
241 241
 		// No selected categories, strange
242
-		if ( ! count( $checked_categories ) ) {
242
+		if ( ! count($checked_categories)) {
243 243
 			$checked_categories[] = $default;
244 244
 		}
245 245
 	} else {
246 246
 		$checked_categories[] = $default;
247 247
 	}
248 248
 
249
-	$categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
249
+	$categories = get_terms('link_category', array('orderby' => 'name', 'hide_empty' => 0));
250 250
 
251
-	if ( empty( $categories ) )
251
+	if (empty($categories))
252 252
 		return;
253 253
 
254
-	foreach ( $categories as $category ) {
254
+	foreach ($categories as $category) {
255 255
 		$cat_id = $category->term_id;
256 256
 
257 257
 		/** This filter is documented in wp-includes/category-template.php */
258
-		$name = esc_html( apply_filters( 'the_category', $category->name ) );
259
-		$checked = in_array( $cat_id, $checked_categories ) ? ' checked="checked"' : '';
258
+		$name = esc_html(apply_filters('the_category', $category->name));
259
+		$checked = in_array($cat_id, $checked_categories) ? ' checked="checked"' : '';
260 260
 		echo '<li id="link-category-', $cat_id, '"><label for="in-link-category-', $cat_id, '" class="selectit"><input value="', $cat_id, '" type="checkbox" name="link_category[]" id="in-link-category-', $cat_id, '"', $checked, '/> ', $name, "</label></li>";
261 261
 	}
262 262
 }
@@ -270,71 +270,71 @@  discard block
 block discarded – undo
270 270
  */
271 271
 function get_inline_data($post) {
272 272
 	$post_type_object = get_post_type_object($post->post_type);
273
-	if ( ! current_user_can( 'edit_post', $post->ID ) )
273
+	if ( ! current_user_can('edit_post', $post->ID))
274 274
 		return;
275 275
 
276
-	$title = esc_textarea( trim( $post->post_title ) );
276
+	$title = esc_textarea(trim($post->post_title));
277 277
 
278 278
 	/** This filter is documented in wp-admin/edit-tag-form.php */
279 279
 	echo '
280
-<div class="hidden" id="inline_' . $post->ID . '">
281
-	<div class="post_title">' . $title . '</div>' .
280
+<div class="hidden" id="inline_' . $post->ID.'">
281
+	<div class="post_title">' . $title.'</div>'.
282 282
 	/** This filter is documented in wp-admin/edit-tag-form.php */
283
-	'<div class="post_name">' . apply_filters( 'editable_slug', $post->post_name, $post ) . '</div>
284
-	<div class="post_author">' . $post->post_author . '</div>
285
-	<div class="comment_status">' . esc_html( $post->comment_status ) . '</div>
286
-	<div class="ping_status">' . esc_html( $post->ping_status ) . '</div>
287
-	<div class="_status">' . esc_html( $post->post_status ) . '</div>
288
-	<div class="jj">' . mysql2date( 'd', $post->post_date, false ) . '</div>
289
-	<div class="mm">' . mysql2date( 'm', $post->post_date, false ) . '</div>
290
-	<div class="aa">' . mysql2date( 'Y', $post->post_date, false ) . '</div>
291
-	<div class="hh">' . mysql2date( 'H', $post->post_date, false ) . '</div>
292
-	<div class="mn">' . mysql2date( 'i', $post->post_date, false ) . '</div>
293
-	<div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
294
-	<div class="post_password">' . esc_html( $post->post_password ) . '</div>';
295
-
296
-	if ( $post_type_object->hierarchical )
297
-		echo '<div class="post_parent">' . $post->post_parent . '</div>';
298
-
299
-	if ( $post->post_type == 'page' )
300
-		echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
301
-
302
-	if ( post_type_supports( $post->post_type, 'page-attributes' ) )
303
-		echo '<div class="menu_order">' . $post->menu_order . '</div>';
304
-
305
-	$taxonomy_names = get_object_taxonomies( $post->post_type );
306
-	foreach ( $taxonomy_names as $taxonomy_name) {
307
-		$taxonomy = get_taxonomy( $taxonomy_name );
308
-
309
-		if ( $taxonomy->hierarchical && $taxonomy->show_ui ) {
310
-
311
-			$terms = get_object_term_cache( $post->ID, $taxonomy_name );
312
-			if ( false === $terms ) {
313
-				$terms = wp_get_object_terms( $post->ID, $taxonomy_name );
314
-				wp_cache_add( $post->ID, $terms, $taxonomy_name . '_relationships' );
283
+	'<div class="post_name">'.apply_filters('editable_slug', $post->post_name, $post).'</div>
284
+	<div class="post_author">' . $post->post_author.'</div>
285
+	<div class="comment_status">' . esc_html($post->comment_status).'</div>
286
+	<div class="ping_status">' . esc_html($post->ping_status).'</div>
287
+	<div class="_status">' . esc_html($post->post_status).'</div>
288
+	<div class="jj">' . mysql2date('d', $post->post_date, false).'</div>
289
+	<div class="mm">' . mysql2date('m', $post->post_date, false).'</div>
290
+	<div class="aa">' . mysql2date('Y', $post->post_date, false).'</div>
291
+	<div class="hh">' . mysql2date('H', $post->post_date, false).'</div>
292
+	<div class="mn">' . mysql2date('i', $post->post_date, false).'</div>
293
+	<div class="ss">' . mysql2date('s', $post->post_date, false).'</div>
294
+	<div class="post_password">' . esc_html($post->post_password).'</div>';
295
+
296
+	if ($post_type_object->hierarchical)
297
+		echo '<div class="post_parent">'.$post->post_parent.'</div>';
298
+
299
+	if ($post->post_type == 'page')
300
+		echo '<div class="page_template">'.esc_html(get_post_meta($post->ID, '_wp_page_template', true)).'</div>';
301
+
302
+	if (post_type_supports($post->post_type, 'page-attributes'))
303
+		echo '<div class="menu_order">'.$post->menu_order.'</div>';
304
+
305
+	$taxonomy_names = get_object_taxonomies($post->post_type);
306
+	foreach ($taxonomy_names as $taxonomy_name) {
307
+		$taxonomy = get_taxonomy($taxonomy_name);
308
+
309
+		if ($taxonomy->hierarchical && $taxonomy->show_ui) {
310
+
311
+			$terms = get_object_term_cache($post->ID, $taxonomy_name);
312
+			if (false === $terms) {
313
+				$terms = wp_get_object_terms($post->ID, $taxonomy_name);
314
+				wp_cache_add($post->ID, $terms, $taxonomy_name.'_relationships');
315 315
 			}
316
-			$term_ids = empty( $terms ) ? array() : wp_list_pluck( $terms, 'term_id' );
316
+			$term_ids = empty($terms) ? array() : wp_list_pluck($terms, 'term_id');
317 317
 
318
-			echo '<div class="post_category" id="' . $taxonomy_name . '_' . $post->ID . '">' . implode( ',', $term_ids ) . '</div>';
318
+			echo '<div class="post_category" id="'.$taxonomy_name.'_'.$post->ID.'">'.implode(',', $term_ids).'</div>';
319 319
 
320
-		} elseif ( $taxonomy->show_ui ) {
320
+		} elseif ($taxonomy->show_ui) {
321 321
 
322
-			$terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name );
323
-			if ( ! is_string( $terms_to_edit ) ) {
322
+			$terms_to_edit = get_terms_to_edit($post->ID, $taxonomy_name);
323
+			if ( ! is_string($terms_to_edit)) {
324 324
 				$terms_to_edit = '';
325 325
 			}
326 326
 
327 327
 			echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
328
-				. esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';
328
+				. esc_html(str_replace(',', ', ', $terms_to_edit)).'</div>';
329 329
 
330 330
 		}
331 331
 	}
332 332
 
333
-	if ( !$post_type_object->hierarchical )
334
-		echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
333
+	if ( ! $post_type_object->hierarchical)
334
+		echo '<div class="sticky">'.(is_sticky($post->ID) ? 'sticky' : '').'</div>';
335 335
 
336
-	if ( post_type_supports( $post->post_type, 'post-formats' ) )
337
-		echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
336
+	if (post_type_supports($post->post_type, 'post-formats'))
337
+		echo '<div class="post_format">'.esc_html(get_post_format($post->ID)).'</div>';
338 338
 
339 339
 	echo '</div>';
340 340
 }
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
  * @param string $mode
352 352
  * @param bool   $table_row
353 353
  */
354
-function wp_comment_reply( $position = 1, $checkbox = false, $mode = 'single', $table_row = true ) {
354
+function wp_comment_reply($position = 1, $checkbox = false, $mode = 'single', $table_row = true) {
355 355
 	global $wp_list_table;
356 356
 	/**
357 357
 	 * Filter the in-line comment reply-to form output in the Comments
@@ -368,15 +368,15 @@  discard block
 block discarded – undo
368 368
 	 * @param string $content The reply-to form content.
369 369
 	 * @param array  $args    An array of default args.
370 370
 	 */
371
-	$content = apply_filters( 'wp_comment_reply', '', array( 'position' => $position, 'checkbox' => $checkbox, 'mode' => $mode ) );
371
+	$content = apply_filters('wp_comment_reply', '', array('position' => $position, 'checkbox' => $checkbox, 'mode' => $mode));
372 372
 
373
-	if ( ! empty($content) ) {
373
+	if ( ! empty($content)) {
374 374
 		echo $content;
375 375
 		return;
376 376
 	}
377 377
 
378
-	if ( ! $wp_list_table ) {
379
-		if ( $mode == 'single' ) {
378
+	if ( ! $wp_list_table) {
379
+		if ($mode == 'single') {
380 380
 			$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
381 381
 		} else {
382 382
 			$wp_list_table = _get_list_table('WP_Comments_List_Table');
@@ -385,29 +385,29 @@  discard block
 block discarded – undo
385 385
 
386 386
 ?>
387 387
 <form method="get">
388
-<?php if ( $table_row ) : ?>
388
+<?php if ($table_row) : ?>
389 389
 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
390 390
 <?php else : ?>
391 391
 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
392 392
 <?php endif; ?>
393 393
 	<fieldset class="comment-reply">
394 394
 	<legend>
395
-		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
396
-		<span class="hidden" id="replyhead"><?php _e( 'Reply to Comment' ); ?></span>
397
-		<span class="hidden" id="addhead"><?php _e( 'Add new Comment' ); ?></span>
395
+		<span class="hidden" id="editlegend"><?php _e('Edit Comment'); ?></span>
396
+		<span class="hidden" id="replyhead"><?php _e('Reply to Comment'); ?></span>
397
+		<span class="hidden" id="addhead"><?php _e('Add new Comment'); ?></span>
398 398
 	</legend>
399 399
 
400 400
 	<div id="replycontainer">
401
-	<label for="replycontent" class="screen-reader-text"><?php _e( 'Comment' ); ?></label>
401
+	<label for="replycontent" class="screen-reader-text"><?php _e('Comment'); ?></label>
402 402
 	<?php
403
-	$quicktags_settings = array( 'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close' );
404
-	wp_editor( '', 'replycontent', array( 'media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings ) );
403
+	$quicktags_settings = array('buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,close');
404
+	wp_editor('', 'replycontent', array('media_buttons' => false, 'tinymce' => false, 'quicktags' => $quicktags_settings));
405 405
 	?>
406 406
 	</div>
407 407
 
408 408
 	<div id="edithead" style="display:none;">
409 409
 		<div class="inside">
410
-		<label for="author-name"><?php _e( 'Name' ) ?></label>
410
+		<label for="author-name"><?php _e('Name') ?></label>
411 411
 		<input type="text" name="newcomment_author" size="50" value="" id="author-name" />
412 412
 		</div>
413 413
 
@@ -440,12 +440,12 @@  discard block
 block discarded – undo
440 440
 	<input type="hidden" name="checkbox" id="checkbox" value="<?php echo $checkbox ? 1 : 0; ?>" />
441 441
 	<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
442 442
 	<?php
443
-		wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
444
-		if ( current_user_can( 'unfiltered_html' ) )
445
-			wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
443
+		wp_nonce_field('replyto-comment', '_ajax_nonce-replyto-comment', false);
444
+		if (current_user_can('unfiltered_html'))
445
+			wp_nonce_field('unfiltered-html-comment', '_wp_unfiltered_html_comment', false);
446 446
 	?>
447 447
 	</fieldset>
448
-<?php if ( $table_row ) : ?>
448
+<?php if ($table_row) : ?>
449 449
 </td></tr></tbody></table>
450 450
 <?php else : ?>
451 451
 </div></div>
@@ -477,15 +477,15 @@  discard block
 block discarded – undo
477 477
  *
478 478
  * @param array $meta
479 479
  */
480
-function list_meta( $meta ) {
480
+function list_meta($meta) {
481 481
 	// Exit if no meta
482
-	if ( ! $meta ) {
482
+	if ( ! $meta) {
483 483
 		echo '
484 484
 <table id="list-table" style="display: none;">
485 485
 	<thead>
486 486
 	<tr>
487
-		<th class="left">' . _x( 'Name', 'meta name' ) . '</th>
488
-		<th>' . __( 'Value' ) . '</th>
487
+		<th class="left">' . _x('Name', 'meta name').'</th>
488
+		<th>' . __('Value').'</th>
489 489
 	</tr>
490 490
 	</thead>
491 491
 	<tbody id="the-list" data-wp-lists="list:meta">
@@ -499,14 +499,14 @@  discard block
 block discarded – undo
499 499
 <table id="list-table">
500 500
 	<thead>
501 501
 	<tr>
502
-		<th class="left"><?php _ex( 'Name', 'meta name' ) ?></th>
503
-		<th><?php _e( 'Value' ) ?></th>
502
+		<th class="left"><?php _ex('Name', 'meta name') ?></th>
503
+		<th><?php _e('Value') ?></th>
504 504
 	</tr>
505 505
 	</thead>
506 506
 	<tbody id='the-list' data-wp-lists='list:meta'>
507 507
 <?php
508
-	foreach ( $meta as $entry )
509
-		echo _list_meta_row( $entry, $count );
508
+	foreach ($meta as $entry)
509
+		echo _list_meta_row($entry, $count);
510 510
 ?>
511 511
 	</tbody>
512 512
 </table>
@@ -524,22 +524,22 @@  discard block
 block discarded – undo
524 524
  * @param int   $count
525 525
  * @return string
526 526
  */
527
-function _list_meta_row( $entry, &$count ) {
527
+function _list_meta_row($entry, &$count) {
528 528
 	static $update_nonce = '';
529 529
 
530
-	if ( is_protected_meta( $entry['meta_key'], 'post' ) )
530
+	if (is_protected_meta($entry['meta_key'], 'post'))
531 531
 		return '';
532 532
 
533
-	if ( ! $update_nonce )
534
-		$update_nonce = wp_create_nonce( 'add-meta' );
533
+	if ( ! $update_nonce)
534
+		$update_nonce = wp_create_nonce('add-meta');
535 535
 
536 536
 	$r = '';
537
-	++ $count;
537
+	++$count;
538 538
 
539
-	if ( is_serialized( $entry['meta_value'] ) ) {
540
-		if ( is_serialized_string( $entry['meta_value'] ) ) {
539
+	if (is_serialized($entry['meta_value'])) {
540
+		if (is_serialized_string($entry['meta_value'])) {
541 541
 			// This is a serialized string, so we should display it.
542
-			$entry['meta_value'] = maybe_unserialize( $entry['meta_value'] );
542
+			$entry['meta_value'] = maybe_unserialize($entry['meta_value']);
543 543
 		} else {
544 544
 			// This is a serialized array/object so we should NOT display it.
545 545
 			--$count;
@@ -548,23 +548,23 @@  discard block
 block discarded – undo
548 548
 	}
549 549
 
550 550
 	$entry['meta_key'] = esc_attr($entry['meta_key']);
551
-	$entry['meta_value'] = esc_textarea( $entry['meta_value'] ); // using a <textarea />
551
+	$entry['meta_value'] = esc_textarea($entry['meta_value']); // using a <textarea />
552 552
 	$entry['meta_id'] = (int) $entry['meta_id'];
553 553
 
554
-	$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
554
+	$delete_nonce = wp_create_nonce('delete-meta_'.$entry['meta_id']);
555 555
 
556 556
 	$r .= "\n\t<tr id='meta-{$entry['meta_id']}'>";
557
-	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
557
+	$r .= "\n\t\t<td class='left'><label class='screen-reader-text' for='meta-{$entry['meta_id']}-key'>".__('Key')."</label><input name='meta[{$entry['meta_id']}][key]' id='meta-{$entry['meta_id']}-key' type='text' size='20' value='{$entry['meta_key']}' />";
558 558
 
559 559
 	$r .= "\n\t\t<div class='submit'>";
560
-	$r .= get_submit_button( __( 'Delete' ), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array( 'data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce" ) );
560
+	$r .= get_submit_button(__('Delete'), 'deletemeta small', "deletemeta[{$entry['meta_id']}]", false, array('data-wp-lists' => "delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce"));
561 561
 	$r .= "\n\t\t";
562
-	$r .= get_submit_button( __( 'Update' ), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array( 'data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce" ) );
562
+	$r .= get_submit_button(__('Update'), 'updatemeta small', "meta-{$entry['meta_id']}-submit", false, array('data-wp-lists' => "add:the-list:meta-{$entry['meta_id']}::_ajax_nonce-add-meta=$update_nonce"));
563 563
 	$r .= "</div>";
564
-	$r .= wp_nonce_field( 'change-meta', '_ajax_nonce', false, false );
564
+	$r .= wp_nonce_field('change-meta', '_ajax_nonce', false, false);
565 565
 	$r .= "</td>";
566 566
 
567
-	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
567
+	$r .= "\n\t\t<td><label class='screen-reader-text' for='meta-{$entry['meta_id']}-value'>".__('Value')."</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta-{$entry['meta_id']}-value' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>\n\t</tr>";
568 568
 	return $r;
569 569
 }
570 570
 
@@ -577,9 +577,9 @@  discard block
 block discarded – undo
577 577
  *
578 578
  * @param WP_Post $post Optional. The post being edited.
579 579
  */
580
-function meta_form( $post = null ) {
580
+function meta_form($post = null) {
581 581
 	global $wpdb;
582
-	$post = get_post( $post );
582
+	$post = get_post($post);
583 583
 
584 584
 	/**
585 585
 	 * Filter values for the meta key dropdown in the Custom Fields meta box.
@@ -592,9 +592,9 @@  discard block
 block discarded – undo
592 592
 	 * @param array|null $keys Pre-defined meta keys to be used in place of a postmeta query. Default null.
593 593
 	 * @param WP_Post    $post The current post object.
594 594
 	 */
595
-	$keys = apply_filters( 'postmeta_form_keys', null, $post );
595
+	$keys = apply_filters('postmeta_form_keys', null, $post);
596 596
 
597
-	if ( null === $keys ) {
597
+	if (null === $keys) {
598 598
 		/**
599 599
 		 * Filter the number of custom fields to retrieve for the drop-down
600 600
 		 * in the Custom Fields meta box.
@@ -603,44 +603,44 @@  discard block
 block discarded – undo
603 603
 		 *
604 604
 		 * @param int $limit Number of custom fields to retrieve. Default 30.
605 605
 		 */
606
-		$limit = apply_filters( 'postmeta_form_limit', 30 );
606
+		$limit = apply_filters('postmeta_form_limit', 30);
607 607
 		$sql = "SELECT DISTINCT meta_key
608 608
 			FROM $wpdb->postmeta
609 609
 			WHERE meta_key NOT BETWEEN '_' AND '_z'
610 610
 			HAVING meta_key NOT LIKE %s
611 611
 			ORDER BY meta_key
612 612
 			LIMIT %d";
613
-		$keys = $wpdb->get_col( $wpdb->prepare( $sql, $wpdb->esc_like( '_' ) . '%', $limit ) );
613
+		$keys = $wpdb->get_col($wpdb->prepare($sql, $wpdb->esc_like('_').'%', $limit));
614 614
 	}
615 615
 
616
-	if ( $keys ) {
617
-		natcasesort( $keys );
616
+	if ($keys) {
617
+		natcasesort($keys);
618 618
 		$meta_key_input_id = 'metakeyselect';
619 619
 	} else {
620 620
 		$meta_key_input_id = 'metakeyinput';
621 621
 	}
622 622
 ?>
623
-<p><strong><?php _e( 'Add New Custom Field:' ) ?></strong></p>
623
+<p><strong><?php _e('Add New Custom Field:') ?></strong></p>
624 624
 <table id="newmeta">
625 625
 <thead>
626 626
 <tr>
627
-<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex( 'Name', 'meta name' ) ?></label></th>
628
-<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
627
+<th class="left"><label for="<?php echo $meta_key_input_id; ?>"><?php _ex('Name', 'meta name') ?></label></th>
628
+<th><label for="metavalue"><?php _e('Value') ?></label></th>
629 629
 </tr>
630 630
 </thead>
631 631
 
632 632
 <tbody>
633 633
 <tr>
634 634
 <td id="newmetaleft" class="left">
635
-<?php if ( $keys ) { ?>
635
+<?php if ($keys) { ?>
636 636
 <select id="metakeyselect" name="metakeyselect">
637
-<option value="#NONE#"><?php _e( '&mdash; Select &mdash;' ); ?></option>
637
+<option value="#NONE#"><?php _e('&mdash; Select &mdash;'); ?></option>
638 638
 <?php
639 639
 
640
-	foreach ( $keys as $key ) {
641
-		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
640
+	foreach ($keys as $key) {
641
+		if (is_protected_meta($key, 'post') || ! current_user_can('add_post_meta', $post->ID, $key))
642 642
 			continue;
643
-		echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
643
+		echo "\n<option value='".esc_attr($key)."'>".esc_html($key)."</option>";
644 644
 	}
645 645
 ?>
646 646
 </select>
@@ -657,9 +657,9 @@  discard block
 block discarded – undo
657 657
 
658 658
 <tr><td colspan="2">
659 659
 <div class="submit">
660
-<?php submit_button( __( 'Add Custom Field' ), 'secondary', 'addmeta', false, array( 'id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta' ) ); ?>
660
+<?php submit_button(__('Add Custom Field'), 'secondary', 'addmeta', false, array('id' => 'newmeta-submit', 'data-wp-lists' => 'add:the-list:newmeta')); ?>
661 661
 </div>
662
-<?php wp_nonce_field( 'add-meta', '_ajax_nonce-add-meta', false ); ?>
662
+<?php wp_nonce_field('add-meta', '_ajax_nonce-add-meta', false); ?>
663 663
 </td></tr>
664 664
 </tbody>
665 665
 </table>
@@ -681,15 +681,15 @@  discard block
 block discarded – undo
681 681
  * @param int|bool $multi     Optional. Whether the additional fields and buttons should be added.
682 682
  *                            Default 0|false.
683 683
  */
684
-function touch_time( $edit = 1, $for_post = 1, $tab_index = 0, $multi = 0 ) {
684
+function touch_time($edit = 1, $for_post = 1, $tab_index = 0, $multi = 0) {
685 685
 	global $wp_locale;
686 686
 	$post = get_post();
687 687
 
688
-	if ( $for_post )
689
-		$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
688
+	if ($for_post)
689
+		$edit = ! (in_array($post->post_status, array('draft', 'pending')) && ( ! $post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt));
690 690
 
691 691
 	$tab_index_attribute = '';
692
-	if ( (int) $tab_index > 0 )
692
+	if ((int) $tab_index > 0)
693 693
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
694 694
 
695 695
 	// todo: Remove this?
@@ -697,56 +697,56 @@  discard block
 block discarded – undo
697 697
 
698 698
 	$time_adj = current_time('timestamp');
699 699
 	$post_date = ($for_post) ? $post->post_date : get_comment()->comment_date;
700
-	$jj = ($edit) ? mysql2date( 'd', $post_date, false ) : gmdate( 'd', $time_adj );
701
-	$mm = ($edit) ? mysql2date( 'm', $post_date, false ) : gmdate( 'm', $time_adj );
702
-	$aa = ($edit) ? mysql2date( 'Y', $post_date, false ) : gmdate( 'Y', $time_adj );
703
-	$hh = ($edit) ? mysql2date( 'H', $post_date, false ) : gmdate( 'H', $time_adj );
704
-	$mn = ($edit) ? mysql2date( 'i', $post_date, false ) : gmdate( 'i', $time_adj );
705
-	$ss = ($edit) ? mysql2date( 's', $post_date, false ) : gmdate( 's', $time_adj );
706
-
707
-	$cur_jj = gmdate( 'd', $time_adj );
708
-	$cur_mm = gmdate( 'm', $time_adj );
709
-	$cur_aa = gmdate( 'Y', $time_adj );
710
-	$cur_hh = gmdate( 'H', $time_adj );
711
-	$cur_mn = gmdate( 'i', $time_adj );
712
-
713
-	$month = '<label><span class="screen-reader-text">' . __( 'Month' ) . '</span><select ' . ( $multi ? '' : 'id="mm" ' ) . 'name="mm"' . $tab_index_attribute . ">\n";
714
-	for ( $i = 1; $i < 13; $i = $i +1 ) {
700
+	$jj = ($edit) ? mysql2date('d', $post_date, false) : gmdate('d', $time_adj);
701
+	$mm = ($edit) ? mysql2date('m', $post_date, false) : gmdate('m', $time_adj);
702
+	$aa = ($edit) ? mysql2date('Y', $post_date, false) : gmdate('Y', $time_adj);
703
+	$hh = ($edit) ? mysql2date('H', $post_date, false) : gmdate('H', $time_adj);
704
+	$mn = ($edit) ? mysql2date('i', $post_date, false) : gmdate('i', $time_adj);
705
+	$ss = ($edit) ? mysql2date('s', $post_date, false) : gmdate('s', $time_adj);
706
+
707
+	$cur_jj = gmdate('d', $time_adj);
708
+	$cur_mm = gmdate('m', $time_adj);
709
+	$cur_aa = gmdate('Y', $time_adj);
710
+	$cur_hh = gmdate('H', $time_adj);
711
+	$cur_mn = gmdate('i', $time_adj);
712
+
713
+	$month = '<label><span class="screen-reader-text">'.__('Month').'</span><select '.($multi ? '' : 'id="mm" ').'name="mm"'.$tab_index_attribute.">\n";
714
+	for ($i = 1; $i < 13; $i = $i + 1) {
715 715
 		$monthnum = zeroise($i, 2);
716
-		$monthtext = $wp_locale->get_month_abbrev( $wp_locale->get_month( $i ) );
717
-		$month .= "\t\t\t" . '<option value="' . $monthnum . '" data-text="' . $monthtext . '" ' . selected( $monthnum, $mm, false ) . '>';
716
+		$monthtext = $wp_locale->get_month_abbrev($wp_locale->get_month($i));
717
+		$month .= "\t\t\t".'<option value="'.$monthnum.'" data-text="'.$monthtext.'" '.selected($monthnum, $mm, false).'>';
718 718
 		/* translators: 1: month number (01, 02, etc.), 2: month abbreviation */
719
-		$month .= sprintf( __( '%1$s-%2$s' ), $monthnum, $monthtext ) . "</option>\n";
719
+		$month .= sprintf(__('%1$s-%2$s'), $monthnum, $monthtext)."</option>\n";
720 720
 	}
721 721
 	$month .= '</select></label>';
722 722
 
723
-	$day = '<label><span class="screen-reader-text">' . __( 'Day' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="jj" ' ) . 'name="jj" value="' . $jj . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
724
-	$year = '<label><span class="screen-reader-text">' . __( 'Year' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="aa" ' ) . 'name="aa" value="' . $aa . '" size="4" maxlength="4"' . $tab_index_attribute . ' autocomplete="off" /></label>';
725
-	$hour = '<label><span class="screen-reader-text">' . __( 'Hour' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="hh" ' ) . 'name="hh" value="' . $hh . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
726
-	$minute = '<label><span class="screen-reader-text">' . __( 'Minute' ) . '</span><input type="text" ' . ( $multi ? '' : 'id="mn" ' ) . 'name="mn" value="' . $mn . '" size="2" maxlength="2"' . $tab_index_attribute . ' autocomplete="off" /></label>';
723
+	$day = '<label><span class="screen-reader-text">'.__('Day').'</span><input type="text" '.($multi ? '' : 'id="jj" ').'name="jj" value="'.$jj.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
724
+	$year = '<label><span class="screen-reader-text">'.__('Year').'</span><input type="text" '.($multi ? '' : 'id="aa" ').'name="aa" value="'.$aa.'" size="4" maxlength="4"'.$tab_index_attribute.' autocomplete="off" /></label>';
725
+	$hour = '<label><span class="screen-reader-text">'.__('Hour').'</span><input type="text" '.($multi ? '' : 'id="hh" ').'name="hh" value="'.$hh.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
726
+	$minute = '<label><span class="screen-reader-text">'.__('Minute').'</span><input type="text" '.($multi ? '' : 'id="mn" ').'name="mn" value="'.$mn.'" size="2" maxlength="2"'.$tab_index_attribute.' autocomplete="off" /></label>';
727 727
 
728 728
 	echo '<div class="timestamp-wrap">';
729 729
 	/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
730
-	printf( __( '%1$s %2$s, %3$s @ %4$s:%5$s' ), $month, $day, $year, $hour, $minute );
730
+	printf(__('%1$s %2$s, %3$s @ %4$s:%5$s'), $month, $day, $year, $hour, $minute);
731 731
 
732
-	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
732
+	echo '</div><input type="hidden" id="ss" name="ss" value="'.$ss.'" />';
733 733
 
734
-	if ( $multi ) return;
734
+	if ($multi) return;
735 735
 
736 736
 	echo "\n\n";
737 737
 	$map = array(
738
-		'mm' => array( $mm, $cur_mm ),
739
-		'jj' => array( $jj, $cur_jj ),
740
-		'aa' => array( $aa, $cur_aa ),
741
-		'hh' => array( $hh, $cur_hh ),
742
-		'mn' => array( $mn, $cur_mn ),
738
+		'mm' => array($mm, $cur_mm),
739
+		'jj' => array($jj, $cur_jj),
740
+		'aa' => array($aa, $cur_aa),
741
+		'hh' => array($hh, $cur_hh),
742
+		'mn' => array($mn, $cur_mn),
743 743
 	);
744
-	foreach ( $map as $timeunit => $value ) {
745
-		list( $unit, $curr ) = $value;
744
+	foreach ($map as $timeunit => $value) {
745
+		list($unit, $curr) = $value;
746 746
 
747
-		echo '<input type="hidden" id="hidden_' . $timeunit . '" name="hidden_' . $timeunit . '" value="' . $unit . '" />' . "\n";
748
-		$cur_timeunit = 'cur_' . $timeunit;
749
-		echo '<input type="hidden" id="' . $cur_timeunit . '" name="' . $cur_timeunit . '" value="' . $curr . '" />' . "\n";
747
+		echo '<input type="hidden" id="hidden_'.$timeunit.'" name="hidden_'.$timeunit.'" value="'.$unit.'" />'."\n";
748
+		$cur_timeunit = 'cur_'.$timeunit;
749
+		echo '<input type="hidden" id="'.$cur_timeunit.'" name="'.$cur_timeunit.'" value="'.$curr.'" />'."\n";
750 750
 	}
751 751
 ?>
752 752
 
@@ -764,12 +764,12 @@  discard block
 block discarded – undo
764 764
  *
765 765
  * @param string $default Optional. The template file name. Default empty.
766 766
  */
767
-function page_template_dropdown( $default = '' ) {
768
-	$templates = get_page_templates( get_post() );
769
-	ksort( $templates );
770
-	foreach ( array_keys( $templates ) as $template ) {
771
-		$selected = selected( $default, $templates[ $template ], false );
772
-		echo "\n\t<option value='" . $templates[ $template ] . "' $selected>$template</option>";
767
+function page_template_dropdown($default = '') {
768
+	$templates = get_page_templates(get_post());
769
+	ksort($templates);
770
+	foreach (array_keys($templates) as $template) {
771
+		$selected = selected($default, $templates[$template], false);
772
+		echo "\n\t<option value='".$templates[$template]."' $selected>$template</option>";
773 773
 	}
774 774
 }
775 775
 
@@ -788,22 +788,22 @@  discard block
 block discarded – undo
788 788
  *
789 789
  * @return null|false Boolean False if page has no children, otherwise print out html elements
790 790
  */
791
-function parent_dropdown( $default = 0, $parent = 0, $level = 0, $post = null ) {
791
+function parent_dropdown($default = 0, $parent = 0, $level = 0, $post = null) {
792 792
 	global $wpdb;
793
-	$post = get_post( $post );
794
-	$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
793
+	$post = get_post($post);
794
+	$items = $wpdb->get_results($wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent));
795 795
 
796
-	if ( $items ) {
797
-		foreach ( $items as $item ) {
796
+	if ($items) {
797
+		foreach ($items as $item) {
798 798
 			// A page cannot be its own parent.
799
-			if ( $post && $post->ID && $item->ID == $post->ID )
799
+			if ($post && $post->ID && $item->ID == $post->ID)
800 800
 				continue;
801 801
 
802
-			$pad = str_repeat( '&nbsp;', $level * 3 );
803
-			$selected = selected( $default, $item->ID, false );
802
+			$pad = str_repeat('&nbsp;', $level * 3);
803
+			$selected = selected($default, $item->ID, false);
804 804
 
805
-			echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad " . esc_html($item->post_title) . "</option>";
806
-			parent_dropdown( $default, $item->ID, $level +1 );
805
+			echo "\n\t<option class='level-$level' value='$item->ID' $selected>$pad ".esc_html($item->post_title)."</option>";
806
+			parent_dropdown($default, $item->ID, $level + 1);
807 807
 		}
808 808
 	} else {
809 809
 		return false;
@@ -817,20 +817,20 @@  discard block
 block discarded – undo
817 817
  *
818 818
  * @param string $selected Slug for the role that should be already selected.
819 819
  */
820
-function wp_dropdown_roles( $selected = '' ) {
820
+function wp_dropdown_roles($selected = '') {
821 821
 	$p = '';
822 822
 	$r = '';
823 823
 
824
-	$editable_roles = array_reverse( get_editable_roles() );
824
+	$editable_roles = array_reverse(get_editable_roles());
825 825
 
826
-	foreach ( $editable_roles as $role => $details ) {
827
-		$name = translate_user_role($details['name'] );
828
-		if ( $selected == $role ) // preselect specified role
829
-			$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
826
+	foreach ($editable_roles as $role => $details) {
827
+		$name = translate_user_role($details['name']);
828
+		if ($selected == $role) // preselect specified role
829
+			$p = "\n\t<option selected='selected' value='".esc_attr($role)."'>$name</option>";
830 830
 		else
831
-			$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
831
+			$r .= "\n\t<option value='".esc_attr($role)."'>$name</option>";
832 832
 	}
833
-	echo $p . $r;
833
+	echo $p.$r;
834 834
 }
835 835
 
836 836
 /**
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
  *
841 841
  * @param string $action The action attribute for the form.
842 842
  */
843
-function wp_import_upload_form( $action ) {
843
+function wp_import_upload_form($action) {
844 844
 
845 845
 	/**
846 846
 	 * Filter the maximum allowed upload size for import files.
@@ -851,22 +851,22 @@  discard block
 block discarded – undo
851 851
 	 *
852 852
 	 * @param int $max_upload_size Allowed upload size. Default 1 MB.
853 853
 	 */
854
-	$bytes = apply_filters( 'import_upload_size_limit', wp_max_upload_size() );
855
-	$size = size_format( $bytes );
854
+	$bytes = apply_filters('import_upload_size_limit', wp_max_upload_size());
855
+	$size = size_format($bytes);
856 856
 	$upload_dir = wp_upload_dir();
857
-	if ( ! empty( $upload_dir['error'] ) ) :
857
+	if ( ! empty($upload_dir['error'])) :
858 858
 		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
859 859
 		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
860 860
 	else :
861 861
 ?>
862
-<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
862
+<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url(wp_nonce_url($action, 'import-upload')); ?>">
863 863
 <p>
864
-<label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
864
+<label for="upload"><?php _e('Choose a file from your computer:'); ?></label> (<?php printf(__('Maximum size: %s'), $size); ?>)
865 865
 <input type="file" id="upload" name="import" size="25" />
866 866
 <input type="hidden" name="action" value="save" />
867 867
 <input type="hidden" name="max_file_size" value="<?php echo $bytes; ?>" />
868 868
 </p>
869
-<?php submit_button( __('Upload file and import'), 'primary' ); ?>
869
+<?php submit_button(__('Upload file and import'), 'primary'); ?>
870 870
 </form>
871 871
 <?php
872 872
 	endif;
@@ -900,75 +900,75 @@  discard block
 block discarded – undo
900 900
  *                                              of the box array (which is the second parameter passed
901 901
  *                                              to your callback). Default null.
902 902
  */
903
-function add_meta_box( $id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null ) {
903
+function add_meta_box($id, $title, $callback, $screen = null, $context = 'advanced', $priority = 'default', $callback_args = null) {
904 904
 	global $wp_meta_boxes;
905 905
 
906
-	if ( empty( $screen ) ) {
906
+	if (empty($screen)) {
907 907
 		$screen = get_current_screen();
908
-	} elseif ( is_string( $screen ) ) {
909
-		$screen = convert_to_screen( $screen );
910
-	} elseif ( is_array( $screen ) ) {
911
-		foreach ( $screen as $single_screen ) {
912
-			add_meta_box( $id, $title, $callback, $single_screen, $context, $priority, $callback_args );
908
+	} elseif (is_string($screen)) {
909
+		$screen = convert_to_screen($screen);
910
+	} elseif (is_array($screen)) {
911
+		foreach ($screen as $single_screen) {
912
+			add_meta_box($id, $title, $callback, $single_screen, $context, $priority, $callback_args);
913 913
 		}
914 914
 	}
915 915
 
916
-	if ( ! isset( $screen->id ) ) {
916
+	if ( ! isset($screen->id)) {
917 917
 		return;
918 918
 	}
919 919
 
920 920
 	$page = $screen->id;
921 921
 
922
-	if ( !isset($wp_meta_boxes) )
922
+	if ( ! isset($wp_meta_boxes))
923 923
 		$wp_meta_boxes = array();
924
-	if ( !isset($wp_meta_boxes[$page]) )
924
+	if ( ! isset($wp_meta_boxes[$page]))
925 925
 		$wp_meta_boxes[$page] = array();
926
-	if ( !isset($wp_meta_boxes[$page][$context]) )
926
+	if ( ! isset($wp_meta_boxes[$page][$context]))
927 927
 		$wp_meta_boxes[$page][$context] = array();
928 928
 
929
-	foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
930
-		foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
931
-			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
929
+	foreach (array_keys($wp_meta_boxes[$page]) as $a_context) {
930
+		foreach (array('high', 'core', 'default', 'low') as $a_priority) {
931
+			if ( ! isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]))
932 932
 				continue;
933 933
 
934 934
 			// If a core box was previously added or removed by a plugin, don't add.
935
-			if ( 'core' == $priority ) {
935
+			if ('core' == $priority) {
936 936
 				// If core box previously deleted, don't add
937
-				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
937
+				if (false === $wp_meta_boxes[$page][$a_context][$a_priority][$id])
938 938
 					return;
939 939
 
940 940
 				/*
941 941
 				 * If box was added with default priority, give it core priority to
942 942
 				 * maintain sort order.
943 943
 				 */
944
-				if ( 'default' == $a_priority ) {
944
+				if ('default' == $a_priority) {
945 945
 					$wp_meta_boxes[$page][$a_context]['core'][$id] = $wp_meta_boxes[$page][$a_context]['default'][$id];
946 946
 					unset($wp_meta_boxes[$page][$a_context]['default'][$id]);
947 947
 				}
948 948
 				return;
949 949
 			}
950 950
 			// If no priority given and id already present, use existing priority.
951
-			if ( empty($priority) ) {
951
+			if (empty($priority)) {
952 952
 				$priority = $a_priority;
953 953
 			/*
954 954
 			 * Else, if we're adding to the sorted priority, we don't know the title
955 955
 			 * or callback. Grab them from the previously added context/priority.
956 956
 			 */
957
-			} elseif ( 'sorted' == $priority ) {
957
+			} elseif ('sorted' == $priority) {
958 958
 				$title = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['title'];
959 959
 				$callback = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['callback'];
960 960
 				$callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
961 961
 			}
962 962
 			// An id can be in only one priority and one context.
963
-			if ( $priority != $a_priority || $context != $a_context )
963
+			if ($priority != $a_priority || $context != $a_context)
964 964
 				unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
965 965
 		}
966 966
 	}
967 967
 
968
-	if ( empty($priority) )
968
+	if (empty($priority))
969 969
 		$priority = 'low';
970 970
 
971
-	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
971
+	if ( ! isset($wp_meta_boxes[$page][$context][$priority]))
972 972
 		$wp_meta_boxes[$page][$context][$priority] = array();
973 973
 
974 974
 	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
@@ -987,27 +987,27 @@  discard block
 block discarded – undo
987 987
  * @param mixed            $object  gets passed to the box callback function as first parameter
988 988
  * @return int number of meta_boxes
989 989
  */
990
-function do_meta_boxes( $screen, $context, $object ) {
990
+function do_meta_boxes($screen, $context, $object) {
991 991
 	global $wp_meta_boxes;
992 992
 	static $already_sorted = false;
993 993
 
994
-	if ( empty( $screen ) )
994
+	if (empty($screen))
995 995
 		$screen = get_current_screen();
996
-	elseif ( is_string( $screen ) )
997
-		$screen = convert_to_screen( $screen );
996
+	elseif (is_string($screen))
997
+		$screen = convert_to_screen($screen);
998 998
 
999 999
 	$page = $screen->id;
1000 1000
 
1001
-	$hidden = get_hidden_meta_boxes( $screen );
1001
+	$hidden = get_hidden_meta_boxes($screen);
1002 1002
 
1003 1003
 	printf('<div id="%s-sortables" class="meta-box-sortables">', htmlspecialchars($context));
1004 1004
 
1005 1005
 	// Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose
1006
-	if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) {
1007
-		foreach ( $sorted as $box_context => $ids ) {
1008
-			foreach ( explode( ',', $ids ) as $id ) {
1009
-				if ( $id && 'dashboard_browser_nag' !== $id ) {
1010
-					add_meta_box( $id, null, null, $screen, $box_context, 'sorted' );
1006
+	if ( ! $already_sorted && $sorted = get_user_option("meta-box-order_$page")) {
1007
+		foreach ($sorted as $box_context => $ids) {
1008
+			foreach (explode(',', $ids) as $id) {
1009
+				if ($id && 'dashboard_browser_nag' !== $id) {
1010
+					add_meta_box($id, null, null, $screen, $box_context, 'sorted');
1011 1011
 				}
1012 1012
 			}
1013 1013
 		}
@@ -1017,23 +1017,23 @@  discard block
 block discarded – undo
1017 1017
 
1018 1018
 	$i = 0;
1019 1019
 
1020
-	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
1021
-		foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
1022
-			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
1023
-				foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1024
-					if ( false == $box || ! $box['title'] )
1020
+	if (isset($wp_meta_boxes[$page][$context])) {
1021
+		foreach (array('high', 'sorted', 'core', 'default', 'low') as $priority) {
1022
+			if (isset($wp_meta_boxes[$page][$context][$priority])) {
1023
+				foreach ((array) $wp_meta_boxes[$page][$context][$priority] as $box) {
1024
+					if (false == $box || ! $box['title'])
1025 1025
 						continue;
1026 1026
 					$i++;
1027 1027
 					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
1028
-					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
1029
-					if ( 'dashboard_browser_nag' != $box['id'] ) {
1028
+					echo '<div id="'.$box['id'].'" class="postbox '.postbox_classes($box['id'], $page).$hidden_class.'" '.'>'."\n";
1029
+					if ('dashboard_browser_nag' != $box['id']) {
1030 1030
 						echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
1031
-						echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $box['title'] ) . '</span>';
1031
+						echo '<span class="screen-reader-text">'.sprintf(__('Toggle panel: %s'), $box['title']).'</span>';
1032 1032
 						echo '<span class="toggle-indicator" aria-hidden="true"></span>';
1033 1033
 						echo '</button>';
1034 1034
 					}
1035 1035
 					echo "<h2 class='hndle'><span>{$box['title']}</span></h2>\n";
1036
-					echo '<div class="inside">' . "\n";
1036
+					echo '<div class="inside">'."\n";
1037 1037
 					call_user_func($box['callback'], $object, $box);
1038 1038
 					echo "</div>\n";
1039 1039
 					echo "</div>\n";
@@ -1067,33 +1067,33 @@  discard block
 block discarded – undo
1067 1067
  *                                        and 'side'. Menus meta boxes (accordion sections) all use
1068 1068
  *                                        the 'side' context. Global default is 'advanced'.
1069 1069
  */
1070
-function remove_meta_box( $id, $screen, $context ) {
1070
+function remove_meta_box($id, $screen, $context) {
1071 1071
 	global $wp_meta_boxes;
1072 1072
 
1073
-	if ( empty( $screen ) ) {
1073
+	if (empty($screen)) {
1074 1074
 		$screen = get_current_screen();
1075
-	} elseif ( is_string( $screen ) ) {
1076
-		$screen = convert_to_screen( $screen );
1077
-	} elseif ( is_array( $screen ) ) {
1078
-		foreach ( $screen as $single_screen ) {
1079
-			remove_meta_box( $id, $single_screen, $context );
1075
+	} elseif (is_string($screen)) {
1076
+		$screen = convert_to_screen($screen);
1077
+	} elseif (is_array($screen)) {
1078
+		foreach ($screen as $single_screen) {
1079
+			remove_meta_box($id, $single_screen, $context);
1080 1080
 		}
1081 1081
 	}
1082 1082
 
1083
-	if ( ! isset( $screen->id ) ) {
1083
+	if ( ! isset($screen->id)) {
1084 1084
 		return;
1085 1085
 	}
1086 1086
 
1087 1087
 	$page = $screen->id;
1088 1088
 
1089
-	if ( !isset($wp_meta_boxes) )
1089
+	if ( ! isset($wp_meta_boxes))
1090 1090
 		$wp_meta_boxes = array();
1091
-	if ( !isset($wp_meta_boxes[$page]) )
1091
+	if ( ! isset($wp_meta_boxes[$page]))
1092 1092
 		$wp_meta_boxes[$page] = array();
1093
-	if ( !isset($wp_meta_boxes[$page][$context]) )
1093
+	if ( ! isset($wp_meta_boxes[$page][$context]))
1094 1094
 		$wp_meta_boxes[$page][$context] = array();
1095 1095
 
1096
-	foreach ( array('high', 'core', 'default', 'low') as $priority )
1096
+	foreach (array('high', 'core', 'default', 'low') as $priority)
1097 1097
 		$wp_meta_boxes[$page][$context][$priority][$id] = false;
1098 1098
 }
1099 1099
 
@@ -1113,19 +1113,19 @@  discard block
 block discarded – undo
1113 1113
  * @param mixed         $object  gets passed to the section callback function as first parameter.
1114 1114
  * @return int number of meta boxes as accordion sections.
1115 1115
  */
1116
-function do_accordion_sections( $screen, $context, $object ) {
1116
+function do_accordion_sections($screen, $context, $object) {
1117 1117
 	global $wp_meta_boxes;
1118 1118
 
1119
-	wp_enqueue_script( 'accordion' );
1119
+	wp_enqueue_script('accordion');
1120 1120
 
1121
-	if ( empty( $screen ) )
1121
+	if (empty($screen))
1122 1122
 		$screen = get_current_screen();
1123
-	elseif ( is_string( $screen ) )
1124
-		$screen = convert_to_screen( $screen );
1123
+	elseif (is_string($screen))
1124
+		$screen = convert_to_screen($screen);
1125 1125
 
1126 1126
 	$page = $screen->id;
1127 1127
 
1128
-	$hidden = get_hidden_meta_boxes( $screen );
1128
+	$hidden = get_hidden_meta_boxes($screen);
1129 1129
 	?>
1130 1130
 	<div id="side-sortables" class="accordion-container">
1131 1131
 		<ul class="outer-border">
@@ -1133,29 +1133,29 @@  discard block
 block discarded – undo
1133 1133
 	$i = 0;
1134 1134
 	$first_open = false;
1135 1135
 
1136
-	if ( isset( $wp_meta_boxes[ $page ][ $context ] ) ) {
1137
-		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
1138
-			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
1139
-				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1140
-					if ( false == $box || ! $box['title'] )
1136
+	if (isset($wp_meta_boxes[$page][$context])) {
1137
+		foreach (array('high', 'core', 'default', 'low') as $priority) {
1138
+			if (isset($wp_meta_boxes[$page][$context][$priority])) {
1139
+				foreach ($wp_meta_boxes[$page][$context][$priority] as $box) {
1140
+					if (false == $box || ! $box['title'])
1141 1141
 						continue;
1142 1142
 					$i++;
1143
-					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
1143
+					$hidden_class = in_array($box['id'], $hidden) ? 'hide-if-js' : '';
1144 1144
 
1145 1145
 					$open_class = '';
1146
-					if ( ! $first_open && empty( $hidden_class ) ) {
1146
+					if ( ! $first_open && empty($hidden_class)) {
1147 1147
 						$first_open = true;
1148 1148
 						$open_class = 'open';
1149 1149
 					}
1150 1150
 					?>
1151
-					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr( $box['id'] ); ?>" id="<?php echo esc_attr( $box['id'] ); ?>">
1151
+					<li class="control-section accordion-section <?php echo $hidden_class; ?> <?php echo $open_class; ?> <?php echo esc_attr($box['id']); ?>" id="<?php echo esc_attr($box['id']); ?>">
1152 1152
 						<h3 class="accordion-section-title hndle" tabindex="0">
1153
-							<?php echo esc_html( $box['title'] ); ?>
1154
-							<span class="screen-reader-text"><?php _e( 'Press return or enter to open this section' ); ?></span>
1153
+							<?php echo esc_html($box['title']); ?>
1154
+							<span class="screen-reader-text"><?php _e('Press return or enter to open this section'); ?></span>
1155 1155
 						</h3>
1156
-						<div class="accordion-section-content <?php postbox_classes( $box['id'], $page ); ?>">
1156
+						<div class="accordion-section-content <?php postbox_classes($box['id'], $page); ?>">
1157 1157
 							<div class="inside">
1158
-								<?php call_user_func( $box['callback'], $object, $box ); ?>
1158
+								<?php call_user_func($box['callback'], $object, $box); ?>
1159 1159
 							</div><!-- .inside -->
1160 1160
 						</div><!-- .accordion-section-content -->
1161 1161
 					</li><!-- .accordion-section -->
@@ -1196,13 +1196,13 @@  discard block
 block discarded – undo
1196 1196
 function add_settings_section($id, $title, $callback, $page) {
1197 1197
 	global $wp_settings_sections;
1198 1198
 
1199
-	if ( 'misc' == $page ) {
1200
-		_deprecated_argument( __FUNCTION__, '3.0', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'misc' ) );
1199
+	if ('misc' == $page) {
1200
+		_deprecated_argument(__FUNCTION__, '3.0', sprintf(__('The "%s" options group has been removed. Use another settings group.'), 'misc'));
1201 1201
 		$page = 'general';
1202 1202
 	}
1203 1203
 
1204
-	if ( 'privacy' == $page ) {
1205
-		_deprecated_argument( __FUNCTION__, '3.5', sprintf( __( 'The "%s" options group has been removed. Use another settings group.' ), 'privacy' ) );
1204
+	if ('privacy' == $page) {
1205
+		_deprecated_argument(__FUNCTION__, '3.5', sprintf(__('The "%s" options group has been removed. Use another settings group.'), 'privacy'));
1206 1206
 		$page = 'reading';
1207 1207
 	}
1208 1208
 
@@ -1247,13 +1247,13 @@  discard block
 block discarded – undo
1247 1247
 function add_settings_field($id, $title, $callback, $page, $section = 'default', $args = array()) {
1248 1248
 	global $wp_settings_fields;
1249 1249
 
1250
-	if ( 'misc' == $page ) {
1251
-		_deprecated_argument( __FUNCTION__, '3.0', __( 'The miscellaneous options group has been removed. Use another settings group.' ) );
1250
+	if ('misc' == $page) {
1251
+		_deprecated_argument(__FUNCTION__, '3.0', __('The miscellaneous options group has been removed. Use another settings group.'));
1252 1252
 		$page = 'general';
1253 1253
 	}
1254 1254
 
1255
-	if ( 'privacy' == $page ) {
1256
-		_deprecated_argument( __FUNCTION__, '3.5', __( 'The privacy options group has been removed. Use another settings group.' ) );
1255
+	if ('privacy' == $page) {
1256
+		_deprecated_argument(__FUNCTION__, '3.5', __('The privacy options group has been removed. Use another settings group.'));
1257 1257
 		$page = 'reading';
1258 1258
 	}
1259 1259
 
@@ -1273,23 +1273,23 @@  discard block
 block discarded – undo
1273 1273
  *
1274 1274
  * @param string $page The slug name of the page whose settings sections you want to output
1275 1275
  */
1276
-function do_settings_sections( $page ) {
1276
+function do_settings_sections($page) {
1277 1277
 	global $wp_settings_sections, $wp_settings_fields;
1278 1278
 
1279
-	if ( ! isset( $wp_settings_sections[$page] ) )
1279
+	if ( ! isset($wp_settings_sections[$page]))
1280 1280
 		return;
1281 1281
 
1282
-	foreach ( (array) $wp_settings_sections[$page] as $section ) {
1283
-		if ( $section['title'] )
1282
+	foreach ((array) $wp_settings_sections[$page] as $section) {
1283
+		if ($section['title'])
1284 1284
 			echo "<h2>{$section['title']}</h2>\n";
1285 1285
 
1286
-		if ( $section['callback'] )
1287
-			call_user_func( $section['callback'], $section );
1286
+		if ($section['callback'])
1287
+			call_user_func($section['callback'], $section);
1288 1288
 
1289
-		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
1289
+		if ( ! isset($wp_settings_fields) || ! isset($wp_settings_fields[$page]) || ! isset($wp_settings_fields[$page][$section['id']]))
1290 1290
 			continue;
1291 1291
 		echo '<table class="form-table">';
1292
-		do_settings_fields( $page, $section['id'] );
1292
+		do_settings_fields($page, $section['id']);
1293 1293
 		echo '</table>';
1294 1294
 	}
1295 1295
 }
@@ -1311,22 +1311,22 @@  discard block
 block discarded – undo
1311 1311
 function do_settings_fields($page, $section) {
1312 1312
 	global $wp_settings_fields;
1313 1313
 
1314
-	if ( ! isset( $wp_settings_fields[$page][$section] ) )
1314
+	if ( ! isset($wp_settings_fields[$page][$section]))
1315 1315
 		return;
1316 1316
 
1317
-	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
1317
+	foreach ((array) $wp_settings_fields[$page][$section] as $field) {
1318 1318
 		$class = '';
1319 1319
 
1320
-		if ( ! empty( $field['args']['class'] ) ) {
1321
-			$class = ' class="' . esc_attr( $field['args']['class'] ) . '"';
1320
+		if ( ! empty($field['args']['class'])) {
1321
+			$class = ' class="'.esc_attr($field['args']['class']).'"';
1322 1322
 		}
1323 1323
 
1324 1324
 		echo "<tr{$class}>";
1325 1325
 
1326
-		if ( ! empty( $field['args']['label_for'] ) ) {
1327
-			echo '<th scope="row"><label for="' . esc_attr( $field['args']['label_for'] ) . '">' . $field['title'] . '</label></th>';
1326
+		if ( ! empty($field['args']['label_for'])) {
1327
+			echo '<th scope="row"><label for="'.esc_attr($field['args']['label_for']).'">'.$field['title'].'</label></th>';
1328 1328
 		} else {
1329
-			echo '<th scope="row">' . $field['title'] . '</th>';
1329
+			echo '<th scope="row">'.$field['title'].'</th>';
1330 1330
 		}
1331 1331
 
1332 1332
 		echo '<td>';
@@ -1360,7 +1360,7 @@  discard block
 block discarded – undo
1360 1360
  * @param string $type    Optional. Message type, controls HTML class. Accepts 'error' or 'updated'.
1361 1361
  *                        Default 'error'.
1362 1362
  */
1363
-function add_settings_error( $setting, $code, $message, $type = 'error' ) {
1363
+function add_settings_error($setting, $code, $message, $type = 'error') {
1364 1364
 	global $wp_settings_errors;
1365 1365
 
1366 1366
 	$wp_settings_errors[] = array(
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
  * @param boolean $sanitize Whether to re-sanitize the setting value before returning errors.
1394 1394
  * @return array Array of settings errors
1395 1395
  */
1396
-function get_settings_errors( $setting = '', $sanitize = false ) {
1396
+function get_settings_errors($setting = '', $sanitize = false) {
1397 1397
 	global $wp_settings_errors;
1398 1398
 
1399 1399
 	/*
@@ -1401,24 +1401,24 @@  discard block
 block discarded – undo
1401 1401
 	 * This allows the $sanitize_callback from register_setting() to run, adding
1402 1402
 	 * any settings errors you want to show by default.
1403 1403
 	 */
1404
-	if ( $sanitize )
1405
-		sanitize_option( $setting, get_option( $setting ) );
1404
+	if ($sanitize)
1405
+		sanitize_option($setting, get_option($setting));
1406 1406
 
1407 1407
 	// If settings were passed back from options.php then use them.
1408
-	if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
1409
-		$wp_settings_errors = array_merge( (array) $wp_settings_errors, get_transient( 'settings_errors' ) );
1410
-		delete_transient( 'settings_errors' );
1408
+	if (isset($_GET['settings-updated']) && $_GET['settings-updated'] && get_transient('settings_errors')) {
1409
+		$wp_settings_errors = array_merge((array) $wp_settings_errors, get_transient('settings_errors'));
1410
+		delete_transient('settings_errors');
1411 1411
 	}
1412 1412
 
1413 1413
 	// Check global in case errors have been added on this pageload.
1414
-	if ( ! count( $wp_settings_errors ) )
1414
+	if ( ! count($wp_settings_errors))
1415 1415
 		return array();
1416 1416
 
1417 1417
 	// Filter the results to those of a specific setting if one was set.
1418
-	if ( $setting ) {
1418
+	if ($setting) {
1419 1419
 		$setting_errors = array();
1420
-		foreach ( (array) $wp_settings_errors as $key => $details ) {
1421
-			if ( $setting == $details['setting'] )
1420
+		foreach ((array) $wp_settings_errors as $key => $details) {
1421
+			if ($setting == $details['setting'])
1422 1422
 				$setting_errors[] = $wp_settings_errors[$key];
1423 1423
 		}
1424 1424
 		return $setting_errors;
@@ -1453,20 +1453,20 @@  discard block
 block discarded – undo
1453 1453
  * @param bool   $sanitize       Whether to re-sanitize the setting value before returning errors.
1454 1454
  * @param bool   $hide_on_update If set to true errors will not be shown if the settings page has already been submitted.
1455 1455
  */
1456
-function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
1456
+function settings_errors($setting = '', $sanitize = false, $hide_on_update = false) {
1457 1457
 
1458
-	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
1458
+	if ($hide_on_update && ! empty($_GET['settings-updated']))
1459 1459
 		return;
1460 1460
 
1461
-	$settings_errors = get_settings_errors( $setting, $sanitize );
1461
+	$settings_errors = get_settings_errors($setting, $sanitize);
1462 1462
 
1463
-	if ( empty( $settings_errors ) )
1463
+	if (empty($settings_errors))
1464 1464
 		return;
1465 1465
 
1466 1466
 	$output = '';
1467
-	foreach ( $settings_errors as $key => $details ) {
1468
-		$css_id = 'setting-error-' . $details['code'];
1469
-		$css_class = $details['type'] . ' settings-error notice is-dismissible';
1467
+	foreach ($settings_errors as $key => $details) {
1468
+		$css_id = 'setting-error-'.$details['code'];
1469
+		$css_class = $details['type'].' settings-error notice is-dismissible';
1470 1470
 		$output .= "<div id='$css_id' class='$css_class'> \n";
1471 1471
 		$output .= "<p><strong>{$details['message']}</strong></p>";
1472 1472
 		$output .= "</div> \n";
@@ -1485,26 +1485,26 @@  discard block
 block discarded – undo
1485 1485
 ?>
1486 1486
 	<div id="find-posts" class="find-box" style="display: none;">
1487 1487
 		<div id="find-posts-head" class="find-box-head">
1488
-			<?php _e( 'Attach to existing content' ); ?>
1488
+			<?php _e('Attach to existing content'); ?>
1489 1489
 			<div id="find-posts-close"></div>
1490 1490
 		</div>
1491 1491
 		<div class="find-box-inside">
1492 1492
 			<div class="find-box-search">
1493
-				<?php if ( $found_action ) { ?>
1493
+				<?php if ($found_action) { ?>
1494 1494
 					<input type="hidden" name="found_action" value="<?php echo esc_attr($found_action); ?>" />
1495 1495
 				<?php } ?>
1496 1496
 				<input type="hidden" name="affected" id="affected" value="" />
1497
-				<?php wp_nonce_field( 'find-posts', '_ajax_nonce', false ); ?>
1498
-				<label class="screen-reader-text" for="find-posts-input"><?php _e( 'Search' ); ?></label>
1497
+				<?php wp_nonce_field('find-posts', '_ajax_nonce', false); ?>
1498
+				<label class="screen-reader-text" for="find-posts-input"><?php _e('Search'); ?></label>
1499 1499
 				<input type="text" id="find-posts-input" name="ps" value="" />
1500 1500
 				<span class="spinner"></span>
1501
-				<input type="button" id="find-posts-search" value="<?php esc_attr_e( 'Search' ); ?>" class="button" />
1501
+				<input type="button" id="find-posts-search" value="<?php esc_attr_e('Search'); ?>" class="button" />
1502 1502
 				<div class="clear"></div>
1503 1503
 			</div>
1504 1504
 			<div id="find-posts-response"></div>
1505 1505
 		</div>
1506 1506
 		<div class="find-box-buttons">
1507
-			<?php submit_button( __( 'Select' ), 'button-primary alignright', 'find-posts-submit', false ); ?>
1507
+			<?php submit_button(__('Select'), 'button-primary alignright', 'find-posts-submit', false); ?>
1508 1508
 			<div class="clear"></div>
1509 1509
 		</div>
1510 1510
 	</div>
@@ -1521,8 +1521,8 @@  discard block
 block discarded – undo
1521 1521
  */
1522 1522
 function the_post_password() {
1523 1523
 	$post = get_post();
1524
-	if ( isset( $post->post_password ) )
1525
-		echo esc_attr( $post->post_password );
1524
+	if (isset($post->post_password))
1525
+		echo esc_attr($post->post_password);
1526 1526
 }
1527 1527
 
1528 1528
 /**
@@ -1536,11 +1536,11 @@  discard block
 block discarded – undo
1536 1536
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
1537 1537
  * @return string The post title if set.
1538 1538
  */
1539
-function _draft_or_post_title( $post = 0 ) {
1540
-	$title = get_the_title( $post );
1541
-	if ( empty( $title ) )
1542
-		$title = __( '(no title)' );
1543
-	return esc_html( $title );
1539
+function _draft_or_post_title($post = 0) {
1540
+	$title = get_the_title($post);
1541
+	if (empty($title))
1542
+		$title = __('(no title)');
1543
+	return esc_html($title);
1544 1544
 }
1545 1545
 
1546 1546
 /**
@@ -1552,7 +1552,7 @@  discard block
 block discarded – undo
1552 1552
  * @since 2.7.0
1553 1553
  */
1554 1554
 function _admin_search_query() {
1555
-	echo isset($_REQUEST['s']) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
1555
+	echo isset($_REQUEST['s']) ? esc_attr(wp_unslash($_REQUEST['s'])) : '';
1556 1556
 }
1557 1557
 
1558 1558
 /**
@@ -1567,69 +1567,69 @@  discard block
 block discarded – undo
1567 1567
  * @param string $title      Optional. Title of the Iframe page. Default empty.
1568 1568
  * @param bool   $deprecated Not used.
1569 1569
  */
1570
-function iframe_header( $title = '', $deprecated = false ) {
1571
-	show_admin_bar( false );
1570
+function iframe_header($title = '', $deprecated = false) {
1571
+	show_admin_bar(false);
1572 1572
 	global $hook_suffix, $admin_body_class, $wp_locale;
1573 1573
 	$admin_body_class = preg_replace('/[^a-z0-9_-]+/i', '-', $hook_suffix);
1574 1574
 
1575 1575
 	$current_screen = get_current_screen();
1576 1576
 
1577
-	@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
1577
+	@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset'));
1578 1578
 	_wp_admin_html_begin();
1579 1579
 ?>
1580 1580
 <title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?> &#8212; <?php _e('WordPress'); ?></title>
1581 1581
 <?php
1582
-wp_enqueue_style( 'colors' );
1582
+wp_enqueue_style('colors');
1583 1583
 ?>
1584 1584
 <script type="text/javascript">
1585 1585
 addLoadEvent = function(func){if(typeof jQuery!="undefined")jQuery(document).ready(func);else if(typeof wpOnload!='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};
1586 1586
 function tb_close(){var win=window.dialogArguments||opener||parent||top;win.tb_remove();}
1587
-var ajaxurl = '<?php echo admin_url( 'admin-ajax.php', 'relative' ); ?>',
1587
+var ajaxurl = '<?php echo admin_url('admin-ajax.php', 'relative'); ?>',
1588 1588
 	pagenow = '<?php echo $current_screen->id; ?>',
1589 1589
 	typenow = '<?php echo $current_screen->post_type; ?>',
1590 1590
 	adminpage = '<?php echo $admin_body_class; ?>',
1591
-	thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
1592
-	decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
1591
+	thousandsSeparator = '<?php echo addslashes($wp_locale->number_format['thousands_sep']); ?>',
1592
+	decimalPoint = '<?php echo addslashes($wp_locale->number_format['decimal_point']); ?>',
1593 1593
 	isRtl = <?php echo (int) is_rtl(); ?>;
1594 1594
 </script>
1595 1595
 <?php
1596 1596
 /** This action is documented in wp-admin/admin-header.php */
1597
-do_action( 'admin_enqueue_scripts', $hook_suffix );
1597
+do_action('admin_enqueue_scripts', $hook_suffix);
1598 1598
 
1599 1599
 /** This action is documented in wp-admin/admin-header.php */
1600
-do_action( "admin_print_styles-$hook_suffix" );
1600
+do_action("admin_print_styles-$hook_suffix");
1601 1601
 
1602 1602
 /** This action is documented in wp-admin/admin-header.php */
1603
-do_action( 'admin_print_styles' );
1603
+do_action('admin_print_styles');
1604 1604
 
1605 1605
 /** This action is documented in wp-admin/admin-header.php */
1606
-do_action( "admin_print_scripts-$hook_suffix" );
1606
+do_action("admin_print_scripts-$hook_suffix");
1607 1607
 
1608 1608
 /** This action is documented in wp-admin/admin-header.php */
1609
-do_action( 'admin_print_scripts' );
1609
+do_action('admin_print_scripts');
1610 1610
 
1611 1611
 /** This action is documented in wp-admin/admin-header.php */
1612
-do_action( "admin_head-$hook_suffix" );
1612
+do_action("admin_head-$hook_suffix");
1613 1613
 
1614 1614
 /** This action is documented in wp-admin/admin-header.php */
1615
-do_action( 'admin_head' );
1615
+do_action('admin_head');
1616 1616
 
1617
-$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
1617
+$admin_body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_locale())));
1618 1618
 
1619
-if ( is_rtl() )
1619
+if (is_rtl())
1620 1620
 	$admin_body_class .= ' rtl';
1621 1621
 
1622 1622
 ?>
1623 1623
 </head>
1624 1624
 <?php
1625 1625
 /** This filter is documented in wp-admin/admin-header.php */
1626
-$admin_body_classes = apply_filters( 'admin_body_class', '' );
1626
+$admin_body_classes = apply_filters('admin_body_class', '');
1627 1627
 ?>
1628 1628
 <body<?php
1629 1629
 /**
1630 1630
  * @global string $body_id
1631 1631
  */
1632
-if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1632
+if (isset($GLOBALS['body_id'])) echo ' id="'.$GLOBALS['body_id'].'"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes.' '.$admin_body_class; ?>">
1633 1633
 <script type="text/javascript">
1634 1634
 (function(){
1635 1635
 var c = document.body.className;
@@ -1655,10 +1655,10 @@  discard block
 block discarded – undo
1655 1655
 	<div class="hidden">
1656 1656
 <?php
1657 1657
 	/** This action is documented in wp-admin/admin-footer.php */
1658
-	do_action( 'admin_footer', '' );
1658
+	do_action('admin_footer', '');
1659 1659
 
1660 1660
 	/** This action is documented in wp-admin/admin-footer.php */
1661
-	do_action( 'admin_print_footer_scripts' );
1661
+	do_action('admin_print_footer_scripts');
1662 1662
 ?>
1663 1663
 	</div>
1664 1664
 <script type="text/javascript">if(typeof wpOnload=="function")wpOnload();</script>
@@ -1673,33 +1673,33 @@  discard block
 block discarded – undo
1673 1673
  */
1674 1674
 function _post_states($post) {
1675 1675
 	$post_states = array();
1676
-	if ( isset( $_REQUEST['post_status'] ) )
1676
+	if (isset($_REQUEST['post_status']))
1677 1677
 		$post_status = $_REQUEST['post_status'];
1678 1678
 	else
1679 1679
 		$post_status = '';
1680 1680
 
1681
-	if ( !empty($post->post_password) )
1681
+	if ( ! empty($post->post_password))
1682 1682
 		$post_states['protected'] = __('Password protected');
1683
-	if ( 'private' == $post->post_status && 'private' != $post_status )
1683
+	if ('private' == $post->post_status && 'private' != $post_status)
1684 1684
 		$post_states['private'] = __('Private');
1685
-	if ( 'draft' == $post->post_status && 'draft' != $post_status )
1685
+	if ('draft' == $post->post_status && 'draft' != $post_status)
1686 1686
 		$post_states['draft'] = __('Draft');
1687
-	if ( 'pending' == $post->post_status && 'pending' != $post_status )
1687
+	if ('pending' == $post->post_status && 'pending' != $post_status)
1688 1688
 		$post_states['pending'] = _x('Pending', 'post status');
1689
-	if ( is_sticky($post->ID) )
1689
+	if (is_sticky($post->ID))
1690 1690
 		$post_states['sticky'] = __('Sticky');
1691 1691
 
1692
-	if ( 'future' === $post->post_status ) {
1693
-		$post_states['scheduled'] = __( 'Scheduled' );
1692
+	if ('future' === $post->post_status) {
1693
+		$post_states['scheduled'] = __('Scheduled');
1694 1694
 	}
1695 1695
 
1696
-	if ( 'page' === get_option( 'show_on_front' ) ) {
1697
-		if ( intval( get_option( 'page_on_front' ) ) === $post->ID ) {
1698
-			$post_states['page_on_front'] = __( 'Front Page' );
1696
+	if ('page' === get_option('show_on_front')) {
1697
+		if (intval(get_option('page_on_front')) === $post->ID) {
1698
+			$post_states['page_on_front'] = __('Front Page');
1699 1699
 		}
1700 1700
 
1701
-		if ( intval( get_option( 'page_for_posts' ) ) === $post->ID ) {
1702
-			$post_states['page_for_posts'] = __( 'Posts Page' );
1701
+		if (intval(get_option('page_for_posts')) === $post->ID) {
1702
+			$post_states['page_for_posts'] = __('Posts Page');
1703 1703
 		}
1704 1704
 	}
1705 1705
 
@@ -1711,15 +1711,15 @@  discard block
 block discarded – undo
1711 1711
 	 * @param array   $post_states An array of post display states.
1712 1712
 	 * @param WP_Post $post        The current post object.
1713 1713
 	 */
1714
-	$post_states = apply_filters( 'display_post_states', $post_states, $post );
1714
+	$post_states = apply_filters('display_post_states', $post_states, $post);
1715 1715
 
1716
-	if ( ! empty($post_states) ) {
1716
+	if ( ! empty($post_states)) {
1717 1717
 		$state_count = count($post_states);
1718 1718
 		$i = 0;
1719 1719
 		echo ' &mdash; ';
1720
-		foreach ( $post_states as $state ) {
1720
+		foreach ($post_states as $state) {
1721 1721
 			++$i;
1722
-			( $i == $state_count ) ? $sep = '' : $sep = ', ';
1722
+			($i == $state_count) ? $sep = '' : $sep = ', ';
1723 1723
 			echo "<span class='post-state'>$state$sep</span>";
1724 1724
 		}
1725 1725
 	}
@@ -1730,28 +1730,28 @@  discard block
 block discarded – undo
1730 1730
  *
1731 1731
  * @param WP_Post $post
1732 1732
  */
1733
-function _media_states( $post ) {
1733
+function _media_states($post) {
1734 1734
 	$media_states = array();
1735 1735
 	$stylesheet = get_option('stylesheet');
1736 1736
 
1737
-	if ( current_theme_supports( 'custom-header') ) {
1738
-		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
1739
-		if ( ! empty( $meta_header ) && $meta_header == $stylesheet )
1740
-			$media_states[] = __( 'Header Image' );
1737
+	if (current_theme_supports('custom-header')) {
1738
+		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true);
1739
+		if ( ! empty($meta_header) && $meta_header == $stylesheet)
1740
+			$media_states[] = __('Header Image');
1741 1741
 	}
1742 1742
 
1743
-	if ( current_theme_supports( 'custom-background') ) {
1744
-		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
1745
-		if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
1746
-			$media_states[] = __( 'Background Image' );
1743
+	if (current_theme_supports('custom-background')) {
1744
+		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true);
1745
+		if ( ! empty($meta_background) && $meta_background == $stylesheet)
1746
+			$media_states[] = __('Background Image');
1747 1747
 	}
1748 1748
 
1749
-	if ( $post->ID == get_option( 'site_icon' ) ) {
1750
-		$media_states[] = __( 'Site Icon' );
1749
+	if ($post->ID == get_option('site_icon')) {
1750
+		$media_states[] = __('Site Icon');
1751 1751
 	}
1752 1752
 
1753
-	if ( $post->ID == get_theme_mod( 'site_logo' ) ) {
1754
-		$media_states[] = __( 'Logo' );
1753
+	if ($post->ID == get_theme_mod('site_logo')) {
1754
+		$media_states[] = __('Logo');
1755 1755
 	}
1756 1756
 
1757 1757
 	/**
@@ -1762,15 +1762,15 @@  discard block
 block discarded – undo
1762 1762
 	 * @param array $media_states An array of media states. Default 'Header Image',
1763 1763
 	 *                            'Background Image', 'Site Icon', 'Logo'.
1764 1764
 	 */
1765
-	$media_states = apply_filters( 'display_media_states', $media_states );
1765
+	$media_states = apply_filters('display_media_states', $media_states);
1766 1766
 
1767
-	if ( ! empty( $media_states ) ) {
1768
-		$state_count = count( $media_states );
1767
+	if ( ! empty($media_states)) {
1768
+		$state_count = count($media_states);
1769 1769
 		$i = 0;
1770 1770
 		echo ' &mdash; ';
1771
-		foreach ( $media_states as $state ) {
1771
+		foreach ($media_states as $state) {
1772 1772
 			++$i;
1773
-			( $i == $state_count ) ? $sep = '' : $sep = ', ';
1773
+			($i == $state_count) ? $sep = '' : $sep = ', ';
1774 1774
 			echo "<span class='post-state'>$state$sep</span>";
1775 1775
 		}
1776 1776
 	}
@@ -1861,8 +1861,8 @@  discard block
 block discarded – undo
1861 1861
  *                                       as a string such as 'tabindex="1"', though the array format is
1862 1862
  *                                       preferred. Default null.
1863 1863
  */
1864
-function submit_button( $text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null ) {
1865
-	echo get_submit_button( $text, $type, $name, $wrap, $other_attributes );
1864
+function submit_button($text = null, $type = 'primary', $name = 'submit', $wrap = true, $other_attributes = null) {
1865
+	echo get_submit_button($text, $type, $name, $wrap, $other_attributes);
1866 1866
 }
1867 1867
 
1868 1868
 /**
@@ -1886,49 +1886,49 @@  discard block
 block discarded – undo
1886 1886
  *                                       Default empty.
1887 1887
  * @return string Submit button HTML.
1888 1888
  */
1889
-function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
1890
-	if ( ! is_array( $type ) )
1891
-		$type = explode( ' ', $type );
1892
-
1893
-	$button_shorthand = array( 'primary', 'small', 'large' );
1894
-	$classes = array( 'button' );
1895
-	foreach ( $type as $t ) {
1896
-		if ( 'secondary' === $t || 'button-secondary' === $t )
1889
+function get_submit_button($text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '') {
1890
+	if ( ! is_array($type))
1891
+		$type = explode(' ', $type);
1892
+
1893
+	$button_shorthand = array('primary', 'small', 'large');
1894
+	$classes = array('button');
1895
+	foreach ($type as $t) {
1896
+		if ('secondary' === $t || 'button-secondary' === $t)
1897 1897
 			continue;
1898
-		$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
1898
+		$classes[] = in_array($t, $button_shorthand) ? 'button-'.$t : $t;
1899 1899
 	}
1900
-	$class = implode( ' ', array_unique( $classes ) );
1900
+	$class = implode(' ', array_unique($classes));
1901 1901
 
1902
-	if ( 'delete' === $type )
1902
+	if ('delete' === $type)
1903 1903
 		$class = 'button-secondary delete';
1904 1904
 
1905
-	$text = $text ? $text : __( 'Save Changes' );
1905
+	$text = $text ? $text : __('Save Changes');
1906 1906
 
1907 1907
 	// Default the id attribute to $name unless an id was specifically provided in $other_attributes
1908 1908
 	$id = $name;
1909
-	if ( is_array( $other_attributes ) && isset( $other_attributes['id'] ) ) {
1909
+	if (is_array($other_attributes) && isset($other_attributes['id'])) {
1910 1910
 		$id = $other_attributes['id'];
1911
-		unset( $other_attributes['id'] );
1911
+		unset($other_attributes['id']);
1912 1912
 	}
1913 1913
 
1914 1914
 	$attributes = '';
1915
-	if ( is_array( $other_attributes ) ) {
1916
-		foreach ( $other_attributes as $attribute => $value ) {
1917
-			$attributes .= $attribute . '="' . esc_attr( $value ) . '" '; // Trailing space is important
1915
+	if (is_array($other_attributes)) {
1916
+		foreach ($other_attributes as $attribute => $value) {
1917
+			$attributes .= $attribute.'="'.esc_attr($value).'" '; // Trailing space is important
1918 1918
 		}
1919
-	} elseif ( ! empty( $other_attributes ) ) { // Attributes provided as a string
1919
+	} elseif ( ! empty($other_attributes)) { // Attributes provided as a string
1920 1920
 		$attributes = $other_attributes;
1921 1921
 	}
1922 1922
 
1923 1923
 	// Don't output empty name and id attributes.
1924
-	$name_attr = $name ? ' name="' . esc_attr( $name ) . '"' : '';
1925
-	$id_attr = $id ? ' id="' . esc_attr( $id ) . '"' : '';
1924
+	$name_attr = $name ? ' name="'.esc_attr($name).'"' : '';
1925
+	$id_attr = $id ? ' id="'.esc_attr($id).'"' : '';
1926 1926
 
1927
-	$button = '<input type="submit"' . $name_attr . $id_attr . ' class="' . esc_attr( $class );
1928
-	$button	.= '" value="' . esc_attr( $text ) . '" ' . $attributes . ' />';
1927
+	$button = '<input type="submit"'.$name_attr.$id_attr.' class="'.esc_attr($class);
1928
+	$button	.= '" value="'.esc_attr($text).'" '.$attributes.' />';
1929 1929
 
1930
-	if ( $wrap ) {
1931
-		$button = '<p class="submit">' . $button . '</p>';
1930
+	if ($wrap) {
1931
+		$button = '<p class="submit">'.$button.'</p>';
1932 1932
 	}
1933 1933
 
1934 1934
 	return $button;
@@ -1941,9 +1941,9 @@  discard block
 block discarded – undo
1941 1941
 function _wp_admin_html_begin() {
1942 1942
 	global $is_IE;
1943 1943
 
1944
-	$admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
1944
+	$admin_html_class = (is_admin_bar_showing()) ? 'wp-toolbar' : '';
1945 1945
 
1946
-	if ( $is_IE )
1946
+	if ($is_IE)
1947 1947
 		@header('X-UA-Compatible: IE=edge');
1948 1948
 
1949 1949
 ?>
@@ -1955,13 +1955,13 @@  discard block
 block discarded – undo
1955 1955
 	 *
1956 1956
 	 * @since 2.2.0
1957 1957
 	 */
1958
-	do_action( 'admin_xml_ns' );
1958
+	do_action('admin_xml_ns');
1959 1959
 ?> <?php language_attributes(); ?>>
1960 1960
 <![endif]-->
1961 1961
 <!--[if !(IE 8) ]><!-->
1962 1962
 <html xmlns="http://www.w3.org/1999/xhtml" class="<?php echo $admin_html_class; ?>" <?php
1963 1963
 	/** This action is documented in wp-admin/includes/template.php */
1964
-	do_action( 'admin_xml_ns' );
1964
+	do_action('admin_xml_ns');
1965 1965
 ?> <?php language_attributes(); ?>>
1966 1966
 <!--<![endif]-->
1967 1967
 <head>
@@ -1977,13 +1977,13 @@  discard block
 block discarded – undo
1977 1977
  * @param string $hook_name The hook name (also known as the hook suffix) used to determine the screen.
1978 1978
  * @return WP_Screen Screen object.
1979 1979
  */
1980
-function convert_to_screen( $hook_name ) {
1981
-	if ( ! class_exists( 'WP_Screen', false ) ) {
1982
-		_doing_it_wrong( 'convert_to_screen(), add_meta_box()', __( "Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead." ), '3.3' );
1983
-		return (object) array( 'id' => '_invalid', 'base' => '_are_belong_to_us' );
1980
+function convert_to_screen($hook_name) {
1981
+	if ( ! class_exists('WP_Screen', false)) {
1982
+		_doing_it_wrong('convert_to_screen(), add_meta_box()', __("Likely direct inclusion of wp-admin/includes/template.php in order to use add_meta_box(). This is very wrong. Hook the add_meta_box() call into the add_meta_boxes action instead."), '3.3');
1983
+		return (object) array('id' => '_invalid', 'base' => '_are_belong_to_us');
1984 1984
 	}
1985 1985
 
1986
-	return WP_Screen::get( $hook_name );
1986
+	return WP_Screen::get($hook_name);
1987 1987
 }
1988 1988
 
1989 1989
 /**
@@ -2029,45 +2029,45 @@  discard block
 block discarded – undo
2029 2029
  *                          of echoing it. Default true.
2030 2030
  * }
2031 2031
  */
2032
-function wp_star_rating( $args = array() ) {
2032
+function wp_star_rating($args = array()) {
2033 2033
 	$defaults = array(
2034 2034
 		'rating' => 0,
2035 2035
 		'type'   => 'rating',
2036 2036
 		'number' => 0,
2037 2037
 		'echo'   => true,
2038 2038
 	);
2039
-	$r = wp_parse_args( $args, $defaults );
2039
+	$r = wp_parse_args($args, $defaults);
2040 2040
 
2041 2041
 	// Non-english decimal places when the $rating is coming from a string
2042
-	$rating = str_replace( ',', '.', $r['rating'] );
2042
+	$rating = str_replace(',', '.', $r['rating']);
2043 2043
 
2044 2044
 	// Convert Percentage to star rating, 0..5 in .5 increments
2045
-	if ( 'percent' == $r['type'] ) {
2046
-		$rating = round( $rating / 10, 0 ) / 2;
2045
+	if ('percent' == $r['type']) {
2046
+		$rating = round($rating / 10, 0) / 2;
2047 2047
 	}
2048 2048
 
2049 2049
 	// Calculate the number of each type of star needed
2050
-	$full_stars = floor( $rating );
2051
-	$half_stars = ceil( $rating - $full_stars );
2050
+	$full_stars = floor($rating);
2051
+	$half_stars = ceil($rating - $full_stars);
2052 2052
 	$empty_stars = 5 - $full_stars - $half_stars;
2053 2053
 
2054
-	if ( $r['number'] ) {
2054
+	if ($r['number']) {
2055 2055
 		/* translators: 1: The rating, 2: The number of ratings */
2056
-		$format = _n( '%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number'] );
2057
-		$title = sprintf( $format, number_format_i18n( $rating, 1 ), number_format_i18n( $r['number'] ) );
2056
+		$format = _n('%1$s rating based on %2$s rating', '%1$s rating based on %2$s ratings', $r['number']);
2057
+		$title = sprintf($format, number_format_i18n($rating, 1), number_format_i18n($r['number']));
2058 2058
 	} else {
2059 2059
 		/* translators: 1: The rating */
2060
-		$title = sprintf( __( '%s rating' ), number_format_i18n( $rating, 1 ) );
2060
+		$title = sprintf(__('%s rating'), number_format_i18n($rating, 1));
2061 2061
 	}
2062 2062
 
2063 2063
 	$output = '<div class="star-rating">';
2064
-	$output .= '<span class="screen-reader-text">' . $title . '</span>';
2065
-	$output .= str_repeat( '<div class="star star-full"></div>', $full_stars );
2066
-	$output .= str_repeat( '<div class="star star-half"></div>', $half_stars );
2067
-	$output .= str_repeat( '<div class="star star-empty"></div>', $empty_stars );
2064
+	$output .= '<span class="screen-reader-text">'.$title.'</span>';
2065
+	$output .= str_repeat('<div class="star star-full"></div>', $full_stars);
2066
+	$output .= str_repeat('<div class="star star-half"></div>', $half_stars);
2067
+	$output .= str_repeat('<div class="star star-empty"></div>', $empty_stars);
2068 2068
 	$output .= '</div>';
2069 2069
 
2070
-	if ( $r['echo'] ) {
2070
+	if ($r['echo']) {
2071 2071
 		echo $output;
2072 2072
 	}
2073 2073
 
@@ -2081,5 +2081,5 @@  discard block
 block discarded – undo
2081 2081
  * @since 4.2.0
2082 2082
  */
2083 2083
 function _wp_posts_page_notice() {
2084
-	echo '<div class="notice notice-warning inline"><p>' . __( 'You are currently editing the page that shows your latest posts.' ) . '</p></div>';
2084
+	echo '<div class="notice notice-warning inline"><p>'.__('You are currently editing the page that shows your latest posts.').'</p></div>';
2085 2085
 }
Please login to merge, or discard this patch.
Braces   +212 added lines, -137 removed lines patch added patch discarded remove patch
@@ -191,10 +191,11 @@  discard block
 block discarded – undo
191 191
 function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
192 192
 	$post = get_post();
193 193
 
194
-	if ( $post && $post->ID )
195
-		$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196
-	else
197
-		$checked_terms = array();
194
+	if ( $post && $post->ID ) {
195
+			$checked_terms = wp_get_object_terms($post->ID, $taxonomy, array('fields'=>'ids'));
196
+	} else {
197
+			$checked_terms = array();
198
+	}
198 199
 
199 200
 	$terms = get_terms( $taxonomy, array( 'orderby' => 'count', 'order' => 'DESC', 'number' => $number, 'hierarchical' => false ) );
200 201
 
@@ -203,8 +204,10 @@  discard block
 block discarded – undo
203 204
 	$popular_ids = array();
204 205
 	foreach ( (array) $terms as $term ) {
205 206
 		$popular_ids[] = $term->term_id;
206
-		if ( !$echo ) // hack for AJAX use
207
+		if ( !$echo ) {
208
+			// hack for AJAX use
207 209
 			continue;
210
+		}
208 211
 		$id = "popular-$taxonomy-$term->term_id";
209 212
 		$checked = in_array( $term->term_id, $checked_terms ) ? 'checked="checked"' : '';
210 213
 		?>
@@ -248,8 +251,9 @@  discard block
 block discarded – undo
248 251
 
249 252
 	$categories = get_terms( 'link_category', array( 'orderby' => 'name', 'hide_empty' => 0 ) );
250 253
 
251
-	if ( empty( $categories ) )
252
-		return;
254
+	if ( empty( $categories ) ) {
255
+			return;
256
+	}
253 257
 
254 258
 	foreach ( $categories as $category ) {
255 259
 		$cat_id = $category->term_id;
@@ -270,8 +274,9 @@  discard block
 block discarded – undo
270 274
  */
271 275
 function get_inline_data($post) {
272 276
 	$post_type_object = get_post_type_object($post->post_type);
273
-	if ( ! current_user_can( 'edit_post', $post->ID ) )
274
-		return;
277
+	if ( ! current_user_can( 'edit_post', $post->ID ) ) {
278
+			return;
279
+	}
275 280
 
276 281
 	$title = esc_textarea( trim( $post->post_title ) );
277 282
 
@@ -293,14 +298,17 @@  discard block
 block discarded – undo
293 298
 	<div class="ss">' . mysql2date( 's', $post->post_date, false ) . '</div>
294 299
 	<div class="post_password">' . esc_html( $post->post_password ) . '</div>';
295 300
 
296
-	if ( $post_type_object->hierarchical )
297
-		echo '<div class="post_parent">' . $post->post_parent . '</div>';
301
+	if ( $post_type_object->hierarchical ) {
302
+			echo '<div class="post_parent">' . $post->post_parent . '</div>';
303
+	}
298 304
 
299
-	if ( $post->post_type == 'page' )
300
-		echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
305
+	if ( $post->post_type == 'page' ) {
306
+			echo '<div class="page_template">' . esc_html( get_post_meta( $post->ID, '_wp_page_template', true ) ) . '</div>';
307
+	}
301 308
 
302
-	if ( post_type_supports( $post->post_type, 'page-attributes' ) )
303
-		echo '<div class="menu_order">' . $post->menu_order . '</div>';
309
+	if ( post_type_supports( $post->post_type, 'page-attributes' ) ) {
310
+			echo '<div class="menu_order">' . $post->menu_order . '</div>';
311
+	}
304 312
 
305 313
 	$taxonomy_names = get_object_taxonomies( $post->post_type );
306 314
 	foreach ( $taxonomy_names as $taxonomy_name) {
@@ -330,11 +338,13 @@  discard block
 block discarded – undo
330 338
 		}
331 339
 	}
332 340
 
333
-	if ( !$post_type_object->hierarchical )
334
-		echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
341
+	if ( !$post_type_object->hierarchical ) {
342
+			echo '<div class="sticky">' . (is_sticky($post->ID) ? 'sticky' : '') . '</div>';
343
+	}
335 344
 
336
-	if ( post_type_supports( $post->post_type, 'post-formats' ) )
337
-		echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
345
+	if ( post_type_supports( $post->post_type, 'post-formats' ) ) {
346
+			echo '<div class="post_format">' . esc_html( get_post_format( $post->ID ) ) . '</div>';
347
+	}
338 348
 
339 349
 	echo '</div>';
340 350
 }
@@ -387,9 +397,12 @@  discard block
 block discarded – undo
387 397
 <form method="get">
388 398
 <?php if ( $table_row ) : ?>
389 399
 <table style="display:none;"><tbody id="com-reply"><tr id="replyrow" class="inline-edit-row" style="display:none;"><td colspan="<?php echo $wp_list_table->get_column_count(); ?>" class="colspanchange">
390
-<?php else : ?>
400
+<?php else {
401
+	: ?>
391 402
 <div id="com-reply" style="display:none;"><div id="replyrow" style="display:none;">
392
-<?php endif; ?>
403
+<?php endif;
404
+}
405
+?>
393 406
 	<fieldset class="comment-reply">
394 407
 	<legend>
395 408
 		<span class="hidden" id="editlegend"><?php _e( 'Edit Comment' ); ?></span>
@@ -441,15 +454,19 @@  discard block
 block discarded – undo
441 454
 	<input type="hidden" name="mode" id="mode" value="<?php echo esc_attr($mode); ?>" />
442 455
 	<?php
443 456
 		wp_nonce_field( 'replyto-comment', '_ajax_nonce-replyto-comment', false );
444
-		if ( current_user_can( 'unfiltered_html' ) )
445
-			wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
457
+		if ( current_user_can( 'unfiltered_html' ) ) {
458
+					wp_nonce_field( 'unfiltered-html-comment', '_wp_unfiltered_html_comment', false );
459
+		}
446 460
 	?>
447 461
 	</fieldset>
448 462
 <?php if ( $table_row ) : ?>
449 463
 </td></tr></tbody></table>
450
-<?php else : ?>
464
+<?php else {
465
+	: ?>
451 466
 </div></div>
452
-<?php endif; ?>
467
+<?php endif;
468
+}
469
+?>
453 470
 </form>
454 471
 <?php
455 472
 }
@@ -505,9 +522,10 @@  discard block
 block discarded – undo
505 522
 	</thead>
506 523
 	<tbody id='the-list' data-wp-lists='list:meta'>
507 524
 <?php
508
-	foreach ( $meta as $entry )
509
-		echo _list_meta_row( $entry, $count );
510
-?>
525
+	foreach ( $meta as $entry ) {
526
+			echo _list_meta_row( $entry, $count );
527
+	}
528
+	?>
511 529
 	</tbody>
512 530
 </table>
513 531
 <?php
@@ -527,11 +545,13 @@  discard block
 block discarded – undo
527 545
 function _list_meta_row( $entry, &$count ) {
528 546
 	static $update_nonce = '';
529 547
 
530
-	if ( is_protected_meta( $entry['meta_key'], 'post' ) )
531
-		return '';
548
+	if ( is_protected_meta( $entry['meta_key'], 'post' ) ) {
549
+			return '';
550
+	}
532 551
 
533
-	if ( ! $update_nonce )
534
-		$update_nonce = wp_create_nonce( 'add-meta' );
552
+	if ( ! $update_nonce ) {
553
+			$update_nonce = wp_create_nonce( 'add-meta' );
554
+	}
535 555
 
536 556
 	$r = '';
537 557
 	++ $count;
@@ -638,8 +658,9 @@  discard block
 block discarded – undo
638 658
 <?php
639 659
 
640 660
 	foreach ( $keys as $key ) {
641
-		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) )
642
-			continue;
661
+		if ( is_protected_meta( $key, 'post' ) || ! current_user_can( 'add_post_meta', $post->ID, $key ) ) {
662
+					continue;
663
+		}
643 664
 		echo "\n<option value='" . esc_attr($key) . "'>" . esc_html($key) . "</option>";
644 665
 	}
645 666
 ?>
@@ -685,12 +706,14 @@  discard block
 block discarded – undo
685 706
 	global $wp_locale;
686 707
 	$post = get_post();
687 708
 
688
-	if ( $for_post )
689
-		$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
709
+	if ( $for_post ) {
710
+			$edit = ! ( in_array($post->post_status, array('draft', 'pending') ) && (!$post->post_date_gmt || '0000-00-00 00:00:00' == $post->post_date_gmt ) );
711
+	}
690 712
 
691 713
 	$tab_index_attribute = '';
692
-	if ( (int) $tab_index > 0 )
693
-		$tab_index_attribute = " tabindex=\"$tab_index\"";
714
+	if ( (int) $tab_index > 0 ) {
715
+			$tab_index_attribute = " tabindex=\"$tab_index\"";
716
+	}
694 717
 
695 718
 	// todo: Remove this?
696 719
 	// echo '<label for="timestamp" style="display: block;"><input type="checkbox" class="checkbox" name="edit_date" value="1" id="timestamp"'.$tab_index_attribute.' /> '.__( 'Edit timestamp' ).'</label><br />';
@@ -731,7 +754,9 @@  discard block
 block discarded – undo
731 754
 
732 755
 	echo '</div><input type="hidden" id="ss" name="ss" value="' . $ss . '" />';
733 756
 
734
-	if ( $multi ) return;
757
+	if ( $multi ) {
758
+		return;
759
+	}
735 760
 
736 761
 	echo "\n\n";
737 762
 	$map = array(
@@ -796,8 +821,9 @@  discard block
 block discarded – undo
796 821
 	if ( $items ) {
797 822
 		foreach ( $items as $item ) {
798 823
 			// A page cannot be its own parent.
799
-			if ( $post && $post->ID && $item->ID == $post->ID )
800
-				continue;
824
+			if ( $post && $post->ID && $item->ID == $post->ID ) {
825
+							continue;
826
+			}
801 827
 
802 828
 			$pad = str_repeat( '&nbsp;', $level * 3 );
803 829
 			$selected = selected( $default, $item->ID, false );
@@ -825,10 +851,12 @@  discard block
 block discarded – undo
825 851
 
826 852
 	foreach ( $editable_roles as $role => $details ) {
827 853
 		$name = translate_user_role($details['name'] );
828
-		if ( $selected == $role ) // preselect specified role
854
+		if ( $selected == $role ) {
855
+			// preselect specified role
829 856
 			$p = "\n\t<option selected='selected' value='" . esc_attr($role) . "'>$name</option>";
830
-		else
831
-			$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
857
+		} else {
858
+					$r .= "\n\t<option value='" . esc_attr($role) . "'>$name</option>";
859
+		}
832 860
 	}
833 861
 	echo $p . $r;
834 862
 }
@@ -857,9 +885,12 @@  discard block
 block discarded – undo
857 885
 	if ( ! empty( $upload_dir['error'] ) ) :
858 886
 		?><div class="error"><p><?php _e('Before you can upload your import file, you will need to fix the following error:'); ?></p>
859 887
 		<p><strong><?php echo $upload_dir['error']; ?></strong></p></div><?php
860
-	else :
888
+	else {
889
+		:
861 890
 ?>
862
-<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) ); ?>">
891
+<form enctype="multipart/form-data" id="import-upload-form" method="post" class="wp-upload-form" action="<?php echo esc_url( wp_nonce_url( $action, 'import-upload' ) );
892
+	}
893
+	?>">
863 894
 <p>
864 895
 <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?>)
865 896
 <input type="file" id="upload" name="import" size="25" />
@@ -919,23 +950,28 @@  discard block
 block discarded – undo
919 950
 
920 951
 	$page = $screen->id;
921 952
 
922
-	if ( !isset($wp_meta_boxes) )
923
-		$wp_meta_boxes = array();
924
-	if ( !isset($wp_meta_boxes[$page]) )
925
-		$wp_meta_boxes[$page] = array();
926
-	if ( !isset($wp_meta_boxes[$page][$context]) )
927
-		$wp_meta_boxes[$page][$context] = array();
953
+	if ( !isset($wp_meta_boxes) ) {
954
+			$wp_meta_boxes = array();
955
+	}
956
+	if ( !isset($wp_meta_boxes[$page]) ) {
957
+			$wp_meta_boxes[$page] = array();
958
+	}
959
+	if ( !isset($wp_meta_boxes[$page][$context]) ) {
960
+			$wp_meta_boxes[$page][$context] = array();
961
+	}
928 962
 
929 963
 	foreach ( array_keys($wp_meta_boxes[$page]) as $a_context ) {
930 964
 		foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
931
-			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) )
932
-				continue;
965
+			if ( !isset($wp_meta_boxes[$page][$a_context][$a_priority][$id]) ) {
966
+							continue;
967
+			}
933 968
 
934 969
 			// If a core box was previously added or removed by a plugin, don't add.
935 970
 			if ( 'core' == $priority ) {
936 971
 				// If core box previously deleted, don't add
937
-				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] )
938
-					return;
972
+				if ( false === $wp_meta_boxes[$page][$a_context][$a_priority][$id] ) {
973
+									return;
974
+				}
939 975
 
940 976
 				/*
941 977
 				 * If box was added with default priority, give it core priority to
@@ -960,16 +996,19 @@  discard block
 block discarded – undo
960 996
 				$callback_args = $wp_meta_boxes[$page][$a_context][$a_priority][$id]['args'];
961 997
 			}
962 998
 			// An id can be in only one priority and one context.
963
-			if ( $priority != $a_priority || $context != $a_context )
964
-				unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
999
+			if ( $priority != $a_priority || $context != $a_context ) {
1000
+							unset($wp_meta_boxes[$page][$a_context][$a_priority][$id]);
1001
+			}
965 1002
 		}
966 1003
 	}
967 1004
 
968
-	if ( empty($priority) )
969
-		$priority = 'low';
1005
+	if ( empty($priority) ) {
1006
+			$priority = 'low';
1007
+	}
970 1008
 
971
-	if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
972
-		$wp_meta_boxes[$page][$context][$priority] = array();
1009
+	if ( !isset($wp_meta_boxes[$page][$context][$priority]) ) {
1010
+			$wp_meta_boxes[$page][$context][$priority] = array();
1011
+	}
973 1012
 
974 1013
 	$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback, 'args' => $callback_args);
975 1014
 }
@@ -991,10 +1030,11 @@  discard block
 block discarded – undo
991 1030
 	global $wp_meta_boxes;
992 1031
 	static $already_sorted = false;
993 1032
 
994
-	if ( empty( $screen ) )
995
-		$screen = get_current_screen();
996
-	elseif ( is_string( $screen ) )
997
-		$screen = convert_to_screen( $screen );
1033
+	if ( empty( $screen ) ) {
1034
+			$screen = get_current_screen();
1035
+	} elseif ( is_string( $screen ) ) {
1036
+			$screen = convert_to_screen( $screen );
1037
+	}
998 1038
 
999 1039
 	$page = $screen->id;
1000 1040
 
@@ -1021,8 +1061,9 @@  discard block
 block discarded – undo
1021 1061
 		foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) {
1022 1062
 			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ]) ) {
1023 1063
 				foreach ( (array) $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1024
-					if ( false == $box || ! $box['title'] )
1025
-						continue;
1064
+					if ( false == $box || ! $box['title'] ) {
1065
+											continue;
1066
+					}
1026 1067
 					$i++;
1027 1068
 					$hidden_class = in_array($box['id'], $hidden) ? ' hide-if-js' : '';
1028 1069
 					echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . $hidden_class . '" ' . '>' . "\n";
@@ -1086,16 +1127,20 @@  discard block
 block discarded – undo
1086 1127
 
1087 1128
 	$page = $screen->id;
1088 1129
 
1089
-	if ( !isset($wp_meta_boxes) )
1090
-		$wp_meta_boxes = array();
1091
-	if ( !isset($wp_meta_boxes[$page]) )
1092
-		$wp_meta_boxes[$page] = array();
1093
-	if ( !isset($wp_meta_boxes[$page][$context]) )
1094
-		$wp_meta_boxes[$page][$context] = array();
1130
+	if ( !isset($wp_meta_boxes) ) {
1131
+			$wp_meta_boxes = array();
1132
+	}
1133
+	if ( !isset($wp_meta_boxes[$page]) ) {
1134
+			$wp_meta_boxes[$page] = array();
1135
+	}
1136
+	if ( !isset($wp_meta_boxes[$page][$context]) ) {
1137
+			$wp_meta_boxes[$page][$context] = array();
1138
+	}
1095 1139
 
1096
-	foreach ( array('high', 'core', 'default', 'low') as $priority )
1097
-		$wp_meta_boxes[$page][$context][$priority][$id] = false;
1098
-}
1140
+	foreach ( array('high', 'core', 'default', 'low') as $priority ) {
1141
+			$wp_meta_boxes[$page][$context][$priority][$id] = false;
1142
+	}
1143
+	}
1099 1144
 
1100 1145
 /**
1101 1146
  * Meta Box Accordion Template Function
@@ -1118,10 +1163,11 @@  discard block
 block discarded – undo
1118 1163
 
1119 1164
 	wp_enqueue_script( 'accordion' );
1120 1165
 
1121
-	if ( empty( $screen ) )
1122
-		$screen = get_current_screen();
1123
-	elseif ( is_string( $screen ) )
1124
-		$screen = convert_to_screen( $screen );
1166
+	if ( empty( $screen ) ) {
1167
+			$screen = get_current_screen();
1168
+	} elseif ( is_string( $screen ) ) {
1169
+			$screen = convert_to_screen( $screen );
1170
+	}
1125 1171
 
1126 1172
 	$page = $screen->id;
1127 1173
 
@@ -1137,8 +1183,9 @@  discard block
 block discarded – undo
1137 1183
 		foreach ( array( 'high', 'core', 'default', 'low' ) as $priority ) {
1138 1184
 			if ( isset( $wp_meta_boxes[ $page ][ $context ][ $priority ] ) ) {
1139 1185
 				foreach ( $wp_meta_boxes[ $page ][ $context ][ $priority ] as $box ) {
1140
-					if ( false == $box || ! $box['title'] )
1141
-						continue;
1186
+					if ( false == $box || ! $box['title'] ) {
1187
+											continue;
1188
+					}
1142 1189
 					$i++;
1143 1190
 					$hidden_class = in_array( $box['id'], $hidden ) ? 'hide-if-js' : '';
1144 1191
 
@@ -1276,18 +1323,22 @@  discard block
 block discarded – undo
1276 1323
 function do_settings_sections( $page ) {
1277 1324
 	global $wp_settings_sections, $wp_settings_fields;
1278 1325
 
1279
-	if ( ! isset( $wp_settings_sections[$page] ) )
1280
-		return;
1326
+	if ( ! isset( $wp_settings_sections[$page] ) ) {
1327
+			return;
1328
+	}
1281 1329
 
1282 1330
 	foreach ( (array) $wp_settings_sections[$page] as $section ) {
1283
-		if ( $section['title'] )
1284
-			echo "<h2>{$section['title']}</h2>\n";
1331
+		if ( $section['title'] ) {
1332
+					echo "<h2>{$section['title']}</h2>\n";
1333
+		}
1285 1334
 
1286
-		if ( $section['callback'] )
1287
-			call_user_func( $section['callback'], $section );
1335
+		if ( $section['callback'] ) {
1336
+					call_user_func( $section['callback'], $section );
1337
+		}
1288 1338
 
1289
-		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) )
1290
-			continue;
1339
+		if ( ! isset( $wp_settings_fields ) || !isset( $wp_settings_fields[$page] ) || !isset( $wp_settings_fields[$page][$section['id']] ) ) {
1340
+					continue;
1341
+		}
1291 1342
 		echo '<table class="form-table">';
1292 1343
 		do_settings_fields( $page, $section['id'] );
1293 1344
 		echo '</table>';
@@ -1311,8 +1362,9 @@  discard block
 block discarded – undo
1311 1362
 function do_settings_fields($page, $section) {
1312 1363
 	global $wp_settings_fields;
1313 1364
 
1314
-	if ( ! isset( $wp_settings_fields[$page][$section] ) )
1315
-		return;
1365
+	if ( ! isset( $wp_settings_fields[$page][$section] ) ) {
1366
+			return;
1367
+	}
1316 1368
 
1317 1369
 	foreach ( (array) $wp_settings_fields[$page][$section] as $field ) {
1318 1370
 		$class = '';
@@ -1401,8 +1453,9 @@  discard block
 block discarded – undo
1401 1453
 	 * This allows the $sanitize_callback from register_setting() to run, adding
1402 1454
 	 * any settings errors you want to show by default.
1403 1455
 	 */
1404
-	if ( $sanitize )
1405
-		sanitize_option( $setting, get_option( $setting ) );
1456
+	if ( $sanitize ) {
1457
+			sanitize_option( $setting, get_option( $setting ) );
1458
+	}
1406 1459
 
1407 1460
 	// If settings were passed back from options.php then use them.
1408 1461
 	if ( isset( $_GET['settings-updated'] ) && $_GET['settings-updated'] && get_transient( 'settings_errors' ) ) {
@@ -1411,15 +1464,17 @@  discard block
 block discarded – undo
1411 1464
 	}
1412 1465
 
1413 1466
 	// Check global in case errors have been added on this pageload.
1414
-	if ( ! count( $wp_settings_errors ) )
1415
-		return array();
1467
+	if ( ! count( $wp_settings_errors ) ) {
1468
+			return array();
1469
+	}
1416 1470
 
1417 1471
 	// Filter the results to those of a specific setting if one was set.
1418 1472
 	if ( $setting ) {
1419 1473
 		$setting_errors = array();
1420 1474
 		foreach ( (array) $wp_settings_errors as $key => $details ) {
1421
-			if ( $setting == $details['setting'] )
1422
-				$setting_errors[] = $wp_settings_errors[$key];
1475
+			if ( $setting == $details['setting'] ) {
1476
+							$setting_errors[] = $wp_settings_errors[$key];
1477
+			}
1423 1478
 		}
1424 1479
 		return $setting_errors;
1425 1480
 	}
@@ -1455,13 +1510,15 @@  discard block
 block discarded – undo
1455 1510
  */
1456 1511
 function settings_errors( $setting = '', $sanitize = false, $hide_on_update = false ) {
1457 1512
 
1458
-	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) )
1459
-		return;
1513
+	if ( $hide_on_update && ! empty( $_GET['settings-updated'] ) ) {
1514
+			return;
1515
+	}
1460 1516
 
1461 1517
 	$settings_errors = get_settings_errors( $setting, $sanitize );
1462 1518
 
1463
-	if ( empty( $settings_errors ) )
1464
-		return;
1519
+	if ( empty( $settings_errors ) ) {
1520
+			return;
1521
+	}
1465 1522
 
1466 1523
 	$output = '';
1467 1524
 	foreach ( $settings_errors as $key => $details ) {
@@ -1521,9 +1578,10 @@  discard block
 block discarded – undo
1521 1578
  */
1522 1579
 function the_post_password() {
1523 1580
 	$post = get_post();
1524
-	if ( isset( $post->post_password ) )
1525
-		echo esc_attr( $post->post_password );
1526
-}
1581
+	if ( isset( $post->post_password ) ) {
1582
+			echo esc_attr( $post->post_password );
1583
+	}
1584
+	}
1527 1585
 
1528 1586
 /**
1529 1587
  * Get the post title.
@@ -1538,8 +1596,9 @@  discard block
 block discarded – undo
1538 1596
  */
1539 1597
 function _draft_or_post_title( $post = 0 ) {
1540 1598
 	$title = get_the_title( $post );
1541
-	if ( empty( $title ) )
1542
-		$title = __( '(no title)' );
1599
+	if ( empty( $title ) ) {
1600
+			$title = __( '(no title)' );
1601
+	}
1543 1602
 	return esc_html( $title );
1544 1603
 }
1545 1604
 
@@ -1616,8 +1675,9 @@  discard block
 block discarded – undo
1616 1675
 
1617 1676
 $admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_locale() ) ) );
1618 1677
 
1619
-if ( is_rtl() )
1678
+if ( is_rtl() ) {
1620 1679
 	$admin_body_class .= ' rtl';
1680
+}
1621 1681
 
1622 1682
 ?>
1623 1683
 </head>
@@ -1629,7 +1689,10 @@  discard block
 block discarded – undo
1629 1689
 /**
1630 1690
  * @global string $body_id
1631 1691
  */
1632
-if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1692
+if ( isset($GLOBALS['body_id']) ) {
1693
+	echo ' id="' . $GLOBALS['body_id'] . '"';
1694
+}
1695
+?> class="wp-admin wp-core-ui no-js iframe <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1633 1696
 <script type="text/javascript">
1634 1697
 (function(){
1635 1698
 var c = document.body.className;
@@ -1673,21 +1736,27 @@  discard block
 block discarded – undo
1673 1736
  */
1674 1737
 function _post_states($post) {
1675 1738
 	$post_states = array();
1676
-	if ( isset( $_REQUEST['post_status'] ) )
1677
-		$post_status = $_REQUEST['post_status'];
1678
-	else
1679
-		$post_status = '';
1680
-
1681
-	if ( !empty($post->post_password) )
1682
-		$post_states['protected'] = __('Password protected');
1683
-	if ( 'private' == $post->post_status && 'private' != $post_status )
1684
-		$post_states['private'] = __('Private');
1685
-	if ( 'draft' == $post->post_status && 'draft' != $post_status )
1686
-		$post_states['draft'] = __('Draft');
1687
-	if ( 'pending' == $post->post_status && 'pending' != $post_status )
1688
-		$post_states['pending'] = _x('Pending', 'post status');
1689
-	if ( is_sticky($post->ID) )
1690
-		$post_states['sticky'] = __('Sticky');
1739
+	if ( isset( $_REQUEST['post_status'] ) ) {
1740
+			$post_status = $_REQUEST['post_status'];
1741
+	} else {
1742
+			$post_status = '';
1743
+	}
1744
+
1745
+	if ( !empty($post->post_password) ) {
1746
+			$post_states['protected'] = __('Password protected');
1747
+	}
1748
+	if ( 'private' == $post->post_status && 'private' != $post_status ) {
1749
+			$post_states['private'] = __('Private');
1750
+	}
1751
+	if ( 'draft' == $post->post_status && 'draft' != $post_status ) {
1752
+			$post_states['draft'] = __('Draft');
1753
+	}
1754
+	if ( 'pending' == $post->post_status && 'pending' != $post_status ) {
1755
+			$post_states['pending'] = _x('Pending', 'post status');
1756
+	}
1757
+	if ( is_sticky($post->ID) ) {
1758
+			$post_states['sticky'] = __('Sticky');
1759
+	}
1691 1760
 
1692 1761
 	if ( 'future' === $post->post_status ) {
1693 1762
 		$post_states['scheduled'] = __( 'Scheduled' );
@@ -1736,14 +1805,16 @@  discard block
 block discarded – undo
1736 1805
 
1737 1806
 	if ( current_theme_supports( 'custom-header') ) {
1738 1807
 		$meta_header = get_post_meta($post->ID, '_wp_attachment_is_custom_header', true );
1739
-		if ( ! empty( $meta_header ) && $meta_header == $stylesheet )
1740
-			$media_states[] = __( 'Header Image' );
1808
+		if ( ! empty( $meta_header ) && $meta_header == $stylesheet ) {
1809
+					$media_states[] = __( 'Header Image' );
1810
+		}
1741 1811
 	}
1742 1812
 
1743 1813
 	if ( current_theme_supports( 'custom-background') ) {
1744 1814
 		$meta_background = get_post_meta($post->ID, '_wp_attachment_is_custom_background', true );
1745
-		if ( ! empty( $meta_background ) && $meta_background == $stylesheet )
1746
-			$media_states[] = __( 'Background Image' );
1815
+		if ( ! empty( $meta_background ) && $meta_background == $stylesheet ) {
1816
+					$media_states[] = __( 'Background Image' );
1817
+		}
1747 1818
 	}
1748 1819
 
1749 1820
 	if ( $post->ID == get_option( 'site_icon' ) ) {
@@ -1887,20 +1958,23 @@  discard block
 block discarded – undo
1887 1958
  * @return string Submit button HTML.
1888 1959
  */
1889 1960
 function get_submit_button( $text = '', $type = 'primary large', $name = 'submit', $wrap = true, $other_attributes = '' ) {
1890
-	if ( ! is_array( $type ) )
1891
-		$type = explode( ' ', $type );
1961
+	if ( ! is_array( $type ) ) {
1962
+			$type = explode( ' ', $type );
1963
+	}
1892 1964
 
1893 1965
 	$button_shorthand = array( 'primary', 'small', 'large' );
1894 1966
 	$classes = array( 'button' );
1895 1967
 	foreach ( $type as $t ) {
1896
-		if ( 'secondary' === $t || 'button-secondary' === $t )
1897
-			continue;
1968
+		if ( 'secondary' === $t || 'button-secondary' === $t ) {
1969
+					continue;
1970
+		}
1898 1971
 		$classes[] = in_array( $t, $button_shorthand ) ? 'button-' . $t : $t;
1899 1972
 	}
1900 1973
 	$class = implode( ' ', array_unique( $classes ) );
1901 1974
 
1902
-	if ( 'delete' === $type )
1903
-		$class = 'button-secondary delete';
1975
+	if ( 'delete' === $type ) {
1976
+			$class = 'button-secondary delete';
1977
+	}
1904 1978
 
1905 1979
 	$text = $text ? $text : __( 'Save Changes' );
1906 1980
 
@@ -1943,8 +2017,9 @@  discard block
 block discarded – undo
1943 2017
 
1944 2018
 	$admin_html_class = ( is_admin_bar_showing() ) ? 'wp-toolbar' : '';
1945 2019
 
1946
-	if ( $is_IE )
1947
-		@header('X-UA-Compatible: IE=edge');
2020
+	if ( $is_IE ) {
2021
+			@header('X-UA-Compatible: IE=edge');
2022
+	}
1948 2023
 
1949 2024
 ?>
1950 2025
 <!DOCTYPE html>
Please login to merge, or discard this patch.