Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-admin/update-core.php 3 patches
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
- * Update Core administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+												 * Update Core administration panel.
4
+												 *
5
+												 * @package WordPress
6
+												 * @subpackage Administration
7
+												 */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -105,10 +105,10 @@  discard block
 block discarded – undo
105 105
 			submit_button( __('Bring back this update'), 'button', 'undismiss', false );
106 106
 	echo '</p>';
107 107
 	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
108
-	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
108
+		echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
109 109
 	// Partial builds don't need language-specific warnings.
110 110
 	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111
-	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
111
+		echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
112 112
 	}
113 113
 	echo '</form>';
114 114
 
Please login to merge, or discard this patch.
Spacing   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_enqueue_style( 'plugin-install' );
13
-wp_enqueue_script( 'plugin-install' );
14
-wp_enqueue_script( 'updates' );
12
+wp_enqueue_style('plugin-install');
13
+wp_enqueue_script('plugin-install');
14
+wp_enqueue_script('updates');
15 15
 add_thickbox();
16 16
 
17
-if ( is_multisite() && ! is_network_admin() ) {
18
-	wp_redirect( network_admin_url( 'update-core.php' ) );
17
+if (is_multisite() && ! is_network_admin()) {
18
+	wp_redirect(network_admin_url('update-core.php'));
19 19
 	exit();
20 20
 }
21 21
 
22
-if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
23
-	wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
22
+if ( ! current_user_can('update_core') && ! current_user_can('update_themes') && ! current_user_can('update_plugins'))
23
+	wp_die(__('You do not have sufficient permissions to update this site.'));
24 24
 
25 25
 /**
26 26
  *
@@ -32,50 +32,50 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @param object $update
34 34
  */
35
-function list_core_update( $update ) {
35
+function list_core_update($update) {
36 36
  	global $wp_local_package, $wpdb, $wp_version;
37 37
   	static $first_pass = true;
38 38
 
39
- 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
39
+ 	if ('en_US' == $update->locale && 'en_US' == get_locale())
40 40
  		$version_string = $update->current;
41 41
  	// If the only available update is a partial builds, it doesn't need a language-specific version string.
42
- 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
42
+ 	elseif ('en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ($updates = get_core_updates()) && 1 == count($updates))
43 43
  		$version_string = $update->current;
44 44
  	else
45
- 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
45
+ 		$version_string = sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
46 46
 
47 47
 	$current = false;
48
-	if ( !isset($update->response) || 'latest' == $update->response )
48
+	if ( ! isset($update->response) || 'latest' == $update->response)
49 49
 		$current = true;
50 50
 	$submit = __('Update Now');
51 51
 	$form_action = 'update-core.php?action=do-core-upgrade';
52 52
 	$php_version    = phpversion();
53 53
 	$mysql_version  = $wpdb->db_version();
54 54
 	$show_buttons = true;
55
-	if ( 'development' == $update->response ) {
55
+	if ('development' == $update->response) {
56 56
 		$message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:');
57 57
 		$download = __('Download nightly build');
58 58
 	} else {
59
-		if ( $current ) {
60
-			$message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string );
59
+		if ($current) {
60
+			$message = sprintf(__('If you need to re-install version %s, you can do so here or download the package and re-install manually:'), $version_string);
61 61
 			$submit = __('Re-install Now');
62 62
 			$form_action = 'update-core.php?action=do-core-reinstall';
63 63
 		} else {
64
-			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );
65
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
64
+			$php_compat = version_compare($php_version, $update->php_version, '>=');
65
+			if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql))
66 66
 				$mysql_compat = true;
67 67
 			else
68
-				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
69
-
70
-			if ( !$mysql_compat && !$php_compat )
71
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
72
-			elseif ( !$php_compat )
73
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
74
-			elseif ( !$mysql_compat )
75
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
68
+				$mysql_compat = version_compare($mysql_version, $update->mysql_version, '>=');
69
+
70
+			if ( ! $mysql_compat && ! $php_compat)
71
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version);
72
+			elseif ( ! $php_compat)
73
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version);
74
+			elseif ( ! $mysql_compat)
75
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version);
76 76
 			else
77
-				$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
-			if ( !$mysql_compat || !$php_compat )
77
+				$message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
+			if ( ! $mysql_compat || ! $php_compat)
79 79
 				$show_buttons = false;
80 80
 		}
81 81
 		$download = sprintf(__('Download %s'), $version_string);
@@ -84,31 +84,31 @@  discard block
 block discarded – undo
84 84
 	echo '<p>';
85 85
 	echo $message;
86 86
 	echo '</p>';
87
-	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
87
+	echo '<form method="post" action="'.$form_action.'" name="upgrade" class="upgrade">';
88 88
 	wp_nonce_field('upgrade-core');
89 89
 	echo '<p>';
90
-	echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
91
-	echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
92
-	if ( $show_buttons ) {
93
-		if ( $first_pass ) {
94
-			submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
90
+	echo '<input name="version" value="'.esc_attr($update->current).'" type="hidden"/>';
91
+	echo '<input name="locale" value="'.esc_attr($update->locale).'" type="hidden"/>';
92
+	if ($show_buttons) {
93
+		if ($first_pass) {
94
+			submit_button($submit, $current ? 'button' : 'primary regular', 'upgrade', false);
95 95
 			$first_pass = false;
96 96
 		} else {
97
-			submit_button( $submit, 'button', 'upgrade', false );
97
+			submit_button($submit, 'button', 'upgrade', false);
98 98
 		}
99
-		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
99
+		echo '&nbsp;<a href="'.esc_url($update->download).'" class="button">'.$download.'</a>&nbsp;';
100 100
 	}
101
-	if ( 'en_US' != $update->locale )
102
-		if ( !isset( $update->dismissed ) || !$update->dismissed )
103
-			submit_button( __('Hide this update'), 'button', 'dismiss', false );
101
+	if ('en_US' != $update->locale)
102
+		if ( ! isset($update->dismissed) || ! $update->dismissed)
103
+			submit_button(__('Hide this update'), 'button', 'dismiss', false);
104 104
 		else
105
-			submit_button( __('Bring back this update'), 'button', 'undismiss', false );
105
+			submit_button(__('Bring back this update'), 'button', 'undismiss', false);
106 106
 	echo '</p>';
107
-	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
107
+	if ('en_US' != $update->locale && ( ! isset($wp_local_package) || $wp_local_package != $update->locale))
108 108
 	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
109 109
 	// Partial builds don't need language-specific warnings.
110
-	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111
-	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
110
+	elseif ('en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version)) {
111
+	    echo '<p class="hint">'.sprintf(__('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '').'</p>';
112 112
 	}
113 113
 	echo '</form>';
114 114
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
  * @since 2.7.0
119 119
  */
120 120
 function dismissed_updates() {
121
-	$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
122
-	if ( $dismissed ) {
121
+	$dismissed = get_core_updates(array('dismissed' => true, 'available' => false));
122
+	if ($dismissed) {
123 123
 
124 124
 		$show_text = esc_js(__('Show hidden updates'));
125 125
 		$hide_text = esc_js(__('Hide hidden updates'));
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	<?php
136 136
 		echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
137 137
 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
138
-		foreach ( (array) $dismissed as $update) {
138
+		foreach ((array) $dismissed as $update) {
139 139
 			echo '<li>';
140
-			list_core_update( $update );
140
+			list_core_update($update);
141 141
 			echo '</li>';
142 142
 		}
143 143
 		echo '</ul>';
@@ -158,22 +158,22 @@  discard block
 block discarded – undo
158 158
 
159 159
 	$updates = get_core_updates();
160 160
 
161
-	if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
161
+	if ( ! isset($updates[0]->response) || 'latest' == $updates[0]->response) {
162 162
 		echo '<h2>';
163 163
 		_e('You have the latest version of WordPress.');
164 164
 
165
-		if ( wp_http_supports( array( 'ssl' ) ) ) {
166
-			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
165
+		if (wp_http_supports(array('ssl'))) {
166
+			require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
167 167
 			$upgrader = new WP_Automatic_Updater;
168 168
 			$future_minor_update = (object) array(
169
-				'current'       => $wp_version . '.1.next.minor',
170
-				'version'       => $wp_version . '.1.next.minor',
169
+				'current'       => $wp_version.'.1.next.minor',
170
+				'version'       => $wp_version.'.1.next.minor',
171 171
 				'php_version'   => $required_php_version,
172 172
 				'mysql_version' => $required_mysql_version,
173 173
 			);
174
-			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
175
-			if ( $should_auto_update )
176
-				echo ' ' . __( 'Future security updates will be applied automatically.' );
174
+			$should_auto_update = $upgrader->should_update('core', $future_minor_update, ABSPATH);
175
+			if ($should_auto_update)
176
+				echo ' '.__('Future security updates will be applied automatically.');
177 177
 		}
178 178
 		echo '</h2>';
179 179
 	} else {
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 		echo '</p></div>';
183 183
 
184 184
 		echo '<h2 class="response">';
185
-		_e( 'An updated version of WordPress is available.' );
185
+		_e('An updated version of WordPress is available.');
186 186
 		echo '</h2>';
187 187
 	}
188 188
 
189
-	if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
190
-		require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
189
+	if (isset($updates[0]) && $updates[0]->response == 'development') {
190
+		require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
191 191
 		$upgrader = new WP_Automatic_Updater;
192
-		if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
192
+		if (wp_http_supports('ssl') && $upgrader->should_update('core', $updates[0], ABSPATH)) {
193 193
 			echo '<div class="updated inline"><p>';
194
-			echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
194
+			echo '<strong>'.__('BETA TESTERS:').'</strong> '.__('This site is set up to install updates of future beta versions automatically.');
195 195
 			echo '</p></div>';
196 196
 		}
197 197
 	}
198 198
 
199 199
 	echo '<ul class="core-updates">';
200
-	foreach ( (array) $updates as $update ) {
200
+	foreach ((array) $updates as $update) {
201 201
 		echo '<li>';
202
-		list_core_update( $update );
202
+		list_core_update($update);
203 203
 		echo '</li>';
204 204
 	}
205 205
 	echo '</ul>';
206 206
 	// Don't show the maintenance mode notice when we are only showing a single re-install option.
207
-	if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
208
-		echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
209
-	} elseif ( ! $updates ) {
210
-		list( $normalized_version ) = explode( '-', $wp_version );
211
-		echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
207
+	if ($updates && (count($updates) > 1 || $updates[0]->response != 'latest')) {
208
+		echo '<p>'.__('While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.').'</p>';
209
+	} elseif ( ! $updates) {
210
+		list($normalized_version) = explode('-', $wp_version);
211
+		echo '<p>'.sprintf(__('<a href="%s">Learn more about WordPress %s</a>.'), esc_url(self_admin_url('about.php')), $normalized_version).'</p>';
212 212
 	}
213 213
 	dismissed_updates();
214 214
 }
@@ -222,77 +222,77 @@  discard block
 block discarded – undo
222 222
 
223 223
 	$cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
224 224
 
225
-	require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
225
+	require_once(ABSPATH.'wp-admin/includes/plugin-install.php');
226 226
 	$plugins = get_plugin_updates();
227
-	if ( empty( $plugins ) ) {
228
-		echo '<h2>' . __( 'Plugins' ) . '</h2>';
229
-		echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
227
+	if (empty($plugins)) {
228
+		echo '<h2>'.__('Plugins').'</h2>';
229
+		echo '<p>'.__('Your plugins are all up to date.').'</p>';
230 230
 		return;
231 231
 	}
232 232
 	$form_action = 'update-core.php?action=do-plugin-upgrade';
233 233
 
234 234
 	$core_updates = get_core_updates();
235
-	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
235
+	if ( ! isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare($core_updates[0]->current, $cur_wp_version, '='))
236 236
 		$core_update_version = false;
237 237
 	else
238 238
 		$core_update_version = $core_updates[0]->current;
239 239
 	?>
240
-<h2><?php _e( 'Plugins' ); ?></h2>
241
-<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
242
-<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
240
+<h2><?php _e('Plugins'); ?></h2>
241
+<p><?php _e('The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.'); ?></p>
242
+<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-plugins" class="upgrade">
243 243
 <?php wp_nonce_field('upgrade-core'); ?>
244 244
 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
245 245
 <table class="widefat updates-table" id="update-plugins-table">
246 246
 	<thead>
247 247
 	<tr>
248 248
 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
249
-		<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
249
+		<td class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></td>
250 250
 	</tr>
251 251
 	</thead>
252 252
 
253 253
 	<tbody class="plugins">
254 254
 <?php
255
-	foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
255
+	foreach ((array) $plugins as $plugin_file => $plugin_data) {
256 256
 		// Get plugin compat for running version of WordPress.
257
-		if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
258
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
259
-		} elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) {
257
+		if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=')) {
258
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
259
+		} elseif (isset($plugin_data->update->compatibility->{$cur_wp_version})) {
260 260
 			$compat = $plugin_data->update->compatibility->{$cur_wp_version};
261
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
261
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
262 262
 		} else {
263
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
263
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
264 264
 		}
265 265
 		// Get plugin compat for updated version of WordPress.
266
-		if ( $core_update_version ) {
267
-			if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
268
-				$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
269
-			} elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {
266
+		if ($core_update_version) {
267
+			if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $core_update_version, '>=')) {
268
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $core_update_version);
269
+			} elseif (isset($plugin_data->update->compatibility->{$core_update_version} )) {
270 270
 				$update_compat = $plugin_data->update->compatibility->{$core_update_version};
271
-				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
271
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
272 272
 			} else {
273
-				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
273
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
274 274
 			}
275 275
 		}
276 276
 		// Get the upgrade notice for the new plugin version.
277
-		if ( isset($plugin_data->update->upgrade_notice) ) {
278
-			$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
277
+		if (isset($plugin_data->update->upgrade_notice)) {
278
+			$upgrade_notice = '<br />'.strip_tags($plugin_data->update->upgrade_notice);
279 279
 		} else {
280 280
 			$upgrade_notice = '';
281 281
 		}
282 282
 
283
-		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662');
284
-		$details_name = sprintf( '<span class="screen-reader-text">%1$s</span>', esc_attr( $plugin_data->Name ) );
283
+		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data->update->slug.'&section=changelog&TB_iframe=true&width=640&height=662');
284
+		$details_name = sprintf('<span class="screen-reader-text">%1$s</span>', esc_attr($plugin_data->Name));
285 285
 		/* translators: 1: Plugin name 2: Plugin version */
286
-		$details_text = sprintf( __( 'View %1$s version %2$s details.' ), $details_name, $plugin_data->update->new_version );
287
-		$details = sprintf( '<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', esc_url( $details_url ), $details_text );
288
-		$checkbox_id =  "checkbox_" . md5( $plugin_data->Name );
286
+		$details_text = sprintf(__('View %1$s version %2$s details.'), $details_name, $plugin_data->update->new_version);
287
+		$details = sprintf('<a href="%1$s" class="thickbox open-plugin-details-modal">%2$s</a>', esc_url($details_url), $details_text);
288
+		$checkbox_id = "checkbox_".md5($plugin_data->Name);
289 289
 		?>
290 290
 		<tr>
291 291
 			<td class="check-column">
292
-				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
292
+				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($plugin_file); ?>" />
293 293
 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
294 294
 					/* translators: %s: plugin name */
295
-					printf( __( 'Select %s' ),
295
+					printf(__('Select %s'),
296 296
 						$plugin_data->Name
297 297
 					);
298 298
 				?></label>
@@ -301,11 +301,11 @@  discard block
 block discarded – undo
301 301
 				<strong><?php echo $plugin_data->Name; ?></strong>
302 302
 				<?php
303 303
 					/* translators: 1: plugin version, 2: new version */
304
-					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
304
+					printf(__('You have version %1$s installed. Update to %2$s.'),
305 305
 						$plugin_data->Version,
306 306
 						$plugin_data->update->new_version
307 307
 					);
308
-					echo ' ' . $details . $compat . $upgrade_notice;
308
+					echo ' '.$details.$compat.$upgrade_notice;
309 309
 				?>
310 310
 			</p></td>
311 311
 		</tr>
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 	<tfoot>
318 318
 	<tr>
319 319
 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
320
-		<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
320
+		<td class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></td>
321 321
 	</tr>
322 322
 	</tfoot>
323 323
 </table>
@@ -331,50 +331,50 @@  discard block
 block discarded – undo
331 331
  */
332 332
 function list_theme_updates() {
333 333
 	$themes = get_theme_updates();
334
-	if ( empty( $themes ) ) {
335
-		echo '<h2>' . __( 'Themes' ) . '</h2>';
336
-		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
334
+	if (empty($themes)) {
335
+		echo '<h2>'.__('Themes').'</h2>';
336
+		echo '<p>'.__('Your themes are all up to date.').'</p>';
337 337
 		return;
338 338
 	}
339 339
 
340 340
 	$form_action = 'update-core.php?action=do-theme-upgrade';
341 341
 ?>
342
-<h2><?php _e( 'Themes' ); ?></h2>
343
-<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
344
-<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p>
345
-<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
342
+<h2><?php _e('Themes'); ?></h2>
343
+<p><?php _e('The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.'); ?></p>
344
+<p><?php printf(__('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), __('https://codex.wordpress.org/Child_Themes')); ?></p>
345
+<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-themes" class="upgrade">
346 346
 <?php wp_nonce_field('upgrade-core'); ?>
347 347
 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
348 348
 <table class="widefat updates-table" id="update-themes-table">
349 349
 	<thead>
350 350
 	<tr>
351 351
 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
352
-		<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
352
+		<td class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></td>
353 353
 	</tr>
354 354
 	</thead>
355 355
 
356 356
 	<tbody class="plugins">
357 357
 <?php
358
-	foreach ( $themes as $stylesheet => $theme ) {
359
-		$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
358
+	foreach ($themes as $stylesheet => $theme) {
359
+		$checkbox_id = 'checkbox_'.md5($theme->get('Name'));
360 360
 		?>
361 361
 		<tr>
362 362
 			<td class="check-column">
363
-				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
363
+				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($stylesheet); ?>" />
364 364
 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
365 365
 					/* translators: %s: theme name */
366
-					printf( __( 'Select %s' ),
367
-						$theme->display( 'Name' )
366
+					printf(__('Select %s'),
367
+						$theme->display('Name')
368 368
 					);
369 369
 				?></label>
370 370
 			</td>
371 371
 			<td class="plugin-title"><p>
372
-				<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
373
-				<strong><?php echo $theme->display( 'Name' ); ?></strong>
372
+				<img src="<?php echo esc_url($theme->get_screenshot()); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
373
+				<strong><?php echo $theme->display('Name'); ?></strong>
374 374
 				<?php
375 375
 					/* translators: 1: theme version, 2: new version */
376
-					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
377
-						$theme->display( 'Version' ),
376
+					printf(__('You have version %1$s installed. Update to %2$s.'),
377
+						$theme->display('Version'),
378 378
 						$theme->update['new_version']
379 379
 					);
380 380
 				?>
@@ -388,7 +388,7 @@  discard block
 block discarded – undo
388 388
 	<tfoot>
389 389
 	<tr>
390 390
 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
391
-		<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
391
+		<td class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></td>
392 392
 	</tr>
393 393
 	</tfoot>
394 394
 </table>
@@ -402,21 +402,21 @@  discard block
 block discarded – undo
402 402
  */
403 403
 function list_translation_updates() {
404 404
 	$updates = wp_get_translation_updates();
405
-	if ( ! $updates ) {
406
-		if ( 'en_US' != get_locale() ) {
407
-			echo '<h2>' . __( 'Translations' ) . '</h2>';
408
-			echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
405
+	if ( ! $updates) {
406
+		if ('en_US' != get_locale()) {
407
+			echo '<h2>'.__('Translations').'</h2>';
408
+			echo '<p>'.__('Your translations are all up to date.').'</p>';
409 409
 		}
410 410
 		return;
411 411
 	}
412 412
 
413 413
 	$form_action = 'update-core.php?action=do-translation-upgrade';
414 414
 	?>
415
-	<h2><?php _e( 'Translations' ); ?></h2>
416
-	<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
417
-		<p><?php _e( 'New translations are available.' ); ?></p>
418
-		<?php wp_nonce_field( 'upgrade-translations' ); ?>
419
-		<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
415
+	<h2><?php _e('Translations'); ?></h2>
416
+	<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-translations" class="upgrade">
417
+		<p><?php _e('New translations are available.'); ?></p>
418
+		<?php wp_nonce_field('upgrade-translations'); ?>
419
+		<p><input class="button" type="submit" value="<?php esc_attr_e('Update Translations'); ?>" name="upgrade" /></p>
420 420
 	</form>
421 421
 	<?php
422 422
 }
@@ -430,76 +430,76 @@  discard block
 block discarded – undo
430 430
  *
431 431
  * @param bool $reinstall
432 432
  */
433
-function do_core_upgrade( $reinstall = false ) {
433
+function do_core_upgrade($reinstall = false) {
434 434
 	global $wp_filesystem;
435 435
 
436
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
436
+	include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
437 437
 
438
-	if ( $reinstall )
438
+	if ($reinstall)
439 439
 		$url = 'update-core.php?action=do-core-reinstall';
440 440
 	else
441 441
 		$url = 'update-core.php?action=do-core-upgrade';
442 442
 	$url = wp_nonce_url($url, 'upgrade-core');
443 443
 
444
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
445
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
446
-	$update = find_core_update( $version, $locale );
447
-	if ( !$update )
444
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
445
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
446
+	$update = find_core_update($version, $locale);
447
+	if ( ! $update)
448 448
 		return;
449 449
 
450 450
 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
451 451
 	// that it's safe to do so. This only happens when there are no new files to create.
452
-	$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
452
+	$allow_relaxed_file_ownership = ! $reinstall && isset($update->new_files) && ! $update->new_files;
453 453
 
454 454
 ?>
455 455
 	<div class="wrap">
456
-	<h1><?php _e( 'Update WordPress' ); ?></h1>
456
+	<h1><?php _e('Update WordPress'); ?></h1>
457 457
 <?php
458 458
 
459
-	if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
459
+	if (false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership))) {
460 460
 		echo '</div>';
461 461
 		return;
462 462
 	}
463 463
 
464
-	if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
464
+	if ( ! WP_Filesystem($credentials, ABSPATH, $allow_relaxed_file_ownership)) {
465 465
 		// Failed to connect, Error and request again
466
-		request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
466
+		request_filesystem_credentials($url, '', true, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership);
467 467
 		echo '</div>';
468 468
 		return;
469 469
 	}
470 470
 
471
-	if ( $wp_filesystem->errors->get_error_code() ) {
472
-		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
471
+	if ($wp_filesystem->errors->get_error_code()) {
472
+		foreach ($wp_filesystem->errors->get_error_messages() as $message)
473 473
 			show_message($message);
474 474
 		echo '</div>';
475 475
 		return;
476 476
 	}
477 477
 
478
-	if ( $reinstall )
478
+	if ($reinstall)
479 479
 		$update->response = 'reinstall';
480 480
 
481
-	add_filter( 'update_feedback', 'show_message' );
481
+	add_filter('update_feedback', 'show_message');
482 482
 
483 483
 	$upgrader = new Core_Upgrader();
484
-	$result = $upgrader->upgrade( $update, array(
484
+	$result = $upgrader->upgrade($update, array(
485 485
 		'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
486
-	) );
486
+	));
487 487
 
488
-	if ( is_wp_error($result) ) {
488
+	if (is_wp_error($result)) {
489 489
 		show_message($result);
490
-		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
491
-			show_message( __('Installation Failed') );
490
+		if ('up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code())
491
+			show_message(__('Installation Failed'));
492 492
 		echo '</div>';
493 493
 		return;
494 494
 	}
495 495
 
496
-	show_message( __('WordPress updated successfully') );
497
-	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
498
-	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
496
+	show_message(__('WordPress updated successfully'));
497
+	show_message('<span class="hide-if-no-js">'.sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>');
498
+	show_message('<span class="hide-if-js">'.sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>');
499 499
 	?>
500 500
 	</div>
501 501
 	<script type="text/javascript">
502
-	window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
502
+	window.location = '<?php echo self_admin_url('about.php?updated'); ?>';
503 503
 	</script>
504 504
 	<?php
505 505
 }
@@ -508,13 +508,13 @@  discard block
 block discarded – undo
508 508
  * @since 2.7.0
509 509
  */
510 510
 function do_dismiss_core_update() {
511
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
512
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
513
-	$update = find_core_update( $version, $locale );
514
-	if ( !$update )
511
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
512
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
513
+	$update = find_core_update($version, $locale);
514
+	if ( ! $update)
515 515
 		return;
516
-	dismiss_core_update( $update );
517
-	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
516
+	dismiss_core_update($update);
517
+	wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core'));
518 518
 	exit;
519 519
 }
520 520
 
@@ -522,21 +522,21 @@  discard block
 block discarded – undo
522 522
  * @since 2.7.0
523 523
  */
524 524
 function do_undismiss_core_update() {
525
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
526
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
527
-	$update = find_core_update( $version, $locale );
528
-	if ( !$update )
525
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
526
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
527
+	$update = find_core_update($version, $locale);
528
+	if ( ! $update)
529 529
 		return;
530
-	undismiss_core_update( $version, $locale );
531
-	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
530
+	undismiss_core_update($version, $locale);
531
+	wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core'));
532 532
 	exit;
533 533
 }
534 534
 
535 535
 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
536 536
 
537 537
 $upgrade_error = false;
538
-if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
539
-	&& ! isset( $_POST['checked'] ) ) {
538
+if (('do-theme-upgrade' == $action || ('do-plugin-upgrade' == $action && ! isset($_GET['plugins'])))
539
+	&& ! isset($_POST['checked'])) {
540 540
 	$upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
541 541
 	$action = 'upgrade-core';
542 542
 }
@@ -544,47 +544,47 @@  discard block
 block discarded – undo
544 544
 $title = __('WordPress Updates');
545 545
 $parent_file = 'index.php';
546 546
 
547
-$updates_overview  = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
548
-$updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
547
+$updates_overview  = '<p>'.__('On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.').'</p>';
548
+$updates_overview .= '<p>'.__('If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.').' '.__('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.').'</p>';
549 549
 
550
-get_current_screen()->add_help_tab( array(
550
+get_current_screen()->add_help_tab(array(
551 551
 	'id'      => 'overview',
552
-	'title'   => __( 'Overview' ),
552
+	'title'   => __('Overview'),
553 553
 	'content' => $updates_overview
554
-) );
554
+));
555 555
 
556
-$updates_howto  = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
557
-$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
556
+$updates_howto  = '<p>'.__('<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.').' '.__('In most cases, WordPress will automatically apply maintenance and security updates in the background for you.').'</p>';
557
+$updates_howto .= '<p>'.__('<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.').'</p>';
558 558
 
559
-if ( 'en_US' != get_locale() ) {
560
-	$updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
559
+if ('en_US' != get_locale()) {
560
+	$updates_howto .= '<p>'.__('<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.').'</p>';
561 561
 }
562 562
 
563
-get_current_screen()->add_help_tab( array(
563
+get_current_screen()->add_help_tab(array(
564 564
 	'id'      => 'how-to-update',
565
-	'title'   => __( 'How to Update' ),
565
+	'title'   => __('How to Update'),
566 566
 	'content' => $updates_howto
567
-) );
567
+));
568 568
 
569 569
 get_current_screen()->set_help_sidebar(
570
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
571
-	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
572
-	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
570
+	'<p><strong>'.__('For more information:').'</strong></p>'.
571
+	'<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>').'</p>'.
572
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
573 573
 );
574 574
 
575
-if ( 'upgrade-core' == $action ) {
575
+if ('upgrade-core' == $action) {
576 576
 	// Force a update check when requested
577
-	$force_check = ! empty( $_GET['force-check'] );
578
-	wp_version_check( array(), $force_check );
577
+	$force_check = ! empty($_GET['force-check']);
578
+	wp_version_check(array(), $force_check);
579 579
 
580
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
580
+	require_once(ABSPATH.'wp-admin/admin-header.php');
581 581
 	?>
582 582
 	<div class="wrap">
583
-	<h1><?php _e( 'WordPress Updates' ); ?></h1>
583
+	<h1><?php _e('WordPress Updates'); ?></h1>
584 584
 	<?php
585
-	if ( $upgrade_error ) {
585
+	if ($upgrade_error) {
586 586
 		echo '<div class="error"><p>';
587
-		if ( $upgrade_error == 'themes' )
587
+		if ($upgrade_error == 'themes')
588 588
 			_e('Please select one or more themes to update.');
589 589
 		else
590 590
 			_e('Please select one or more plugins to update.');
@@ -593,129 +593,129 @@  discard block
 block discarded – undo
593 593
 
594 594
 	echo '<p>';
595 595
 	/* translators: %1 date, %2 time. */
596
-	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ) ), date_i18n( __( 'g:i a' ) ) );
597
-	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
596
+	printf(__('Last checked on %1$s at %2$s.'), date_i18n(__('F j, Y')), date_i18n(__('g:i a')));
597
+	echo ' &nbsp; <a class="button" href="'.esc_url(self_admin_url('update-core.php?force-check=1')).'">'.__('Check Again').'</a>';
598 598
 	echo '</p>';
599 599
 
600
-	if ( $core = current_user_can( 'update_core' ) )
600
+	if ($core = current_user_can('update_core'))
601 601
 		core_upgrade_preamble();
602
-	if ( $plugins = current_user_can( 'update_plugins' ) )
602
+	if ($plugins = current_user_can('update_plugins'))
603 603
 		list_plugin_updates();
604
-	if ( $themes = current_user_can( 'update_themes' ) )
604
+	if ($themes = current_user_can('update_themes'))
605 605
 		list_theme_updates();
606
-	if ( $core || $plugins || $themes )
606
+	if ($core || $plugins || $themes)
607 607
 		list_translation_updates();
608
-	unset( $core, $plugins, $themes );
608
+	unset($core, $plugins, $themes);
609 609
 	/**
610 610
 	 * Fires after the core, plugin, and theme update tables.
611 611
 	 *
612 612
 	 * @since 2.9.0
613 613
 	 */
614
-	do_action( 'core_upgrade_preamble' );
614
+	do_action('core_upgrade_preamble');
615 615
 	echo '</div>';
616
-	include(ABSPATH . 'wp-admin/admin-footer.php');
616
+	include(ABSPATH.'wp-admin/admin-footer.php');
617 617
 
618
-} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
618
+} elseif ('do-core-upgrade' == $action || 'do-core-reinstall' == $action) {
619 619
 
620
-	if ( ! current_user_can( 'update_core' ) )
621
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
620
+	if ( ! current_user_can('update_core'))
621
+		wp_die(__('You do not have sufficient permissions to update this site.'));
622 622
 
623 623
 	check_admin_referer('upgrade-core');
624 624
 
625 625
 	// Do the (un)dismiss actions before headers, so that they can redirect.
626
-	if ( isset( $_POST['dismiss'] ) )
626
+	if (isset($_POST['dismiss']))
627 627
 		do_dismiss_core_update();
628
-	elseif ( isset( $_POST['undismiss'] ) )
628
+	elseif (isset($_POST['undismiss']))
629 629
 		do_undismiss_core_update();
630 630
 
631
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
632
-	if ( 'do-core-reinstall' == $action )
631
+	require_once(ABSPATH.'wp-admin/admin-header.php');
632
+	if ('do-core-reinstall' == $action)
633 633
 		$reinstall = true;
634 634
 	else
635 635
 		$reinstall = false;
636 636
 
637
-	if ( isset( $_POST['upgrade'] ) )
637
+	if (isset($_POST['upgrade']))
638 638
 		do_core_upgrade($reinstall);
639 639
 
640
-	include(ABSPATH . 'wp-admin/admin-footer.php');
640
+	include(ABSPATH.'wp-admin/admin-footer.php');
641 641
 
642
-} elseif ( 'do-plugin-upgrade' == $action ) {
642
+} elseif ('do-plugin-upgrade' == $action) {
643 643
 
644
-	if ( ! current_user_can( 'update_plugins' ) )
645
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
644
+	if ( ! current_user_can('update_plugins'))
645
+		wp_die(__('You do not have sufficient permissions to update this site.'));
646 646
 
647 647
 	check_admin_referer('upgrade-core');
648 648
 
649
-	if ( isset( $_GET['plugins'] ) ) {
650
-		$plugins = explode( ',', $_GET['plugins'] );
651
-	} elseif ( isset( $_POST['checked'] ) ) {
649
+	if (isset($_GET['plugins'])) {
650
+		$plugins = explode(',', $_GET['plugins']);
651
+	} elseif (isset($_POST['checked'])) {
652 652
 		$plugins = (array) $_POST['checked'];
653 653
 	} else {
654
-		wp_redirect( admin_url('update-core.php') );
654
+		wp_redirect(admin_url('update-core.php'));
655 655
 		exit;
656 656
 	}
657 657
 
658
-	$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
658
+	$url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins));
659 659
 	$url = wp_nonce_url($url, 'bulk-update-plugins');
660 660
 
661 661
 	$title = __('Update Plugins');
662 662
 
663
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
663
+	require_once(ABSPATH.'wp-admin/admin-header.php');
664 664
 	echo '<div class="wrap">';
665
-	echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
666
-	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
665
+	echo '<h1>'.__('Update Plugins').'</h1>';
666
+	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="'.esc_attr__('Update progress').'"></iframe>';
667 667
 	echo '</div>';
668
-	include(ABSPATH . 'wp-admin/admin-footer.php');
668
+	include(ABSPATH.'wp-admin/admin-footer.php');
669 669
 
670
-} elseif ( 'do-theme-upgrade' == $action ) {
670
+} elseif ('do-theme-upgrade' == $action) {
671 671
 
672
-	if ( ! current_user_can( 'update_themes' ) )
673
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
672
+	if ( ! current_user_can('update_themes'))
673
+		wp_die(__('You do not have sufficient permissions to update this site.'));
674 674
 
675 675
 	check_admin_referer('upgrade-core');
676 676
 
677
-	if ( isset( $_GET['themes'] ) ) {
678
-		$themes = explode( ',', $_GET['themes'] );
679
-	} elseif ( isset( $_POST['checked'] ) ) {
677
+	if (isset($_GET['themes'])) {
678
+		$themes = explode(',', $_GET['themes']);
679
+	} elseif (isset($_POST['checked'])) {
680 680
 		$themes = (array) $_POST['checked'];
681 681
 	} else {
682
-		wp_redirect( admin_url('update-core.php') );
682
+		wp_redirect(admin_url('update-core.php'));
683 683
 		exit;
684 684
 	}
685 685
 
686
-	$url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
686
+	$url = 'update.php?action=update-selected-themes&themes='.urlencode(implode(',', $themes));
687 687
 	$url = wp_nonce_url($url, 'bulk-update-themes');
688 688
 
689 689
 	$title = __('Update Themes');
690 690
 
691
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
691
+	require_once(ABSPATH.'wp-admin/admin-header.php');
692 692
 	?>
693 693
 	<div class="wrap">
694
-		<h1><?php _e( 'Update Themes' ); ?></h1>
695
-		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
694
+		<h1><?php _e('Update Themes'); ?></h1>
695
+		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e('Update progress'); ?>"></iframe>
696 696
 	</div>
697 697
 	<?php
698
-	include(ABSPATH . 'wp-admin/admin-footer.php');
698
+	include(ABSPATH.'wp-admin/admin-footer.php');
699 699
 
700
-} elseif ( 'do-translation-upgrade' == $action ) {
700
+} elseif ('do-translation-upgrade' == $action) {
701 701
 
702
-	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
703
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
702
+	if ( ! current_user_can('update_core') && ! current_user_can('update_plugins') && ! current_user_can('update_themes'))
703
+		wp_die(__('You do not have sufficient permissions to update this site.'));
704 704
 
705
-	check_admin_referer( 'upgrade-translations' );
705
+	check_admin_referer('upgrade-translations');
706 706
 
707
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
708
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
707
+	require_once(ABSPATH.'wp-admin/admin-header.php');
708
+	include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
709 709
 
710 710
 	$url = 'update-core.php?action=do-translation-upgrade';
711 711
 	$nonce = 'upgrade-translations';
712
-	$title = __( 'Update Translations' );
712
+	$title = __('Update Translations');
713 713
 	$context = WP_LANG_DIR;
714 714
 
715
-	$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
715
+	$upgrader = new Language_Pack_Upgrader(new Language_Pack_Upgrader_Skin(compact('url', 'nonce', 'title', 'context')));
716 716
 	$result = $upgrader->bulk_upgrade();
717 717
 
718
-	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
718
+	require_once(ABSPATH.'wp-admin/admin-footer.php');
719 719
 
720 720
 } else {
721 721
 	/**
@@ -727,5 +727,5 @@  discard block
 block discarded – undo
727 727
 	 *
728 728
 	 * @since 3.2.0
729 729
 	 */
730
-	do_action( "update-core-custom_{$action}" );
730
+	do_action("update-core-custom_{$action}");
731 731
 }
Please login to merge, or discard this patch.
Braces   +112 added lines, -82 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	exit();
20 20
 }
21 21
 
22
-if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
22
+if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) {
23 23
 	wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
24
+}
24 25
 
25 26
 /**
26 27
  *
@@ -36,17 +37,20 @@  discard block
 block discarded – undo
36 37
  	global $wp_local_package, $wpdb, $wp_version;
37 38
   	static $first_pass = true;
38 39
 
39
- 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
40
- 		$version_string = $update->current;
40
+ 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) {
41
+ 	 		$version_string = $update->current;
42
+ 	}
41 43
  	// If the only available update is a partial builds, it doesn't need a language-specific version string.
42
- 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
43
- 		$version_string = $update->current;
44
- 	else
45
- 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
44
+ 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) {
45
+ 	 		$version_string = $update->current;
46
+ 	} else {
47
+ 	 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
48
+ 	}
46 49
 
47 50
 	$current = false;
48
-	if ( !isset($update->response) || 'latest' == $update->response )
49
-		$current = true;
51
+	if ( !isset($update->response) || 'latest' == $update->response ) {
52
+			$current = true;
53
+	}
50 54
 	$submit = __('Update Now');
51 55
 	$form_action = 'update-core.php?action=do-core-upgrade';
52 56
 	$php_version    = phpversion();
@@ -62,21 +66,24 @@  discard block
 block discarded – undo
62 66
 			$form_action = 'update-core.php?action=do-core-reinstall';
63 67
 		} else {
64 68
 			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );
65
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
66
-				$mysql_compat = true;
67
-			else
68
-				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
69
-
70
-			if ( !$mysql_compat && !$php_compat )
71
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
72
-			elseif ( !$php_compat )
73
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
74
-			elseif ( !$mysql_compat )
75
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
76
-			else
77
-				$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
-			if ( !$mysql_compat || !$php_compat )
79
-				$show_buttons = false;
69
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
70
+							$mysql_compat = true;
71
+			} else {
72
+							$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
73
+			}
74
+
75
+			if ( !$mysql_compat && !$php_compat ) {
76
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
77
+			} elseif ( !$php_compat ) {
78
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
79
+			} elseif ( !$mysql_compat ) {
80
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
81
+			} else {
82
+							$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
83
+			}
84
+			if ( !$mysql_compat || !$php_compat ) {
85
+							$show_buttons = false;
86
+			}
80 87
 		}
81 88
 		$download = sprintf(__('Download %s'), $version_string);
82 89
 	}
@@ -98,14 +105,16 @@  discard block
 block discarded – undo
98 105
 		}
99 106
 		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
100 107
 	}
101
-	if ( 'en_US' != $update->locale )
102
-		if ( !isset( $update->dismissed ) || !$update->dismissed )
108
+	if ( 'en_US' != $update->locale ) {
109
+			if ( !isset( $update->dismissed ) || !$update->dismissed )
103 110
 			submit_button( __('Hide this update'), 'button', 'dismiss', false );
104
-		else
105
-			submit_button( __('Bring back this update'), 'button', 'undismiss', false );
111
+	} else {
112
+					submit_button( __('Bring back this update'), 'button', 'undismiss', false );
113
+		}
106 114
 	echo '</p>';
107
-	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
108
-	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
115
+	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) {
116
+		    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
117
+	}
109 118
 	// Partial builds don't need language-specific warnings.
110 119
 	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111 120
 	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
@@ -172,8 +181,9 @@  discard block
 block discarded – undo
172 181
 				'mysql_version' => $required_mysql_version,
173 182
 			);
174 183
 			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
175
-			if ( $should_auto_update )
176
-				echo ' ' . __( 'Future security updates will be applied automatically.' );
184
+			if ( $should_auto_update ) {
185
+							echo ' ' . __( 'Future security updates will be applied automatically.' );
186
+			}
177 187
 		}
178 188
 		echo '</h2>';
179 189
 	} else {
@@ -232,10 +242,11 @@  discard block
 block discarded – undo
232 242
 	$form_action = 'update-core.php?action=do-plugin-upgrade';
233 243
 
234 244
 	$core_updates = get_core_updates();
235
-	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
236
-		$core_update_version = false;
237
-	else
238
-		$core_update_version = $core_updates[0]->current;
245
+	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) {
246
+			$core_update_version = false;
247
+	} else {
248
+			$core_update_version = $core_updates[0]->current;
249
+	}
239 250
 	?>
240 251
 <h2><?php _e( 'Plugins' ); ?></h2>
241 252
 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
@@ -435,17 +446,19 @@  discard block
 block discarded – undo
435 446
 
436 447
 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
437 448
 
438
-	if ( $reinstall )
439
-		$url = 'update-core.php?action=do-core-reinstall';
440
-	else
441
-		$url = 'update-core.php?action=do-core-upgrade';
449
+	if ( $reinstall ) {
450
+			$url = 'update-core.php?action=do-core-reinstall';
451
+	} else {
452
+			$url = 'update-core.php?action=do-core-upgrade';
453
+	}
442 454
 	$url = wp_nonce_url($url, 'upgrade-core');
443 455
 
444 456
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
445 457
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
446 458
 	$update = find_core_update( $version, $locale );
447
-	if ( !$update )
448
-		return;
459
+	if ( !$update ) {
460
+			return;
461
+	}
449 462
 
450 463
 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
451 464
 	// that it's safe to do so. This only happens when there are no new files to create.
@@ -469,14 +482,16 @@  discard block
 block discarded – undo
469 482
 	}
470 483
 
471 484
 	if ( $wp_filesystem->errors->get_error_code() ) {
472
-		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
473
-			show_message($message);
485
+		foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
486
+					show_message($message);
487
+		}
474 488
 		echo '</div>';
475 489
 		return;
476 490
 	}
477 491
 
478
-	if ( $reinstall )
479
-		$update->response = 'reinstall';
492
+	if ( $reinstall ) {
493
+			$update->response = 'reinstall';
494
+	}
480 495
 
481 496
 	add_filter( 'update_feedback', 'show_message' );
482 497
 
@@ -487,8 +502,9 @@  discard block
 block discarded – undo
487 502
 
488 503
 	if ( is_wp_error($result) ) {
489 504
 		show_message($result);
490
-		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
491
-			show_message( __('Installation Failed') );
505
+		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
506
+					show_message( __('Installation Failed') );
507
+		}
492 508
 		echo '</div>';
493 509
 		return;
494 510
 	}
@@ -511,8 +527,9 @@  discard block
 block discarded – undo
511 527
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
512 528
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
513 529
 	$update = find_core_update( $version, $locale );
514
-	if ( !$update )
515
-		return;
530
+	if ( !$update ) {
531
+			return;
532
+	}
516 533
 	dismiss_core_update( $update );
517 534
 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
518 535
 	exit;
@@ -525,8 +542,9 @@  discard block
 block discarded – undo
525 542
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
526 543
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
527 544
 	$update = find_core_update( $version, $locale );
528
-	if ( !$update )
529
-		return;
545
+	if ( !$update ) {
546
+			return;
547
+	}
530 548
 	undismiss_core_update( $version, $locale );
531 549
 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
532 550
 	exit;
@@ -584,10 +602,11 @@  discard block
 block discarded – undo
584 602
 	<?php
585 603
 	if ( $upgrade_error ) {
586 604
 		echo '<div class="error"><p>';
587
-		if ( $upgrade_error == 'themes' )
588
-			_e('Please select one or more themes to update.');
589
-		else
590
-			_e('Please select one or more plugins to update.');
605
+		if ( $upgrade_error == 'themes' ) {
606
+					_e('Please select one or more themes to update.');
607
+		} else {
608
+					_e('Please select one or more plugins to update.');
609
+		}
591 610
 		echo '</p></div>';
592 611
 	}
593 612
 
@@ -597,14 +616,18 @@  discard block
 block discarded – undo
597 616
 	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
598 617
 	echo '</p>';
599 618
 
600
-	if ( $core = current_user_can( 'update_core' ) )
601
-		core_upgrade_preamble();
602
-	if ( $plugins = current_user_can( 'update_plugins' ) )
603
-		list_plugin_updates();
604
-	if ( $themes = current_user_can( 'update_themes' ) )
605
-		list_theme_updates();
606
-	if ( $core || $plugins || $themes )
607
-		list_translation_updates();
619
+	if ( $core = current_user_can( 'update_core' ) ) {
620
+			core_upgrade_preamble();
621
+	}
622
+	if ( $plugins = current_user_can( 'update_plugins' ) ) {
623
+			list_plugin_updates();
624
+	}
625
+	if ( $themes = current_user_can( 'update_themes' ) ) {
626
+			list_theme_updates();
627
+	}
628
+	if ( $core || $plugins || $themes ) {
629
+			list_translation_updates();
630
+	}
608 631
 	unset( $core, $plugins, $themes );
609 632
 	/**
610 633
 	 * Fires after the core, plugin, and theme update tables.
@@ -617,32 +640,37 @@  discard block
 block discarded – undo
617 640
 
618 641
 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
619 642
 
620
-	if ( ! current_user_can( 'update_core' ) )
621
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
643
+	if ( ! current_user_can( 'update_core' ) ) {
644
+			wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
645
+	}
622 646
 
623 647
 	check_admin_referer('upgrade-core');
624 648
 
625 649
 	// Do the (un)dismiss actions before headers, so that they can redirect.
626
-	if ( isset( $_POST['dismiss'] ) )
627
-		do_dismiss_core_update();
628
-	elseif ( isset( $_POST['undismiss'] ) )
629
-		do_undismiss_core_update();
650
+	if ( isset( $_POST['dismiss'] ) ) {
651
+			do_dismiss_core_update();
652
+	} elseif ( isset( $_POST['undismiss'] ) ) {
653
+			do_undismiss_core_update();
654
+	}
630 655
 
631 656
 	require_once(ABSPATH . 'wp-admin/admin-header.php');
632
-	if ( 'do-core-reinstall' == $action )
633
-		$reinstall = true;
634
-	else
635
-		$reinstall = false;
657
+	if ( 'do-core-reinstall' == $action ) {
658
+			$reinstall = true;
659
+	} else {
660
+			$reinstall = false;
661
+	}
636 662
 
637
-	if ( isset( $_POST['upgrade'] ) )
638
-		do_core_upgrade($reinstall);
663
+	if ( isset( $_POST['upgrade'] ) ) {
664
+			do_core_upgrade($reinstall);
665
+	}
639 666
 
640 667
 	include(ABSPATH . 'wp-admin/admin-footer.php');
641 668
 
642 669
 } elseif ( 'do-plugin-upgrade' == $action ) {
643 670
 
644
-	if ( ! current_user_can( 'update_plugins' ) )
645
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
671
+	if ( ! current_user_can( 'update_plugins' ) ) {
672
+			wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
673
+	}
646 674
 
647 675
 	check_admin_referer('upgrade-core');
648 676
 
@@ -669,8 +697,9 @@  discard block
 block discarded – undo
669 697
 
670 698
 } elseif ( 'do-theme-upgrade' == $action ) {
671 699
 
672
-	if ( ! current_user_can( 'update_themes' ) )
673
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
700
+	if ( ! current_user_can( 'update_themes' ) ) {
701
+			wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
702
+	}
674 703
 
675 704
 	check_admin_referer('upgrade-core');
676 705
 
@@ -699,8 +728,9 @@  discard block
 block discarded – undo
699 728
 
700 729
 } elseif ( 'do-translation-upgrade' == $action ) {
701 730
 
702
-	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
703
-		wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
731
+	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) {
732
+			wp_die( __( 'You do not have sufficient permissions to update this site.' ) );
733
+	}
704 734
 
705 735
 	check_admin_referer( 'upgrade-translations' );
706 736
 
Please login to merge, or discard this patch.
src/wp-admin/custom-header.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The custom header image script.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * The custom header image script.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * The custom header image class.
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 
43 43
 	/**
44 44
 	 * Used to trigger a success message when settings updated and set to true.
45
- 	 *
45
+	 *
46 46
 	 * @since 3.0.0
47 47
 	 * @access private
48 48
 	 * @var bool
Please login to merge, or discard this patch.
Spacing   +368 added lines, -368 removed lines patch added patch discarded remove patch
@@ -60,12 +60,12 @@  discard block
 block discarded – undo
60 60
 		$this->admin_header_callback = $admin_header_callback;
61 61
 		$this->admin_image_div_callback = $admin_image_div_callback;
62 62
 
63
-		add_action( 'admin_menu', array( $this, 'init' ) );
63
+		add_action('admin_menu', array($this, 'init'));
64 64
 
65
-		add_action( 'customize_save_after',         array( $this, 'customize_set_last_used' ) );
66
-		add_action( 'wp_ajax_custom-header-crop',   array( $this, 'ajax_header_crop'        ) );
67
-		add_action( 'wp_ajax_custom-header-add',    array( $this, 'ajax_header_add'         ) );
68
-		add_action( 'wp_ajax_custom-header-remove', array( $this, 'ajax_header_remove'      ) );
65
+		add_action('customize_save_after', array($this, 'customize_set_last_used'));
66
+		add_action('wp_ajax_custom-header-crop', array($this, 'ajax_header_crop'));
67
+		add_action('wp_ajax_custom-header-add', array($this, 'ajax_header_add'));
68
+		add_action('wp_ajax_custom-header-remove', array($this, 'ajax_header_remove'));
69 69
 	}
70 70
 
71 71
 	/**
@@ -74,18 +74,18 @@  discard block
 block discarded – undo
74 74
 	 * @since 2.1.0
75 75
 	 */
76 76
 	public function init() {
77
-		$page = add_theme_page( __( 'Header' ), __( 'Header' ), 'edit_theme_options', 'custom-header', array( $this, 'admin_page' ) );
78
-		if ( ! $page ) {
77
+		$page = add_theme_page(__('Header'), __('Header'), 'edit_theme_options', 'custom-header', array($this, 'admin_page'));
78
+		if ( ! $page) {
79 79
 			return;
80 80
 		}
81 81
 
82
-		add_action( "admin_print_scripts-$page", array( $this, 'js_includes' ) );
83
-		add_action( "admin_print_styles-$page", array( $this, 'css_includes' ) );
84
-		add_action( "admin_head-$page", array( $this, 'help' ) );
85
-		add_action( "admin_head-$page", array( $this, 'take_action' ), 50 );
86
-		add_action( "admin_head-$page", array( $this, 'js' ), 50 );
87
-		if ( $this->admin_header_callback ) {
88
-			add_action( "admin_head-$page", $this->admin_header_callback, 51 );
82
+		add_action("admin_print_scripts-$page", array($this, 'js_includes'));
83
+		add_action("admin_print_styles-$page", array($this, 'css_includes'));
84
+		add_action("admin_head-$page", array($this, 'help'));
85
+		add_action("admin_head-$page", array($this, 'take_action'), 50);
86
+		add_action("admin_head-$page", array($this, 'js'), 50);
87
+		if ($this->admin_header_callback) {
88
+			add_action("admin_head-$page", $this->admin_header_callback, 51);
89 89
 		}
90 90
 	}
91 91
 
@@ -95,37 +95,37 @@  discard block
 block discarded – undo
95 95
 	 * @since 3.0.0
96 96
 	 */
97 97
 	public function help() {
98
-		get_current_screen()->add_help_tab( array(
98
+		get_current_screen()->add_help_tab(array(
99 99
 			'id'      => 'overview',
100 100
 			'title'   => __('Overview'),
101 101
 			'content' =>
102
-				'<p>' . __( 'This screen is used to customize the header section of your theme.') . '</p>' .
103
-				'<p>' . __( 'You can choose from the theme&#8217;s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.') . '<p>'
104
-		) );
102
+				'<p>'.__('This screen is used to customize the header section of your theme.').'</p>'.
103
+				'<p>'.__('You can choose from the theme&#8217;s default header images, or use one of your own. You can also customize how your Site Title and Tagline are displayed.').'<p>'
104
+		));
105 105
 
106
-		get_current_screen()->add_help_tab( array(
106
+		get_current_screen()->add_help_tab(array(
107 107
 			'id'      => 'set-header-image',
108 108
 			'title'   => __('Header Image'),
109 109
 			'content' =>
110
-				'<p>' . __( 'You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button.' ) . '</p>' .
111
-				'<p>' . __( 'Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the &#8220;Save Changes&#8221; button.' ) . '</p>' .
112
-				'<p>' . __( 'If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the &#8220;Random&#8221; radio button next to the Uploaded Images or Default Images section to enable this feature.') . '</p>' .
113
-				'<p>' . __( 'If you don&#8217;t want a header image to be displayed on your site at all, click the &#8220;Remove Header Image&#8221; button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click &#8220;Save Changes&#8221;.') . '</p>'
114
-		) );
110
+				'<p>'.__('You can set a custom image header for your site. Simply upload the image and crop it, and the new header will go live immediately. Alternatively, you can use an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button.').'</p>'.
111
+				'<p>'.__('Some themes come with additional header images bundled. If you see multiple images displayed, select the one you&#8217;d like and click the &#8220;Save Changes&#8221; button.').'</p>'.
112
+				'<p>'.__('If your theme has more than one default header image, or you have uploaded more than one custom header image, you have the option of having WordPress display a randomly different image on each page of your site. Click the &#8220;Random&#8221; radio button next to the Uploaded Images or Default Images section to enable this feature.').'</p>'.
113
+				'<p>'.__('If you don&#8217;t want a header image to be displayed on your site at all, click the &#8220;Remove Header Image&#8221; button at the bottom of the Header Image section of this page. If you want to re-enable the header image later, you just have to select one of the other image options and click &#8220;Save Changes&#8221;.').'</p>'
114
+		));
115 115
 
116
-		get_current_screen()->add_help_tab( array(
116
+		get_current_screen()->add_help_tab(array(
117 117
 			'id'      => 'set-header-text',
118 118
 			'title'   => __('Header Text'),
119 119
 			'content' =>
120
-				'<p>' . sprintf( __( 'For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.' ), admin_url( 'options-general.php' ) ) . '<p>' .
121
-				'<p>' . __( 'In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' .
122
-				'<p>' . __( 'Don&#8217;t forget to click &#8220;Save Changes&#8221; when you&#8217;re done!') . '</p>'
123
-		) );
120
+				'<p>'.sprintf(__('For most themes, the header text is your Site Title and Tagline, as defined in the <a href="%1$s">General Settings</a> section.'), admin_url('options-general.php')).'<p>'.
121
+				'<p>'.__('In the Header Text section of this page, you can choose whether to display this text or hide it. You can also choose a color for the text by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.').'</p>'.
122
+				'<p>'.__('Don&#8217;t forget to click &#8220;Save Changes&#8221; when you&#8217;re done!').'</p>'
123
+		));
124 124
 
125 125
 		get_current_screen()->set_help_sidebar(
126
-			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
127
-			'<p>' . __( '<a href="https://codex.wordpress.org/Appearance_Header_Screen" target="_blank">Documentation on Custom Header</a>' ) . '</p>' .
128
-			'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
126
+			'<p><strong>'.__('For more information:').'</strong></p>'.
127
+			'<p>'.__('<a href="https://codex.wordpress.org/Appearance_Header_Screen" target="_blank">Documentation on Custom Header</a>').'</p>'.
128
+			'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
129 129
 		);
130 130
 	}
131 131
 
@@ -137,13 +137,13 @@  discard block
 block discarded – undo
137 137
 	 * @return int Current step
138 138
 	 */
139 139
 	public function step() {
140
-		if ( ! isset( $_GET['step'] ) )
140
+		if ( ! isset($_GET['step']))
141 141
 			return 1;
142 142
 
143 143
 		$step = (int) $_GET['step'];
144
-		if ( $step < 1 || 3 < $step ||
145
-			( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) ||
146
-			( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) )
144
+		if ($step < 1 || 3 < $step ||
145
+			(2 == $step && ! wp_verify_nonce($_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload')) ||
146
+			(3 == $step && ! wp_verify_nonce($_REQUEST['_wpnonce'], 'custom-header-crop-image'))
147 147
 		)
148 148
 			return 1;
149 149
 
@@ -158,12 +158,12 @@  discard block
 block discarded – undo
158 158
 	public function js_includes() {
159 159
 		$step = $this->step();
160 160
 
161
-		if ( ( 1 == $step || 3 == $step ) ) {
161
+		if ((1 == $step || 3 == $step)) {
162 162
 			wp_enqueue_media();
163
-			wp_enqueue_script( 'custom-header' );
164
-			if ( current_theme_supports( 'custom-header', 'header-text' ) )
165
-				wp_enqueue_script( 'wp-color-picker' );
166
-		} elseif ( 2 == $step ) {
163
+			wp_enqueue_script('custom-header');
164
+			if (current_theme_supports('custom-header', 'header-text'))
165
+				wp_enqueue_script('wp-color-picker');
166
+		} elseif (2 == $step) {
167 167
 			wp_enqueue_script('imgareaselect');
168 168
 		}
169 169
 	}
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	public function css_includes() {
177 177
 		$step = $this->step();
178 178
 
179
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
180
-			wp_enqueue_style( 'wp-color-picker' );
181
-		elseif ( 2 == $step )
179
+		if ((1 == $step || 3 == $step) && current_theme_supports('custom-header', 'header-text'))
180
+			wp_enqueue_style('wp-color-picker');
181
+		elseif (2 == $step)
182 182
 			wp_enqueue_style('imgareaselect');
183 183
 	}
184 184
 
@@ -188,42 +188,42 @@  discard block
 block discarded – undo
188 188
 	 * @since 2.6.0
189 189
 	 */
190 190
 	public function take_action() {
191
-		if ( ! current_user_can('edit_theme_options') )
191
+		if ( ! current_user_can('edit_theme_options'))
192 192
 			return;
193 193
 
194
-		if ( empty( $_POST ) )
194
+		if (empty($_POST))
195 195
 			return;
196 196
 
197 197
 		$this->updated = true;
198 198
 
199
-		if ( isset( $_POST['resetheader'] ) ) {
200
-			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
199
+		if (isset($_POST['resetheader'])) {
200
+			check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
201 201
 			$this->reset_header_image();
202 202
 			return;
203 203
 		}
204 204
 
205
-		if ( isset( $_POST['removeheader'] ) ) {
206
-			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
205
+		if (isset($_POST['removeheader'])) {
206
+			check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
207 207
 			$this->remove_header_image();
208 208
 			return;
209 209
 		}
210 210
 
211
-		if ( isset( $_POST['text-color'] ) && ! isset( $_POST['display-header-text'] ) ) {
212
-			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
213
-			set_theme_mod( 'header_textcolor', 'blank' );
214
-		} elseif ( isset( $_POST['text-color'] ) ) {
215
-			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
216
-			$_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );
211
+		if (isset($_POST['text-color']) && ! isset($_POST['display-header-text'])) {
212
+			check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
213
+			set_theme_mod('header_textcolor', 'blank');
214
+		} elseif (isset($_POST['text-color'])) {
215
+			check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
216
+			$_POST['text-color'] = str_replace('#', '', $_POST['text-color']);
217 217
 			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
218
-			if ( strlen($color) == 6 || strlen($color) == 3 )
218
+			if (strlen($color) == 6 || strlen($color) == 3)
219 219
 				set_theme_mod('header_textcolor', $color);
220
-			elseif ( ! $color )
221
-				set_theme_mod( 'header_textcolor', 'blank' );
220
+			elseif ( ! $color)
221
+				set_theme_mod('header_textcolor', 'blank');
222 222
 		}
223 223
 
224
-		if ( isset( $_POST['default-header'] ) ) {
225
-			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
226
-			$this->set_header_image( $_POST['default-header'] );
224
+		if (isset($_POST['default-header'])) {
225
+			check_admin_referer('custom-header-options', '_wpnonce-custom-header-options');
226
+			$this->set_header_image($_POST['default-header']);
227 227
 			return;
228 228
 		}
229 229
 	}
@@ -238,19 +238,19 @@  discard block
 block discarded – undo
238 238
 	public function process_default_headers() {
239 239
 		global $_wp_default_headers;
240 240
 
241
-		if ( !isset($_wp_default_headers) )
241
+		if ( ! isset($_wp_default_headers))
242 242
 			return;
243 243
 
244
-		if ( ! empty( $this->default_headers ) ) {
244
+		if ( ! empty($this->default_headers)) {
245 245
 			return;
246 246
 		}
247 247
 
248 248
 		$this->default_headers = $_wp_default_headers;
249 249
 		$template_directory_uri = get_template_directory_uri();
250 250
 		$stylesheet_directory_uri = get_stylesheet_directory_uri();
251
-		foreach ( array_keys($this->default_headers) as $header ) {
252
-			$this->default_headers[$header]['url'] =  sprintf( $this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri );
253
-			$this->default_headers[$header]['thumbnail_url'] =  sprintf( $this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri );
251
+		foreach (array_keys($this->default_headers) as $header) {
252
+			$this->default_headers[$header]['url'] = sprintf($this->default_headers[$header]['url'], $template_directory_uri, $stylesheet_directory_uri);
253
+			$this->default_headers[$header]['thumbnail_url'] = sprintf($this->default_headers[$header]['thumbnail_url'], $template_directory_uri, $stylesheet_directory_uri);
254 254
 		}
255 255
 	}
256 256
 
@@ -265,33 +265,33 @@  discard block
 block discarded – undo
265 265
 	 * @param string $type The header type. One of 'default' (for the Uploaded Images control)
266 266
 	 *                     or 'uploaded' (for the Uploaded Images control).
267 267
 	 */
268
-	public function show_header_selector( $type = 'default' ) {
269
-		if ( 'default' == $type ) {
268
+	public function show_header_selector($type = 'default') {
269
+		if ('default' == $type) {
270 270
 			$headers = $this->default_headers;
271 271
 		} else {
272 272
 			$headers = get_uploaded_header_images();
273 273
 			$type = 'uploaded';
274 274
 		}
275 275
 
276
-		if ( 1 < count( $headers ) ) {
276
+		if (1 < count($headers)) {
277 277
 			echo '<div class="random-header">';
278
-			echo '<label><input name="default-header" type="radio" value="random-' . $type . '-image"' . checked( is_random_header_image( $type ), true, false ) . ' />';
279
-			_e( '<strong>Random:</strong> Show a different image on each page.' );
278
+			echo '<label><input name="default-header" type="radio" value="random-'.$type.'-image"'.checked(is_random_header_image($type), true, false).' />';
279
+			_e('<strong>Random:</strong> Show a different image on each page.');
280 280
 			echo '</label>';
281 281
 			echo '</div>';
282 282
 		}
283 283
 
284 284
 		echo '<div class="available-headers">';
285
-		foreach ( $headers as $header_key => $header ) {
285
+		foreach ($headers as $header_key => $header) {
286 286
 			$header_thumbnail = $header['thumbnail_url'];
287 287
 			$header_url = $header['url'];
288
-			$header_alt_text = empty( $header['alt_text'] ) ? '' : $header['alt_text'];
288
+			$header_alt_text = empty($header['alt_text']) ? '' : $header['alt_text'];
289 289
 			echo '<div class="default-header">';
290
-			echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
290
+			echo '<label><input name="default-header" type="radio" value="'.esc_attr($header_key).'" '.checked($header_url, get_theme_mod('header_image'), false).' />';
291 291
 			$width = '';
292
-			if ( !empty( $header['attachment_id'] ) )
292
+			if ( ! empty($header['attachment_id']))
293 293
 				$width = ' width="230"';
294
-			echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'"' . $width . ' /></label>';
294
+			echo '<img src="'.set_url_scheme($header_thumbnail).'" alt="'.esc_attr($header_alt_text).'"'.$width.' /></label>';
295 295
 			echo '</div>';
296 296
 		}
297 297
 		echo '<div class="clear"></div></div>';
@@ -304,9 +304,9 @@  discard block
 block discarded – undo
304 304
 	 */
305 305
 	public function js() {
306 306
 		$step = $this->step();
307
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
307
+		if ((1 == $step || 3 == $step) && current_theme_supports('custom-header', 'header-text'))
308 308
 			$this->js_1();
309
-		elseif ( 2 == $step )
309
+		elseif (2 == $step)
310 310
 			$this->js_2();
311 311
 	}
312 312
 
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 	 */
318 318
 	public function js_1() {
319 319
 		$default_color = '';
320
-		if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
321
-			$default_color = get_theme_support( 'custom-header', 'default-text-color' );
322
-			if ( $default_color && false === strpos( $default_color, '#' ) ) {
323
-				$default_color = '#' . $default_color;
320
+		if (current_theme_supports('custom-header', 'default-text-color')) {
321
+			$default_color = get_theme_support('custom-header', 'default-text-color');
322
+			if ($default_color && false === strpos($default_color, '#')) {
323
+				$default_color = '#'.$default_color;
324 324
 			}
325 325
 		}
326 326
 		?>
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 			}
363 363
 		});
364 364
 		$('#display-header-text').click( toggle_text );
365
-		<?php if ( ! display_header_text() ) : ?>
365
+		<?php if ( ! display_header_text()) : ?>
366 366
 		toggle_text();
367 367
 		<?php endif; ?>
368 368
 	});
@@ -386,8 +386,8 @@  discard block
 block discarded – undo
386 386
 	}
387 387
 
388 388
 	jQuery(document).ready(function() {
389
-		var xinit = <?php echo absint( get_theme_support( 'custom-header', 'width' ) ); ?>;
390
-		var yinit = <?php echo absint( get_theme_support( 'custom-header', 'height' ) ); ?>;
389
+		var xinit = <?php echo absint(get_theme_support('custom-header', 'width')); ?>;
390
+		var yinit = <?php echo absint(get_theme_support('custom-header', 'height')); ?>;
391 391
 		var ratio = xinit / yinit;
392 392
 		var ximg = jQuery('img#upload').width();
393 393
 		var yimg = jQuery('img#upload').height();
@@ -411,19 +411,19 @@  discard block
 block discarded – undo
411 411
 			x2: xinit,
412 412
 			y2: yinit,
413 413
 			<?php
414
-			if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
414
+			if ( ! current_theme_supports('custom-header', 'flex-height') && ! current_theme_supports('custom-header', 'flex-width')) {
415 415
 			?>
416 416
 			aspectRatio: xinit + ':' + yinit,
417 417
 			<?php
418 418
 			}
419
-			if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) {
419
+			if ( ! current_theme_supports('custom-header', 'flex-height')) {
420 420
 			?>
421
-			maxHeight: <?php echo get_theme_support( 'custom-header', 'height' ); ?>,
421
+			maxHeight: <?php echo get_theme_support('custom-header', 'height'); ?>,
422 422
 			<?php
423 423
 			}
424
-			if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
424
+			if ( ! current_theme_supports('custom-header', 'flex-width')) {
425 425
 			?>
426
-			maxWidth: <?php echo get_theme_support( 'custom-header', 'width' ); ?>,
426
+			maxWidth: <?php echo get_theme_support('custom-header', 'width'); ?>,
427 427
 			<?php
428 428
 			}
429 429
 			?>
@@ -453,144 +453,144 @@  discard block
 block discarded – undo
453 453
 ?>
454 454
 
455 455
 <div class="wrap">
456
-<h1><?php _e( 'Custom Header' ); ?></h1>
456
+<h1><?php _e('Custom Header'); ?></h1>
457 457
 
458
-<?php if ( current_user_can( 'customize' ) ) { ?>
458
+<?php if (current_user_can('customize')) { ?>
459 459
 <div class="notice notice-info hide-if-no-customize">
460 460
 	<p>
461 461
 		<?php
462 462
 		printf(
463
-			__( 'You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.' ),
464
-			admin_url( 'customize.php?autofocus[control]=header_image' )
463
+			__('You can now manage and live-preview Custom Header in the <a href="%1$s">Customizer</a>.'),
464
+			admin_url('customize.php?autofocus[control]=header_image')
465 465
 		);
466 466
 		?>
467 467
 	</p>
468 468
 </div>
469 469
 <?php } ?>
470 470
 
471
-<?php if ( ! empty( $this->updated ) ) { ?>
471
+<?php if ( ! empty($this->updated)) { ?>
472 472
 <div id="message" class="updated">
473
-<p><?php printf( __( 'Header updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
473
+<p><?php printf(__('Header updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url('/')); ?></p>
474 474
 </div>
475 475
 <?php } ?>
476 476
 
477
-<h3><?php _e( 'Header Image' ); ?></h3>
477
+<h3><?php _e('Header Image'); ?></h3>
478 478
 
479 479
 <table class="form-table">
480 480
 <tbody>
481 481
 
482
-<?php if ( get_custom_header() || display_header_text() ) : ?>
482
+<?php if (get_custom_header() || display_header_text()) : ?>
483 483
 <tr>
484
-<th scope="row"><?php _e( 'Preview' ); ?></th>
484
+<th scope="row"><?php _e('Preview'); ?></th>
485 485
 <td>
486 486
 	<?php
487
-	if ( $this->admin_image_div_callback ) {
488
-		call_user_func( $this->admin_image_div_callback );
487
+	if ($this->admin_image_div_callback) {
488
+		call_user_func($this->admin_image_div_callback);
489 489
 	} else {
490 490
 		$custom_header = get_custom_header();
491 491
 		$header_image = get_header_image();
492 492
 
493
-		if ( $header_image ) {
494
-			$header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
495
-		}  else {
493
+		if ($header_image) {
494
+			$header_image_style = 'background-image:url('.esc_url($header_image).');';
495
+		} else {
496 496
 			$header_image_style = '';
497 497
 		}
498 498
 
499
-		if ( $custom_header->width )
500
-			$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
501
-		if ( $custom_header->height )
502
-			$header_image_style .= 'height:' . $custom_header->height . 'px;';
499
+		if ($custom_header->width)
500
+			$header_image_style .= 'max-width:'.$custom_header->width.'px;';
501
+		if ($custom_header->height)
502
+			$header_image_style .= 'height:'.$custom_header->height.'px;';
503 503
 	?>
504 504
 	<div id="headimg" style="<?php echo $header_image_style; ?>">
505 505
 		<?php
506
-		if ( display_header_text() )
507
-			$style = ' style="color:#' . get_header_textcolor() . ';"';
506
+		if (display_header_text())
507
+			$style = ' style="color:#'.get_header_textcolor().';"';
508 508
 		else
509 509
 			$style = ' style="display:none;"';
510 510
 		?>
511
-		<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
512
-		<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
511
+		<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo('name'); ?></a></h1>
512
+		<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo('description'); ?></div>
513 513
 	</div>
514 514
 	<?php } ?>
515 515
 </td>
516 516
 </tr>
517 517
 <?php endif; ?>
518 518
 
519
-<?php if ( current_user_can( 'upload_files' ) && current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
519
+<?php if (current_user_can('upload_files') && current_theme_supports('custom-header', 'uploads')) : ?>
520 520
 <tr>
521
-<th scope="row"><?php _e( 'Select Image' ); ?></th>
521
+<th scope="row"><?php _e('Select Image'); ?></th>
522 522
 <td>
523
-	<p><?php _e( 'You can select an image to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an image you will be able to crop it.' ); ?><br />
523
+	<p><?php _e('You can select an image to be shown at the top of your site by uploading from your computer or choosing from your media library. After selecting an image you will be able to crop it.'); ?><br />
524 524
 	<?php
525
-	if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
526
-		printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
527
-	} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
528
-		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) )
525
+	if ( ! current_theme_supports('custom-header', 'flex-height') && ! current_theme_supports('custom-header', 'flex-width')) {
526
+		printf(__('Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.').'<br />', get_theme_support('custom-header', 'width'), get_theme_support('custom-header', 'height'));
527
+	} elseif (current_theme_supports('custom-header', 'flex-height')) {
528
+		if ( ! current_theme_supports('custom-header', 'flex-width'))
529 529
 			printf(
530 530
 				/* translators: %s: size in pixels */
531
-				__( 'Images should be at least %s wide.' ) . ' ',
531
+				__('Images should be at least %s wide.').' ',
532 532
 				sprintf(
533 533
 					/* translators: %d: custom header width */
534
-					'<strong>' . __( '%d pixels' ) . '</strong>',
535
-					get_theme_support( 'custom-header', 'width' )
534
+					'<strong>'.__('%d pixels').'</strong>',
535
+					get_theme_support('custom-header', 'width')
536 536
 				)
537 537
 			);
538
-	} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
539
-		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) )
538
+	} elseif (current_theme_supports('custom-header', 'flex-width')) {
539
+		if ( ! current_theme_supports('custom-header', 'flex-height'))
540 540
 			printf(
541 541
 				/* translators: %s: size in pixels */
542
-				__( 'Images should be at least %s tall.' ) . ' ',
542
+				__('Images should be at least %s tall.').' ',
543 543
 				sprintf(
544 544
 					/* translators: %d: custom header height */
545
-					'<strong>' . __( '%d pixels' ) . '</strong>',
546
-					get_theme_support( 'custom-header', 'height' )
545
+					'<strong>'.__('%d pixels').'</strong>',
546
+					get_theme_support('custom-header', 'height')
547 547
 				)
548 548
 			);
549 549
 	}
550
-	if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
551
-		if ( current_theme_supports( 'custom-header', 'width' ) )
550
+	if (current_theme_supports('custom-header', 'flex-height') || current_theme_supports('custom-header', 'flex-width')) {
551
+		if (current_theme_supports('custom-header', 'width'))
552 552
 			printf(
553 553
 				/* translators: %s: size in pixels */
554
-				__( 'Suggested width is %s.' ) . ' ',
554
+				__('Suggested width is %s.').' ',
555 555
 				sprintf(
556 556
 					/* translators: %d: custom header width */
557
-					'<strong>' . __( '%d pixels' ) . '</strong>',
558
-					get_theme_support( 'custom-header', 'width' )
557
+					'<strong>'.__('%d pixels').'</strong>',
558
+					get_theme_support('custom-header', 'width')
559 559
 				)
560 560
 			);
561
-		if ( current_theme_supports( 'custom-header', 'height' ) )
561
+		if (current_theme_supports('custom-header', 'height'))
562 562
 			printf(
563 563
 				/* translators: %s: size in pixels */
564
-				__( 'Suggested height is %s.' ) . ' ',
564
+				__('Suggested height is %s.').' ',
565 565
 				sprintf(
566 566
 					/* translators: %d: custom header height */
567
-					'<strong>' . __( '%d pixels' ) . '</strong>',
568
-					get_theme_support( 'custom-header', 'height' )
567
+					'<strong>'.__('%d pixels').'</strong>',
568
+					get_theme_support('custom-header', 'height')
569 569
 				)
570 570
 			);
571 571
 	}
572 572
 	?></p>
573
-	<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>">
573
+	<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url(add_query_arg('step', 2)) ?>">
574 574
 	<p>
575
-		<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
575
+		<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br />
576 576
 		<input type="file" id="upload" name="import" />
577 577
 		<input type="hidden" name="action" value="save" />
578
-		<?php wp_nonce_field( 'custom-header-upload', '_wpnonce-custom-header-upload' ); ?>
579
-		<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
578
+		<?php wp_nonce_field('custom-header-upload', '_wpnonce-custom-header-upload'); ?>
579
+		<?php submit_button(__('Upload'), 'button', 'submit', false); ?>
580 580
 	</p>
581 581
 	<?php
582
-		$modal_update_href = esc_url( add_query_arg( array(
582
+		$modal_update_href = esc_url(add_query_arg(array(
583 583
 			'page' => 'custom-header',
584 584
 			'step' => 2,
585 585
 			'_wpnonce-custom-header-upload' => wp_create_nonce('custom-header-upload'),
586
-		), admin_url('themes.php') ) );
586
+		), admin_url('themes.php')));
587 587
 	?>
588 588
 	<p>
589
-		<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
589
+		<label for="choose-from-library-link"><?php _e('Or choose an image from your media library:'); ?></label><br />
590 590
 		<button id="choose-from-library-link" class="button"
591
-			data-update-link="<?php echo esc_attr( $modal_update_href ); ?>"
592
-			data-choose="<?php esc_attr_e( 'Choose a Custom Header' ); ?>"
593
-			data-update="<?php esc_attr_e( 'Set as header' ); ?>"><?php _e( 'Choose Image' ); ?></button>
591
+			data-update-link="<?php echo esc_attr($modal_update_href); ?>"
592
+			data-choose="<?php esc_attr_e('Choose a Custom Header'); ?>"
593
+			data-update="<?php esc_attr_e('Set as header'); ?>"><?php _e('Choose Image'); ?></button>
594 594
 	</p>
595 595
 	</form>
596 596
 </td>
@@ -599,97 +599,97 @@  discard block
 block discarded – undo
599 599
 </tbody>
600 600
 </table>
601 601
 
602
-<form method="post" action="<?php echo esc_url( add_query_arg( 'step', 1 ) ) ?>">
603
-<?php submit_button( null, 'screen-reader-text', 'save-header-options', false ); ?>
602
+<form method="post" action="<?php echo esc_url(add_query_arg('step', 1)) ?>">
603
+<?php submit_button(null, 'screen-reader-text', 'save-header-options', false); ?>
604 604
 <table class="form-table">
605 605
 <tbody>
606
-	<?php if ( get_uploaded_header_images() ) : ?>
606
+	<?php if (get_uploaded_header_images()) : ?>
607 607
 <tr>
608
-<th scope="row"><?php _e( 'Uploaded Images' ); ?></th>
608
+<th scope="row"><?php _e('Uploaded Images'); ?></th>
609 609
 <td>
610
-	<p><?php _e( 'You can choose one of your previously uploaded headers, or show a random one.' ) ?></p>
610
+	<p><?php _e('You can choose one of your previously uploaded headers, or show a random one.') ?></p>
611 611
 	<?php
612
-		$this->show_header_selector( 'uploaded' );
612
+		$this->show_header_selector('uploaded');
613 613
 	?>
614 614
 </td>
615 615
 </tr>
616 616
 	<?php endif;
617
-	if ( ! empty( $this->default_headers ) ) : ?>
617
+	if ( ! empty($this->default_headers)) : ?>
618 618
 <tr>
619
-<th scope="row"><?php _e( 'Default Images' ); ?></th>
619
+<th scope="row"><?php _e('Default Images'); ?></th>
620 620
 <td>
621
-<?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
622
-	<p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p>
621
+<?php if (current_theme_supports('custom-header', 'uploads')) : ?>
622
+	<p><?php _e('If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.') ?></p>
623 623
 <?php else: ?>
624
-	<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p>
624
+	<p><?php _e('You can use one of these cool headers or show a random one on each page.') ?></p>
625 625
 <?php endif; ?>
626 626
 	<?php
627
-		$this->show_header_selector( 'default' );
627
+		$this->show_header_selector('default');
628 628
 	?>
629 629
 </td>
630 630
 </tr>
631 631
 	<?php endif;
632
-	if ( get_header_image() ) : ?>
632
+	if (get_header_image()) : ?>
633 633
 <tr>
634
-<th scope="row"><?php _e( 'Remove Image' ); ?></th>
634
+<th scope="row"><?php _e('Remove Image'); ?></th>
635 635
 <td>
636
-	<p><?php _e( 'This will remove the header image. You will not be able to restore any customizations.' ) ?></p>
637
-	<?php submit_button( __( 'Remove Header Image' ), 'button', 'removeheader', false ); ?>
636
+	<p><?php _e('This will remove the header image. You will not be able to restore any customizations.') ?></p>
637
+	<?php submit_button(__('Remove Header Image'), 'button', 'removeheader', false); ?>
638 638
 </td>
639 639
 </tr>
640 640
 	<?php endif;
641 641
 
642
-	$default_image = get_theme_support( 'custom-header', 'default-image' );
643
-	if ( $default_image && get_header_image() != $default_image ) : ?>
642
+	$default_image = get_theme_support('custom-header', 'default-image');
643
+	if ($default_image && get_header_image() != $default_image) : ?>
644 644
 <tr>
645
-<th scope="row"><?php _e( 'Reset Image' ); ?></th>
645
+<th scope="row"><?php _e('Reset Image'); ?></th>
646 646
 <td>
647
-	<p><?php _e( 'This will restore the original header image. You will not be able to restore any customizations.' ) ?></p>
648
-	<?php submit_button( __( 'Restore Original Header Image' ), 'button', 'resetheader', false ); ?>
647
+	<p><?php _e('This will restore the original header image. You will not be able to restore any customizations.') ?></p>
648
+	<?php submit_button(__('Restore Original Header Image'), 'button', 'resetheader', false); ?>
649 649
 </td>
650 650
 </tr>
651 651
 	<?php endif; ?>
652 652
 </tbody>
653 653
 </table>
654 654
 
655
-<?php if ( current_theme_supports( 'custom-header', 'header-text' ) ) : ?>
655
+<?php if (current_theme_supports('custom-header', 'header-text')) : ?>
656 656
 
657
-<h3><?php _e( 'Header Text' ); ?></h3>
657
+<h3><?php _e('Header Text'); ?></h3>
658 658
 
659 659
 <table class="form-table">
660 660
 <tbody>
661 661
 <tr>
662
-<th scope="row"><?php _e( 'Header Text' ); ?></th>
662
+<th scope="row"><?php _e('Header Text'); ?></th>
663 663
 <td>
664 664
 	<p>
665
-	<label><input type="checkbox" name="display-header-text" id="display-header-text"<?php checked( display_header_text() ); ?> /> <?php _e( 'Show header text with your image.' ); ?></label>
665
+	<label><input type="checkbox" name="display-header-text" id="display-header-text"<?php checked(display_header_text()); ?> /> <?php _e('Show header text with your image.'); ?></label>
666 666
 	</p>
667 667
 </td>
668 668
 </tr>
669 669
 
670 670
 <tr class="displaying-header-text">
671
-<th scope="row"><?php _e( 'Text Color' ); ?></th>
671
+<th scope="row"><?php _e('Text Color'); ?></th>
672 672
 <td>
673 673
 	<p>
674 674
 	<?php
675 675
 	$default_color = '';
676
-	if ( current_theme_supports( 'custom-header', 'default-text-color' ) ) {
677
-		$default_color = get_theme_support( 'custom-header', 'default-text-color' );
678
-		if ( $default_color && false === strpos( $default_color, '#' ) ) {
679
-			$default_color = '#' . $default_color;
676
+	if (current_theme_supports('custom-header', 'default-text-color')) {
677
+		$default_color = get_theme_support('custom-header', 'default-text-color');
678
+		if ($default_color && false === strpos($default_color, '#')) {
679
+			$default_color = '#'.$default_color;
680 680
 		}
681 681
 	}
682 682
 
683
-	$default_color_attr = $default_color ? ' data-default-color="' . esc_attr( $default_color ) . '"' : '';
683
+	$default_color_attr = $default_color ? ' data-default-color="'.esc_attr($default_color).'"' : '';
684 684
 
685
-	$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support( 'custom-header', 'default-text-color' );
686
-	if ( $header_textcolor && false === strpos( $header_textcolor, '#' ) ) {
687
-		$header_textcolor = '#' . $header_textcolor;
685
+	$header_textcolor = display_header_text() ? get_header_textcolor() : get_theme_support('custom-header', 'default-text-color');
686
+	if ($header_textcolor && false === strpos($header_textcolor, '#')) {
687
+		$header_textcolor = '#'.$header_textcolor;
688 688
 	}
689 689
 
690
-	echo '<input type="text" name="text-color" id="text-color" value="' . esc_attr( $header_textcolor ) . '"' . $default_color_attr . ' />';
691
-	if ( $default_color ) {
692
-		echo ' <span class="description hide-if-js">' . sprintf( _x( 'Default: %s', 'color' ), esc_html( $default_color ) ) . '</span>';
690
+	echo '<input type="text" name="text-color" id="text-color" value="'.esc_attr($header_textcolor).'"'.$default_color_attr.' />';
691
+	if ($default_color) {
692
+		echo ' <span class="description hide-if-js">'.sprintf(_x('Default: %s', 'color'), esc_html($default_color)).'</span>';
693 693
 	}
694 694
 	?>
695 695
 	</p>
@@ -704,11 +704,11 @@  discard block
 block discarded – undo
704 704
  *
705 705
  * @since 3.1.0
706 706
  */
707
-do_action( 'custom_header_options' );
707
+do_action('custom_header_options');
708 708
 
709
-wp_nonce_field( 'custom-header-options', '_wpnonce-custom-header-options' ); ?>
709
+wp_nonce_field('custom-header-options', '_wpnonce-custom-header-options'); ?>
710 710
 
711
-<?php submit_button( null, 'primary', 'save-header-options' ); ?>
711
+<?php submit_button(null, 'primary', 'save-header-options'); ?>
712 712
 </form>
713 713
 </div>
714 714
 
@@ -721,53 +721,53 @@  discard block
 block discarded – undo
721 721
 	 */
722 722
 	public function step_2() {
723 723
 		check_admin_referer('custom-header-upload', '_wpnonce-custom-header-upload');
724
-		if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
724
+		if ( ! current_theme_supports('custom-header', 'uploads')) {
725 725
 			wp_die(
726
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
727
-				'<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
726
+				'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
727
+				'<p>'.__('The current theme does not support uploading a custom header image.').'</p>',
728 728
 				403
729 729
 			);
730 730
 		}
731 731
 
732
-		if ( empty( $_POST ) && isset( $_GET['file'] ) ) {
733
-			$attachment_id = absint( $_GET['file'] );
734
-			$file = get_attached_file( $attachment_id, true );
735
-			$url = wp_get_attachment_image_src( $attachment_id, 'full' );
732
+		if (empty($_POST) && isset($_GET['file'])) {
733
+			$attachment_id = absint($_GET['file']);
734
+			$file = get_attached_file($attachment_id, true);
735
+			$url = wp_get_attachment_image_src($attachment_id, 'full');
736 736
 			$url = $url[0];
737
-		} elseif ( isset( $_POST ) ) {
737
+		} elseif (isset($_POST)) {
738 738
 			$data = $this->step_2_manage_upload();
739 739
 			$attachment_id = $data['attachment_id'];
740 740
 			$file = $data['file'];
741 741
 			$url = $data['url'];
742 742
 		}
743 743
 
744
-		if ( file_exists( $file ) ) {
745
-			list( $width, $height, $type, $attr ) = getimagesize( $file );
744
+		if (file_exists($file)) {
745
+			list($width, $height, $type, $attr) = getimagesize($file);
746 746
 		} else {
747
-			$data = wp_get_attachment_metadata( $attachment_id );
748
-			$height = isset( $data[ 'height' ] ) ? $data[ 'height' ] : 0;
749
-			$width = isset( $data[ 'width' ] ) ? $data[ 'width' ] : 0;
750
-			unset( $data );
747
+			$data = wp_get_attachment_metadata($attachment_id);
748
+			$height = isset($data['height']) ? $data['height'] : 0;
749
+			$width = isset($data['width']) ? $data['width'] : 0;
750
+			unset($data);
751 751
 		}
752 752
 
753 753
 		$max_width = 0;
754 754
 		// For flex, limit size of image displayed to 1500px unless theme says otherwise
755
-		if ( current_theme_supports( 'custom-header', 'flex-width' ) )
755
+		if (current_theme_supports('custom-header', 'flex-width'))
756 756
 			$max_width = 1500;
757 757
 
758
-		if ( current_theme_supports( 'custom-header', 'max-width' ) )
759
-			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
760
-		$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
758
+		if (current_theme_supports('custom-header', 'max-width'))
759
+			$max_width = max($max_width, get_theme_support('custom-header', 'max-width'));
760
+		$max_width = max($max_width, get_theme_support('custom-header', 'width'));
761 761
 
762 762
 		// If flexible height isn't supported and the image is the exact right size
763
-		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' )
764
-			&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) )
763
+		if ( ! current_theme_supports('custom-header', 'flex-height') && ! current_theme_supports('custom-header', 'flex-width')
764
+			&& $width == get_theme_support('custom-header', 'width') && $height == get_theme_support('custom-header', 'height'))
765 765
 		{
766 766
 			// Add the meta-data
767
-			if ( file_exists( $file ) )
768
-				wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
767
+			if (file_exists($file))
768
+				wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
769 769
 
770
-			$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
770
+			$this->set_header_image(compact('url', 'attachment_id', 'width', 'height'));
771 771
 
772 772
 			/**
773 773
 			 * Fires after the header image is set or an error is returned.
@@ -777,17 +777,17 @@  discard block
 block discarded – undo
777 777
 			 * @param string $file          Path to the file.
778 778
 			 * @param int    $attachment_id Attachment ID.
779 779
 			 */
780
-			do_action( 'wp_create_file_in_uploads', $file, $attachment_id ); // For replication
780
+			do_action('wp_create_file_in_uploads', $file, $attachment_id); // For replication
781 781
 
782 782
 			return $this->finished();
783
-		} elseif ( $width > $max_width ) {
783
+		} elseif ($width > $max_width) {
784 784
 			$oitar = $width / $max_width;
785 785
 			$image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
786
-			if ( ! $image || is_wp_error( $image ) )
787
-				wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
786
+			if ( ! $image || is_wp_error($image))
787
+				wp_die(__('Image could not be processed. Please go back and try again.'), __('Image Processing Error'));
788 788
 
789 789
 			/** This filter is documented in wp-admin/custom-header.php */
790
-			$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
790
+			$image = apply_filters('wp_create_file_in_uploads', $image, $attachment_id); // For replication
791 791
 
792 792
 			$url = str_replace(basename($url), basename($image), $url);
793 793
 			$width = $width / $oitar;
@@ -798,32 +798,32 @@  discard block
 block discarded – undo
798 798
 		?>
799 799
 
800 800
 <div class="wrap">
801
-<h1><?php _e( 'Crop Header Image' ); ?></h1>
801
+<h1><?php _e('Crop Header Image'); ?></h1>
802 802
 
803 803
 <form method="post" action="<?php echo esc_url(add_query_arg('step', 3)); ?>">
804 804
 	<p class="hide-if-no-js"><?php _e('Choose the part of the image you want to use as your header.'); ?></p>
805
-	<p class="hide-if-js"><strong><?php _e( 'You need JavaScript to choose a part of the image.'); ?></strong></p>
805
+	<p class="hide-if-js"><strong><?php _e('You need JavaScript to choose a part of the image.'); ?></strong></p>
806 806
 
807 807
 	<div id="crop_image" style="position: relative">
808
-		<img src="<?php echo esc_url( $url ); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" alt="" />
808
+		<img src="<?php echo esc_url($url); ?>" id="upload" width="<?php echo $width; ?>" height="<?php echo $height; ?>" alt="" />
809 809
 	</div>
810 810
 
811 811
 	<input type="hidden" name="x1" id="x1" value="0"/>
812 812
 	<input type="hidden" name="y1" id="y1" value="0"/>
813
-	<input type="hidden" name="width" id="width" value="<?php echo esc_attr( $width ); ?>"/>
814
-	<input type="hidden" name="height" id="height" value="<?php echo esc_attr( $height ); ?>"/>
815
-	<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr( $attachment_id ); ?>" />
816
-	<input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr( $oitar ); ?>" />
817
-	<?php if ( empty( $_POST ) && isset( $_GET['file'] ) ) { ?>
813
+	<input type="hidden" name="width" id="width" value="<?php echo esc_attr($width); ?>"/>
814
+	<input type="hidden" name="height" id="height" value="<?php echo esc_attr($height); ?>"/>
815
+	<input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo esc_attr($attachment_id); ?>" />
816
+	<input type="hidden" name="oitar" id="oitar" value="<?php echo esc_attr($oitar); ?>" />
817
+	<?php if (empty($_POST) && isset($_GET['file'])) { ?>
818 818
 	<input type="hidden" name="create-new-attachment" value="true" />
819 819
 	<?php } ?>
820
-	<?php wp_nonce_field( 'custom-header-crop-image' ) ?>
820
+	<?php wp_nonce_field('custom-header-crop-image') ?>
821 821
 
822 822
 	<p class="submit">
823
-	<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
823
+	<?php submit_button(__('Crop and Publish'), 'primary', 'submit', false); ?>
824 824
 	<?php
825
-	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
826
-		submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
825
+	if (isset($oitar) && 1 == $oitar && (current_theme_supports('custom-header', 'flex-height') || current_theme_supports('custom-header', 'flex-width')))
826
+		submit_button(__('Skip Cropping, Publish Image as Is'), 'secondary', 'skip-cropping', false);
827 827
 	?>
828 828
 	</p>
829 829
 </form>
@@ -841,14 +841,14 @@  discard block
 block discarded – undo
841 841
 		$overrides = array('test_form' => false);
842 842
 
843 843
 		$uploaded_file = $_FILES['import'];
844
-		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
845
-		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
846
-			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
844
+		$wp_filetype = wp_check_filetype_and_ext($uploaded_file['tmp_name'], $uploaded_file['name']);
845
+		if ( ! wp_match_mime_types('image', $wp_filetype['type']))
846
+			wp_die(__('The uploaded file is not a valid image. Please try again.'));
847 847
 
848 848
 		$file = wp_handle_upload($uploaded_file, $overrides);
849 849
 
850
-		if ( isset($file['error']) )
851
-			wp_die( $file['error'],  __( 'Image Upload Error' ) );
850
+		if (isset($file['error']))
851
+			wp_die($file['error'], __('Image Upload Error'));
852 852
 
853 853
 		$url = $file['url'];
854 854
 		$type = $file['type'];
@@ -865,8 +865,8 @@  discard block
 block discarded – undo
865 865
 		);
866 866
 
867 867
 		// Save the data
868
-		$attachment_id = wp_insert_attachment( $object, $file );
869
-		return compact( 'attachment_id', 'file', 'filename', 'url', 'type' );
868
+		$attachment_id = wp_insert_attachment($object, $file);
869
+		return compact('attachment_id', 'file', 'filename', 'url', 'type');
870 870
 	}
871 871
 
872 872
 	/**
@@ -877,73 +877,73 @@  discard block
 block discarded – undo
877 877
 	 *              for retrieving the header image URL.
878 878
 	 */
879 879
 	public function step_3() {
880
-		check_admin_referer( 'custom-header-crop-image' );
880
+		check_admin_referer('custom-header-crop-image');
881 881
 
882
-		if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
882
+		if ( ! current_theme_supports('custom-header', 'uploads')) {
883 883
 			wp_die(
884
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
885
-				'<p>' . __( 'The current theme does not support uploading a custom header image.' ) . '</p>',
884
+				'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
885
+				'<p>'.__('The current theme does not support uploading a custom header image.').'</p>',
886 886
 				403
887 887
 			);
888 888
 		}
889 889
 
890
-		if ( ! empty( $_POST['skip-cropping'] ) && ! ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
890
+		if ( ! empty($_POST['skip-cropping']) && ! (current_theme_supports('custom-header', 'flex-height') || current_theme_supports('custom-header', 'flex-width'))) {
891 891
 			wp_die(
892
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
893
-				'<p>' . __( 'The current theme does not support a flexible sized header image.' ) . '</p>',
892
+				'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
893
+				'<p>'.__('The current theme does not support a flexible sized header image.').'</p>',
894 894
 				403
895 895
 			);
896 896
 		}
897 897
 
898
-		if ( $_POST['oitar'] > 1 ) {
898
+		if ($_POST['oitar'] > 1) {
899 899
 			$_POST['x1'] = $_POST['x1'] * $_POST['oitar'];
900 900
 			$_POST['y1'] = $_POST['y1'] * $_POST['oitar'];
901 901
 			$_POST['width'] = $_POST['width'] * $_POST['oitar'];
902 902
 			$_POST['height'] = $_POST['height'] * $_POST['oitar'];
903 903
 		}
904 904
 
905
-		$attachment_id = absint( $_POST['attachment_id'] );
905
+		$attachment_id = absint($_POST['attachment_id']);
906 906
 		$original = get_attached_file($attachment_id);
907 907
 
908
-		$dimensions = $this->get_header_dimensions( array(
908
+		$dimensions = $this->get_header_dimensions(array(
909 909
 			'height' => $_POST['height'],
910 910
 			'width'  => $_POST['width'],
911
-		) );
911
+		));
912 912
 		$height = $dimensions['dst_height'];
913 913
 		$width = $dimensions['dst_width'];
914 914
 
915
-		if ( empty( $_POST['skip-cropping'] ) )
916
-			$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
917
-		elseif ( ! empty( $_POST['create-new-attachment'] ) )
918
-			$cropped = _copy_image_file( $attachment_id );
915
+		if (empty($_POST['skip-cropping']))
916
+			$cropped = wp_crop_image($attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height);
917
+		elseif ( ! empty($_POST['create-new-attachment']))
918
+			$cropped = _copy_image_file($attachment_id);
919 919
 		else
920
-			$cropped = get_attached_file( $attachment_id );
920
+			$cropped = get_attached_file($attachment_id);
921 921
 
922
-		if ( ! $cropped || is_wp_error( $cropped ) )
923
-			wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
922
+		if ( ! $cropped || is_wp_error($cropped))
923
+			wp_die(__('Image could not be processed. Please go back and try again.'), __('Image Processing Error'));
924 924
 
925 925
 		/** This filter is documented in wp-admin/custom-header.php */
926
-		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
926
+		$cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication
927 927
 
928
-		$object = $this->create_attachment_object( $cropped, $attachment_id );
928
+		$object = $this->create_attachment_object($cropped, $attachment_id);
929 929
 
930
-		if ( ! empty( $_POST['create-new-attachment'] ) )
931
-			unset( $object['ID'] );
930
+		if ( ! empty($_POST['create-new-attachment']))
931
+			unset($object['ID']);
932 932
 
933 933
 		// Update the attachment
934
-		$attachment_id = $this->insert_attachment( $object, $cropped );
934
+		$attachment_id = $this->insert_attachment($object, $cropped);
935 935
 
936
-		$url = wp_get_attachment_url( $attachment_id );
937
-		$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
936
+		$url = wp_get_attachment_url($attachment_id);
937
+		$this->set_header_image(compact('url', 'attachment_id', 'width', 'height'));
938 938
 
939 939
 		// Cleanup.
940
-		$medium = str_replace( basename( $original ), 'midsize-' . basename( $original ), $original );
941
-		if ( file_exists( $medium ) ) {
942
-			wp_delete_file( $medium );
940
+		$medium = str_replace(basename($original), 'midsize-'.basename($original), $original);
941
+		if (file_exists($medium)) {
942
+			wp_delete_file($medium);
943 943
 		}
944 944
 
945
-		if ( empty( $_POST['create-new-attachment'] ) && empty( $_POST['skip-cropping'] ) ) {
946
-			wp_delete_file( $original );
945
+		if (empty($_POST['create-new-attachment']) && empty($_POST['skip-cropping'])) {
946
+			wp_delete_file($original);
947 947
 		}
948 948
 
949 949
 		return $this->finished();
@@ -965,12 +965,12 @@  discard block
 block discarded – undo
965 965
 	 * @since 2.1.0
966 966
 	 */
967 967
 	public function admin_page() {
968
-		if ( ! current_user_can('edit_theme_options') )
968
+		if ( ! current_user_can('edit_theme_options'))
969 969
 			wp_die(__('You do not have permission to customize headers.'));
970 970
 		$step = $this->step();
971
-		if ( 2 == $step )
971
+		if (2 == $step)
972 972
 			$this->step_2();
973
-		elseif ( 3 == $step )
973
+		elseif (3 == $step)
974 974
 			$this->step_3();
975 975
 		else
976 976
 			$this->step_1();
@@ -984,7 +984,7 @@  discard block
 block discarded – undo
984 984
 	 * @param array $form_fields
985 985
 	 * @return array $form_fields
986 986
 	 */
987
-	public function attachment_fields_to_edit( $form_fields ) {
987
+	public function attachment_fields_to_edit($form_fields) {
988 988
 		return $form_fields;
989 989
 	}
990 990
 
@@ -996,7 +996,7 @@  discard block
 block discarded – undo
996 996
 	 * @param array $tabs
997 997
 	 * @return array $tabs
998 998
 	 */
999
-	public function filter_upload_tabs( $tabs ) {
999
+	public function filter_upload_tabs($tabs) {
1000 1000
 		return $tabs;
1001 1001
 	}
1002 1002
 
@@ -1012,13 +1012,13 @@  discard block
 block discarded – undo
1012 1012
 	 * 	the key of an image uploaded for that theme (the attachment ID of the image).
1013 1013
 	 *  Or an array of arguments: attachment_id, url, width, height. All are required.
1014 1014
 	 */
1015
-	final public function set_header_image( $choice ) {
1016
-		if ( is_array( $choice ) || is_object( $choice ) ) {
1015
+	final public function set_header_image($choice) {
1016
+		if (is_array($choice) || is_object($choice)) {
1017 1017
 			$choice = (array) $choice;
1018
-			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) )
1018
+			if ( ! isset($choice['attachment_id']) || ! isset($choice['url']))
1019 1019
 				return;
1020 1020
 
1021
-			$choice['url'] = esc_url_raw( $choice['url'] );
1021
+			$choice['url'] = esc_url_raw($choice['url']);
1022 1022
 
1023 1023
 			$header_image_data = (object) array(
1024 1024
 				'attachment_id' => $choice['attachment_id'],
@@ -1028,32 +1028,32 @@  discard block
 block discarded – undo
1028 1028
 				'width'         => $choice['width'],
1029 1029
 			);
1030 1030
 
1031
-			update_post_meta( $choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet() );
1032
-			set_theme_mod( 'header_image', $choice['url'] );
1033
-			set_theme_mod( 'header_image_data', $header_image_data );
1031
+			update_post_meta($choice['attachment_id'], '_wp_attachment_is_custom_header', get_stylesheet());
1032
+			set_theme_mod('header_image', $choice['url']);
1033
+			set_theme_mod('header_image_data', $header_image_data);
1034 1034
 			return;
1035 1035
 		}
1036 1036
 
1037
-		if ( in_array( $choice, array( 'remove-header', 'random-default-image', 'random-uploaded-image' ) ) ) {
1038
-			set_theme_mod( 'header_image', $choice );
1039
-			remove_theme_mod( 'header_image_data' );
1037
+		if (in_array($choice, array('remove-header', 'random-default-image', 'random-uploaded-image'))) {
1038
+			set_theme_mod('header_image', $choice);
1039
+			remove_theme_mod('header_image_data');
1040 1040
 			return;
1041 1041
 		}
1042 1042
 
1043 1043
 		$uploaded = get_uploaded_header_images();
1044
-		if ( $uploaded && isset( $uploaded[ $choice ] ) ) {
1045
-			$header_image_data = $uploaded[ $choice ];
1044
+		if ($uploaded && isset($uploaded[$choice])) {
1045
+			$header_image_data = $uploaded[$choice];
1046 1046
 
1047 1047
 		} else {
1048 1048
 			$this->process_default_headers();
1049
-			if ( isset( $this->default_headers[ $choice ] ) )
1050
-				$header_image_data = $this->default_headers[ $choice ];
1049
+			if (isset($this->default_headers[$choice]))
1050
+				$header_image_data = $this->default_headers[$choice];
1051 1051
 			else
1052 1052
 				return;
1053 1053
 		}
1054 1054
 
1055
-		set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) );
1056
-		set_theme_mod( 'header_image_data', $header_image_data );
1055
+		set_theme_mod('header_image', esc_url_raw($header_image_data['url']));
1056
+		set_theme_mod('header_image_data', $header_image_data);
1057 1057
 	}
1058 1058
 
1059 1059
 	/**
@@ -1062,7 +1062,7 @@  discard block
 block discarded – undo
1062 1062
 	 * @since 3.4.0
1063 1063
 	 */
1064 1064
 	final public function remove_header_image() {
1065
-		$this->set_header_image( 'remove-header' );
1065
+		$this->set_header_image('remove-header');
1066 1066
 	}
1067 1067
 
1068 1068
 	/**
@@ -1074,24 +1074,24 @@  discard block
 block discarded – undo
1074 1074
 	 */
1075 1075
 	final public function reset_header_image() {
1076 1076
 		$this->process_default_headers();
1077
-		$default = get_theme_support( 'custom-header', 'default-image' );
1077
+		$default = get_theme_support('custom-header', 'default-image');
1078 1078
 
1079
-		if ( ! $default ) {
1079
+		if ( ! $default) {
1080 1080
 			$this->remove_header_image();
1081 1081
 			return;
1082 1082
 		}
1083
-		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
1083
+		$default = sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri());
1084 1084
 
1085 1085
 		$default_data = array();
1086
-		foreach ( $this->default_headers as $header => $details ) {
1087
-			if ( $details['url'] == $default ) {
1086
+		foreach ($this->default_headers as $header => $details) {
1087
+			if ($details['url'] == $default) {
1088 1088
 				$default_data = $details;
1089 1089
 				break;
1090 1090
 			}
1091 1091
 		}
1092 1092
 
1093
-		set_theme_mod( 'header_image', $default );
1094
-		set_theme_mod( 'header_image_data', (object) $default_data );
1093
+		set_theme_mod('header_image', $default);
1094
+		set_theme_mod('header_image_data', (object) $default_data);
1095 1095
 	}
1096 1096
 
1097 1097
 	/**
@@ -1100,41 +1100,41 @@  discard block
 block discarded – undo
1100 1100
 	 * @param array $dimensions
1101 1101
 	 * @return array dst_height and dst_width of header image.
1102 1102
 	 */
1103
-	final public function get_header_dimensions( $dimensions ) {
1103
+	final public function get_header_dimensions($dimensions) {
1104 1104
 		$max_width = 0;
1105
-		$width = absint( $dimensions['width'] );
1106
-		$height = absint( $dimensions['height'] );
1107
-		$theme_height = get_theme_support( 'custom-header', 'height' );
1108
-		$theme_width = get_theme_support( 'custom-header', 'width' );
1109
-		$has_flex_width = current_theme_supports( 'custom-header', 'flex-width' );
1110
-		$has_flex_height = current_theme_supports( 'custom-header', 'flex-height' );
1111
-		$has_max_width = current_theme_supports( 'custom-header', 'max-width' ) ;
1112
-		$dst = array( 'dst_height' => null, 'dst_width' => null );
1105
+		$width = absint($dimensions['width']);
1106
+		$height = absint($dimensions['height']);
1107
+		$theme_height = get_theme_support('custom-header', 'height');
1108
+		$theme_width = get_theme_support('custom-header', 'width');
1109
+		$has_flex_width = current_theme_supports('custom-header', 'flex-width');
1110
+		$has_flex_height = current_theme_supports('custom-header', 'flex-height');
1111
+		$has_max_width = current_theme_supports('custom-header', 'max-width');
1112
+		$dst = array('dst_height' => null, 'dst_width' => null);
1113 1113
 
1114 1114
 		// For flex, limit size of image displayed to 1500px unless theme says otherwise
1115
-		if ( $has_flex_width ) {
1115
+		if ($has_flex_width) {
1116 1116
 			$max_width = 1500;
1117 1117
 		}
1118 1118
 
1119
-		if ( $has_max_width ) {
1120
-			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
1119
+		if ($has_max_width) {
1120
+			$max_width = max($max_width, get_theme_support('custom-header', 'max-width'));
1121 1121
 		}
1122
-		$max_width = max( $max_width, $theme_width );
1122
+		$max_width = max($max_width, $theme_width);
1123 1123
 
1124
-		if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) {
1125
-			$dst['dst_height'] = absint( $height * ( $max_width / $width ) );
1124
+		if ($has_flex_height && ( ! $has_flex_width || $width > $max_width)) {
1125
+			$dst['dst_height'] = absint($height * ($max_width / $width));
1126 1126
 		}
1127
-		elseif ( $has_flex_height && $has_flex_width ) {
1127
+		elseif ($has_flex_height && $has_flex_width) {
1128 1128
 			$dst['dst_height'] = $height;
1129 1129
 		}
1130 1130
 		else {
1131 1131
 			$dst['dst_height'] = $theme_height;
1132 1132
 		}
1133 1133
 
1134
-		if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) {
1135
-			$dst['dst_width'] = absint( $width * ( $max_width / $width ) );
1134
+		if ($has_flex_width && ( ! $has_flex_height || $width > $max_width)) {
1135
+			$dst['dst_width'] = absint($width * ($max_width / $width));
1136 1136
 		}
1137
-		elseif ( $has_flex_width && $has_flex_height ) {
1137
+		elseif ($has_flex_width && $has_flex_height) {
1138 1138
 			$dst['dst_width'] = $width;
1139 1139
 		}
1140 1140
 		else {
@@ -1152,13 +1152,13 @@  discard block
 block discarded – undo
1152 1152
 	 *
1153 1153
 	 * @return array Attachment object.
1154 1154
 	 */
1155
-	final public function create_attachment_object( $cropped, $parent_attachment_id ) {
1156
-		$parent = get_post( $parent_attachment_id );
1157
-		$parent_url = wp_get_attachment_url( $parent->ID );
1158
-		$url = str_replace( basename( $parent_url ), basename( $cropped ), $parent_url );
1155
+	final public function create_attachment_object($cropped, $parent_attachment_id) {
1156
+		$parent = get_post($parent_attachment_id);
1157
+		$parent_url = wp_get_attachment_url($parent->ID);
1158
+		$url = str_replace(basename($parent_url), basename($cropped), $parent_url);
1159 1159
 
1160
-		$size = @getimagesize( $cropped );
1161
-		$image_type = ( $size ) ? $size['mime'] : 'image/jpeg';
1160
+		$size = @getimagesize($cropped);
1161
+		$image_type = ($size) ? $size['mime'] : 'image/jpeg';
1162 1162
 
1163 1163
 		$object = array(
1164 1164
 			'ID' => $parent_attachment_id,
@@ -1179,9 +1179,9 @@  discard block
 block discarded – undo
1179 1179
 	 *
1180 1180
 	 * @return int Attachment ID.
1181 1181
 	 */
1182
-	final public function insert_attachment( $object, $cropped ) {
1183
-		$attachment_id = wp_insert_attachment( $object, $cropped );
1184
-		$metadata = wp_generate_attachment_metadata( $attachment_id, $cropped );
1182
+	final public function insert_attachment($object, $cropped) {
1183
+		$attachment_id = wp_insert_attachment($object, $cropped);
1184
+		$metadata = wp_generate_attachment_metadata($attachment_id, $cropped);
1185 1185
 		/**
1186 1186
 		 * Filter the header image attachment metadata.
1187 1187
 		 *
@@ -1191,8 +1191,8 @@  discard block
 block discarded – undo
1191 1191
 		 *
1192 1192
 		 * @param array $metadata Attachment metadata.
1193 1193
 		 */
1194
-		$metadata = apply_filters( 'wp_header_image_attachment_metadata', $metadata );
1195
-		wp_update_attachment_metadata( $attachment_id, $metadata );
1194
+		$metadata = apply_filters('wp_header_image_attachment_metadata', $metadata);
1195
+		wp_update_attachment_metadata($attachment_id, $metadata);
1196 1196
 		return $attachment_id;
1197 1197
 	}
1198 1198
 
@@ -1201,24 +1201,24 @@  discard block
 block discarded – undo
1201 1201
 	 * new object. Returns JSON-encoded object details.
1202 1202
 	 */
1203 1203
 	public function ajax_header_crop() {
1204
-		check_ajax_referer( 'image_editor-' . $_POST['id'], 'nonce' );
1204
+		check_ajax_referer('image_editor-'.$_POST['id'], 'nonce');
1205 1205
 
1206
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
1206
+		if ( ! current_user_can('edit_theme_options')) {
1207 1207
 			wp_send_json_error();
1208 1208
 		}
1209 1209
 
1210
-		if ( ! current_theme_supports( 'custom-header', 'uploads' ) ) {
1210
+		if ( ! current_theme_supports('custom-header', 'uploads')) {
1211 1211
 			wp_send_json_error();
1212 1212
 		}
1213 1213
 
1214 1214
 		$crop_details = $_POST['cropDetails'];
1215 1215
 
1216
-		$dimensions = $this->get_header_dimensions( array(
1216
+		$dimensions = $this->get_header_dimensions(array(
1217 1217
 			'height' => $crop_details['height'],
1218 1218
 			'width'  => $crop_details['width'],
1219
-		) );
1219
+		));
1220 1220
 
1221
-		$attachment_id = absint( $_POST['id'] );
1221
+		$attachment_id = absint($_POST['id']);
1222 1222
 
1223 1223
 		$cropped = wp_crop_image(
1224 1224
 			$attachment_id,
@@ -1230,25 +1230,25 @@  discard block
 block discarded – undo
1230 1230
 			(int) $dimensions['dst_height']
1231 1231
 		);
1232 1232
 
1233
-		if ( ! $cropped || is_wp_error( $cropped ) ) {
1234
-			wp_send_json_error( array( 'message' => __( 'Image could not be processed. Please go back and try again.' ) ) );
1233
+		if ( ! $cropped || is_wp_error($cropped)) {
1234
+			wp_send_json_error(array('message' => __('Image could not be processed. Please go back and try again.')));
1235 1235
 		}
1236 1236
 
1237 1237
 		/** This filter is documented in wp-admin/custom-header.php */
1238
-		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
1238
+		$cropped = apply_filters('wp_create_file_in_uploads', $cropped, $attachment_id); // For replication
1239 1239
 
1240
-		$object = $this->create_attachment_object( $cropped, $attachment_id );
1240
+		$object = $this->create_attachment_object($cropped, $attachment_id);
1241 1241
 
1242
-		unset( $object['ID'] );
1242
+		unset($object['ID']);
1243 1243
 
1244
-		$new_attachment_id = $this->insert_attachment( $object, $cropped );
1244
+		$new_attachment_id = $this->insert_attachment($object, $cropped);
1245 1245
 
1246 1246
 		$object['attachment_id'] = $new_attachment_id;
1247
-		$object['url']           = wp_get_attachment_url( $new_attachment_id );;
1247
+		$object['url']           = wp_get_attachment_url($new_attachment_id); ;
1248 1248
 		$object['width']         = $dimensions['dst_width'];
1249 1249
 		$object['height']        = $dimensions['dst_height'];
1250 1250
 
1251
-		wp_send_json_success( $object );
1251
+		wp_send_json_success($object);
1252 1252
 	}
1253 1253
 
1254 1254
 	/**
@@ -1259,20 +1259,20 @@  discard block
 block discarded – undo
1259 1259
 	 * Media Manager, even if s/he doesn't save that change.
1260 1260
 	 */
1261 1261
 	public function ajax_header_add() {
1262
-		check_ajax_referer( 'header-add', 'nonce' );
1262
+		check_ajax_referer('header-add', 'nonce');
1263 1263
 
1264
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
1264
+		if ( ! current_user_can('edit_theme_options')) {
1265 1265
 			wp_send_json_error();
1266 1266
 		}
1267 1267
 
1268
-		$attachment_id = absint( $_POST['attachment_id'] );
1269
-		if ( $attachment_id < 1 ) {
1268
+		$attachment_id = absint($_POST['attachment_id']);
1269
+		if ($attachment_id < 1) {
1270 1270
 			wp_send_json_error();
1271 1271
 		}
1272 1272
 
1273
-		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
1274
-		update_post_meta( $attachment_id, $key, time() );
1275
-		update_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() );
1273
+		$key = '_wp_attachment_custom_header_last_used_'.get_stylesheet();
1274
+		update_post_meta($attachment_id, $key, time());
1275
+		update_post_meta($attachment_id, '_wp_attachment_is_custom_header', get_stylesheet());
1276 1276
 
1277 1277
 		wp_send_json_success();
1278 1278
 	}
@@ -1285,20 +1285,20 @@  discard block
 block discarded – undo
1285 1285
 	 * choice in the Customizer's Header tool.
1286 1286
 	 */
1287 1287
 	public function ajax_header_remove() {
1288
-		check_ajax_referer( 'header-remove', 'nonce' );
1288
+		check_ajax_referer('header-remove', 'nonce');
1289 1289
 
1290
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
1290
+		if ( ! current_user_can('edit_theme_options')) {
1291 1291
 			wp_send_json_error();
1292 1292
 		}
1293 1293
 
1294
-		$attachment_id = absint( $_POST['attachment_id'] );
1295
-		if ( $attachment_id < 1 ) {
1294
+		$attachment_id = absint($_POST['attachment_id']);
1295
+		if ($attachment_id < 1) {
1296 1296
 			wp_send_json_error();
1297 1297
 		}
1298 1298
 
1299
-		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
1300
-		delete_post_meta( $attachment_id, $key );
1301
-		delete_post_meta( $attachment_id, '_wp_attachment_is_custom_header', get_stylesheet() );
1299
+		$key = '_wp_attachment_custom_header_last_used_'.get_stylesheet();
1300
+		delete_post_meta($attachment_id, $key);
1301
+		delete_post_meta($attachment_id, '_wp_attachment_is_custom_header', get_stylesheet());
1302 1302
 
1303 1303
 		wp_send_json_success();
1304 1304
 	}
@@ -1307,16 +1307,16 @@  discard block
 block discarded – undo
1307 1307
 	 *
1308 1308
 	 * @param WP_Customize_Manager $wp_customize
1309 1309
 	 */
1310
-	public function customize_set_last_used( $wp_customize ) {
1311
-		$data = $wp_customize->get_setting( 'header_image_data' )->post_value();
1310
+	public function customize_set_last_used($wp_customize) {
1311
+		$data = $wp_customize->get_setting('header_image_data')->post_value();
1312 1312
 
1313
-		if ( ! isset( $data['attachment_id'] ) ) {
1313
+		if ( ! isset($data['attachment_id'])) {
1314 1314
 			return;
1315 1315
 		}
1316 1316
 
1317 1317
 		$attachment_id = $data['attachment_id'];
1318
-		$key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
1319
-		update_post_meta( $attachment_id, $key, time() );
1318
+		$key = '_wp_attachment_custom_header_last_used_'.get_stylesheet();
1319
+		update_post_meta($attachment_id, $key, time());
1320 1320
 	}
1321 1321
 
1322 1322
 	/**
@@ -1327,23 +1327,23 @@  discard block
 block discarded – undo
1327 1327
 		$this->process_default_headers();
1328 1328
 
1329 1329
 		// Get the default image if there is one.
1330
-		$default = get_theme_support( 'custom-header', 'default-image' );
1330
+		$default = get_theme_support('custom-header', 'default-image');
1331 1331
 
1332
-		if ( ! $default ) { // If not,
1332
+		if ( ! $default) { // If not,
1333 1333
 			return $this->default_headers; // easy peasy.
1334 1334
 		}
1335 1335
 
1336
-		$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
1336
+		$default = sprintf($default, get_template_directory_uri(), get_stylesheet_directory_uri());
1337 1337
 		$already_has_default = false;
1338 1338
 
1339
-		foreach ( $this->default_headers as $k => $h ) {
1340
-			if ( $h['url'] === $default ) {
1339
+		foreach ($this->default_headers as $k => $h) {
1340
+			if ($h['url'] === $default) {
1341 1341
 				$already_has_default = true;
1342 1342
 				break;
1343 1343
 			}
1344 1344
 		}
1345 1345
 
1346
-		if ( $already_has_default ) {
1346
+		if ($already_has_default) {
1347 1347
 			return $this->default_headers;
1348 1348
 		}
1349 1349
 
@@ -1356,7 +1356,7 @@  discard block
 block discarded – undo
1356 1356
 		);
1357 1357
 
1358 1358
 		// The rest of the set comes after.
1359
-		return array_merge( $header_images, $this->default_headers );
1359
+		return array_merge($header_images, $this->default_headers);
1360 1360
 	}
1361 1361
 
1362 1362
 	/**
@@ -1365,13 +1365,13 @@  discard block
 block discarded – undo
1365 1365
 	 */
1366 1366
 	public function get_uploaded_header_images() {
1367 1367
 		$header_images = get_uploaded_header_images();
1368
-		$timestamp_key = '_wp_attachment_custom_header_last_used_' . get_stylesheet();
1368
+		$timestamp_key = '_wp_attachment_custom_header_last_used_'.get_stylesheet();
1369 1369
 		$alt_text_key = '_wp_attachment_image_alt';
1370 1370
 
1371
-		foreach ( $header_images as &$header_image ) {
1372
-			$header_meta = get_post_meta( $header_image['attachment_id'] );
1373
-			$header_image['timestamp'] = isset( $header_meta[ $timestamp_key ] ) ? $header_meta[ $timestamp_key ] : '';
1374
-			$header_image['alt_text'] = isset( $header_meta[ $alt_text_key ] ) ? $header_meta[ $alt_text_key ] : '';
1371
+		foreach ($header_images as &$header_image) {
1372
+			$header_meta = get_post_meta($header_image['attachment_id']);
1373
+			$header_image['timestamp'] = isset($header_meta[$timestamp_key]) ? $header_meta[$timestamp_key] : '';
1374
+			$header_image['alt_text'] = isset($header_meta[$alt_text_key]) ? $header_meta[$alt_text_key] : '';
1375 1375
 		}
1376 1376
 
1377 1377
 		return $header_images;
Please login to merge, or discard this patch.
Braces   +121 added lines, -91 removed lines patch added patch discarded remove patch
@@ -137,15 +137,17 @@  discard block
 block discarded – undo
137 137
 	 * @return int Current step
138 138
 	 */
139 139
 	public function step() {
140
-		if ( ! isset( $_GET['step'] ) )
141
-			return 1;
140
+		if ( ! isset( $_GET['step'] ) ) {
141
+					return 1;
142
+		}
142 143
 
143 144
 		$step = (int) $_GET['step'];
144 145
 		if ( $step < 1 || 3 < $step ||
145 146
 			( 2 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce-custom-header-upload'], 'custom-header-upload' ) ) ||
146 147
 			( 3 == $step && ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'custom-header-crop-image' ) )
147
-		)
148
-			return 1;
148
+		) {
149
+					return 1;
150
+		}
149 151
 
150 152
 		return $step;
151 153
 	}
@@ -161,8 +163,9 @@  discard block
 block discarded – undo
161 163
 		if ( ( 1 == $step || 3 == $step ) ) {
162 164
 			wp_enqueue_media();
163 165
 			wp_enqueue_script( 'custom-header' );
164
-			if ( current_theme_supports( 'custom-header', 'header-text' ) )
165
-				wp_enqueue_script( 'wp-color-picker' );
166
+			if ( current_theme_supports( 'custom-header', 'header-text' ) ) {
167
+							wp_enqueue_script( 'wp-color-picker' );
168
+			}
166 169
 		} elseif ( 2 == $step ) {
167 170
 			wp_enqueue_script('imgareaselect');
168 171
 		}
@@ -176,10 +179,11 @@  discard block
 block discarded – undo
176 179
 	public function css_includes() {
177 180
 		$step = $this->step();
178 181
 
179
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
180
-			wp_enqueue_style( 'wp-color-picker' );
181
-		elseif ( 2 == $step )
182
-			wp_enqueue_style('imgareaselect');
182
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) {
183
+					wp_enqueue_style( 'wp-color-picker' );
184
+		} elseif ( 2 == $step ) {
185
+					wp_enqueue_style('imgareaselect');
186
+		}
183 187
 	}
184 188
 
185 189
 	/**
@@ -188,11 +192,13 @@  discard block
 block discarded – undo
188 192
 	 * @since 2.6.0
189 193
 	 */
190 194
 	public function take_action() {
191
-		if ( ! current_user_can('edit_theme_options') )
192
-			return;
195
+		if ( ! current_user_can('edit_theme_options') ) {
196
+					return;
197
+		}
193 198
 
194
-		if ( empty( $_POST ) )
195
-			return;
199
+		if ( empty( $_POST ) ) {
200
+					return;
201
+		}
196 202
 
197 203
 		$this->updated = true;
198 204
 
@@ -215,10 +221,11 @@  discard block
 block discarded – undo
215 221
 			check_admin_referer( 'custom-header-options', '_wpnonce-custom-header-options' );
216 222
 			$_POST['text-color'] = str_replace( '#', '', $_POST['text-color'] );
217 223
 			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['text-color']);
218
-			if ( strlen($color) == 6 || strlen($color) == 3 )
219
-				set_theme_mod('header_textcolor', $color);
220
-			elseif ( ! $color )
221
-				set_theme_mod( 'header_textcolor', 'blank' );
224
+			if ( strlen($color) == 6 || strlen($color) == 3 ) {
225
+							set_theme_mod('header_textcolor', $color);
226
+			} elseif ( ! $color ) {
227
+							set_theme_mod( 'header_textcolor', 'blank' );
228
+			}
222 229
 		}
223 230
 
224 231
 		if ( isset( $_POST['default-header'] ) ) {
@@ -238,8 +245,9 @@  discard block
 block discarded – undo
238 245
 	public function process_default_headers() {
239 246
 		global $_wp_default_headers;
240 247
 
241
-		if ( !isset($_wp_default_headers) )
242
-			return;
248
+		if ( !isset($_wp_default_headers) ) {
249
+					return;
250
+		}
243 251
 
244 252
 		if ( ! empty( $this->default_headers ) ) {
245 253
 			return;
@@ -289,8 +297,9 @@  discard block
 block discarded – undo
289 297
 			echo '<div class="default-header">';
290 298
 			echo '<label><input name="default-header" type="radio" value="' . esc_attr( $header_key ) . '" ' . checked( $header_url, get_theme_mod( 'header_image' ), false ) . ' />';
291 299
 			$width = '';
292
-			if ( !empty( $header['attachment_id'] ) )
293
-				$width = ' width="230"';
300
+			if ( !empty( $header['attachment_id'] ) ) {
301
+							$width = ' width="230"';
302
+			}
294 303
 			echo '<img src="' . set_url_scheme( $header_thumbnail ) . '" alt="' . esc_attr( $header_alt_text ) .'"' . $width . ' /></label>';
295 304
 			echo '</div>';
296 305
 		}
@@ -304,10 +313,11 @@  discard block
 block discarded – undo
304 313
 	 */
305 314
 	public function js() {
306 315
 		$step = $this->step();
307
-		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) )
308
-			$this->js_1();
309
-		elseif ( 2 == $step )
310
-			$this->js_2();
316
+		if ( ( 1 == $step || 3 == $step ) && current_theme_supports( 'custom-header', 'header-text' ) ) {
317
+					$this->js_1();
318
+		} elseif ( 2 == $step ) {
319
+					$this->js_2();
320
+		}
311 321
 	}
312 322
 
313 323
 	/**
@@ -492,21 +502,24 @@  discard block
 block discarded – undo
492 502
 
493 503
 		if ( $header_image ) {
494 504
 			$header_image_style = 'background-image:url(' . esc_url( $header_image ) . ');';
495
-		}  else {
505
+		} else {
496 506
 			$header_image_style = '';
497 507
 		}
498 508
 
499
-		if ( $custom_header->width )
500
-			$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
501
-		if ( $custom_header->height )
502
-			$header_image_style .= 'height:' . $custom_header->height . 'px;';
509
+		if ( $custom_header->width ) {
510
+					$header_image_style .= 'max-width:' . $custom_header->width . 'px;';
511
+		}
512
+		if ( $custom_header->height ) {
513
+					$header_image_style .= 'height:' . $custom_header->height . 'px;';
514
+		}
503 515
 	?>
504 516
 	<div id="headimg" style="<?php echo $header_image_style; ?>">
505 517
 		<?php
506
-		if ( display_header_text() )
507
-			$style = ' style="color:#' . get_header_textcolor() . ';"';
508
-		else
509
-			$style = ' style="display:none;"';
518
+		if ( display_header_text() ) {
519
+					$style = ' style="color:#' . get_header_textcolor() . ';"';
520
+		} else {
521
+					$style = ' style="display:none;"';
522
+		}
510 523
 		?>
511 524
 		<h1><a id="name" class="displaying-header-text" <?php echo $style; ?> onclick="return false;" href="<?php bloginfo('url'); ?>" tabindex="-1"><?php bloginfo( 'name' ); ?></a></h1>
512 525
 		<div id="desc" class="displaying-header-text" <?php echo $style; ?>><?php bloginfo( 'description' ); ?></div>
@@ -525,8 +538,8 @@  discard block
 block discarded – undo
525 538
 	if ( ! current_theme_supports( 'custom-header', 'flex-height' ) && ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
526 539
 		printf( __( 'Images of exactly <strong>%1$d &times; %2$d pixels</strong> will be used as-is.' ) . '<br />', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ) );
527 540
 	} elseif ( current_theme_supports( 'custom-header', 'flex-height' ) ) {
528
-		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) )
529
-			printf(
541
+		if ( ! current_theme_supports( 'custom-header', 'flex-width' ) ) {
542
+					printf(
530 543
 				/* translators: %s: size in pixels */
531 544
 				__( 'Images should be at least %s wide.' ) . ' ',
532 545
 				sprintf(
@@ -535,9 +548,10 @@  discard block
 block discarded – undo
535 548
 					get_theme_support( 'custom-header', 'width' )
536 549
 				)
537 550
 			);
551
+		}
538 552
 	} elseif ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
539
-		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) )
540
-			printf(
553
+		if ( ! current_theme_supports( 'custom-header', 'flex-height' ) ) {
554
+					printf(
541 555
 				/* translators: %s: size in pixels */
542 556
 				__( 'Images should be at least %s tall.' ) . ' ',
543 557
 				sprintf(
@@ -546,10 +560,11 @@  discard block
 block discarded – undo
546 560
 					get_theme_support( 'custom-header', 'height' )
547 561
 				)
548 562
 			);
563
+		}
549 564
 	}
550 565
 	if ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) {
551
-		if ( current_theme_supports( 'custom-header', 'width' ) )
552
-			printf(
566
+		if ( current_theme_supports( 'custom-header', 'width' ) ) {
567
+					printf(
553 568
 				/* translators: %s: size in pixels */
554 569
 				__( 'Suggested width is %s.' ) . ' ',
555 570
 				sprintf(
@@ -558,8 +573,9 @@  discard block
 block discarded – undo
558 573
 					get_theme_support( 'custom-header', 'width' )
559 574
 				)
560 575
 			);
561
-		if ( current_theme_supports( 'custom-header', 'height' ) )
562
-			printf(
576
+		}
577
+		if ( current_theme_supports( 'custom-header', 'height' ) ) {
578
+					printf(
563 579
 				/* translators: %s: size in pixels */
564 580
 				__( 'Suggested height is %s.' ) . ' ',
565 581
 				sprintf(
@@ -568,6 +584,7 @@  discard block
 block discarded – undo
568 584
 					get_theme_support( 'custom-header', 'height' )
569 585
 				)
570 586
 			);
587
+		}
571 588
 	}
572 589
 	?></p>
573 590
 	<form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post" action="<?php echo esc_url( add_query_arg( 'step', 2 ) ) ?>">
@@ -620,9 +637,12 @@  discard block
 block discarded – undo
620 637
 <td>
621 638
 <?php if ( current_theme_supports( 'custom-header', 'uploads' ) ) : ?>
622 639
 	<p><?php _e( 'If you don&lsquo;t want to upload your own image, you can use one of these cool headers, or show a random one.' ) ?></p>
623
-<?php else: ?>
640
+<?php else {
641
+	: ?>
624 642
 	<p><?php _e( 'You can use one of these cool headers or show a random one on each page.' ) ?></p>
625
-<?php endif; ?>
643
+<?php endif;
644
+}
645
+?>
626 646
 	<?php
627 647
 		$this->show_header_selector( 'default' );
628 648
 	?>
@@ -752,11 +772,13 @@  discard block
 block discarded – undo
752 772
 
753 773
 		$max_width = 0;
754 774
 		// For flex, limit size of image displayed to 1500px unless theme says otherwise
755
-		if ( current_theme_supports( 'custom-header', 'flex-width' ) )
756
-			$max_width = 1500;
775
+		if ( current_theme_supports( 'custom-header', 'flex-width' ) ) {
776
+					$max_width = 1500;
777
+		}
757 778
 
758
-		if ( current_theme_supports( 'custom-header', 'max-width' ) )
759
-			$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
779
+		if ( current_theme_supports( 'custom-header', 'max-width' ) ) {
780
+					$max_width = max( $max_width, get_theme_support( 'custom-header', 'max-width' ) );
781
+		}
760 782
 		$max_width = max( $max_width, get_theme_support( 'custom-header', 'width' ) );
761 783
 
762 784
 		// If flexible height isn't supported and the image is the exact right size
@@ -764,8 +786,9 @@  discard block
 block discarded – undo
764 786
 			&& $width == get_theme_support( 'custom-header', 'width' ) && $height == get_theme_support( 'custom-header', 'height' ) )
765 787
 		{
766 788
 			// Add the meta-data
767
-			if ( file_exists( $file ) )
768
-				wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
789
+			if ( file_exists( $file ) ) {
790
+							wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
791
+			}
769 792
 
770 793
 			$this->set_header_image( compact( 'url', 'attachment_id', 'width', 'height' ) );
771 794
 
@@ -783,8 +806,9 @@  discard block
 block discarded – undo
783 806
 		} elseif ( $width > $max_width ) {
784 807
 			$oitar = $width / $max_width;
785 808
 			$image = wp_crop_image($attachment_id, 0, 0, $width, $height, $max_width, $height / $oitar, false, str_replace(basename($file), 'midsize-'.basename($file), $file));
786
-			if ( ! $image || is_wp_error( $image ) )
787
-				wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
809
+			if ( ! $image || is_wp_error( $image ) ) {
810
+							wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
811
+			}
788 812
 
789 813
 			/** This filter is documented in wp-admin/custom-header.php */
790 814
 			$image = apply_filters( 'wp_create_file_in_uploads', $image, $attachment_id ); // For replication
@@ -822,8 +846,9 @@  discard block
 block discarded – undo
822 846
 	<p class="submit">
823 847
 	<?php submit_button( __( 'Crop and Publish' ), 'primary', 'submit', false ); ?>
824 848
 	<?php
825
-	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) )
826
-		submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
849
+	if ( isset( $oitar ) && 1 == $oitar && ( current_theme_supports( 'custom-header', 'flex-height' ) || current_theme_supports( 'custom-header', 'flex-width' ) ) ) {
850
+			submit_button( __( 'Skip Cropping, Publish Image as Is' ), 'secondary', 'skip-cropping', false );
851
+	}
827 852
 	?>
828 853
 	</p>
829 854
 </form>
@@ -842,13 +867,15 @@  discard block
 block discarded – undo
842 867
 
843 868
 		$uploaded_file = $_FILES['import'];
844 869
 		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
845
-		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
846
-			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
870
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
871
+					wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
872
+		}
847 873
 
848 874
 		$file = wp_handle_upload($uploaded_file, $overrides);
849 875
 
850
-		if ( isset($file['error']) )
851
-			wp_die( $file['error'],  __( 'Image Upload Error' ) );
876
+		if ( isset($file['error']) ) {
877
+					wp_die( $file['error'],  __( 'Image Upload Error' ) );
878
+		}
852 879
 
853 880
 		$url = $file['url'];
854 881
 		$type = $file['type'];
@@ -912,23 +939,26 @@  discard block
 block discarded – undo
912 939
 		$height = $dimensions['dst_height'];
913 940
 		$width = $dimensions['dst_width'];
914 941
 
915
-		if ( empty( $_POST['skip-cropping'] ) )
916
-			$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
917
-		elseif ( ! empty( $_POST['create-new-attachment'] ) )
918
-			$cropped = _copy_image_file( $attachment_id );
919
-		else
920
-			$cropped = get_attached_file( $attachment_id );
942
+		if ( empty( $_POST['skip-cropping'] ) ) {
943
+					$cropped = wp_crop_image( $attachment_id, (int) $_POST['x1'], (int) $_POST['y1'], (int) $_POST['width'], (int) $_POST['height'], $width, $height );
944
+		} elseif ( ! empty( $_POST['create-new-attachment'] ) ) {
945
+					$cropped = _copy_image_file( $attachment_id );
946
+		} else {
947
+					$cropped = get_attached_file( $attachment_id );
948
+		}
921 949
 
922
-		if ( ! $cropped || is_wp_error( $cropped ) )
923
-			wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
950
+		if ( ! $cropped || is_wp_error( $cropped ) ) {
951
+					wp_die( __( 'Image could not be processed. Please go back and try again.' ), __( 'Image Processing Error' ) );
952
+		}
924 953
 
925 954
 		/** This filter is documented in wp-admin/custom-header.php */
926 955
 		$cropped = apply_filters( 'wp_create_file_in_uploads', $cropped, $attachment_id ); // For replication
927 956
 
928 957
 		$object = $this->create_attachment_object( $cropped, $attachment_id );
929 958
 
930
-		if ( ! empty( $_POST['create-new-attachment'] ) )
931
-			unset( $object['ID'] );
959
+		if ( ! empty( $_POST['create-new-attachment'] ) ) {
960
+					unset( $object['ID'] );
961
+		}
932 962
 
933 963
 		// Update the attachment
934 964
 		$attachment_id = $this->insert_attachment( $object, $cropped );
@@ -965,15 +995,17 @@  discard block
 block discarded – undo
965 995
 	 * @since 2.1.0
966 996
 	 */
967 997
 	public function admin_page() {
968
-		if ( ! current_user_can('edit_theme_options') )
969
-			wp_die(__('You do not have permission to customize headers.'));
998
+		if ( ! current_user_can('edit_theme_options') ) {
999
+					wp_die(__('You do not have permission to customize headers.'));
1000
+		}
970 1001
 		$step = $this->step();
971
-		if ( 2 == $step )
972
-			$this->step_2();
973
-		elseif ( 3 == $step )
974
-			$this->step_3();
975
-		else
976
-			$this->step_1();
1002
+		if ( 2 == $step ) {
1003
+					$this->step_2();
1004
+		} elseif ( 3 == $step ) {
1005
+					$this->step_3();
1006
+		} else {
1007
+					$this->step_1();
1008
+		}
977 1009
 	}
978 1010
 
979 1011
 	/**
@@ -1015,8 +1047,9 @@  discard block
 block discarded – undo
1015 1047
 	final public function set_header_image( $choice ) {
1016 1048
 		if ( is_array( $choice ) || is_object( $choice ) ) {
1017 1049
 			$choice = (array) $choice;
1018
-			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) )
1019
-				return;
1050
+			if ( ! isset( $choice['attachment_id'] ) || ! isset( $choice['url'] ) ) {
1051
+							return;
1052
+			}
1020 1053
 
1021 1054
 			$choice['url'] = esc_url_raw( $choice['url'] );
1022 1055
 
@@ -1046,10 +1079,11 @@  discard block
 block discarded – undo
1046 1079
 
1047 1080
 		} else {
1048 1081
 			$this->process_default_headers();
1049
-			if ( isset( $this->default_headers[ $choice ] ) )
1050
-				$header_image_data = $this->default_headers[ $choice ];
1051
-			else
1052
-				return;
1082
+			if ( isset( $this->default_headers[ $choice ] ) ) {
1083
+							$header_image_data = $this->default_headers[ $choice ];
1084
+			} else {
1085
+							return;
1086
+			}
1053 1087
 		}
1054 1088
 
1055 1089
 		set_theme_mod( 'header_image', esc_url_raw( $header_image_data['url'] ) );
@@ -1123,21 +1157,17 @@  discard block
 block discarded – undo
1123 1157
 
1124 1158
 		if ( $has_flex_height && ( ! $has_flex_width || $width > $max_width ) ) {
1125 1159
 			$dst['dst_height'] = absint( $height * ( $max_width / $width ) );
1126
-		}
1127
-		elseif ( $has_flex_height && $has_flex_width ) {
1160
+		} elseif ( $has_flex_height && $has_flex_width ) {
1128 1161
 			$dst['dst_height'] = $height;
1129
-		}
1130
-		else {
1162
+		} else {
1131 1163
 			$dst['dst_height'] = $theme_height;
1132 1164
 		}
1133 1165
 
1134 1166
 		if ( $has_flex_width && ( ! $has_flex_height || $width > $max_width ) ) {
1135 1167
 			$dst['dst_width'] = absint( $width * ( $max_width / $width ) );
1136
-		}
1137
-		elseif ( $has_flex_width && $has_flex_height ) {
1168
+		} elseif ( $has_flex_width && $has_flex_height ) {
1138 1169
 			$dst['dst_width'] = $width;
1139
-		}
1140
-		else {
1170
+		} else {
1141 1171
 			$dst['dst_width'] = $theme_width;
1142 1172
 		}
1143 1173
 
Please login to merge, or discard this patch.
src/wp-admin/theme-editor.php 3 patches
Switch Indentation   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -107,60 +107,60 @@  discard block
 block discarded – undo
107 107
 $scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0;
108 108
 
109 109
 switch( $action ) {
110
-case 'update':
111
-	check_admin_referer( 'edit-theme_' . $file . $stylesheet );
112
-	$newcontent = wp_unslash( $_POST['newcontent'] );
113
-	$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
114
-	if ( is_writeable( $file ) ) {
115
-		// is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
116
-		$f = fopen( $file, 'w+' );
117
-		if ( $f !== false ) {
118
-			fwrite( $f, $newcontent );
119
-			fclose( $f );
120
-			$location .= '&updated=true';
121
-			$theme->cache_delete();
110
+	case 'update':
111
+		check_admin_referer( 'edit-theme_' . $file . $stylesheet );
112
+		$newcontent = wp_unslash( $_POST['newcontent'] );
113
+		$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
114
+		if ( is_writeable( $file ) ) {
115
+			// is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
116
+			$f = fopen( $file, 'w+' );
117
+			if ( $f !== false ) {
118
+				fwrite( $f, $newcontent );
119
+				fclose( $f );
120
+				$location .= '&updated=true';
121
+				$theme->cache_delete();
122
+			}
122 123
 		}
123
-	}
124
-	wp_redirect( $location );
125
-	exit;
124
+		wp_redirect( $location );
125
+		exit;
126 126
 
127
-default:
127
+	default:
128 128
 
129
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
129
+		require_once( ABSPATH . 'wp-admin/admin-header.php' );
130 130
 
131
-	update_recently_edited( $file );
131
+		update_recently_edited( $file );
132 132
 
133
-	if ( ! is_file( $file ) )
134
-		$error = true;
133
+		if ( ! is_file( $file ) )
134
+			$error = true;
135 135
 
136
-	$content = '';
137
-	if ( ! $error && filesize( $file ) > 0 ) {
138
-		$f = fopen($file, 'r');
139
-		$content = fread($f, filesize($file));
136
+		$content = '';
137
+		if ( ! $error && filesize( $file ) > 0 ) {
138
+			$f = fopen($file, 'r');
139
+			$content = fread($f, filesize($file));
140 140
 
141
-		if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
142
-			$functions = wp_doc_link_parse( $content );
141
+			if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
142
+				$functions = wp_doc_link_parse( $content );
143 143
 
144
-			$docs_select = '<select name="docs-list" id="docs-list">';
145
-			$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
146
-			foreach ( $functions as $function ) {
147
-				$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
144
+				$docs_select = '<select name="docs-list" id="docs-list">';
145
+				$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
146
+				foreach ( $functions as $function ) {
147
+					$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
148
+				}
149
+				$docs_select .= '</select>';
148 150
 			}
149
-			$docs_select .= '</select>';
150
-		}
151 151
 
152
-		$content = esc_textarea( $content );
153
-	}
152
+			$content = esc_textarea( $content );
153
+		}
154 154
 
155
-	if ( isset( $_GET['updated'] ) ) : ?>
156
- <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
157
-<?php endif;
155
+		if ( isset( $_GET['updated'] ) ) : ?>
156
+	 <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
157
+	<?php endif;
158 158
 
159
-$description = get_file_description( $relative_file );
160
-$file_show = array_search( $file, array_filter( $allowed_files ) );
161
-if ( $description != $file_show )
162
-	$description .= ' <span>(' . $file_show . ')</span>';
163
-?>
159
+	$description = get_file_description( $relative_file );
160
+	$file_show = array_search( $file, array_filter( $allowed_files ) );
161
+	if ( $description != $file_show )
162
+		$description .= ' <span>(' . $file_show . ')</span>';
163
+	?>
164 164
 <div class="wrap">
165 165
 <h1><?php echo esc_html( $title ); ?></h1>
166 166
 
@@ -173,38 +173,38 @@  discard block
 block discarded – undo
173 173
 		<strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
174 174
 		<select name="theme" id="theme">
175 175
 <?php
176
-foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
177
-	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
178
-		continue;
176
+	foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
177
+		if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
178
+			continue;
179 179
 
180
-	$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
181
-	echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
180
+		$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
181
+		echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
182 182
 }
183
-?>
184
-		</select>
183
+	?>
184
+			</select>
185 185
 		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
186 186
 	</form>
187 187
 </div>
188 188
 <br class="clear" />
189 189
 </div>
190 190
 <?php
191
-if ( $theme->errors() )
192
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
193
-?>
194
-	<div id="templateside">
195
-<?php
196
-if ( $allowed_files ) :
197
-	$previous_file_type = '';
198
-
199
-	foreach ( $allowed_files as $filename => $absolute_filename ) :
200
-		$file_type = substr( $filename, strrpos( $filename, '.' ) );
201
-
202
-		if ( $file_type !== $previous_file_type ) {
203
-			if ( '' !== $previous_file_type ) {
204
-				echo "\t</ul>\n";
205
-			}
206
-
207
-			switch ( $file_type ) {
191
+	if ( $theme->errors() )
192
+		echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
193
+	?>
194
+		<div id="templateside">
195
+	<?php
196
+	if ( $allowed_files ) :
197
+		$previous_file_type = '';
198
+
199
+		foreach ( $allowed_files as $filename => $absolute_filename ) :
200
+			$file_type = substr( $filename, strrpos( $filename, '.' ) );
201
+
202
+			if ( $file_type !== $previous_file_type ) {
203
+				if ( '' !== $previous_file_type ) {
204
+					echo "\t</ul>\n";
205
+				}
206
+
207
+				switch ( $file_type ) {
208 208
 				case '.php':
209 209
 					if ( $has_templates || $theme->parent() ) :
210 210
 						echo "\t<h2>" . __( 'Templates' ) . "</h2>\n";
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 					/* translators: %s: file extension */
226 226
 					echo "\t<h2>" . sprintf( __( '%s files' ), $file_type ) . "</h2>\n";
227 227
 					break;
228
-			}
228
+				}
229 229
 
230 230
 			echo "\t<ul>\n";
231 231
 		}
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -7,63 +7,63 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( is_multisite() && ! is_network_admin() ) {
13
-	wp_redirect( network_admin_url( 'theme-editor.php' ) );
12
+if (is_multisite() && ! is_network_admin()) {
13
+	wp_redirect(network_admin_url('theme-editor.php'));
14 14
 	exit();
15 15
 }
16 16
 
17
-if ( !current_user_can('edit_themes') )
17
+if ( ! current_user_can('edit_themes'))
18 18
 	wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');
19 19
 
20 20
 $title = __("Edit Themes");
21 21
 $parent_file = 'themes.php';
22 22
 
23
-get_current_screen()->add_help_tab( array(
23
+get_current_screen()->add_help_tab(array(
24 24
 'id'		=> 'overview',
25 25
 'title'		=> __('Overview'),
26 26
 'content'	=>
27
-	'<p>' . __('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.') . '</p>
28
-	<p>' . __("Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of the theme's template files. Clicking once on any file name causes the file to appear in the large Editor box.") . '</p>
29
-	<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '</p>
30
-	<p id="newcontent-description">' . __( 'In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.' ) . '</p>
31
-	<p>' . __('After typing in your edits, click Update File.') . '</p>
32
-	<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>
33
-	<p>' . sprintf( __('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s" target="_blank">child theme</a> instead.'), __('https://codex.wordpress.org/Child_Themes') ) . '</p>' .
34
-	( is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : '' )
35
-) );
27
+	'<p>'.__('You can use the Theme Editor to edit the individual CSS and PHP files which make up your theme.').'</p>
28
+	<p>' . __("Begin by choosing a theme to edit from the dropdown menu and clicking Select. A list then appears of the theme's template files. Clicking once on any file name causes the file to appear in the large Editor box.").'</p>
29
+	<p>' . __('For PHP files, you can use the Documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.').'</p>
30
+	<p id="newcontent-description">' . __('In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key. In some cases the Esc key will need to be pressed twice before the Tab key will allow you to continue.').'</p>
31
+	<p>' . __('After typing in your edits, click Update File.').'</p>
32
+	<p>' . __('<strong>Advice:</strong> think very carefully about your site crashing if you are live-editing the theme currently in use.').'</p>
33
+	<p>' . sprintf(__('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s" target="_blank">child theme</a> instead.'), __('https://codex.wordpress.org/Child_Themes')).'</p>'.
34
+	(is_network_admin() ? '<p>'.__('Any edits to files from this screen will be reflected on all sites in the network.').'</p>' : '')
35
+));
36 36
 
37 37
 get_current_screen()->set_help_sidebar(
38
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
39
-	'<p>' . __('<a href="https://codex.wordpress.org/Theme_Development" target="_blank">Documentation on Theme Development</a>') . '</p>' .
40
-	'<p>' . __('<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>') . '</p>' .
41
-	'<p>' . __('<a href="https://codex.wordpress.org/Editing_Files" target="_blank">Documentation on Editing Files</a>') . '</p>' .
42
-	'<p>' . __('<a href="https://codex.wordpress.org/Template_Tags" target="_blank">Documentation on Template Tags</a>') . '</p>' .
43
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
38
+	'<p><strong>'.__('For more information:').'</strong></p>'.
39
+	'<p>'.__('<a href="https://codex.wordpress.org/Theme_Development" target="_blank">Documentation on Theme Development</a>').'</p>'.
40
+	'<p>'.__('<a href="https://codex.wordpress.org/Using_Themes" target="_blank">Documentation on Using Themes</a>').'</p>'.
41
+	'<p>'.__('<a href="https://codex.wordpress.org/Editing_Files" target="_blank">Documentation on Editing Files</a>').'</p>'.
42
+	'<p>'.__('<a href="https://codex.wordpress.org/Template_Tags" target="_blank">Documentation on Template Tags</a>').'</p>'.
43
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
44 44
 );
45 45
 
46
-wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
46
+wp_reset_vars(array('action', 'error', 'file', 'theme'));
47 47
 
48
-if ( $theme ) {
48
+if ($theme) {
49 49
 	$stylesheet = $theme;
50 50
 } else {
51 51
 	$stylesheet = get_stylesheet();
52 52
 }
53 53
 
54
-$theme = wp_get_theme( $stylesheet );
54
+$theme = wp_get_theme($stylesheet);
55 55
 
56
-if ( ! $theme->exists() ) {
57
-	wp_die( __( 'The requested theme does not exist.' ) );
56
+if ( ! $theme->exists()) {
57
+	wp_die(__('The requested theme does not exist.'));
58 58
 }
59 59
 
60
-if ( $theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code() ) {
61
-	wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
60
+if ($theme->errors() && 'theme_no_stylesheet' == $theme->errors()->get_error_code()) {
61
+	wp_die(__('The requested theme does not exist.').' '.$theme->errors()->get_error_message());
62 62
 }
63 63
 
64 64
 $allowed_files = $style_files = array();
65 65
 $has_templates = false;
66
-$default_types = array( 'php', 'css' );
66
+$default_types = array('php', 'css');
67 67
 
68 68
 /**
69 69
  * Filter the list of file types allowed for editing in the Theme editor.
@@ -73,208 +73,208 @@  discard block
 block discarded – undo
73 73
  * @param array    $default_types List of file types. Default types include 'php' and 'css'.
74 74
  * @param WP_Theme $theme         The current Theme object.
75 75
  */
76
-$file_types = apply_filters( 'wp_theme_editor_filetypes', $default_types, $theme );
76
+$file_types = apply_filters('wp_theme_editor_filetypes', $default_types, $theme);
77 77
 
78 78
 // Ensure that default types are still there.
79
-$file_types = array_unique( array_merge( $file_types, $default_types ) );
79
+$file_types = array_unique(array_merge($file_types, $default_types));
80 80
 
81
-foreach ( $file_types as $type ) {
82
-	switch ( $type ) {
81
+foreach ($file_types as $type) {
82
+	switch ($type) {
83 83
 		case 'php':
84
-			$allowed_files += $theme->get_files( 'php', 1 );
85
-			$has_templates = ! empty( $allowed_files );
84
+			$allowed_files += $theme->get_files('php', 1);
85
+			$has_templates = ! empty($allowed_files);
86 86
 			break;
87 87
 		case 'css':
88
-			$style_files = $theme->get_files( 'css' );
88
+			$style_files = $theme->get_files('css');
89 89
 			$allowed_files['style.css'] = $style_files['style.css'];
90 90
 			$allowed_files += $style_files;
91 91
 			break;
92 92
 		default:
93
-			$allowed_files += $theme->get_files( $type );
93
+			$allowed_files += $theme->get_files($type);
94 94
 			break;
95 95
 	}
96 96
 }
97 97
 
98
-if ( empty( $file ) ) {
98
+if (empty($file)) {
99 99
 	$relative_file = 'style.css';
100 100
 	$file = $allowed_files['style.css'];
101 101
 } else {
102 102
 	$relative_file = $file;
103
-	$file = $theme->get_stylesheet_directory() . '/' . $relative_file;
103
+	$file = $theme->get_stylesheet_directory().'/'.$relative_file;
104 104
 }
105 105
 
106
-validate_file_to_edit( $file, $allowed_files );
107
-$scrollto = isset( $_REQUEST['scrollto'] ) ? (int) $_REQUEST['scrollto'] : 0;
106
+validate_file_to_edit($file, $allowed_files);
107
+$scrollto = isset($_REQUEST['scrollto']) ? (int) $_REQUEST['scrollto'] : 0;
108 108
 
109
-switch( $action ) {
109
+switch ($action) {
110 110
 case 'update':
111
-	check_admin_referer( 'edit-theme_' . $file . $stylesheet );
112
-	$newcontent = wp_unslash( $_POST['newcontent'] );
113
-	$location = 'theme-editor.php?file=' . urlencode( $relative_file ) . '&theme=' . urlencode( $stylesheet ) . '&scrollto=' . $scrollto;
114
-	if ( is_writeable( $file ) ) {
111
+	check_admin_referer('edit-theme_'.$file.$stylesheet);
112
+	$newcontent = wp_unslash($_POST['newcontent']);
113
+	$location = 'theme-editor.php?file='.urlencode($relative_file).'&theme='.urlencode($stylesheet).'&scrollto='.$scrollto;
114
+	if (is_writeable($file)) {
115 115
 		// is_writable() not always reliable, check return value. see comments @ http://uk.php.net/is_writable
116
-		$f = fopen( $file, 'w+' );
117
-		if ( $f !== false ) {
118
-			fwrite( $f, $newcontent );
119
-			fclose( $f );
116
+		$f = fopen($file, 'w+');
117
+		if ($f !== false) {
118
+			fwrite($f, $newcontent);
119
+			fclose($f);
120 120
 			$location .= '&updated=true';
121 121
 			$theme->cache_delete();
122 122
 		}
123 123
 	}
124
-	wp_redirect( $location );
124
+	wp_redirect($location);
125 125
 	exit;
126 126
 
127 127
 default:
128 128
 
129
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
129
+	require_once(ABSPATH.'wp-admin/admin-header.php');
130 130
 
131
-	update_recently_edited( $file );
131
+	update_recently_edited($file);
132 132
 
133
-	if ( ! is_file( $file ) )
133
+	if ( ! is_file($file))
134 134
 		$error = true;
135 135
 
136 136
 	$content = '';
137
-	if ( ! $error && filesize( $file ) > 0 ) {
137
+	if ( ! $error && filesize($file) > 0) {
138 138
 		$f = fopen($file, 'r');
139 139
 		$content = fread($f, filesize($file));
140 140
 
141
-		if ( '.php' == substr( $file, strrpos( $file, '.' ) ) ) {
142
-			$functions = wp_doc_link_parse( $content );
141
+		if ('.php' == substr($file, strrpos($file, '.'))) {
142
+			$functions = wp_doc_link_parse($content);
143 143
 
144 144
 			$docs_select = '<select name="docs-list" id="docs-list">';
145
-			$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
146
-			foreach ( $functions as $function ) {
147
-				$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
145
+			$docs_select .= '<option value="">'.esc_attr__('Function Name&hellip;').'</option>';
146
+			foreach ($functions as $function) {
147
+				$docs_select .= '<option value="'.esc_attr(urlencode($function)).'">'.htmlspecialchars($function).'()</option>';
148 148
 			}
149 149
 			$docs_select .= '</select>';
150 150
 		}
151 151
 
152
-		$content = esc_textarea( $content );
152
+		$content = esc_textarea($content);
153 153
 	}
154 154
 
155
-	if ( isset( $_GET['updated'] ) ) : ?>
156
- <div id="message" class="updated notice is-dismissible"><p><?php _e( 'File edited successfully.' ) ?></p></div>
155
+	if (isset($_GET['updated'])) : ?>
156
+ <div id="message" class="updated notice is-dismissible"><p><?php _e('File edited successfully.') ?></p></div>
157 157
 <?php endif;
158 158
 
159
-$description = get_file_description( $relative_file );
160
-$file_show = array_search( $file, array_filter( $allowed_files ) );
161
-if ( $description != $file_show )
162
-	$description .= ' <span>(' . $file_show . ')</span>';
159
+$description = get_file_description($relative_file);
160
+$file_show = array_search($file, array_filter($allowed_files));
161
+if ($description != $file_show)
162
+	$description .= ' <span>('.$file_show.')</span>';
163 163
 ?>
164 164
 <div class="wrap">
165
-<h1><?php echo esc_html( $title ); ?></h1>
165
+<h1><?php echo esc_html($title); ?></h1>
166 166
 
167 167
 <div class="fileedit-sub">
168 168
 <div class="alignleft">
169
-<h2><?php echo $theme->display( 'Name' ); if ( $description ) echo ': ' . $description; ?></h2>
169
+<h2><?php echo $theme->display('Name'); if ($description) echo ': '.$description; ?></h2>
170 170
 </div>
171 171
 <div class="alignright">
172 172
 	<form action="theme-editor.php" method="post">
173 173
 		<strong><label for="theme"><?php _e('Select theme to edit:'); ?> </label></strong>
174 174
 		<select name="theme" id="theme">
175 175
 <?php
176
-foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
177
-	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
176
+foreach (wp_get_themes(array('errors' => null)) as $a_stylesheet => $a_theme) {
177
+	if ($a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code())
178 178
 		continue;
179 179
 
180 180
 	$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
181
-	echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
181
+	echo "\n\t".'<option value="'.esc_attr($a_stylesheet).'"'.$selected.'>'.$a_theme->display('Name').'</option>';
182 182
 }
183 183
 ?>
184 184
 		</select>
185
-		<?php submit_button( __( 'Select' ), 'button', 'Submit', false ); ?>
185
+		<?php submit_button(__('Select'), 'button', 'Submit', false); ?>
186 186
 	</form>
187 187
 </div>
188 188
 <br class="clear" />
189 189
 </div>
190 190
 <?php
191
-if ( $theme->errors() )
192
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
191
+if ($theme->errors())
192
+	echo '<div class="error"><p><strong>'.__('This theme is broken.').'</strong> '.$theme->errors()->get_error_message().'</p></div>';
193 193
 ?>
194 194
 	<div id="templateside">
195 195
 <?php
196
-if ( $allowed_files ) :
196
+if ($allowed_files) :
197 197
 	$previous_file_type = '';
198 198
 
199
-	foreach ( $allowed_files as $filename => $absolute_filename ) :
200
-		$file_type = substr( $filename, strrpos( $filename, '.' ) );
199
+	foreach ($allowed_files as $filename => $absolute_filename) :
200
+		$file_type = substr($filename, strrpos($filename, '.'));
201 201
 
202
-		if ( $file_type !== $previous_file_type ) {
203
-			if ( '' !== $previous_file_type ) {
202
+		if ($file_type !== $previous_file_type) {
203
+			if ('' !== $previous_file_type) {
204 204
 				echo "\t</ul>\n";
205 205
 			}
206 206
 
207
-			switch ( $file_type ) {
207
+			switch ($file_type) {
208 208
 				case '.php':
209
-					if ( $has_templates || $theme->parent() ) :
210
-						echo "\t<h2>" . __( 'Templates' ) . "</h2>\n";
211
-						if ( $theme->parent() ) {
212
-							echo '<p class="howto">' . sprintf( __( 'This child theme inherits templates from a parent theme, %s.' ),
213
-								sprintf( '<a href="%s">%s</a>',
214
-									self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
215
-									$theme->parent()->display( 'Name' )
209
+					if ($has_templates || $theme->parent()) :
210
+						echo "\t<h2>".__('Templates')."</h2>\n";
211
+						if ($theme->parent()) {
212
+							echo '<p class="howto">'.sprintf(__('This child theme inherits templates from a parent theme, %s.'),
213
+								sprintf('<a href="%s">%s</a>',
214
+									self_admin_url('theme-editor.php?theme='.urlencode($theme->get_template())),
215
+									$theme->parent()->display('Name')
216 216
 								)
217
-							) . "</p>\n";
217
+							)."</p>\n";
218 218
 						}
219 219
 					endif;
220 220
 					break;
221 221
 				case '.css':
222
-					echo "\t<h2>" . _x( 'Styles', 'Theme stylesheets in theme editor' ) . "</h2>\n";
222
+					echo "\t<h2>"._x('Styles', 'Theme stylesheets in theme editor')."</h2>\n";
223 223
 					break;
224 224
 				default:
225 225
 					/* translators: %s: file extension */
226
-					echo "\t<h2>" . sprintf( __( '%s files' ), $file_type ) . "</h2>\n";
226
+					echo "\t<h2>".sprintf(__('%s files'), $file_type)."</h2>\n";
227 227
 					break;
228 228
 			}
229 229
 
230 230
 			echo "\t<ul>\n";
231 231
 		}
232 232
 		
233
-		$file_description = get_file_description( $filename );
234
-		if ( $filename !== basename( $absolute_filename ) || $file_description !== $filename ) {
235
-			$file_description .= '<br /><span class="nonessential">(' . $filename . ')</span>';
233
+		$file_description = get_file_description($filename);
234
+		if ($filename !== basename($absolute_filename) || $file_description !== $filename) {
235
+			$file_description .= '<br /><span class="nonessential">('.$filename.')</span>';
236 236
 		}
237 237
 
238
-		if ( $absolute_filename === $file ) {
239
-			$file_description = '<span class="highlight">' . $file_description . '</span>';
238
+		if ($absolute_filename === $file) {
239
+			$file_description = '<span class="highlight">'.$file_description.'</span>';
240 240
 		}
241 241
 
242 242
 		$previous_file_type = $file_type;
243 243
 ?>
244
-		<li><a href="theme-editor.php?file=<?php echo urlencode( $filename ) ?>&amp;theme=<?php echo urlencode( $stylesheet ) ?>"><?php echo $file_description; ?></a></li>
244
+		<li><a href="theme-editor.php?file=<?php echo urlencode($filename) ?>&amp;theme=<?php echo urlencode($stylesheet) ?>"><?php echo $file_description; ?></a></li>
245 245
 <?php
246 246
 	endforeach;
247 247
 ?>
248 248
 </ul>
249 249
 <?php endif; ?>
250 250
 </div>
251
-<?php if ( $error ) :
252
-	echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
251
+<?php if ($error) :
252
+	echo '<div class="error"><p>'.__('Oops, no such file exists! Double check the name and try again, merci.').'</p></div>';
253 253
 else : ?>
254 254
 	<form name="template" id="template" action="theme-editor.php" method="post">
255
-	<?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?>
255
+	<?php wp_nonce_field('edit-theme_'.$file.$stylesheet); ?>
256 256
 		<div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
257 257
 		<input type="hidden" name="action" value="update" />
258
-		<input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
259
-		<input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
258
+		<input type="hidden" name="file" value="<?php echo esc_attr($relative_file); ?>" />
259
+		<input type="hidden" name="theme" value="<?php echo esc_attr($theme->get_stylesheet()); ?>" />
260 260
 		<input type="hidden" name="scrollto" id="scrollto" value="<?php echo $scrollto; ?>" />
261 261
 		</div>
262
-	<?php if ( ! empty( $functions ) ) : ?>
262
+	<?php if ( ! empty($functions)) : ?>
263 263
 		<div id="documentation" class="hide-if-no-js">
264 264
 		<label for="docs-list"><?php _e('Documentation:') ?></label>
265 265
 		<?php echo $docs_select; ?>
266
-		<input type="button" class="button" value=" <?php esc_attr_e( 'Look Up' ); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_locale() ) ?>&amp;version=<?php echo urlencode( $wp_version ) ?>&amp;redirect=true'); }" />
266
+		<input type="button" class="button" value=" <?php esc_attr_e('Look Up'); ?> " onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode(get_locale()) ?>&amp;version=<?php echo urlencode($wp_version) ?>&amp;redirect=true'); }" />
267 267
 		</div>
268 268
 	<?php endif; ?>
269 269
 
270 270
 		<div>
271
-		<?php if ( is_child_theme() && $theme->get_stylesheet() == get_template() ) : ?>
272
-			<p><?php if ( is_writeable( $file ) ) { ?><strong><?php _e( 'Caution:' ); ?></strong><?php } ?>
273
-			<?php _e( 'This is a file in your current parent theme.' ); ?></p>
271
+		<?php if (is_child_theme() && $theme->get_stylesheet() == get_template()) : ?>
272
+			<p><?php if (is_writeable($file)) { ?><strong><?php _e('Caution:'); ?></strong><?php } ?>
273
+			<?php _e('This is a file in your current parent theme.'); ?></p>
274 274
 		<?php endif; ?>
275 275
 <?php
276
-	if ( is_writeable( $file ) ) :
277
-		submit_button( __( 'Update File' ), 'primary', 'submit', true );
276
+	if (is_writeable($file)) :
277
+		submit_button(__('Update File'), 'primary', 'submit', true);
278 278
 	else : ?>
279 279
 <p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
280 280
 <?php endif; ?>
@@ -295,4 +295,4 @@  discard block
 block discarded – undo
295 295
 break;
296 296
 }
297 297
 
298
-include(ABSPATH . 'wp-admin/admin-footer.php' );
298
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +26 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,8 +14,9 @@  discard block
 block discarded – undo
14 14
 	exit();
15 15
 }
16 16
 
17
-if ( !current_user_can('edit_themes') )
17
+if ( !current_user_can('edit_themes') ) {
18 18
 	wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this site.').'</p>');
19
+}
19 20
 
20 21
 $title = __("Edit Themes");
21 22
 $parent_file = 'themes.php';
@@ -130,8 +131,9 @@  discard block
 block discarded – undo
130 131
 
131 132
 	update_recently_edited( $file );
132 133
 
133
-	if ( ! is_file( $file ) )
134
-		$error = true;
134
+	if ( ! is_file( $file ) ) {
135
+			$error = true;
136
+	}
135 137
 
136 138
 	$content = '';
137 139
 	if ( ! $error && filesize( $file ) > 0 ) {
@@ -158,15 +160,19 @@  discard block
 block discarded – undo
158 160
 
159 161
 $description = get_file_description( $relative_file );
160 162
 $file_show = array_search( $file, array_filter( $allowed_files ) );
161
-if ( $description != $file_show )
163
+if ( $description != $file_show ) {
162 164
 	$description .= ' <span>(' . $file_show . ')</span>';
165
+}
163 166
 ?>
164 167
 <div class="wrap">
165 168
 <h1><?php echo esc_html( $title ); ?></h1>
166 169
 
167 170
 <div class="fileedit-sub">
168 171
 <div class="alignleft">
169
-<h2><?php echo $theme->display( 'Name' ); if ( $description ) echo ': ' . $description; ?></h2>
172
+<h2><?php echo $theme->display( 'Name' ); if ( $description ) {
173
+	echo ': ' . $description;
174
+}
175
+?></h2>
170 176
 </div>
171 177
 <div class="alignright">
172 178
 	<form action="theme-editor.php" method="post">
@@ -174,8 +180,9 @@  discard block
 block discarded – undo
174 180
 		<select name="theme" id="theme">
175 181
 <?php
176 182
 foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
177
-	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() )
178
-		continue;
183
+	if ( $a_theme->errors() && 'theme_no_stylesheet' == $a_theme->errors()->get_error_code() ) {
184
+			continue;
185
+	}
179 186
 
180 187
 	$selected = $a_stylesheet == $stylesheet ? ' selected="selected"' : '';
181 188
 	echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
@@ -188,8 +195,9 @@  discard block
 block discarded – undo
188 195
 <br class="clear" />
189 196
 </div>
190 197
 <?php
191
-if ( $theme->errors() )
198
+if ( $theme->errors() ) {
192 199
 	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
200
+}
193 201
 ?>
194 202
 	<div id="templateside">
195 203
 <?php
@@ -250,9 +258,12 @@  discard block
 block discarded – undo
250 258
 </div>
251 259
 <?php if ( $error ) :
252 260
 	echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
253
-else : ?>
261
+else {
262
+	: ?>
254 263
 	<form name="template" id="template" action="theme-editor.php" method="post">
255
-	<?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet ); ?>
264
+	<?php wp_nonce_field( 'edit-theme_' . $file . $stylesheet );
265
+}
266
+?>
256 267
 		<div><textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="newcontent-description"><?php echo $content; ?></textarea>
257 268
 		<input type="hidden" name="action" value="update" />
258 269
 		<input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
@@ -275,8 +286,11 @@  discard block
 block discarded – undo
275 286
 <?php
276 287
 	if ( is_writeable( $file ) ) :
277 288
 		submit_button( __( 'Update File' ), 'primary', 'submit', true );
278
-	else : ?>
279
-<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.'); ?></em></p>
289
+	else {
290
+		: ?>
291
+<p><em><?php _e('You need to make this file writable before you can save your changes. See <a href="https://codex.wordpress.org/Changing_File_Permissions">the Codex</a> for more information.');
292
+	}
293
+	?></em></p>
280 294
 <?php endif; ?>
281 295
 		</div>
282 296
 	</form>
Please login to merge, or discard this patch.
src/wp-admin/load-scripts.php 2 patches
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -8,61 +8,61 @@
 block discarded – undo
8 8
 error_reporting(0);
9 9
 
10 10
 /** Set ABSPATH for execution */
11
-define( 'ABSPATH', dirname(dirname(__FILE__)) . '/' );
12
-define( 'WPINC', 'wp-includes' );
11
+define('ABSPATH', dirname(dirname(__FILE__)).'/');
12
+define('WPINC', 'wp-includes');
13 13
 
14 14
 $load = $_GET['load'];
15
-if ( is_array( $load ) )
16
-	$load = implode( '', $load );
15
+if (is_array($load))
16
+	$load = implode('', $load);
17 17
 
18
-$load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
19
-$load = array_unique( explode( ',', $load ) );
18
+$load = preg_replace('/[^a-z0-9,_-]+/i', '', $load);
19
+$load = array_unique(explode(',', $load));
20 20
 
21
-if ( empty($load) )
21
+if (empty($load))
22 22
 	exit;
23 23
 
24
-require( ABSPATH . 'wp-admin/includes/noop.php' );
25
-require( ABSPATH . WPINC . '/script-loader.php' );
26
-require( ABSPATH . WPINC . '/version.php' );
24
+require(ABSPATH.'wp-admin/includes/noop.php');
25
+require(ABSPATH.WPINC.'/script-loader.php');
26
+require(ABSPATH.WPINC.'/version.php');
27 27
 
28
-$compress = ( isset($_GET['c']) && $_GET['c'] );
29
-$force_gzip = ( $compress && 'gzip' == $_GET['c'] );
28
+$compress = (isset($_GET['c']) && $_GET['c']);
29
+$force_gzip = ($compress && 'gzip' == $_GET['c']);
30 30
 $expires_offset = 31536000; // 1 year
31 31
 $out = '';
32 32
 
33 33
 $wp_scripts = new WP_Scripts();
34 34
 wp_default_scripts($wp_scripts);
35 35
 
36
-if ( isset( $_SERVER['HTTP_IF_NONE_MATCH'] ) && stripslashes( $_SERVER['HTTP_IF_NONE_MATCH'] ) === $wp_version ) {
36
+if (isset($_SERVER['HTTP_IF_NONE_MATCH']) && stripslashes($_SERVER['HTTP_IF_NONE_MATCH']) === $wp_version) {
37 37
 	$protocol = $_SERVER['SERVER_PROTOCOL'];
38
-	if ( ! in_array( $protocol, array( 'HTTP/1.1', 'HTTP/2', 'HTTP/2.0' ) ) ) {
38
+	if ( ! in_array($protocol, array('HTTP/1.1', 'HTTP/2', 'HTTP/2.0'))) {
39 39
 		$protocol = 'HTTP/1.0';
40 40
 	}
41
-	header( "$protocol 304 Not Modified" );
41
+	header("$protocol 304 Not Modified");
42 42
 	exit();
43 43
 }
44 44
 
45
-foreach ( $load as $handle ) {
46
-	if ( !array_key_exists($handle, $wp_scripts->registered) )
45
+foreach ($load as $handle) {
46
+	if ( ! array_key_exists($handle, $wp_scripts->registered))
47 47
 		continue;
48 48
 
49
-	$path = ABSPATH . $wp_scripts->registered[$handle]->src;
50
-	$out .= get_file($path) . "\n";
49
+	$path = ABSPATH.$wp_scripts->registered[$handle]->src;
50
+	$out .= get_file($path)."\n";
51 51
 }
52 52
 
53 53
 header("Etag: $wp_version");
54 54
 header('Content-Type: application/javascript; charset=UTF-8');
55
-header('Expires: ' . gmdate( "D, d M Y H:i:s", time() + $expires_offset ) . ' GMT');
55
+header('Expires: '.gmdate("D, d M Y H:i:s", time() + $expires_offset).' GMT');
56 56
 header("Cache-Control: public, max-age=$expires_offset");
57 57
 
58
-if ( $compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
58
+if ($compress && ! ini_get('zlib.output_compression') && 'ob_gzhandler' != ini_get('output_handler') && isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
59 59
 	header('Vary: Accept-Encoding'); // Handle proxies
60
-	if ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip ) {
60
+	if (false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'deflate') && function_exists('gzdeflate') && ! $force_gzip) {
61 61
 		header('Content-Encoding: deflate');
62
-		$out = gzdeflate( $out, 3 );
63
-	} elseif ( false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode') ) {
62
+		$out = gzdeflate($out, 3);
63
+	} elseif (false !== stripos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') && function_exists('gzencode')) {
64 64
 		header('Content-Encoding: gzip');
65
-		$out = gzencode( $out, 3 );
65
+		$out = gzencode($out, 3);
66 66
 	}
67 67
 }
68 68
 
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,14 +12,16 @@  discard block
 block discarded – undo
12 12
 define( 'WPINC', 'wp-includes' );
13 13
 
14 14
 $load = $_GET['load'];
15
-if ( is_array( $load ) )
15
+if ( is_array( $load ) ) {
16 16
 	$load = implode( '', $load );
17
+}
17 18
 
18 19
 $load = preg_replace( '/[^a-z0-9,_-]+/i', '', $load );
19 20
 $load = array_unique( explode( ',', $load ) );
20 21
 
21
-if ( empty($load) )
22
+if ( empty($load) ) {
22 23
 	exit;
24
+}
23 25
 
24 26
 require( ABSPATH . 'wp-admin/includes/noop.php' );
25 27
 require( ABSPATH . WPINC . '/script-loader.php' );
@@ -43,8 +45,9 @@  discard block
 block discarded – undo
43 45
 }
44 46
 
45 47
 foreach ( $load as $handle ) {
46
-	if ( !array_key_exists($handle, $wp_scripts->registered) )
47
-		continue;
48
+	if ( !array_key_exists($handle, $wp_scripts->registered) ) {
49
+			continue;
50
+	}
48 51
 
49 52
 	$path = ABSPATH . $wp_scripts->registered[$handle]->src;
50 53
 	$out .= get_file($path) . "\n";
Please login to merge, or discard this patch.
src/wp-admin/edit.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 $bulk_messages['post'] = array(
269 269
 	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
270 270
 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
271
-	                   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
271
+					   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
272 272
 	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
273 273
 	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
274 274
 	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 $bulk_messages['page'] = array(
277 277
 	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
278 278
 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
279
-	                   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
279
+					   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
280 280
 	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
281 281
 	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
282 282
 	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
Please login to merge, or discard this patch.
Spacing   +145 added lines, -147 removed lines patch added patch discarded remove patch
@@ -7,17 +7,17 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( ! $typenow )
13
-	wp_die( __( 'Invalid post type' ) );
12
+if ( ! $typenow)
13
+	wp_die(__('Invalid post type'));
14 14
 
15
-if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
16
-	wp_die( __( 'You are not allowed to edit posts in this post type.' ) );
15
+if ( ! in_array($typenow, get_post_types(array('show_ui' => true)))) {
16
+	wp_die(__('You are not allowed to edit posts in this post type.'));
17 17
 }
18 18
 
19
-if ( 'attachment' === $typenow ) {
20
-	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
19
+if ('attachment' === $typenow) {
20
+	if (wp_redirect(admin_url('upload.php'))) {
21 21
 		exit;
22 22
 	}
23 23
 }
@@ -29,15 +29,15 @@  discard block
 block discarded – undo
29 29
 global $post_type, $post_type_object;
30 30
 
31 31
 $post_type = $typenow;
32
-$post_type_object = get_post_type_object( $post_type );
32
+$post_type_object = get_post_type_object($post_type);
33 33
 
34
-if ( ! $post_type_object )
35
-	wp_die( __( 'Invalid post type' ) );
34
+if ( ! $post_type_object)
35
+	wp_die(__('Invalid post type'));
36 36
 
37
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
37
+if ( ! current_user_can($post_type_object->cap->edit_posts)) {
38 38
 	wp_die(
39
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
40
-		'<p>' . __( 'You are not allowed to edit posts in this post type.' ) . '</p>',
39
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
40
+		'<p>'.__('You are not allowed to edit posts in this post type.').'</p>',
41 41
 		403
42 42
 	);
43 43
 }
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 $pagenum = $wp_list_table->get_pagenum();
47 47
 
48 48
 // Back-compat for viewing comments of an entry
49
-foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
50
-	if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
51
-		wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
49
+foreach (array('p', 'attachment_id', 'page_id') as $_redirect) {
50
+	if ( ! empty($_REQUEST[$_redirect])) {
51
+		wp_redirect(admin_url('edit-comments.php?p='.absint($_REQUEST[$_redirect])));
52 52
 		exit;
53 53
 	}
54 54
 }
55
-unset( $_redirect );
55
+unset($_redirect);
56 56
 
57
-if ( 'post' != $post_type ) {
57
+if ('post' != $post_type) {
58 58
 	$parent_file = "edit.php?post_type=$post_type";
59 59
 	$submenu_file = "edit.php?post_type=$post_type";
60 60
 	$post_new_file = "post-new.php?post_type=$post_type";
@@ -66,66 +66,66 @@  discard block
 block discarded – undo
66 66
 
67 67
 $doaction = $wp_list_table->current_action();
68 68
 
69
-if ( $doaction ) {
69
+if ($doaction) {
70 70
 	check_admin_referer('bulk-posts');
71 71
 
72
-	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
73
-	if ( ! $sendback )
74
-		$sendback = admin_url( $parent_file );
75
-	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
76
-	if ( strpos($sendback, 'post.php') !== false )
72
+	$sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer());
73
+	if ( ! $sendback)
74
+		$sendback = admin_url($parent_file);
75
+	$sendback = add_query_arg('paged', $pagenum, $sendback);
76
+	if (strpos($sendback, 'post.php') !== false)
77 77
 		$sendback = admin_url($post_new_file);
78 78
 
79
-	if ( 'delete_all' == $doaction ) {
79
+	if ('delete_all' == $doaction) {
80 80
 		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
81 81
 		$post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
82 82
 		// Validate the post status exists.
83
-		if ( get_post_status_object( $post_status ) ) {
84
-			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
83
+		if (get_post_status_object($post_status)) {
84
+			$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status));
85 85
 		}
86 86
 		$doaction = 'delete';
87
-	} elseif ( isset( $_REQUEST['media'] ) ) {
87
+	} elseif (isset($_REQUEST['media'])) {
88 88
 		$post_ids = $_REQUEST['media'];
89
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
90
-		$post_ids = explode( ',', $_REQUEST['ids'] );
91
-	} elseif ( !empty( $_REQUEST['post'] ) ) {
89
+	} elseif (isset($_REQUEST['ids'])) {
90
+		$post_ids = explode(',', $_REQUEST['ids']);
91
+	} elseif ( ! empty($_REQUEST['post'])) {
92 92
 		$post_ids = array_map('intval', $_REQUEST['post']);
93 93
 	}
94 94
 
95
-	if ( !isset( $post_ids ) ) {
96
-		wp_redirect( $sendback );
95
+	if ( ! isset($post_ids)) {
96
+		wp_redirect($sendback);
97 97
 		exit;
98 98
 	}
99 99
 
100
-	switch ( $doaction ) {
100
+	switch ($doaction) {
101 101
 		case 'trash':
102 102
 			$trashed = $locked = 0;
103 103
 
104
-			foreach ( (array) $post_ids as $post_id ) {
105
-				if ( !current_user_can( 'delete_post', $post_id) )
106
-					wp_die( __('You are not allowed to move this item to the Trash.') );
104
+			foreach ((array) $post_ids as $post_id) {
105
+				if ( ! current_user_can('delete_post', $post_id))
106
+					wp_die(__('You are not allowed to move this item to the Trash.'));
107 107
 
108
-				if ( wp_check_post_lock( $post_id ) ) {
108
+				if (wp_check_post_lock($post_id)) {
109 109
 					$locked++;
110 110
 					continue;
111 111
 				}
112 112
 
113
-				if ( !wp_trash_post($post_id) )
114
-					wp_die( __('Error in moving to Trash.') );
113
+				if ( ! wp_trash_post($post_id))
114
+					wp_die(__('Error in moving to Trash.'));
115 115
 
116 116
 				$trashed++;
117 117
 			}
118 118
 
119
-			$sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback );
119
+			$sendback = add_query_arg(array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked), $sendback);
120 120
 			break;
121 121
 		case 'untrash':
122 122
 			$untrashed = 0;
123
-			foreach ( (array) $post_ids as $post_id ) {
124
-				if ( !current_user_can( 'delete_post', $post_id) )
125
-					wp_die( __('You are not allowed to restore this item from the Trash.') );
123
+			foreach ((array) $post_ids as $post_id) {
124
+				if ( ! current_user_can('delete_post', $post_id))
125
+					wp_die(__('You are not allowed to restore this item from the Trash.'));
126 126
 
127
-				if ( !wp_untrash_post($post_id) )
128
-					wp_die( __('Error in restoring from Trash.') );
127
+				if ( ! wp_untrash_post($post_id))
128
+					wp_die(__('Error in restoring from Trash.'));
129 129
 
130 130
 				$untrashed++;
131 131
 			}
@@ -133,43 +133,43 @@  discard block
 block discarded – undo
133 133
 			break;
134 134
 		case 'delete':
135 135
 			$deleted = 0;
136
-			foreach ( (array) $post_ids as $post_id ) {
136
+			foreach ((array) $post_ids as $post_id) {
137 137
 				$post_del = get_post($post_id);
138 138
 
139
-				if ( !current_user_can( 'delete_post', $post_id ) )
140
-					wp_die( __('You are not allowed to delete this item.') );
139
+				if ( ! current_user_can('delete_post', $post_id))
140
+					wp_die(__('You are not allowed to delete this item.'));
141 141
 
142
-				if ( $post_del->post_type == 'attachment' ) {
143
-					if ( ! wp_delete_attachment($post_id) )
144
-						wp_die( __('Error in deleting.') );
142
+				if ($post_del->post_type == 'attachment') {
143
+					if ( ! wp_delete_attachment($post_id))
144
+						wp_die(__('Error in deleting.'));
145 145
 				} else {
146
-					if ( !wp_delete_post($post_id) )
147
-						wp_die( __('Error in deleting.') );
146
+					if ( ! wp_delete_post($post_id))
147
+						wp_die(__('Error in deleting.'));
148 148
 				}
149 149
 				$deleted++;
150 150
 			}
151 151
 			$sendback = add_query_arg('deleted', $deleted, $sendback);
152 152
 			break;
153 153
 		case 'edit':
154
-			if ( isset($_REQUEST['bulk_edit']) ) {
154
+			if (isset($_REQUEST['bulk_edit'])) {
155 155
 				$done = bulk_edit_posts($_REQUEST);
156 156
 
157
-				if ( is_array($done) ) {
158
-					$done['updated'] = count( $done['updated'] );
159
-					$done['skipped'] = count( $done['skipped'] );
160
-					$done['locked'] = count( $done['locked'] );
161
-					$sendback = add_query_arg( $done, $sendback );
157
+				if (is_array($done)) {
158
+					$done['updated'] = count($done['updated']);
159
+					$done['skipped'] = count($done['skipped']);
160
+					$done['locked'] = count($done['locked']);
161
+					$sendback = add_query_arg($done, $sendback);
162 162
 				}
163 163
 			}
164 164
 			break;
165 165
 	}
166 166
 
167
-	$sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
167
+	$sendback = remove_query_arg(array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback);
168 168
 
169 169
 	wp_redirect($sendback);
170 170
 	exit();
171
-} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
172
-	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) );
171
+} elseif ( ! empty($_REQUEST['_wp_http_referer'])) {
172
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
173 173
 	 exit;
174 174
 }
175 175
 
@@ -180,106 +180,104 @@  discard block
 block discarded – undo
180 180
 
181 181
 $title = $post_type_object->labels->name;
182 182
 
183
-if ( 'post' == $post_type ) {
184
-	get_current_screen()->add_help_tab( array(
183
+if ('post' == $post_type) {
184
+	get_current_screen()->add_help_tab(array(
185 185
 	'id'		=> 'overview',
186 186
 	'title'		=> __('Overview'),
187 187
 	'content'	=>
188
-		'<p>' . __('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.') . '</p>'
189
-	) );
190
-	get_current_screen()->add_help_tab( array(
188
+		'<p>'.__('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.').'</p>'
189
+	));
190
+	get_current_screen()->add_help_tab(array(
191 191
 	'id'		=> 'screen-content',
192 192
 	'title'		=> __('Screen Content'),
193 193
 	'content'	=>
194
-		'<p>' . __('You can customize the display of this screen&#8217;s contents in a number of ways:') . '</p>' .
195
-		'<ul>' .
196
-			'<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' .
197
-			'<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' .
198
-			'<li>' . __('You can view posts in a simple title list or with an excerpt using the Screen Options tab.') . '</li>' .
199
-			'<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' .
194
+		'<p>'.__('You can customize the display of this screen&#8217;s contents in a number of ways:').'</p>'.
195
+		'<ul>'.
196
+			'<li>'.__('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.').'</li>'.
197
+			'<li>'.__('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.').'</li>'.
198
+			'<li>'.__('You can view posts in a simple title list or with an excerpt using the Screen Options tab.').'</li>'.
199
+			'<li>'.__('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.').'</li>'.
200 200
 		'</ul>'
201
-	) );
202
-	get_current_screen()->add_help_tab( array(
201
+	));
202
+	get_current_screen()->add_help_tab(array(
203 203
 	'id'		=> 'action-links',
204 204
 	'title'		=> __('Available Actions'),
205 205
 	'content'	=>
206
-		'<p>' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '</p>' .
207
-		'<ul>' .
208
-			'<li>' . __('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' .
209
-			'<li>' . __('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' .
210
-			'<li>' . __('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' .
211
-			'<li>' . __('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.') . '</li>' .
206
+		'<p>'.__('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:').'</p>'.
207
+		'<ul>'.
208
+			'<li>'.__('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.').'</li>'.
209
+			'<li>'.__('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.').'</li>'.
210
+			'<li>'.__('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.').'</li>'.
211
+			'<li>'.__('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.').'</li>'.
212 212
 		'</ul>'
213
-	) );
214
-	get_current_screen()->add_help_tab( array(
213
+	));
214
+	get_current_screen()->add_help_tab(array(
215 215
 	'id'		=> 'bulk-actions',
216 216
 	'title'		=> __('Bulk Actions'),
217 217
 	'content'	=>
218
-		'<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' .
219
-				'<p>' . __('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>'
220
-	) );
218
+		'<p>'.__('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.').'</p>'.
219
+				'<p>'.__('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.').'</p>'
220
+	));
221 221
 
222 222
 	get_current_screen()->set_help_sidebar(
223
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
224
-	'<p>' . __('<a href="https://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>') . '</p>' .
225
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
223
+	'<p><strong>'.__('For more information:').'</strong></p>'.
224
+	'<p>'.__('<a href="https://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>').'</p>'.
225
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
226 226
 	);
227 227
 
228
-} elseif ( 'page' == $post_type ) {
229
-	get_current_screen()->add_help_tab( array(
228
+} elseif ('page' == $post_type) {
229
+	get_current_screen()->add_help_tab(array(
230 230
 	'id'		=> 'overview',
231 231
 	'title'		=> __('Overview'),
232 232
 	'content'	=>
233
-		'<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.') . '</p>'
234
-	) );
235
-	get_current_screen()->add_help_tab( array(
233
+		'<p>'.__('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.').'</p>'
234
+	));
235
+	get_current_screen()->add_help_tab(array(
236 236
 	'id'		=> 'managing-pages',
237 237
 	'title'		=> __('Managing Pages'),
238 238
 	'content'	=>
239
-		'<p>' . __('Managing pages is very similar to managing posts, and the screens can be customized in the same way.') . '</p>' .
240
-		'<p>' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.') . '</p>'
241
-	) );
239
+		'<p>'.__('Managing pages is very similar to managing posts, and the screens can be customized in the same way.').'</p>'.
240
+		'<p>'.__('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.').'</p>'
241
+	));
242 242
 
243 243
 	get_current_screen()->set_help_sidebar(
244
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
245
-	'<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>') . '</p>' .
246
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
244
+	'<p><strong>'.__('For more information:').'</strong></p>'.
245
+	'<p>'.__('<a href="https://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>').'</p>'.
246
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
247 247
 	);
248 248
 
249 249
 }
250 250
 
251
-get_current_screen()->set_screen_reader_content( array(
251
+get_current_screen()->set_screen_reader_content(array(
252 252
 	'heading_views'      => $post_type_object->labels->filter_items_list,
253 253
 	'heading_pagination' => $post_type_object->labels->items_list_navigation,
254 254
 	'heading_list'       => $post_type_object->labels->items_list,
255
-) );
255
+));
256 256
 
257
-add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
257
+add_screen_option('per_page', array('default' => 20, 'option' => 'edit_'.$post_type.'_per_page'));
258 258
 
259 259
 $bulk_counts = array(
260
-	'updated'   => isset( $_REQUEST['updated'] )   ? absint( $_REQUEST['updated'] )   : 0,
261
-	'locked'    => isset( $_REQUEST['locked'] )    ? absint( $_REQUEST['locked'] )    : 0,
262
-	'deleted'   => isset( $_REQUEST['deleted'] )   ? absint( $_REQUEST['deleted'] )   : 0,
263
-	'trashed'   => isset( $_REQUEST['trashed'] )   ? absint( $_REQUEST['trashed'] )   : 0,
264
-	'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
260
+	'updated'   => isset($_REQUEST['updated']) ? absint($_REQUEST['updated']) : 0,
261
+	'locked'    => isset($_REQUEST['locked']) ? absint($_REQUEST['locked']) : 0,
262
+	'deleted'   => isset($_REQUEST['deleted']) ? absint($_REQUEST['deleted']) : 0,
263
+	'trashed'   => isset($_REQUEST['trashed']) ? absint($_REQUEST['trashed']) : 0,
264
+	'untrashed' => isset($_REQUEST['untrashed']) ? absint($_REQUEST['untrashed']) : 0,
265 265
 );
266 266
 
267 267
 $bulk_messages = array();
268 268
 $bulk_messages['post'] = array(
269
-	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
270
-	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
271
-	                   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
272
-	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
273
-	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
274
-	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
269
+	'updated'   => _n('%s post updated.', '%s posts updated.', $bulk_counts['updated']),
270
+	'locked'    => (1 == $bulk_counts['locked']) ? __('1 post not updated, somebody is editing it.') : _n('%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked']),
271
+	'deleted'   => _n('%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted']),
272
+	'trashed'   => _n('%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed']),
273
+	'untrashed' => _n('%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed']),
275 274
 );
276 275
 $bulk_messages['page'] = array(
277
-	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
278
-	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
279
-	                   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
280
-	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
281
-	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
282
-	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
276
+	'updated'   => _n('%s page updated.', '%s pages updated.', $bulk_counts['updated']),
277
+	'locked'    => (1 == $bulk_counts['locked']) ? __('1 page not updated, somebody is editing it.') : _n('%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked']),
278
+	'deleted'   => _n('%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted']),
279
+	'trashed'   => _n('%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed']),
280
+	'untrashed' => _n('%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed']),
283 281
 );
284 282
 
285 283
 /**
@@ -293,54 +291,54 @@  discard block
 block discarded – undo
293 291
  *                             keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
294 292
  * @param array $bulk_counts   Array of item counts for each message, used to build internationalized strings.
295 293
  */
296
-$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
297
-$bulk_counts = array_filter( $bulk_counts );
294
+$bulk_messages = apply_filters('bulk_post_updated_messages', $bulk_messages, $bulk_counts);
295
+$bulk_counts = array_filter($bulk_counts);
298 296
 
299
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
297
+require_once(ABSPATH.'wp-admin/admin-header.php');
300 298
 ?>
301 299
 <div class="wrap">
302 300
 <h1><?php
303
-echo esc_html( $post_type_object->labels->name );
304
-if ( current_user_can( $post_type_object->cap->create_posts ) )
305
-	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
301
+echo esc_html($post_type_object->labels->name);
302
+if (current_user_can($post_type_object->cap->create_posts))
303
+	echo ' <a href="'.esc_url(admin_url($post_new_file)).'" class="page-title-action">'.esc_html($post_type_object->labels->add_new).'</a>';
306 304
 
307
-if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
305
+if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) {
308 306
 	/* translators: %s: search keywords */
309
-	printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
307
+	printf(' <span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query());
310 308
 }
311 309
 ?></h1>
312 310
 
313 311
 <?php
314 312
 // If we have a bulk message to issue:
315 313
 $messages = array();
316
-foreach ( $bulk_counts as $message => $count ) {
317
-	if ( isset( $bulk_messages[ $post_type ][ $message ] ) )
318
-		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
319
-	elseif ( isset( $bulk_messages['post'][ $message ] ) )
320
-		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
321
-
322
-	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
323
-		$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
324
-		$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>';
314
+foreach ($bulk_counts as $message => $count) {
315
+	if (isset($bulk_messages[$post_type][$message]))
316
+		$messages[] = sprintf($bulk_messages[$post_type][$message], number_format_i18n($count));
317
+	elseif (isset($bulk_messages['post'][$message]))
318
+		$messages[] = sprintf($bulk_messages['post'][$message], number_format_i18n($count));
319
+
320
+	if ($message == 'trashed' && isset($_REQUEST['ids'])) {
321
+		$ids = preg_replace('/[^0-9,]/', '', $_REQUEST['ids']);
322
+		$messages[] = '<a href="'.esc_url(wp_nonce_url("edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts")).'">'.__('Undo').'</a>';
325 323
 	}
326 324
 }
327 325
 
328
-if ( $messages )
329
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
330
-unset( $messages );
326
+if ($messages)
327
+	echo '<div id="message" class="updated notice is-dismissible"><p>'.join(' ', $messages).'</p></div>';
328
+unset($messages);
331 329
 
332
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
330
+$_SERVER['REQUEST_URI'] = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI']);
333 331
 ?>
334 332
 
335 333
 <?php $wp_list_table->views(); ?>
336 334
 
337 335
 <form id="posts-filter" method="get">
338 336
 
339
-<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
337
+<?php $wp_list_table->search_box($post_type_object->labels->search_items, 'post'); ?>
340 338
 
341
-<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
339
+<input type="hidden" name="post_status" class="post_status_page" value="<?php echo ! empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
342 340
 <input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
343
-<?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?>
341
+<?php if ( ! empty($_REQUEST['show_sticky'])) { ?>
344 342
 <input type="hidden" name="show_sticky" value="1" />
345 343
 <?php } ?>
346 344
 
@@ -349,7 +347,7 @@  discard block
 block discarded – undo
349 347
 </form>
350 348
 
351 349
 <?php
352
-if ( $wp_list_table->has_items() )
350
+if ($wp_list_table->has_items())
353 351
 	$wp_list_table->inline_edit();
354 352
 ?>
355 353
 
@@ -358,4 +356,4 @@  discard block
 block discarded – undo
358 356
 </div>
359 357
 
360 358
 <?php
361
-include( ABSPATH . 'wp-admin/admin-footer.php' );
359
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +42 added lines, -27 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( ! $typenow )
12
+if ( ! $typenow ) {
13 13
 	wp_die( __( 'Invalid post type' ) );
14
+}
14 15
 
15 16
 if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
16 17
 	wp_die( __( 'You are not allowed to edit posts in this post type.' ) );
@@ -31,8 +32,9 @@  discard block
 block discarded – undo
31 32
 $post_type = $typenow;
32 33
 $post_type_object = get_post_type_object( $post_type );
33 34
 
34
-if ( ! $post_type_object )
35
+if ( ! $post_type_object ) {
35 36
 	wp_die( __( 'Invalid post type' ) );
37
+}
36 38
 
37 39
 if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
38 40
 	wp_die(
@@ -70,11 +72,13 @@  discard block
 block discarded – undo
70 72
 	check_admin_referer('bulk-posts');
71 73
 
72 74
 	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
73
-	if ( ! $sendback )
74
-		$sendback = admin_url( $parent_file );
75
+	if ( ! $sendback ) {
76
+			$sendback = admin_url( $parent_file );
77
+	}
75 78
 	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
76
-	if ( strpos($sendback, 'post.php') !== false )
77
-		$sendback = admin_url($post_new_file);
79
+	if ( strpos($sendback, 'post.php') !== false ) {
80
+			$sendback = admin_url($post_new_file);
81
+	}
78 82
 
79 83
 	if ( 'delete_all' == $doaction ) {
80 84
 		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
@@ -102,16 +106,18 @@  discard block
 block discarded – undo
102 106
 			$trashed = $locked = 0;
103 107
 
104 108
 			foreach ( (array) $post_ids as $post_id ) {
105
-				if ( !current_user_can( 'delete_post', $post_id) )
106
-					wp_die( __('You are not allowed to move this item to the Trash.') );
109
+				if ( !current_user_can( 'delete_post', $post_id) ) {
110
+									wp_die( __('You are not allowed to move this item to the Trash.') );
111
+				}
107 112
 
108 113
 				if ( wp_check_post_lock( $post_id ) ) {
109 114
 					$locked++;
110 115
 					continue;
111 116
 				}
112 117
 
113
-				if ( !wp_trash_post($post_id) )
114
-					wp_die( __('Error in moving to Trash.') );
118
+				if ( !wp_trash_post($post_id) ) {
119
+									wp_die( __('Error in moving to Trash.') );
120
+				}
115 121
 
116 122
 				$trashed++;
117 123
 			}
@@ -121,11 +127,13 @@  discard block
 block discarded – undo
121 127
 		case 'untrash':
122 128
 			$untrashed = 0;
123 129
 			foreach ( (array) $post_ids as $post_id ) {
124
-				if ( !current_user_can( 'delete_post', $post_id) )
125
-					wp_die( __('You are not allowed to restore this item from the Trash.') );
130
+				if ( !current_user_can( 'delete_post', $post_id) ) {
131
+									wp_die( __('You are not allowed to restore this item from the Trash.') );
132
+				}
126 133
 
127
-				if ( !wp_untrash_post($post_id) )
128
-					wp_die( __('Error in restoring from Trash.') );
134
+				if ( !wp_untrash_post($post_id) ) {
135
+									wp_die( __('Error in restoring from Trash.') );
136
+				}
129 137
 
130 138
 				$untrashed++;
131 139
 			}
@@ -136,15 +144,18 @@  discard block
 block discarded – undo
136 144
 			foreach ( (array) $post_ids as $post_id ) {
137 145
 				$post_del = get_post($post_id);
138 146
 
139
-				if ( !current_user_can( 'delete_post', $post_id ) )
140
-					wp_die( __('You are not allowed to delete this item.') );
147
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
148
+									wp_die( __('You are not allowed to delete this item.') );
149
+				}
141 150
 
142 151
 				if ( $post_del->post_type == 'attachment' ) {
143
-					if ( ! wp_delete_attachment($post_id) )
144
-						wp_die( __('Error in deleting.') );
152
+					if ( ! wp_delete_attachment($post_id) ) {
153
+											wp_die( __('Error in deleting.') );
154
+					}
145 155
 				} else {
146
-					if ( !wp_delete_post($post_id) )
147
-						wp_die( __('Error in deleting.') );
156
+					if ( !wp_delete_post($post_id) ) {
157
+											wp_die( __('Error in deleting.') );
158
+					}
148 159
 				}
149 160
 				$deleted++;
150 161
 			}
@@ -301,8 +312,9 @@  discard block
 block discarded – undo
301 312
 <div class="wrap">
302 313
 <h1><?php
303 314
 echo esc_html( $post_type_object->labels->name );
304
-if ( current_user_can( $post_type_object->cap->create_posts ) )
315
+if ( current_user_can( $post_type_object->cap->create_posts ) ) {
305 316
 	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
317
+}
306 318
 
307 319
 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
308 320
 	/* translators: %s: search keywords */
@@ -314,10 +326,11 @@  discard block
 block discarded – undo
314 326
 // If we have a bulk message to issue:
315 327
 $messages = array();
316 328
 foreach ( $bulk_counts as $message => $count ) {
317
-	if ( isset( $bulk_messages[ $post_type ][ $message ] ) )
318
-		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
319
-	elseif ( isset( $bulk_messages['post'][ $message ] ) )
320
-		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
329
+	if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) {
330
+			$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
331
+	} elseif ( isset( $bulk_messages['post'][ $message ] ) ) {
332
+			$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
333
+	}
321 334
 
322 335
 	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
323 336
 		$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
@@ -325,8 +338,9 @@  discard block
 block discarded – undo
325 338
 	}
326 339
 }
327 340
 
328
-if ( $messages )
341
+if ( $messages ) {
329 342
 	echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
343
+}
330 344
 unset( $messages );
331 345
 
332 346
 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
@@ -349,8 +363,9 @@  discard block
 block discarded – undo
349 363
 </form>
350 364
 
351 365
 <?php
352
-if ( $wp_list_table->has_items() )
366
+if ( $wp_list_table->has_items() ) {
353 367
 	$wp_list_table->inline_edit();
368
+}
354 369
 ?>
355 370
 
356 371
 <div id="ajax-response"></div>
Please login to merge, or discard this patch.
src/wp-admin/user-new.php 3 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
 ) );
202 202
 
203 203
 get_current_screen()->set_help_sidebar(
204
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
205
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
206
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
204
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
205
+	'<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
206
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
207 207
 );
208 208
 
209 209
 wp_enqueue_script('wp-ajax-response');
@@ -347,16 +347,16 @@  discard block
 block discarded – undo
347 347
 </table>
348 348
 <?php
349 349
 /**
350
- * Fires at the end of the new user form.
351
- *
352
- * Passes a contextual string to make both types of new user forms
353
- * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
354
- * and 'add-new-user' (single site and network admin).
355
- *
356
- * @since 3.7.0
357
- *
358
- * @param string $type A contextual string specifying which type of new user form the hook follows.
359
- */
350
+	 * Fires at the end of the new user form.
351
+	 *
352
+	 * Passes a contextual string to make both types of new user forms
353
+	 * uniquely targetable. Contexts are 'add-existing-user' (Multisite),
354
+	 * and 'add-new-user' (single site and network admin).
355
+	 *
356
+	 * @since 3.7.0
357
+	 *
358
+	 * @param string $type A contextual string specifying which type of new user form the hook follows.
359
+	 */
360 360
 do_action( 'user_new_form', 'add-existing-user' );
361 361
 ?>
362 362
 <?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
Please login to merge, or discard this patch.
Spacing   +165 added lines, -165 removed lines patch added patch discarded remove patch
@@ -7,53 +7,53 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( is_multisite() ) {
13
-	if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) {
12
+if (is_multisite()) {
13
+	if ( ! current_user_can('create_users') && ! current_user_can('promote_users')) {
14 14
 		wp_die(
15
-			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
16
-			'<p>' . __( 'You do not have sufficient permissions to add users to this network.' ) . '</p>',
15
+			'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
16
+			'<p>'.__('You do not have sufficient permissions to add users to this network.').'</p>',
17 17
 			403
18 18
 		);
19 19
 	}
20
-} elseif ( ! current_user_can( 'create_users' ) ) {
20
+} elseif ( ! current_user_can('create_users')) {
21 21
 	wp_die(
22
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
23
-		'<p>' . __( 'You are not allowed to create users.' ) . '</p>',
22
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
23
+		'<p>'.__('You are not allowed to create users.').'</p>',
24 24
 		403
25 25
 	);
26 26
 }
27 27
 
28
-if ( is_multisite() ) {
29
-	add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' );
28
+if (is_multisite()) {
29
+	add_filter('wpmu_signup_user_notification_email', 'admin_created_user_email');
30 30
 }
31 31
 
32
-if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) {
33
-	check_admin_referer( 'add-user', '_wpnonce_add-user' );
32
+if (isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action']) {
33
+	check_admin_referer('add-user', '_wpnonce_add-user');
34 34
 
35 35
 	$user_details = null;
36
-	$user_email = wp_unslash( $_REQUEST['email'] );
37
-	if ( false !== strpos( $user_email, '@' ) ) {
38
-		$user_details = get_user_by( 'email', $user_email );
36
+	$user_email = wp_unslash($_REQUEST['email']);
37
+	if (false !== strpos($user_email, '@')) {
38
+		$user_details = get_user_by('email', $user_email);
39 39
 	} else {
40
-		if ( is_super_admin() ) {
41
-			$user_details = get_user_by( 'login', $user_email );
40
+		if (is_super_admin()) {
41
+			$user_details = get_user_by('login', $user_email);
42 42
 		} else {
43
-			wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) );
43
+			wp_redirect(add_query_arg(array('update' => 'enter_email'), 'user-new.php'));
44 44
 			die();
45 45
 		}
46 46
 	}
47 47
 
48
-	if ( !$user_details ) {
49
-		wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) );
48
+	if ( ! $user_details) {
49
+		wp_redirect(add_query_arg(array('update' => 'does_not_exist'), 'user-new.php'));
50 50
 		die();
51 51
 	}
52 52
 
53
-	if ( ! current_user_can( 'promote_user', $user_details->ID ) ) {
53
+	if ( ! current_user_can('promote_user', $user_details->ID)) {
54 54
 		wp_die(
55
-			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
56
-			'<p>' . __( 'You do not have sufficient permissions to add users to this network.' ) . '</p>',
55
+			'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
56
+			'<p>'.__('You do not have sufficient permissions to add users to this network.').'</p>',
57 57
 			403
58 58
 		);
59 59
 	}
@@ -63,18 +63,18 @@  discard block
 block discarded – undo
63 63
 	$redirect = 'user-new.php';
64 64
 	$username = $user_details->user_login;
65 65
 	$user_id = $user_details->ID;
66
-	if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) {
67
-		$redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' );
66
+	if (($username != null && ! is_super_admin($user_id)) && (array_key_exists($blog_id, get_blogs_of_user($user_id)))) {
67
+		$redirect = add_query_arg(array('update' => 'addexisting'), 'user-new.php');
68 68
 	} else {
69
-		if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
70
-			add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) );
71
-			$redirect = add_query_arg( array( 'update' => 'addnoconfirmation' , 'user_id' => $user_id ), 'user-new.php' );
69
+		if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) {
70
+			add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role']));
71
+			$redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $user_id), 'user-new.php');
72 72
 		} else {
73
-			$newuser_key = substr( md5( $user_id ), 0, 5 );
74
-			add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) );
73
+			$newuser_key = substr(md5($user_id), 0, 5);
74
+			add_option('new_user_'.$newuser_key, array('user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST['role']));
75 75
 
76 76
 			$roles = get_editable_roles();
77
-			$role = $roles[ $_REQUEST['role'] ];
77
+			$role = $roles[$_REQUEST['role']];
78 78
 
79 79
 			/**
80 80
 			 * Fires immediately after a user is invited to join a site, but before the notification is sent.
@@ -85,52 +85,52 @@  discard block
 block discarded – undo
85 85
 			 * @param array  $role        The role of invited user.
86 86
 			 * @param string $newuser_key The key of the invitation.
87 87
 			 */
88
-			do_action( 'invite_user', $user_id, $role, $newuser_key );
88
+			do_action('invite_user', $user_id, $role, $newuser_key);
89 89
 
90 90
 			/* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */
91
-			$message = __( 'Hi,
91
+			$message = __('Hi,
92 92
 
93 93
 You\'ve been invited to join \'%1$s\' at
94 94
 %2$s with the role of %3$s.
95 95
 
96 96
 Please click the following link to confirm the invite:
97 97
 %4$s' );
98
-			wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) );
99
-			$redirect = add_query_arg( array('update' => 'add'), 'user-new.php' );
98
+			wp_mail($new_user_email, sprintf(__('[%s] Joining confirmation'), wp_specialchars_decode(get_option('blogname'))), sprintf($message, get_option('blogname'), home_url(), wp_specialchars_decode(translate_user_role($role['name'])), home_url("/newbloguser/$newuser_key/")));
99
+			$redirect = add_query_arg(array('update' => 'add'), 'user-new.php');
100 100
 		}
101 101
 	}
102
-	wp_redirect( $redirect );
102
+	wp_redirect($redirect);
103 103
 	die();
104
-} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) {
105
-	check_admin_referer( 'create-user', '_wpnonce_create-user' );
104
+} elseif (isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action']) {
105
+	check_admin_referer('create-user', '_wpnonce_create-user');
106 106
 
107
-	if ( ! current_user_can( 'create_users' ) ) {
107
+	if ( ! current_user_can('create_users')) {
108 108
 		wp_die(
109
-			'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
110
-			'<p>' . __( 'You are not allowed to create users.' ) . '</p>',
109
+			'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
110
+			'<p>'.__('You are not allowed to create users.').'</p>',
111 111
 			403
112 112
 		);
113 113
 	}
114 114
 
115
-	if ( ! is_multisite() ) {
115
+	if ( ! is_multisite()) {
116 116
 		$user_id = edit_user();
117 117
 
118
-		if ( is_wp_error( $user_id ) ) {
118
+		if (is_wp_error($user_id)) {
119 119
 			$add_user_errors = $user_id;
120 120
 		} else {
121
-			if ( current_user_can( 'list_users' ) )
122
-				$redirect = 'users.php?update=add&id=' . $user_id;
121
+			if (current_user_can('list_users'))
122
+				$redirect = 'users.php?update=add&id='.$user_id;
123 123
 			else
124
-				$redirect = add_query_arg( 'update', 'add', 'user-new.php' );
125
-			wp_redirect( $redirect );
124
+				$redirect = add_query_arg('update', 'add', 'user-new.php');
125
+			wp_redirect($redirect);
126 126
 			die();
127 127
 		}
128 128
 	} else {
129 129
 		// Adding a new user to this site
130
-		$new_user_email = wp_unslash( $_REQUEST['email'] );
131
-		$user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email );
132
-		if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) {
133
-			$add_user_errors = $user_details[ 'errors' ];
130
+		$new_user_email = wp_unslash($_REQUEST['email']);
131
+		$user_details = wpmu_validate_user_signup($_REQUEST['user_login'], $new_user_email);
132
+		if (is_wp_error($user_details['errors']) && ! empty($user_details['errors']->errors)) {
133
+			$add_user_errors = $user_details['errors'];
134 134
 		} else {
135 135
 			/**
136 136
 			 * Filter the user_login, also known as the username, before it is added to the site.
@@ -139,24 +139,24 @@  discard block
 block discarded – undo
139 139
 			 *
140 140
 			 * @param string $user_login The sanitized username.
141 141
 			 */
142
-			$new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) );
143
-			if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
144
-				add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email
145
-				add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email
142
+			$new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true));
143
+			if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) {
144
+				add_filter('wpmu_signup_user_notification', '__return_false'); // Disable confirmation email
145
+				add_filter('wpmu_welcome_user_notification', '__return_false'); // Disable welcome email
146 146
 			}
147
-			wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'] ) );
148
-			if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) {
149
-				$key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) );
150
-				$new_user = wpmu_activate_signup( $key );
151
-				if ( ! is_wp_error( $new_user ) ) {
152
-					$redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' );
147
+			wpmu_signup_user($new_user_login, $new_user_email, array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role']));
148
+			if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) {
149
+				$key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email));
150
+				$new_user = wpmu_activate_signup($key);
151
+				if ( ! is_wp_error($new_user)) {
152
+					$redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php');
153 153
 				} else {
154
-					$redirect = add_query_arg( array( 'update' => 'addnoconfirmation', 'user_id' => $new_user['user_id'] ), 'user-new.php' );
154
+					$redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $new_user['user_id']), 'user-new.php');
155 155
 				}
156 156
 			} else {
157
-				$redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' );
157
+				$redirect = add_query_arg(array('update' => 'newuserconfirmation'), 'user-new.php');
158 158
 			}
159
-			wp_redirect( $redirect );
159
+			wp_redirect($redirect);
160 160
 			die();
161 161
 		}
162 162
 	}
@@ -166,48 +166,48 @@  discard block
 block discarded – undo
166 166
 $parent_file = 'users.php';
167 167
 
168 168
 $do_both = false;
169
-if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') )
169
+if (is_multisite() && current_user_can('promote_users') && current_user_can('create_users'))
170 170
 	$do_both = true;
171 171
 
172
-$help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>';
172
+$help = '<p>'.__('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.').'</p>';
173 173
 
174
-if ( is_multisite() ) {
175
-	$help .= '<p>' . __('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.') . '</p>' .
176
-	'<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.') . '</p>';
174
+if (is_multisite()) {
175
+	$help .= '<p>'.__('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user&#8217;s name to Edit the user profile under Network Admin > All Users.').'</p>'.
176
+	'<p>'.__('New users will receive an email letting them know they&#8217;ve been added as a user for your site. This email will also contain their password. Check the box if you don&#8217;t want the user to receive a welcome email.').'</p>';
177 177
 } else {
178
-	$help .= '<p>' . __('You must assign a password to the new user, which they can change after logging in. The username, however, cannot be changed.') . '</p>' .
179
-	'<p>' . __('New users will receive an email letting them know they&#8217;ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don&#8217;t want the password to be included in the welcome email.') . '</p>';
178
+	$help .= '<p>'.__('You must assign a password to the new user, which they can change after logging in. The username, however, cannot be changed.').'</p>'.
179
+	'<p>'.__('New users will receive an email letting them know they&#8217;ve been added as a user for your site. By default, this email will also contain their password. Uncheck the box if you don&#8217;t want the password to be included in the welcome email.').'</p>';
180 180
 }
181 181
 
182
-$help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>';
182
+$help .= '<p>'.__('Remember to click the Add New User button at the bottom of this screen when you are finished.').'</p>';
183 183
 
184
-get_current_screen()->add_help_tab( array(
184
+get_current_screen()->add_help_tab(array(
185 185
 	'id'      => 'overview',
186 186
 	'title'   => __('Overview'),
187 187
 	'content' => $help,
188
-) );
188
+));
189 189
 
190
-get_current_screen()->add_help_tab( array(
190
+get_current_screen()->add_help_tab(array(
191 191
 'id'      => 'user-roles',
192 192
 'title'   => __('User Roles'),
193
-'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' .
194
-				'<ul>' .
195
-				'<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' .
196
-				'<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' .
197
-				'<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' .
198
-				'<li>' . __('Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.') . '</li>' .
199
-				'<li>' . __('Administrators have access to all the administration features.') . '</li>' .
193
+'content' => '<p>'.__('Here is a basic overview of the different user roles and the permissions associated with each one:').'</p>'.
194
+				'<ul>'.
195
+				'<li>'.__('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.').'</li>'.
196
+				'<li>'.__('Contributors can write and manage their posts but not publish posts or upload media files.').'</li>'.
197
+				'<li>'.__('Authors can publish and manage their own posts, and are able to upload files.').'</li>'.
198
+				'<li>'.__('Editors can publish posts, manage posts as well as manage other people&#8217;s posts, etc.').'</li>'.
199
+				'<li>'.__('Administrators have access to all the administration features.').'</li>'.
200 200
 				'</ul>'
201
-) );
201
+));
202 202
 
203 203
 get_current_screen()->set_help_sidebar(
204
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
205
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>') . '</p>' .
206
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
204
+    '<p><strong>'.__('For more information:').'</strong></p>'.
205
+    '<p>'.__('<a href="https://codex.wordpress.org/Users_Add_New_Screen" target="_blank">Documentation on Adding New Users</a>').'</p>'.
206
+    '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
207 207
 );
208 208
 
209 209
 wp_enqueue_script('wp-ajax-response');
210
-wp_enqueue_script( 'user-profile' );
210
+wp_enqueue_script('user-profile');
211 211
 
212 212
 /**
213 213
  * Filter whether to enable user auto-complete for non-super admins in Multisite.
@@ -216,26 +216,26 @@  discard block
 block discarded – undo
216 216
  *
217 217
  * @param bool $enable Whether to enable auto-complete for non-super admins. Default false.
218 218
  */
219
-if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' )
220
-	&& ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) )
219
+if (is_multisite() && current_user_can('promote_users') && ! wp_is_large_network('users')
220
+	&& (is_super_admin() || apply_filters('autocomplete_users_for_site_admins', false))
221 221
 ) {
222
-	wp_enqueue_script( 'user-suggest' );
222
+	wp_enqueue_script('user-suggest');
223 223
 }
224 224
 
225
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
225
+require_once(ABSPATH.'wp-admin/admin-header.php');
226 226
 
227
-if ( isset($_GET['update']) ) {
227
+if (isset($_GET['update'])) {
228 228
 	$messages = array();
229
-	if ( is_multisite() ) {
229
+	if (is_multisite()) {
230 230
 		$edit_link = '';
231
-		if ( ( isset( $_GET['user_id'] ) ) ) {
232
-			$user_id_new = absint( $_GET['user_id'] );
233
-			if ( $user_id_new ) {
234
-				$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) );
231
+		if ((isset($_GET['user_id']))) {
232
+			$user_id_new = absint($_GET['user_id']);
233
+			if ($user_id_new) {
234
+				$edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new)));
235 235
 			}
236 236
 		}
237 237
 
238
-		switch ( $_GET['update'] ) {
238
+		switch ($_GET['update']) {
239 239
 			case "newuserconfirmation":
240 240
 				$messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.');
241 241
 				break;
@@ -243,11 +243,11 @@  discard block
 block discarded – undo
243 243
 				$messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.');
244 244
 				break;
245 245
 			case "addnoconfirmation":
246
-				if ( empty( $edit_link ) ) {
247
-					$messages[] = __( 'User has been added to your site.' );
246
+				if (empty($edit_link)) {
247
+					$messages[] = __('User has been added to your site.');
248 248
 				} else {
249 249
 					/* translators: %s: edit page url */
250
-					$messages[] = sprintf( __( 'User has been added to your site. <a href="%s">Edit user</a>' ), $edit_link );
250
+					$messages[] = sprintf(__('User has been added to your site. <a href="%s">Edit user</a>'), $edit_link);
251 251
 				}
252 252
 				break;
253 253
 			case "addexisting":
@@ -261,40 +261,40 @@  discard block
 block discarded – undo
261 261
 				break;
262 262
 		}
263 263
 	} else {
264
-		if ( 'add' == $_GET['update'] )
264
+		if ('add' == $_GET['update'])
265 265
 			$messages[] = __('User added.');
266 266
 	}
267 267
 }
268 268
 ?>
269 269
 <div class="wrap">
270 270
 <h1 id="add-new-user"><?php
271
-if ( current_user_can( 'create_users' ) ) {
272
-	echo _x( 'Add New User', 'user' );
273
-} elseif ( current_user_can( 'promote_users' ) ) {
274
-	echo _x( 'Add Existing User', 'user' );
271
+if (current_user_can('create_users')) {
272
+	echo _x('Add New User', 'user');
273
+} elseif (current_user_can('promote_users')) {
274
+	echo _x('Add Existing User', 'user');
275 275
 } ?>
276 276
 </h1>
277 277
 
278
-<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
278
+<?php if (isset($errors) && is_wp_error($errors)) : ?>
279 279
 	<div class="error">
280 280
 		<ul>
281 281
 		<?php
282
-			foreach ( $errors->get_error_messages() as $err )
282
+			foreach ($errors->get_error_messages() as $err)
283 283
 				echo "<li>$err</li>\n";
284 284
 		?>
285 285
 		</ul>
286 286
 	</div>
287 287
 <?php endif;
288 288
 
289
-if ( ! empty( $messages ) ) {
290
-	foreach ( $messages as $msg )
291
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
289
+if ( ! empty($messages)) {
290
+	foreach ($messages as $msg)
291
+		echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>';
292 292
 } ?>
293 293
 
294
-<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
294
+<?php if (isset($add_user_errors) && is_wp_error($add_user_errors)) : ?>
295 295
 	<div class="error">
296 296
 		<?php
297
-			foreach ( $add_user_errors->get_error_messages() as $message )
297
+			foreach ($add_user_errors->get_error_messages() as $message)
298 298
 				echo "<p>$message</p>";
299 299
 		?>
300 300
 	</div>
@@ -302,15 +302,15 @@  discard block
 block discarded – undo
302 302
 <div id="ajax-response"></div>
303 303
 
304 304
 <?php
305
-if ( is_multisite() ) {
306
-	if ( $do_both )
307
-		echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>';
308
-	if ( !is_super_admin() ) {
309
-		echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>';
305
+if (is_multisite()) {
306
+	if ($do_both)
307
+		echo '<h2 id="add-existing-user">'.__('Add Existing User').'</h2>';
308
+	if ( ! is_super_admin()) {
309
+		echo '<p>'.__('Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>';
310 310
 		$label = __('Email');
311 311
 		$type  = 'email';
312 312
 	} else {
313
-		echo '<p>' . __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>';
313
+		echo '<p>'.__('Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>';
314 314
 		$label = __('Email or Username');
315 315
 		$type  = 'text';
316 316
 	}
@@ -321,10 +321,10 @@  discard block
 block discarded – undo
321 321
 	 *
322 322
 	 * @since 3.0.0
323 323
 	 */
324
-	do_action( 'user_new_form_tag' );
324
+	do_action('user_new_form_tag');
325 325
 ?>>
326 326
 <input name="action" type="hidden" value="adduser" />
327
-<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?>
327
+<?php wp_nonce_field('add-user', '_wpnonce_add-user') ?>
328 328
 
329 329
 <table class="form-table">
330 330
 	<tr class="form-field form-required">
@@ -334,14 +334,14 @@  discard block
 block discarded – undo
334 334
 	<tr class="form-field">
335 335
 		<th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th>
336 336
 		<td><select name="role" id="adduser-role">
337
-			<?php wp_dropdown_roles( get_option('default_role') ); ?>
337
+			<?php wp_dropdown_roles(get_option('default_role')); ?>
338 338
 			</select>
339 339
 		</td>
340 340
 	</tr>
341
-<?php if ( current_user_can( 'manage_network_users' ) ) { ?>
341
+<?php if (current_user_can('manage_network_users')) { ?>
342 342
 	<tr>
343 343
 		<th scope="row"><label for="adduser-noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
344
-		<td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
344
+		<td><label for="adduser-noconfirmation"><input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> <?php _e('Add the user without sending an email that requires their confirmation.'); ?></label></td>
345 345
 	</tr>
346 346
 <?php } ?>
347 347
 </table>
@@ -357,48 +357,48 @@  discard block
 block discarded – undo
357 357
  *
358 358
  * @param string $type A contextual string specifying which type of new user form the hook follows.
359 359
  */
360
-do_action( 'user_new_form', 'add-existing-user' );
360
+do_action('user_new_form', 'add-existing-user');
361 361
 ?>
362
-<?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?>
362
+<?php submit_button(__('Add Existing User'), 'primary', 'adduser', true, array('id' => 'addusersub')); ?>
363 363
 </form>
364 364
 <?php
365 365
 } // is_multisite()
366 366
 
367
-if ( current_user_can( 'create_users') ) {
368
-	if ( $do_both )
369
-		echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>';
367
+if (current_user_can('create_users')) {
368
+	if ($do_both)
369
+		echo '<h2 id="create-new-user">'.__('Add New User').'</h2>';
370 370
 ?>
371 371
 <p><?php _e('Create a brand new user and add them to this site.'); ?></p>
372 372
 <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php
373 373
 	/** This action is documented in wp-admin/user-new.php */
374
-	do_action( 'user_new_form_tag' );
374
+	do_action('user_new_form_tag');
375 375
 ?>>
376 376
 <input name="action" type="hidden" value="createuser" />
377
-<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?>
377
+<?php wp_nonce_field('create-user', '_wpnonce_create-user'); ?>
378 378
 <?php
379 379
 // Load up the passed data, else set to a default.
380
-$creating = isset( $_POST['createuser'] );
380
+$creating = isset($_POST['createuser']);
381 381
 
382
-$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : '';
383
-$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : '';
384
-$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : '';
385
-$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : '';
386
-$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : '';
387
-$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : '';
388
-$new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true;
389
-$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : '';
382
+$new_user_login = $creating && isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : '';
383
+$new_user_firstname = $creating && isset($_POST['first_name']) ? wp_unslash($_POST['first_name']) : '';
384
+$new_user_lastname = $creating && isset($_POST['last_name']) ? wp_unslash($_POST['last_name']) : '';
385
+$new_user_email = $creating && isset($_POST['email']) ? wp_unslash($_POST['email']) : '';
386
+$new_user_uri = $creating && isset($_POST['url']) ? wp_unslash($_POST['url']) : '';
387
+$new_user_role = $creating && isset($_POST['role']) ? wp_unslash($_POST['role']) : '';
388
+$new_user_send_notification = $creating && ! isset($_POST['send_user_notification']) ? false : true;
389
+$new_user_ignore_pass = $creating && isset($_POST['noconfirmation']) ? wp_unslash($_POST['noconfirmation']) : '';
390 390
 
391 391
 ?>
392 392
 <table class="form-table">
393 393
 	<tr class="form-field form-required">
394 394
 		<th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
395
-		<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td>
395
+		<td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td>
396 396
 	</tr>
397 397
 	<tr class="form-field form-required">
398 398
 		<th scope="row"><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
399
-		<td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td>
399
+		<td><input name="email" type="email" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td>
400 400
 	</tr>
401
-<?php if ( !is_multisite() ) { ?>
401
+<?php if ( ! is_multisite()) { ?>
402 402
 	<tr class="form-field">
403 403
 		<th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th>
404 404
 		<td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td>
@@ -409,82 +409,82 @@  discard block
 block discarded – undo
409 409
 	</tr>
410 410
 	<tr class="form-field">
411 411
 		<th scope="row"><label for="url"><?php _e('Website') ?></label></th>
412
-		<td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td>
412
+		<td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td>
413 413
 	</tr>
414 414
 	<tr class="form-field form-required user-pass1-wrap">
415 415
 		<th scope="row">
416 416
 			<label for="pass1">
417
-				<?php _e( 'Password' ); ?>
418
-				<span class="description hide-if-js"><?php _e( '(required)' ); ?></span>
417
+				<?php _e('Password'); ?>
418
+				<span class="description hide-if-js"><?php _e('(required)'); ?></span>
419 419
 			</label>
420 420
 		</th>
421 421
 		<td>
422 422
 			<input class="hidden" value=" " /><!-- #24364 workaround -->
423
-			<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button>
423
+			<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e('Show password'); ?></button>
424 424
 			<div class="wp-pwd hide-if-js">
425
-				<?php $initial_password = wp_generate_password( 24 ); ?>
425
+				<?php $initial_password = wp_generate_password(24); ?>
426 426
 				<span class="password-input-wrapper">
427
-					<input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" />
427
+					<input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr($initial_password); ?>" aria-describedby="pass-strength-result" />
428 428
 				</span>
429
-				<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>">
429
+				<button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Hide password'); ?>">
430 430
 					<span class="dashicons dashicons-hidden"></span>
431
-					<span class="text"><?php _e( 'Hide' ); ?></span>
431
+					<span class="text"><?php _e('Hide'); ?></span>
432 432
 				</button>
433
-				<button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>">
434
-					<span class="text"><?php _e( 'Cancel' ); ?></span>
433
+				<button type="button" class="button button-secondary wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Cancel password change'); ?>">
434
+					<span class="text"><?php _e('Cancel'); ?></span>
435 435
 				</button>
436 436
 				<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
437 437
 			</div>
438 438
 		</td>
439 439
 	</tr>
440 440
 	<tr class="form-field form-required user-pass2-wrap hide-if-js">
441
-		<th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th>
441
+		<th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
442 442
 		<td>
443 443
 		<input name="pass2" type="password" id="pass2" autocomplete="off" />
444 444
 		</td>
445 445
 	</tr>
446 446
 	<tr class="pw-weak">
447
-		<th><?php _e( 'Confirm Password' ); ?></th>
447
+		<th><?php _e('Confirm Password'); ?></th>
448 448
 		<td>
449 449
 			<label>
450 450
 				<input type="checkbox" name="pw_weak" class="pw-checkbox" />
451
-				<?php _e( 'Confirm use of weak password' ); ?>
451
+				<?php _e('Confirm use of weak password'); ?>
452 452
 			</label>
453 453
 		</td>
454 454
 	</tr>
455 455
 	<tr>
456
-		<th scope="row"><?php _e( 'Send User Notification' ) ?></th>
457
-		<td><label for="send_user_notification"><input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> /> <?php _e( 'Send the new user an email about their account.' ); ?></label></td>
456
+		<th scope="row"><?php _e('Send User Notification') ?></th>
457
+		<td><label for="send_user_notification"><input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked($new_user_send_notification); ?> /> <?php _e('Send the new user an email about their account.'); ?></label></td>
458 458
 	</tr>
459 459
 <?php } // !is_multisite ?>
460 460
 	<tr class="form-field">
461 461
 		<th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
462 462
 		<td><select name="role" id="role">
463 463
 			<?php
464
-			if ( !$new_user_role )
465
-				$new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
464
+			if ( ! $new_user_role)
465
+				$new_user_role = ! empty($current_role) ? $current_role : get_option('default_role');
466 466
 			wp_dropdown_roles($new_user_role);
467 467
 			?>
468 468
 			</select>
469 469
 		</td>
470 470
 	</tr>
471
-	<?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?>
471
+	<?php if (is_multisite() && current_user_can('manage_network_users')) { ?>
472 472
 	<tr>
473 473
 		<th scope="row"><label for="noconfirmation"><?php _e('Skip Confirmation Email') ?></label></th>
474
-		<td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> <?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label></td>
474
+		<td><label for="noconfirmation"><input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked($new_user_ignore_pass); ?> /> <?php _e('Add the user without sending an email that requires their confirmation.'); ?></label></td>
475 475
 	</tr>
476 476
 	<?php } ?>
477 477
 </table>
478 478
 
479 479
 <?php
480 480
 /** This action is documented in wp-admin/user-new.php */
481
-do_action( 'user_new_form', 'add-new-user' );
481
+do_action('user_new_form', 'add-new-user');
482 482
 ?>
483 483
 
484
-<?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?>
484
+<?php submit_button(__('Add New User'), 'primary', 'createuser', true, array('id' => 'createusersub')); ?>
485 485
 
486 486
 </form>
487 487
 <?php } // current_user_can('create_users') ?>
488 488
 </div>
489 489
 <?php
490
-include( ABSPATH . 'wp-admin/admin-footer.php' );
490
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +30 added lines, -21 removed lines patch added patch discarded remove patch
@@ -118,10 +118,11 @@  discard block
 block discarded – undo
118 118
 		if ( is_wp_error( $user_id ) ) {
119 119
 			$add_user_errors = $user_id;
120 120
 		} else {
121
-			if ( current_user_can( 'list_users' ) )
122
-				$redirect = 'users.php?update=add&id=' . $user_id;
123
-			else
124
-				$redirect = add_query_arg( 'update', 'add', 'user-new.php' );
121
+			if ( current_user_can( 'list_users' ) ) {
122
+							$redirect = 'users.php?update=add&id=' . $user_id;
123
+			} else {
124
+							$redirect = add_query_arg( 'update', 'add', 'user-new.php' );
125
+			}
125 126
 			wp_redirect( $redirect );
126 127
 			die();
127 128
 		}
@@ -166,8 +167,9 @@  discard block
 block discarded – undo
166 167
 $parent_file = 'users.php';
167 168
 
168 169
 $do_both = false;
169
-if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') )
170
+if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) {
170 171
 	$do_both = true;
172
+}
171 173
 
172 174
 $help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>';
173 175
 
@@ -261,8 +263,9 @@  discard block
 block discarded – undo
261 263
 				break;
262 264
 		}
263 265
 	} else {
264
-		if ( 'add' == $_GET['update'] )
265
-			$messages[] = __('User added.');
266
+		if ( 'add' == $_GET['update'] ) {
267
+					$messages[] = __('User added.');
268
+		}
266 269
 	}
267 270
 }
268 271
 ?>
@@ -279,23 +282,26 @@  discard block
 block discarded – undo
279 282
 	<div class="error">
280 283
 		<ul>
281 284
 		<?php
282
-			foreach ( $errors->get_error_messages() as $err )
283
-				echo "<li>$err</li>\n";
285
+			foreach ( $errors->get_error_messages() as $err ) {
286
+							echo "<li>$err</li>\n";
287
+			}
284 288
 		?>
285 289
 		</ul>
286 290
 	</div>
287 291
 <?php endif;
288 292
 
289 293
 if ( ! empty( $messages ) ) {
290
-	foreach ( $messages as $msg )
291
-		echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
292
-} ?>
294
+	foreach ( $messages as $msg ) {
295
+			echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>';
296
+	}
297
+	} ?>
293 298
 
294 299
 <?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?>
295 300
 	<div class="error">
296 301
 		<?php
297
-			foreach ( $add_user_errors->get_error_messages() as $message )
298
-				echo "<p>$message</p>";
302
+			foreach ( $add_user_errors->get_error_messages() as $message ) {
303
+							echo "<p>$message</p>";
304
+			}
299 305
 		?>
300 306
 	</div>
301 307
 <?php endif; ?>
@@ -303,8 +309,9 @@  discard block
 block discarded – undo
303 309
 
304 310
 <?php
305 311
 if ( is_multisite() ) {
306
-	if ( $do_both )
307
-		echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>';
312
+	if ( $do_both ) {
313
+			echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>';
314
+	}
308 315
 	if ( !is_super_admin() ) {
309 316
 		echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>';
310 317
 		$label = __('Email');
@@ -365,9 +372,10 @@  discard block
 block discarded – undo
365 372
 } // is_multisite()
366 373
 
367 374
 if ( current_user_can( 'create_users') ) {
368
-	if ( $do_both )
369
-		echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>';
370
-?>
375
+	if ( $do_both ) {
376
+			echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>';
377
+	}
378
+	?>
371 379
 <p><?php _e('Create a brand new user and add them to this site.'); ?></p>
372 380
 <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php
373 381
 	/** This action is documented in wp-admin/user-new.php */
@@ -461,8 +469,9 @@  discard block
 block discarded – undo
461 469
 		<th scope="row"><label for="role"><?php _e('Role'); ?></label></th>
462 470
 		<td><select name="role" id="role">
463 471
 			<?php
464
-			if ( !$new_user_role )
465
-				$new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
472
+			if ( !$new_user_role ) {
473
+							$new_user_role = !empty($current_role) ? $current_role : get_option('default_role');
474
+			}
466 475
 			wp_dropdown_roles($new_user_role);
467 476
 			?>
468 477
 			</select>
Please login to merge, or discard this patch.
src/wp-admin/users.php 4 patches
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * User administration panel
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- * @since 1.0.0
8
- */
3
+			 * User administration panel
4
+			 *
5
+			 * @package WordPress
6
+			 * @subpackage Administration
7
+			 * @since 1.0.0
8
+			 */
9 9
 
10 10
 /** WordPress Administration Bootstrap */
11 11
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -63,10 +63,10 @@  discard block
 block discarded – undo
63 63
 unset( $help );
64 64
 
65 65
 get_current_screen()->set_help_sidebar(
66
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
67
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
68
-    '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
69
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
66
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
67
+	'<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
68
+	'<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
69
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
70 70
 );
71 71
 
72 72
 get_current_screen()->set_screen_reader_content( array(
Please login to merge, or discard this patch.
Switch Indentation   +273 added lines, -273 removed lines patch added patch discarded remove patch
@@ -90,101 +90,101 @@  discard block
 block discarded – undo
90 90
 switch ( $wp_list_table->current_action() ) {
91 91
 
92 92
 /* Bulk Dropdown menu Role changes */
93
-case 'promote':
94
-	check_admin_referer('bulk-users');
93
+	case 'promote':
94
+		check_admin_referer('bulk-users');
95 95
 
96
-	if ( ! current_user_can( 'promote_users' ) )
97
-		wp_die( __( 'You can&#8217;t edit that user.' ) );
96
+		if ( ! current_user_can( 'promote_users' ) )
97
+			wp_die( __( 'You can&#8217;t edit that user.' ) );
98 98
 
99
-	if ( empty($_REQUEST['users']) ) {
100
-		wp_redirect($redirect);
101
-		exit();
102
-	}
103
-
104
-	$editable_roles = get_editable_roles();
105
-	$role = false;
106
-	if ( ! empty( $_REQUEST['new_role2'] ) ) {
107
-		$role = $_REQUEST['new_role2'];
108
-	} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
109
-		$role = $_REQUEST['new_role'];
110
-	}
111
-
112
-	if ( ! $role || empty( $editable_roles[ $role ] ) ) {
113
-		wp_die( __( 'You can&#8217;t give users that role.' ) );
114
-	}
115
-
116
-	$userids = $_REQUEST['users'];
117
-	$update = 'promote';
118
-	foreach ( $userids as $id ) {
119
-		$id = (int) $id;
120
-
121
-		if ( ! current_user_can('promote_user', $id) )
122
-			wp_die(__('You can&#8217;t edit that user.'));
123
-		// The new role of the current user must also have the promote_users cap or be a multisite super admin
124
-		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125
-			&& ! ( is_multisite() && is_super_admin() ) ) {
126
-				$update = 'err_admin_role';
127
-				continue;
99
+		if ( empty($_REQUEST['users']) ) {
100
+			wp_redirect($redirect);
101
+			exit();
128 102
 		}
129 103
 
130
-		// If the user doesn't already belong to the blog, bail.
131
-		if ( is_multisite() && !is_user_member_of_blog( $id ) ) {
132
-			wp_die(
133
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
134
-				'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
135
-				403
136
-			);
104
+		$editable_roles = get_editable_roles();
105
+		$role = false;
106
+		if ( ! empty( $_REQUEST['new_role2'] ) ) {
107
+			$role = $_REQUEST['new_role2'];
108
+		} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
109
+			$role = $_REQUEST['new_role'];
137 110
 		}
138 111
 
139
-		$user = get_userdata( $id );
140
-		$user->set_role( $role );
141
-	}
112
+		if ( ! $role || empty( $editable_roles[ $role ] ) ) {
113
+			wp_die( __( 'You can&#8217;t give users that role.' ) );
114
+		}
142 115
 
143
-	wp_redirect(add_query_arg('update', $update, $redirect));
144
-	exit();
116
+		$userids = $_REQUEST['users'];
117
+		$update = 'promote';
118
+		foreach ( $userids as $id ) {
119
+			$id = (int) $id;
120
+
121
+			if ( ! current_user_can('promote_user', $id) )
122
+				wp_die(__('You can&#8217;t edit that user.'));
123
+			// The new role of the current user must also have the promote_users cap or be a multisite super admin
124
+			if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125
+				&& ! ( is_multisite() && is_super_admin() ) ) {
126
+					$update = 'err_admin_role';
127
+					continue;
128
+			}
145 129
 
146
-case 'dodelete':
147
-	if ( is_multisite() )
148
-		wp_die( __('User deletion is not allowed from this screen.') );
130
+			// If the user doesn't already belong to the blog, bail.
131
+			if ( is_multisite() && !is_user_member_of_blog( $id ) ) {
132
+				wp_die(
133
+					'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
134
+					'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
135
+					403
136
+				);
137
+			}
149 138
 
150
-	check_admin_referer('delete-users');
139
+			$user = get_userdata( $id );
140
+			$user->set_role( $role );
141
+		}
151 142
 
152
-	if ( empty($_REQUEST['users']) ) {
153
-		wp_redirect($redirect);
143
+		wp_redirect(add_query_arg('update', $update, $redirect));
154 144
 		exit();
155
-	}
156 145
 
157
-	$userids = array_map( 'intval', (array) $_REQUEST['users'] );
146
+	case 'dodelete':
147
+		if ( is_multisite() )
148
+			wp_die( __('User deletion is not allowed from this screen.') );
158 149
 
159
-	if ( empty( $_REQUEST['delete_option'] ) ) {
160
-		$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
161
-		$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
162
-		wp_redirect( $url );
163
-		exit;
164
-	}
165
-
166
-	if ( ! current_user_can( 'delete_users' ) )
167
-		wp_die(__('You can&#8217;t delete users.'));
150
+		check_admin_referer('delete-users');
168 151
 
169
-	$update = 'del';
170
-	$delete_count = 0;
152
+		if ( empty($_REQUEST['users']) ) {
153
+			wp_redirect($redirect);
154
+			exit();
155
+		}
171 156
 
172
-	foreach ( $userids as $id ) {
173
-		if ( ! current_user_can( 'delete_user', $id ) )
174
-			wp_die(__( 'You can&#8217;t delete that user.' ) );
157
+		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
175 158
 
176
-		if ( $id == $current_user->ID ) {
177
-			$update = 'err_admin_del';
178
-			continue;
179
-		}
180
-		switch ( $_REQUEST['delete_option'] ) {
181
-		case 'delete':
182
-			wp_delete_user( $id );
183
-			break;
184
-		case 'reassign':
185
-			wp_delete_user( $id, $_REQUEST['reassign_user'] );
186
-			break;
159
+		if ( empty( $_REQUEST['delete_option'] ) ) {
160
+			$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
161
+			$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
162
+			wp_redirect( $url );
163
+			exit;
187 164
 		}
165
+
166
+		if ( ! current_user_can( 'delete_users' ) )
167
+			wp_die(__('You can&#8217;t delete users.'));
168
+
169
+		$update = 'del';
170
+		$delete_count = 0;
171
+
172
+		foreach ( $userids as $id ) {
173
+			if ( ! current_user_can( 'delete_user', $id ) )
174
+				wp_die(__( 'You can&#8217;t delete that user.' ) );
175
+
176
+			if ( $id == $current_user->ID ) {
177
+				$update = 'err_admin_del';
178
+				continue;
179
+			}
180
+			switch ( $_REQUEST['delete_option'] ) {
181
+				case 'delete':
182
+					wp_delete_user( $id );
183
+					break;
184
+				case 'reassign':
185
+					wp_delete_user( $id, $_REQUEST['reassign_user'] );
186
+					break;
187
+			}
188 188
 		++$delete_count;
189 189
 	}
190 190
 
@@ -192,95 +192,95 @@  discard block
 block discarded – undo
192 192
 	wp_redirect($redirect);
193 193
 	exit();
194 194
 
195
-case 'delete':
196
-	if ( is_multisite() )
197
-		wp_die( __('User deletion is not allowed from this screen.') );
195
+	case 'delete':
196
+		if ( is_multisite() )
197
+			wp_die( __('User deletion is not allowed from this screen.') );
198 198
 
199
-	check_admin_referer('bulk-users');
199
+		check_admin_referer('bulk-users');
200 200
 
201
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
202
-		wp_redirect($redirect);
203
-		exit();
204
-	}
201
+		if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
202
+			wp_redirect($redirect);
203
+			exit();
204
+		}
205 205
 
206
-	if ( ! current_user_can( 'delete_users' ) )
207
-		$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
206
+		if ( ! current_user_can( 'delete_users' ) )
207
+			$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
208 208
 
209
-	if ( empty($_REQUEST['users']) )
210
-		$userids = array( intval( $_REQUEST['user'] ) );
211
-	else
212
-		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
209
+		if ( empty($_REQUEST['users']) )
210
+			$userids = array( intval( $_REQUEST['user'] ) );
211
+		else
212
+			$userids = array_map( 'intval', (array) $_REQUEST['users'] );
213 213
 
214
-	$users_have_content = false;
215
-	if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
216
-		$users_have_content = true;
217
-	} elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
218
-		$users_have_content = true;
219
-	}
214
+		$users_have_content = false;
215
+		if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
216
+			$users_have_content = true;
217
+		} elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
218
+			$users_have_content = true;
219
+		}
220 220
 
221
-	if ( $users_have_content ) {
222
-		add_action( 'admin_head', 'delete_users_add_js' );
223
-	}
221
+		if ( $users_have_content ) {
222
+			add_action( 'admin_head', 'delete_users_add_js' );
223
+		}
224 224
 
225
-	include( ABSPATH . 'wp-admin/admin-header.php' );
226
-?>
227
-<form method="post" name="updateusers" id="updateusers">
228
-<?php wp_nonce_field('delete-users') ?>
229
-<?php echo $referer; ?>
225
+		include( ABSPATH . 'wp-admin/admin-header.php' );
226
+	?>
227
+	<form method="post" name="updateusers" id="updateusers">
228
+	<?php wp_nonce_field('delete-users') ?>
229
+	<?php echo $referer; ?>
230 230
 
231 231
 <div class="wrap">
232 232
 <h1><?php _e( 'Delete Users' ); ?></h1>
233
-<?php if ( isset( $_REQUEST['error'] ) ) : ?>
233
+	<?php if ( isset( $_REQUEST['error'] ) ) : ?>
234 234
 	<div class="error">
235 235
 		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
236 236
 	</div>
237 237
 <?php endif; ?>
238
-
239
-<?php if ( 1 == count( $userids ) ) : ?>
240
-	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
241
-<?php else : ?>
242
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
243
-<?php endif; ?>
238
+	
239
+	<?php if ( 1 == count( $userids ) ) : ?>
240
+		<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
241
+	<?php else : ?>
242
+		<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
243
+	<?php endif; ?>
244 244
 
245 245
 <ul>
246 246
 <?php
247
-	$go_delete = 0;
248
-	foreach ( $userids as $id ) {
249
-		$user = get_userdata( $id );
250
-		if ( $id == $current_user->ID ) {
251
-			/* translators: 1: user id, 2: user login */
252
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
253
-		} else {
254
-			/* translators: 1: user id, 2: user login */
255
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
256
-			$go_delete++;
247
+		$go_delete = 0;
248
+		foreach ( $userids as $id ) {
249
+			$user = get_userdata( $id );
250
+			if ( $id == $current_user->ID ) {
251
+				/* translators: 1: user id, 2: user login */
252
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
253
+			} else {
254
+				/* translators: 1: user id, 2: user login */
255
+				echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
256
+				$go_delete++;
257
+			}
257 258
 		}
258
-	}
259
-	?>
260
-	</ul>
261
-<?php if ( $go_delete ) :
259
+		?>
260
+		</ul>
261
+	<?php if ( $go_delete ) :
262 262
 
263
-	if ( ! $users_have_content ) : ?>
264
-		<input type="hidden" name="delete_option" value="delete" />
263
+		if ( ! $users_have_content ) : ?>
264
+			<input type="hidden" name="delete_option" value="delete" />
265 265
 	<?php else: ?>
266
-		<?php if ( 1 == $go_delete ) : ?>
267
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
266
+			<?php if ( 1 == $go_delete ) : ?>
267
+				<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
268 268
 		<?php else : ?>
269
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
269
+				<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
270 270
 		<?php endif; ?>
271 271
 		<ul style="list-style:none;">
272 272
 			<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
273 273
 			<?php _e('Delete all content.'); ?></label></li>
274 274
 			<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
275 275
 			<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
276
-			wp_dropdown_users( array(
277
-				'name' => 'reassign_user',
278
-				'exclude' => array_diff( $userids, array( $current_user->ID ) ),
279
-				'show' => 'display_name_with_login',
280
-			) ); ?></li>
276
+				wp_dropdown_users( array(
277
+					'name' => 'reassign_user',
278
+					'exclude' => array_diff( $userids, array( $current_user->ID ) ),
279
+					'show' => 'display_name_with_login',
280
+				) ); ?></li>
281 281
 		</ul></fieldset>
282 282
 	<?php endif;
283
-	/**
283
+		/**
284 284
 	 * Fires at the end of the delete users form prior to the confirm button.
285 285
 	 *
286 286
 	 * @since 4.0.0
@@ -289,178 +289,178 @@  discard block
 block discarded – undo
289 289
 	 * @param WP_User $current_user WP_User object for the current user.
290 290
 	 * @param array   $userids      Array of IDs for users being deleted.
291 291
 	 */
292
-	do_action( 'delete_user_form', $current_user, $userids );
293
-	?>
294
-	<input type="hidden" name="action" value="dodelete" />
292
+		do_action( 'delete_user_form', $current_user, $userids );
293
+		?>
294
+		<input type="hidden" name="action" value="dodelete" />
295 295
 	<?php submit_button( __('Confirm Deletion'), 'primary' ); ?>
296
-<?php else : ?>
297
-	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
298
-<?php endif; ?>
296
+	<?php else : ?>
297
+		<p><?php _e('There are no valid users selected for deletion.'); ?></p>
298
+	<?php endif; ?>
299 299
 </div>
300 300
 </form>
301 301
 <?php
302 302
 
303
-break;
303
+	break;
304 304
 
305
-case 'doremove':
306
-	check_admin_referer('remove-users');
305
+	case 'doremove':
306
+		check_admin_referer('remove-users');
307 307
 
308
-	if ( ! is_multisite() )
309
-		wp_die( __( 'You can&#8217;t remove users.' ) );
308
+		if ( ! is_multisite() )
309
+			wp_die( __( 'You can&#8217;t remove users.' ) );
310 310
 
311
-	if ( empty($_REQUEST['users']) ) {
312
-		wp_redirect($redirect);
313
-		exit;
314
-	}
311
+		if ( empty($_REQUEST['users']) ) {
312
+			wp_redirect($redirect);
313
+			exit;
314
+		}
315 315
 
316
-	if ( ! current_user_can( 'remove_users' ) )
317
-		wp_die( __( 'You can&#8217;t remove users.' ) );
316
+		if ( ! current_user_can( 'remove_users' ) )
317
+			wp_die( __( 'You can&#8217;t remove users.' ) );
318 318
 
319
-	$userids = $_REQUEST['users'];
319
+		$userids = $_REQUEST['users'];
320 320
 
321
-	$update = 'remove';
322
- 	foreach ( $userids as $id ) {
323
-		$id = (int) $id;
324
-		if ( $id == $current_user->ID && !is_super_admin() ) {
325
-			$update = 'err_admin_remove';
326
-			continue;
327
-		}
328
-		if ( !current_user_can('remove_user', $id) ) {
329
-			$update = 'err_admin_remove';
330
-			continue;
321
+		$update = 'remove';
322
+ 		foreach ( $userids as $id ) {
323
+			$id = (int) $id;
324
+			if ( $id == $current_user->ID && !is_super_admin() ) {
325
+				$update = 'err_admin_remove';
326
+				continue;
327
+			}
328
+			if ( !current_user_can('remove_user', $id) ) {
329
+				$update = 'err_admin_remove';
330
+				continue;
331
+			}
332
+			remove_user_from_blog($id, $blog_id);
331 333
 		}
332
-		remove_user_from_blog($id, $blog_id);
333
-	}
334 334
 
335
-	$redirect = add_query_arg( array('update' => $update), $redirect);
336
-	wp_redirect($redirect);
337
-	exit;
335
+		$redirect = add_query_arg( array('update' => $update), $redirect);
336
+		wp_redirect($redirect);
337
+		exit;
338 338
 
339
-case 'remove':
339
+	case 'remove':
340 340
 
341
-	check_admin_referer('bulk-users');
341
+		check_admin_referer('bulk-users');
342 342
 
343
-	if ( ! is_multisite() )
344
-		wp_die( __( 'You can&#8217;t remove users.' ) );
343
+		if ( ! is_multisite() )
344
+			wp_die( __( 'You can&#8217;t remove users.' ) );
345 345
 
346
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
347
-		wp_redirect($redirect);
348
-		exit();
349
-	}
346
+		if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
347
+			wp_redirect($redirect);
348
+			exit();
349
+		}
350 350
 
351
-	if ( !current_user_can('remove_users') )
352
-		$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
351
+		if ( !current_user_can('remove_users') )
352
+			$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
353 353
 
354
-	if ( empty($_REQUEST['users']) )
355
-		$userids = array(intval($_REQUEST['user']));
356
-	else
357
-		$userids = $_REQUEST['users'];
354
+		if ( empty($_REQUEST['users']) )
355
+			$userids = array(intval($_REQUEST['user']));
356
+		else
357
+			$userids = $_REQUEST['users'];
358 358
 
359
-	include( ABSPATH . 'wp-admin/admin-header.php' );
360
-?>
361
-<form method="post" name="updateusers" id="updateusers">
362
-<?php wp_nonce_field('remove-users') ?>
363
-<?php echo $referer; ?>
359
+		include( ABSPATH . 'wp-admin/admin-header.php' );
360
+	?>
361
+	<form method="post" name="updateusers" id="updateusers">
362
+	<?php wp_nonce_field('remove-users') ?>
363
+	<?php echo $referer; ?>
364 364
 
365 365
 <div class="wrap">
366 366
 <h1><?php _e( 'Remove Users from Site' ); ?></h1>
367 367
 
368
-<?php if ( 1 == count( $userids ) ) : ?>
369
-	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
370
-<?php else : ?>
371
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
372
-<?php endif; ?>
368
+	<?php if ( 1 == count( $userids ) ) : ?>
369
+		<p><?php _e( 'You have specified this user for removal:' ); ?></p>
370
+	<?php else : ?>
371
+		<p><?php _e( 'You have specified these users for removal:' ); ?></p>
372
+	<?php endif; ?>
373 373
 
374 374
 <ul>
375 375
 <?php
376
-	$go_remove = false;
377
- 	foreach ( $userids as $id ) {
378
-		$id = (int) $id;
379
- 		$user = get_userdata( $id );
380
-		if ( $id == $current_user->ID && !is_super_admin() ) {
381
-			/* translators: 1: user id, 2: user login */
382
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
383
-		} elseif ( !current_user_can('remove_user', $id) ) {
384
-			/* translators: 1: user id, 2: user login */
385
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
386
-		} else {
387
-			/* translators: 1: user id, 2: user login */
388
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
389
-			$go_remove = true;
390
-		}
391
- 	}
392
- 	?>
393
-</ul>
394
-<?php if ( $go_remove ) : ?>
395
-		<input type="hidden" name="action" value="doremove" />
376
+		$go_remove = false;
377
+ 		foreach ( $userids as $id ) {
378
+			$id = (int) $id;
379
+ 			$user = get_userdata( $id );
380
+			if ( $id == $current_user->ID && !is_super_admin() ) {
381
+				/* translators: 1: user id, 2: user login */
382
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
383
+			} elseif ( !current_user_can('remove_user', $id) ) {
384
+				/* translators: 1: user id, 2: user login */
385
+				echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
386
+			} else {
387
+				/* translators: 1: user id, 2: user login */
388
+				echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
389
+				$go_remove = true;
390
+			}
391
+ 		}
392
+ 		?>
393
+	</ul>
394
+	<?php if ( $go_remove ) : ?>
395
+			<input type="hidden" name="action" value="doremove" />
396 396
 		<?php submit_button( __('Confirm Removal'), 'primary' ); ?>
397
-<?php else : ?>
398
-	<p><?php _e('There are no valid users selected for removal.'); ?></p>
399
-<?php endif; ?>
397
+	<?php else : ?>
398
+		<p><?php _e('There are no valid users selected for removal.'); ?></p>
399
+	<?php endif; ?>
400 400
 </div>
401 401
 </form>
402 402
 <?php
403 403
 
404
-break;
404
+	break;
405 405
 
406
-default:
406
+	default:
407 407
 
408
-	if ( !empty($_GET['_wp_http_referer']) ) {
409
-		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
410
-		exit;
411
-	}
412
-
413
-	$wp_list_table->prepare_items();
414
-	$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
415
-	if ( $pagenum > $total_pages && $total_pages > 0 ) {
416
-		wp_redirect( add_query_arg( 'paged', $total_pages ) );
417
-		exit;
418
-	}
408
+		if ( !empty($_GET['_wp_http_referer']) ) {
409
+			wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
410
+			exit;
411
+		}
419 412
 
420
-	include( ABSPATH . 'wp-admin/admin-header.php' );
413
+		$wp_list_table->prepare_items();
414
+		$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
415
+		if ( $pagenum > $total_pages && $total_pages > 0 ) {
416
+			wp_redirect( add_query_arg( 'paged', $total_pages ) );
417
+			exit;
418
+		}
421 419
 
422
-	$messages = array();
423
-	if ( isset($_GET['update']) ) :
424
-		switch($_GET['update']) {
425
-		case 'del':
426
-		case 'del_many':
427
-			$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
428
-			if ( 1 == $delete_count ) {
429
-				$message = __( 'User deleted.' );
430
-			} else {
431
-				$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
420
+		include( ABSPATH . 'wp-admin/admin-header.php' );
421
+
422
+		$messages = array();
423
+		if ( isset($_GET['update']) ) :
424
+			switch($_GET['update']) {
425
+				case 'del':
426
+				case 'del_many':
427
+					$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
428
+					if ( 1 == $delete_count ) {
429
+						$message = __( 'User deleted.' );
430
+					} else {
431
+						$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
432
+					}
433
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
434
+					break;
435
+				case 'add':
436
+					if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
437
+						/* translators: %s: edit page url */
438
+						$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
439
+							esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
440
+								self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
441
+					} else {
442
+						$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
443
+					}
444
+					break;
445
+				case 'promote':
446
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
447
+					break;
448
+				case 'err_admin_role':
449
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
450
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
451
+					break;
452
+				case 'err_admin_del':
453
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
454
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
455
+					break;
456
+				case 'remove':
457
+					$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
458
+					break;
459
+				case 'err_admin_remove':
460
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
461
+					$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
462
+					break;
432 463
 			}
433
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
434
-			break;
435
-		case 'add':
436
-			if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
437
-				/* translators: %s: edit page url */
438
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
439
-					esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
440
-						self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
441
-			} else {
442
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
443
-			}
444
-			break;
445
-		case 'promote':
446
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
447
-			break;
448
-		case 'err_admin_role':
449
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
450
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
451
-			break;
452
-		case 'err_admin_del':
453
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
454
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
455
-			break;
456
-		case 'remove':
457
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
458
-			break;
459
-		case 'err_admin_remove':
460
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
461
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
462
-			break;
463
-		}
464 464
 	endif; ?>
465 465
 
466 466
 <?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
Please login to merge, or discard this patch.
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-if ( ! current_user_can( 'list_users' ) ) {
13
+if ( ! current_user_can('list_users')) {
14 14
 	wp_die(
15
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
16
-		'<p>' . __( 'You are not allowed to browse users.' ) . '</p>',
15
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
16
+		'<p>'.__('You are not allowed to browse users.').'</p>',
17 17
 		403
18 18
 	);
19 19
 }
@@ -23,63 +23,63 @@  discard block
 block discarded – undo
23 23
 $title = __('Users');
24 24
 $parent_file = 'users.php';
25 25
 
26
-add_screen_option( 'per_page' );
26
+add_screen_option('per_page');
27 27
 
28 28
 // contextual help - choose Help on the top right of admin panel to preview this.
29
-get_current_screen()->add_help_tab( array(
29
+get_current_screen()->add_help_tab(array(
30 30
 	'id'      => 'overview',
31 31
 	'title'   => __('Overview'),
32
-	'content' => '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' .
33
-				 '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>'
34
-) ) ;
32
+	'content' => '<p>'.__('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.').'</p>'.
33
+				 '<p>'.__('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.').'</p>'
34
+));
35 35
 
36
-get_current_screen()->add_help_tab( array(
36
+get_current_screen()->add_help_tab(array(
37 37
 	'id'      => 'screen-display',
38 38
 	'title'   => __('Screen Display'),
39
-	'content' => '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' .
40
-					'<ul>' .
41
-					'<li>' . __('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.') . '</li>' .
42
-					'<li>' . __('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.') . '</li>' .
43
-					'<li>' . __('You can view all posts made by a user by clicking on the number under the Posts column.') . '</li>' .
39
+	'content' => '<p>'.__('You can customize the display of this screen in a number of ways:').'</p>'.
40
+					'<ul>'.
41
+					'<li>'.__('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.').'</li>'.
42
+					'<li>'.__('You can filter the list of users by User Role using the text links in the upper left to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.').'</li>'.
43
+					'<li>'.__('You can view all posts made by a user by clicking on the number under the Posts column.').'</li>'.
44 44
 					'</ul>'
45
-) );
45
+));
46 46
 
47
-$help = '<p>' . __('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:') . '</p>' .
48
-	'<ul>' .
49
-	'<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
47
+$help = '<p>'.__('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:').'</p>'.
48
+	'<ul>'.
49
+	'<li>'.__('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.').'</li>';
50 50
 
51
-if ( is_multisite() )
52
-	$help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
51
+if (is_multisite())
52
+	$help .= '<li>'.__('Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.').'</li>';
53 53
 else
54
-	$help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
54
+	$help .= '<li>'.__('Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.').'</li>';
55 55
 
56 56
 $help .= '</ul>';
57 57
 
58
-get_current_screen()->add_help_tab( array(
58
+get_current_screen()->add_help_tab(array(
59 59
 	'id'      => 'actions',
60 60
 	'title'   => __('Actions'),
61 61
 	'content' => $help,
62
-) );
63
-unset( $help );
62
+));
63
+unset($help);
64 64
 
65 65
 get_current_screen()->set_help_sidebar(
66
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
67
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
68
-    '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
69
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
66
+    '<p><strong>'.__('For more information:').'</strong></p>'.
67
+    '<p>'.__('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>').'</p>'.
68
+    '<p>'.__('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>').'</p>'.
69
+    '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
70 70
 );
71 71
 
72
-get_current_screen()->set_screen_reader_content( array(
73
-	'heading_views'      => __( 'Filter users list' ),
74
-	'heading_pagination' => __( 'Users list navigation' ),
75
-	'heading_list'       => __( 'Users list' ),
76
-) );
77
-
78
-if ( empty($_REQUEST) ) {
79
-	$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
80
-} elseif ( isset($_REQUEST['wp_http_referer']) ) {
81
-	$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) );
82
-	$referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
72
+get_current_screen()->set_screen_reader_content(array(
73
+	'heading_views'      => __('Filter users list'),
74
+	'heading_pagination' => __('Users list navigation'),
75
+	'heading_list'       => __('Users list'),
76
+));
77
+
78
+if (empty($_REQUEST)) {
79
+	$referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />';
80
+} elseif (isset($_REQUEST['wp_http_referer'])) {
81
+	$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash($_REQUEST['wp_http_referer']));
82
+	$referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr($redirect).'" />';
83 83
 } else {
84 84
 	$redirect = 'users.php';
85 85
 	$referer = '';
@@ -87,197 +87,197 @@  discard block
 block discarded – undo
87 87
 
88 88
 $update = '';
89 89
 
90
-switch ( $wp_list_table->current_action() ) {
90
+switch ($wp_list_table->current_action()) {
91 91
 
92 92
 /* Bulk Dropdown menu Role changes */
93 93
 case 'promote':
94 94
 	check_admin_referer('bulk-users');
95 95
 
96
-	if ( ! current_user_can( 'promote_users' ) )
97
-		wp_die( __( 'You can&#8217;t edit that user.' ) );
96
+	if ( ! current_user_can('promote_users'))
97
+		wp_die(__('You can&#8217;t edit that user.'));
98 98
 
99
-	if ( empty($_REQUEST['users']) ) {
99
+	if (empty($_REQUEST['users'])) {
100 100
 		wp_redirect($redirect);
101 101
 		exit();
102 102
 	}
103 103
 
104 104
 	$editable_roles = get_editable_roles();
105 105
 	$role = false;
106
-	if ( ! empty( $_REQUEST['new_role2'] ) ) {
106
+	if ( ! empty($_REQUEST['new_role2'])) {
107 107
 		$role = $_REQUEST['new_role2'];
108
-	} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
108
+	} elseif ( ! empty($_REQUEST['new_role'])) {
109 109
 		$role = $_REQUEST['new_role'];
110 110
 	}
111 111
 
112
-	if ( ! $role || empty( $editable_roles[ $role ] ) ) {
113
-		wp_die( __( 'You can&#8217;t give users that role.' ) );
112
+	if ( ! $role || empty($editable_roles[$role])) {
113
+		wp_die(__('You can&#8217;t give users that role.'));
114 114
 	}
115 115
 
116 116
 	$userids = $_REQUEST['users'];
117 117
 	$update = 'promote';
118
-	foreach ( $userids as $id ) {
118
+	foreach ($userids as $id) {
119 119
 		$id = (int) $id;
120 120
 
121
-		if ( ! current_user_can('promote_user', $id) )
121
+		if ( ! current_user_can('promote_user', $id))
122 122
 			wp_die(__('You can&#8217;t edit that user.'));
123 123
 		// The new role of the current user must also have the promote_users cap or be a multisite super admin
124
-		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125
-			&& ! ( is_multisite() && is_super_admin() ) ) {
124
+		if ($id == $current_user->ID && ! $wp_roles->role_objects[$role]->has_cap('promote_users')
125
+			&& ! (is_multisite() && is_super_admin())) {
126 126
 				$update = 'err_admin_role';
127 127
 				continue;
128 128
 		}
129 129
 
130 130
 		// If the user doesn't already belong to the blog, bail.
131
-		if ( is_multisite() && !is_user_member_of_blog( $id ) ) {
131
+		if (is_multisite() && ! is_user_member_of_blog($id)) {
132 132
 			wp_die(
133
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
134
-				'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
133
+				'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
134
+				'<p>'.__('One of the selected users is not a member of this site.').'</p>',
135 135
 				403
136 136
 			);
137 137
 		}
138 138
 
139
-		$user = get_userdata( $id );
140
-		$user->set_role( $role );
139
+		$user = get_userdata($id);
140
+		$user->set_role($role);
141 141
 	}
142 142
 
143 143
 	wp_redirect(add_query_arg('update', $update, $redirect));
144 144
 	exit();
145 145
 
146 146
 case 'dodelete':
147
-	if ( is_multisite() )
148
-		wp_die( __('User deletion is not allowed from this screen.') );
147
+	if (is_multisite())
148
+		wp_die(__('User deletion is not allowed from this screen.'));
149 149
 
150 150
 	check_admin_referer('delete-users');
151 151
 
152
-	if ( empty($_REQUEST['users']) ) {
152
+	if (empty($_REQUEST['users'])) {
153 153
 		wp_redirect($redirect);
154 154
 		exit();
155 155
 	}
156 156
 
157
-	$userids = array_map( 'intval', (array) $_REQUEST['users'] );
157
+	$userids = array_map('intval', (array) $_REQUEST['users']);
158 158
 
159
-	if ( empty( $_REQUEST['delete_option'] ) ) {
160
-		$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
161
-		$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
162
-		wp_redirect( $url );
159
+	if (empty($_REQUEST['delete_option'])) {
160
+		$url = self_admin_url('users.php?action=delete&users[]='.implode('&users[]=', $userids).'&error=true');
161
+		$url = str_replace('&amp;', '&', wp_nonce_url($url, 'bulk-users'));
162
+		wp_redirect($url);
163 163
 		exit;
164 164
 	}
165 165
 
166
-	if ( ! current_user_can( 'delete_users' ) )
166
+	if ( ! current_user_can('delete_users'))
167 167
 		wp_die(__('You can&#8217;t delete users.'));
168 168
 
169 169
 	$update = 'del';
170 170
 	$delete_count = 0;
171 171
 
172
-	foreach ( $userids as $id ) {
173
-		if ( ! current_user_can( 'delete_user', $id ) )
174
-			wp_die(__( 'You can&#8217;t delete that user.' ) );
172
+	foreach ($userids as $id) {
173
+		if ( ! current_user_can('delete_user', $id))
174
+			wp_die(__('You can&#8217;t delete that user.'));
175 175
 
176
-		if ( $id == $current_user->ID ) {
176
+		if ($id == $current_user->ID) {
177 177
 			$update = 'err_admin_del';
178 178
 			continue;
179 179
 		}
180
-		switch ( $_REQUEST['delete_option'] ) {
180
+		switch ($_REQUEST['delete_option']) {
181 181
 		case 'delete':
182
-			wp_delete_user( $id );
182
+			wp_delete_user($id);
183 183
 			break;
184 184
 		case 'reassign':
185
-			wp_delete_user( $id, $_REQUEST['reassign_user'] );
185
+			wp_delete_user($id, $_REQUEST['reassign_user']);
186 186
 			break;
187 187
 		}
188 188
 		++$delete_count;
189 189
 	}
190 190
 
191
-	$redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
191
+	$redirect = add_query_arg(array('delete_count' => $delete_count, 'update' => $update), $redirect);
192 192
 	wp_redirect($redirect);
193 193
 	exit();
194 194
 
195 195
 case 'delete':
196
-	if ( is_multisite() )
197
-		wp_die( __('User deletion is not allowed from this screen.') );
196
+	if (is_multisite())
197
+		wp_die(__('User deletion is not allowed from this screen.'));
198 198
 
199 199
 	check_admin_referer('bulk-users');
200 200
 
201
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
201
+	if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) {
202 202
 		wp_redirect($redirect);
203 203
 		exit();
204 204
 	}
205 205
 
206
-	if ( ! current_user_can( 'delete_users' ) )
207
-		$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
206
+	if ( ! current_user_can('delete_users'))
207
+		$errors = new WP_Error('edit_users', __('You can&#8217;t delete users.'));
208 208
 
209
-	if ( empty($_REQUEST['users']) )
210
-		$userids = array( intval( $_REQUEST['user'] ) );
209
+	if (empty($_REQUEST['users']))
210
+		$userids = array(intval($_REQUEST['user']));
211 211
 	else
212
-		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
212
+		$userids = array_map('intval', (array) $_REQUEST['users']);
213 213
 
214 214
 	$users_have_content = false;
215
-	if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
215
+	if ($wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_author IN( ".implode(',', $userids)." ) LIMIT 1")) {
216 216
 		$users_have_content = true;
217
-	} elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
217
+	} elseif ($wpdb->get_var("SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( ".implode(',', $userids)." ) LIMIT 1")) {
218 218
 		$users_have_content = true;
219 219
 	}
220 220
 
221
-	if ( $users_have_content ) {
222
-		add_action( 'admin_head', 'delete_users_add_js' );
221
+	if ($users_have_content) {
222
+		add_action('admin_head', 'delete_users_add_js');
223 223
 	}
224 224
 
225
-	include( ABSPATH . 'wp-admin/admin-header.php' );
225
+	include(ABSPATH.'wp-admin/admin-header.php');
226 226
 ?>
227 227
 <form method="post" name="updateusers" id="updateusers">
228 228
 <?php wp_nonce_field('delete-users') ?>
229 229
 <?php echo $referer; ?>
230 230
 
231 231
 <div class="wrap">
232
-<h1><?php _e( 'Delete Users' ); ?></h1>
233
-<?php if ( isset( $_REQUEST['error'] ) ) : ?>
232
+<h1><?php _e('Delete Users'); ?></h1>
233
+<?php if (isset($_REQUEST['error'])) : ?>
234 234
 	<div class="error">
235
-		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
235
+		<p><strong><?php _e('ERROR:'); ?></strong> <?php _e('Please select an option.'); ?></p>
236 236
 	</div>
237 237
 <?php endif; ?>
238 238
 
239
-<?php if ( 1 == count( $userids ) ) : ?>
240
-	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
239
+<?php if (1 == count($userids)) : ?>
240
+	<p><?php _e('You have specified this user for deletion:'); ?></p>
241 241
 <?php else : ?>
242
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
242
+	<p><?php _e('You have specified these users for deletion:'); ?></p>
243 243
 <?php endif; ?>
244 244
 
245 245
 <ul>
246 246
 <?php
247 247
 	$go_delete = 0;
248
-	foreach ( $userids as $id ) {
249
-		$user = get_userdata( $id );
250
-		if ( $id == $current_user->ID ) {
248
+	foreach ($userids as $id) {
249
+		$user = get_userdata($id);
250
+		if ($id == $current_user->ID) {
251 251
 			/* translators: 1: user id, 2: user login */
252
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
252
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login)."</li>\n";
253 253
 		} else {
254 254
 			/* translators: 1: user id, 2: user login */
255
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
255
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"".esc_attr($id)."\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n";
256 256
 			$go_delete++;
257 257
 		}
258 258
 	}
259 259
 	?>
260 260
 	</ul>
261
-<?php if ( $go_delete ) :
261
+<?php if ($go_delete) :
262 262
 
263
-	if ( ! $users_have_content ) : ?>
263
+	if ( ! $users_have_content) : ?>
264 264
 		<input type="hidden" name="delete_option" value="delete" />
265 265
 	<?php else: ?>
266
-		<?php if ( 1 == $go_delete ) : ?>
267
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
266
+		<?php if (1 == $go_delete) : ?>
267
+			<fieldset><p><legend><?php _e('What should be done with content owned by this user?'); ?></legend></p>
268 268
 		<?php else : ?>
269
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
269
+			<fieldset><p><legend><?php _e('What should be done with content owned by these users?'); ?></legend></p>
270 270
 		<?php endif; ?>
271 271
 		<ul style="list-style:none;">
272 272
 			<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
273 273
 			<?php _e('Delete all content.'); ?></label></li>
274 274
 			<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
275
-			<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
276
-			wp_dropdown_users( array(
275
+			<?php echo '<label for="delete_option1">'.__('Attribute all content to:').'</label> ';
276
+			wp_dropdown_users(array(
277 277
 				'name' => 'reassign_user',
278
-				'exclude' => array_diff( $userids, array( $current_user->ID ) ),
278
+				'exclude' => array_diff($userids, array($current_user->ID)),
279 279
 				'show' => 'display_name_with_login',
280
-			) ); ?></li>
280
+			)); ?></li>
281 281
 		</ul></fieldset>
282 282
 	<?php endif;
283 283
 	/**
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @param WP_User $current_user WP_User object for the current user.
290 290
 	 * @param array   $userids      Array of IDs for users being deleted.
291 291
 	 */
292
-	do_action( 'delete_user_form', $current_user, $userids );
292
+	do_action('delete_user_form', $current_user, $userids);
293 293
 	?>
294 294
 	<input type="hidden" name="action" value="dodelete" />
295
-	<?php submit_button( __('Confirm Deletion'), 'primary' ); ?>
295
+	<?php submit_button(__('Confirm Deletion'), 'primary'); ?>
296 296
 <?php else : ?>
297 297
 	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
298 298
 <?php endif; ?>
@@ -305,34 +305,34 @@  discard block
 block discarded – undo
305 305
 case 'doremove':
306 306
 	check_admin_referer('remove-users');
307 307
 
308
-	if ( ! is_multisite() )
309
-		wp_die( __( 'You can&#8217;t remove users.' ) );
308
+	if ( ! is_multisite())
309
+		wp_die(__('You can&#8217;t remove users.'));
310 310
 
311
-	if ( empty($_REQUEST['users']) ) {
311
+	if (empty($_REQUEST['users'])) {
312 312
 		wp_redirect($redirect);
313 313
 		exit;
314 314
 	}
315 315
 
316
-	if ( ! current_user_can( 'remove_users' ) )
317
-		wp_die( __( 'You can&#8217;t remove users.' ) );
316
+	if ( ! current_user_can('remove_users'))
317
+		wp_die(__('You can&#8217;t remove users.'));
318 318
 
319 319
 	$userids = $_REQUEST['users'];
320 320
 
321 321
 	$update = 'remove';
322
- 	foreach ( $userids as $id ) {
322
+ 	foreach ($userids as $id) {
323 323
 		$id = (int) $id;
324
-		if ( $id == $current_user->ID && !is_super_admin() ) {
324
+		if ($id == $current_user->ID && ! is_super_admin()) {
325 325
 			$update = 'err_admin_remove';
326 326
 			continue;
327 327
 		}
328
-		if ( !current_user_can('remove_user', $id) ) {
328
+		if ( ! current_user_can('remove_user', $id)) {
329 329
 			$update = 'err_admin_remove';
330 330
 			continue;
331 331
 		}
332 332
 		remove_user_from_blog($id, $blog_id);
333 333
 	}
334 334
 
335
-	$redirect = add_query_arg( array('update' => $update), $redirect);
335
+	$redirect = add_query_arg(array('update' => $update), $redirect);
336 336
 	wp_redirect($redirect);
337 337
 	exit;
338 338
 
@@ -340,60 +340,60 @@  discard block
 block discarded – undo
340 340
 
341 341
 	check_admin_referer('bulk-users');
342 342
 
343
-	if ( ! is_multisite() )
344
-		wp_die( __( 'You can&#8217;t remove users.' ) );
343
+	if ( ! is_multisite())
344
+		wp_die(__('You can&#8217;t remove users.'));
345 345
 
346
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
346
+	if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) {
347 347
 		wp_redirect($redirect);
348 348
 		exit();
349 349
 	}
350 350
 
351
-	if ( !current_user_can('remove_users') )
351
+	if ( ! current_user_can('remove_users'))
352 352
 		$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
353 353
 
354
-	if ( empty($_REQUEST['users']) )
354
+	if (empty($_REQUEST['users']))
355 355
 		$userids = array(intval($_REQUEST['user']));
356 356
 	else
357 357
 		$userids = $_REQUEST['users'];
358 358
 
359
-	include( ABSPATH . 'wp-admin/admin-header.php' );
359
+	include(ABSPATH.'wp-admin/admin-header.php');
360 360
 ?>
361 361
 <form method="post" name="updateusers" id="updateusers">
362 362
 <?php wp_nonce_field('remove-users') ?>
363 363
 <?php echo $referer; ?>
364 364
 
365 365
 <div class="wrap">
366
-<h1><?php _e( 'Remove Users from Site' ); ?></h1>
366
+<h1><?php _e('Remove Users from Site'); ?></h1>
367 367
 
368
-<?php if ( 1 == count( $userids ) ) : ?>
369
-	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
368
+<?php if (1 == count($userids)) : ?>
369
+	<p><?php _e('You have specified this user for removal:'); ?></p>
370 370
 <?php else : ?>
371
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
371
+	<p><?php _e('You have specified these users for removal:'); ?></p>
372 372
 <?php endif; ?>
373 373
 
374 374
 <ul>
375 375
 <?php
376 376
 	$go_remove = false;
377
- 	foreach ( $userids as $id ) {
377
+ 	foreach ($userids as $id) {
378 378
 		$id = (int) $id;
379
- 		$user = get_userdata( $id );
380
-		if ( $id == $current_user->ID && !is_super_admin() ) {
379
+ 		$user = get_userdata($id);
380
+		if ($id == $current_user->ID && ! is_super_admin()) {
381 381
 			/* translators: 1: user id, 2: user login */
382
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
383
-		} elseif ( !current_user_can('remove_user', $id) ) {
382
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login)."</li>\n";
383
+		} elseif ( ! current_user_can('remove_user', $id)) {
384 384
 			/* translators: 1: user id, 2: user login */
385
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
385
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login)."</li>\n";
386 386
 		} else {
387 387
 			/* translators: 1: user id, 2: user login */
388
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
388
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n";
389 389
 			$go_remove = true;
390 390
 		}
391 391
  	}
392 392
  	?>
393 393
 </ul>
394
-<?php if ( $go_remove ) : ?>
394
+<?php if ($go_remove) : ?>
395 395
 		<input type="hidden" name="action" value="doremove" />
396
-		<?php submit_button( __('Confirm Removal'), 'primary' ); ?>
396
+		<?php submit_button(__('Confirm Removal'), 'primary'); ?>
397 397
 <?php else : ?>
398 398
 	<p><?php _e('There are no valid users selected for removal.'); ?></p>
399 399
 <?php endif; ?>
@@ -405,93 +405,93 @@  discard block
 block discarded – undo
405 405
 
406 406
 default:
407 407
 
408
-	if ( !empty($_GET['_wp_http_referer']) ) {
409
-		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
408
+	if ( ! empty($_GET['_wp_http_referer'])) {
409
+		wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
410 410
 		exit;
411 411
 	}
412 412
 
413 413
 	$wp_list_table->prepare_items();
414
-	$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
415
-	if ( $pagenum > $total_pages && $total_pages > 0 ) {
416
-		wp_redirect( add_query_arg( 'paged', $total_pages ) );
414
+	$total_pages = $wp_list_table->get_pagination_arg('total_pages');
415
+	if ($pagenum > $total_pages && $total_pages > 0) {
416
+		wp_redirect(add_query_arg('paged', $total_pages));
417 417
 		exit;
418 418
 	}
419 419
 
420
-	include( ABSPATH . 'wp-admin/admin-header.php' );
420
+	include(ABSPATH.'wp-admin/admin-header.php');
421 421
 
422 422
 	$messages = array();
423
-	if ( isset($_GET['update']) ) :
424
-		switch($_GET['update']) {
423
+	if (isset($_GET['update'])) :
424
+		switch ($_GET['update']) {
425 425
 		case 'del':
426 426
 		case 'del_many':
427 427
 			$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
428
-			if ( 1 == $delete_count ) {
429
-				$message = __( 'User deleted.' );
428
+			if (1 == $delete_count) {
429
+				$message = __('User deleted.');
430 430
 			} else {
431
-				$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
431
+				$message = _n('%s user deleted.', '%s users deleted.', $delete_count);
432 432
 			}
433
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
433
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($delete_count)).'</p></div>';
434 434
 			break;
435 435
 		case 'add':
436
-			if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
436
+			if (isset($_GET['id']) && ($user_id = $_GET['id']) && current_user_can('edit_user', $user_id)) {
437 437
 				/* translators: %s: edit page url */
438
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
439
-					esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
440
-						self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
438
+				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf(__('New user created. <a href="%s">Edit user</a>'),
439
+					esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])),
440
+						self_admin_url('user-edit.php?user_id='.$user_id)))).'</p></div>';
441 441
 			} else {
442
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
442
+				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('New user created.').'</p></div>';
443 443
 			}
444 444
 			break;
445 445
 		case 'promote':
446
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
446
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Changed roles.').'</p></div>';
447 447
 			break;
448 448
 		case 'err_admin_role':
449
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
450
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
449
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('The current user&#8217;s role must have user editing capabilities.').'</p></div>';
450
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other user roles have been changed.').'</p></div>';
451 451
 			break;
452 452
 		case 'err_admin_del':
453
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
454
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
453
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('You can&#8217;t delete the current user.').'</p></div>';
454
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other users have been deleted.').'</p></div>';
455 455
 			break;
456 456
 		case 'remove':
457
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
457
+			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('User removed from this site.').'</p></div>';
458 458
 			break;
459 459
 		case 'err_admin_remove':
460
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
461
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
460
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__("You can't remove the current user.").'</p></div>';
461
+			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('Other users have been removed.').'</p></div>';
462 462
 			break;
463 463
 		}
464 464
 	endif; ?>
465 465
 
466
-<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
466
+<?php if (isset($errors) && is_wp_error($errors)) : ?>
467 467
 	<div class="error">
468 468
 		<ul>
469 469
 		<?php
470
-			foreach ( $errors->get_error_messages() as $err )
470
+			foreach ($errors->get_error_messages() as $err)
471 471
 				echo "<li>$err</li>\n";
472 472
 		?>
473 473
 		</ul>
474 474
 	</div>
475 475
 <?php endif;
476 476
 
477
-if ( ! empty($messages) ) {
478
-	foreach ( $messages as $msg )
477
+if ( ! empty($messages)) {
478
+	foreach ($messages as $msg)
479 479
 		echo $msg;
480 480
 } ?>
481 481
 
482 482
 <div class="wrap">
483 483
 <h1>
484 484
 <?php
485
-echo esc_html( $title );
486
-if ( current_user_can( 'create_users' ) ) { ?>
487
-	<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
488
-<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
489
-	<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
485
+echo esc_html($title);
486
+if (current_user_can('create_users')) { ?>
487
+	<a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a>
488
+<?php } elseif (is_multisite() && current_user_can('promote_users')) { ?>
489
+	<a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add Existing', 'user'); ?></a>
490 490
 <?php }
491 491
 
492
-if ( strlen( $usersearch ) ) {
492
+if (strlen($usersearch)) {
493 493
 	/* translators: %s: search keywords */
494
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
494
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html($usersearch));
495 495
 }
496 496
 ?>
497 497
 </h1>
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 
501 501
 <form method="get">
502 502
 
503
-<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
503
+<?php $wp_list_table->search_box(__('Search Users'), 'user'); ?>
504 504
 
505 505
 <?php $wp_list_table->display(); ?>
506 506
 </form>
@@ -512,4 +512,4 @@  discard block
 block discarded – undo
512 512
 
513 513
 } // end of the $doaction switch
514 514
 
515
-include( ABSPATH . 'wp-admin/admin-footer.php' );
515
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +83 added lines, -49 removed lines patch added patch discarded remove patch
@@ -48,10 +48,11 @@  discard block
 block discarded – undo
48 48
 	'<ul>' .
49 49
 	'<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
50 50
 
51
-if ( is_multisite() )
51
+if ( is_multisite() ) {
52 52
 	$help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
53
-else
53
+} else {
54 54
 	$help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
55
+}
55 56
 
56 57
 $help .= '</ul>';
57 58
 
@@ -93,8 +94,9 @@  discard block
 block discarded – undo
93 94
 case 'promote':
94 95
 	check_admin_referer('bulk-users');
95 96
 
96
-	if ( ! current_user_can( 'promote_users' ) )
97
-		wp_die( __( 'You can&#8217;t edit that user.' ) );
97
+	if ( ! current_user_can( 'promote_users' ) ) {
98
+			wp_die( __( 'You can&#8217;t edit that user.' ) );
99
+	}
98 100
 
99 101
 	if ( empty($_REQUEST['users']) ) {
100 102
 		wp_redirect($redirect);
@@ -118,8 +120,9 @@  discard block
 block discarded – undo
118 120
 	foreach ( $userids as $id ) {
119 121
 		$id = (int) $id;
120 122
 
121
-		if ( ! current_user_can('promote_user', $id) )
122
-			wp_die(__('You can&#8217;t edit that user.'));
123
+		if ( ! current_user_can('promote_user', $id) ) {
124
+					wp_die(__('You can&#8217;t edit that user.'));
125
+		}
123 126
 		// The new role of the current user must also have the promote_users cap or be a multisite super admin
124 127
 		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125 128
 			&& ! ( is_multisite() && is_super_admin() ) ) {
@@ -144,8 +147,9 @@  discard block
 block discarded – undo
144 147
 	exit();
145 148
 
146 149
 case 'dodelete':
147
-	if ( is_multisite() )
148
-		wp_die( __('User deletion is not allowed from this screen.') );
150
+	if ( is_multisite() ) {
151
+			wp_die( __('User deletion is not allowed from this screen.') );
152
+	}
149 153
 
150 154
 	check_admin_referer('delete-users');
151 155
 
@@ -163,15 +167,17 @@  discard block
 block discarded – undo
163 167
 		exit;
164 168
 	}
165 169
 
166
-	if ( ! current_user_can( 'delete_users' ) )
167
-		wp_die(__('You can&#8217;t delete users.'));
170
+	if ( ! current_user_can( 'delete_users' ) ) {
171
+			wp_die(__('You can&#8217;t delete users.'));
172
+	}
168 173
 
169 174
 	$update = 'del';
170 175
 	$delete_count = 0;
171 176
 
172 177
 	foreach ( $userids as $id ) {
173
-		if ( ! current_user_can( 'delete_user', $id ) )
174
-			wp_die(__( 'You can&#8217;t delete that user.' ) );
178
+		if ( ! current_user_can( 'delete_user', $id ) ) {
179
+					wp_die(__( 'You can&#8217;t delete that user.' ) );
180
+		}
175 181
 
176 182
 		if ( $id == $current_user->ID ) {
177 183
 			$update = 'err_admin_del';
@@ -193,8 +199,9 @@  discard block
 block discarded – undo
193 199
 	exit();
194 200
 
195 201
 case 'delete':
196
-	if ( is_multisite() )
197
-		wp_die( __('User deletion is not allowed from this screen.') );
202
+	if ( is_multisite() ) {
203
+			wp_die( __('User deletion is not allowed from this screen.') );
204
+	}
198 205
 
199 206
 	check_admin_referer('bulk-users');
200 207
 
@@ -203,13 +210,15 @@  discard block
 block discarded – undo
203 210
 		exit();
204 211
 	}
205 212
 
206
-	if ( ! current_user_can( 'delete_users' ) )
207
-		$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
213
+	if ( ! current_user_can( 'delete_users' ) ) {
214
+			$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
215
+	}
208 216
 
209
-	if ( empty($_REQUEST['users']) )
210
-		$userids = array( intval( $_REQUEST['user'] ) );
211
-	else
212
-		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
217
+	if ( empty($_REQUEST['users']) ) {
218
+			$userids = array( intval( $_REQUEST['user'] ) );
219
+	} else {
220
+			$userids = array_map( 'intval', (array) $_REQUEST['users'] );
221
+	}
213 222
 
214 223
 	$users_have_content = false;
215 224
 	if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
@@ -238,8 +247,11 @@  discard block
 block discarded – undo
238 247
 
239 248
 <?php if ( 1 == count( $userids ) ) : ?>
240 249
 	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
241
-<?php else : ?>
242
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
250
+<?php else {
251
+	: ?>
252
+	<p><?php _e( 'You have specified these users for deletion:' );
253
+}
254
+?></p>
243 255
 <?php endif; ?>
244 256
 
245 257
 <ul>
@@ -262,11 +274,17 @@  discard block
 block discarded – undo
262 274
 
263 275
 	if ( ! $users_have_content ) : ?>
264 276
 		<input type="hidden" name="delete_option" value="delete" />
265
-	<?php else: ?>
277
+	<?php else {
278
+	: ?>
266 279
 		<?php if ( 1 == $go_delete ) : ?>
267
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
268
-		<?php else : ?>
269
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
280
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' );
281
+}
282
+?></legend></p>
283
+		<?php else {
284
+	: ?>
285
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' );
286
+}
287
+?></legend></p>
270 288
 		<?php endif; ?>
271 289
 		<ul style="list-style:none;">
272 290
 			<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
@@ -293,8 +311,11 @@  discard block
 block discarded – undo
293 311
 	?>
294 312
 	<input type="hidden" name="action" value="dodelete" />
295 313
 	<?php submit_button( __('Confirm Deletion'), 'primary' ); ?>
296
-<?php else : ?>
297
-	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
314
+<?php else {
315
+	: ?>
316
+	<p><?php _e('There are no valid users selected for deletion.');
317
+}
318
+?></p>
298 319
 <?php endif; ?>
299 320
 </div>
300 321
 </form>
@@ -305,16 +326,18 @@  discard block
 block discarded – undo
305 326
 case 'doremove':
306 327
 	check_admin_referer('remove-users');
307 328
 
308
-	if ( ! is_multisite() )
309
-		wp_die( __( 'You can&#8217;t remove users.' ) );
329
+	if ( ! is_multisite() ) {
330
+			wp_die( __( 'You can&#8217;t remove users.' ) );
331
+	}
310 332
 
311 333
 	if ( empty($_REQUEST['users']) ) {
312 334
 		wp_redirect($redirect);
313 335
 		exit;
314 336
 	}
315 337
 
316
-	if ( ! current_user_can( 'remove_users' ) )
317
-		wp_die( __( 'You can&#8217;t remove users.' ) );
338
+	if ( ! current_user_can( 'remove_users' ) ) {
339
+			wp_die( __( 'You can&#8217;t remove users.' ) );
340
+	}
318 341
 
319 342
 	$userids = $_REQUEST['users'];
320 343
 
@@ -340,21 +363,24 @@  discard block
 block discarded – undo
340 363
 
341 364
 	check_admin_referer('bulk-users');
342 365
 
343
-	if ( ! is_multisite() )
344
-		wp_die( __( 'You can&#8217;t remove users.' ) );
366
+	if ( ! is_multisite() ) {
367
+			wp_die( __( 'You can&#8217;t remove users.' ) );
368
+	}
345 369
 
346 370
 	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
347 371
 		wp_redirect($redirect);
348 372
 		exit();
349 373
 	}
350 374
 
351
-	if ( !current_user_can('remove_users') )
352
-		$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
375
+	if ( !current_user_can('remove_users') ) {
376
+			$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
377
+	}
353 378
 
354
-	if ( empty($_REQUEST['users']) )
355
-		$userids = array(intval($_REQUEST['user']));
356
-	else
357
-		$userids = $_REQUEST['users'];
379
+	if ( empty($_REQUEST['users']) ) {
380
+			$userids = array(intval($_REQUEST['user']));
381
+	} else {
382
+			$userids = $_REQUEST['users'];
383
+	}
358 384
 
359 385
 	include( ABSPATH . 'wp-admin/admin-header.php' );
360 386
 ?>
@@ -367,8 +393,11 @@  discard block
 block discarded – undo
367 393
 
368 394
 <?php if ( 1 == count( $userids ) ) : ?>
369 395
 	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
370
-<?php else : ?>
371
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
396
+<?php else {
397
+	: ?>
398
+	<p><?php _e( 'You have specified these users for removal:' );
399
+}
400
+?></p>
372 401
 <?php endif; ?>
373 402
 
374 403
 <ul>
@@ -394,8 +423,11 @@  discard block
 block discarded – undo
394 423
 <?php if ( $go_remove ) : ?>
395 424
 		<input type="hidden" name="action" value="doremove" />
396 425
 		<?php submit_button( __('Confirm Removal'), 'primary' ); ?>
397
-<?php else : ?>
398
-	<p><?php _e('There are no valid users selected for removal.'); ?></p>
426
+<?php else {
427
+	: ?>
428
+	<p><?php _e('There are no valid users selected for removal.');
429
+}
430
+?></p>
399 431
 <?php endif; ?>
400 432
 </div>
401 433
 </form>
@@ -467,17 +499,19 @@  discard block
 block discarded – undo
467 499
 	<div class="error">
468 500
 		<ul>
469 501
 		<?php
470
-			foreach ( $errors->get_error_messages() as $err )
471
-				echo "<li>$err</li>\n";
502
+			foreach ( $errors->get_error_messages() as $err ) {
503
+							echo "<li>$err</li>\n";
504
+			}
472 505
 		?>
473 506
 		</ul>
474 507
 	</div>
475 508
 <?php endif;
476 509
 
477 510
 if ( ! empty($messages) ) {
478
-	foreach ( $messages as $msg )
479
-		echo $msg;
480
-} ?>
511
+	foreach ( $messages as $msg ) {
512
+			echo $msg;
513
+	}
514
+	} ?>
481 515
 
482 516
 <div class="wrap">
483 517
 <h1>
Please login to merge, or discard this patch.
src/wp-admin/post-new.php 2 patches
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 /**
13 13
  * @global string  $post_type
@@ -16,28 +16,28 @@  discard block
 block discarded – undo
16 16
  */
17 17
 global $post_type, $post_type_object, $post;
18 18
 
19
-if ( ! isset( $_GET['post_type'] ) ) {
19
+if ( ! isset($_GET['post_type'])) {
20 20
 	$post_type = 'post';
21
-} elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) {
21
+} elseif (in_array($_GET['post_type'], get_post_types(array('show_ui' => true)))) {
22 22
 	$post_type = $_GET['post_type'];
23 23
 } else {
24
-	wp_die( __('Invalid post type') );
24
+	wp_die(__('Invalid post type'));
25 25
 }
26
-$post_type_object = get_post_type_object( $post_type );
26
+$post_type_object = get_post_type_object($post_type);
27 27
 
28
-if ( 'post' == $post_type ) {
28
+if ('post' == $post_type) {
29 29
 	$parent_file = 'edit.php';
30 30
 	$submenu_file = 'post-new.php';
31
-} elseif ( 'attachment' == $post_type ) {
32
-	if ( wp_redirect( admin_url( 'media-new.php' ) ) )
31
+} elseif ('attachment' == $post_type) {
32
+	if (wp_redirect(admin_url('media-new.php')))
33 33
 		exit;
34 34
 } else {
35 35
 	$submenu_file = "post-new.php?post_type=$post_type";
36
-	if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
36
+	if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true) {
37 37
 		$parent_file = $post_type_object->show_in_menu;
38 38
 		// What if there isn't a post-new.php item for this post type?
39
-		if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
40
-			if (	isset( $_registered_pages[ get_plugin_page_hookname( "edit.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
39
+		if ( ! isset($_registered_pages[get_plugin_page_hookname("post-new.php?post_type=$post_type", $post_type_object->show_in_menu)])) {
40
+			if (isset($_registered_pages[get_plugin_page_hookname("edit.php?post_type=$post_type", $post_type_object->show_in_menu)])) {
41 41
 				// Fall back to edit.php for that post type, if it exists
42 42
 				$submenu_file = "edit.php?post_type=$post_type";
43 43
 			} else {
@@ -54,33 +54,33 @@  discard block
 block discarded – undo
54 54
 
55 55
 $editing = true;
56 56
 
57
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
57
+if ( ! current_user_can($post_type_object->cap->edit_posts) || ! current_user_can($post_type_object->cap->create_posts)) {
58 58
 	wp_die(
59
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
60
-		'<p>' . __( 'You are not allowed to create posts as this user.' ) . '</p>',
59
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
60
+		'<p>'.__('You are not allowed to create posts as this user.').'</p>',
61 61
 		403
62 62
 	);
63 63
 }
64 64
 
65 65
 // Schedule auto-draft cleanup
66
-if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
67
-	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
66
+if ( ! wp_next_scheduled('wp_scheduled_auto_draft_delete'))
67
+	wp_schedule_event(time(), 'daily', 'wp_scheduled_auto_draft_delete');
68 68
 
69
-wp_enqueue_script( 'autosave' );
69
+wp_enqueue_script('autosave');
70 70
 
71
-if ( is_multisite() ) {
72
-	add_action( 'admin_footer', '_admin_notice_post_locked' );
71
+if (is_multisite()) {
72
+	add_action('admin_footer', '_admin_notice_post_locked');
73 73
 } else {
74
-	$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
74
+	$check_users = get_users(array('fields' => 'ID', 'number' => 2));
75 75
 
76
-	if ( count( $check_users ) > 1 )
77
-		add_action( 'admin_footer', '_admin_notice_post_locked' );
76
+	if (count($check_users) > 1)
77
+		add_action('admin_footer', '_admin_notice_post_locked');
78 78
 
79
-	unset( $check_users );
79
+	unset($check_users);
80 80
 }
81 81
 
82 82
 // Show post form.
83
-$post = get_default_post_to_edit( $post_type, true );
83
+$post = get_default_post_to_edit($post_type, true);
84 84
 $post_ID = $post->ID;
85
-include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
86
-include( ABSPATH . 'wp-admin/admin-footer.php' );
85
+include(ABSPATH.'wp-admin/edit-form-advanced.php');
86
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -29,9 +29,10 @@  discard block
 block discarded – undo
29 29
 	$parent_file = 'edit.php';
30 30
 	$submenu_file = 'post-new.php';
31 31
 } elseif ( 'attachment' == $post_type ) {
32
-	if ( wp_redirect( admin_url( 'media-new.php' ) ) )
33
-		exit;
34
-} else {
32
+	if ( wp_redirect( admin_url( 'media-new.php' ) ) ) {
33
+			exit;
34
+	}
35
+	} else {
35 36
 	$submenu_file = "post-new.php?post_type=$post_type";
36 37
 	if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
37 38
 		$parent_file = $post_type_object->show_in_menu;
@@ -63,8 +64,9 @@  discard block
 block discarded – undo
63 64
 }
64 65
 
65 66
 // Schedule auto-draft cleanup
66
-if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
67
+if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
67 68
 	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
69
+}
68 70
 
69 71
 wp_enqueue_script( 'autosave' );
70 72
 
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
 } else {
74 76
 	$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
75 77
 
76
-	if ( count( $check_users ) > 1 )
77
-		add_action( 'admin_footer', '_admin_notice_post_locked' );
78
+	if ( count( $check_users ) > 1 ) {
79
+			add_action( 'admin_footer', '_admin_notice_post_locked' );
80
+	}
78 81
 
79 82
 	unset( $check_users );
80 83
 }
Please login to merge, or discard this patch.
src/wp-admin/edit-form-advanced.php 3 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -491,12 +491,12 @@  discard block
 block discarded – undo
491 491
 </div>
492 492
 <form name="post" action="post.php" method="post" id="post"<?php
493 493
 /**
494
- * Fires inside the post editor form tag.
495
- *
496
- * @since 3.0.0
497
- *
498
- * @param WP_Post $post Post object.
499
- */
494
+	 * Fires inside the post editor form tag.
495
+	 *
496
+	 * @since 3.0.0
497
+	 *
498
+	 * @param WP_Post $post Post object.
499
+	 */
500 500
 do_action( 'post_edit_form_tag', $post );
501 501
 
502 502
 $referer = wp_get_referer();
@@ -557,12 +557,12 @@  discard block
 block discarded – undo
557 557
 </div>
558 558
 <?php
559 559
 /**
560
- * Fires before the permalink field in the edit form.
561
- *
562
- * @since 4.1.0
563
- *
564
- * @param WP_Post $post Post object.
565
- */
560
+	 * Fires before the permalink field in the edit form.
561
+	 *
562
+	 * @since 4.1.0
563
+	 *
564
+	 * @param WP_Post $post Post object.
565
+	 */
566 566
 do_action( 'edit_form_before_permalink', $post );
567 567
 ?>
568 568
 <div class="inside">
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 	$shortlink = wp_get_shortlink($post->ID, 'post');
576 576
 
577 577
 	if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {
578
-    	$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
578
+		$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
579 579
 	}
580 580
 }
581 581
 
@@ -600,12 +600,12 @@  discard block
 block discarded – undo
600 600
 <?php
601 601
 }
602 602
 /**
603
- * Fires after the title field.
604
- *
605
- * @since 3.5.0
606
- *
607
- * @param WP_Post $post Post object.
608
- */
603
+	 * Fires after the title field.
604
+	 *
605
+	 * @since 3.5.0
606
+	 *
607
+	 * @param WP_Post $post Post object.
608
+	 */
609 609
 do_action( 'edit_form_after_title', $post );
610 610
 
611 611
 if ( post_type_supports($post_type, 'editor') ) {
@@ -644,12 +644,12 @@  discard block
 block discarded – undo
644 644
 </div>
645 645
 <?php }
646 646
 /**
647
- * Fires after the content editor.
648
- *
649
- * @since 3.5.0
650
- *
651
- * @param WP_Post $post Post object.
652
- */
647
+	 * Fires after the content editor.
648
+	 *
649
+	 * @since 3.5.0
650
+	 *
651
+	 * @param WP_Post $post Post object.
652
+	 */
653 653
 do_action( 'edit_form_after_editor', $post );
654 654
 ?>
655 655
 </div><!-- /post-body-content -->
Please login to merge, or discard this patch.
Spacing   +241 added lines, -241 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // don't load directly
10
-if ( !defined('ABSPATH') )
10
+if ( ! defined('ABSPATH'))
11 11
 	die('-1');
12 12
 
13 13
 /**
@@ -29,17 +29,17 @@  discard block
 block discarded – undo
29 29
  * @param bool   $expand    Whether to enable the 'expand' functionality. Default true.
30 30
  * @param string $post_type Post type.
31 31
  */
32
-if ( post_type_supports( $post_type, 'editor' ) && ! wp_is_mobile() &&
33
-	 ! ( $is_IE && preg_match( '/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'] ) ) &&
34
-	 apply_filters( 'wp_editor_expand', true, $post_type ) ) {
32
+if (post_type_supports($post_type, 'editor') && ! wp_is_mobile() &&
33
+	 ! ($is_IE && preg_match('/MSIE [5678]/', $_SERVER['HTTP_USER_AGENT'])) &&
34
+	 apply_filters('wp_editor_expand', true, $post_type)) {
35 35
 
36 36
 	wp_enqueue_script('editor-expand');
37 37
 	$_content_editor_dfw = true;
38
-	$_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
38
+	$_wp_editor_expand = (get_user_setting('editor_expand', 'on') === 'on');
39 39
 }
40 40
 
41
-if ( wp_is_mobile() )
42
-	wp_enqueue_script( 'jquery-touch-punch' );
41
+if (wp_is_mobile())
42
+	wp_enqueue_script('jquery-touch-punch');
43 43
 
44 44
 /**
45 45
  * Post ID global
@@ -50,33 +50,33 @@  discard block
 block discarded – undo
50 50
 $user_ID = isset($user_ID) ? (int) $user_ID : 0;
51 51
 $action = isset($action) ? $action : '';
52 52
 
53
-if ( $post_ID == get_option( 'page_for_posts' ) && empty( $post->post_content ) ) {
54
-	add_action( 'edit_form_after_title', '_wp_posts_page_notice' );
55
-	remove_post_type_support( $post_type, 'editor' );
53
+if ($post_ID == get_option('page_for_posts') && empty($post->post_content)) {
54
+	add_action('edit_form_after_title', '_wp_posts_page_notice');
55
+	remove_post_type_support($post_type, 'editor');
56 56
 }
57 57
 
58
-$thumbnail_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
59
-if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type ) {
60
-	if ( wp_attachment_is( 'audio', $post ) ) {
61
-		$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
62
-	} elseif ( wp_attachment_is( 'video', $post ) ) {
63
-		$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
58
+$thumbnail_support = current_theme_supports('post-thumbnails', $post_type) && post_type_supports($post_type, 'thumbnail');
59
+if ( ! $thumbnail_support && 'attachment' === $post_type && $post->post_mime_type) {
60
+	if (wp_attachment_is('audio', $post)) {
61
+		$thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
62
+	} elseif (wp_attachment_is('video', $post)) {
63
+		$thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
64 64
 	}
65 65
 }
66 66
 
67
-if ( $thumbnail_support ) {
67
+if ($thumbnail_support) {
68 68
 	add_thickbox();
69
-	wp_enqueue_media( array( 'post' => $post_ID ) );
69
+	wp_enqueue_media(array('post' => $post_ID));
70 70
 }
71 71
 
72 72
 // Add the local autosave notice HTML
73
-add_action( 'admin_footer', '_local_storage_notice' );
73
+add_action('admin_footer', '_local_storage_notice');
74 74
 
75 75
 /*
76 76
  * @todo Document the $messages array(s).
77 77
  */
78
-$permalink = get_permalink( $post_ID );
79
-if ( ! $permalink ) {
78
+$permalink = get_permalink($post_ID);
79
+if ( ! $permalink) {
80 80
 	$permalink = '';
81 81
 }
82 82
 
@@ -85,82 +85,82 @@  discard block
 block discarded – undo
85 85
 $preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = '';
86 86
 $preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = '';
87 87
 
88
-$preview_url = get_preview_post_link( $post );
88
+$preview_url = get_preview_post_link($post);
89 89
 
90
-$viewable = is_post_type_viewable( $post_type_object );
90
+$viewable = is_post_type_viewable($post_type_object);
91 91
 
92
-if ( $viewable ) {
92
+if ($viewable) {
93 93
 
94 94
 	// Preview post link.
95
-	$preview_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
96
-		esc_url( $preview_url ),
97
-		__( 'Preview post' )
95
+	$preview_post_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>',
96
+		esc_url($preview_url),
97
+		__('Preview post')
98 98
 	);
99 99
 
100 100
 	// Scheduled post preview link.
101
-	$scheduled_post_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
102
-		esc_url( $permalink ),
103
-		__( 'Preview post' )
101
+	$scheduled_post_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>',
102
+		esc_url($permalink),
103
+		__('Preview post')
104 104
 	);
105 105
 
106 106
 	// View post link.
107
-	$view_post_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
108
-		esc_url( $permalink ),
109
-		__( 'View post' )
107
+	$view_post_link_html = sprintf(' <a href="%1$s">%2$s</a>',
108
+		esc_url($permalink),
109
+		__('View post')
110 110
 	);
111 111
 
112 112
 	// Preview page link.
113
-	$preview_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
114
-		esc_url( $preview_url ),
115
-		__( 'Preview page' )
113
+	$preview_page_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>',
114
+		esc_url($preview_url),
115
+		__('Preview page')
116 116
 	);
117 117
 
118 118
 	// Scheduled page preview link.
119
-	$scheduled_page_link_html = sprintf( ' <a target="_blank" href="%1$s">%2$s</a>',
120
-		esc_url( $permalink ),
121
-		__( 'Preview page' )
119
+	$scheduled_page_link_html = sprintf(' <a target="_blank" href="%1$s">%2$s</a>',
120
+		esc_url($permalink),
121
+		__('Preview page')
122 122
 	);
123 123
 
124 124
 	// View page link.
125
-	$view_page_link_html = sprintf( ' <a href="%1$s">%2$s</a>',
126
-		esc_url( $permalink ),
127
-		__( 'View page' )
125
+	$view_page_link_html = sprintf(' <a href="%1$s">%2$s</a>',
126
+		esc_url($permalink),
127
+		__('View page')
128 128
 	);
129 129
 
130 130
 }
131 131
 
132 132
 /* translators: Publish box date format, see http://php.net/date */
133
-$scheduled_date = date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_date ) );
133
+$scheduled_date = date_i18n(__('M j, Y @ H:i'), strtotime($post->post_date));
134 134
 
135 135
 $messages['post'] = array(
136 136
 	 0 => '', // Unused. Messages start at index 1.
137
-	 1 => __( 'Post updated.' ) . $view_post_link_html,
138
-	 2 => __( 'Custom field updated.' ),
139
-	 3 => __( 'Custom field deleted.' ),
140
-	 4 => __( 'Post updated.' ),
137
+	 1 => __('Post updated.').$view_post_link_html,
138
+	 2 => __('Custom field updated.'),
139
+	 3 => __('Custom field deleted.'),
140
+	 4 => __('Post updated.'),
141 141
 	/* translators: %s: date and time of the revision */
142
-	 5 => isset($_GET['revision']) ? sprintf( __( 'Post restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
143
-	 6 => __( 'Post published.' ) . $view_post_link_html,
144
-	 7 => __( 'Post saved.' ),
145
-	 8 => __( 'Post submitted.' ) . $preview_post_link_html,
146
-	 9 => sprintf( __( 'Post scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_post_link_html,
147
-	10 => __( 'Post draft updated.' ) . $preview_post_link_html,
142
+	 5 => isset($_GET['revision']) ? sprintf(__('Post restored to revision from %s.'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
143
+	 6 => __('Post published.').$view_post_link_html,
144
+	 7 => __('Post saved.'),
145
+	 8 => __('Post submitted.').$preview_post_link_html,
146
+	 9 => sprintf(__('Post scheduled for: %s.'), '<strong>'.$scheduled_date.'</strong>').$scheduled_post_link_html,
147
+	10 => __('Post draft updated.').$preview_post_link_html,
148 148
 );
149 149
 $messages['page'] = array(
150 150
 	 0 => '', // Unused. Messages start at index 1.
151
-	 1 => __( 'Page updated.' ) . $view_page_link_html,
152
-	 2 => __( 'Custom field updated.' ),
153
-	 3 => __( 'Custom field deleted.' ),
154
-	 4 => __( 'Page updated.' ),
151
+	 1 => __('Page updated.').$view_page_link_html,
152
+	 2 => __('Custom field updated.'),
153
+	 3 => __('Custom field deleted.'),
154
+	 4 => __('Page updated.'),
155 155
 	/* translators: %s: date and time of the revision */
156
-	 5 => isset($_GET['revision']) ? sprintf( __( 'Page restored to revision from %s.' ), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
157
-	 6 => __( 'Page published.' ) . $view_page_link_html,
158
-	 7 => __( 'Page saved.' ),
159
-	 8 => __( 'Page submitted.' ) . $preview_page_link_html,
160
-	 9 => sprintf( __( 'Page scheduled for: %s.' ), '<strong>' . $scheduled_date . '</strong>' ) . $scheduled_page_link_html,
161
-	10 => __( 'Page draft updated.' ) . $preview_page_link_html,
156
+	 5 => isset($_GET['revision']) ? sprintf(__('Page restored to revision from %s.'), wp_post_revision_title((int) $_GET['revision'], false)) : false,
157
+	 6 => __('Page published.').$view_page_link_html,
158
+	 7 => __('Page saved.'),
159
+	 8 => __('Page submitted.').$preview_page_link_html,
160
+	 9 => sprintf(__('Page scheduled for: %s.'), '<strong>'.$scheduled_date.'</strong>').$scheduled_page_link_html,
161
+	10 => __('Page draft updated.').$preview_page_link_html,
162 162
 );
163
-$messages['attachment'] = array_fill( 1, 10, __( 'Media file updated.' ) ); // Hack, for now.
163
+$messages['attachment'] = array_fill(1, 10, __('Media file updated.')); // Hack, for now.
164 164
 
165 165
 /**
166 166
  * Filter the post updated messages.
@@ -169,109 +169,109 @@  discard block
 block discarded – undo
169 169
  *
170 170
  * @param array $messages Post updated messages. For defaults @see $messages declarations above.
171 171
  */
172
-$messages = apply_filters( 'post_updated_messages', $messages );
172
+$messages = apply_filters('post_updated_messages', $messages);
173 173
 
174 174
 $message = false;
175
-if ( isset($_GET['message']) ) {
176
-	$_GET['message'] = absint( $_GET['message'] );
177
-	if ( isset($messages[$post_type][$_GET['message']]) )
175
+if (isset($_GET['message'])) {
176
+	$_GET['message'] = absint($_GET['message']);
177
+	if (isset($messages[$post_type][$_GET['message']]))
178 178
 		$message = $messages[$post_type][$_GET['message']];
179
-	elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
179
+	elseif ( ! isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]))
180 180
 		$message = $messages['post'][$_GET['message']];
181 181
 }
182 182
 
183 183
 $notice = false;
184 184
 $form_extra = '';
185
-if ( 'auto-draft' == $post->post_status ) {
186
-	if ( 'edit' == $action )
185
+if ('auto-draft' == $post->post_status) {
186
+	if ('edit' == $action)
187 187
 		$post->post_title = '';
188 188
 	$autosave = false;
189 189
 	$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
190 190
 } else {
191
-	$autosave = wp_get_post_autosave( $post_ID );
191
+	$autosave = wp_get_post_autosave($post_ID);
192 192
 }
193 193
 
194 194
 $form_action = 'editpost';
195
-$nonce_action = 'update-post_' . $post_ID;
196
-$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='" . esc_attr($post_ID) . "' />";
195
+$nonce_action = 'update-post_'.$post_ID;
196
+$form_extra .= "<input type='hidden' id='post_ID' name='post_ID' value='".esc_attr($post_ID)."' />";
197 197
 
198 198
 // Detect if there exists an autosave newer than the post and if that autosave is different than the post
199
-if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt, false ) > mysql2date( 'U', $post->post_modified_gmt, false ) ) {
200
-	foreach ( _wp_post_revision_fields( $post ) as $autosave_field => $_autosave_field ) {
201
-		if ( normalize_whitespace( $autosave->$autosave_field ) != normalize_whitespace( $post->$autosave_field ) ) {
202
-			$notice = sprintf( __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>' ), get_edit_post_link( $autosave->ID ) );
199
+if ($autosave && mysql2date('U', $autosave->post_modified_gmt, false) > mysql2date('U', $post->post_modified_gmt, false)) {
200
+	foreach (_wp_post_revision_fields($post) as $autosave_field => $_autosave_field) {
201
+		if (normalize_whitespace($autosave->$autosave_field) != normalize_whitespace($post->$autosave_field)) {
202
+			$notice = sprintf(__('There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>'), get_edit_post_link($autosave->ID));
203 203
 			break;
204 204
 		}
205 205
 	}
206 206
 	// If this autosave isn't different from the current post, begone.
207
-	if ( ! $notice )
208
-		wp_delete_post_revision( $autosave->ID );
207
+	if ( ! $notice)
208
+		wp_delete_post_revision($autosave->ID);
209 209
 	unset($autosave_field, $_autosave_field);
210 210
 }
211 211
 
212 212
 $post_type_object = get_post_type_object($post_type);
213 213
 
214 214
 // All meta boxes should be defined and added before the first do_meta_boxes() call (or potentially during the do_meta_boxes action).
215
-require_once( ABSPATH . 'wp-admin/includes/meta-boxes.php' );
215
+require_once(ABSPATH.'wp-admin/includes/meta-boxes.php');
216 216
 
217 217
 
218 218
 $publish_callback_args = null;
219
-if ( post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status ) {
220
-	$revisions = wp_get_post_revisions( $post_ID );
219
+if (post_type_supports($post_type, 'revisions') && 'auto-draft' != $post->post_status) {
220
+	$revisions = wp_get_post_revisions($post_ID);
221 221
 
222 222
 	// We should aim to show the revisions metabox only when there are revisions.
223
-	if ( count( $revisions ) > 1 ) {
224
-		reset( $revisions ); // Reset pointer for key()
225
-		$publish_callback_args = array( 'revisions_count' => count( $revisions ), 'revision_id' => key( $revisions ) );
223
+	if (count($revisions) > 1) {
224
+		reset($revisions); // Reset pointer for key()
225
+		$publish_callback_args = array('revisions_count' => count($revisions), 'revision_id' => key($revisions));
226 226
 		add_meta_box('revisionsdiv', __('Revisions'), 'post_revisions_meta_box', null, 'normal', 'core');
227 227
 	}
228 228
 }
229 229
 
230
-if ( 'attachment' == $post_type ) {
231
-	wp_enqueue_script( 'image-edit' );
232
-	wp_enqueue_style( 'imgareaselect' );
233
-	add_meta_box( 'submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core' );
234
-	add_action( 'edit_form_after_title', 'edit_form_image_editor' );
230
+if ('attachment' == $post_type) {
231
+	wp_enqueue_script('image-edit');
232
+	wp_enqueue_style('imgareaselect');
233
+	add_meta_box('submitdiv', __('Save'), 'attachment_submit_meta_box', null, 'side', 'core');
234
+	add_action('edit_form_after_title', 'edit_form_image_editor');
235 235
 
236
-	if ( wp_attachment_is( 'audio', $post ) ) {
237
-		add_meta_box( 'attachment-id3', __( 'Metadata' ), 'attachment_id3_data_meta_box', null, 'normal', 'core' );
236
+	if (wp_attachment_is('audio', $post)) {
237
+		add_meta_box('attachment-id3', __('Metadata'), 'attachment_id3_data_meta_box', null, 'normal', 'core');
238 238
 	}
239 239
 } else {
240
-	add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
240
+	add_meta_box('submitdiv', __('Publish'), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args);
241 241
 }
242 242
 
243
-if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
244
-	add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );
243
+if (current_theme_supports('post-formats') && post_type_supports($post_type, 'post-formats'))
244
+	add_meta_box('formatdiv', _x('Format', 'post format'), 'post_format_meta_box', null, 'side', 'core');
245 245
 
246 246
 // all taxonomies
247
-foreach ( get_object_taxonomies( $post ) as $tax_name ) {
248
-	$taxonomy = get_taxonomy( $tax_name );
249
-	if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb )
247
+foreach (get_object_taxonomies($post) as $tax_name) {
248
+	$taxonomy = get_taxonomy($tax_name);
249
+	if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb)
250 250
 		continue;
251 251
 
252 252
 	$label = $taxonomy->labels->name;
253 253
 
254
-	if ( ! is_taxonomy_hierarchical( $tax_name ) )
255
-		$tax_meta_box_id = 'tagsdiv-' . $tax_name;
254
+	if ( ! is_taxonomy_hierarchical($tax_name))
255
+		$tax_meta_box_id = 'tagsdiv-'.$tax_name;
256 256
 	else
257
-		$tax_meta_box_id = $tax_name . 'div';
257
+		$tax_meta_box_id = $tax_name.'div';
258 258
 
259
-	add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
259
+	add_meta_box($tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array('taxonomy' => $tax_name));
260 260
 }
261 261
 
262
-if ( post_type_supports($post_type, 'page-attributes') )
262
+if (post_type_supports($post_type, 'page-attributes'))
263 263
 	add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
264 264
 
265
-if ( $thumbnail_support && current_user_can( 'upload_files' ) )
266
-	add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low');
265
+if ($thumbnail_support && current_user_can('upload_files'))
266
+	add_meta_box('postimagediv', esc_html($post_type_object->labels->featured_image), 'post_thumbnail_meta_box', null, 'side', 'low');
267 267
 
268
-if ( post_type_supports($post_type, 'excerpt') )
268
+if (post_type_supports($post_type, 'excerpt'))
269 269
 	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
270 270
 
271
-if ( post_type_supports($post_type, 'trackbacks') )
271
+if (post_type_supports($post_type, 'trackbacks'))
272 272
 	add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
273 273
 
274
-if ( post_type_supports($post_type, 'custom-fields') )
274
+if (post_type_supports($post_type, 'custom-fields'))
275 275
 	add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
276 276
 
277 277
 /**
@@ -282,33 +282,33 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param WP_Post $post Post object.
284 284
  */
285
-do_action( 'dbx_post_advanced', $post );
285
+do_action('dbx_post_advanced', $post);
286 286
 
287 287
 // Allow the Discussion meta box to show up if the post type supports comments,
288 288
 // or if comments or pings are open.
289
-if ( comments_open( $post ) || pings_open( $post ) || post_type_supports( $post_type, 'comments' ) ) {
290
-	add_meta_box( 'commentstatusdiv', __( 'Discussion' ), 'post_comment_status_meta_box', null, 'normal', 'core' );
289
+if (comments_open($post) || pings_open($post) || post_type_supports($post_type, 'comments')) {
290
+	add_meta_box('commentstatusdiv', __('Discussion'), 'post_comment_status_meta_box', null, 'normal', 'core');
291 291
 }
292 292
 
293
-$stati = get_post_stati( array( 'public' => true ) );
294
-if ( empty( $stati ) ) {
295
-	$stati = array( 'publish' );
293
+$stati = get_post_stati(array('public' => true));
294
+if (empty($stati)) {
295
+	$stati = array('publish');
296 296
 }
297 297
 $stati[] = 'private';
298 298
 
299
-if ( in_array( get_post_status( $post ), $stati ) ) {
299
+if (in_array(get_post_status($post), $stati)) {
300 300
 	// If the post type support comments, or the post has comments, allow the
301 301
 	// Comments meta box.
302
-	if ( comments_open( $post ) || pings_open( $post ) || $post->comment_count > 0 || post_type_supports( $post_type, 'comments' ) ) {
303
-		add_meta_box( 'commentsdiv', __( 'Comments' ), 'post_comment_meta_box', null, 'normal', 'core' );
302
+	if (comments_open($post) || pings_open($post) || $post->comment_count > 0 || post_type_supports($post_type, 'comments')) {
303
+		add_meta_box('commentsdiv', __('Comments'), 'post_comment_meta_box', null, 'normal', 'core');
304 304
 	}
305 305
 }
306 306
 
307
-if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
307
+if ( ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts)))
308 308
 	add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
309 309
 
310
-if ( post_type_supports($post_type, 'author') ) {
311
-	if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
310
+if (post_type_supports($post_type, 'author')) {
311
+	if (is_super_admin() || current_user_can($post_type_object->cap->edit_others_posts))
312 312
 		add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
313 313
 }
314 314
 
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
  * @param string  $post_type Post type.
321 321
  * @param WP_Post $post      Post object.
322 322
  */
323
-do_action( 'add_meta_boxes', $post_type, $post );
323
+do_action('add_meta_boxes', $post_type, $post);
324 324
 
325 325
 /**
326 326
  * Fires after all built-in meta boxes have been added, contextually for the given post type.
@@ -331,7 +331,7 @@  discard block
 block discarded – undo
331 331
  *
332 332
  * @param WP_Post $post Post object.
333 333
  */
334
-do_action( 'add_meta_boxes_' . $post_type, $post );
334
+do_action('add_meta_boxes_'.$post_type, $post);
335 335
 
336 336
 /**
337 337
  * Fires after meta boxes have been added.
@@ -344,149 +344,149 @@  discard block
 block discarded – undo
344 344
  * @param string  $context   string  Meta box context.
345 345
  * @param WP_Post $post      Post object.
346 346
  */
347
-do_action( 'do_meta_boxes', $post_type, 'normal', $post );
347
+do_action('do_meta_boxes', $post_type, 'normal', $post);
348 348
 /** This action is documented in wp-admin/edit-form-advanced.php */
349
-do_action( 'do_meta_boxes', $post_type, 'advanced', $post );
349
+do_action('do_meta_boxes', $post_type, 'advanced', $post);
350 350
 /** This action is documented in wp-admin/edit-form-advanced.php */
351
-do_action( 'do_meta_boxes', $post_type, 'side', $post );
351
+do_action('do_meta_boxes', $post_type, 'side', $post);
352 352
 
353
-add_screen_option('layout_columns', array('max' => 2, 'default' => 2) );
353
+add_screen_option('layout_columns', array('max' => 2, 'default' => 2));
354 354
 
355
-if ( 'post' == $post_type ) {
356
-	$customize_display = '<p>' . __('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.') . '</p>';
355
+if ('post' == $post_type) {
356
+	$customize_display = '<p>'.__('The title field and the big Post Editing Area are fixed in place, but you can reposition all the other boxes using drag and drop. You can also minimize or expand them by clicking the title bar of each box. Use the Screen Options tab to unhide more boxes (Excerpt, Send Trackbacks, Custom Fields, Discussion, Slug, Author) or to choose a 1- or 2-column layout for this screen.').'</p>';
357 357
 
358
-	get_current_screen()->add_help_tab( array(
358
+	get_current_screen()->add_help_tab(array(
359 359
 		'id'      => 'customize-display',
360 360
 		'title'   => __('Customizing This Display'),
361 361
 		'content' => $customize_display,
362
-	) );
362
+	));
363 363
 
364
-	$title_and_editor  = '<p>' . __('<strong>Title</strong> &mdash; Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.') . '</p>';
365
-	$title_and_editor .= '<p>' . __( '<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.' ) . '</p>';
366
-	$title_and_editor .= '<p>' . __( 'Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls. ') . '</p>';
367
-	$title_and_editor .= '<p>' . __( 'The Text mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.' ) . '</p>';
368
-	$title_and_editor .= '<p>' . __( 'You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.' ) . '</p>';
369
-	$title_and_editor .= '<p>' . __( 'You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.' ) . '</p>';
370
-	$title_and_editor .= '<p>' . __( 'Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.' ) . '</p>';
364
+	$title_and_editor  = '<p>'.__('<strong>Title</strong> &mdash; Enter a title for your post. After you enter a title, you&#8217;ll see the permalink below, which you can edit.').'</p>';
365
+	$title_and_editor .= '<p>'.__('<strong>Post editor</strong> &mdash; Enter the text for your post. There are two modes of editing: Visual and Text. Choose the mode by clicking on the appropriate tab.').'</p>';
366
+	$title_and_editor .= '<p>'.__('Visual mode gives you an editor that is similar to a word processor. Click the Toolbar Toggle button to get a second row of controls. ').'</p>';
367
+	$title_and_editor .= '<p>'.__('The Text mode allows you to enter HTML along with your post text. Note that &lt;p&gt; and &lt;br&gt; tags are converted to line breaks when switching to the Text editor to make it less cluttered. When you type, a single line break can be used instead of typing &lt;br&gt;, and two line breaks instead of paragraph tags. The line breaks are converted back to tags automatically.').'</p>';
368
+	$title_and_editor .= '<p>'.__('You can insert media files by clicking the icons above the post editor and following the directions. You can align or edit images using the inline formatting toolbar available in Visual mode.').'</p>';
369
+	$title_and_editor .= '<p>'.__('You can enable distraction-free writing mode using the icon to the right. This feature is not available for old browsers or devices with small screens, and requires that the full-height editor be enabled in Screen Options.').'</p>';
370
+	$title_and_editor .= '<p>'.__('Keyboard users: When you&#8217;re working in the visual editor, you can use <kbd>Alt + F10</kbd> to access the toolbar.').'</p>';
371 371
 
372
-	get_current_screen()->add_help_tab( array(
372
+	get_current_screen()->add_help_tab(array(
373 373
 		'id'      => 'title-post-editor',
374 374
 		'title'   => __('Title and Post Editor'),
375 375
 		'content' => $title_and_editor,
376
-	) );
376
+	));
377 377
 
378 378
 	get_current_screen()->set_help_sidebar(
379
-			'<p>' . sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php') . '</p>' .
380
-			'<p><strong>' . __('For more information:') . '</strong></p>' .
381
-			'<p>' . __('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>') . '</p>' .
382
-			'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
379
+			'<p>'.sprintf(__('You can also create posts with the <a href="%s">Press This bookmarklet</a>.'), 'tools.php').'</p>'.
380
+			'<p><strong>'.__('For more information:').'</strong></p>'.
381
+			'<p>'.__('<a href="https://codex.wordpress.org/Posts_Add_New_Screen" target="_blank">Documentation on Writing and Editing Posts</a>').'</p>'.
382
+			'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
383 383
 	);
384
-} elseif ( 'page' == $post_type ) {
385
-	$about_pages = '<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.') . '</p>' .
386
-		'<p>' . __('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.') . '</p>';
384
+} elseif ('page' == $post_type) {
385
+	$about_pages = '<p>'.__('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.').'</p>'.
386
+		'<p>'.__('Creating a Page is very similar to creating a Post, and the screens can be customized in the same way using drag and drop, the Screen Options tab, and expanding/collapsing boxes as you choose. This screen also has the distraction-free writing space, available in both the Visual and Text modes via the Fullscreen buttons. The Page editor mostly works the same as the Post editor, but there are some Page-specific features in the Page Attributes box.').'</p>';
387 387
 
388
-	get_current_screen()->add_help_tab( array(
388
+	get_current_screen()->add_help_tab(array(
389 389
 		'id'      => 'about-pages',
390 390
 		'title'   => __('About Pages'),
391 391
 		'content' => $about_pages,
392
-	) );
392
+	));
393 393
 
394 394
 	get_current_screen()->set_help_sidebar(
395
-			'<p><strong>' . __('For more information:') . '</strong></p>' .
396
-			'<p>' . __('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>') . '</p>' .
397
-			'<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>') . '</p>' .
398
-			'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
395
+			'<p><strong>'.__('For more information:').'</strong></p>'.
396
+			'<p>'.__('<a href="https://codex.wordpress.org/Pages_Add_New_Screen" target="_blank">Documentation on Adding New Pages</a>').'</p>'.
397
+			'<p>'.__('<a href="https://codex.wordpress.org/Pages_Screen#Editing_Individual_Pages" target="_blank">Documentation on Editing Pages</a>').'</p>'.
398
+			'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
399 399
 	);
400
-} elseif ( 'attachment' == $post_type ) {
401
-	get_current_screen()->add_help_tab( array(
400
+} elseif ('attachment' == $post_type) {
401
+	get_current_screen()->add_help_tab(array(
402 402
 		'id'      => 'overview',
403 403
 		'title'   => __('Overview'),
404 404
 		'content' =>
405
-			'<p>' . __('This screen allows you to edit four fields for metadata in a file within the media library.') . '</p>' .
406
-			'<p>' . __('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.') . '</p>' .
407
-			'<p>' . __('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.') . '</p>' .
408
-			'<p>' . __('Remember to click Update Media to save metadata entered or changed.') . '</p>'
409
-	) );
405
+			'<p>'.__('This screen allows you to edit four fields for metadata in a file within the media library.').'</p>'.
406
+			'<p>'.__('For images only, you can click on Edit Image under the thumbnail to expand out an inline image editor with icons for cropping, rotating, or flipping the image as well as for undoing and redoing. The boxes on the right give you more options for scaling the image, for cropping it, and for cropping the thumbnail in a different way than you crop the original image. You can click on Help in those boxes to get more information.').'</p>'.
407
+			'<p>'.__('Note that you crop the image by clicking on it (the Crop icon is already selected) and dragging the cropping frame to select the desired part. Then click Save to retain the cropping.').'</p>'.
408
+			'<p>'.__('Remember to click Update Media to save metadata entered or changed.').'</p>'
409
+	));
410 410
 
411 411
 	get_current_screen()->set_help_sidebar(
412
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
413
-	'<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>') . '</p>' .
414
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
412
+	'<p><strong>'.__('For more information:').'</strong></p>'.
413
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen#Edit_Media" target="_blank">Documentation on Edit Media</a>').'</p>'.
414
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
415 415
 	);
416 416
 }
417 417
 
418
-if ( 'post' == $post_type || 'page' == $post_type ) {
419
-	$inserting_media = '<p>' . __( 'You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the &#8220;Create a new gallery&#8221; button.' ) . '</p>';
420
-	$inserting_media .= '<p>' . __( 'You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.' ) . '</p>';
418
+if ('post' == $post_type || 'page' == $post_type) {
419
+	$inserting_media = '<p>'.__('You can upload and insert media (images, audio, documents, etc.) by clicking the Add Media button. You can select from the images and files already uploaded to the Media Library, or upload new media to add to your page or post. To create an image gallery, select the images to add and click the &#8220;Create a new gallery&#8221; button.').'</p>';
420
+	$inserting_media .= '<p>'.__('You can also embed media from many popular websites including Twitter, YouTube, Flickr and others by pasting the media URL on its own line into the content of your post/page. Please refer to the Codex to <a href="https://codex.wordpress.org/Embeds">learn more about embeds</a>.').'</p>';
421 421
 
422
-	get_current_screen()->add_help_tab( array(
422
+	get_current_screen()->add_help_tab(array(
423 423
 		'id'		=> 'inserting-media',
424
-		'title'		=> __( 'Inserting Media' ),
424
+		'title'		=> __('Inserting Media'),
425 425
 		'content' 	=> $inserting_media,
426
-	) );
426
+	));
427 427
 }
428 428
 
429
-if ( 'post' == $post_type ) {
430
-	$publish_box = '<p>' . __('Several boxes on this screen contain settings for how your content will be published, including:') . '</p>';
431
-	$publish_box .= '<ul><li>' .
432
-		__( '<strong>Publish</strong> &mdash; You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.' ) .
429
+if ('post' == $post_type) {
430
+	$publish_box = '<p>'.__('Several boxes on this screen contain settings for how your content will be published, including:').'</p>';
431
+	$publish_box .= '<ul><li>'.
432
+		__('<strong>Publish</strong> &mdash; You can set the terms of publishing your post in the Publish box. For Status, Visibility, and Publish (immediately), click on the Edit link to reveal more options. Visibility includes options for password-protecting a post or making it stay at the top of your blog indefinitely (sticky). The Password protected option allows you to set an arbitrary password for each post. The Private option hides the post from everyone except editors and administrators. Publish (immediately) allows you to set a future or past date and time, so you can schedule a post to be published in the future or backdate a post.').
433 433
 	'</li>';
434 434
 
435
-	if ( current_theme_supports( 'post-formats' ) && post_type_supports( 'post', 'post-formats' ) ) {
436
-		$publish_box .= '<li>' . __( '<strong>Format</strong> &mdash; Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.' ) . '</li>';
435
+	if (current_theme_supports('post-formats') && post_type_supports('post', 'post-formats')) {
436
+		$publish_box .= '<li>'.__('<strong>Format</strong> &mdash; Post Formats designate how your theme will display a specific post. For example, you could have a <em>standard</em> blog post with a title and paragraphs, or a short <em>aside</em> that omits the title and contains a short text blurb. Please refer to the Codex for <a href="https://codex.wordpress.org/Post_Formats#Supported_Formats">descriptions of each post format</a>. Your theme could enable all or some of 10 possible formats.').'</li>';
437 437
 	}
438 438
 
439
-	if ( current_theme_supports( 'post-thumbnails' ) && post_type_supports( 'post', 'thumbnail' ) ) {
439
+	if (current_theme_supports('post-thumbnails') && post_type_supports('post', 'thumbnail')) {
440 440
 		/* translators: %s: Featured Image */
441
-		$publish_box .= '<li>' . sprintf( __( '<strong>%s</strong> &mdash; This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.' ), esc_html( $post_type_object->labels->featured_image ) ) . '</li>';
441
+		$publish_box .= '<li>'.sprintf(__('<strong>%s</strong> &mdash; This allows you to associate an image with your post without inserting it. This is usually useful only if your theme makes use of the image as a post thumbnail on the home page, a custom header, etc.'), esc_html($post_type_object->labels->featured_image)).'</li>';
442 442
 	}
443 443
 
444 444
 	$publish_box .= '</ul>';
445 445
 
446
-	get_current_screen()->add_help_tab( array(
446
+	get_current_screen()->add_help_tab(array(
447 447
 		'id'      => 'publish-box',
448 448
 		'title'   => __('Publish Settings'),
449 449
 		'content' => $publish_box,
450
-	) );
450
+	));
451 451
 
452
-	$discussion_settings  = '<p>' . __('<strong>Send Trackbacks</strong> &mdash; Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.') . '</p>';
453
-	$discussion_settings .= '<p>' . __('<strong>Discussion</strong> &mdash; You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.') . '</p>';
452
+	$discussion_settings  = '<p>'.__('<strong>Send Trackbacks</strong> &mdash; Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. Enter the URL(s) you want to send trackbacks. If you link to other WordPress sites they&#8217;ll be notified automatically using pingbacks, and this field is unnecessary.').'</p>';
453
+	$discussion_settings .= '<p>'.__('<strong>Discussion</strong> &mdash; You can turn comments and pings on or off, and if there are comments on the post, you can see them here and moderate them.').'</p>';
454 454
 
455
-	get_current_screen()->add_help_tab( array(
455
+	get_current_screen()->add_help_tab(array(
456 456
 		'id'      => 'discussion-settings',
457 457
 		'title'   => __('Discussion Settings'),
458 458
 		'content' => $discussion_settings,
459
-	) );
460
-} elseif ( 'page' == $post_type ) {
461
-	$page_attributes = '<p>' . __('<strong>Parent</strong> &mdash; You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.') . '</p>' .
462
-		'<p>' . __('<strong>Template</strong> &mdash; Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.') . '</p>' .
463
-		'<p>' . __('<strong>Order</strong> &mdash; Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.') . '</p>';
459
+	));
460
+} elseif ('page' == $post_type) {
461
+	$page_attributes = '<p>'.__('<strong>Parent</strong> &mdash; You can arrange your pages in hierarchies. For example, you could have an &#8220;About&#8221; page that has &#8220;Life Story&#8221; and &#8220;My Dog&#8221; pages under it. There are no limits to how many levels you can nest pages.').'</p>'.
462
+		'<p>'.__('<strong>Template</strong> &mdash; Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you&#8217;ll see them in this dropdown menu.').'</p>'.
463
+		'<p>'.__('<strong>Order</strong> &mdash; Pages are usually ordered alphabetically, but you can choose your own order by entering a number (1 for first, etc.) in this field.').'</p>';
464 464
 
465
-	get_current_screen()->add_help_tab( array(
465
+	get_current_screen()->add_help_tab(array(
466 466
 		'id' => 'page-attributes',
467 467
 		'title' => __('Page Attributes'),
468 468
 		'content' => $page_attributes,
469
-	) );
469
+	));
470 470
 }
471 471
 
472
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
472
+require_once(ABSPATH.'wp-admin/admin-header.php');
473 473
 ?>
474 474
 
475 475
 <div class="wrap">
476 476
 <h1><?php
477
-echo esc_html( $title );
478
-if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) )
479
-	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
477
+echo esc_html($title);
478
+if (isset($post_new_file) && current_user_can($post_type_object->cap->create_posts))
479
+	echo ' <a href="'.esc_url(admin_url($post_new_file)).'" class="page-title-action">'.esc_html($post_type_object->labels->add_new).'</a>';
480 480
 ?></h1>
481
-<?php if ( $notice ) : ?>
481
+<?php if ($notice) : ?>
482 482
 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
483 483
 <?php endif; ?>
484
-<?php if ( $message ) : ?>
484
+<?php if ($message) : ?>
485 485
 <div id="message" class="updated notice notice-success is-dismissible"><p><?php echo $message; ?></p></div>
486 486
 <?php endif; ?>
487 487
 <div id="lost-connection-notice" class="error hidden">
488
-	<p><span class="spinner"></span> <?php _e( '<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.' ); ?>
489
-	<span class="hide-if-no-sessionstorage"><?php _e( 'We&#8217;re backing up this post in your browser, just in case.' ); ?></span>
488
+	<p><span class="spinner"></span> <?php _e('<strong>Connection lost.</strong> Saving has been disabled until you&#8217;re reconnected.'); ?>
489
+	<span class="hide-if-no-sessionstorage"><?php _e('We&#8217;re backing up this post in your browser, just in case.'); ?></span>
490 490
 	</p>
491 491
 </div>
492 492
 <form name="post" action="post.php" method="post" id="post"<?php
@@ -497,29 +497,29 @@  discard block
 block discarded – undo
497 497
  *
498 498
  * @param WP_Post $post Post object.
499 499
  */
500
-do_action( 'post_edit_form_tag', $post );
500
+do_action('post_edit_form_tag', $post);
501 501
 
502 502
 $referer = wp_get_referer();
503 503
 ?>>
504 504
 <?php wp_nonce_field($nonce_action); ?>
505 505
 <input type="hidden" id="user-id" name="user_ID" value="<?php echo (int) $user_ID ?>" />
506
-<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr( $form_action ) ?>" />
507
-<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr( $form_action ) ?>" />
508
-<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
509
-<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr( $post_type ) ?>" />
510
-<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr( $post->post_status) ?>" />
511
-<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url( $referer ) : ''; ?>" />
512
-<?php if ( ! empty( $active_post_lock ) ) { ?>
513
-<input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
506
+<input type="hidden" id="hiddenaction" name="action" value="<?php echo esc_attr($form_action) ?>" />
507
+<input type="hidden" id="originalaction" name="originalaction" value="<?php echo esc_attr($form_action) ?>" />
508
+<input type="hidden" id="post_author" name="post_author" value="<?php echo esc_attr($post->post_author); ?>" />
509
+<input type="hidden" id="post_type" name="post_type" value="<?php echo esc_attr($post_type) ?>" />
510
+<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo esc_attr($post->post_status) ?>" />
511
+<input type="hidden" id="referredby" name="referredby" value="<?php echo $referer ? esc_url($referer) : ''; ?>" />
512
+<?php if ( ! empty($active_post_lock)) { ?>
513
+<input type="hidden" id="active_post_lock" value="<?php echo esc_attr(implode(':', $active_post_lock)); ?>" />
514 514
 <?php
515 515
 }
516
-if ( 'draft' != get_post_status( $post ) )
516
+if ('draft' != get_post_status($post))
517 517
 	wp_original_referer_field(true, 'previous');
518 518
 
519 519
 echo $form_extra;
520 520
 
521
-wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
522
-wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
521
+wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
522
+wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
523 523
 ?>
524 524
 
525 525
 <?php
@@ -532,13 +532,13 @@  discard block
 block discarded – undo
532 532
  *
533 533
  * @param WP_Post $post Post object.
534 534
  */
535
-do_action( 'edit_form_top', $post ); ?>
535
+do_action('edit_form_top', $post); ?>
536 536
 
537 537
 <div id="poststuff">
538 538
 <div id="post-body" class="metabox-holder columns-<?php echo 1 == get_current_screen()->get_columns() ? '1' : '2'; ?>">
539 539
 <div id="post-body-content">
540 540
 
541
-<?php if ( post_type_supports($post_type, 'title') ) { ?>
541
+<?php if (post_type_supports($post_type, 'title')) { ?>
542 542
 <div id="titlediv">
543 543
 <div id="titlewrap">
544 544
 	<?php
@@ -550,10 +550,10 @@  discard block
 block discarded – undo
550 550
 	 * @param string  $text Placeholder text. Default 'Enter title here'.
551 551
 	 * @param WP_Post $post Post object.
552 552
 	 */
553
-	$title_placeholder = apply_filters( 'enter_title_here', __( 'Enter title here' ), $post );
553
+	$title_placeholder = apply_filters('enter_title_here', __('Enter title here'), $post);
554 554
 	?>
555 555
 	<label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo $title_placeholder; ?></label>
556
-	<input type="text" name="post_title" size="30" value="<?php echo esc_attr( $post->post_title ); ?>" id="title" spellcheck="true" autocomplete="off" />
556
+	<input type="text" name="post_title" size="30" value="<?php echo esc_attr($post->post_title); ?>" id="title" spellcheck="true" autocomplete="off" />
557 557
 </div>
558 558
 <?php
559 559
 /**
@@ -563,28 +563,28 @@  discard block
 block discarded – undo
563 563
  *
564 564
  * @param WP_Post $post Post object.
565 565
  */
566
-do_action( 'edit_form_before_permalink', $post );
566
+do_action('edit_form_before_permalink', $post);
567 567
 ?>
568 568
 <div class="inside">
569 569
 <?php
570
-if ( $viewable ) :
570
+if ($viewable) :
571 571
 $sample_permalink_html = $post_type_object->public ? get_sample_permalink_html($post->ID) : '';
572 572
 
573 573
 // As of 4.4, the Get Shortlink button is hidden by default.
574
-if ( has_filter( 'pre_get_shortlink' ) || has_filter( 'get_shortlink' ) ) {
574
+if (has_filter('pre_get_shortlink') || has_filter('get_shortlink')) {
575 575
 	$shortlink = wp_get_shortlink($post->ID, 'post');
576 576
 
577
-	if ( !empty( $shortlink ) && $shortlink !== $permalink && $permalink !== home_url('?page_id=' . $post->ID) ) {
578
-    	$sample_permalink_html .= '<input id="shortlink" type="hidden" value="' . esc_attr($shortlink) . '" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">' . __('Get Shortlink') . '</a>';
577
+	if ( ! empty($shortlink) && $shortlink !== $permalink && $permalink !== home_url('?page_id='.$post->ID)) {
578
+    	$sample_permalink_html .= '<input id="shortlink" type="hidden" value="'.esc_attr($shortlink).'" /><a href="#" class="button button-small" onclick="prompt(&#39;URL:&#39;, jQuery(\'#shortlink\').val()); return false;">'.__('Get Shortlink').'</a>';
579 579
 	}
580 580
 }
581 581
 
582
-if ( $post_type_object->public && ! ( 'pending' == get_post_status( $post ) && !current_user_can( $post_type_object->cap->publish_posts ) ) ) {
582
+if ($post_type_object->public && ! ('pending' == get_post_status($post) && ! current_user_can($post_type_object->cap->publish_posts))) {
583 583
 	$has_sample_permalink = $sample_permalink_html && 'auto-draft' != $post->post_status;
584 584
 ?>
585 585
 	<div id="edit-slug-box" class="hide-if-no-js">
586 586
 	<?php
587
-		if ( $has_sample_permalink )
587
+		if ($has_sample_permalink)
588 588
 			echo $sample_permalink_html;
589 589
 	?>
590 590
 	</div>
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 ?>
595 595
 </div>
596 596
 <?php
597
-wp_nonce_field( 'samplepermalink', 'samplepermalinknonce', false );
597
+wp_nonce_field('samplepermalink', 'samplepermalinknonce', false);
598 598
 ?>
599 599
 </div><!-- /titlediv -->
600 600
 <?php
@@ -606,13 +606,13 @@  discard block
 block discarded – undo
606 606
  *
607 607
  * @param WP_Post $post Post object.
608 608
  */
609
-do_action( 'edit_form_after_title', $post );
609
+do_action('edit_form_after_title', $post);
610 610
 
611
-if ( post_type_supports($post_type, 'editor') ) {
611
+if (post_type_supports($post_type, 'editor')) {
612 612
 ?>
613
-<div id="postdivrich" class="postarea<?php if ( $_wp_editor_expand ) { echo ' wp-editor-expand'; } ?>">
613
+<div id="postdivrich" class="postarea<?php if ($_wp_editor_expand) { echo ' wp-editor-expand'; } ?>">
614 614
 
615
-<?php wp_editor( $post->post_content, 'content', array(
615
+<?php wp_editor($post->post_content, 'content', array(
616 616
 	'_content_editor_dfw' => $_content_editor_dfw,
617 617
 	'drag_drop_upload' => true,
618 618
 	'tabfocus_elements' => 'content-html,save-post',
@@ -622,18 +622,18 @@  discard block
 block discarded – undo
622 622
 		'wp_autoresize_on' => $_wp_editor_expand,
623 623
 		'add_unload_trigger' => false,
624 624
 	),
625
-) ); ?>
625
+)); ?>
626 626
 <table id="post-status-info"><tbody><tr>
627
-	<td id="wp-word-count" class="hide-if-no-js"><?php printf( __( 'Word count: %s' ), '<span class="word-count">0</span>' ); ?></td>
627
+	<td id="wp-word-count" class="hide-if-no-js"><?php printf(__('Word count: %s'), '<span class="word-count">0</span>'); ?></td>
628 628
 	<td class="autosave-info">
629 629
 	<span class="autosave-message">&nbsp;</span>
630 630
 <?php
631
-	if ( 'auto-draft' != $post->post_status ) {
631
+	if ('auto-draft' != $post->post_status) {
632 632
 		echo '<span id="last-edit">';
633
-		if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) {
634
-			printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
633
+		if ($last_user = get_userdata(get_post_meta($post_ID, '_edit_last', true))) {
634
+			printf(__('Last edited by %1$s on %2$s at %3$s'), esc_html($last_user->display_name), mysql2date(__('F j, Y'), $post->post_modified), mysql2date(__('g:i a'), $post->post_modified));
635 635
 		} else {
636
-			printf( __( 'Last edited on %1$s at %2$s' ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) );
636
+			printf(__('Last edited on %1$s at %2$s'), mysql2date(__('F j, Y'), $post->post_modified), mysql2date(__('g:i a'), $post->post_modified));
637 637
 		}
638 638
 		echo '</span>';
639 639
 	} ?>
@@ -650,14 +650,14 @@  discard block
 block discarded – undo
650 650
  *
651 651
  * @param WP_Post $post Post object.
652 652
  */
653
-do_action( 'edit_form_after_editor', $post );
653
+do_action('edit_form_after_editor', $post);
654 654
 ?>
655 655
 </div><!-- /post-body-content -->
656 656
 
657 657
 <div id="postbox-container-1" class="postbox-container">
658 658
 <?php
659 659
 
660
-if ( 'page' == $post_type ) {
660
+if ('page' == $post_type) {
661 661
 	/**
662 662
 	 * Fires before meta boxes with 'side' context are output for the 'page' post type.
663 663
 	 *
@@ -667,7 +667,7 @@  discard block
 block discarded – undo
667 667
 	 *
668 668
 	 * @param WP_Post $post Post object.
669 669
 	 */
670
-	do_action( 'submitpage_box', $post );
670
+	do_action('submitpage_box', $post);
671 671
 }
672 672
 else {
673 673
 	/**
@@ -679,7 +679,7 @@  discard block
 block discarded – undo
679 679
 	 *
680 680
 	 * @param WP_Post $post Post object.
681 681
 	 */
682
-	do_action( 'submitpost_box', $post );
682
+	do_action('submitpost_box', $post);
683 683
 }
684 684
 
685 685
 
@@ -692,7 +692,7 @@  discard block
 block discarded – undo
692 692
 
693 693
 do_meta_boxes(null, 'normal', $post);
694 694
 
695
-if ( 'page' == $post_type ) {
695
+if ('page' == $post_type) {
696 696
 	/**
697 697
 	 * Fires after 'normal' context meta boxes have been output for the 'page' post type.
698 698
 	 *
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 	 *
701 701
 	 * @param WP_Post $post Post object.
702 702
 	 */
703
-	do_action( 'edit_page_form', $post );
703
+	do_action('edit_page_form', $post);
704 704
 }
705 705
 else {
706 706
 	/**
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 *
711 711
 	 * @param WP_Post $post Post object.
712 712
 	 */
713
-	do_action( 'edit_form_advanced', $post );
713
+	do_action('edit_form_advanced', $post);
714 714
 }
715 715
 
716 716
 
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
  *
727 727
  * @param WP_Post $post Post object.
728 728
  */
729
-do_action( 'dbx_post_sidebar', $post );
729
+do_action('dbx_post_sidebar', $post);
730 730
 
731 731
 ?>
732 732
 </div><!-- /post-body -->
@@ -736,11 +736,11 @@  discard block
 block discarded – undo
736 736
 </div>
737 737
 
738 738
 <?php
739
-if ( post_type_supports( $post_type, 'comments' ) )
739
+if (post_type_supports($post_type, 'comments'))
740 740
 	wp_comment_reply();
741 741
 ?>
742 742
 
743
-<?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
743
+<?php if ( ! wp_is_mobile() && post_type_supports($post_type, 'title') && '' === $post->post_title) : ?>
744 744
 <script type="text/javascript">
745 745
 try{document.post.title.focus();}catch(e){}
746 746
 </script>
Please login to merge, or discard this patch.
Braces   +53 added lines, -36 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // don't load directly
10
-if ( !defined('ABSPATH') )
10
+if ( !defined('ABSPATH') ) {
11 11
 	die('-1');
12
+}
12 13
 
13 14
 /**
14 15
  * @global string  $post_type
@@ -38,8 +39,9 @@  discard block
 block discarded – undo
38 39
 	$_wp_editor_expand = ( get_user_setting( 'editor_expand', 'on' ) === 'on' );
39 40
 }
40 41
 
41
-if ( wp_is_mobile() )
42
+if ( wp_is_mobile() ) {
42 43
 	wp_enqueue_script( 'jquery-touch-punch' );
44
+}
43 45
 
44 46
 /**
45 47
  * Post ID global
@@ -174,17 +176,19 @@  discard block
 block discarded – undo
174 176
 $message = false;
175 177
 if ( isset($_GET['message']) ) {
176 178
 	$_GET['message'] = absint( $_GET['message'] );
177
-	if ( isset($messages[$post_type][$_GET['message']]) )
178
-		$message = $messages[$post_type][$_GET['message']];
179
-	elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) )
180
-		$message = $messages['post'][$_GET['message']];
181
-}
179
+	if ( isset($messages[$post_type][$_GET['message']]) ) {
180
+			$message = $messages[$post_type][$_GET['message']];
181
+	} elseif ( !isset($messages[$post_type]) && isset($messages['post'][$_GET['message']]) ) {
182
+			$message = $messages['post'][$_GET['message']];
183
+	}
184
+	}
182 185
 
183 186
 $notice = false;
184 187
 $form_extra = '';
185 188
 if ( 'auto-draft' == $post->post_status ) {
186
-	if ( 'edit' == $action )
187
-		$post->post_title = '';
189
+	if ( 'edit' == $action ) {
190
+			$post->post_title = '';
191
+	}
188 192
 	$autosave = false;
189 193
 	$form_extra .= "<input type='hidden' id='auto_draft' name='auto_draft' value='1' />";
190 194
 } else {
@@ -204,8 +208,9 @@  discard block
 block discarded – undo
204 208
 		}
205 209
 	}
206 210
 	// If this autosave isn't different from the current post, begone.
207
-	if ( ! $notice )
208
-		wp_delete_post_revision( $autosave->ID );
211
+	if ( ! $notice ) {
212
+			wp_delete_post_revision( $autosave->ID );
213
+	}
209 214
 	unset($autosave_field, $_autosave_field);
210 215
 }
211 216
 
@@ -240,39 +245,47 @@  discard block
 block discarded – undo
240 245
 	add_meta_box( 'submitdiv', __( 'Publish' ), 'post_submit_meta_box', null, 'side', 'core', $publish_callback_args );
241 246
 }
242 247
 
243
-if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) )
248
+if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post_type, 'post-formats' ) ) {
244 249
 	add_meta_box( 'formatdiv', _x( 'Format', 'post format' ), 'post_format_meta_box', null, 'side', 'core' );
250
+}
245 251
 
246 252
 // all taxonomies
247 253
 foreach ( get_object_taxonomies( $post ) as $tax_name ) {
248 254
 	$taxonomy = get_taxonomy( $tax_name );
249
-	if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb )
250
-		continue;
255
+	if ( ! $taxonomy->show_ui || false === $taxonomy->meta_box_cb ) {
256
+			continue;
257
+	}
251 258
 
252 259
 	$label = $taxonomy->labels->name;
253 260
 
254
-	if ( ! is_taxonomy_hierarchical( $tax_name ) )
255
-		$tax_meta_box_id = 'tagsdiv-' . $tax_name;
256
-	else
257
-		$tax_meta_box_id = $tax_name . 'div';
261
+	if ( ! is_taxonomy_hierarchical( $tax_name ) ) {
262
+			$tax_meta_box_id = 'tagsdiv-' . $tax_name;
263
+	} else {
264
+			$tax_meta_box_id = $tax_name . 'div';
265
+	}
258 266
 
259 267
 	add_meta_box( $tax_meta_box_id, $label, $taxonomy->meta_box_cb, null, 'side', 'core', array( 'taxonomy' => $tax_name ) );
260 268
 }
261 269
 
262
-if ( post_type_supports($post_type, 'page-attributes') )
270
+if ( post_type_supports($post_type, 'page-attributes') ) {
263 271
 	add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
272
+}
264 273
 
265
-if ( $thumbnail_support && current_user_can( 'upload_files' ) )
274
+if ( $thumbnail_support && current_user_can( 'upload_files' ) ) {
266 275
 	add_meta_box('postimagediv', esc_html( $post_type_object->labels->featured_image ), 'post_thumbnail_meta_box', null, 'side', 'low');
276
+}
267 277
 
268
-if ( post_type_supports($post_type, 'excerpt') )
278
+if ( post_type_supports($post_type, 'excerpt') ) {
269 279
 	add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core');
280
+}
270 281
 
271
-if ( post_type_supports($post_type, 'trackbacks') )
282
+if ( post_type_supports($post_type, 'trackbacks') ) {
272 283
 	add_meta_box('trackbacksdiv', __('Send Trackbacks'), 'post_trackback_meta_box', null, 'normal', 'core');
284
+}
273 285
 
274
-if ( post_type_supports($post_type, 'custom-fields') )
286
+if ( post_type_supports($post_type, 'custom-fields') ) {
275 287
 	add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', null, 'normal', 'core');
288
+}
276 289
 
277 290
 /**
278 291
  * Fires in the middle of built-in meta box registration.
@@ -304,13 +317,15 @@  discard block
 block discarded – undo
304 317
 	}
305 318
 }
306 319
 
307
-if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) )
320
+if ( ! ( 'pending' == get_post_status( $post ) && ! current_user_can( $post_type_object->cap->publish_posts ) ) ) {
308 321
 	add_meta_box('slugdiv', __('Slug'), 'post_slug_meta_box', null, 'normal', 'core');
322
+}
309 323
 
310 324
 if ( post_type_supports($post_type, 'author') ) {
311
-	if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) )
312
-		add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
313
-}
325
+	if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) {
326
+			add_meta_box('authordiv', __('Author'), 'post_author_meta_box', null, 'normal', 'core');
327
+	}
328
+	}
314 329
 
315 330
 /**
316 331
  * Fires after all built-in meta boxes have been added.
@@ -475,8 +490,9 @@  discard block
 block discarded – undo
475 490
 <div class="wrap">
476 491
 <h1><?php
477 492
 echo esc_html( $title );
478
-if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) )
493
+if ( isset( $post_new_file ) && current_user_can( $post_type_object->cap->create_posts ) ) {
479 494
 	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
495
+}
480 496
 ?></h1>
481 497
 <?php if ( $notice ) : ?>
482 498
 <div id="notice" class="notice notice-warning"><p id="has-newer-autosave"><?php echo $notice ?></p></div>
@@ -513,8 +529,9 @@  discard block
 block discarded – undo
513 529
 <input type="hidden" id="active_post_lock" value="<?php echo esc_attr( implode( ':', $active_post_lock ) ); ?>" />
514 530
 <?php
515 531
 }
516
-if ( 'draft' != get_post_status( $post ) )
532
+if ( 'draft' != get_post_status( $post ) ) {
517 533
 	wp_original_referer_field(true, 'previous');
534
+}
518 535
 
519 536
 echo $form_extra;
520 537
 
@@ -584,8 +601,9 @@  discard block
 block discarded – undo
584 601
 ?>
585 602
 	<div id="edit-slug-box" class="hide-if-no-js">
586 603
 	<?php
587
-		if ( $has_sample_permalink )
588
-			echo $sample_permalink_html;
604
+		if ( $has_sample_permalink ) {
605
+					echo $sample_permalink_html;
606
+		}
589 607
 	?>
590 608
 	</div>
591 609
 <?php
@@ -668,8 +686,7 @@  discard block
 block discarded – undo
668 686
 	 * @param WP_Post $post Post object.
669 687
 	 */
670 688
 	do_action( 'submitpage_box', $post );
671
-}
672
-else {
689
+} else {
673 690
 	/**
674 691
 	 * Fires before meta boxes with 'side' context are output for all post types other than 'page'.
675 692
 	 *
@@ -701,8 +718,7 @@  discard block
 block discarded – undo
701 718
 	 * @param WP_Post $post Post object.
702 719
 	 */
703 720
 	do_action( 'edit_page_form', $post );
704
-}
705
-else {
721
+} else {
706 722
 	/**
707 723
 	 * Fires after 'normal' context meta boxes have been output for all post types other than 'page'.
708 724
 	 *
@@ -736,8 +752,9 @@  discard block
 block discarded – undo
736 752
 </div>
737 753
 
738 754
 <?php
739
-if ( post_type_supports( $post_type, 'comments' ) )
755
+if ( post_type_supports( $post_type, 'comments' ) ) {
740 756
 	wp_comment_reply();
757
+}
741 758
 ?>
742 759
 
743 760
 <?php if ( ! wp_is_mobile() && post_type_supports( $post_type, 'title' ) && '' === $post->post_title ) : ?>
Please login to merge, or discard this patch.