Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-admin/update.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Update/Install Plugin/Theme administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Update/Install Plugin/Theme administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
10 10
 	define( 'IFRAME_REQUEST', true );
Please login to merge, or discard this patch.
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -6,99 +6,99 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
10
-	define( 'IFRAME_REQUEST', true );
9
+if ( ! defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes')))
10
+	define('IFRAME_REQUEST', true);
11 11
 
12 12
 /** WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15
-include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
15
+include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
16 16
 
17
-if ( isset($_GET['action']) ) {
17
+if (isset($_GET['action'])) {
18 18
 	$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
19 19
 	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
20 20
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 21
 
22
-	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
22
+	if ('update-selected' == $action) {
23
+		if ( ! current_user_can('update_plugins'))
24
+			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
25 25
 
26
-		check_admin_referer( 'bulk-update-plugins' );
26
+		check_admin_referer('bulk-update-plugins');
27 27
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
28
+		if (isset($_GET['plugins']))
29
+			$plugins = explode(',', stripslashes($_GET['plugins']));
30
+		elseif (isset($_POST['checked']))
31 31
 			$plugins = (array) $_POST['checked'];
32 32
 		else
33 33
 			$plugins = array();
34 34
 
35 35
 		$plugins = array_map('urldecode', $plugins);
36 36
 
37
-		$url = 'update.php?action=update-selected&amp;plugins=' . urlencode(implode(',', $plugins));
37
+		$url = 'update.php?action=update-selected&amp;plugins='.urlencode(implode(',', $plugins));
38 38
 		$nonce = 'bulk-update-plugins';
39 39
 
40
-		wp_enqueue_script( 'updates' );
40
+		wp_enqueue_script('updates');
41 41
 		iframe_header();
42 42
 
43
-		$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
44
-		$upgrader->bulk_upgrade( $plugins );
43
+		$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
44
+		$upgrader->bulk_upgrade($plugins);
45 45
 
46 46
 		iframe_footer();
47 47
 
48
-	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
48
+	} elseif ('upgrade-plugin' == $action) {
49
+		if ( ! current_user_can('update_plugins'))
50 50
 			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
51 51
 
52
-		check_admin_referer('upgrade-plugin_' . $plugin);
52
+		check_admin_referer('upgrade-plugin_'.$plugin);
53 53
 
54 54
 		$title = __('Update Plugin');
55 55
 		$parent_file = 'plugins.php';
56 56
 		$submenu_file = 'plugins.php';
57 57
 
58
-		wp_enqueue_script( 'updates' );
59
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
58
+		wp_enqueue_script('updates');
59
+		require_once(ABSPATH.'wp-admin/admin-header.php');
60 60
 
61
-		$nonce = 'upgrade-plugin_' . $plugin;
62
-		$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
61
+		$nonce = 'upgrade-plugin_'.$plugin;
62
+		$url = 'update.php?action=upgrade-plugin&plugin='.urlencode($plugin);
63 63
 
64
-		$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
64
+		$upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin')));
65 65
 		$upgrader->upgrade($plugin);
66 66
 
67
-		include(ABSPATH . 'wp-admin/admin-footer.php');
67
+		include(ABSPATH.'wp-admin/admin-footer.php');
68 68
 
69
-	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
69
+	} elseif ('activate-plugin' == $action) {
70
+		if ( ! current_user_can('update_plugins'))
71 71
 			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
72 72
 
73
-		check_admin_referer('activate-plugin_' . $plugin);
74
-		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
75
-			wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
76
-			activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
77
-			wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
73
+		check_admin_referer('activate-plugin_'.$plugin);
74
+		if ( ! isset($_GET['failure']) && ! isset($_GET['success'])) {
75
+			wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
76
+			activate_plugin($plugin, '', ! empty($_GET['networkwide']), true);
77
+			wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
78 78
 			die();
79 79
 		}
80
-		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
80
+		iframe_header(__('Plugin Reactivation'), true);
81
+		if (isset($_GET['success']))
82
+			echo '<p>'.__('Plugin reactivated successfully.').'</p>';
83 83
 
84
-		if ( isset($_GET['failure']) ){
85
-			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
84
+		if (isset($_GET['failure'])) {
85
+			echo '<p>'.__('Plugin failed to reactivate due to a fatal error.').'</p>';
86 86
 
87
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
87
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
88 88
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
89
-			wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
90
-			include( WP_PLUGIN_DIR . '/' . $plugin );
89
+			wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin);
90
+			include(WP_PLUGIN_DIR.'/'.$plugin);
91 91
 		}
92 92
 		iframe_footer();
93
-	} elseif ( 'install-plugin' == $action ) {
93
+	} elseif ('install-plugin' == $action) {
94 94
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
95
+		if ( ! current_user_can('install_plugins'))
96
+			wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
97 97
 
98
-		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
98
+		include_once(ABSPATH.'wp-admin/includes/plugin-install.php'); //for plugins_api..
99 99
 
100
-		check_admin_referer( 'install-plugin_' . $plugin );
101
-		$api = plugins_api( 'plugin_information', array(
100
+		check_admin_referer('install-plugin_'.$plugin);
101
+		$api = plugins_api('plugin_information', array(
102 102
 			'slug' => $plugin,
103 103
 			'fields' => array(
104 104
 				'short_description' => false,
@@ -114,34 +114,34 @@  discard block
 block discarded – undo
114 114
 				'homepage' => false,
115 115
 				'donate_link' => false,
116 116
 			),
117
-		) );
117
+		));
118 118
 
119
-		if ( is_wp_error( $api ) ) {
120
-	 		wp_die( $api );
119
+		if (is_wp_error($api)) {
120
+	 		wp_die($api);
121 121
 		}
122 122
 
123 123
 		$title = __('Plugin Install');
124 124
 		$parent_file = 'plugins.php';
125 125
 		$submenu_file = 'plugin-install.php';
126
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
126
+		require_once(ABSPATH.'wp-admin/admin-header.php');
127 127
 
128
-		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129
-		$nonce = 'install-plugin_' . $plugin;
130
-		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
128
+		$title = sprintf(__('Installing Plugin: %s'), $api->name.' '.$api->version);
129
+		$nonce = 'install-plugin_'.$plugin;
130
+		$url = 'update.php?action=install-plugin&plugin='.urlencode($plugin);
131
+		if (isset($_GET['from']))
132
+			$url .= '&from='.urlencode(stripslashes($_GET['from']));
133 133
 
134 134
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 135
 
136
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
136
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
137 137
 		$upgrader->install($api->download_link);
138 138
 
139
-		include(ABSPATH . 'wp-admin/admin-footer.php');
139
+		include(ABSPATH.'wp-admin/admin-footer.php');
140 140
 
141
-	} elseif ( 'upload-plugin' == $action ) {
141
+	} elseif ('upload-plugin' == $action) {
142 142
 
143
-		if ( ! current_user_can( 'upload_plugins' ) ) {
144
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
143
+		if ( ! current_user_can('upload_plugins')) {
144
+			wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
145 145
 		}
146 146
 
147 147
 		check_admin_referer('plugin-upload');
@@ -151,128 +151,128 @@  discard block
 block discarded – undo
151 151
 		$title = __('Upload Plugin');
152 152
 		$parent_file = 'plugins.php';
153 153
 		$submenu_file = 'plugin-install.php';
154
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
154
+		require_once(ABSPATH.'wp-admin/admin-header.php');
155 155
 
156
-		$title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
156
+		$title = sprintf(__('Installing Plugin from uploaded file: %s'), esc_html(basename($file_upload->filename)));
157 157
 		$nonce = 'plugin-upload';
158 158
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin');
159 159
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
160 160
 
161
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162
-		$result = $upgrader->install( $file_upload->package );
161
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
162
+		$result = $upgrader->install($file_upload->package);
163 163
 
164
-		if ( $result || is_wp_error($result) )
164
+		if ($result || is_wp_error($result))
165 165
 			$file_upload->cleanup();
166 166
 
167
-		include(ABSPATH . 'wp-admin/admin-footer.php');
167
+		include(ABSPATH.'wp-admin/admin-footer.php');
168 168
 
169
-	} elseif ( 'upgrade-theme' == $action ) {
169
+	} elseif ('upgrade-theme' == $action) {
170 170
 
171
-		if ( ! current_user_can('update_themes') )
171
+		if ( ! current_user_can('update_themes'))
172 172
 			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
173 173
 
174
-		check_admin_referer('upgrade-theme_' . $theme);
174
+		check_admin_referer('upgrade-theme_'.$theme);
175 175
 
176
-		wp_enqueue_script( 'customize-loader' );
177
-		wp_enqueue_script( 'updates' );
176
+		wp_enqueue_script('customize-loader');
177
+		wp_enqueue_script('updates');
178 178
 
179 179
 		$title = __('Update Theme');
180 180
 		$parent_file = 'themes.php';
181 181
 		$submenu_file = 'themes.php';
182
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
182
+		require_once(ABSPATH.'wp-admin/admin-header.php');
183 183
 
184
-		$nonce = 'upgrade-theme_' . $theme;
185
-		$url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
184
+		$nonce = 'upgrade-theme_'.$theme;
185
+		$url = 'update.php?action=upgrade-theme&theme='.urlencode($theme);
186 186
 
187
-		$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
187
+		$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
188 188
 		$upgrader->upgrade($theme);
189 189
 
190
-		include(ABSPATH . 'wp-admin/admin-footer.php');
191
-	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
190
+		include(ABSPATH.'wp-admin/admin-footer.php');
191
+	} elseif ('update-selected-themes' == $action) {
192
+		if ( ! current_user_can('update_themes'))
193
+			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
194 194
 
195
-		check_admin_referer( 'bulk-update-themes' );
195
+		check_admin_referer('bulk-update-themes');
196 196
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
197
+		if (isset($_GET['themes']))
198
+			$themes = explode(',', stripslashes($_GET['themes']));
199
+		elseif (isset($_POST['checked']))
200 200
 			$themes = (array) $_POST['checked'];
201 201
 		else
202 202
 			$themes = array();
203 203
 
204 204
 		$themes = array_map('urldecode', $themes);
205 205
 
206
-		$url = 'update.php?action=update-selected-themes&amp;themes=' . urlencode(implode(',', $themes));
206
+		$url = 'update.php?action=update-selected-themes&amp;themes='.urlencode(implode(',', $themes));
207 207
 		$nonce = 'bulk-update-themes';
208 208
 
209
-		wp_enqueue_script( 'updates' );
209
+		wp_enqueue_script('updates');
210 210
 		iframe_header();
211 211
 
212
-		$upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
213
-		$upgrader->bulk_upgrade( $themes );
212
+		$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url')));
213
+		$upgrader->bulk_upgrade($themes);
214 214
 
215 215
 		iframe_footer();
216
-	} elseif ( 'install-theme' == $action ) {
216
+	} elseif ('install-theme' == $action) {
217 217
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
218
+		if ( ! current_user_can('install_themes'))
219
+			wp_die(__('You do not have sufficient permissions to install themes on this site.'));
220 220
 
221
-		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
221
+		include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); //for themes_api..
222 222
 
223
-		check_admin_referer( 'install-theme_' . $theme );
224
-		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
223
+		check_admin_referer('install-theme_'.$theme);
224
+		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth.
225 225
 
226
-		if ( is_wp_error($api) )
226
+		if (is_wp_error($api))
227 227
 	 		wp_die($api);
228 228
 
229
-		wp_enqueue_script( 'customize-loader' );
229
+		wp_enqueue_script('customize-loader');
230 230
 
231 231
 		$title = __('Install Themes');
232 232
 		$parent_file = 'themes.php';
233 233
 		$submenu_file = 'themes.php';
234
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
234
+		require_once(ABSPATH.'wp-admin/admin-header.php');
235 235
 
236
-		$title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
237
-		$nonce = 'install-theme_' . $theme;
238
-		$url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
236
+		$title = sprintf(__('Installing Theme: %s'), $api->name.' '.$api->version);
237
+		$nonce = 'install-theme_'.$theme;
238
+		$url = 'update.php?action=install-theme&theme='.urlencode($theme);
239 239
 		$type = 'web'; //Install theme type, From Web or an Upload.
240 240
 
241
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
241
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
242 242
 		$upgrader->install($api->download_link);
243 243
 
244
-		include(ABSPATH . 'wp-admin/admin-footer.php');
244
+		include(ABSPATH.'wp-admin/admin-footer.php');
245 245
 
246
-	} elseif ( 'upload-theme' == $action ) {
246
+	} elseif ('upload-theme' == $action) {
247 247
 
248
-		if ( ! current_user_can( 'upload_themes' ) ) {
249
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
248
+		if ( ! current_user_can('upload_themes')) {
249
+			wp_die(__('You do not have sufficient permissions to install themes on this site.'));
250 250
 		}
251 251
 
252 252
 		check_admin_referer('theme-upload');
253 253
 
254 254
 		$file_upload = new File_Upload_Upgrader('themezip', 'package');
255 255
 
256
-		wp_enqueue_script( 'customize-loader' );
256
+		wp_enqueue_script('customize-loader');
257 257
 
258 258
 		$title = __('Upload Theme');
259 259
 		$parent_file = 'themes.php';
260 260
 		$submenu_file = 'theme-install.php';
261 261
 
262
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
262
+		require_once(ABSPATH.'wp-admin/admin-header.php');
263 263
 
264
-		$title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
264
+		$title = sprintf(__('Installing Theme from uploaded file: %s'), esc_html(basename($file_upload->filename)));
265 265
 		$nonce = 'theme-upload';
266 266
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme');
267 267
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
268 268
 
269
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270
-		$result = $upgrader->install( $file_upload->package );
269
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
270
+		$result = $upgrader->install($file_upload->package);
271 271
 
272
-		if ( $result || is_wp_error($result) )
272
+		if ($result || is_wp_error($result))
273 273
 			$file_upload->cleanup();
274 274
 
275
-		include(ABSPATH . 'wp-admin/admin-footer.php');
275
+		include(ABSPATH.'wp-admin/admin-footer.php');
276 276
 
277 277
 	} else {
278 278
 		/**
@@ -284,6 +284,6 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @since 2.8.0
286 286
 		 */
287
-		do_action( "update-custom_{$action}" );
287
+		do_action("update-custom_{$action}");
288 288
 	}
289 289
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -37 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
9
+if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
10 10
 	define( 'IFRAME_REQUEST', true );
11
+}
11 12
 
12 13
 /** WordPress Administration Bootstrap */
13 14
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -20,17 +21,19 @@  discard block
 block discarded – undo
20 21
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 22
 
22 23
 	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
24
+		if ( ! current_user_can( 'update_plugins' ) ) {
25
+					wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
26
+		}
25 27
 
26 28
 		check_admin_referer( 'bulk-update-plugins' );
27 29
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
31
-			$plugins = (array) $_POST['checked'];
32
-		else
33
-			$plugins = array();
30
+		if ( isset( $_GET['plugins'] ) ) {
31
+					$plugins = explode( ',', stripslashes($_GET['plugins']) );
32
+		} elseif ( isset( $_POST['checked'] ) ) {
33
+					$plugins = (array) $_POST['checked'];
34
+		} else {
35
+					$plugins = array();
36
+		}
34 37
 
35 38
 		$plugins = array_map('urldecode', $plugins);
36 39
 
@@ -46,8 +49,9 @@  discard block
 block discarded – undo
46 49
 		iframe_footer();
47 50
 
48 51
 	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
50
-			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
52
+		if ( ! current_user_can('update_plugins') ) {
53
+					wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
54
+		}
51 55
 
52 56
 		check_admin_referer('upgrade-plugin_' . $plugin);
53 57
 
@@ -67,8 +71,9 @@  discard block
 block discarded – undo
67 71
 		include(ABSPATH . 'wp-admin/admin-footer.php');
68 72
 
69 73
 	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
71
-			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
74
+		if ( ! current_user_can('update_plugins') ) {
75
+					wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
76
+		}
72 77
 
73 78
 		check_admin_referer('activate-plugin_' . $plugin);
74 79
 		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
@@ -78,8 +83,9 @@  discard block
 block discarded – undo
78 83
 			die();
79 84
 		}
80 85
 		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
86
+		if ( isset($_GET['success']) ) {
87
+					echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
88
+		}
83 89
 
84 90
 		if ( isset($_GET['failure']) ){
85 91
 			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
@@ -92,8 +98,9 @@  discard block
 block discarded – undo
92 98
 		iframe_footer();
93 99
 	} elseif ( 'install-plugin' == $action ) {
94 100
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
101
+		if ( ! current_user_can('install_plugins') ) {
102
+					wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
103
+		}
97 104
 
98 105
 		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
99 106
 
@@ -128,8 +135,9 @@  discard block
 block discarded – undo
128 135
 		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
129 136
 		$nonce = 'install-plugin_' . $plugin;
130 137
 		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
131
-		if ( isset($_GET['from']) )
132
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
138
+		if ( isset($_GET['from']) ) {
139
+					$url .= '&from=' . urlencode(stripslashes($_GET['from']));
140
+		}
133 141
 
134 142
 		$type = 'web'; //Install plugin type, From Web or an Upload.
135 143
 
@@ -161,15 +169,17 @@  discard block
 block discarded – undo
161 169
 		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
162 170
 		$result = $upgrader->install( $file_upload->package );
163 171
 
164
-		if ( $result || is_wp_error($result) )
165
-			$file_upload->cleanup();
172
+		if ( $result || is_wp_error($result) ) {
173
+					$file_upload->cleanup();
174
+		}
166 175
 
167 176
 		include(ABSPATH . 'wp-admin/admin-footer.php');
168 177
 
169 178
 	} elseif ( 'upgrade-theme' == $action ) {
170 179
 
171
-		if ( ! current_user_can('update_themes') )
172
-			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
180
+		if ( ! current_user_can('update_themes') ) {
181
+					wp_die(__('You do not have sufficient permissions to update themes for this site.'));
182
+		}
173 183
 
174 184
 		check_admin_referer('upgrade-theme_' . $theme);
175 185
 
@@ -189,17 +199,19 @@  discard block
 block discarded – undo
189 199
 
190 200
 		include(ABSPATH . 'wp-admin/admin-footer.php');
191 201
 	} elseif ( 'update-selected-themes' == $action ) {
192
-		if ( ! current_user_can( 'update_themes' ) )
193
-			wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
202
+		if ( ! current_user_can( 'update_themes' ) ) {
203
+					wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
204
+		}
194 205
 
195 206
 		check_admin_referer( 'bulk-update-themes' );
196 207
 
197
-		if ( isset( $_GET['themes'] ) )
198
-			$themes = explode( ',', stripslashes($_GET['themes']) );
199
-		elseif ( isset( $_POST['checked'] ) )
200
-			$themes = (array) $_POST['checked'];
201
-		else
202
-			$themes = array();
208
+		if ( isset( $_GET['themes'] ) ) {
209
+					$themes = explode( ',', stripslashes($_GET['themes']) );
210
+		} elseif ( isset( $_POST['checked'] ) ) {
211
+					$themes = (array) $_POST['checked'];
212
+		} else {
213
+					$themes = array();
214
+		}
203 215
 
204 216
 		$themes = array_map('urldecode', $themes);
205 217
 
@@ -215,16 +227,18 @@  discard block
 block discarded – undo
215 227
 		iframe_footer();
216 228
 	} elseif ( 'install-theme' == $action ) {
217 229
 
218
-		if ( ! current_user_can('install_themes') )
219
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
230
+		if ( ! current_user_can('install_themes') ) {
231
+					wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
232
+		}
220 233
 
221 234
 		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
222 235
 
223 236
 		check_admin_referer( 'install-theme_' . $theme );
224 237
 		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
225 238
 
226
-		if ( is_wp_error($api) )
227
-	 		wp_die($api);
239
+		if ( is_wp_error($api) ) {
240
+			 		wp_die($api);
241
+		}
228 242
 
229 243
 		wp_enqueue_script( 'customize-loader' );
230 244
 
@@ -269,8 +283,9 @@  discard block
 block discarded – undo
269 283
 		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
270 284
 		$result = $upgrader->install( $file_upload->package );
271 285
 
272
-		if ( $result || is_wp_error($result) )
273
-			$file_upload->cleanup();
286
+		if ( $result || is_wp_error($result) ) {
287
+					$file_upload->cleanup();
288
+		}
274 289
 
275 290
 		include(ABSPATH . 'wp-admin/admin-footer.php');
276 291
 
Please login to merge, or discard this patch.
src/wp-admin/credits.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Credits administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Credits 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' );
Please login to merge, or discard this patch.
Spacing   +53 added lines, -53 removed lines patch added patch discarded remove patch
@@ -7,88 +7,88 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
-require_once( dirname( __FILE__ ) . '/includes/credits.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11
+require_once(dirname(__FILE__).'/includes/credits.php');
12 12
 
13
-$title = __( 'Credits' );
13
+$title = __('Credits');
14 14
 
15
-list( $display_version ) = explode( '-', $wp_version );
15
+list($display_version) = explode('-', $wp_version);
16 16
 
17
-include( ABSPATH . 'wp-admin/admin-header.php' );
17
+include(ABSPATH.'wp-admin/admin-header.php');
18 18
 ?>
19 19
 <div class="wrap about-wrap">
20 20
 
21
-<h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1>
21
+<h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1>
22 22
 
23
-<div class="about-text"><?php printf( __( 'Thank you for updating! WordPress %s makes your site more connected and responsive.' ), $display_version ); ?></div>
23
+<div class="about-text"><?php printf(__('Thank you for updating! WordPress %s makes your site more connected and responsive.'), $display_version); ?></div>
24 24
 
25
-<div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div>
25
+<div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div>
26 26
 
27 27
 <h2 class="nav-tab-wrapper wp-clearfix">
28
-	<a href="about.php" class="nav-tab"><?php _e( 'What&#8217;s New' ); ?></a>
29
-	<a href="credits.php" class="nav-tab nav-tab-active"><?php _e( 'Credits' ); ?></a>
30
-	<a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a>
28
+	<a href="about.php" class="nav-tab"><?php _e('What&#8217;s New'); ?></a>
29
+	<a href="credits.php" class="nav-tab nav-tab-active"><?php _e('Credits'); ?></a>
30
+	<a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a>
31 31
 </h2>
32 32
 
33 33
 <?php
34 34
 
35 35
 $credits = wp_credits();
36 36
 
37
-if ( ! $credits ) {
37
+if ( ! $credits) {
38 38
 	echo '<p class="about-description">';
39 39
 	/* translators: 1: https://wordpress.org/about/, 2: https://make.wordpress.org/ */
40
-	printf( __( 'WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.' ),
40
+	printf(__('WordPress is created by a <a href="%1$s">worldwide team</a> of passionate individuals. <a href="%2$s">Get involved in WordPress</a>.'),
41 41
 		'https://wordpress.org/about/',
42
-		__( 'https://make.wordpress.org/' )
42
+		__('https://make.wordpress.org/')
43 43
 	);
44 44
 	echo '</p>';
45
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
45
+	include(ABSPATH.'wp-admin/admin-footer.php');
46 46
 	exit;
47 47
 }
48 48
 
49
-echo '<p class="about-description">' . __( 'WordPress is created by a worldwide team of passionate individuals.' ) . "</p>\n";
49
+echo '<p class="about-description">'.__('WordPress is created by a worldwide team of passionate individuals.')."</p>\n";
50 50
 
51
-foreach ( $credits['groups'] as $group_slug => $group_data ) {
52
-	if ( $group_data['name'] ) {
53
-		if ( 'Translators' == $group_data['name'] ) {
51
+foreach ($credits['groups'] as $group_slug => $group_data) {
52
+	if ($group_data['name']) {
53
+		if ('Translators' == $group_data['name']) {
54 54
 			// Considered a special slug in the API response. (Also, will never be returned for en_US.)
55
-			$title = _x( 'Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section' );
56
-		} elseif ( isset( $group_data['placeholders'] ) ) {
57
-			$title = vsprintf( translate( $group_data['name'] ), $group_data['placeholders'] );
55
+			$title = _x('Translators', 'Translate this to be the equivalent of English Translators in your language for the credits page Translators section');
56
+		} elseif (isset($group_data['placeholders'])) {
57
+			$title = vsprintf(translate($group_data['name']), $group_data['placeholders']);
58 58
 		} else {
59
-			$title = translate( $group_data['name'] );
59
+			$title = translate($group_data['name']);
60 60
 		}
61 61
 
62
-		echo '<h3 class="wp-people-group">' . esc_html( $title ) . "</h3>\n";
62
+		echo '<h3 class="wp-people-group">'.esc_html($title)."</h3>\n";
63 63
 	}
64 64
 
65
-	if ( ! empty( $group_data['shuffle'] ) )
66
-		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
65
+	if ( ! empty($group_data['shuffle']))
66
+		shuffle($group_data['data']); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
67 67
 
68
-	switch ( $group_data['type'] ) {
68
+	switch ($group_data['type']) {
69 69
 		case 'list' :
70
-			array_walk( $group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles'] );
71
-			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
70
+			array_walk($group_data['data'], '_wp_credits_add_profile_link', $credits['data']['profiles']);
71
+			echo '<p class="wp-credits-list">'.wp_sprintf('%l.', $group_data['data'])."</p>\n\n";
72 72
 			break;
73 73
 		case 'libraries' :
74
-			array_walk( $group_data['data'], '_wp_credits_build_object_link' );
75
-			echo '<p class="wp-credits-list">' . wp_sprintf( '%l.', $group_data['data'] ) . "</p>\n\n";
74
+			array_walk($group_data['data'], '_wp_credits_build_object_link');
75
+			echo '<p class="wp-credits-list">'.wp_sprintf('%l.', $group_data['data'])."</p>\n\n";
76 76
 			break;
77 77
 		default:
78 78
 			$compact = 'compact' == $group_data['type'];
79
-			$classes = 'wp-people-group ' . ( $compact ? 'compact' : '' );
80
-			echo '<ul class="' . $classes . '" id="wp-people-group-' . $group_slug . '">' . "\n";
81
-			foreach ( $group_data['data'] as $person_data ) {
82
-				echo '<li class="wp-person" id="wp-person-' . esc_attr( $person_data[2] ) . '">' . "\n\t";
83
-				echo '<a href="' . esc_url( sprintf( $credits['data']['profiles'], $person_data[2] ) ) . '" class="web">';
79
+			$classes = 'wp-people-group '.($compact ? 'compact' : '');
80
+			echo '<ul class="'.$classes.'" id="wp-people-group-'.$group_slug.'">'."\n";
81
+			foreach ($group_data['data'] as $person_data) {
82
+				echo '<li class="wp-person" id="wp-person-'.esc_attr($person_data[2]).'">'."\n\t";
83
+				echo '<a href="'.esc_url(sprintf($credits['data']['profiles'], $person_data[2])).'" class="web">';
84 84
 				$size = 'compact' == $group_data['type'] ? 30 : 60;
85
-				$data = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );
85
+				$data = get_avatar_data($person_data[1].'@md5.gravatar.com', array('size' => $size));
86 86
 				$size *= 2;
87
-				$data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );
88
-				echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" />' . "\n";
89
-				echo esc_html( $person_data[0] ) . "</a>\n\t";
90
-				if ( ! $compact )
91
-					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
87
+				$data2x = get_avatar_data($person_data[1].'@md5.gravatar.com', array('size' => $size));
88
+				echo '<img src="'.esc_url($data['url']).'" srcset="'.esc_url($data2x['url']).' 2x" class="gravatar" alt="" />'."\n";
89
+				echo esc_html($person_data[0])."</a>\n\t";
90
+				if ( ! $compact)
91
+					echo '<span class="title">'.translate($person_data[3])."</span>\n";
92 92
 				echo "</li>\n";
93 93
 			}
94 94
 			echo "</ul>\n";
@@ -99,24 +99,24 @@  discard block
 block discarded – undo
99 99
 ?>
100 100
 <p class="clear"><?php
101 101
 	/* translators: %s: https://make.wordpress.org/ */
102
-	printf( __( 'Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.' ),
103
-		__( 'https://make.wordpress.org/' )
102
+	printf(__('Want to see your name in lights on this page? <a href="%s">Get involved in WordPress</a>.'),
103
+		__('https://make.wordpress.org/')
104 104
 	);
105 105
 ?></p>
106 106
 
107 107
 </div>
108 108
 <?php
109 109
 
110
-include( ABSPATH . 'wp-admin/admin-footer.php' );
110
+include(ABSPATH.'wp-admin/admin-footer.php');
111 111
 
112 112
 return;
113 113
 
114 114
 // These are strings returned by the API that we want to be translatable
115
-__( 'Project Leaders' );
116
-__( 'Core Contributors to WordPress %s' );
117
-__( 'Contributing Developers' );
118
-__( 'Cofounder, Project Lead' );
119
-__( 'Lead Developer' );
120
-__( 'Release Lead' );
121
-__( 'Core Developer' );
122
-__( 'External Libraries' );
115
+__('Project Leaders');
116
+__('Core Contributors to WordPress %s');
117
+__('Contributing Developers');
118
+__('Cofounder, Project Lead');
119
+__('Lead Developer');
120
+__('Release Lead');
121
+__('Core Developer');
122
+__('External Libraries');
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -62,8 +62,10 @@  discard block
 block discarded – undo
62 62
 		echo '<h3 class="wp-people-group">' . esc_html( $title ) . "</h3>\n";
63 63
 	}
64 64
 
65
-	if ( ! empty( $group_data['shuffle'] ) )
66
-		shuffle( $group_data['data'] ); // We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
65
+	if ( ! empty( $group_data['shuffle'] ) ) {
66
+			shuffle( $group_data['data'] );
67
+	}
68
+	// We were going to sort by ability to pronounce "hierarchical," but that wouldn't be fair to Matt.
67 69
 
68 70
 	switch ( $group_data['type'] ) {
69 71
 		case 'list' :
@@ -87,8 +89,9 @@  discard block
 block discarded – undo
87 89
 				$data2x = get_avatar_data( $person_data[1] . '@md5.gravatar.com', array( 'size' => $size ) );
88 90
 				echo '<img src="' . esc_url( $data['url'] ) . '" srcset="' . esc_url( $data2x['url'] ) . ' 2x" class="gravatar" alt="" />' . "\n";
89 91
 				echo esc_html( $person_data[0] ) . "</a>\n\t";
90
-				if ( ! $compact )
91
-					echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
92
+				if ( ! $compact ) {
93
+									echo '<span class="title">' . translate( $person_data[3] ) . "</span>\n";
94
+				}
92 95
 				echo "</li>\n";
93 96
 			}
94 97
 			echo "</ul>\n";
Please login to merge, or discard this patch.
src/wp-admin/press-this.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Press This Display and Handler.
4
- *
5
- * @package WordPress
6
- * @subpackage Press_This
7
- */
3
+			 * Press This Display and Handler.
4
+			 *
5
+			 * @package WordPress
6
+			 * @subpackage Press_This
7
+			 */
8 8
 
9 9
 define('IFRAME_REQUEST' , true);
10 10
 
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -6,15 +6,15 @@  discard block
 block discarded – undo
6 6
  * @subpackage Press_This
7 7
  */
8 8
 
9
-define('IFRAME_REQUEST' , true);
9
+define('IFRAME_REQUEST', true);
10 10
 
11 11
 /** WordPress Administration Bootstrap */
12
-require_once( dirname( __FILE__ ) . '/admin.php' );
12
+require_once(dirname(__FILE__).'/admin.php');
13 13
 
14
-if ( ! current_user_can( 'edit_posts' ) || ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
14
+if ( ! current_user_can('edit_posts') || ! current_user_can(get_post_type_object('post')->cap->create_posts)) {
15 15
 	wp_die(
16
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
17
-		'<p>' . __( 'You are not allowed to create posts as this user.' ) . '</p>',
16
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
17
+		'<p>'.__('You are not allowed to create posts as this user.').'</p>',
18 18
 		403
19 19
 	);
20 20
 }
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
 /**
23 23
  * @global WP_Press_This $wp_press_this
24 24
  */
25
-if ( empty( $GLOBALS['wp_press_this'] ) ) {
26
-	include( ABSPATH . 'wp-admin/includes/class-wp-press-this.php' );
25
+if (empty($GLOBALS['wp_press_this'])) {
26
+	include(ABSPATH.'wp-admin/includes/class-wp-press-this.php');
27 27
 }
28 28
 
29 29
 $GLOBALS['wp_press_this']->html();
Please login to merge, or discard this patch.
src/wp-admin/setup-config.php 3 patches
Switch Indentation   +133 added lines, -133 removed lines patch added patch discarded remove patch
@@ -111,37 +111,37 @@  discard block
 block discarded – undo
111 111
 }
112 112
 
113 113
 switch($step) {
114
-	case -1:
115
-		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
116
-			setup_config_display_header( 'language-chooser' );
117
-			echo '<h1 class="screen-reader-text">Select a default language</h1>';
118
-			echo '<form id="setup" method="post" action="?step=0">';
119
-			wp_install_language_form( $languages );
120
-			echo '</form>';
121
-			break;
122
-		}
114
+		case -1:
115
+			if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
116
+				setup_config_display_header( 'language-chooser' );
117
+				echo '<h1 class="screen-reader-text">Select a default language</h1>';
118
+				echo '<form id="setup" method="post" action="?step=0">';
119
+				wp_install_language_form( $languages );
120
+				echo '</form>';
121
+				break;
122
+			}
123 123
 
124
-		// Deliberately fall through if we can't reach the translations API.
124
+			// Deliberately fall through if we can't reach the translations API.
125 125
 
126
-	case 0:
127
-		if ( ! empty( $language ) ) {
128
-			$loaded_language = wp_download_language_pack( $language );
129
-			if ( $loaded_language ) {
130
-				load_default_textdomain( $loaded_language );
131
-				$GLOBALS['wp_locale'] = new WP_Locale();
126
+		case 0:
127
+			if ( ! empty( $language ) ) {
128
+				$loaded_language = wp_download_language_pack( $language );
129
+				if ( $loaded_language ) {
130
+					load_default_textdomain( $loaded_language );
131
+					$GLOBALS['wp_locale'] = new WP_Locale();
132
+				}
132 133
 			}
133
-		}
134 134
 
135
-		setup_config_display_header();
136
-		$step_1 = 'setup-config.php?step=1';
137
-		if ( isset( $_REQUEST['noapi'] ) ) {
138
-			$step_1 .= '&amp;noapi';
139
-		}
140
-		if ( ! empty( $loaded_language ) ) {
141
-			$step_1 .= '&amp;language=' . $loaded_language;
142
-		}
143
-?>
144
-<h1 class="screen-reader-text"><?php _e( 'Before getting started' ) ?></h1>
135
+			setup_config_display_header();
136
+			$step_1 = 'setup-config.php?step=1';
137
+			if ( isset( $_REQUEST['noapi'] ) ) {
138
+				$step_1 .= '&amp;noapi';
139
+			}
140
+			if ( ! empty( $loaded_language ) ) {
141
+				$step_1 .= '&amp;language=' . $loaded_language;
142
+			}
143
+	?>
144
+	<h1 class="screen-reader-text"><?php _e( 'Before getting started' ) ?></h1>
145 145
 <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
146 146
 <ol>
147 147
 	<li><?php _e( 'Database name' ); ?></li>
@@ -151,37 +151,37 @@  discard block
 block discarded – undo
151 151
 	<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
152 152
 </ol>
153 153
 <p><?php
154
-	/* translators: %s: wp-config.php */
155
-	printf( __( 'We&#8217;re going to use this information to create a %s file.' ),
156
-		'<code>wp-config.php</code>'
157
-	);
158
-	?>
159
-	<strong><?php
160
-		/* translators: 1: wp-config-sample.php, 2: wp-config.php */
161
-		printf( __( 'If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.' ),
162
-			'<code>wp-config-sample.php</code>',
154
+		/* translators: %s: wp-config.php */
155
+		printf( __( 'We&#8217;re going to use this information to create a %s file.' ),
163 156
 			'<code>wp-config.php</code>'
164 157
 		);
165
-	?></strong>
158
+		?>
159
+		<strong><?php
160
+			/* translators: 1: wp-config-sample.php, 2: wp-config.php */
161
+			printf( __( 'If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.' ),
162
+				'<code>wp-config-sample.php</code>',
163
+				'<code>wp-config.php</code>'
164
+			);
165
+		?></strong>
166 166
 	<?php
167
-	/* translators: %s: Codex URL */
168
-	printf( __( 'Need more help? <a href="%s">We got it</a>.' ),
169
-		__( 'https://codex.wordpress.org/Editing_wp-config.php' )
170
-	);
171
-?></p>
167
+		/* translators: %s: Codex URL */
168
+		printf( __( 'Need more help? <a href="%s">We got it</a>.' ),
169
+			__( 'https://codex.wordpress.org/Editing_wp-config.php' )
170
+		);
171
+	?></p>
172 172
 <p><?php _e( 'In all likelihood, these items were supplied to you by your Web Host. If you don&#8217;t have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;' ); ?></p>
173 173
 
174 174
 <p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
175
-<?php
176
-	break;
175
+	<?php
176
+		break;
177 177
 
178
-	case 1:
179
-		load_default_textdomain( $language );
180
-		$GLOBALS['wp_locale'] = new WP_Locale();
178
+		case 1:
179
+			load_default_textdomain( $language );
180
+			$GLOBALS['wp_locale'] = new WP_Locale();
181 181
 
182
-		setup_config_display_header();
183
-	?>
184
-<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ) ?></h1>
182
+			setup_config_display_header();
183
+		?>
184
+	<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ) ?></h1>
185 185
 <form method="post" action="setup-config.php?step=2">
186 186
 	<p><?php _e( 'Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.' ); ?></p>
187 187
 	<table class="form-table">
@@ -204,9 +204,9 @@  discard block
 block discarded – undo
204 204
 			<th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
205 205
 			<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
206 206
 			<td><?php
207
-				/* translators: %s: localhost */
208
-				printf( __( 'You should be able to get this info from your web host, if %s doesn&#8217;t work.' ),'<code>localhost</code>' );
209
-			?></td>
207
+					/* translators: %s: localhost */
208
+					printf( __( 'You should be able to get this info from your web host, if %s doesn&#8217;t work.' ),'<code>localhost</code>' );
209
+				?></td>
210 210
 		</tr>
211 211
 		<tr>
212 212
 			<th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
@@ -215,113 +215,113 @@  discard block
 block discarded – undo
215 215
 		</tr>
216 216
 	</table>
217 217
 	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
218
-	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
218
+		<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
219 219
 	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
220 220
 </form>
221 221
 <?php
222
-	break;
222
+		break;
223 223
 
224
-	case 2:
225
-	load_default_textdomain( $language );
226
-	$GLOBALS['wp_locale'] = new WP_Locale();
224
+		case 2:
225
+		load_default_textdomain( $language );
226
+		$GLOBALS['wp_locale'] = new WP_Locale();
227 227
 
228
-	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
229
-	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
230
-	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
231
-	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
232
-	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
228
+		$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
229
+		$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
230
+		$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
231
+		$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
232
+		$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
233 233
 
234
-	$step_1 = 'setup-config.php?step=1';
235
-	$install = 'install.php';
236
-	if ( isset( $_REQUEST['noapi'] ) ) {
237
-		$step_1 .= '&amp;noapi';
238
-	}
234
+		$step_1 = 'setup-config.php?step=1';
235
+		$install = 'install.php';
236
+		if ( isset( $_REQUEST['noapi'] ) ) {
237
+			$step_1 .= '&amp;noapi';
238
+		}
239 239
 
240
-	if ( ! empty( $language ) ) {
241
-		$step_1 .= '&amp;language=' . $language;
242
-		$install .= '?language=' . $language;
243
-	} else {
244
-		$install .= '?language=en_US';
245
-	}
240
+		if ( ! empty( $language ) ) {
241
+			$step_1 .= '&amp;language=' . $language;
242
+			$install .= '?language=' . $language;
243
+		} else {
244
+			$install .= '?language=en_US';
245
+		}
246 246
 
247
-	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
247
+		$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
248 248
 
249
-	if ( empty( $prefix ) )
250
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
249
+		if ( empty( $prefix ) )
250
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
251 251
 
252
-	// Validate $prefix: it can only contain letters, numbers and underscores.
253
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
254
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
252
+		// Validate $prefix: it can only contain letters, numbers and underscores.
253
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
254
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
255 255
 
256
-	// Test the db connection.
257
-	/**#@+
256
+		// Test the db connection.
257
+		/**#@+
258 258
 	 * @ignore
259 259
 	 */
260
-	define('DB_NAME', $dbname);
261
-	define('DB_USER', $uname);
262
-	define('DB_PASSWORD', $pwd);
263
-	define('DB_HOST', $dbhost);
264
-	/**#@-*/
260
+		define('DB_NAME', $dbname);
261
+		define('DB_USER', $uname);
262
+		define('DB_PASSWORD', $pwd);
263
+		define('DB_HOST', $dbhost);
264
+		/**#@-*/
265 265
 
266
-	// Re-construct $wpdb with these new values.
267
-	unset( $wpdb );
268
-	require_wp_db();
266
+		// Re-construct $wpdb with these new values.
267
+		unset( $wpdb );
268
+		require_wp_db();
269 269
 
270
-	/*
270
+		/*
271 271
 	 * The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
272 272
 	 * fire this manually. We'll fail here if the values are no good.
273 273
 	 */
274
-	$wpdb->db_connect();
275
-
276
-	if ( ! empty( $wpdb->error ) )
277
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
278
-
279
-	// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
280
-	try {
281
-		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
282
-		$max = strlen($chars) - 1;
283
-		for ( $i = 0; $i < 8; $i++ ) {
284
-			$key = '';
285
-			for ( $j = 0; $j < 64; $j++ ) {
286
-				$key .= substr( $chars, random_int( 0, $max ), 1 );
287
-			}
288
-			$secret_keys[] = $key;
289
-		}
290
-	} catch ( Exception $ex ) {
291
-		$no_api = isset( $_POST['noapi'] );
274
+		$wpdb->db_connect();
292 275
 
293
-		if ( ! $no_api ) {
294
-			$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
295
-		}
276
+		if ( ! empty( $wpdb->error ) )
277
+			wp_die( $wpdb->error->get_error_message() . $tryagain_link );
296 278
 
297
-		if ( $no_api || is_wp_error( $secret_keys ) ) {
298
-			$secret_keys = array();
279
+		// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
280
+		try {
281
+			$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
282
+			$max = strlen($chars) - 1;
299 283
 			for ( $i = 0; $i < 8; $i++ ) {
300
-				$secret_keys[] = wp_generate_password( 64, true, true );
284
+				$key = '';
285
+				for ( $j = 0; $j < 64; $j++ ) {
286
+					$key .= substr( $chars, random_int( 0, $max ), 1 );
287
+				}
288
+				$secret_keys[] = $key;
301 289
 			}
302
-		} else {
303
-			$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
304
-			foreach ( $secret_keys as $k => $v ) {
305
-				$secret_keys[$k] = substr( $v, 28, 64 );
290
+		} catch ( Exception $ex ) {
291
+			$no_api = isset( $_POST['noapi'] );
292
+
293
+			if ( ! $no_api ) {
294
+				$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
306 295
 			}
307
-		}
308
-	}
309 296
 
310
-	$key = 0;
311
-	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
312
-	foreach ( $config_file as $line_num => $line ) {
313
-		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
314
-			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
315
-			continue;
297
+			if ( $no_api || is_wp_error( $secret_keys ) ) {
298
+				$secret_keys = array();
299
+				for ( $i = 0; $i < 8; $i++ ) {
300
+					$secret_keys[] = wp_generate_password( 64, true, true );
301
+				}
302
+			} else {
303
+				$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
304
+				foreach ( $secret_keys as $k => $v ) {
305
+					$secret_keys[$k] = substr( $v, 28, 64 );
306
+				}
307
+			}
316 308
 		}
317 309
 
318
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
319
-			continue;
310
+		$key = 0;
311
+		// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
312
+		foreach ( $config_file as $line_num => $line ) {
313
+			if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
314
+				$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
315
+				continue;
316
+			}
320 317
 
321
-		$constant = $match[1];
322
-		$padding  = $match[2];
318
+			if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
319
+				continue;
323 320
 
324
-		switch ( $constant ) {
321
+			$constant = $match[1];
322
+			$padding  = $match[2];
323
+
324
+			switch ( $constant ) {
325 325
 			case 'DB_NAME'     :
326 326
 			case 'DB_USER'     :
327 327
 			case 'DB_PASSWORD' :
@@ -343,7 +343,7 @@  discard block
 block discarded – undo
343 343
 			case 'NONCE_SALT'       :
344 344
 				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
345 345
 				break;
346
-		}
346
+			}
347 347
 	}
348 348
 	unset( $line );
349 349
 
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -28,46 +28,46 @@  discard block
 block discarded – undo
28 28
  */
29 29
 error_reporting(0);
30 30
 
31
-define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
31
+define('ABSPATH', dirname(dirname(__FILE__)).'/');
32 32
 
33
-require( ABSPATH . 'wp-settings.php' );
33
+require(ABSPATH.'wp-settings.php');
34 34
 
35 35
 /** Load WordPress Administration Upgrade API */
36
-require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
36
+require_once(ABSPATH.'wp-admin/includes/upgrade.php');
37 37
 
38 38
 /** Load WordPress Translation Install API */
39
-require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
39
+require_once(ABSPATH.'wp-admin/includes/translation-install.php');
40 40
 
41 41
 nocache_headers();
42 42
 
43 43
 // Support wp-config-sample.php one level up, for the develop repo.
44
-if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
45
-	$config_file = file( ABSPATH . 'wp-config-sample.php' );
46
-elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
47
-	$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
44
+if (file_exists(ABSPATH.'wp-config-sample.php'))
45
+	$config_file = file(ABSPATH.'wp-config-sample.php');
46
+elseif (file_exists(dirname(ABSPATH).'/wp-config-sample.php'))
47
+	$config_file = file(dirname(ABSPATH).'/wp-config-sample.php');
48 48
 else
49
-	wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation.' ) );
49
+	wp_die(__('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation.'));
50 50
 
51 51
 // Check if wp-config.php has been created
52
-if ( file_exists( ABSPATH . 'wp-config.php' ) )
53
-	wp_die( '<p>' . sprintf(
52
+if (file_exists(ABSPATH.'wp-config.php'))
53
+	wp_die('<p>'.sprintf(
54 54
 			/* translators: %s: install.php */
55
-			__( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ),
55
+			__("The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>."),
56 56
 			'install.php'
57
-		) . '</p>'
57
+		).'</p>'
58 58
 	);
59 59
 
60 60
 // Check if wp-config.php exists above the root directory but is not part of another install
61
-if ( @file_exists( ABSPATH . '../wp-config.php' ) && ! @file_exists( ABSPATH . '../wp-settings.php' ) ) {
62
-	wp_die( '<p>' . sprintf(
61
+if (@file_exists(ABSPATH.'../wp-config.php') && ! @file_exists(ABSPATH.'../wp-settings.php')) {
62
+	wp_die('<p>'.sprintf(
63 63
 			/* translators: %s: install.php */
64
-			__( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ),
64
+			__("The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>."),
65 65
 			'install.php'
66
-		) . '</p>'
66
+		).'</p>'
67 67
 	);
68 68
 }
69 69
 
70
-$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
70
+$step = isset($_GET['step']) ? (int) $_GET['step'] : -1;
71 71
 
72 72
 /**
73 73
  * Display setup wp-config.php file header.
@@ -80,43 +80,43 @@  discard block
 block discarded – undo
80 80
  *
81 81
  * @param string|array $body_classes
82 82
  */
83
-function setup_config_display_header( $body_classes = array() ) {
83
+function setup_config_display_header($body_classes = array()) {
84 84
 	$body_classes = (array) $body_classes;
85 85
 	$body_classes[] = 'wp-core-ui';
86
-	if ( is_rtl() ) {
86
+	if (is_rtl()) {
87 87
 		$body_classes[] = 'rtl';
88 88
 	}
89 89
 
90
-	header( 'Content-Type: text/html; charset=utf-8' );
90
+	header('Content-Type: text/html; charset=utf-8');
91 91
 ?>
92 92
 <!DOCTYPE html>
93
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
93
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
94 94
 <head>
95 95
 	<meta name="viewport" content="width=device-width" />
96 96
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
97 97
 	<meta name="robots" content="noindex,nofollow" />
98
-	<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
99
-	<?php wp_admin_css( 'install', true ); ?>
98
+	<title><?php _e('WordPress &rsaquo; Setup Configuration File'); ?></title>
99
+	<?php wp_admin_css('install', true); ?>
100 100
 </head>
101
-<body class="<?php echo implode( ' ', $body_classes ); ?>">
102
-<p id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></p>
101
+<body class="<?php echo implode(' ', $body_classes); ?>">
102
+<p id="logo"><a href="<?php esc_attr_e('https://wordpress.org/'); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></p>
103 103
 <?php
104 104
 } // end function setup_config_display_header();
105 105
 
106 106
 $language = '';
107
-if ( ! empty( $_REQUEST['language'] ) ) {
108
-	$language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
109
-} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
107
+if ( ! empty($_REQUEST['language'])) {
108
+	$language = preg_replace('/[^a-zA-Z_]/', '', $_REQUEST['language']);
109
+} elseif (isset($GLOBALS['wp_local_package'])) {
110 110
 	$language = $GLOBALS['wp_local_package'];
111 111
 }
112 112
 
113
-switch($step) {
113
+switch ($step) {
114 114
 	case -1:
115
-		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
116
-			setup_config_display_header( 'language-chooser' );
115
+		if (wp_can_install_language_pack() && empty($language) && ($languages = wp_get_available_translations())) {
116
+			setup_config_display_header('language-chooser');
117 117
 			echo '<h1 class="screen-reader-text">Select a default language</h1>';
118 118
 			echo '<form id="setup" method="post" action="?step=0">';
119
-			wp_install_language_form( $languages );
119
+			wp_install_language_form($languages);
120 120
 			echo '</form>';
121 121
 			break;
122 122
 		}
@@ -124,134 +124,134 @@  discard block
 block discarded – undo
124 124
 		// Deliberately fall through if we can't reach the translations API.
125 125
 
126 126
 	case 0:
127
-		if ( ! empty( $language ) ) {
128
-			$loaded_language = wp_download_language_pack( $language );
129
-			if ( $loaded_language ) {
130
-				load_default_textdomain( $loaded_language );
127
+		if ( ! empty($language)) {
128
+			$loaded_language = wp_download_language_pack($language);
129
+			if ($loaded_language) {
130
+				load_default_textdomain($loaded_language);
131 131
 				$GLOBALS['wp_locale'] = new WP_Locale();
132 132
 			}
133 133
 		}
134 134
 
135 135
 		setup_config_display_header();
136 136
 		$step_1 = 'setup-config.php?step=1';
137
-		if ( isset( $_REQUEST['noapi'] ) ) {
137
+		if (isset($_REQUEST['noapi'])) {
138 138
 			$step_1 .= '&amp;noapi';
139 139
 		}
140
-		if ( ! empty( $loaded_language ) ) {
141
-			$step_1 .= '&amp;language=' . $loaded_language;
140
+		if ( ! empty($loaded_language)) {
141
+			$step_1 .= '&amp;language='.$loaded_language;
142 142
 		}
143 143
 ?>
144
-<h1 class="screen-reader-text"><?php _e( 'Before getting started' ) ?></h1>
145
-<p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
144
+<h1 class="screen-reader-text"><?php _e('Before getting started') ?></h1>
145
+<p><?php _e('Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.') ?></p>
146 146
 <ol>
147
-	<li><?php _e( 'Database name' ); ?></li>
148
-	<li><?php _e( 'Database username' ); ?></li>
149
-	<li><?php _e( 'Database password' ); ?></li>
150
-	<li><?php _e( 'Database host' ); ?></li>
151
-	<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
147
+	<li><?php _e('Database name'); ?></li>
148
+	<li><?php _e('Database username'); ?></li>
149
+	<li><?php _e('Database password'); ?></li>
150
+	<li><?php _e('Database host'); ?></li>
151
+	<li><?php _e('Table prefix (if you want to run more than one WordPress in a single database)'); ?></li>
152 152
 </ol>
153 153
 <p><?php
154 154
 	/* translators: %s: wp-config.php */
155
-	printf( __( 'We&#8217;re going to use this information to create a %s file.' ),
155
+	printf(__('We&#8217;re going to use this information to create a %s file.'),
156 156
 		'<code>wp-config.php</code>'
157 157
 	);
158 158
 	?>
159 159
 	<strong><?php
160 160
 		/* translators: 1: wp-config-sample.php, 2: wp-config.php */
161
-		printf( __( 'If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.' ),
161
+		printf(__('If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open %1$s in a text editor, fill in your information, and save it as %2$s.'),
162 162
 			'<code>wp-config-sample.php</code>',
163 163
 			'<code>wp-config.php</code>'
164 164
 		);
165 165
 	?></strong>
166 166
 	<?php
167 167
 	/* translators: %s: Codex URL */
168
-	printf( __( 'Need more help? <a href="%s">We got it</a>.' ),
169
-		__( 'https://codex.wordpress.org/Editing_wp-config.php' )
168
+	printf(__('Need more help? <a href="%s">We got it</a>.'),
169
+		__('https://codex.wordpress.org/Editing_wp-config.php')
170 170
 	);
171 171
 ?></p>
172
-<p><?php _e( 'In all likelihood, these items were supplied to you by your Web Host. If you don&#8217;t have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;' ); ?></p>
172
+<p><?php _e('In all likelihood, these items were supplied to you by your Web Host. If you don&#8217;t have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;'); ?></p>
173 173
 
174
-<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
174
+<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e('Let&#8217;s go!'); ?></a></p>
175 175
 <?php
176 176
 	break;
177 177
 
178 178
 	case 1:
179
-		load_default_textdomain( $language );
179
+		load_default_textdomain($language);
180 180
 		$GLOBALS['wp_locale'] = new WP_Locale();
181 181
 
182 182
 		setup_config_display_header();
183 183
 	?>
184
-<h1 class="screen-reader-text"><?php _e( 'Set up your database connection' ) ?></h1>
184
+<h1 class="screen-reader-text"><?php _e('Set up your database connection') ?></h1>
185 185
 <form method="post" action="setup-config.php?step=2">
186
-	<p><?php _e( 'Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.' ); ?></p>
186
+	<p><?php _e('Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host.'); ?></p>
187 187
 	<table class="form-table">
188 188
 		<tr>
189
-			<th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
189
+			<th scope="row"><label for="dbname"><?php _e('Database Name'); ?></label></th>
190 190
 			<td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
191
-			<td><?php _e( 'The name of the database you want to use with WordPress.' ); ?></td>
191
+			<td><?php _e('The name of the database you want to use with WordPress.'); ?></td>
192 192
 		</tr>
193 193
 		<tr>
194
-			<th scope="row"><label for="uname"><?php _e( 'Username' ); ?></label></th>
195
-			<td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td>
196
-			<td><?php _e( 'Your database username.' ); ?></td>
194
+			<th scope="row"><label for="uname"><?php _e('Username'); ?></label></th>
195
+			<td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars(_x('username', 'example username'), ENT_QUOTES); ?>" /></td>
196
+			<td><?php _e('Your database username.'); ?></td>
197 197
 		</tr>
198 198
 		<tr>
199
-			<th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th>
200
-			<td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td>
201
-			<td><?php _e( 'Your database password.' ); ?></td>
199
+			<th scope="row"><label for="pwd"><?php _e('Password'); ?></label></th>
200
+			<td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars(_x('password', 'example password'), ENT_QUOTES); ?>" autocomplete="off" /></td>
201
+			<td><?php _e('Your database password.'); ?></td>
202 202
 		</tr>
203 203
 		<tr>
204
-			<th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
204
+			<th scope="row"><label for="dbhost"><?php _e('Database Host'); ?></label></th>
205 205
 			<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
206 206
 			<td><?php
207 207
 				/* translators: %s: localhost */
208
-				printf( __( 'You should be able to get this info from your web host, if %s doesn&#8217;t work.' ),'<code>localhost</code>' );
208
+				printf(__('You should be able to get this info from your web host, if %s doesn&#8217;t work.'), '<code>localhost</code>');
209 209
 			?></td>
210 210
 		</tr>
211 211
 		<tr>
212
-			<th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
212
+			<th scope="row"><label for="prefix"><?php _e('Table Prefix'); ?></label></th>
213 213
 			<td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td>
214
-			<td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
214
+			<td><?php _e('If you want to run multiple WordPress installations in a single database, change this.'); ?></td>
215 215
 		</tr>
216 216
 	</table>
217
-	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
218
-	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
219
-	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
217
+	<?php if (isset($_GET['noapi'])) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
218
+	<input type="hidden" name="language" value="<?php echo esc_attr($language); ?>" />
219
+	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars(__('Submit'), ENT_QUOTES); ?>" class="button button-large" /></p>
220 220
 </form>
221 221
 <?php
222 222
 	break;
223 223
 
224 224
 	case 2:
225
-	load_default_textdomain( $language );
225
+	load_default_textdomain($language);
226 226
 	$GLOBALS['wp_locale'] = new WP_Locale();
227 227
 
228
-	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
229
-	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
230
-	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
231
-	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
232
-	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
228
+	$dbname = trim(wp_unslash($_POST['dbname']));
229
+	$uname = trim(wp_unslash($_POST['uname']));
230
+	$pwd = trim(wp_unslash($_POST['pwd']));
231
+	$dbhost = trim(wp_unslash($_POST['dbhost']));
232
+	$prefix = trim(wp_unslash($_POST['prefix']));
233 233
 
234 234
 	$step_1 = 'setup-config.php?step=1';
235 235
 	$install = 'install.php';
236
-	if ( isset( $_REQUEST['noapi'] ) ) {
236
+	if (isset($_REQUEST['noapi'])) {
237 237
 		$step_1 .= '&amp;noapi';
238 238
 	}
239 239
 
240
-	if ( ! empty( $language ) ) {
241
-		$step_1 .= '&amp;language=' . $language;
242
-		$install .= '?language=' . $language;
240
+	if ( ! empty($language)) {
241
+		$step_1 .= '&amp;language='.$language;
242
+		$install .= '?language='.$language;
243 243
 	} else {
244 244
 		$install .= '?language=en_US';
245 245
 	}
246 246
 
247
-	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
247
+	$tryagain_link = '</p><p class="step"><a href="'.$step_1.'" onclick="javascript:history.go(-1);return false;" class="button button-large">'.__('Try again').'</a>';
248 248
 
249
-	if ( empty( $prefix ) )
250
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
249
+	if (empty($prefix))
250
+		wp_die(__('<strong>ERROR</strong>: "Table Prefix" must not be empty.'.$tryagain_link));
251 251
 
252 252
 	// Validate $prefix: it can only contain letters, numbers and underscores.
253
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
254
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
253
+	if (preg_match('|[^a-z0-9_]|i', $prefix))
254
+		wp_die(__('<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'.$tryagain_link));
255 255
 
256 256
 	// Test the db connection.
257 257
 	/**#@+
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	/**#@-*/
265 265
 
266 266
 	// Re-construct $wpdb with these new values.
267
-	unset( $wpdb );
267
+	unset($wpdb);
268 268
 	require_wp_db();
269 269
 
270 270
 	/*
@@ -273,64 +273,64 @@  discard block
 block discarded – undo
273 273
 	 */
274 274
 	$wpdb->db_connect();
275 275
 
276
-	if ( ! empty( $wpdb->error ) )
277
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
276
+	if ( ! empty($wpdb->error))
277
+		wp_die($wpdb->error->get_error_message().$tryagain_link);
278 278
 
279 279
 	// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
280 280
 	try {
281 281
 		$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_ []{}<>~`+=,.;:/?|';
282 282
 		$max = strlen($chars) - 1;
283
-		for ( $i = 0; $i < 8; $i++ ) {
283
+		for ($i = 0; $i < 8; $i++) {
284 284
 			$key = '';
285
-			for ( $j = 0; $j < 64; $j++ ) {
286
-				$key .= substr( $chars, random_int( 0, $max ), 1 );
285
+			for ($j = 0; $j < 64; $j++) {
286
+				$key .= substr($chars, random_int(0, $max), 1);
287 287
 			}
288 288
 			$secret_keys[] = $key;
289 289
 		}
290
-	} catch ( Exception $ex ) {
291
-		$no_api = isset( $_POST['noapi'] );
290
+	} catch (Exception $ex) {
291
+		$no_api = isset($_POST['noapi']);
292 292
 
293
-		if ( ! $no_api ) {
294
-			$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
293
+		if ( ! $no_api) {
294
+			$secret_keys = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
295 295
 		}
296 296
 
297
-		if ( $no_api || is_wp_error( $secret_keys ) ) {
297
+		if ($no_api || is_wp_error($secret_keys)) {
298 298
 			$secret_keys = array();
299
-			for ( $i = 0; $i < 8; $i++ ) {
300
-				$secret_keys[] = wp_generate_password( 64, true, true );
299
+			for ($i = 0; $i < 8; $i++) {
300
+				$secret_keys[] = wp_generate_password(64, true, true);
301 301
 			}
302 302
 		} else {
303
-			$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
304
-			foreach ( $secret_keys as $k => $v ) {
305
-				$secret_keys[$k] = substr( $v, 28, 64 );
303
+			$secret_keys = explode("\n", wp_remote_retrieve_body($secret_keys));
304
+			foreach ($secret_keys as $k => $v) {
305
+				$secret_keys[$k] = substr($v, 28, 64);
306 306
 			}
307 307
 		}
308 308
 	}
309 309
 
310 310
 	$key = 0;
311 311
 	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
312
-	foreach ( $config_file as $line_num => $line ) {
313
-		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
314
-			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
312
+	foreach ($config_file as $line_num => $line) {
313
+		if ('$table_prefix  =' == substr($line, 0, 16)) {
314
+			$config_file[$line_num] = '$table_prefix  = \''.addcslashes($prefix, "\\'")."';\r\n";
315 315
 			continue;
316 316
 		}
317 317
 
318
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
318
+		if ( ! preg_match('/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match))
319 319
 			continue;
320 320
 
321 321
 		$constant = $match[1];
322 322
 		$padding  = $match[2];
323 323
 
324
-		switch ( $constant ) {
324
+		switch ($constant) {
325 325
 			case 'DB_NAME'     :
326 326
 			case 'DB_USER'     :
327 327
 			case 'DB_PASSWORD' :
328 328
 			case 'DB_HOST'     :
329
-				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
329
+				$config_file[$line_num] = "define('".$constant."',".$padding."'".addcslashes(constant($constant), "\\'")."');\r\n";
330 330
 				break;
331 331
 			case 'DB_CHARSET'  :
332
-				if ( 'utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap( 'utf8mb4' ) ) ) {
333
-					$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'utf8mb4');\r\n";
332
+				if ('utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap('utf8mb4'))) {
333
+					$config_file[$line_num] = "define('".$constant."',".$padding."'utf8mb4');\r\n";
334 334
 				}
335 335
 				break;
336 336
 			case 'AUTH_KEY'         :
@@ -341,30 +341,30 @@  discard block
 block discarded – undo
341 341
 			case 'SECURE_AUTH_SALT' :
342 342
 			case 'LOGGED_IN_SALT'   :
343 343
 			case 'NONCE_SALT'       :
344
-				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
344
+				$config_file[$line_num] = "define('".$constant."',".$padding."'".$secret_keys[$key++]."');\r\n";
345 345
 				break;
346 346
 		}
347 347
 	}
348
-	unset( $line );
348
+	unset($line);
349 349
 
350
-	if ( ! is_writable(ABSPATH) ) :
350
+	if ( ! is_writable(ABSPATH)) :
351 351
 		setup_config_display_header();
352 352
 ?>
353 353
 <p><?php
354 354
 	/* translators: %s: wp-config.php */
355
-	printf( __( 'Sorry, but I can&#8217;t write the %s file.' ), '<code>wp-config.php</code>' );
355
+	printf(__('Sorry, but I can&#8217;t write the %s file.'), '<code>wp-config.php</code>');
356 356
 ?></p>
357 357
 <p><?php
358 358
 	/* translators: %s: wp-config.php */
359
-	printf( __( 'You can create the %s manually and paste the following text into it.' ), '<code>wp-config.php</code>' );
359
+	printf(__('You can create the %s manually and paste the following text into it.'), '<code>wp-config.php</code>');
360 360
 ?></p>
361 361
 <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php
362
-		foreach ( $config_file as $line ) {
362
+		foreach ($config_file as $line) {
363 363
 			echo htmlentities($line, ENT_COMPAT, 'UTF-8');
364 364
 		}
365 365
 ?></textarea>
366
-<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the install.&#8221;' ); ?></p>
367
-<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
366
+<p><?php _e('After you&#8217;ve done that, click &#8220;Run the install.&#8221;'); ?></p>
367
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e('Run the install'); ?></a></p>
368 368
 <script>
369 369
 (function(){
370 370
 if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
@@ -380,28 +380,28 @@  discard block
 block discarded – undo
380 380
 		 * If this file doesn't exist, then we are using the wp-config-sample.php
381 381
 		 * file one level up, which is for the develop repo.
382 382
 		 */
383
-		if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
384
-			$path_to_wp_config = ABSPATH . 'wp-config.php';
383
+		if (file_exists(ABSPATH.'wp-config-sample.php'))
384
+			$path_to_wp_config = ABSPATH.'wp-config.php';
385 385
 		else
386
-			$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
386
+			$path_to_wp_config = dirname(ABSPATH).'/wp-config.php';
387 387
 
388
-		$handle = fopen( $path_to_wp_config, 'w' );
389
-		foreach ( $config_file as $line ) {
390
-			fwrite( $handle, $line );
388
+		$handle = fopen($path_to_wp_config, 'w');
389
+		foreach ($config_file as $line) {
390
+			fwrite($handle, $line);
391 391
 		}
392
-		fclose( $handle );
393
-		chmod( $path_to_wp_config, 0666 );
392
+		fclose($handle);
393
+		chmod($path_to_wp_config, 0666);
394 394
 		setup_config_display_header();
395 395
 ?>
396
-<h1 class="screen-reader-text"><?php _e( 'Successful database connection' ) ?></h1>
397
-<p><?php _e( 'All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;' ); ?></p>
396
+<h1 class="screen-reader-text"><?php _e('Successful database connection') ?></h1>
397
+<p><?php _e('All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;'); ?></p>
398 398
 
399
-<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
399
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e('Run the install'); ?></a></p>
400 400
 <?php
401 401
 	endif;
402 402
 	break;
403 403
 }
404 404
 ?>
405
-<?php wp_print_scripts( 'language-chooser' ); ?>
405
+<?php wp_print_scripts('language-chooser'); ?>
406 406
 </body>
407 407
 </html>
Please login to merge, or discard this patch.
Braces   +28 added lines, -16 removed lines patch added patch discarded remove patch
@@ -41,21 +41,23 @@  discard block
 block discarded – undo
41 41
 nocache_headers();
42 42
 
43 43
 // Support wp-config-sample.php one level up, for the develop repo.
44
-if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
44
+if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) {
45 45
 	$config_file = file( ABSPATH . 'wp-config-sample.php' );
46
-elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
46
+} elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) {
47 47
 	$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
48
-else
48
+} else {
49 49
 	wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file to your WordPress installation.' ) );
50
+}
50 51
 
51 52
 // Check if wp-config.php has been created
52
-if ( file_exists( ABSPATH . 'wp-config.php' ) )
53
+if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
53 54
 	wp_die( '<p>' . sprintf(
54 55
 			/* translators: %s: install.php */
55 56
 			__( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ),
56 57
 			'install.php'
57 58
 		) . '</p>'
58 59
 	);
60
+}
59 61
 
60 62
 // Check if wp-config.php exists above the root directory but is not part of another install
61 63
 if ( @file_exists( ABSPATH . '../wp-config.php' ) && ! @file_exists( ABSPATH . '../wp-settings.php' ) ) {
@@ -90,7 +92,10 @@  discard block
 block discarded – undo
90 92
 	header( 'Content-Type: text/html; charset=utf-8' );
91 93
 ?>
92 94
 <!DOCTYPE html>
93
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
95
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
96
+	echo ' dir="rtl"';
97
+}
98
+?>>
94 99
 <head>
95 100
 	<meta name="viewport" content="width=device-width" />
96 101
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -246,12 +251,14 @@  discard block
 block discarded – undo
246 251
 
247 252
 	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
248 253
 
249
-	if ( empty( $prefix ) )
250
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
254
+	if ( empty( $prefix ) ) {
255
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
256
+	}
251 257
 
252 258
 	// Validate $prefix: it can only contain letters, numbers and underscores.
253
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
254
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
259
+	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
260
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
261
+	}
255 262
 
256 263
 	// Test the db connection.
257 264
 	/**#@+
@@ -273,8 +280,9 @@  discard block
 block discarded – undo
273 280
 	 */
274 281
 	$wpdb->db_connect();
275 282
 
276
-	if ( ! empty( $wpdb->error ) )
277
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
283
+	if ( ! empty( $wpdb->error ) ) {
284
+			wp_die( $wpdb->error->get_error_message() . $tryagain_link );
285
+	}
278 286
 
279 287
 	// Generate keys and salts using secure CSPRNG; fallback to API if enabled; further fallback to original wp_generate_password().
280 288
 	try {
@@ -315,8 +323,9 @@  discard block
 block discarded – undo
315 323
 			continue;
316 324
 		}
317 325
 
318
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
319
-			continue;
326
+		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) {
327
+					continue;
328
+		}
320 329
 
321 330
 		$constant = $match[1];
322 331
 		$padding  = $match[2];
@@ -375,15 +384,18 @@  discard block
 block discarded – undo
375 384
 })();
376 385
 </script>
377 386
 <?php
378
-	else :
387
+	else {
388
+		:
379 389
 		/*
380 390
 		 * If this file doesn't exist, then we are using the wp-config-sample.php
381 391
 		 * file one level up, which is for the develop repo.
382 392
 		 */
383 393
 		if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
384 394
 			$path_to_wp_config = ABSPATH . 'wp-config.php';
385
-		else
386
-			$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
395
+	}
396
+		else {
397
+					$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
398
+		}
387 399
 
388 400
 		$handle = fopen( $path_to_wp_config, 'w' );
389 401
 		foreach ( $config_file as $line ) {
Please login to merge, or discard this patch.
src/wp-admin/export.php 3 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -280,10 +280,10 @@
 block discarded – undo
280 280
 </fieldset>
281 281
 <?php
282 282
 /**
283
- * Fires at the end of the export filters form.
284
- *
285
- * @since 3.5.0
286
- */
283
+		 * Fires at the end of the export filters form.
284
+		 *
285
+		 * @since 3.5.0
286
+		 */
287 287
 do_action( 'export_filters' );
288 288
 ?>
289 289
 
Please login to merge, or discard this patch.
Spacing   +89 added lines, -89 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( !current_user_can('export') )
12
+if ( ! current_user_can('export'))
13 13
 	wp_die(__('You do not have sufficient permissions to export the content of this site.'));
14 14
 
15 15
 /** Load WordPress export API */
16
-require_once( ABSPATH . 'wp-admin/includes/export.php' );
16
+require_once(ABSPATH.'wp-admin/includes/export.php');
17 17
 $title = __('Export');
18 18
 
19 19
 /**
@@ -40,60 +40,60 @@  discard block
 block discarded – undo
40 40
 </script>
41 41
 <?php
42 42
 }
43
-add_action( 'admin_head', 'export_add_js' );
43
+add_action('admin_head', 'export_add_js');
44 44
 
45
-get_current_screen()->add_help_tab( array(
45
+get_current_screen()->add_help_tab(array(
46 46
 	'id'      => 'overview',
47 47
 	'title'   => __('Overview'),
48
-	'content' => '<p>' . __('You can export a file of your site&#8217;s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.') . '</p>' .
49
-		'<p>' . __('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.') . '</p>',
50
-) );
48
+	'content' => '<p>'.__('You can export a file of your site&#8217;s content in order to import it into another installation or platform. The export file will be an XML file format called WXR. Posts, pages, comments, custom fields, categories, and tags can be included. You can choose for the WXR file to include only certain posts or pages by setting the dropdown filters to limit the export by category, author, date range by month, or publishing status.').'</p>'.
49
+		'<p>'.__('Once generated, your WXR file can be imported by another WordPress site or by another blogging platform able to access this format.').'</p>',
50
+));
51 51
 
52 52
 get_current_screen()->set_help_sidebar(
53
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
54
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>') . '</p>' .
55
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
53
+	'<p><strong>'.__('For more information:').'</strong></p>'.
54
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Export_Screen" target="_blank">Documentation on Export</a>').'</p>'.
55
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
56 56
 );
57 57
 
58 58
 // If the 'download' URL parameter is set, a WXR export file is baked and returned.
59
-if ( isset( $_GET['download'] ) ) {
59
+if (isset($_GET['download'])) {
60 60
 	$args = array();
61 61
 
62
-	if ( ! isset( $_GET['content'] ) || 'all' == $_GET['content'] ) {
62
+	if ( ! isset($_GET['content']) || 'all' == $_GET['content']) {
63 63
 		$args['content'] = 'all';
64
-	} elseif ( 'posts' == $_GET['content'] ) {
64
+	} elseif ('posts' == $_GET['content']) {
65 65
 		$args['content'] = 'post';
66 66
 
67
-		if ( $_GET['cat'] )
67
+		if ($_GET['cat'])
68 68
 			$args['category'] = (int) $_GET['cat'];
69 69
 
70
-		if ( $_GET['post_author'] )
70
+		if ($_GET['post_author'])
71 71
 			$args['author'] = (int) $_GET['post_author'];
72 72
 
73
-		if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) {
73
+		if ($_GET['post_start_date'] || $_GET['post_end_date']) {
74 74
 			$args['start_date'] = $_GET['post_start_date'];
75 75
 			$args['end_date'] = $_GET['post_end_date'];
76 76
 		}
77 77
 
78
-		if ( $_GET['post_status'] )
78
+		if ($_GET['post_status'])
79 79
 			$args['status'] = $_GET['post_status'];
80
-	} elseif ( 'pages' == $_GET['content'] ) {
80
+	} elseif ('pages' == $_GET['content']) {
81 81
 		$args['content'] = 'page';
82 82
 
83
-		if ( $_GET['page_author'] )
83
+		if ($_GET['page_author'])
84 84
 			$args['author'] = (int) $_GET['page_author'];
85 85
 
86
-		if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) {
86
+		if ($_GET['page_start_date'] || $_GET['page_end_date']) {
87 87
 			$args['start_date'] = $_GET['page_start_date'];
88 88
 			$args['end_date'] = $_GET['page_end_date'];
89 89
 		}
90 90
 
91
-		if ( $_GET['page_status'] )
91
+		if ($_GET['page_status'])
92 92
 			$args['status'] = $_GET['page_status'];
93
-	} elseif ( 'attachment' == $_GET['content'] ) {
93
+	} elseif ('attachment' == $_GET['content']) {
94 94
 		$args['content'] = 'attachment';
95 95
 
96
-		if ( $_GET['attachment_start_date'] || $_GET['attachment_end_date'] ) {
96
+		if ($_GET['attachment_start_date'] || $_GET['attachment_end_date']) {
97 97
 			$args['start_date'] = $_GET['attachment_start_date'];
98 98
 			$args['end_date'] = $_GET['attachment_end_date'];
99 99
 		}
@@ -109,13 +109,13 @@  discard block
 block discarded – undo
109 109
 	 *
110 110
 	 * @param array $args The arguments to send to the exporter.
111 111
 	 */
112
-	$args = apply_filters( 'export_args', $args );
112
+	$args = apply_filters('export_args', $args);
113 113
 
114
-	export_wp( $args );
114
+	export_wp($args);
115 115
 	die();
116 116
 }
117 117
 
118
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
118
+require_once(ABSPATH.'wp-admin/admin-header.php');
119 119
 
120 120
 /**
121 121
  * Create the date options fields for exporting a given post type.
@@ -127,151 +127,151 @@  discard block
 block discarded – undo
127 127
  *
128 128
  * @param string $post_type The post type. Default 'post'.
129 129
  */
130
-function export_date_options( $post_type = 'post' ) {
130
+function export_date_options($post_type = 'post') {
131 131
 	global $wpdb, $wp_locale;
132 132
 
133
-	$months = $wpdb->get_results( $wpdb->prepare( "
133
+	$months = $wpdb->get_results($wpdb->prepare("
134 134
 		SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
135 135
 		FROM $wpdb->posts
136 136
 		WHERE post_type = %s AND post_status != 'auto-draft'
137 137
 		ORDER BY post_date DESC
138
-	", $post_type ) );
138
+	", $post_type));
139 139
 
140
-	$month_count = count( $months );
141
-	if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
140
+	$month_count = count($months);
141
+	if ( ! $month_count || (1 == $month_count && 0 == $months[0]->month))
142 142
 		return;
143 143
 
144
-	foreach ( $months as $date ) {
145
-		if ( 0 == $date->year )
144
+	foreach ($months as $date) {
145
+		if (0 == $date->year)
146 146
 			continue;
147 147
 
148
-		$month = zeroise( $date->month, 2 );
149
-		echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
148
+		$month = zeroise($date->month, 2);
149
+		echo '<option value="'.$date->year.'-'.$month.'">'.$wp_locale->get_month($month).' '.$date->year.'</option>';
150 150
 	}
151 151
 }
152 152
 ?>
153 153
 
154 154
 <div class="wrap">
155
-<h1><?php echo esc_html( $title ); ?></h1>
155
+<h1><?php echo esc_html($title); ?></h1>
156 156
 
157 157
 <p><?php _e('When you click the button below WordPress will create an XML file for you to save to your computer.'); ?></p>
158 158
 <p><?php _e('This format, which we call WordPress eXtended RSS or WXR, will contain your posts, pages, comments, custom fields, categories, and tags.'); ?></p>
159 159
 <p><?php _e('Once you&#8217;ve saved the download file, you can use the Import function in another WordPress installation to import the content from this site.'); ?></p>
160 160
 
161
-<h2><?php _e( 'Choose what to export' ); ?></h2>
161
+<h2><?php _e('Choose what to export'); ?></h2>
162 162
 <form method="get" id="export-filters">
163 163
 <fieldset>
164
-<legend class="screen-reader-text"><?php _e( 'Content to export' ); ?></legend>
164
+<legend class="screen-reader-text"><?php _e('Content to export'); ?></legend>
165 165
 <input type="hidden" name="download" value="true" />
166
-<p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /> <?php _e( 'All content' ); ?></label></p>
167
-<p class="description" id="all-content-desc"><?php _e( 'This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.' ); ?></p>
166
+<p><label><input type="radio" name="content" value="all" checked="checked" aria-describedby="all-content-desc" /> <?php _e('All content'); ?></label></p>
167
+<p class="description" id="all-content-desc"><?php _e('This will contain all of your posts, pages, comments, custom fields, terms, navigation menus, and custom posts.'); ?></p>
168 168
 
169
-<p><label><input type="radio" name="content" value="posts" /> <?php _e( 'Posts' ); ?></label></p>
169
+<p><label><input type="radio" name="content" value="posts" /> <?php _e('Posts'); ?></label></p>
170 170
 <ul id="post-filters" class="export-filters">
171 171
 	<li>
172
-		<label><span class="label-responsive"><?php _e( 'Categories:' ); ?></span>
173
-		<?php wp_dropdown_categories( array( 'show_option_all' => __('All') ) ); ?>
172
+		<label><span class="label-responsive"><?php _e('Categories:'); ?></span>
173
+		<?php wp_dropdown_categories(array('show_option_all' => __('All'))); ?>
174 174
 		</label>
175 175
 	</li>
176 176
 	<li>
177
-		<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
177
+		<label><span class="label-responsive"><?php _e('Authors:'); ?></span>
178 178
 		<?php
179
-		$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'" );
180
-		wp_dropdown_users( array(
179
+		$authors = $wpdb->get_col("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'post'");
180
+		wp_dropdown_users(array(
181 181
 			'include' => $authors,
182 182
 			'name' => 'post_author',
183 183
 			'multi' => true,
184
-			'show_option_all' => __( 'All' ),
184
+			'show_option_all' => __('All'),
185 185
 			'show' => 'display_name_with_login',
186
-		) ); ?>
186
+		)); ?>
187 187
 		</label>
188 188
 	</li>
189 189
 	<li>
190 190
 		<fieldset>
191
-		<legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
192
-		<label for="post-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
191
+		<legend class="screen-reader-text"><?php _e('Date range:'); ?></legend>
192
+		<label for="post-start-date" class="label-responsive"><?php _e('Start date:'); ?></label>
193 193
 		<select name="post_start_date" id="post-start-date">
194
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
194
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
195 195
 			<?php export_date_options(); ?>
196 196
 		</select>
197
-		<label for="post-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
197
+		<label for="post-end-date" class="label-responsive"><?php _e('End date:'); ?></label>
198 198
 		<select name="post_end_date" id="post-end-date">
199
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
199
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
200 200
 			<?php export_date_options(); ?>
201 201
 		</select>
202 202
 		</fieldset>
203 203
 	</li>
204 204
 	<li>
205
-		<label for="post-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
205
+		<label for="post-status" class="label-responsive"><?php _e('Status:'); ?></label>
206 206
 		<select name="post_status" id="post-status">
207
-			<option value="0"><?php _e( 'All' ); ?></option>
208
-			<?php $post_stati = get_post_stati( array( 'internal' => false ), 'objects' );
209
-			foreach ( $post_stati as $status ) : ?>
210
-			<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
207
+			<option value="0"><?php _e('All'); ?></option>
208
+			<?php $post_stati = get_post_stati(array('internal' => false), 'objects');
209
+			foreach ($post_stati as $status) : ?>
210
+			<option value="<?php echo esc_attr($status->name); ?>"><?php echo esc_html($status->label); ?></option>
211 211
 			<?php endforeach; ?>
212 212
 		</select>
213 213
 	</li>
214 214
 </ul>
215 215
 
216
-<p><label><input type="radio" name="content" value="pages" /> <?php _e( 'Pages' ); ?></label></p>
216
+<p><label><input type="radio" name="content" value="pages" /> <?php _e('Pages'); ?></label></p>
217 217
 <ul id="page-filters" class="export-filters">
218 218
 	<li>
219
-		<label><span class="label-responsive"><?php _e( 'Authors:' ); ?></span>
219
+		<label><span class="label-responsive"><?php _e('Authors:'); ?></span>
220 220
 		<?php
221
-		$authors = $wpdb->get_col( "SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'" );
222
-		wp_dropdown_users( array(
221
+		$authors = $wpdb->get_col("SELECT DISTINCT post_author FROM {$wpdb->posts} WHERE post_type = 'page'");
222
+		wp_dropdown_users(array(
223 223
 			'include' => $authors,
224 224
 			'name' => 'page_author',
225 225
 			'multi' => true,
226
-			'show_option_all' => __( 'All' ),
226
+			'show_option_all' => __('All'),
227 227
 			'show' => 'display_name_with_login',
228
-		) ); ?>
228
+		)); ?>
229 229
 		</label>
230 230
 	</li>
231 231
 	<li>
232 232
 		<fieldset>
233
-		<legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
234
-		<label for="page-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
233
+		<legend class="screen-reader-text"><?php _e('Date range:'); ?></legend>
234
+		<label for="page-start-date" class="label-responsive"><?php _e('Start date:'); ?></label>
235 235
 		<select name="page_start_date" id="page-start-date">
236
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
237
-			<?php export_date_options( 'page' ); ?>
236
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
237
+			<?php export_date_options('page'); ?>
238 238
 		</select>
239
-		<label for="page-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
239
+		<label for="page-end-date" class="label-responsive"><?php _e('End date:'); ?></label>
240 240
 		<select name="page_end_date" id="page-end-date">
241
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
242
-			<?php export_date_options( 'page' ); ?>
241
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
242
+			<?php export_date_options('page'); ?>
243 243
 		</select>
244 244
 		</fieldset>
245 245
 	</li>
246 246
 	<li>
247
-		<label for="page-status" class="label-responsive"><?php _e( 'Status:' ); ?></label>
247
+		<label for="page-status" class="label-responsive"><?php _e('Status:'); ?></label>
248 248
 		<select name="page_status" id="page-status">
249
-			<option value="0"><?php _e( 'All' ); ?></option>
250
-			<?php foreach ( $post_stati as $status ) : ?>
251
-			<option value="<?php echo esc_attr( $status->name ); ?>"><?php echo esc_html( $status->label ); ?></option>
249
+			<option value="0"><?php _e('All'); ?></option>
250
+			<?php foreach ($post_stati as $status) : ?>
251
+			<option value="<?php echo esc_attr($status->name); ?>"><?php echo esc_html($status->label); ?></option>
252 252
 			<?php endforeach; ?>
253 253
 		</select>
254 254
 	</li>
255 255
 </ul>
256 256
 
257
-<?php foreach ( get_post_types( array( '_builtin' => false, 'can_export' => true ), 'objects' ) as $post_type ) : ?>
258
-<p><label><input type="radio" name="content" value="<?php echo esc_attr( $post_type->name ); ?>" /> <?php echo esc_html( $post_type->label ); ?></label></p>
257
+<?php foreach (get_post_types(array('_builtin' => false, 'can_export' => true), 'objects') as $post_type) : ?>
258
+<p><label><input type="radio" name="content" value="<?php echo esc_attr($post_type->name); ?>" /> <?php echo esc_html($post_type->label); ?></label></p>
259 259
 <?php endforeach; ?>
260 260
 
261
-<p><label><input type="radio" name="content" value="attachment" /> <?php _e( 'Media' ); ?></label></p>
261
+<p><label><input type="radio" name="content" value="attachment" /> <?php _e('Media'); ?></label></p>
262 262
 <ul id="attachment-filters" class="export-filters">
263 263
 	<li>
264 264
 		<fieldset>
265
-		<legend class="screen-reader-text"><?php _e( 'Date range:' ); ?></legend>
266
-		<label for="attachment-start-date" class="label-responsive"><?php _e( 'Start date:' ); ?></label>
265
+		<legend class="screen-reader-text"><?php _e('Date range:'); ?></legend>
266
+		<label for="attachment-start-date" class="label-responsive"><?php _e('Start date:'); ?></label>
267 267
 		<select name="attachment_start_date" id="attachment-start-date">
268
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
269
-			<?php export_date_options( 'attachment' ); ?>
268
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
269
+			<?php export_date_options('attachment'); ?>
270 270
 		</select>
271
-		<label for="attachment-end-date" class="label-responsive"><?php _e( 'End date:' ); ?></label>
271
+		<label for="attachment-end-date" class="label-responsive"><?php _e('End date:'); ?></label>
272 272
 		<select name="attachment_end_date" id="attachment-end-date">
273
-			<option value="0"><?php _e( '&mdash; Select &mdash;' ); ?></option>
274
-			<?php export_date_options( 'attachment' ); ?>
273
+			<option value="0"><?php _e('&mdash; Select &mdash;'); ?></option>
274
+			<?php export_date_options('attachment'); ?>
275 275
 		</select>
276 276
 		</fieldset>
277 277
 	</li>
@@ -284,11 +284,11 @@  discard block
 block discarded – undo
284 284
  *
285 285
  * @since 3.5.0
286 286
  */
287
-do_action( 'export_filters' );
287
+do_action('export_filters');
288 288
 ?>
289 289
 
290
-<?php submit_button( __('Download Export File') ); ?>
290
+<?php submit_button(__('Download Export File')); ?>
291 291
 </form>
292 292
 </div>
293 293
 
294
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
294
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** Load WordPress Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( !current_user_can('export') )
12
+if ( !current_user_can('export') ) {
13 13
 	wp_die(__('You do not have sufficient permissions to export the content of this site.'));
14
+}
14 15
 
15 16
 /** Load WordPress export API */
16 17
 require_once( ABSPATH . 'wp-admin/includes/export.php' );
@@ -64,32 +65,37 @@  discard block
 block discarded – undo
64 65
 	} elseif ( 'posts' == $_GET['content'] ) {
65 66
 		$args['content'] = 'post';
66 67
 
67
-		if ( $_GET['cat'] )
68
-			$args['category'] = (int) $_GET['cat'];
68
+		if ( $_GET['cat'] ) {
69
+					$args['category'] = (int) $_GET['cat'];
70
+		}
69 71
 
70
-		if ( $_GET['post_author'] )
71
-			$args['author'] = (int) $_GET['post_author'];
72
+		if ( $_GET['post_author'] ) {
73
+					$args['author'] = (int) $_GET['post_author'];
74
+		}
72 75
 
73 76
 		if ( $_GET['post_start_date'] || $_GET['post_end_date'] ) {
74 77
 			$args['start_date'] = $_GET['post_start_date'];
75 78
 			$args['end_date'] = $_GET['post_end_date'];
76 79
 		}
77 80
 
78
-		if ( $_GET['post_status'] )
79
-			$args['status'] = $_GET['post_status'];
81
+		if ( $_GET['post_status'] ) {
82
+					$args['status'] = $_GET['post_status'];
83
+		}
80 84
 	} elseif ( 'pages' == $_GET['content'] ) {
81 85
 		$args['content'] = 'page';
82 86
 
83
-		if ( $_GET['page_author'] )
84
-			$args['author'] = (int) $_GET['page_author'];
87
+		if ( $_GET['page_author'] ) {
88
+					$args['author'] = (int) $_GET['page_author'];
89
+		}
85 90
 
86 91
 		if ( $_GET['page_start_date'] || $_GET['page_end_date'] ) {
87 92
 			$args['start_date'] = $_GET['page_start_date'];
88 93
 			$args['end_date'] = $_GET['page_end_date'];
89 94
 		}
90 95
 
91
-		if ( $_GET['page_status'] )
92
-			$args['status'] = $_GET['page_status'];
96
+		if ( $_GET['page_status'] ) {
97
+					$args['status'] = $_GET['page_status'];
98
+		}
93 99
 	} elseif ( 'attachment' == $_GET['content'] ) {
94 100
 		$args['content'] = 'attachment';
95 101
 
@@ -97,8 +103,7 @@  discard block
 block discarded – undo
97 103
 			$args['start_date'] = $_GET['attachment_start_date'];
98 104
 			$args['end_date'] = $_GET['attachment_end_date'];
99 105
 		}
100
-	}
101
-	else {
106
+	} else {
102 107
 		$args['content'] = $_GET['content'];
103 108
 	}
104 109
 
@@ -138,12 +143,14 @@  discard block
 block discarded – undo
138 143
 	", $post_type ) );
139 144
 
140 145
 	$month_count = count( $months );
141
-	if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) )
142
-		return;
146
+	if ( !$month_count || ( 1 == $month_count && 0 == $months[0]->month ) ) {
147
+			return;
148
+	}
143 149
 
144 150
 	foreach ( $months as $date ) {
145
-		if ( 0 == $date->year )
146
-			continue;
151
+		if ( 0 == $date->year ) {
152
+					continue;
153
+		}
147 154
 
148 155
 		$month = zeroise( $date->month, 2 );
149 156
 		echo '<option value="' . $date->year . '-' . $month . '">' . $wp_locale->get_month( $month ) . ' ' . $date->year . '</option>';
Please login to merge, or discard this patch.
src/wp-admin/link-manager.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Link Management Administration Screen.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+		 * Link Management Administration Screen.
4
+		 *
5
+		 * @package WordPress
6
+		 * @subpackage Administration
7
+		 */
8 8
 
9 9
 /** Load WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -45,14 +45,14 @@  discard block
 block discarded – undo
45 45
 'title'		=> __('Overview'),
46 46
 'content'	=>
47 47
 	'<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
48
-    '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
49
-    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
48
+	'<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
49
+	'<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
50 50
 ) );
51 51
 get_current_screen()->add_help_tab( array(
52 52
 'id'		=> 'deleting-links',
53 53
 'title'		=> __('Deleting Links'),
54 54
 'content'	=>
55
-    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
55
+	'<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
56 56
 ) );
57 57
 
58 58
 get_current_screen()->set_help_sidebar(
Please login to merge, or discard this patch.
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -7,31 +7,31 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
-if ( ! current_user_can( 'manage_links' ) )
12
-	wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
10
+require_once(dirname(__FILE__).'/admin.php');
11
+if ( ! current_user_can('manage_links'))
12
+	wp_die(__('You do not have sufficient permissions to edit the links for this site.'));
13 13
 
14 14
 $wp_list_table = _get_list_table('WP_Links_List_Table');
15 15
 
16 16
 // Handle bulk deletes
17 17
 $doaction = $wp_list_table->current_action();
18 18
 
19
-if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) {
20
-	check_admin_referer( 'bulk-bookmarks' );
19
+if ($doaction && isset($_REQUEST['linkcheck'])) {
20
+	check_admin_referer('bulk-bookmarks');
21 21
 
22
-	if ( 'delete' == $doaction ) {
22
+	if ('delete' == $doaction) {
23 23
 		$bulklinks = (array) $_REQUEST['linkcheck'];
24
-		foreach ( $bulklinks as $link_id ) {
24
+		foreach ($bulklinks as $link_id) {
25 25
 			$link_id = (int) $link_id;
26 26
 
27
-			wp_delete_link( $link_id );
27
+			wp_delete_link($link_id);
28 28
 		}
29 29
 
30
-		wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) );
30
+		wp_redirect(add_query_arg('deleted', count($bulklinks), admin_url('link-manager.php')));
31 31
 		exit;
32 32
 	}
33
-} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
34
-	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
33
+} elseif ( ! empty($_GET['_wp_http_referer'])) {
34
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
35 35
 	 exit;
36 36
 }
37 37
 
@@ -40,49 +40,49 @@  discard block
 block discarded – undo
40 40
 $title = __('Links');
41 41
 $this_file = $parent_file = 'link-manager.php';
42 42
 
43
-get_current_screen()->add_help_tab( array(
43
+get_current_screen()->add_help_tab(array(
44 44
 'id'		=> 'overview',
45 45
 'title'		=> __('Overview'),
46 46
 'content'	=>
47
-	'<p>' . sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php') . '</p>' .
48
-    '<p>' . __('Links may be separated into Link Categories; these are different than the categories used on your posts.') . '</p>' .
49
-    '<p>' . __('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.') . '</p>'
50
-) );
51
-get_current_screen()->add_help_tab( array(
47
+	'<p>'.sprintf(__('You can add links here to be displayed on your site, usually using <a href="%s">Widgets</a>. By default, links to several sites in the WordPress community are included as examples.'), 'widgets.php').'</p>'.
48
+    '<p>'.__('Links may be separated into Link Categories; these are different than the categories used on your posts.').'</p>'.
49
+    '<p>'.__('You can customize the display of this screen using the Screen Options tab and/or the dropdown filters above the links table.').'</p>'
50
+));
51
+get_current_screen()->add_help_tab(array(
52 52
 'id'		=> 'deleting-links',
53 53
 'title'		=> __('Deleting Links'),
54 54
 'content'	=>
55
-    '<p>' . __('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.') . '</p>'
56
-) );
55
+    '<p>'.__('If you delete a link, it will be removed permanently, as Links do not have a Trash function yet.').'</p>'
56
+));
57 57
 
58 58
 get_current_screen()->set_help_sidebar(
59
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
60
-	'<p>' . __('<a href="https://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>') . '</p>' .
61
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
59
+	'<p><strong>'.__('For more information:').'</strong></p>'.
60
+	'<p>'.__('<a href="https://codex.wordpress.org/Links_Screen" target="_blank">Documentation on Managing Links</a>').'</p>'.
61
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
62 62
 );
63 63
 
64
-get_current_screen()->set_screen_reader_content( array(
65
-	'heading_list' => __( 'Links list' ),
66
-) );
64
+get_current_screen()->set_screen_reader_content(array(
65
+	'heading_list' => __('Links list'),
66
+));
67 67
 
68
-include_once( ABSPATH . 'wp-admin/admin-header.php' );
68
+include_once(ABSPATH.'wp-admin/admin-header.php');
69 69
 
70
-if ( ! current_user_can('manage_links') )
70
+if ( ! current_user_can('manage_links'))
71 71
 	wp_die(__("You do not have sufficient permissions to edit the links for this site."));
72 72
 
73 73
 ?>
74 74
 
75 75
 <div class="wrap nosubsub">
76
-<h1><?php echo esc_html( $title ); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
77
-if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
76
+<h1><?php echo esc_html($title); ?> <a href="link-add.php" class="page-title-action"><?php echo esc_html_x('Add New', 'link'); ?></a> <?php
77
+if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) {
78 78
 	/* translators: %s: search keywords */
79
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) );
79
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html(wp_unslash($_REQUEST['s'])));
80 80
 }
81 81
 ?>
82 82
 </h1>
83 83
 
84 84
 <?php
85
-if ( isset($_REQUEST['deleted']) ) {
85
+if (isset($_REQUEST['deleted'])) {
86 86
 	echo '<div id="message" class="updated notice is-dismissible"><p>';
87 87
 	$deleted = (int) $_REQUEST['deleted'];
88 88
 	printf(_n('%s link deleted.', '%s links deleted', $deleted), $deleted);
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 
94 94
 <form id="posts-filter" method="get">
95 95
 
96
-<?php $wp_list_table->search_box( __( 'Search Links' ), 'link' ); ?>
96
+<?php $wp_list_table->search_box(__('Search Links'), 'link'); ?>
97 97
 
98 98
 <?php $wp_list_table->display(); ?>
99 99
 
@@ -103,4 +103,4 @@  discard block
 block discarded – undo
103 103
 </div>
104 104
 
105 105
 <?php
106
-include( ABSPATH . 'wp-admin/admin-footer.php' );
106
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
 
9 9
 /** Load WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11
-if ( ! current_user_can( 'manage_links' ) )
11
+if ( ! current_user_can( 'manage_links' ) ) {
12 12
 	wp_die( __( 'You do not have sufficient permissions to edit the links for this site.' ) );
13
+}
13 14
 
14 15
 $wp_list_table = _get_list_table('WP_Links_List_Table');
15 16
 
@@ -67,8 +68,9 @@  discard block
 block discarded – undo
67 68
 
68 69
 include_once( ABSPATH . 'wp-admin/admin-header.php' );
69 70
 
70
-if ( ! current_user_can('manage_links') )
71
+if ( ! current_user_can('manage_links') ) {
71 72
 	wp_die(__("You do not have sufficient permissions to edit the links for this site."));
73
+}
72 74
 
73 75
 ?>
74 76
 
Please login to merge, or discard this patch.
src/wp-admin/plugins.php 3 patches
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -493,17 +493,17 @@
 block discarded – undo
493 493
 
494 494
 <?php
495 495
 /**
496
- * Fires before the plugins list table is rendered.
497
- *
498
- * This hook also fires before the plugins list table is rendered in the Network Admin.
499
- *
500
- * Please note: The 'active' portion of the hook name does not refer to whether the current
501
- * view is for active plugins, but rather all plugins actively-installed.
502
- *
503
- * @since 3.0.0
504
- *
505
- * @param array $plugins_all An array containing all installed plugins.
506
- */
496
+	 * Fires before the plugins list table is rendered.
497
+	 *
498
+	 * This hook also fires before the plugins list table is rendered in the Network Admin.
499
+	 *
500
+	 * Please note: The 'active' portion of the hook name does not refer to whether the current
501
+	 * view is for active plugins, but rather all plugins actively-installed.
502
+	 *
503
+	 * @since 3.0.0
504
+	 *
505
+	 * @param array $plugins_all An array containing all installed plugins.
506
+	 */
507 507
 do_action( 'pre_current_active_plugins', $plugins['all'] );
508 508
 ?>
509 509
 
Please login to merge, or discard this patch.
Spacing   +196 added lines, -196 removed lines patch added patch discarded remove patch
@@ -7,10 +7,10 @@  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 ( ! current_user_can('activate_plugins') )
13
-	wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
12
+if ( ! current_user_can('activate_plugins'))
13
+	wp_die(__('You do not have sufficient permissions to manage plugins for this site.'));
14 14
 
15 15
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 16
 $pagenum = $wp_list_table->get_pagenum();
@@ -18,302 +18,302 @@  discard block
 block discarded – undo
18 18
 $action = $wp_list_table->current_action();
19 19
 
20 20
 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : '';
21
-$s = isset($_REQUEST['s']) ? urlencode( wp_unslash( $_REQUEST['s'] ) ) : '';
21
+$s = isset($_REQUEST['s']) ? urlencode(wp_unslash($_REQUEST['s'])) : '';
22 22
 
23 23
 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.
24 24
 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']);
25 25
 
26
-wp_enqueue_script( 'updates' );
26
+wp_enqueue_script('updates');
27 27
 
28
-if ( $action ) {
28
+if ($action) {
29 29
 
30
-	switch ( $action ) {
30
+	switch ($action) {
31 31
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
32
+			if ( ! current_user_can('activate_plugins'))
33 33
 				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
34 34
 
35
-			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
35
+			if (is_multisite() && ! is_network_admin() && is_network_only_plugin($plugin)) {
36
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
37 37
 				exit;
38 38
 			}
39 39
 
40
-			check_admin_referer('activate-plugin_' . $plugin);
40
+			check_admin_referer('activate-plugin_'.$plugin);
41 41
 
42
-			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin=' . $plugin), is_network_admin() );
43
-			if ( is_wp_error( $result ) ) {
44
-				if ( 'unexpected_output' == $result->get_error_code() ) {
45
-					$redirect = self_admin_url('plugins.php?error=true&charsout=' . strlen($result->get_error_data()) . '&plugin=' . $plugin . "&plugin_status=$status&paged=$page&s=$s");
46
-					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
42
+			$result = activate_plugin($plugin, self_admin_url('plugins.php?error=true&plugin='.$plugin), is_network_admin());
43
+			if (is_wp_error($result)) {
44
+				if ('unexpected_output' == $result->get_error_code()) {
45
+					$redirect = self_admin_url('plugins.php?error=true&charsout='.strlen($result->get_error_data()).'&plugin='.$plugin."&plugin_status=$status&paged=$page&s=$s");
46
+					wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_'.$plugin), $redirect));
47 47
 					exit;
48 48
 				} else {
49 49
 					wp_die($result);
50 50
 				}
51 51
 			}
52 52
 
53
-			if ( ! is_network_admin() ) {
54
-				$recent = (array) get_option( 'recently_activated' );
55
-				unset( $recent[ $plugin ] );
56
-				update_option( 'recently_activated', $recent );
53
+			if ( ! is_network_admin()) {
54
+				$recent = (array) get_option('recently_activated');
55
+				unset($recent[$plugin]);
56
+				update_option('recently_activated', $recent);
57 57
 			} else {
58
-				$recent = (array) get_site_option( 'recently_activated' );
59
-				unset( $recent[ $plugin ] );
60
-				update_site_option( 'recently_activated', $recent );
58
+				$recent = (array) get_site_option('recently_activated');
59
+				unset($recent[$plugin]);
60
+				update_site_option('recently_activated', $recent);
61 61
 			}
62 62
 
63
-			if ( isset($_GET['from']) && 'import' == $_GET['from'] ) {
64
-				wp_redirect( self_admin_url("import.php?import=" . str_replace('-importer', '', dirname($plugin))) ); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
63
+			if (isset($_GET['from']) && 'import' == $_GET['from']) {
64
+				wp_redirect(self_admin_url("import.php?import=".str_replace('-importer', '', dirname($plugin)))); // overrides the ?error=true one above and redirects to the Imports page, stripping the -importer suffix
65 65
 			} else {
66
-				wp_redirect( self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s") ); // overrides the ?error=true one above
66
+				wp_redirect(self_admin_url("plugins.php?activate=true&plugin_status=$status&paged=$page&s=$s")); // overrides the ?error=true one above
67 67
 			}
68 68
 			exit;
69 69
 
70 70
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
71
+			if ( ! current_user_can('activate_plugins'))
72 72
 				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
73 73
 
74 74
 			check_admin_referer('bulk-plugins');
75 75
 
76
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
76
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
77 77
 
78
-			if ( is_network_admin() ) {
79
-				foreach ( $plugins as $i => $plugin ) {
78
+			if (is_network_admin()) {
79
+				foreach ($plugins as $i => $plugin) {
80 80
 					// Only activate plugins which are not already network activated.
81
-					if ( is_plugin_active_for_network( $plugin ) ) {
82
-						unset( $plugins[ $i ] );
81
+					if (is_plugin_active_for_network($plugin)) {
82
+						unset($plugins[$i]);
83 83
 					}
84 84
 				}
85 85
 			} else {
86
-				foreach ( $plugins as $i => $plugin ) {
86
+				foreach ($plugins as $i => $plugin) {
87 87
 					// Only activate plugins which are not already active and are not network-only when on Multisite.
88
-					if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) {
89
-						unset( $plugins[ $i ] );
88
+					if (is_plugin_active($plugin) || (is_multisite() && is_network_only_plugin($plugin))) {
89
+						unset($plugins[$i]);
90 90
 					}
91 91
 				}
92 92
 			}
93 93
 
94
-			if ( empty($plugins) ) {
95
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
94
+			if (empty($plugins)) {
95
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
96 96
 				exit;
97 97
 			}
98 98
 
99
-			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin() );
99
+			activate_plugins($plugins, self_admin_url('plugins.php?error=true'), is_network_admin());
100 100
 
101
-			if ( ! is_network_admin() ) {
102
-				$recent = (array) get_option('recently_activated' );
101
+			if ( ! is_network_admin()) {
102
+				$recent = (array) get_option('recently_activated');
103 103
 			} else {
104
-				$recent = (array) get_site_option('recently_activated' );
104
+				$recent = (array) get_site_option('recently_activated');
105 105
 			}
106 106
 
107
-			foreach ( $plugins as $plugin ) {
108
-				unset( $recent[ $plugin ] );
107
+			foreach ($plugins as $plugin) {
108
+				unset($recent[$plugin]);
109 109
 			}
110 110
 
111
-			if ( ! is_network_admin() ) {
112
-				update_option( 'recently_activated', $recent );
111
+			if ( ! is_network_admin()) {
112
+				update_option('recently_activated', $recent);
113 113
 			} else {
114
-				update_site_option( 'recently_activated', $recent );
114
+				update_site_option('recently_activated', $recent);
115 115
 			}
116 116
 
117
-			wp_redirect( self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s") );
117
+			wp_redirect(self_admin_url("plugins.php?activate-multi=true&plugin_status=$status&paged=$page&s=$s"));
118 118
 			exit;
119 119
 
120 120
 		case 'update-selected' :
121 121
 
122
-			check_admin_referer( 'bulk-plugins' );
122
+			check_admin_referer('bulk-plugins');
123 123
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
124
+			if (isset($_GET['plugins']))
125
+				$plugins = explode(',', $_GET['plugins']);
126
+			elseif (isset($_POST['checked']))
127 127
 				$plugins = (array) $_POST['checked'];
128 128
 			else
129 129
 				$plugins = array();
130 130
 
131
-			$title = __( 'Update Plugins' );
131
+			$title = __('Update Plugins');
132 132
 			$parent_file = 'plugins.php';
133 133
 
134
-			wp_enqueue_script( 'updates' );
135
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
134
+			wp_enqueue_script('updates');
135
+			require_once(ABSPATH.'wp-admin/admin-header.php');
136 136
 
137 137
 			echo '<div class="wrap">';
138
-			echo '<h1>' . esc_html( $title ) . '</h1>';
138
+			echo '<h1>'.esc_html($title).'</h1>';
139 139
 
140
-			$url = self_admin_url('update.php?action=update-selected&amp;plugins=' . urlencode( join(',', $plugins) ));
140
+			$url = self_admin_url('update.php?action=update-selected&amp;plugins='.urlencode(join(',', $plugins)));
141 141
 			$url = wp_nonce_url($url, 'bulk-update-plugins');
142 142
 
143 143
 			echo "<iframe src='$url' style='width: 100%; height:100%; min-height:850px;'></iframe>";
144 144
 			echo '</div>';
145
-			require_once(ABSPATH . 'wp-admin/admin-footer.php');
145
+			require_once(ABSPATH.'wp-admin/admin-footer.php');
146 146
 			exit;
147 147
 
148 148
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
149
+			if ( ! current_user_can('activate_plugins'))
150 150
 				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
151 151
 
152
-			check_admin_referer('plugin-activation-error_' . $plugin);
152
+			check_admin_referer('plugin-activation-error_'.$plugin);
153 153
 
154 154
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
155
+			if (is_wp_error($valid))
156 156
 				wp_die($valid);
157 157
 
158
-			if ( ! WP_DEBUG ) {
159
-				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
158
+			if ( ! WP_DEBUG) {
159
+				error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
160 160
 			}
161 161
 
162 162
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
163 163
 			// Go back to "sandbox" scope so we get the same errors as before
164
-			plugin_sandbox_scrape( $plugin );
164
+			plugin_sandbox_scrape($plugin);
165 165
 			/** This action is documented in wp-admin/includes/plugin.php */
166
-			do_action( "activate_{$plugin}" );
166
+			do_action("activate_{$plugin}");
167 167
 			exit;
168 168
 
169 169
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
170
+			if ( ! current_user_can('activate_plugins'))
171 171
 				wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
172 172
 
173
-			check_admin_referer('deactivate-plugin_' . $plugin);
173
+			check_admin_referer('deactivate-plugin_'.$plugin);
174 174
 
175
-			if ( ! is_network_admin() && is_plugin_active_for_network( $plugin ) ) {
176
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
175
+			if ( ! is_network_admin() && is_plugin_active_for_network($plugin)) {
176
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
177 177
 				exit;
178 178
 			}
179 179
 
180
-			deactivate_plugins( $plugin, false, is_network_admin() );
180
+			deactivate_plugins($plugin, false, is_network_admin());
181 181
 
182
-			if ( ! is_network_admin() ) {
183
-				update_option( 'recently_activated', array( $plugin => time() ) + (array) get_option( 'recently_activated' ) );
182
+			if ( ! is_network_admin()) {
183
+				update_option('recently_activated', array($plugin => time()) + (array) get_option('recently_activated'));
184 184
 			} else {
185
-				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
185
+				update_site_option('recently_activated', array($plugin => time()) + (array) get_site_option('recently_activated'));
186 186
 			}
187 187
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
188
+			if (headers_sent())
189
+				echo "<meta http-equiv='refresh' content='".esc_attr("0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s")."' />";
190 190
 			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
191
+				wp_redirect(self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s"));
192 192
 			exit;
193 193
 
194 194
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
195
+			if ( ! current_user_can('activate_plugins'))
196 196
 				wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
197 197
 
198 198
 			check_admin_referer('bulk-plugins');
199 199
 
200
-			$plugins = isset( $_POST['checked'] ) ? (array) $_POST['checked'] : array();
200
+			$plugins = isset($_POST['checked']) ? (array) $_POST['checked'] : array();
201 201
 			// Do not deactivate plugins which are already deactivated.
202
-			if ( is_network_admin() ) {
203
-				$plugins = array_filter( $plugins, 'is_plugin_active_for_network' );
202
+			if (is_network_admin()) {
203
+				$plugins = array_filter($plugins, 'is_plugin_active_for_network');
204 204
 			} else {
205
-				$plugins = array_filter( $plugins, 'is_plugin_active' );
206
-				$plugins = array_diff( $plugins, array_filter( $plugins, 'is_plugin_active_for_network' ) );
205
+				$plugins = array_filter($plugins, 'is_plugin_active');
206
+				$plugins = array_diff($plugins, array_filter($plugins, 'is_plugin_active_for_network'));
207 207
 			}
208
-			if ( empty($plugins) ) {
209
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
208
+			if (empty($plugins)) {
209
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
210 210
 				exit;
211 211
 			}
212 212
 
213
-			deactivate_plugins( $plugins, false, is_network_admin() );
213
+			deactivate_plugins($plugins, false, is_network_admin());
214 214
 
215 215
 			$deactivated = array();
216
-			foreach ( $plugins as $plugin ) {
217
-				$deactivated[ $plugin ] = time();
216
+			foreach ($plugins as $plugin) {
217
+				$deactivated[$plugin] = time();
218 218
 			}
219 219
 
220
-			if ( ! is_network_admin() ) {
221
-				update_option( 'recently_activated', $deactivated + (array) get_option( 'recently_activated' ) );
220
+			if ( ! is_network_admin()) {
221
+				update_option('recently_activated', $deactivated + (array) get_option('recently_activated'));
222 222
 			} else {
223
-				update_site_option( 'recently_activated', $deactivated + (array) get_site_option( 'recently_activated' ) );
223
+				update_site_option('recently_activated', $deactivated + (array) get_site_option('recently_activated'));
224 224
 			}
225 225
 
226
-			wp_redirect( self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s") );
226
+			wp_redirect(self_admin_url("plugins.php?deactivate-multi=true&plugin_status=$status&paged=$page&s=$s"));
227 227
 			exit;
228 228
 
229 229
 		case 'delete-selected':
230
-			if ( ! current_user_can('delete_plugins') ) {
230
+			if ( ! current_user_can('delete_plugins')) {
231 231
 				wp_die(__('You do not have sufficient permissions to delete plugins for this site.'));
232 232
 			}
233 233
 
234 234
 			check_admin_referer('bulk-plugins');
235 235
 
236 236
 			//$_POST = from the plugin form; $_GET = from the FTP details screen.
237
-			$plugins = isset( $_REQUEST['checked'] ) ? (array) $_REQUEST['checked'] : array();
238
-			if ( empty( $plugins ) ) {
239
-				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
237
+			$plugins = isset($_REQUEST['checked']) ? (array) $_REQUEST['checked'] : array();
238
+			if (empty($plugins)) {
239
+				wp_redirect(self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s"));
240 240
 				exit;
241 241
 			}
242 242
 
243 243
 			$plugins = array_filter($plugins, 'is_plugin_inactive'); // Do not allow to delete Activated plugins.
244
-			if ( empty( $plugins ) ) {
245
-				wp_redirect( self_admin_url( "plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s" ) );
244
+			if (empty($plugins)) {
245
+				wp_redirect(self_admin_url("plugins.php?error=true&main=true&plugin_status=$status&paged=$page&s=$s"));
246 246
 				exit;
247 247
 			}
248 248
 
249
-			include(ABSPATH . 'wp-admin/update.php');
249
+			include(ABSPATH.'wp-admin/update.php');
250 250
 
251 251
 			$parent_file = 'plugins.php';
252 252
 
253
-			if ( ! isset($_REQUEST['verify-delete']) ) {
253
+			if ( ! isset($_REQUEST['verify-delete'])) {
254 254
 				wp_enqueue_script('jquery');
255
-				require_once(ABSPATH . 'wp-admin/admin-header.php');
255
+				require_once(ABSPATH.'wp-admin/admin-header.php');
256 256
 				?>
257 257
 			<div class="wrap">
258 258
 				<?php
259 259
 					$plugin_info = array();
260 260
 					$have_non_network_plugins = false;
261
-					foreach ( (array) $plugins as $plugin ) {
262
-						$plugin_slug = dirname( $plugin );
263
-
264
-						if ( '.' == $plugin_slug ) {
265
-							if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) {
266
-								$plugin_info[ $plugin ] = $data;
267
-								$plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
268
-								if ( ! $plugin_info[ $plugin ]['Network'] ) {
261
+					foreach ((array) $plugins as $plugin) {
262
+						$plugin_slug = dirname($plugin);
263
+
264
+						if ('.' == $plugin_slug) {
265
+							if ($data = get_plugin_data(WP_PLUGIN_DIR.'/'.$plugin)) {
266
+								$plugin_info[$plugin] = $data;
267
+								$plugin_info[$plugin]['is_uninstallable'] = is_uninstallable_plugin($plugin);
268
+								if ( ! $plugin_info[$plugin]['Network']) {
269 269
 									$have_non_network_plugins = true;
270 270
 								}
271 271
 							}
272 272
 						} else {
273 273
 							// Get plugins list from that folder.
274
-							if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) {
275
-								foreach ( $folder_plugins as $plugin_file => $data ) {
276
-									$plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data );
277
-									$plugin_info[ $plugin_file ]['is_uninstallable'] = is_uninstallable_plugin( $plugin );
278
-									if ( ! $plugin_info[ $plugin_file ]['Network'] ) {
274
+							if ($folder_plugins = get_plugins('/'.$plugin_slug)) {
275
+								foreach ($folder_plugins as $plugin_file => $data) {
276
+									$plugin_info[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $data);
277
+									$plugin_info[$plugin_file]['is_uninstallable'] = is_uninstallable_plugin($plugin);
278
+									if ( ! $plugin_info[$plugin_file]['Network']) {
279 279
 										$have_non_network_plugins = true;
280 280
 									}
281 281
 								}
282 282
 							}
283 283
 						}
284 284
 					}
285
-					$plugins_to_delete = count( $plugin_info );
285
+					$plugins_to_delete = count($plugin_info);
286 286
 				?>
287
-				<?php if ( 1 == $plugins_to_delete ) : ?>
288
-					<h1><?php _e( 'Delete Plugin' ); ?></h1>
289
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
290
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
287
+				<?php if (1 == $plugins_to_delete) : ?>
288
+					<h1><?php _e('Delete Plugin'); ?></h1>
289
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
290
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('This plugin may be active on other sites in the network.'); ?></p></div>
291 291
 					<?php endif; ?>
292
-					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
292
+					<p><?php _e('You are about to remove the following plugin:'); ?></p>
293 293
 				<?php else: ?>
294
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
295
-					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
296
-						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
294
+					<h1><?php _e('Delete Plugins'); ?></h1>
295
+					<?php if ($have_non_network_plugins && is_network_admin()) : ?>
296
+						<div class="error"><p><strong><?php _e('Caution:'); ?></strong> <?php _e('These plugins may be active on other sites in the network.'); ?></p></div>
297 297
 					<?php endif; ?>
298
-					<p><?php _e( 'You are about to remove the following plugins:' ); ?></p>
298
+					<p><?php _e('You are about to remove the following plugins:'); ?></p>
299 299
 				<?php endif; ?>
300 300
 					<ul class="ul-disc">
301 301
 						<?php
302 302
 						$data_to_delete = false;
303
-						foreach ( $plugin_info as $plugin ) {
304
-							if ( $plugin['is_uninstallable'] ) {
303
+						foreach ($plugin_info as $plugin) {
304
+							if ($plugin['is_uninstallable']) {
305 305
 								/* translators: 1: plugin name, 2: plugin author */
306
-								echo '<li>', sprintf( __( '%1$s by %2$s (will also <strong>delete its data</strong>)' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] . '</em>' ), '</li>';
306
+								echo '<li>', sprintf(__('%1$s by %2$s (will also <strong>delete its data</strong>)'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName'].'</em>'), '</li>';
307 307
 								$data_to_delete = true;
308 308
 							} else {
309 309
 								/* translators: 1: plugin name, 2: plugin author */
310
-								echo '<li>', sprintf( _x('%1$s by %2$s', 'plugin' ), '<strong>' . $plugin['Name'] . '</strong>', '<em>' . $plugin['AuthorName'] ) . '</em>', '</li>';
310
+								echo '<li>', sprintf(_x('%1$s by %2$s', 'plugin'), '<strong>'.$plugin['Name'].'</strong>', '<em>'.$plugin['AuthorName']).'</em>', '</li>';
311 311
 							}
312 312
 						}
313 313
 						?>
314 314
 					</ul>
315 315
 				<p><?php
316
-				if ( $data_to_delete )
316
+				if ($data_to_delete)
317 317
 					_e('Are you sure you wish to delete these files and data?');
318 318
 				else
319 319
 					_e('Are you sure you wish to delete these files?');
@@ -322,38 +322,38 @@  discard block
 block discarded – undo
322 322
 					<input type="hidden" name="verify-delete" value="1" />
323 323
 					<input type="hidden" name="action" value="delete-selected" />
324 324
 					<?php
325
-						foreach ( (array) $plugins as $plugin ) {
326
-							echo '<input type="hidden" name="checked[]" value="' . esc_attr( $plugin ) . '" />';
325
+						foreach ((array) $plugins as $plugin) {
326
+							echo '<input type="hidden" name="checked[]" value="'.esc_attr($plugin).'" />';
327 327
 						}
328 328
 					?>
329 329
 					<?php wp_nonce_field('bulk-plugins') ?>
330
-					<?php submit_button( $data_to_delete ? __( 'Yes, delete these files and data' ) : __( 'Yes, delete these files' ), 'button', 'submit', false ); ?>
330
+					<?php submit_button($data_to_delete ? __('Yes, delete these files and data') : __('Yes, delete these files'), 'button', 'submit', false); ?>
331 331
 				</form>
332 332
 				<?php
333 333
 				$referer = wp_get_referer();
334 334
 				?>
335
-				<form method="post" action="<?php echo $referer ? esc_url( $referer ) : ''; ?>" style="display:inline;">
336
-					<?php submit_button( __( 'No, return me to the plugin list' ), 'button', 'submit', false ); ?>
335
+				<form method="post" action="<?php echo $referer ? esc_url($referer) : ''; ?>" style="display:inline;">
336
+					<?php submit_button(__('No, return me to the plugin list'), 'button', 'submit', false); ?>
337 337
 				</form>
338 338
 			</div>
339 339
 				<?php
340
-				require_once(ABSPATH . 'wp-admin/admin-footer.php');
340
+				require_once(ABSPATH.'wp-admin/admin-footer.php');
341 341
 				exit;
342 342
 			} else {
343
-				$plugins_to_delete = count( $plugins );
343
+				$plugins_to_delete = count($plugins);
344 344
 			} // endif verify-delete
345 345
 
346
-			$delete_result = delete_plugins( $plugins );
346
+			$delete_result = delete_plugins($plugins);
347 347
 
348
-			set_transient('plugins_delete_result_' . $user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
349
-			wp_redirect( self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s") );
348
+			set_transient('plugins_delete_result_'.$user_ID, $delete_result); //Store the result in a cache rather than a URL param due to object type & length
349
+			wp_redirect(self_admin_url("plugins.php?deleted=$plugins_to_delete&plugin_status=$status&paged=$page&s=$s"));
350 350
 			exit;
351 351
 
352 352
 		case 'clear-recent-list':
353
-			if ( ! is_network_admin() ) {
354
-				update_option( 'recently_activated', array() );
353
+			if ( ! is_network_admin()) {
354
+				update_option('recently_activated', array());
355 355
 			} else {
356
-				update_site_option( 'recently_activated', array() );
356
+				update_site_option('recently_activated', array());
357 357
 			}
358 358
 			break;
359 359
 	}
@@ -364,129 +364,129 @@  discard block
 block discarded – undo
364 364
 wp_enqueue_script('plugin-install');
365 365
 add_thickbox();
366 366
 
367
-add_screen_option( 'per_page', array( 'default' => 999 ) );
367
+add_screen_option('per_page', array('default' => 999));
368 368
 
369
-get_current_screen()->add_help_tab( array(
369
+get_current_screen()->add_help_tab(array(
370 370
 'id'		=> 'overview',
371 371
 'title'		=> __('Overview'),
372 372
 'content'	=>
373
-	'<p>' . __('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.') . '</p>' .
374
-	'<p>' . sprintf(
373
+	'<p>'.__('Plugins extend and expand the functionality of WordPress. Once a plugin is installed, you may activate it or deactivate it here.').'</p>'.
374
+	'<p>'.sprintf(
375 375
 		/* translators: 1: Plugin Browser/Installer URL, 2: WordPress Plugin Directory URL 3: local plugin directory */
376
-		__( 'You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your %3$s directory. Once a plugin has been installed, you can activate it here.' ),
376
+		__('You can find additional plugins for your site by using the <a href="%1$s">Plugin Browser/Installer</a> functionality or by browsing the <a href="%2$s" target="_blank">WordPress Plugin Directory</a> directly and installing new plugins manually. To manually install a plugin you generally just need to upload the plugin file into your %3$s directory. Once a plugin has been installed, you can activate it here.'),
377 377
 		'plugin-install.php',
378 378
 		'https://wordpress.org/plugins/',
379 379
 		'<code>/wp-content/plugins</code>'
380
-	) . '</p>'
381
-) );
382
-get_current_screen()->add_help_tab( array(
380
+	).'</p>'
381
+));
382
+get_current_screen()->add_help_tab(array(
383 383
 'id'		=> 'compatibility-problems',
384 384
 'title'		=> __('Troubleshooting'),
385 385
 'content'	=>
386
-	'<p>' . __('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.') . '</p>' .
387
-	'<p>' . sprintf(
386
+	'<p>'.__('Most of the time, plugins play nicely with the core of WordPress and with other plugins. Sometimes, though, a plugin&#8217;s code will get in the way of another plugin, causing compatibility issues. If your site starts doing strange things, this may be the problem. Try deactivating all your plugins and re-activating them in various combinations until you isolate which one(s) caused the issue.').'</p>'.
387
+	'<p>'.sprintf(
388 388
 		/* translators: WP_PLUGIN_DIR constant value */
389
-		__( 'If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.' ),
390
-		'<code>' . WP_PLUGIN_DIR . '</code>'
391
-	) . '</p>'
392
-) );
389
+		__('If something goes wrong with a plugin and you can&#8217;t use WordPress, delete or rename that file in the %s directory and it will be automatically deactivated.'),
390
+		'<code>'.WP_PLUGIN_DIR.'</code>'
391
+	).'</p>'
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/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>') . '</p>' .
397
-	'<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/Managing_Plugins#Plugin_Management" target="_blank">Documentation on Managing Plugins</a>').'</p>'.
397
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
398 398
 );
399 399
 
400
-get_current_screen()->set_screen_reader_content( array(
401
-	'heading_views'      => __( 'Filter plugins list' ),
402
-	'heading_pagination' => __( 'Plugins list navigation' ),
403
-	'heading_list'       => __( 'Plugins list' ),
404
-) );
400
+get_current_screen()->set_screen_reader_content(array(
401
+	'heading_views'      => __('Filter plugins list'),
402
+	'heading_pagination' => __('Plugins list navigation'),
403
+	'heading_list'       => __('Plugins list'),
404
+));
405 405
 
406 406
 $title = __('Plugins');
407 407
 $parent_file = 'plugins.php';
408 408
 
409
-require_once(ABSPATH . 'wp-admin/admin-header.php');
409
+require_once(ABSPATH.'wp-admin/admin-header.php');
410 410
 
411 411
 $invalid = validate_active_plugins();
412
-if ( ! empty( $invalid ) ) {
413
-	foreach ( $invalid as $plugin_file => $error ) {
412
+if ( ! empty($invalid)) {
413
+	foreach ($invalid as $plugin_file => $error) {
414 414
 		echo '<div id="message" class="error"><p>';
415 415
 		printf(
416 416
 			/* translators: 1: plugin file 2: error message */
417
-			__( 'The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s' ),
418
-			'<code>' . esc_html( $plugin_file ) . '</code>',
417
+			__('The plugin %1$s has been <strong>deactivated</strong> due to an error: %2$s'),
418
+			'<code>'.esc_html($plugin_file).'</code>',
419 419
 			$error->get_error_message() );
420 420
 		echo '</p></div>';
421 421
 	}
422 422
 }
423 423
 ?>
424 424
 
425
-<?php if ( isset($_GET['error']) ) :
425
+<?php if (isset($_GET['error'])) :
426 426
 
427
-	if ( isset( $_GET['main'] ) )
428
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
429
-	elseif ( isset($_GET['charsout']) )
427
+	if (isset($_GET['main']))
428
+		$errmsg = __('You cannot delete a plugin while it is active on the main site.');
429
+	elseif (isset($_GET['charsout']))
430 430
 		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
431 431
 	else
432 432
 		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
433 433
 	?>
434 434
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
435 435
 	<?php
436
-		if ( ! isset( $_GET['main'] ) && ! isset( $_GET['charsout'] ) && wp_verify_nonce( $_GET['_error_nonce'], 'plugin-activation-error_' . $plugin ) ) {
437
-			$iframe_url = add_query_arg( array(
436
+		if ( ! isset($_GET['main']) && ! isset($_GET['charsout']) && wp_verify_nonce($_GET['_error_nonce'], 'plugin-activation-error_'.$plugin)) {
437
+			$iframe_url = add_query_arg(array(
438 438
 				'action'   => 'error_scrape',
439
-				'plugin'   => urlencode( $plugin ),
440
-				'_wpnonce' => urlencode( $_GET['_error_nonce'] ),
441
-			), admin_url( 'plugins.php' ) );
439
+				'plugin'   => urlencode($plugin),
440
+				'_wpnonce' => urlencode($_GET['_error_nonce']),
441
+			), admin_url('plugins.php'));
442 442
 		?>
443
-		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url( $iframe_url ); ?>"></iframe>
443
+		<iframe style="border:0" width="100%" height="70px" src="<?php echo esc_url($iframe_url); ?>"></iframe>
444 444
 	<?php
445 445
 		}
446 446
 	?>
447 447
 	</div>
448
-<?php elseif ( isset($_GET['deleted']) ) :
449
-		$delete_result = get_transient( 'plugins_delete_result_' . $user_ID );
448
+<?php elseif (isset($_GET['deleted'])) :
449
+		$delete_result = get_transient('plugins_delete_result_'.$user_ID);
450 450
 		// Delete it once we're done.
451
-		delete_transient( 'plugins_delete_result_' . $user_ID );
451
+		delete_transient('plugins_delete_result_'.$user_ID);
452 452
 
453
-		if ( is_wp_error($delete_result) ) : ?>
454
-		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
453
+		if (is_wp_error($delete_result)) : ?>
454
+		<div id="message" class="error notice is-dismissible"><p><?php printf(__('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message()); ?></p></div>
455 455
 		<?php else : ?>
456 456
 		<div id="message" class="updated notice is-dismissible">
457 457
 			<p>
458 458
 				<?php
459
-				if ( 1 == (int) $_GET['deleted'] ) {
460
-					_e( 'The selected plugin has been <strong>deleted</strong>.' );
459
+				if (1 == (int) $_GET['deleted']) {
460
+					_e('The selected plugin has been <strong>deleted</strong>.');
461 461
 				} else {
462
-					_e( 'The selected plugins have been <strong>deleted</strong>.' );
462
+					_e('The selected plugins have been <strong>deleted</strong>.');
463 463
 				}
464 464
 				?>
465 465
 			</p>
466 466
 		</div>
467 467
 		<?php endif; ?>
468
-<?php elseif ( isset($_GET['activate']) ) : ?>
468
+<?php elseif (isset($_GET['activate'])) : ?>
469 469
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>activated</strong>.') ?></p></div>
470 470
 <?php elseif (isset($_GET['activate-multi'])) : ?>
471 471
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>activated</strong>.'); ?></p></div>
472
-<?php elseif ( isset($_GET['deactivate']) ) : ?>
472
+<?php elseif (isset($_GET['deactivate'])) : ?>
473 473
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Plugin <strong>deactivated</strong>.') ?></p></div>
474 474
 <?php elseif (isset($_GET['deactivate-multi'])) : ?>
475 475
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('Selected plugins <strong>deactivated</strong>.'); ?></p></div>
476
-<?php elseif ( 'update-selected' == $action ) : ?>
476
+<?php elseif ('update-selected' == $action) : ?>
477 477
 	<div id="message" class="updated notice is-dismissible"><p><?php _e('All selected plugins are up to date.'); ?></p></div>
478 478
 <?php endif; ?>
479 479
 
480 480
 <div class="wrap">
481
-<h1><?php echo esc_html( $title );
482
-if ( ( ! is_multisite() || is_network_admin() ) && current_user_can('install_plugins') ) { ?>
483
- <a href="<?php echo self_admin_url( 'plugin-install.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
481
+<h1><?php echo esc_html($title);
482
+if (( ! is_multisite() || is_network_admin()) && current_user_can('install_plugins')) { ?>
483
+ <a href="<?php echo self_admin_url('plugin-install.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'plugin'); ?></a>
484 484
 <?php
485 485
 }
486 486
 
487
-if ( strlen( $s ) ) {
487
+if (strlen($s)) {
488 488
 	/* translators: %s: search keywords */
489
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( urldecode( $s ) ) );
489
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html(urldecode($s)));
490 490
 }
491 491
 ?>
492 492
 </h1>
@@ -504,13 +504,13 @@  discard block
 block discarded – undo
504 504
  *
505 505
  * @param array $plugins_all An array containing all installed plugins.
506 506
  */
507
-do_action( 'pre_current_active_plugins', $plugins['all'] );
507
+do_action('pre_current_active_plugins', $plugins['all']);
508 508
 ?>
509 509
 
510 510
 <?php $wp_list_table->views(); ?>
511 511
 
512 512
 <form method="get">
513
-<?php $wp_list_table->search_box( __( 'Search Installed Plugins' ), 'plugin' ); ?>
513
+<?php $wp_list_table->search_box(__('Search Installed Plugins'), 'plugin'); ?>
514 514
 </form>
515 515
 
516 516
 <form method="post" id="bulk-action-form">
@@ -526,4 +526,4 @@  discard block
 block discarded – undo
526 526
 <?php
527 527
 wp_print_request_filesystem_credentials_modal();
528 528
 
529
-include(ABSPATH . 'wp-admin/admin-footer.php');
529
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +52 added lines, -36 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 ( ! current_user_can('activate_plugins') )
12
+if ( ! current_user_can('activate_plugins') ) {
13 13
 	wp_die( __( 'You do not have sufficient permissions to manage plugins for this site.' ) );
14
+}
14 15
 
15 16
 $wp_list_table = _get_list_table('WP_Plugins_List_Table');
16 17
 $pagenum = $wp_list_table->get_pagenum();
@@ -29,8 +30,9 @@  discard block
 block discarded – undo
29 30
 
30 31
 	switch ( $action ) {
31 32
 		case 'activate':
32
-			if ( ! current_user_can('activate_plugins') )
33
-				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
33
+			if ( ! current_user_can('activate_plugins') ) {
34
+							wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
35
+			}
34 36
 
35 37
 			if ( is_multisite() && ! is_network_admin() && is_network_only_plugin( $plugin ) ) {
36 38
 				wp_redirect( self_admin_url("plugins.php?plugin_status=$status&paged=$page&s=$s") );
@@ -68,8 +70,9 @@  discard block
 block discarded – undo
68 70
 			exit;
69 71
 
70 72
 		case 'activate-selected':
71
-			if ( ! current_user_can('activate_plugins') )
72
-				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
73
+			if ( ! current_user_can('activate_plugins') ) {
74
+							wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
75
+			}
73 76
 
74 77
 			check_admin_referer('bulk-plugins');
75 78
 
@@ -121,12 +124,13 @@  discard block
 block discarded – undo
121 124
 
122 125
 			check_admin_referer( 'bulk-plugins' );
123 126
 
124
-			if ( isset( $_GET['plugins'] ) )
125
-				$plugins = explode( ',', $_GET['plugins'] );
126
-			elseif ( isset( $_POST['checked'] ) )
127
-				$plugins = (array) $_POST['checked'];
128
-			else
129
-				$plugins = array();
127
+			if ( isset( $_GET['plugins'] ) ) {
128
+							$plugins = explode( ',', $_GET['plugins'] );
129
+			} elseif ( isset( $_POST['checked'] ) ) {
130
+							$plugins = (array) $_POST['checked'];
131
+			} else {
132
+							$plugins = array();
133
+			}
130 134
 
131 135
 			$title = __( 'Update Plugins' );
132 136
 			$parent_file = 'plugins.php';
@@ -146,14 +150,16 @@  discard block
 block discarded – undo
146 150
 			exit;
147 151
 
148 152
 		case 'error_scrape':
149
-			if ( ! current_user_can('activate_plugins') )
150
-				wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
153
+			if ( ! current_user_can('activate_plugins') ) {
154
+							wp_die(__('You do not have sufficient permissions to activate plugins for this site.'));
155
+			}
151 156
 
152 157
 			check_admin_referer('plugin-activation-error_' . $plugin);
153 158
 
154 159
 			$valid = validate_plugin($plugin);
155
-			if ( is_wp_error($valid) )
156
-				wp_die($valid);
160
+			if ( is_wp_error($valid) ) {
161
+							wp_die($valid);
162
+			}
157 163
 
158 164
 			if ( ! WP_DEBUG ) {
159 165
 				error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
@@ -167,8 +173,9 @@  discard block
 block discarded – undo
167 173
 			exit;
168 174
 
169 175
 		case 'deactivate':
170
-			if ( ! current_user_can('activate_plugins') )
171
-				wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
176
+			if ( ! current_user_can('activate_plugins') ) {
177
+							wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
178
+			}
172 179
 
173 180
 			check_admin_referer('deactivate-plugin_' . $plugin);
174 181
 
@@ -185,15 +192,17 @@  discard block
 block discarded – undo
185 192
 				update_site_option( 'recently_activated', array( $plugin => time() ) + (array) get_site_option( 'recently_activated' ) );
186 193
 			}
187 194
 
188
-			if ( headers_sent() )
189
-				echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
190
-			else
191
-				wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
195
+			if ( headers_sent() ) {
196
+							echo "<meta http-equiv='refresh' content='" . esc_attr( "0;url=plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s" ) . "' />";
197
+			} else {
198
+							wp_redirect( self_admin_url("plugins.php?deactivate=true&plugin_status=$status&paged=$page&s=$s") );
199
+			}
192 200
 			exit;
193 201
 
194 202
 		case 'deactivate-selected':
195
-			if ( ! current_user_can('activate_plugins') )
196
-				wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
203
+			if ( ! current_user_can('activate_plugins') ) {
204
+							wp_die(__('You do not have sufficient permissions to deactivate plugins for this site.'));
205
+			}
197 206
 
198 207
 			check_admin_referer('bulk-plugins');
199 208
 
@@ -290,8 +299,11 @@  discard block
 block discarded – undo
290 299
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'This plugin may be active on other sites in the network.' ); ?></p></div>
291 300
 					<?php endif; ?>
292 301
 					<p><?php _e( 'You are about to remove the following plugin:' ); ?></p>
293
-				<?php else: ?>
294
-					<h1><?php _e( 'Delete Plugins' ); ?></h1>
302
+				<?php else {
303
+	: ?>
304
+					<h1><?php _e( 'Delete Plugins' );
305
+}
306
+?></h1>
295 307
 					<?php if ( $have_non_network_plugins && is_network_admin() ) : ?>
296 308
 						<div class="error"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php _e( 'These plugins may be active on other sites in the network.' ); ?></p></div>
297 309
 					<?php endif; ?>
@@ -313,10 +325,11 @@  discard block
 block discarded – undo
313 325
 						?>
314 326
 					</ul>
315 327
 				<p><?php
316
-				if ( $data_to_delete )
317
-					_e('Are you sure you wish to delete these files and data?');
318
-				else
319
-					_e('Are you sure you wish to delete these files?');
328
+				if ( $data_to_delete ) {
329
+									_e('Are you sure you wish to delete these files and data?');
330
+				} else {
331
+									_e('Are you sure you wish to delete these files?');
332
+				}
320 333
 				?></p>
321 334
 				<form method="post" action="<?php echo esc_url($_SERVER['REQUEST_URI']); ?>" style="display:inline;">
322 335
 					<input type="hidden" name="verify-delete" value="1" />
@@ -424,12 +437,13 @@  discard block
 block discarded – undo
424 437
 
425 438
 <?php if ( isset($_GET['error']) ) :
426 439
 
427
-	if ( isset( $_GET['main'] ) )
428
-		$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
429
-	elseif ( isset($_GET['charsout']) )
430
-		$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
431
-	else
432
-		$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
440
+	if ( isset( $_GET['main'] ) ) {
441
+			$errmsg = __( 'You cannot delete a plugin while it is active on the main site.' );
442
+	} elseif ( isset($_GET['charsout']) ) {
443
+			$errmsg = sprintf(__('The plugin generated %d characters of <strong>unexpected output</strong> during activation. If you notice &#8220;headers already sent&#8221; messages, problems with syndication feeds or other issues, try deactivating or removing this plugin.'), $_GET['charsout']);
444
+	} else {
445
+			$errmsg = __('Plugin could not be activated because it triggered a <strong>fatal error</strong>.');
446
+	}
433 447
 	?>
434 448
 	<div id="message" class="error"><p><?php echo $errmsg; ?></p>
435 449
 	<?php
@@ -452,12 +466,14 @@  discard block
 block discarded – undo
452 466
 
453 467
 		if ( is_wp_error($delete_result) ) : ?>
454 468
 		<div id="message" class="error notice is-dismissible"><p><?php printf( __('Plugin could not be deleted due to an error: %s'), $delete_result->get_error_message() ); ?></p></div>
455
-		<?php else : ?>
469
+		<?php else {
470
+	: ?>
456 471
 		<div id="message" class="updated notice is-dismissible">
457 472
 			<p>
458 473
 				<?php
459 474
 				if ( 1 == (int) $_GET['deleted'] ) {
460 475
 					_e( 'The selected plugin has been <strong>deleted</strong>.' );
476
+}
461 477
 				} else {
462 478
 					_e( 'The selected plugins have been <strong>deleted</strong>.' );
463 479
 				}
Please login to merge, or discard this patch.
src/wp-admin/user-edit.php 3 patches
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Edit user administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Edit user 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' );
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 ) );
51 51
 
52 52
 get_current_screen()->set_help_sidebar(
53
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
54
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' .
55
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
53
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
54
+	'<p>' . __('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' .
55
+	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
56 56
 );
57 57
 
58 58
 $wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
@@ -270,12 +270,12 @@  discard block
 block discarded – undo
270 270
 </tr>
271 271
 <?php
272 272
 /**
273
- * Fires at the end of the 'Personal Options' settings table on the user editing screen.
274
- *
275
- * @since 2.7.0
276
- *
277
- * @param WP_User $profileuser The current WP_User object.
278
- */
273
+	 * Fires at the end of the 'Personal Options' settings table on the user editing screen.
274
+	 *
275
+	 * @since 2.7.0
276
+	 *
277
+	 * @param WP_User $profileuser The current WP_User object.
278
+	 */
279 279
 do_action( 'personal_options', $profileuser );
280 280
 ?>
281 281
 
@@ -483,15 +483,15 @@  discard block
 block discarded – undo
483 483
 
484 484
 <?php
485 485
 /**
486
- * Filter the display of the password fields.
487
- *
488
- * @since 1.5.1
489
- * @since 2.8.0 Added the `$profileuser` parameter.
490
- * @since 4.4.0 Now evaluated only in user-edit.php.
491
- *
492
- * @param bool    $show        Whether to show the password fields. Default true.
493
- * @param WP_User $profileuser User object for the current user to edit.
494
- */
486
+		 * Filter the display of the password fields.
487
+		 *
488
+		 * @since 1.5.1
489
+		 * @since 2.8.0 Added the `$profileuser` parameter.
490
+		 * @since 4.4.0 Now evaluated only in user-edit.php.
491
+		 *
492
+		 * @param bool    $show        Whether to show the password fields. Default true.
493
+		 * @param WP_User $profileuser User object for the current user to edit.
494
+		 */
495 495
 if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
496 496
 ?>
497 497
 </table>
@@ -600,17 +600,17 @@  discard block
 block discarded – undo
600 600
 
601 601
 <?php
602 602
 /**
603
- * Filter whether to display additional capabilities for the user.
604
- *
605
- * The 'Additional Capabilities' section will only be enabled if
606
- * the number of the user's capabilities exceeds their number of
607
- * roles.
608
- *
609
- * @since 2.8.0
610
- *
611
- * @param bool    $enable      Whether to display the capabilities. Default true.
612
- * @param WP_User $profileuser The current WP_User object.
613
- */
603
+	 * Filter whether to display additional capabilities for the user.
604
+	 *
605
+	 * The 'Additional Capabilities' section will only be enabled if
606
+	 * the number of the user's capabilities exceeds their number of
607
+	 * roles.
608
+	 *
609
+	 * @since 2.8.0
610
+	 *
611
+	 * @param bool    $enable      Whether to display the capabilities. Default true.
612
+	 * @param WP_User $profileuser The current WP_User object.
613
+	 */
614 614
 if ( count( $profileuser->caps ) > count( $profileuser->roles )
615 615
 	&& apply_filters( 'additional_capabilities_display', true, $profileuser )
616 616
 ) : ?>
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -7,57 +7,57 @@  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_reset_vars( array( 'action', 'user_id', 'wp_http_referer' ) );
12
+wp_reset_vars(array('action', 'user_id', 'wp_http_referer'));
13 13
 
14 14
 $user_id = (int) $user_id;
15 15
 $current_user = wp_get_current_user();
16
-if ( ! defined( 'IS_PROFILE_PAGE' ) )
17
-	define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
16
+if ( ! defined('IS_PROFILE_PAGE'))
17
+	define('IS_PROFILE_PAGE', ($user_id == $current_user->ID));
18 18
 
19
-if ( ! $user_id && IS_PROFILE_PAGE )
19
+if ( ! $user_id && IS_PROFILE_PAGE)
20 20
 	$user_id = $current_user->ID;
21
-elseif ( ! $user_id && ! IS_PROFILE_PAGE )
22
-	wp_die(__( 'Invalid user ID.' ) );
23
-elseif ( ! get_userdata( $user_id ) )
24
-	wp_die( __('Invalid user ID.') );
21
+elseif ( ! $user_id && ! IS_PROFILE_PAGE)
22
+	wp_die(__('Invalid user ID.'));
23
+elseif ( ! get_userdata($user_id))
24
+	wp_die(__('Invalid user ID.'));
25 25
 
26 26
 wp_enqueue_script('user-profile');
27 27
 
28 28
 $title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
29
-if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
29
+if (current_user_can('edit_users') && ! IS_PROFILE_PAGE)
30 30
 	$submenu_file = 'users.php';
31 31
 else
32 32
 	$submenu_file = 'profile.php';
33 33
 
34
-if ( current_user_can('edit_users') && !is_user_admin() )
34
+if (current_user_can('edit_users') && ! is_user_admin())
35 35
 	$parent_file = 'users.php';
36 36
 else
37 37
 	$parent_file = 'profile.php';
38 38
 
39
-$profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
40
-	'<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' .
41
-	'<p>' . __('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.') . '</p>' .
42
-	'<p>' . __( 'You can log out of other devices, such as your phone or a public computer, by clicking the Log Out Everywhere Else button.' ) . '</p>' .
43
-	'<p>' . __('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.') . '</p>' .
44
-	'<p>' . __('Remember to click the Update Profile button when you are finished.') . '</p>';
39
+$profile_help = '<p>'.__('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.').'</p>'.
40
+	'<p>'.__('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.').'</p>'.
41
+	'<p>'.__('Your username cannot be changed, but you can use other fields to enter your real name or a nickname, and change which name to display on your posts.').'</p>'.
42
+	'<p>'.__('You can log out of other devices, such as your phone or a public computer, by clicking the Log Out Everywhere Else button.').'</p>'.
43
+	'<p>'.__('Required fields are indicated; the rest are optional. Profile information will only be displayed if your theme is set up to do so.').'</p>'.
44
+	'<p>'.__('Remember to click the Update Profile button when you are finished.').'</p>';
45 45
 
46
-get_current_screen()->add_help_tab( array(
46
+get_current_screen()->add_help_tab(array(
47 47
 	'id'      => 'overview',
48 48
 	'title'   => __('Overview'),
49 49
 	'content' => $profile_help,
50
-) );
50
+));
51 51
 
52 52
 get_current_screen()->set_help_sidebar(
53
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
54
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>') . '</p>' .
55
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
53
+    '<p><strong>'.__('For more information:').'</strong></p>'.
54
+    '<p>'.__('<a href="https://codex.wordpress.org/Users_Your_Profile_Screen" target="_blank">Documentation on User Profiles</a>').'</p>'.
55
+    '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
56 56
 );
57 57
 
58
-$wp_http_referer = remove_query_arg( array( 'update', 'delete_count', 'user_id' ), $wp_http_referer );
58
+$wp_http_referer = remove_query_arg(array('update', 'delete_count', 'user_id'), $wp_http_referer);
59 59
 
60
-$user_can_edit = current_user_can( 'edit_posts' ) || current_user_can( 'edit_pages' );
60
+$user_can_edit = current_user_can('edit_posts') || current_user_can('edit_pages');
61 61
 
62 62
 /**
63 63
  * Filter whether to allow administrators on Multisite to edit every user.
@@ -72,46 +72,46 @@  discard block
 block discarded – undo
72 72
  *
73 73
  * @param bool $allow Whether to allow editing of any user. Default true.
74 74
  */
75
-if ( is_multisite()
76
-	&& ! current_user_can( 'manage_network_users' )
75
+if (is_multisite()
76
+	&& ! current_user_can('manage_network_users')
77 77
 	&& $user_id != $current_user->ID
78
-	&& ! apply_filters( 'enable_edit_any_user_configuration', true )
78
+	&& ! apply_filters('enable_edit_any_user_configuration', true)
79 79
 ) {
80
-	wp_die( __( 'You do not have permission to edit this user.' ) );
80
+	wp_die(__('You do not have permission to edit this user.'));
81 81
 }
82 82
 
83 83
 // Execute confirmed email change. See send_confirmation_on_profile_email().
84
-if ( is_multisite() && IS_PROFILE_PAGE && isset( $_GET[ 'newuseremail' ] ) && $current_user->ID ) {
85
-	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
86
-	if ( $new_email && $new_email[ 'hash' ] == $_GET[ 'newuseremail' ] ) {
84
+if (is_multisite() && IS_PROFILE_PAGE && isset($_GET['newuseremail']) && $current_user->ID) {
85
+	$new_email = get_user_meta($current_user->ID, '_new_email', true);
86
+	if ($new_email && $new_email['hash'] == $_GET['newuseremail']) {
87 87
 		$user = new stdClass;
88 88
 		$user->ID = $current_user->ID;
89
-		$user->user_email = esc_html( trim( $new_email[ 'newemail' ] ) );
90
-		if ( $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login ) ) ) {
91
-			$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login ) );
89
+		$user->user_email = esc_html(trim($new_email['newemail']));
90
+		if ($wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $current_user->user_login))) {
91
+			$wpdb->query($wpdb->prepare("UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $user->user_email, $current_user->user_login));
92 92
 		}
93
-		wp_update_user( $user );
94
-		delete_user_meta( $current_user->ID, '_new_email' );
95
-		wp_redirect( add_query_arg( array( 'updated' => 'true' ), self_admin_url( 'profile.php' ) ) );
93
+		wp_update_user($user);
94
+		delete_user_meta($current_user->ID, '_new_email');
95
+		wp_redirect(add_query_arg(array('updated' => 'true'), self_admin_url('profile.php')));
96 96
 		die();
97 97
 	} else {
98
-		wp_redirect( add_query_arg( array( 'error' => 'new-email' ), self_admin_url( 'profile.php' ) ) );
98
+		wp_redirect(add_query_arg(array('error' => 'new-email'), self_admin_url('profile.php')));
99 99
 	}
100
-} elseif ( is_multisite() && IS_PROFILE_PAGE && !empty( $_GET['dismiss'] ) && $current_user->ID . '_new_email' == $_GET['dismiss'] ) {
101
-	delete_user_meta( $current_user->ID, '_new_email' );
102
-	wp_redirect( add_query_arg( array('updated' => 'true'), self_admin_url( 'profile.php' ) ) );
100
+} elseif (is_multisite() && IS_PROFILE_PAGE && ! empty($_GET['dismiss']) && $current_user->ID.'_new_email' == $_GET['dismiss']) {
101
+	delete_user_meta($current_user->ID, '_new_email');
102
+	wp_redirect(add_query_arg(array('updated' => 'true'), self_admin_url('profile.php')));
103 103
 	die();
104 104
 }
105 105
 
106 106
 switch ($action) {
107 107
 case 'update':
108 108
 
109
-check_admin_referer('update-user_' . $user_id);
109
+check_admin_referer('update-user_'.$user_id);
110 110
 
111
-if ( !current_user_can('edit_user', $user_id) )
111
+if ( ! current_user_can('edit_user', $user_id))
112 112
 	wp_die(__('You do not have permission to edit this user.'));
113 113
 
114
-if ( IS_PROFILE_PAGE ) {
114
+if (IS_PROFILE_PAGE) {
115 115
 	/**
116 116
 	 * Fires before the page loads on the 'Your Profile' editing screen.
117 117
 	 *
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 *
122 122
 	 * @param int $user_id The user ID.
123 123
 	 */
124
-	do_action( 'personal_options_update', $user_id );
124
+	do_action('personal_options_update', $user_id);
125 125
 } else {
126 126
 	/**
127 127
 	 * Fires before the page loads on the 'Edit User' screen.
@@ -130,29 +130,29 @@  discard block
 block discarded – undo
130 130
 	 *
131 131
 	 * @param int $user_id The user ID.
132 132
 	 */
133
-	do_action( 'edit_user_profile_update', $user_id );
133
+	do_action('edit_user_profile_update', $user_id);
134 134
 }
135 135
 
136 136
 // Update the email address in signups, if present.
137
-if ( is_multisite() ) {
138
-	$user = get_userdata( $user_id );
137
+if (is_multisite()) {
138
+	$user = get_userdata($user_id);
139 139
 
140
-	if ( $user->user_login && isset( $_POST[ 'email' ] ) && is_email( $_POST[ 'email' ] ) && $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login ) ) ) {
141
-		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
140
+	if ($user->user_login && isset($_POST['email']) && is_email($_POST['email']) && $wpdb->get_var($wpdb->prepare("SELECT user_login FROM {$wpdb->signups} WHERE user_login = %s", $user->user_login))) {
141
+		$wpdb->query($wpdb->prepare("UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email'], $user_login));
142 142
 	}
143 143
 }
144 144
 
145 145
 // Update the user.
146
-$errors = edit_user( $user_id );
146
+$errors = edit_user($user_id);
147 147
 
148 148
 // Grant or revoke super admin status if requested.
149
-if ( is_multisite() && is_network_admin() && !IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) && empty( $_POST['super_admin'] ) == is_super_admin( $user_id ) ) {
150
-	empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
149
+if (is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can('manage_network_options') && ! isset($super_admins) && empty($_POST['super_admin']) == is_super_admin($user_id)) {
150
+	empty($_POST['super_admin']) ? revoke_super_admin($user_id) : grant_super_admin($user_id);
151 151
 }
152 152
 
153
-if ( !is_wp_error( $errors ) ) {
154
-	$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
155
-	if ( $wp_http_referer )
153
+if ( ! is_wp_error($errors)) {
154
+	$redirect = add_query_arg('updated', true, get_edit_user_link($user_id));
155
+	if ($wp_http_referer)
156 156
 		$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
157 157
 	wp_redirect($redirect);
158 158
 	exit;
@@ -161,62 +161,62 @@  discard block
 block discarded – undo
161 161
 default:
162 162
 $profileuser = get_user_to_edit($user_id);
163 163
 
164
-if ( !current_user_can('edit_user', $user_id) )
164
+if ( ! current_user_can('edit_user', $user_id))
165 165
 	wp_die(__('You do not have permission to edit this user.'));
166 166
 
167
-$sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
167
+$sessions = WP_Session_Tokens::get_instance($profileuser->ID);
168 168
 
169
-include(ABSPATH . 'wp-admin/admin-header.php');
169
+include(ABSPATH.'wp-admin/admin-header.php');
170 170
 ?>
171 171
 
172
-<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
172
+<?php if ( ! IS_PROFILE_PAGE && is_super_admin($profileuser->ID) && current_user_can('manage_network_options')) { ?>
173 173
 	<div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
174 174
 <?php } ?>
175
-<?php if ( isset($_GET['updated']) ) : ?>
175
+<?php if (isset($_GET['updated'])) : ?>
176 176
 <div id="message" class="updated notice is-dismissible">
177
-	<?php if ( IS_PROFILE_PAGE ) : ?>
177
+	<?php if (IS_PROFILE_PAGE) : ?>
178 178
 	<p><strong><?php _e('Profile updated.') ?></strong></p>
179 179
 	<?php else: ?>
180 180
 	<p><strong><?php _e('User updated.') ?></strong></p>
181 181
 	<?php endif; ?>
182
-	<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
183
-	<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
182
+	<?php if ($wp_http_referer && false === strpos($wp_http_referer, 'user-new.php') && ! IS_PROFILE_PAGE) : ?>
183
+	<p><a href="<?php echo esc_url($wp_http_referer); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
184 184
 	<?php endif; ?>
185 185
 </div>
186 186
 <?php endif; ?>
187
-<?php if ( isset( $_GET['error'] ) ) : ?>
187
+<?php if (isset($_GET['error'])) : ?>
188 188
 <div class="notice notice-error">
189
-	<?php if ( 'new-email' == $_GET['error'] ) : ?>
190
-	<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
189
+	<?php if ('new-email' == $_GET['error']) : ?>
190
+	<p><?php _e('Error while saving the new email address. Please try again.'); ?></p>
191 191
 	<?php endif; ?>
192 192
 </div>
193 193
 <?php endif; ?>
194
-<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
195
-<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
194
+<?php if (isset($errors) && is_wp_error($errors)) : ?>
195
+<div class="error"><p><?php echo implode("</p>\n<p>", $errors->get_error_messages()); ?></p></div>
196 196
 <?php endif; ?>
197 197
 
198 198
 <div class="wrap" id="profile-page">
199 199
 <h1>
200 200
 <?php
201
-echo esc_html( $title );
202
-if ( ! IS_PROFILE_PAGE ) {
203
-	if ( current_user_can( 'create_users' ) ) { ?>
204
-		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
205
-	<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
206
-		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
201
+echo esc_html($title);
202
+if ( ! IS_PROFILE_PAGE) {
203
+	if (current_user_can('create_users')) { ?>
204
+		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a>
205
+	<?php } elseif (is_multisite() && current_user_can('promote_users')) { ?>
206
+		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x('Add Existing', 'user'); ?></a>
207 207
 	<?php }
208 208
 } ?>
209 209
 </h1>
210
-<form id="your-profile" action="<?php echo esc_url( self_admin_url( IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php' ) ); ?>" method="post" novalidate="novalidate"<?php
210
+<form id="your-profile" action="<?php echo esc_url(self_admin_url(IS_PROFILE_PAGE ? 'profile.php' : 'user-edit.php')); ?>" method="post" novalidate="novalidate"<?php
211 211
 	/**
212 212
 	 * Fires inside the your-profile form tag on the user editing screen.
213 213
 	 *
214 214
 	 * @since 3.0.0
215 215
 	 */
216
-	do_action( 'user_edit_form_tag' );
216
+	do_action('user_edit_form_tag');
217 217
 ?>>
218
-<?php wp_nonce_field('update-user_' . $user_id) ?>
219
-<?php if ( $wp_http_referer ) : ?>
218
+<?php wp_nonce_field('update-user_'.$user_id) ?>
219
+<?php if ($wp_http_referer) : ?>
220 220
 	<input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
221 221
 <?php endif; ?>
222 222
 <p>
@@ -224,16 +224,16 @@  discard block
 block discarded – undo
224 224
 <input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
225 225
 </p>
226 226
 
227
-<h2><?php _e( 'Personal Options' ); ?></h2>
227
+<h2><?php _e('Personal Options'); ?></h2>
228 228
 
229 229
 <table class="form-table">
230
-<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
230
+<?php if ( ! (IS_PROFILE_PAGE && ! $user_can_edit)) : ?>
231 231
 	<tr class="user-rich-editing-wrap">
232
-		<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
233
-		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
232
+		<th scope="row"><?php _e('Visual Editor'); ?></th>
233
+		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty($profileuser->rich_editing)) checked('false', $profileuser->rich_editing); ?> /> <?php _e('Disable the visual editor when writing'); ?></label></td>
234 234
 	</tr>
235 235
 <?php endif; ?>
236
-<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
236
+<?php if (count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker')) : ?>
237 237
 <tr class="user-admin-color-wrap">
238 238
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
239 239
 <td><?php
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
 	 *
249 249
 	 * @param int $user_id The user ID.
250 250
 	 */
251
-	do_action( 'admin_color_scheme_picker', $user_id );
251
+	do_action('admin_color_scheme_picker', $user_id);
252 252
 ?></td>
253 253
 </tr>
254 254
 <?php
255 255
 endif; // $_wp_admin_css_colors
256
-if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
256
+if ( ! (IS_PROFILE_PAGE && ! $user_can_edit)) : ?>
257 257
 <tr class="user-comment-shortcuts-wrap">
258
-<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
259
-<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
258
+<th scope="row"><?php _e('Keyboard Shortcuts'); ?></th>
259
+<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty($profileuser->comment_shortcuts)) checked('true', $profileuser->comment_shortcuts); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
260 260
 </tr>
261 261
 <?php endif; ?>
262 262
 <tr class="show-admin-bar user-admin-bar-front-wrap">
263
-<th scope="row"><?php _e( 'Toolbar' ); ?></th>
263
+<th scope="row"><?php _e('Toolbar'); ?></th>
264 264
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend>
265 265
 <label for="admin_bar_front">
266
-<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
267
-<?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
266
+<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked(_get_admin_bar_pref('front', $profileuser->ID)); ?> />
267
+<?php _e('Show Toolbar when viewing site'); ?></label><br />
268 268
 </fieldset>
269 269
 </td>
270 270
 </tr>
@@ -276,12 +276,12 @@  discard block
 block discarded – undo
276 276
  *
277 277
  * @param WP_User $profileuser The current WP_User object.
278 278
  */
279
-do_action( 'personal_options', $profileuser );
279
+do_action('personal_options', $profileuser);
280 280
 ?>
281 281
 
282 282
 </table>
283 283
 <?php
284
-	if ( IS_PROFILE_PAGE ) {
284
+	if (IS_PROFILE_PAGE) {
285 285
 		/**
286 286
 		 * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
287 287
 		 *
@@ -291,11 +291,11 @@  discard block
 block discarded – undo
291 291
 		 *
292 292
 		 * @param WP_User $profileuser The current WP_User object.
293 293
 		 */
294
-		do_action( 'profile_personal_options', $profileuser );
294
+		do_action('profile_personal_options', $profileuser);
295 295
 	}
296 296
 ?>
297 297
 
298
-<h2><?php _e( 'Name' ); ?></h2>
298
+<h2><?php _e('Name'); ?></h2>
299 299
 
300 300
 <table class="form-table">
301 301
 	<tr class="user-user-login-wrap">
@@ -303,33 +303,33 @@  discard block
 block discarded – undo
303 303
 		<td><input type="text" name="user_login" id="user_login" value="<?php echo esc_attr($profileuser->user_login); ?>" disabled="disabled" class="regular-text" /> <span class="description"><?php _e('Usernames cannot be changed.'); ?></span></td>
304 304
 	</tr>
305 305
 
306
-<?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
306
+<?php if ( ! IS_PROFILE_PAGE && ! is_network_admin()) : ?>
307 307
 <tr class="user-role-wrap"><th><label for="role"><?php _e('Role') ?></label></th>
308 308
 <td><select name="role" id="role">
309 309
 <?php
310 310
 // Compare user role against currently editable roles
311
-$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
312
-$user_role  = reset( $user_roles );
311
+$user_roles = array_intersect(array_values($profileuser->roles), array_keys(get_editable_roles()));
312
+$user_role  = reset($user_roles);
313 313
 
314 314
 // print the full list of roles with the primary one selected.
315 315
 wp_dropdown_roles($user_role);
316 316
 
317 317
 // print the 'no role' option. Make it selected if the user has no role yet.
318
-if ( $user_role )
319
-	echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
318
+if ($user_role)
319
+	echo '<option value="">'.__('&mdash; No role for this site &mdash;').'</option>';
320 320
 else
321
-	echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
321
+	echo '<option value="" selected="selected">'.__('&mdash; No role for this site &mdash;').'</option>';
322 322
 ?>
323 323
 </select></td></tr>
324 324
 <?php endif; //!IS_PROFILE_PAGE
325 325
 
326
-if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
326
+if (is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can('manage_network_options') && ! isset($super_admins)) { ?>
327 327
 <tr class="user-super-admin-wrap"><th><?php _e('Super Admin'); ?></th>
328 328
 <td>
329
-<?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
330
-<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
329
+<?php if ($profileuser->user_email != get_site_option('admin_email') || ! is_super_admin($profileuser->ID)) : ?>
330
+<p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked(is_super_admin($profileuser->ID)); ?> /> <?php _e('Grant this user super admin privileges for the Network.'); ?></label></p>
331 331
 <?php else : ?>
332
-<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
332
+<p><?php _e('Super admin privileges cannot be removed because this user has the network admin email.'); ?></p>
333 333
 <?php endif; ?>
334 334
 </td></tr>
335 335
 <?php } ?>
@@ -358,26 +358,26 @@  discard block
 block discarded – undo
358 358
 			$public_display['display_nickname']  = $profileuser->nickname;
359 359
 			$public_display['display_username']  = $profileuser->user_login;
360 360
 
361
-			if ( !empty($profileuser->first_name) )
361
+			if ( ! empty($profileuser->first_name))
362 362
 				$public_display['display_firstname'] = $profileuser->first_name;
363 363
 
364
-			if ( !empty($profileuser->last_name) )
364
+			if ( ! empty($profileuser->last_name))
365 365
 				$public_display['display_lastname'] = $profileuser->last_name;
366 366
 
367
-			if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
368
-				$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
369
-				$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
367
+			if ( ! empty($profileuser->first_name) && ! empty($profileuser->last_name)) {
368
+				$public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
369
+				$public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
370 370
 			}
371 371
 
372
-			if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
373
-				$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
372
+			if ( ! in_array($profileuser->display_name, $public_display)) // Only add this if it isn't duplicated elsewhere
373
+				$public_display = array('display_displayname' => $profileuser->display_name) + $public_display;
374 374
 
375
-			$public_display = array_map( 'trim', $public_display );
376
-			$public_display = array_unique( $public_display );
375
+			$public_display = array_map('trim', $public_display);
376
+			$public_display = array_unique($public_display);
377 377
 
378
-			foreach ( $public_display as $id => $item ) {
378
+			foreach ($public_display as $id => $item) {
379 379
 		?>
380
-			<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
380
+			<option <?php selected($profileuser->display_name, $item); ?>><?php echo $item; ?></option>
381 381
 		<?php
382 382
 			}
383 383
 		?>
@@ -386,26 +386,26 @@  discard block
 block discarded – undo
386 386
 </tr>
387 387
 </table>
388 388
 
389
-<h2><?php _e( 'Contact Info' ); ?></h2>
389
+<h2><?php _e('Contact Info'); ?></h2>
390 390
 
391 391
 <table class="form-table">
392 392
 <tr class="user-email-wrap">
393 393
 	<th><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
394
-	<td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" />
394
+	<td><input type="email" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text ltr" />
395 395
 	<?php
396
-	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
397
-	if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
396
+	$new_email = get_user_meta($current_user->ID, '_new_email', true);
397
+	if ($new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID) : ?>
398 398
 	<div class="updated inline">
399 399
 	<p><?php
400 400
 		printf(
401 401
 			/* translators: %s: new email */
402
-			__( 'There is a pending change of your email to %s.' ),
403
-			'<code>' . $new_email['newemail'] . '</code>'
402
+			__('There is a pending change of your email to %s.'),
403
+			'<code>'.$new_email['newemail'].'</code>'
404 404
 		);
405 405
 		printf(
406 406
 			' <a href="%1$s">%2$s</a>',
407
-			esc_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ) ),
408
-			__( 'Cancel' )
407
+			esc_url(self_admin_url('profile.php?dismiss='.$current_user->ID.'_new_email')),
408
+			__('Cancel')
409 409
 		);
410 410
 	?></p>
411 411
 	</div>
@@ -415,11 +415,11 @@  discard block
 block discarded – undo
415 415
 
416 416
 <tr class="user-url-wrap">
417 417
 	<th><label for="url"><?php _e('Website') ?></label></th>
418
-	<td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ) ?>" class="regular-text code" /></td>
418
+	<td><input type="url" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
419 419
 </tr>
420 420
 
421 421
 <?php
422
-	foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
422
+	foreach (wp_get_user_contact_methods($profileuser) as $name => $desc) {
423 423
 ?>
424 424
 <tr class="user-<?php echo $name; ?>-wrap">
425 425
 	<th><label for="<?php echo $name; ?>">
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 		 *
435 435
 		 * @param string $desc The translatable label for the contactmethod.
436 436
 		 */
437
-		echo apply_filters( "user_{$name}_label", $desc );
437
+		echo apply_filters("user_{$name}_label", $desc);
438 438
 		?>
439 439
 	</label></th>
440 440
 	<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 ?>
445 445
 </table>
446 446
 
447
-<h2><?php IS_PROFILE_PAGE ? _e( 'About Yourself' ) : _e( 'About the user' ); ?></h2>
447
+<h2><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h2>
448 448
 
449 449
 <table class="form-table">
450 450
 <tr class="user-description-wrap">
@@ -453,16 +453,16 @@  discard block
 block discarded – undo
453 453
 	<p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p></td>
454 454
 </tr>
455 455
 
456
-<?php if ( get_option( 'show_avatars' ) ) : ?>
456
+<?php if (get_option('show_avatars')) : ?>
457 457
 <tr class="user-profile-picture">
458
-	<th><?php _e( 'Profile Picture' ); ?></th>
458
+	<th><?php _e('Profile Picture'); ?></th>
459 459
 	<td>
460
-		<?php echo get_avatar( $user_id ); ?>
460
+		<?php echo get_avatar($user_id); ?>
461 461
 		<p class="description"><?php
462
-			if ( IS_PROFILE_PAGE ) {
462
+			if (IS_PROFILE_PAGE) {
463 463
 				/* translators: %s: Gravatar URL */
464
-				$description = sprintf( __( 'You can change your profile picture on <a href="%s">Gravatar</a>.' ),
465
-					__( 'https://en.gravatar.com/' )
464
+				$description = sprintf(__('You can change your profile picture on <a href="%s">Gravatar</a>.'),
465
+					__('https://en.gravatar.com/')
466 466
 				);
467 467
 			} else {
468 468
 				$description = '';
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 			 *
476 476
 			 * @param string $description The description that will be printed.
477 477
 			 */
478
-			echo apply_filters( 'user_profile_picture_description', $description );
478
+			echo apply_filters('user_profile_picture_description', $description);
479 479
 		?></p>
480 480
 	</td>
481 481
 </tr>
@@ -492,80 +492,80 @@  discard block
 block discarded – undo
492 492
  * @param bool    $show        Whether to show the password fields. Default true.
493 493
  * @param WP_User $profileuser User object for the current user to edit.
494 494
  */
495
-if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
495
+if ($show_password_fields = apply_filters('show_password_fields', true, $profileuser)) :
496 496
 ?>
497 497
 </table>
498 498
 
499
-<h2><?php _e( 'Account Management' ); ?></h2>
499
+<h2><?php _e('Account Management'); ?></h2>
500 500
 <table class="form-table">
501 501
 <tr id="password" class="user-pass1-wrap">
502
-	<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
502
+	<th><label for="pass1"><?php _e('New Password'); ?></label></th>
503 503
 	<td>
504 504
 		<input class="hidden" value=" " /><!-- #24364 workaround -->
505
-		<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Generate Password' ); ?></button>
505
+		<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e('Generate Password'); ?></button>
506 506
 		<div class="wp-pwd hide-if-js">
507 507
 			<span class="password-input-wrapper">
508
-				<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr( wp_generate_password( 24 ) ); ?>" aria-describedby="pass-strength-result" />
508
+				<input type="password" name="pass1" id="pass1" class="regular-text" value="" autocomplete="off" data-pw="<?php echo esc_attr(wp_generate_password(24)); ?>" aria-describedby="pass-strength-result" />
509 509
 			</span>
510
-			<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' ); ?>">
510
+			<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'); ?>">
511 511
 				<span class="dashicons dashicons-hidden"></span>
512
-				<span class="text"><?php _e( 'Hide' ); ?></span>
512
+				<span class="text"><?php _e('Hide'); ?></span>
513 513
 			</button>
514
-			<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' ); ?>">
515
-				<span class="text"><?php _e( 'Cancel' ); ?></span>
514
+			<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'); ?>">
515
+				<span class="text"><?php _e('Cancel'); ?></span>
516 516
 			</button>
517 517
 			<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
518 518
 		</div>
519 519
 	</td>
520 520
 </tr>
521 521
 <tr class="user-pass2-wrap hide-if-js">
522
-	<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
522
+	<th scope="row"><label for="pass2"><?php _e('Repeat New Password'); ?></label></th>
523 523
 	<td>
524 524
 	<input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" />
525
-	<p class="description"><?php _e( 'Type your new password again.' ); ?></p>
525
+	<p class="description"><?php _e('Type your new password again.'); ?></p>
526 526
 	</td>
527 527
 </tr>
528 528
 <tr class="pw-weak">
529
-	<th><?php _e( 'Confirm Password' ); ?></th>
529
+	<th><?php _e('Confirm Password'); ?></th>
530 530
 	<td>
531 531
 		<label>
532 532
 			<input type="checkbox" name="pw_weak" class="pw-checkbox" />
533
-			<?php _e( 'Confirm use of weak password' ); ?>
533
+			<?php _e('Confirm use of weak password'); ?>
534 534
 		</label>
535 535
 	</td>
536 536
 </tr>
537 537
 <?php endif; ?>
538 538
 
539 539
 <?php
540
-if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?>
540
+if (IS_PROFILE_PAGE && count($sessions->get_all()) === 1) : ?>
541 541
 	<tr class="user-sessions-wrap hide-if-no-js">
542
-		<th><?php _e( 'Sessions' ); ?></th>
542
+		<th><?php _e('Sessions'); ?></th>
543 543
 		<td aria-live="assertive">
544
-			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
544
+			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e('Log Out Everywhere Else'); ?></button></div>
545 545
 			<p class="description">
546
-				<?php _e( 'You are only logged in at this location.' ); ?>
546
+				<?php _e('You are only logged in at this location.'); ?>
547 547
 			</p>
548 548
 		</td>
549 549
 	</tr>
550
-<?php elseif ( IS_PROFILE_PAGE && count( $sessions->get_all() ) > 1 ) : ?>
550
+<?php elseif (IS_PROFILE_PAGE && count($sessions->get_all()) > 1) : ?>
551 551
 	<tr class="user-sessions-wrap hide-if-no-js">
552
-		<th><?php _e( 'Sessions' ); ?></th>
552
+		<th><?php _e('Sessions'); ?></th>
553 553
 		<td aria-live="assertive">
554
-			<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
554
+			<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e('Log Out Everywhere Else'); ?></button></div>
555 555
 			<p class="description">
556
-				<?php _e( 'Did you lose your phone or leave your account logged in at a public computer? You can log out everywhere else, and stay logged in here.' ); ?>
556
+				<?php _e('Did you lose your phone or leave your account logged in at a public computer? You can log out everywhere else, and stay logged in here.'); ?>
557 557
 			</p>
558 558
 		</td>
559 559
 	</tr>
560
-<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all() ) : ?>
560
+<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all()) : ?>
561 561
 	<tr class="user-sessions-wrap hide-if-no-js">
562
-		<th><?php _e( 'Sessions' ); ?></th>
562
+		<th><?php _e('Sessions'); ?></th>
563 563
 		<td>
564
-			<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out Everywhere' ); ?></button></p>
564
+			<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e('Log Out Everywhere'); ?></button></p>
565 565
 			<p class="description">
566 566
 				<?php
567 567
 				/* translators: 1: User's display name. */
568
-				printf( __( 'Log %s out of all locations.' ), $profileuser->display_name );
568
+				printf(__('Log %s out of all locations.'), $profileuser->display_name);
569 569
 				?>
570 570
 			</p>
571 571
 		</td>
@@ -575,7 +575,7 @@  discard block
 block discarded – undo
575 575
 </table>
576 576
 
577 577
 <?php
578
-	if ( IS_PROFILE_PAGE ) {
578
+	if (IS_PROFILE_PAGE) {
579 579
 		/**
580 580
 		 * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
581 581
 		 *
@@ -585,7 +585,7 @@  discard block
 block discarded – undo
585 585
 		 *
586 586
 		 * @param WP_User $profileuser The current WP_User object.
587 587
 		 */
588
-		do_action( 'show_user_profile', $profileuser );
588
+		do_action('show_user_profile', $profileuser);
589 589
 	} else {
590 590
 		/**
591 591
 		 * Fires after the 'About the User' settings table on the 'Edit User' screen.
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		 *
595 595
 		 * @param WP_User $profileuser The current WP_User object.
596 596
 		 */
597
-		do_action( 'edit_user_profile', $profileuser );
597
+		do_action('edit_user_profile', $profileuser);
598 598
 	}
599 599
 ?>
600 600
 
@@ -611,21 +611,21 @@  discard block
 block discarded – undo
611 611
  * @param bool    $enable      Whether to display the capabilities. Default true.
612 612
  * @param WP_User $profileuser The current WP_User object.
613 613
  */
614
-if ( count( $profileuser->caps ) > count( $profileuser->roles )
615
-	&& apply_filters( 'additional_capabilities_display', true, $profileuser )
614
+if (count($profileuser->caps) > count($profileuser->roles)
615
+	&& apply_filters('additional_capabilities_display', true, $profileuser)
616 616
 ) : ?>
617
-<h2><?php _e( 'Additional Capabilities' ); ?></h2>
617
+<h2><?php _e('Additional Capabilities'); ?></h2>
618 618
 <table class="form-table">
619 619
 <tr class="user-capabilities-wrap">
620
-	<th scope="row"><?php _e( 'Capabilities' ); ?></th>
620
+	<th scope="row"><?php _e('Capabilities'); ?></th>
621 621
 	<td>
622 622
 <?php
623 623
 	$output = '';
624
-	foreach ( $profileuser->caps as $cap => $value ) {
625
-		if ( ! $wp_roles->is_role( $cap ) ) {
626
-			if ( '' != $output )
624
+	foreach ($profileuser->caps as $cap => $value) {
625
+		if ( ! $wp_roles->is_role($cap)) {
626
+			if ('' != $output)
627 627
 				$output .= ', ';
628
-			$output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
628
+			$output .= $value ? $cap : sprintf(__('Denied: %s'), $cap);
629 629
 		}
630 630
 	}
631 631
 	echo $output;
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 <input type="hidden" name="action" value="update" />
639 639
 <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
640 640
 
641
-<?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
641
+<?php submit_button(IS_PROFILE_PAGE ? __('Update Profile') : __('Update User')); ?>
642 642
 
643 643
 </form>
644 644
 </div>
@@ -652,4 +652,4 @@  discard block
 block discarded – undo
652 652
 	}
653 653
 </script>
654 654
 <?php
655
-include( ABSPATH . 'wp-admin/admin-footer.php');
655
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +52 added lines, -27 removed lines patch added patch discarded remove patch
@@ -13,28 +13,32 @@  discard block
 block discarded – undo
13 13
 
14 14
 $user_id = (int) $user_id;
15 15
 $current_user = wp_get_current_user();
16
-if ( ! defined( 'IS_PROFILE_PAGE' ) )
16
+if ( ! defined( 'IS_PROFILE_PAGE' ) ) {
17 17
 	define( 'IS_PROFILE_PAGE', ( $user_id == $current_user->ID ) );
18
+}
18 19
 
19
-if ( ! $user_id && IS_PROFILE_PAGE )
20
+if ( ! $user_id && IS_PROFILE_PAGE ) {
20 21
 	$user_id = $current_user->ID;
21
-elseif ( ! $user_id && ! IS_PROFILE_PAGE )
22
+} elseif ( ! $user_id && ! IS_PROFILE_PAGE ) {
22 23
 	wp_die(__( 'Invalid user ID.' ) );
23
-elseif ( ! get_userdata( $user_id ) )
24
+} elseif ( ! get_userdata( $user_id ) ) {
24 25
 	wp_die( __('Invalid user ID.') );
26
+}
25 27
 
26 28
 wp_enqueue_script('user-profile');
27 29
 
28 30
 $title = IS_PROFILE_PAGE ? __('Profile') : __('Edit User');
29
-if ( current_user_can('edit_users') && !IS_PROFILE_PAGE )
31
+if ( current_user_can('edit_users') && !IS_PROFILE_PAGE ) {
30 32
 	$submenu_file = 'users.php';
31
-else
33
+} else {
32 34
 	$submenu_file = 'profile.php';
35
+}
33 36
 
34
-if ( current_user_can('edit_users') && !is_user_admin() )
37
+if ( current_user_can('edit_users') && !is_user_admin() ) {
35 38
 	$parent_file = 'users.php';
36
-else
39
+} else {
37 40
 	$parent_file = 'profile.php';
41
+}
38 42
 
39 43
 $profile_help = '<p>' . __('Your profile contains information about you (your &#8220;account&#8221;) as well as some personal options related to using WordPress.') . '</p>' .
40 44
 	'<p>' . __('You can change your password, turn on keyboard shortcuts, change the color scheme of your WordPress administration screens, and turn off the WYSIWYG (Visual) editor, among other things. You can hide the Toolbar (formerly called the Admin Bar) from the front end of your site, however it cannot be disabled on the admin screens.') . '</p>' .
@@ -108,8 +112,9 @@  discard block
 block discarded – undo
108 112
 
109 113
 check_admin_referer('update-user_' . $user_id);
110 114
 
111
-if ( !current_user_can('edit_user', $user_id) )
115
+if ( !current_user_can('edit_user', $user_id) ) {
112 116
 	wp_die(__('You do not have permission to edit this user.'));
117
+}
113 118
 
114 119
 if ( IS_PROFILE_PAGE ) {
115 120
 	/**
@@ -152,8 +157,9 @@  discard block
 block discarded – undo
152 157
 
153 158
 if ( !is_wp_error( $errors ) ) {
154 159
 	$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
155
-	if ( $wp_http_referer )
156
-		$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
160
+	if ( $wp_http_referer ) {
161
+			$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
162
+	}
157 163
 	wp_redirect($redirect);
158 164
 	exit;
159 165
 }
@@ -161,8 +167,9 @@  discard block
 block discarded – undo
161 167
 default:
162 168
 $profileuser = get_user_to_edit($user_id);
163 169
 
164
-if ( !current_user_can('edit_user', $user_id) )
170
+if ( !current_user_can('edit_user', $user_id) ) {
165 171
 	wp_die(__('You do not have permission to edit this user.'));
172
+}
166 173
 
167 174
 $sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
168 175
 
@@ -176,9 +183,12 @@  discard block
 block discarded – undo
176 183
 <div id="message" class="updated notice is-dismissible">
177 184
 	<?php if ( IS_PROFILE_PAGE ) : ?>
178 185
 	<p><strong><?php _e('Profile updated.') ?></strong></p>
179
-	<?php else: ?>
186
+	<?php else {
187
+	: ?>
180 188
 	<p><strong><?php _e('User updated.') ?></strong></p>
181
-	<?php endif; ?>
189
+	<?php endif;
190
+}
191
+?>
182 192
 	<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
183 193
 	<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
184 194
 	<?php endif; ?>
@@ -230,7 +240,10 @@  discard block
 block discarded – undo
230 240
 <?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
231 241
 	<tr class="user-rich-editing-wrap">
232 242
 		<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
233
-		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) checked( 'false', $profileuser->rich_editing ); ?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
243
+		<td><label for="rich_editing"><input name="rich_editing" type="checkbox" id="rich_editing" value="false" <?php if ( ! empty( $profileuser->rich_editing ) ) {
244
+	checked( 'false', $profileuser->rich_editing );
245
+}
246
+?> /> <?php _e( 'Disable the visual editor when writing' ); ?></label></td>
234 247
 	</tr>
235 248
 <?php endif; ?>
236 249
 <?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
@@ -256,7 +269,10 @@  discard block
 block discarded – undo
256 269
 if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
257 270
 <tr class="user-comment-shortcuts-wrap">
258 271
 <th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
259
-<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) checked( 'true', $profileuser->comment_shortcuts ); ?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
272
+<td><label for="comment_shortcuts"><input type="checkbox" name="comment_shortcuts" id="comment_shortcuts" value="true" <?php if ( ! empty( $profileuser->comment_shortcuts ) ) {
273
+	checked( 'true', $profileuser->comment_shortcuts );
274
+}
275
+?> /> <?php _e('Enable keyboard shortcuts for comment moderation.'); ?></label> <?php _e('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">More information</a>'); ?></td>
260 276
 </tr>
261 277
 <?php endif; ?>
262 278
 <tr class="show-admin-bar user-admin-bar-front-wrap">
@@ -315,10 +331,11 @@  discard block
 block discarded – undo
315 331
 wp_dropdown_roles($user_role);
316 332
 
317 333
 // print the 'no role' option. Make it selected if the user has no role yet.
318
-if ( $user_role )
334
+if ( $user_role ) {
319 335
 	echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
320
-else
336
+} else {
321 337
 	echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
338
+}
322 339
 ?>
323 340
 </select></td></tr>
324 341
 <?php endif; //!IS_PROFILE_PAGE
@@ -328,8 +345,11 @@  discard block
 block discarded – undo
328 345
 <td>
329 346
 <?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
330 347
 <p><label><input type="checkbox" id="super_admin" name="super_admin"<?php checked( is_super_admin( $profileuser->ID ) ); ?> /> <?php _e( 'Grant this user super admin privileges for the Network.' ); ?></label></p>
331
-<?php else : ?>
332
-<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
348
+<?php else {
349
+	: ?>
350
+<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' );
351
+}
352
+?></p>
333 353
 <?php endif; ?>
334 354
 </td></tr>
335 355
 <?php } ?>
@@ -358,19 +378,23 @@  discard block
 block discarded – undo
358 378
 			$public_display['display_nickname']  = $profileuser->nickname;
359 379
 			$public_display['display_username']  = $profileuser->user_login;
360 380
 
361
-			if ( !empty($profileuser->first_name) )
362
-				$public_display['display_firstname'] = $profileuser->first_name;
381
+			if ( !empty($profileuser->first_name) ) {
382
+							$public_display['display_firstname'] = $profileuser->first_name;
383
+			}
363 384
 
364
-			if ( !empty($profileuser->last_name) )
365
-				$public_display['display_lastname'] = $profileuser->last_name;
385
+			if ( !empty($profileuser->last_name) ) {
386
+							$public_display['display_lastname'] = $profileuser->last_name;
387
+			}
366 388
 
367 389
 			if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
368 390
 				$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
369 391
 				$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
370 392
 			}
371 393
 
372
-			if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
394
+			if ( !in_array( $profileuser->display_name, $public_display ) ) {
395
+				// Only add this if it isn't duplicated elsewhere
373 396
 				$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
397
+			}
374 398
 
375 399
 			$public_display = array_map( 'trim', $public_display );
376 400
 			$public_display = array_unique( $public_display );
@@ -623,8 +647,9 @@  discard block
 block discarded – undo
623 647
 	$output = '';
624 648
 	foreach ( $profileuser->caps as $cap => $value ) {
625 649
 		if ( ! $wp_roles->is_role( $cap ) ) {
626
-			if ( '' != $output )
627
-				$output .= ', ';
650
+			if ( '' != $output ) {
651
+							$output .= ', ';
652
+			}
628 653
 			$output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
629 654
 		}
630 655
 	}
Please login to merge, or discard this patch.
src/wp-admin/options-permalink.php 2 patches
Spacing   +91 added lines, -91 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 ( ! current_user_can( 'manage_options' ) )
13
-	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
12
+if ( ! current_user_can('manage_options'))
13
+	wp_die(__('You do not have sufficient permissions to manage options for this site.'));
14 14
 
15 15
 $title = __('Permalink Settings');
16 16
 $parent_file = 'options-general.php';
17 17
 
18
-get_current_screen()->add_help_tab( array(
18
+get_current_screen()->add_help_tab(array(
19 19
 	'id'      => 'overview',
20 20
 	'title'   => __('Overview'),
21
-	'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' .
22
-		'<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
23
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
24
-) );
21
+	'content' => '<p>'.__('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.').'</p>'.
22
+		'<p>'.__('This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.').'</p>'.
23
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
24
+));
25 25
 
26
-get_current_screen()->add_help_tab( array(
26
+get_current_screen()->add_help_tab(array(
27 27
 	'id'      => 'permalink-settings',
28 28
 	'title'   => __('Permalink Settings'),
29
-	'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
30
-		'<p>' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.' ) . '</p>' .
31
-		'<p>' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.') . '</p>' .
32
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
33
-) );
29
+	'content' => '<p>'.__('Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.').'</p>'.
30
+		'<p>'.__('If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.').'</p>'.
31
+		'<p>'.__('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.').'</p>'.
32
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
33
+));
34 34
 
35
-get_current_screen()->add_help_tab( array(
35
+get_current_screen()->add_help_tab(array(
36 36
 	'id'      => 'custom-structures',
37 37
 	'title'   => __('Custom Structures'),
38
-	'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' .
39
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
40
-) );
38
+	'content' => '<p>'.__('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.').'</p>'.
39
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
40
+));
41 41
 
42 42
 get_current_screen()->set_help_sidebar(
43
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
44
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>') . '</p>' .
45
-	'<p>' . __('<a href="https://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>') . '</p>' .
46
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
43
+	'<p><strong>'.__('For more information:').'</strong></p>'.
44
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen" target="_blank">Documentation on Permalinks Settings</a>').'</p>'.
45
+	'<p>'.__('<a href="https://codex.wordpress.org/Using_Permalinks" target="_blank">Documentation on Using Permalinks</a>').'</p>'.
46
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
47 47
 );
48 48
 
49 49
 add_filter('admin_head', 'options_permalink_add_js');
50 50
 
51 51
 $home_path = get_home_path();
52 52
 $iis7_permalinks = iis7_supports_permalinks();
53
-$permalink_structure = get_option( 'permalink_structure' );
53
+$permalink_structure = get_option('permalink_structure');
54 54
 
55 55
 $prefix = $blog_prefix = '';
56
-if ( ! got_url_rewrite() )
56
+if ( ! got_url_rewrite())
57 57
 	$prefix = '/index.php';
58 58
 
59 59
 /**
@@ -62,93 +62,93 @@  discard block
 block discarded – undo
62 62
  * network. If the `permalink_structure` option has been changed to remove this
63 63
  * base prefix, WordPress core can no longer account for the possible collision.
64 64
  */
65
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
65
+if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
66 66
 	$blog_prefix = '/blog';
67 67
 }
68 68
 
69
-if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
69
+if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
70 70
 	check_admin_referer('update-permalink');
71 71
 
72
-	if ( isset( $_POST['permalink_structure'] ) ) {
73
-		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
72
+	if (isset($_POST['permalink_structure'])) {
73
+		if (isset($_POST['selection']) && 'custom' != $_POST['selection'])
74 74
 			$permalink_structure = $_POST['selection'];
75 75
 		else
76 76
 			$permalink_structure = $_POST['permalink_structure'];
77 77
 
78
-		if ( ! empty( $permalink_structure ) ) {
79
-			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
80
-			if ( $prefix && $blog_prefix )
81
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
78
+		if ( ! empty($permalink_structure)) {
79
+			$permalink_structure = preg_replace('#/+#', '/', '/'.str_replace('#', '', $permalink_structure));
80
+			if ($prefix && $blog_prefix)
81
+				$permalink_structure = $prefix.preg_replace('#^/?index\.php#', '', $permalink_structure);
82 82
 			else
83
-				$permalink_structure = $blog_prefix . $permalink_structure;
83
+				$permalink_structure = $blog_prefix.$permalink_structure;
84 84
 		}
85
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
85
+		$wp_rewrite->set_permalink_structure($permalink_structure);
86 86
 	}
87 87
 
88
-	if ( isset( $_POST['category_base'] ) ) {
88
+	if (isset($_POST['category_base'])) {
89 89
 		$category_base = $_POST['category_base'];
90
-		if ( ! empty( $category_base ) )
91
-			$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
92
-		$wp_rewrite->set_category_base( $category_base );
90
+		if ( ! empty($category_base))
91
+			$category_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $category_base));
92
+		$wp_rewrite->set_category_base($category_base);
93 93
 	}
94 94
 
95
-	if ( isset( $_POST['tag_base'] ) ) {
95
+	if (isset($_POST['tag_base'])) {
96 96
 		$tag_base = $_POST['tag_base'];
97
-		if ( ! empty( $tag_base ) )
98
-			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
99
-		$wp_rewrite->set_tag_base( $tag_base );
97
+		if ( ! empty($tag_base))
98
+			$tag_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $tag_base));
99
+		$wp_rewrite->set_tag_base($tag_base);
100 100
 	}
101 101
 
102
-	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
102
+	wp_redirect(admin_url('options-permalink.php?settings-updated=true'));
103 103
 	exit;
104 104
 }
105 105
 
106
-$category_base       = get_option( 'category_base' );
107
-$tag_base            = get_option( 'tag_base' );
106
+$category_base       = get_option('category_base');
107
+$tag_base            = get_option('tag_base');
108 108
 $update_required     = false;
109 109
 
110
-if ( $iis7_permalinks ) {
111
-	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
110
+if ($iis7_permalinks) {
111
+	if (( ! file_exists($home_path.'web.config') && win_is_writable($home_path)) || win_is_writable($home_path.'web.config'))
112 112
 		$writable = true;
113 113
 	else
114 114
 		$writable = false;
115
-} elseif ( $is_nginx ) {
115
+} elseif ($is_nginx) {
116 116
 	$writable = false;
117 117
 } else {
118
-	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
118
+	if (( ! file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')) {
119 119
 		$writable = true;
120 120
 	} else {
121 121
 		$writable = false;
122
-		$existing_rules  = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
123
-		$new_rules       = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
124
-		$update_required = ( $new_rules !== $existing_rules );
122
+		$existing_rules  = array_filter(extract_from_markers($home_path.'.htaccess', 'WordPress'));
123
+		$new_rules       = array_filter(explode("\n", $wp_rewrite->mod_rewrite_rules()));
124
+		$update_required = ($new_rules !== $existing_rules);
125 125
 	}
126 126
 }
127 127
 
128
-if ( $wp_rewrite->using_index_permalinks() )
128
+if ($wp_rewrite->using_index_permalinks())
129 129
 	$usingpi = true;
130 130
 else
131 131
 	$usingpi = false;
132 132
 
133 133
 flush_rewrite_rules();
134 134
 
135
-require( ABSPATH . 'wp-admin/admin-header.php' );
135
+require(ABSPATH.'wp-admin/admin-header.php');
136 136
 
137
-if ( ! empty( $_GET['settings-updated'] ) ) : ?>
137
+if ( ! empty($_GET['settings-updated'])) : ?>
138 138
 <div id="message" class="updated notice is-dismissible"><p><?php
139
-if ( ! is_multisite() ) {
140
-	if ( $iis7_permalinks ) {
141
-		if ( $permalink_structure && ! $usingpi && ! $writable ) {
139
+if ( ! is_multisite()) {
140
+	if ($iis7_permalinks) {
141
+		if ($permalink_structure && ! $usingpi && ! $writable) {
142 142
 			_e('You should update your web.config now.');
143
-		} elseif ( $permalink_structure && ! $usingpi && $writable ) {
143
+		} elseif ($permalink_structure && ! $usingpi && $writable) {
144 144
 			_e('Permalink structure updated. Remove write access on web.config file now!');
145 145
 		} else {
146 146
 			_e('Permalink structure updated.');
147 147
 		}
148
-	} elseif ( $is_nginx ) {
148
+	} elseif ($is_nginx) {
149 149
 		_e('Permalink structure updated.');
150 150
 	} else {
151
-		if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) {
151
+		if ($permalink_structure && ! $usingpi && ! $writable && $update_required) {
152 152
 			_e('You should update your .htaccess now.');
153 153
 		} else {
154 154
 			_e('Permalink structure updated.');
@@ -162,58 +162,58 @@  discard block
 block discarded – undo
162 162
 <?php endif; ?>
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
 <form name="form" action="options-permalink.php" method="post">
168 168
 <?php wp_nonce_field('update-permalink') ?>
169 169
 
170
-  <p><?php _e( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.' ); ?></p>
170
+  <p><?php _e('WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
171 171
 
172 172
 <?php
173
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
174
-	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
175
-	$category_base = preg_replace( '|^/?blog|', '', $category_base );
176
-	$tag_base = preg_replace( '|^/?blog|', '', $tag_base );
173
+if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
174
+	$permalink_structure = preg_replace('|^/?blog|', '', $permalink_structure);
175
+	$category_base = preg_replace('|^/?blog|', '', $category_base);
176
+	$tag_base = preg_replace('|^/?blog|', '', $tag_base);
177 177
 }
178 178
 
179 179
 $structures = array(
180 180
 	0 => '',
181
-	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
182
-	2 => $prefix . '/%year%/%monthnum%/%postname%/',
183
-	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
184
-	4 => $prefix . '/%postname%/',
181
+	1 => $prefix.'/%year%/%monthnum%/%day%/%postname%/',
182
+	2 => $prefix.'/%year%/%monthnum%/%postname%/',
183
+	3 => $prefix.'/'._x('archives', 'sample permalink base').'/%post_id%',
184
+	4 => $prefix.'/%postname%/',
185 185
 );
186 186
 ?>
187 187
 <h2 class="title"><?php _e('Common Settings'); ?></h2>
188 188
 <table class="form-table permalink-structure">
189 189
 	<tr>
190
-		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e( 'Plain' ); ?></label></th>
190
+		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Plain'); ?></label></th>
191 191
 		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
192 192
 	</tr>
193 193
 	<tr>
194 194
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
195
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
195
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'.date('d').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
196 196
 	</tr>
197 197
 	<tr>
198 198
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
199
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
199
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
200 200
 	</tr>
201 201
 	<tr>
202 202
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
203
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
203
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('archives', 'sample permalink base').'/123'; ?></code></td>
204 204
 	</tr>
205 205
 	<tr>
206 206
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th>
207
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
207
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
208 208
 	</tr>
209 209
 	<tr>
210 210
 		<th>
211
-			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
211
+			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array($permalink_structure, $structures)); ?> />
212 212
 			<?php _e('Custom Structure'); ?>
213 213
 			</label>
214 214
 		</th>
215 215
 		<td>
216
-			<code><?php echo get_option('home') . $blog_prefix; ?></code>
216
+			<code><?php echo get_option('home').$blog_prefix; ?></code>
217 217
 			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
218 218
 		</td>
219 219
 	</tr>
@@ -222,12 +222,12 @@  discard block
 block discarded – undo
222 222
 <h2 class="title"><?php _e('Optional'); ?></h2>
223 223
 <p><?php
224 224
 /* translators: %s is a placeholder that must come at the start of the URL. */
225
-printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); ?></p>
225
+printf(__('If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.'), get_option('home').$blog_prefix.$prefix); ?></p>
226 226
 
227 227
 <table class="form-table">
228 228
 	<tr>
229 229
 		<th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th>
230
-		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
230
+		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
231 231
 	</tr>
232 232
 	<tr>
233 233
 		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
@@ -240,33 +240,33 @@  discard block
 block discarded – undo
240 240
 
241 241
 <?php submit_button(); ?>
242 242
   </form>
243
-<?php if ( !is_multisite() ) { ?>
244
-<?php if ( $iis7_permalinks ) :
245
-	if ( isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable ) :
246
-		if ( file_exists($home_path . 'web.config') ) : ?>
243
+<?php if ( ! is_multisite()) { ?>
244
+<?php if ($iis7_permalinks) :
245
+	if (isset($_POST['submit']) && $permalink_structure && ! $usingpi && ! $writable) :
246
+		if (file_exists($home_path.'web.config')) : ?>
247 247
 <p><?php _e('If your <code>web.config</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p>
248 248
 <form action="options-permalink.php" method="post">
249 249
 <?php wp_nonce_field('update-permalink') ?>
250
-	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
250
+	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules()); ?></textarea></p>
251 251
 </form>
252 252
 <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p>
253 253
 		<?php else : ?>
254 254
 <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p>
255 255
 <form action="options-permalink.php" method="post">
256 256
 <?php wp_nonce_field('update-permalink') ?>
257
-	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p>
257
+	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules(true)); ?></textarea></p>
258 258
 </form>
259 259
 <p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p>
260 260
 		<?php endif; ?>
261 261
 	<?php endif; ?>
262
-<?php elseif ( $is_nginx ) : ?>
263
-	<p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p>
262
+<?php elseif ($is_nginx) : ?>
263
+	<p><?php _e('<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.'); ?></p>
264 264
 <?php else:
265
-	if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) : ?>
265
+	if ($permalink_structure && ! $usingpi && ! $writable && $update_required) : ?>
266 266
 <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
267 267
 <form action="options-permalink.php" method="post">
268 268
 <?php wp_nonce_field('update-permalink') ?>
269
-	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
269
+	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
270 270
 </form>
271 271
 	<?php endif; ?>
272 272
 <?php endif; ?>
@@ -274,4 +274,4 @@  discard block
 block discarded – undo
274 274
 
275 275
 </div>
276 276
 
277
-<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
277
+<?php require(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +39 added lines, -25 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 ( ! current_user_can( 'manage_options' ) )
12
+if ( ! current_user_can( 'manage_options' ) ) {
13 13
 	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
14
+}
14 15
 
15 16
 $title = __('Permalink Settings');
16 17
 $parent_file = 'options-general.php';
@@ -53,8 +54,9 @@  discard block
 block discarded – undo
53 54
 $permalink_structure = get_option( 'permalink_structure' );
54 55
 
55 56
 $prefix = $blog_prefix = '';
56
-if ( ! got_url_rewrite() )
57
+if ( ! got_url_rewrite() ) {
57 58
 	$prefix = '/index.php';
59
+}
58 60
 
59 61
 /**
60 62
  * In a subdirectory configuration of multisite, the `/blog` prefix is used by
@@ -70,32 +72,36 @@  discard block
 block discarded – undo
70 72
 	check_admin_referer('update-permalink');
71 73
 
72 74
 	if ( isset( $_POST['permalink_structure'] ) ) {
73
-		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
74
-			$permalink_structure = $_POST['selection'];
75
-		else
76
-			$permalink_structure = $_POST['permalink_structure'];
75
+		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) {
76
+					$permalink_structure = $_POST['selection'];
77
+		} else {
78
+					$permalink_structure = $_POST['permalink_structure'];
79
+		}
77 80
 
78 81
 		if ( ! empty( $permalink_structure ) ) {
79 82
 			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
80
-			if ( $prefix && $blog_prefix )
81
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
82
-			else
83
-				$permalink_structure = $blog_prefix . $permalink_structure;
83
+			if ( $prefix && $blog_prefix ) {
84
+							$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
85
+			} else {
86
+							$permalink_structure = $blog_prefix . $permalink_structure;
87
+			}
84 88
 		}
85 89
 		$wp_rewrite->set_permalink_structure( $permalink_structure );
86 90
 	}
87 91
 
88 92
 	if ( isset( $_POST['category_base'] ) ) {
89 93
 		$category_base = $_POST['category_base'];
90
-		if ( ! empty( $category_base ) )
91
-			$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
94
+		if ( ! empty( $category_base ) ) {
95
+					$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
96
+		}
92 97
 		$wp_rewrite->set_category_base( $category_base );
93 98
 	}
94 99
 
95 100
 	if ( isset( $_POST['tag_base'] ) ) {
96 101
 		$tag_base = $_POST['tag_base'];
97
-		if ( ! empty( $tag_base ) )
98
-			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
102
+		if ( ! empty( $tag_base ) ) {
103
+					$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
104
+		}
99 105
 		$wp_rewrite->set_tag_base( $tag_base );
100 106
 	}
101 107
 
@@ -108,11 +114,12 @@  discard block
 block discarded – undo
108 114
 $update_required     = false;
109 115
 
110 116
 if ( $iis7_permalinks ) {
111
-	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
112
-		$writable = true;
113
-	else
114
-		$writable = false;
115
-} elseif ( $is_nginx ) {
117
+	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) {
118
+			$writable = true;
119
+	} else {
120
+			$writable = false;
121
+	}
122
+	} elseif ( $is_nginx ) {
116 123
 	$writable = false;
117 124
 } else {
118 125
 	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
@@ -125,10 +132,11 @@  discard block
 block discarded – undo
125 132
 	}
126 133
 }
127 134
 
128
-if ( $wp_rewrite->using_index_permalinks() )
135
+if ( $wp_rewrite->using_index_permalinks() ) {
129 136
 	$usingpi = true;
130
-else
137
+} else {
131 138
 	$usingpi = false;
139
+}
132 140
 
133 141
 flush_rewrite_rules();
134 142
 
@@ -250,23 +258,29 @@  discard block
 block discarded – undo
250 258
 	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
251 259
 </form>
252 260
 <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p>
253
-		<?php else : ?>
261
+		<?php else {
262
+	: ?>
254 263
 <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p>
255 264
 <form action="options-permalink.php" method="post">
256 265
 <?php wp_nonce_field('update-permalink') ?>
257
-	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p>
266
+	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) );
267
+}
268
+?></textarea></p>
258 269
 </form>
259 270
 <p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p>
260 271
 		<?php endif; ?>
261 272
 	<?php endif; ?>
262 273
 <?php elseif ( $is_nginx ) : ?>
263 274
 	<p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p>
264
-<?php else:
275
+<?php else {
276
+	:
265 277
 	if ( $permalink_structure && ! $usingpi && ! $writable && $update_required ) : ?>
266 278
 <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
267 279
 <form action="options-permalink.php" method="post">
268 280
 <?php wp_nonce_field('update-permalink') ?>
269
-	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
281
+	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() );
282
+}
283
+?></textarea></p>
270 284
 </form>
271 285
 	<?php endif; ?>
272 286
 <?php endif; ?>
Please login to merge, or discard this patch.