Completed
Push — master ( fdb3a7...cde0c6 )
by Stephen
20:18
created
src/wp-admin/widgets.php 1 patch
Spacing   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -7,32 +7,32 @@  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 12
 /** WordPress Administration Widgets API */
13
-require_once(ABSPATH . 'wp-admin/includes/widgets.php');
13
+require_once(ABSPATH.'wp-admin/includes/widgets.php');
14 14
 
15
-if ( ! current_user_can( 'edit_theme_options' ) ) {
15
+if ( ! current_user_can('edit_theme_options')) {
16 16
 	wp_die(
17
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
18
-		'<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
17
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
18
+		'<p>'.__('Sorry, you are not allowed to edit theme options on this site.').'</p>',
19 19
 		403
20 20
 	);
21 21
 }
22 22
 
23
-$widgets_access = get_user_setting( 'widgets_access' );
24
-if ( isset($_GET['widgets-access']) ) {
23
+$widgets_access = get_user_setting('widgets_access');
24
+if (isset($_GET['widgets-access'])) {
25 25
 	$widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off';
26
-	set_user_setting( 'widgets_access', $widgets_access );
26
+	set_user_setting('widgets_access', $widgets_access);
27 27
 }
28 28
 
29
-if ( 'on' == $widgets_access ) {
30
-	add_filter( 'admin_body_class', 'wp_widgets_access_body_class' );
29
+if ('on' == $widgets_access) {
30
+	add_filter('admin_body_class', 'wp_widgets_access_body_class');
31 31
 } else {
32 32
 	wp_enqueue_script('admin-widgets');
33 33
 
34
-	if ( wp_is_mobile() )
35
-		wp_enqueue_script( 'jquery-touch-punch' );
34
+	if (wp_is_mobile())
35
+		wp_enqueue_script('jquery-touch-punch');
36 36
 }
37 37
 
38 38
 /**
@@ -41,68 +41,68 @@  discard block
 block discarded – undo
41 41
  *
42 42
  * @since 2.2.0
43 43
  */
44
-do_action( 'sidebar_admin_setup' );
44
+do_action('sidebar_admin_setup');
45 45
 
46
-$title = __( 'Widgets' );
46
+$title = __('Widgets');
47 47
 $parent_file = 'themes.php';
48 48
 
49
-get_current_screen()->add_help_tab( array(
49
+get_current_screen()->add_help_tab(array(
50 50
 'id'		=> 'overview',
51 51
 'title'		=> __('Overview'),
52 52
 'content'	=>
53
-	'<p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p>
54
-	<p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>'
55
-) );
56
-get_current_screen()->add_help_tab( array(
53
+	'<p>'.__('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.').'</p>
54
+	<p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.').'</p>'
55
+));
56
+get_current_screen()->add_help_tab(array(
57 57
 'id'		=> 'removing-reusing',
58 58
 'title'		=> __('Removing and Reusing'),
59 59
 'content'	=>
60
-	'<p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p>
61
-	<p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.') . '</p>
62
-	<p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>'
63
-) );
64
-get_current_screen()->add_help_tab( array(
60
+	'<p>'.__('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.').'</p>
61
+	<p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it&#8217;s not required.').'</p>
62
+	<p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.').'</p>'
63
+));
64
+get_current_screen()->add_help_tab(array(
65 65
 'id'		=> 'missing-widgets',
66 66
 'title'		=> __('Missing Widgets'),
67 67
 'content'	=>
68
-	'<p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>' .
69
-		'<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.') . '</p>'
70
-) );
68
+	'<p>'.__('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.').'</p>'.
69
+		'<p>'.__('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.').'</p>'
70
+));
71 71
 
72 72
 get_current_screen()->set_help_sidebar(
73
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
74
-	'<p>' . __('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>' .
75
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
73
+	'<p><strong>'.__('For more information:').'</strong></p>'.
74
+	'<p>'.__('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>').'</p>'.
75
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
76 76
 );
77 77
 
78
-if ( ! current_theme_supports( 'widgets' ) ) {
79
-	wp_die( __( 'The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) );
78
+if ( ! current_theme_supports('widgets')) {
79
+	wp_die(__('The theme you are currently using isn&#8217;t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.'));
80 80
 }
81 81
 
82 82
 // These are the widgets grouped by sidebar
83 83
 $sidebars_widgets = wp_get_sidebars_widgets();
84 84
 
85
-if ( empty( $sidebars_widgets ) )
85
+if (empty($sidebars_widgets))
86 86
 	$sidebars_widgets = wp_get_widget_defaults();
87 87
 
88
-foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
89
-	if ( 'wp_inactive_widgets' == $sidebar_id )
88
+foreach ($sidebars_widgets as $sidebar_id => $widgets) {
89
+	if ('wp_inactive_widgets' == $sidebar_id)
90 90
 		continue;
91 91
 
92
-	if ( ! is_registered_sidebar( $sidebar_id ) ) {
93
-		if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar
92
+	if ( ! is_registered_sidebar($sidebar_id)) {
93
+		if ( ! empty($widgets)) { // register the inactive_widgets area as sidebar
94 94
 			register_sidebar(array(
95
-				'name' => __( 'Inactive Sidebar (not used)' ),
95
+				'name' => __('Inactive Sidebar (not used)'),
96 96
 				'id' => $sidebar_id,
97 97
 				'class' => 'inactive-sidebar orphan-sidebar',
98
-				'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ),
98
+				'description' => __('This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.'),
99 99
 				'before_widget' => '',
100 100
 				'after_widget' => '',
101 101
 				'before_title' => '',
102 102
 				'after_title' => '',
103 103
 			));
104 104
 		} else {
105
-			unset( $sidebars_widgets[ $sidebar_id ] );
105
+			unset($sidebars_widgets[$sidebar_id]);
106 106
 		}
107 107
 	}
108 108
 }
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
 	'name' => __('Inactive Widgets'),
113 113
 	'id' => 'wp_inactive_widgets',
114 114
 	'class' => 'inactive-sidebar',
115
-	'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ),
115
+	'description' => __('Drag widgets here to remove them from the sidebar but keep their settings.'),
116 116
 	'before_widget' => '',
117 117
 	'after_widget' => '',
118 118
 	'before_title' => '',
@@ -122,36 +122,36 @@  discard block
 block discarded – undo
122 122
 retrieve_widgets();
123 123
 
124 124
 // We're saving a widget without js
125
-if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) {
125
+if (isset($_POST['savewidget']) || isset($_POST['removewidget'])) {
126 126
 	$widget_id = $_POST['widget-id'];
127 127
 	check_admin_referer("save-delete-widget-$widget_id");
128 128
 
129 129
 	$number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : '';
130
-	if ( $number ) {
131
-		foreach ( $_POST as $key => $val ) {
132
-			if ( is_array($val) && preg_match('/__i__|%i%/', key($val)) ) {
133
-				$_POST[$key] = array( $number => array_shift($val) );
130
+	if ($number) {
131
+		foreach ($_POST as $key => $val) {
132
+			if (is_array($val) && preg_match('/__i__|%i%/', key($val))) {
133
+				$_POST[$key] = array($number => array_shift($val));
134 134
 				break;
135 135
 			}
136 136
 		}
137 137
 	}
138 138
 
139 139
 	$sidebar_id = $_POST['sidebar'];
140
-	$position = isset($_POST[$sidebar_id . '_position']) ? (int) $_POST[$sidebar_id . '_position'] - 1 : 0;
140
+	$position = isset($_POST[$sidebar_id.'_position']) ? (int) $_POST[$sidebar_id.'_position'] - 1 : 0;
141 141
 
142 142
 	$id_base = $_POST['id_base'];
143 143
 	$sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array();
144 144
 
145 145
 	// Delete.
146
-	if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) {
146
+	if (isset($_POST['removewidget']) && $_POST['removewidget']) {
147 147
 
148
-		if ( !in_array($widget_id, $sidebar, true) ) {
149
-			wp_redirect( admin_url('widgets.php?error=0') );
148
+		if ( ! in_array($widget_id, $sidebar, true)) {
149
+			wp_redirect(admin_url('widgets.php?error=0'));
150 150
 			exit;
151 151
 		}
152 152
 
153
-		$sidebar = array_diff( $sidebar, array($widget_id) );
154
-		$_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
153
+		$sidebar = array_diff($sidebar, array($widget_id));
154
+		$_POST = array('sidebar' => $sidebar_id, 'widget-'.$id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1');
155 155
 
156 156
 		/**
157 157
 		 * Fires immediately after a widget has been marked for deletion.
@@ -162,17 +162,17 @@  discard block
 block discarded – undo
162 162
 		 * @param string $sidebar_id ID of the sidebar the widget was deleted from.
163 163
 		 * @param string $id_base    ID base for the widget.
164 164
 		 */
165
-		do_action( 'delete_widget', $widget_id, $sidebar_id, $id_base );
165
+		do_action('delete_widget', $widget_id, $sidebar_id, $id_base);
166 166
 	}
167 167
 
168 168
 	$_POST['widget-id'] = $sidebar;
169 169
 
170
-	foreach ( (array) $wp_registered_widget_updates as $name => $control ) {
171
-		if ( $name != $id_base || !is_callable($control['callback']) )
170
+	foreach ((array) $wp_registered_widget_updates as $name => $control) {
171
+		if ($name != $id_base || ! is_callable($control['callback']))
172 172
 			continue;
173 173
 
174 174
 		ob_start();
175
-			call_user_func_array( $control['callback'], $control['params'] );
175
+			call_user_func_array($control['callback'], $control['params']);
176 176
 		ob_end_clean();
177 177
 
178 178
 		break;
@@ -181,58 +181,58 @@  discard block
 block discarded – undo
181 181
 	$sidebars_widgets[$sidebar_id] = $sidebar;
182 182
 
183 183
 	// Remove old position.
184
-	if ( !isset($_POST['delete_widget']) ) {
185
-		foreach ( $sidebars_widgets as $key => $sb ) {
186
-			if ( is_array($sb) )
187
-				$sidebars_widgets[$key] = array_diff( $sb, array($widget_id) );
184
+	if ( ! isset($_POST['delete_widget'])) {
185
+		foreach ($sidebars_widgets as $key => $sb) {
186
+			if (is_array($sb))
187
+				$sidebars_widgets[$key] = array_diff($sb, array($widget_id));
188 188
 		}
189
-		array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id );
189
+		array_splice($sidebars_widgets[$sidebar_id], $position, 0, $widget_id);
190 190
 	}
191 191
 
192 192
 	wp_set_sidebars_widgets($sidebars_widgets);
193
-	wp_redirect( admin_url('widgets.php?message=0') );
193
+	wp_redirect(admin_url('widgets.php?message=0'));
194 194
 	exit;
195 195
 }
196 196
 
197 197
 // Remove inactive widgets without js
198
-if ( isset( $_POST['removeinactivewidgets'] ) ) {
199
-	check_admin_referer( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' );
200
-
201
-	if ( $_POST['removeinactivewidgets'] ) {
202
-		foreach ( $sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id ) {
203
-			$pieces = explode( '-', $widget_id );
204
-			$multi_number = array_pop( $pieces );
205
-			$id_base = implode( '-', $pieces );
206
-			$widget = get_option( 'widget_' . $id_base );
207
-			unset( $widget[$multi_number] );
208
-			update_option( 'widget_' . $id_base, $widget );
209
-			unset( $sidebars_widgets['wp_inactive_widgets'][$key] );
198
+if (isset($_POST['removeinactivewidgets'])) {
199
+	check_admin_referer('remove-inactive-widgets', '_wpnonce_remove_inactive_widgets');
200
+
201
+	if ($_POST['removeinactivewidgets']) {
202
+		foreach ($sidebars_widgets['wp_inactive_widgets'] as $key => $widget_id) {
203
+			$pieces = explode('-', $widget_id);
204
+			$multi_number = array_pop($pieces);
205
+			$id_base = implode('-', $pieces);
206
+			$widget = get_option('widget_'.$id_base);
207
+			unset($widget[$multi_number]);
208
+			update_option('widget_'.$id_base, $widget);
209
+			unset($sidebars_widgets['wp_inactive_widgets'][$key]);
210 210
 		}
211 211
 
212
-		wp_set_sidebars_widgets( $sidebars_widgets );
212
+		wp_set_sidebars_widgets($sidebars_widgets);
213 213
 	}
214 214
 
215
-	wp_redirect( admin_url( 'widgets.php?message=0' ) );
215
+	wp_redirect(admin_url('widgets.php?message=0'));
216 216
 	exit;
217 217
 }
218 218
 
219 219
 // Output the widget form without js
220
-if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) {
220
+if (isset($_GET['editwidget']) && $_GET['editwidget']) {
221 221
 	$widget_id = $_GET['editwidget'];
222 222
 
223
-	if ( isset($_GET['addnew']) ) {
223
+	if (isset($_GET['addnew'])) {
224 224
 		// Default to the first sidebar
225
-		$keys = array_keys( $wp_registered_sidebars );
226
-		$sidebar = reset( $keys );
225
+		$keys = array_keys($wp_registered_sidebars);
226
+		$sidebar = reset($keys);
227 227
 
228
-		if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget
228
+		if (isset($_GET['base']) && isset($_GET['num'])) { // multi-widget
229 229
 			// Copy minimal info from an existing instance of this widget to a new instance
230
-			foreach ( $wp_registered_widget_controls as $control ) {
231
-				if ( $_GET['base'] === $control['id_base'] ) {
230
+			foreach ($wp_registered_widget_controls as $control) {
231
+				if ($_GET['base'] === $control['id_base']) {
232 232
 					$control_callback = $control['callback'];
233 233
 					$multi_number = (int) $_GET['num'];
234 234
 					$control['params'][0]['number'] = -1;
235
-					$widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number;
235
+					$widget_id = $control['id'] = $control['id_base'].'-'.$multi_number;
236 236
 					$wp_registered_widget_controls[$control['id']] = $control;
237 237
 					break;
238 238
 				}
@@ -240,66 +240,66 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 	}
242 242
 
243
-	if ( isset($wp_registered_widget_controls[$widget_id]) && !isset($control) ) {
243
+	if (isset($wp_registered_widget_controls[$widget_id]) && ! isset($control)) {
244 244
 		$control = $wp_registered_widget_controls[$widget_id];
245 245
 		$control_callback = $control['callback'];
246
-	} elseif ( !isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id]) ) {
247
-		$name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) );
246
+	} elseif ( ! isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id])) {
247
+		$name = esc_html(strip_tags($wp_registered_widgets[$widget_id]['name']));
248 248
 	}
249 249
 
250
-	if ( !isset($name) )
251
-		$name = esc_html( strip_tags($control['name']) );
250
+	if ( ! isset($name))
251
+		$name = esc_html(strip_tags($control['name']));
252 252
 
253
-	if ( !isset($sidebar) )
253
+	if ( ! isset($sidebar))
254 254
 		$sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets';
255 255
 
256
-	if ( !isset($multi_number) )
256
+	if ( ! isset($multi_number))
257 257
 		$multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : '';
258 258
 
259 259
 	$id_base = isset($control['id_base']) ? $control['id_base'] : $control['id'];
260 260
 
261 261
 	// Show the widget form.
262
-	$width = ' style="width:' . max($control['width'], 350) . 'px"';
262
+	$width = ' style="width:'.max($control['width'], 350).'px"';
263 263
 	$key = isset($_GET['key']) ? (int) $_GET['key'] : 0;
264 264
 
265
-	require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
265
+	require_once(ABSPATH.'wp-admin/admin-header.php'); ?>
266 266
 	<div class="wrap">
267
-	<h1><?php echo esc_html( $title ); ?></h1>
267
+	<h1><?php echo esc_html($title); ?></h1>
268 268
 	<div class="editwidget"<?php echo $width; ?>>
269
-	<h2><?php printf( __( 'Widget %s' ), $name ); ?></h2>
269
+	<h2><?php printf(__('Widget %s'), $name); ?></h2>
270 270
 
271 271
 	<form action="widgets.php" method="post">
272 272
 	<div class="widget-inside">
273 273
 <?php
274
-	if ( is_callable( $control_callback ) )
275
-		call_user_func_array( $control_callback, $control['params'] );
274
+	if (is_callable($control_callback))
275
+		call_user_func_array($control_callback, $control['params']);
276 276
 	else
277
-		echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?>
277
+		echo '<p>'.__('There are no options for this widget.')."</p>\n"; ?>
278 278
 	</div>
279 279
 
280 280
 	<p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p>
281 281
 	<div class="widget-position">
282 282
 	<table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody>
283 283
 <?php
284
-	foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) {
285
-		echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>";
286
-		if ( 'wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr( $sbname, 0, 16 ) ) {
284
+	foreach ($wp_registered_sidebars as $sbname => $sbvalue) {
285
+		echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='".esc_attr($sbname)."'".checked($sbname, $sidebar, false)." /> $sbvalue[name]</label></td><td>";
286
+		if ('wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr($sbname, 0, 16)) {
287 287
 			echo '&nbsp;';
288 288
 		} else {
289
-			if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) {
289
+			if ( ! isset($sidebars_widgets[$sbname]) || ! is_array($sidebars_widgets[$sbname])) {
290 290
 				$j = 1;
291 291
 				$sidebars_widgets[$sbname] = array();
292 292
 			} else {
293 293
 				$j = count($sidebars_widgets[$sbname]);
294
-				if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) )
294
+				if (isset($_GET['addnew']) || ! in_array($widget_id, $sidebars_widgets[$sbname], true))
295 295
 					$j++;
296 296
 			}
297 297
 			$selected = '';
298 298
 			echo "\t\t<select name='{$sbname}_position'>\n";
299
-			echo "\t\t<option value=''>" . __('&mdash; Select &mdash;') . "</option>\n";
300
-			for ( $i = 1; $i <= $j; $i++ ) {
301
-				if ( in_array($widget_id, $sidebars_widgets[$sbname], true) )
302
-					$selected = selected( $i, $key + 1, false );
299
+			echo "\t\t<option value=''>".__('&mdash; Select &mdash;')."</option>\n";
300
+			for ($i = 1; $i <= $j; $i++) {
301
+				if (in_array($widget_id, $sidebars_widgets[$sbname], true))
302
+					$selected = selected($i, $key + 1, false);
303 303
 				echo "\t\t<option value='$i'$selected> $i </option>\n";
304 304
 			}
305 305
 			echo "\t\t</select>\n";
@@ -311,13 +311,13 @@  discard block
 block discarded – undo
311 311
 
312 312
 	<div class="widget-control-actions">
313 313
 <?php
314
-	if ( isset($_GET['addnew']) ) { ?>
314
+	if (isset($_GET['addnew'])) { ?>
315 315
 	<a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a>
316 316
 <?php
317 317
 	} else {
318
-		submit_button( __( 'Delete' ), 'button alignleft', 'removewidget', false );
318
+		submit_button(__('Delete'), 'button alignleft', 'removewidget', false);
319 319
 	}
320
-	submit_button( __( 'Save Widget' ), 'button-primary alignright', 'savewidget', false ); ?>
320
+	submit_button(__('Save Widget'), 'button-primary alignright', 'savewidget', false); ?>
321 321
 	<input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" />
322 322
 	<input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" />
323 323
 	<input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" />
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	</div>
329 329
 	</div>
330 330
 <?php
331
-	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
331
+	require_once(ABSPATH.'wp-admin/admin-footer.php');
332 332
 	exit;
333 333
 }
334 334
 
@@ -341,32 +341,32 @@  discard block
 block discarded – undo
341 341
 	__('Error in displaying the widget settings form.')
342 342
 );
343 343
 
344
-require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
344
+require_once(ABSPATH.'wp-admin/admin-header.php'); ?>
345 345
 
346 346
 <div class="wrap">
347 347
 <h1>
348 348
 <?php
349
-	echo esc_html( $title );
350
-	if ( current_user_can( 'customize' ) ) {
349
+	echo esc_html($title);
350
+	if (current_user_can('customize')) {
351 351
 		printf(
352 352
 			' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
353
-			esc_url( add_query_arg(
353
+			esc_url(add_query_arg(
354 354
 				array(
355
-					array( 'autofocus' => array( 'panel' => 'widgets' ) ),
356
-					'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) )
355
+					array('autofocus' => array('panel' => 'widgets')),
356
+					'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI']))
357 357
 				),
358
-				admin_url( 'customize.php' )
359
-			) ),
360
-			__( 'Manage with Live Preview' )
358
+				admin_url('customize.php')
359
+			)),
360
+			__('Manage with Live Preview')
361 361
 		);
362 362
 	}
363 363
 ?>
364 364
 </h1>
365 365
 
366
-<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?>
366
+<?php if (isset($_GET['message']) && isset($messages[$_GET['message']])) { ?>
367 367
 <div id="message" class="updated notice is-dismissible"><p><?php echo $messages[$_GET['message']]; ?></p></div>
368 368
 <?php } ?>
369
-<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?>
369
+<?php if (isset($_GET['error']) && isset($errors[$_GET['error']])) { ?>
370 370
 <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div>
371 371
 <?php } ?>
372 372
 
@@ -376,14 +376,14 @@  discard block
 block discarded – undo
376 376
  *
377 377
  * @since 3.0.0
378 378
  */
379
-do_action( 'widgets_admin_page' ); ?>
379
+do_action('widgets_admin_page'); ?>
380 380
 
381 381
 <div class="widget-liquid-left">
382 382
 <div id="widgets-left">
383 383
 	<div id="available-widgets" class="widgets-holder-wrap">
384 384
 		<div class="sidebar-name">
385 385
 			<div class="sidebar-name-arrow"><br /></div>
386
-			<h2><?php _e( 'Available Widgets' ); ?> <span id="removing-widget"><?php _ex( 'Deactivate', 'removing-widget' ); ?> <span></span></span></h2>
386
+			<h2><?php _e('Available Widgets'); ?> <span id="removing-widget"><?php _ex('Deactivate', 'removing-widget'); ?> <span></span></span></h2>
387 387
 		</div>
388 388
 		<div class="widget-holder">
389 389
 			<div class="sidebar-description">
@@ -400,40 +400,40 @@  discard block
 block discarded – undo
400 400
 <?php
401 401
 
402 402
 $theme_sidebars = array();
403
-foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) {
404
-	if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) {
403
+foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) {
404
+	if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) {
405 405
 		$wrap_class = 'widgets-holder-wrap';
406
-		if ( !empty( $registered_sidebar['class'] ) )
407
-			$wrap_class .= ' ' . $registered_sidebar['class'];
406
+		if ( ! empty($registered_sidebar['class']))
407
+			$wrap_class .= ' '.$registered_sidebar['class'];
408 408
 
409 409
 		$is_inactive_widgets = 'wp_inactive_widgets' == $registered_sidebar['id'];
410 410
 		?>
411
-		<div class="<?php echo esc_attr( $wrap_class ); ?>">
411
+		<div class="<?php echo esc_attr($wrap_class); ?>">
412 412
 			<div class="widget-holder inactive">
413
-				<?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?>
413
+				<?php wp_list_widget_controls($registered_sidebar['id'], $registered_sidebar['name']); ?>
414 414
 
415
-				<?php if ( $is_inactive_widgets ) { ?>
415
+				<?php if ($is_inactive_widgets) { ?>
416 416
 				<div class="remove-inactive-widgets">
417 417
 					<form action="" method="post">
418 418
 						<p>
419 419
 							<?php
420
-							$attributes = array( 'id' => 'inactive-widgets-control-remove' );
420
+							$attributes = array('id' => 'inactive-widgets-control-remove');
421 421
 
422
-							if ( empty($sidebars_widgets['wp_inactive_widgets']) ) {
422
+							if (empty($sidebars_widgets['wp_inactive_widgets'])) {
423 423
 								$attributes['disabled'] = '';
424 424
 							}
425 425
 
426
-							submit_button( __( 'Clear Inactive Widgets' ), 'delete', 'removeinactivewidgets', false, $attributes );
426
+							submit_button(__('Clear Inactive Widgets'), 'delete', 'removeinactivewidgets', false, $attributes);
427 427
 							?>
428 428
 							<span class="spinner"></span>
429 429
 						</p>
430
-						<?php wp_nonce_field( 'remove-inactive-widgets', '_wpnonce_remove_inactive_widgets' ); ?>
430
+						<?php wp_nonce_field('remove-inactive-widgets', '_wpnonce_remove_inactive_widgets'); ?>
431 431
 					</form>
432 432
 				</div>
433 433
 				<?php } ?>
434 434
 			</div>
435
-			<?php if ( $is_inactive_widgets ) { ?>
436
-			<p class="description"><?php _e( 'This will clear all items from the inactive widgets list. You will not be able to restore any customizations.' ); ?></p>
435
+			<?php if ($is_inactive_widgets) { ?>
436
+			<p class="description"><?php _e('This will clear all items from the inactive widgets list. You will not be able to restore any customizations.'); ?></p>
437 437
 			<?php } ?>
438 438
 		</div>
439 439
 		<?php
@@ -450,10 +450,10 @@  discard block
 block discarded – undo
450 450
 
451 451
 $i = $split = 0;
452 452
 $single_sidebar_class = '';
453
-$sidebars_count = count( $theme_sidebars );
453
+$sidebars_count = count($theme_sidebars);
454 454
 
455
-if ( $sidebars_count > 1 ) {
456
-	$split = ceil( $sidebars_count / 2 );
455
+if ($sidebars_count > 1) {
456
+	$split = ceil($sidebars_count / 2);
457 457
 } else {
458 458
 	$single_sidebar_class = ' single-sidebar';
459 459
 }
@@ -464,23 +464,23 @@  discard block
 block discarded – undo
464 464
 <div class="sidebars-column-1">
465 465
 <?php
466 466
 
467
-foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) {
467
+foreach ($theme_sidebars as $sidebar => $registered_sidebar) {
468 468
 	$wrap_class = 'widgets-holder-wrap';
469
-	if ( !empty( $registered_sidebar['class'] ) )
470
-		$wrap_class .= ' sidebar-' . $registered_sidebar['class'];
469
+	if ( ! empty($registered_sidebar['class']))
470
+		$wrap_class .= ' sidebar-'.$registered_sidebar['class'];
471 471
 
472
-	if ( $i > 0 )
472
+	if ($i > 0)
473 473
 		$wrap_class .= ' closed';
474 474
 
475
-	if ( $split && $i == $split ) {
475
+	if ($split && $i == $split) {
476 476
 		?>
477 477
 		</div><div class="sidebars-column-2">
478 478
 		<?php
479 479
 	}
480 480
 
481 481
 	?>
482
-	<div class="<?php echo esc_attr( $wrap_class ); ?>">
483
-		<?php wp_list_widget_controls( $sidebar, $registered_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?>
482
+	<div class="<?php echo esc_attr($wrap_class); ?>">
483
+		<?php wp_list_widget_controls($sidebar, $registered_sidebar['name']); // Show the control forms for each of the widgets in this sidebar ?>
484 484
 	</div>
485 485
 	<?php
486 486
 
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
 </div>
493 493
 </div>
494 494
 <form method="post">
495
-<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?>
495
+<?php wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false); ?>
496 496
 </form>
497 497
 <br class="clear" />
498 498
 </div>
@@ -500,8 +500,8 @@  discard block
 block discarded – undo
500 500
 <div class="widgets-chooser">
501 501
 	<ul class="widgets-chooser-sidebars"></ul>
502 502
 	<div class="widgets-chooser-actions">
503
-		<button class="button-secondary"><?php _e( 'Cancel' ); ?></button>
504
-		<button class="button-primary"><?php _e( 'Add Widget' ); ?></button>
503
+		<button class="button-secondary"><?php _e('Cancel'); ?></button>
504
+		<button class="button-primary"><?php _e('Add Widget'); ?></button>
505 505
 	</div>
506 506
 </div>
507 507
 
@@ -512,5 +512,5 @@  discard block
 block discarded – undo
512 512
  *
513 513
  * @since 2.2.0
514 514
  */
515
-do_action( 'sidebar_admin_page' );
516
-require_once( ABSPATH . 'wp-admin/admin-footer.php' );
515
+do_action('sidebar_admin_page');
516
+require_once(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/upload.php 2 patches
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -7,90 +7,90 @@  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('upload_files') )
13
-	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
12
+if ( ! current_user_can('upload_files'))
13
+	wp_die(__('Sorry, you are not allowed to upload files.'));
14 14
 
15
-$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
16
-$modes = array( 'grid', 'list' );
15
+$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
16
+$modes = array('grid', 'list');
17 17
 
18
-if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
18
+if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
19 19
 	$mode = $_GET['mode'];
20
-	update_user_option( get_current_user_id(), 'media_library_mode', $mode );
20
+	update_user_option(get_current_user_id(), 'media_library_mode', $mode);
21 21
 }
22 22
 
23
-if ( 'grid' === $mode ) {
23
+if ('grid' === $mode) {
24 24
 	wp_enqueue_media();
25
-	wp_enqueue_script( 'media-grid' );
26
-	wp_enqueue_script( 'media' );
25
+	wp_enqueue_script('media-grid');
26
+	wp_enqueue_script('media');
27 27
 
28
-	remove_action( 'admin_head', 'wp_admin_canonical_url' );
28
+	remove_action('admin_head', 'wp_admin_canonical_url');
29 29
 
30 30
 	$q = $_GET;
31 31
 	// let JS handle this
32
-	unset( $q['s'] );
33
-	$vars = wp_edit_attachments_query_vars( $q );
34
-	$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
35
-	foreach ( $vars as $key => $value ) {
36
-		if ( ! $value || in_array( $key, $ignore ) ) {
37
-			unset( $vars[ $key ] );
32
+	unset($q['s']);
33
+	$vars = wp_edit_attachments_query_vars($q);
34
+	$ignore = array('mode', 'post_type', 'post_status', 'posts_per_page');
35
+	foreach ($vars as $key => $value) {
36
+		if ( ! $value || in_array($key, $ignore)) {
37
+			unset($vars[$key]);
38 38
 		}
39 39
 	}
40 40
 
41
-	wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
42
-		'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
41
+	wp_localize_script('media-grid', '_wpMediaGridSettings', array(
42
+		'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH),
43 43
 		'queryVars' => (object) $vars
44
-	) );
44
+	));
45 45
 
46
-	get_current_screen()->add_help_tab( array(
46
+	get_current_screen()->add_help_tab(array(
47 47
 		'id'		=> 'overview',
48
-		'title'		=> __( 'Overview' ),
48
+		'title'		=> __('Overview'),
49 49
 		'content'	=>
50
-			'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
51
-			'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' .
52
-			'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>'
53
-	) );
50
+			'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.').'</p>'.
51
+			'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'.
52
+			'<p>'.__('To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.').'</p>'
53
+	));
54 54
 
55
-	get_current_screen()->add_help_tab( array(
55
+	get_current_screen()->add_help_tab(array(
56 56
 		'id'		=> 'attachment-details',
57
-		'title'		=> __( 'Attachment Details' ),
57
+		'title'		=> __('Attachment Details'),
58 58
 		'content'	=>
59
-			'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' .
60
-			'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' .
61
-			'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
62
-	) );
59
+			'<p>'.__('Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.').'</p>'.
60
+			'<p>'.__('Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.').'</p>'.
61
+			'<p>'.__('You can also delete individual items and access the extended edit screen from the details dialog.').'</p>'
62
+	));
63 63
 
64 64
 	get_current_screen()->set_help_sidebar(
65
-		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
66
-		'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
67
-		'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
65
+		'<p><strong>'.__('For more information:').'</strong></p>'.
66
+		'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
67
+		'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
68 68
 	);
69 69
 
70 70
 	$title = __('Media Library');
71 71
 	$parent_file = 'upload.php';
72 72
 
73
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
73
+	require_once(ABSPATH.'wp-admin/admin-header.php');
74 74
 	?>
75 75
 	<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
76 76
 		<h1>
77 77
 		<?php
78
-		echo esc_html( $title );
79
-		if ( current_user_can( 'upload_files' ) ) { ?>
80
-			<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
78
+		echo esc_html($title);
79
+		if (current_user_can('upload_files')) { ?>
80
+			<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
81 81
 		}
82 82
 		?>
83 83
 		</h1>
84 84
 		<div class="error hide-if-js">
85 85
 			<p><?php printf(
86 86
 				/* translators: %s: list view URL */
87
-				__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
87
+				__('The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.'),
88 88
 				'upload.php?mode=list'
89 89
 			); ?></p>
90 90
 		</div>
91 91
 	</div>
92 92
 	<?php
93
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
93
+	include(ABSPATH.'wp-admin/admin-footer.php');
94 94
 	exit;
95 95
 }
96 96
 
@@ -100,75 +100,75 @@  discard block
 block discarded – undo
100 100
 // Handle bulk actions
101 101
 $doaction = $wp_list_table->current_action();
102 102
 
103
-if ( $doaction ) {
103
+if ($doaction) {
104 104
 	check_admin_referer('bulk-media');
105 105
 
106
-	if ( 'delete_all' == $doaction ) {
107
-		$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
106
+	if ('delete_all' == $doaction) {
107
+		$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'");
108 108
 		$doaction = 'delete';
109
-	} elseif ( isset( $_REQUEST['media'] ) ) {
109
+	} elseif (isset($_REQUEST['media'])) {
110 110
 		$post_ids = $_REQUEST['media'];
111
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
112
-		$post_ids = explode( ',', $_REQUEST['ids'] );
111
+	} elseif (isset($_REQUEST['ids'])) {
112
+		$post_ids = explode(',', $_REQUEST['ids']);
113 113
 	}
114 114
 
115 115
 	$location = 'upload.php';
116
-	if ( $referer = wp_get_referer() ) {
117
-		if ( false !== strpos( $referer, 'upload.php' ) )
118
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
116
+	if ($referer = wp_get_referer()) {
117
+		if (false !== strpos($referer, 'upload.php'))
118
+			$location = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer);
119 119
 	}
120 120
 
121
-	switch ( $doaction ) {
121
+	switch ($doaction) {
122 122
 		case 'detach':
123
-			wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' );
123
+			wp_media_attach_action($_REQUEST['parent_post_id'], 'detach');
124 124
 			break;
125 125
 
126 126
 		case 'attach':
127
-			wp_media_attach_action( $_REQUEST['found_post_id'] );
127
+			wp_media_attach_action($_REQUEST['found_post_id']);
128 128
 			break;
129 129
 
130 130
 		case 'trash':
131
-			if ( !isset( $post_ids ) )
131
+			if ( ! isset($post_ids))
132 132
 				break;
133
-			foreach ( (array) $post_ids as $post_id ) {
134
-				if ( !current_user_can( 'delete_post', $post_id ) )
135
-					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
133
+			foreach ((array) $post_ids as $post_id) {
134
+				if ( ! current_user_can('delete_post', $post_id))
135
+					wp_die(__('Sorry, you are not allowed to move this item to the Trash.'));
136 136
 
137
-				if ( !wp_trash_post( $post_id ) )
138
-					wp_die( __( 'Error in moving to Trash.' ) );
137
+				if ( ! wp_trash_post($post_id))
138
+					wp_die(__('Error in moving to Trash.'));
139 139
 			}
140
-			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
140
+			$location = add_query_arg(array('trashed' => count($post_ids), 'ids' => join(',', $post_ids)), $location);
141 141
 			break;
142 142
 		case 'untrash':
143
-			if ( !isset( $post_ids ) )
143
+			if ( ! isset($post_ids))
144 144
 				break;
145
-			foreach ( (array) $post_ids as $post_id ) {
146
-				if ( !current_user_can( 'delete_post', $post_id ) )
147
-					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
145
+			foreach ((array) $post_ids as $post_id) {
146
+				if ( ! current_user_can('delete_post', $post_id))
147
+					wp_die(__('Sorry, you are not allowed to restore this item from the Trash.'));
148 148
 
149
-				if ( !wp_untrash_post( $post_id ) )
150
-					wp_die( __( 'Error in restoring from Trash.' ) );
149
+				if ( ! wp_untrash_post($post_id))
150
+					wp_die(__('Error in restoring from Trash.'));
151 151
 			}
152
-			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
152
+			$location = add_query_arg('untrashed', count($post_ids), $location);
153 153
 			break;
154 154
 		case 'delete':
155
-			if ( !isset( $post_ids ) )
155
+			if ( ! isset($post_ids))
156 156
 				break;
157
-			foreach ( (array) $post_ids as $post_id_del ) {
158
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
159
-					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
157
+			foreach ((array) $post_ids as $post_id_del) {
158
+				if ( ! current_user_can('delete_post', $post_id_del))
159
+					wp_die(__('Sorry, you are not allowed to delete this item.'));
160 160
 
161
-				if ( !wp_delete_attachment( $post_id_del ) )
162
-					wp_die( __( 'Error in deleting.' ) );
161
+				if ( ! wp_delete_attachment($post_id_del))
162
+					wp_die(__('Error in deleting.'));
163 163
 			}
164
-			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
164
+			$location = add_query_arg('deleted', count($post_ids), $location);
165 165
 			break;
166 166
 	}
167 167
 
168
-	wp_redirect( $location );
168
+	wp_redirect($location);
169 169
 	exit;
170
-} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
171
-	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
170
+} elseif ( ! empty($_GET['_wp_http_referer'])) {
171
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
172 172
 	 exit;
173 173
 }
174 174
 
@@ -177,135 +177,135 @@  discard block
 block discarded – undo
177 177
 $title = __('Media Library');
178 178
 $parent_file = 'upload.php';
179 179
 
180
-wp_enqueue_script( 'media' );
180
+wp_enqueue_script('media');
181 181
 
182
-add_screen_option( 'per_page' );
182
+add_screen_option('per_page');
183 183
 
184
-get_current_screen()->add_help_tab( array(
184
+get_current_screen()->add_help_tab(array(
185 185
 'id'		=> 'overview',
186 186
 'title'		=> __('Overview'),
187 187
 'content'	=>
188
-	'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' .
189
-	'<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' .
190
-	'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>'
191
-) );
192
-get_current_screen()->add_help_tab( array(
188
+	'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.').'</p>'.
189
+	'<p>'.__('You can narrow the list by file type/status or by date using the dropdown menus above the media table.').'</p>'.
190
+	'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'
191
+));
192
+get_current_screen()->add_help_tab(array(
193 193
 'id'		=> 'actions-links',
194 194
 'title'		=> __('Available Actions'),
195 195
 'content'	=>
196
-	'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>'
197
-) );
198
-get_current_screen()->add_help_tab( array(
196
+	'<p>'.__('Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.').'</p>'
197
+));
198
+get_current_screen()->add_help_tab(array(
199 199
 'id'		=> 'attaching-files',
200 200
 'title'		=> __('Attaching Files'),
201 201
 'content'	=>
202
-	'<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>'
203
-) );
202
+	'<p>'.__('If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.').'</p>'
203
+));
204 204
 
205 205
 get_current_screen()->set_help_sidebar(
206
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
207
-	'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
208
-	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
206
+	'<p><strong>'.__('For more information:').'</strong></p>'.
207
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
208
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
209 209
 );
210 210
 
211
-get_current_screen()->set_screen_reader_content( array(
212
-	'heading_views'      => __( 'Filter media items list' ),
213
-	'heading_pagination' => __( 'Media items list navigation' ),
214
-	'heading_list'       => __( 'Media items list' ),
215
-) );
211
+get_current_screen()->set_screen_reader_content(array(
212
+	'heading_views'      => __('Filter media items list'),
213
+	'heading_pagination' => __('Media items list navigation'),
214
+	'heading_list'       => __('Media items list'),
215
+));
216 216
 
217
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
217
+require_once(ABSPATH.'wp-admin/admin-header.php');
218 218
 ?>
219 219
 
220 220
 <div class="wrap">
221 221
 <h1>
222 222
 <?php
223
-echo esc_html( $title );
224
-if ( current_user_can( 'upload_files' ) ) { ?>
225
-	<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
223
+echo esc_html($title);
224
+if (current_user_can('upload_files')) { ?>
225
+	<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
226 226
 }
227
-if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
227
+if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) {
228 228
 	/* translators: %s: search keywords */
229
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
229
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query());
230 230
 }
231 231
 ?>
232 232
 </h1>
233 233
 
234 234
 <?php
235 235
 $message = '';
236
-if ( ! empty( $_GET['posted'] ) ) {
237
-	$message = __( 'Media file updated.' );
236
+if ( ! empty($_GET['posted'])) {
237
+	$message = __('Media file updated.');
238 238
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
239 239
 }
240 240
 
241
-if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
242
-	if ( 1 == $attached ) {
243
-		$message = __( 'Media file attached.' );
241
+if ( ! empty($_GET['attached']) && $attached = absint($_GET['attached'])) {
242
+	if (1 == $attached) {
243
+		$message = __('Media file attached.');
244 244
 	} else {
245 245
 		/* translators: %s: number of media files */
246
-		$message = _n( '%s media file attached.', '%s media files attached.', $attached );
246
+		$message = _n('%s media file attached.', '%s media files attached.', $attached);
247 247
 	}
248
-	$message = sprintf( $message, number_format_i18n( $attached ) );
249
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
248
+	$message = sprintf($message, number_format_i18n($attached));
249
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
250 250
 }
251 251
 
252
-if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
253
-	if ( 1 == $detached ) {
254
-		$message = __( 'Media file detached.' );
252
+if ( ! empty($_GET['detach']) && $detached = absint($_GET['detach'])) {
253
+	if (1 == $detached) {
254
+		$message = __('Media file detached.');
255 255
 	} else {
256 256
 		/* translators: %s: number of media files */
257
-		$message = _n( '%s media file detached.', '%s media files detached.', $detached );
257
+		$message = _n('%s media file detached.', '%s media files detached.', $detached);
258 258
 	}
259
-	$message = sprintf( $message, number_format_i18n( $detached ) );
260
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
259
+	$message = sprintf($message, number_format_i18n($detached));
260
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
261 261
 }
262 262
 
263
-if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
264
-	if ( 1 == $deleted ) {
265
-		$message = __( 'Media file permanently deleted.' );
263
+if ( ! empty($_GET['deleted']) && $deleted = absint($_GET['deleted'])) {
264
+	if (1 == $deleted) {
265
+		$message = __('Media file permanently deleted.');
266 266
 	} else {
267 267
 		/* translators: %s: number of media files */
268
-		$message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
268
+		$message = _n('%s media file permanently deleted.', '%s media files permanently deleted.', $deleted);
269 269
 	}
270
-	$message = sprintf( $message, number_format_i18n( $deleted ) );
270
+	$message = sprintf($message, number_format_i18n($deleted));
271 271
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
272 272
 }
273 273
 
274
-if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
275
-	if ( 1 == $trashed ) {
276
-		$message = __( 'Media file moved to the trash.' );
274
+if ( ! empty($_GET['trashed']) && $trashed = absint($_GET['trashed'])) {
275
+	if (1 == $trashed) {
276
+		$message = __('Media file moved to the trash.');
277 277
 	} else {
278 278
 		/* translators: %s: number of media files */
279
-		$message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed );
279
+		$message = _n('%s media file moved to the trash.', '%s media files moved to the trash.', $trashed);
280 280
 	}
281
-	$message = sprintf( $message, number_format_i18n( $trashed ) );
282
-	$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
281
+	$message = sprintf($message, number_format_i18n($trashed));
282
+	$message .= ' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
283 283
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
284 284
 }
285 285
 
286
-if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
287
-	if ( 1 == $untrashed ) {
288
-		$message = __( 'Media file restored from the trash.' );
286
+if ( ! empty($_GET['untrashed']) && $untrashed = absint($_GET['untrashed'])) {
287
+	if (1 == $untrashed) {
288
+		$message = __('Media file restored from the trash.');
289 289
 	} else {
290 290
 		/* translators: %s: number of media files */
291
-		$message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed );
291
+		$message = _n('%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed);
292 292
 	}
293
-	$message = sprintf( $message, number_format_i18n( $untrashed ) );
293
+	$message = sprintf($message, number_format_i18n($untrashed));
294 294
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
295 295
 }
296 296
 
297
-$messages[1] = __( 'Media file updated.' );
298
-$messages[2] = __( 'Media file permanently deleted.' );
299
-$messages[3] = __( 'Error saving media file.' );
300
-$messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>';
301
-$messages[5] = __( 'Media file restored from the trash.' );
297
+$messages[1] = __('Media file updated.');
298
+$messages[2] = __('Media file permanently deleted.');
299
+$messages[3] = __('Error saving media file.');
300
+$messages[4] = __('Media file moved to the trash.').' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
301
+$messages[5] = __('Media file restored from the trash.');
302 302
 
303
-if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
304
-	$message = $messages[ $_GET['message'] ];
303
+if ( ! empty($_GET['message']) && isset($messages[$_GET['message']])) {
304
+	$message = $messages[$_GET['message']];
305 305
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
306 306
 }
307 307
 
308
-if ( !empty($message) ) { ?>
308
+if ( ! empty($message)) { ?>
309 309
 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
310 310
 <?php } ?>
311 311
 
@@ -321,4 +321,4 @@  discard block
 block discarded – undo
321 321
 </div>
322 322
 
323 323
 <?php
324
-include( ABSPATH . 'wp-admin/admin-footer.php' );
324
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +32 added lines, -21 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('upload_files') )
12
+if ( !current_user_can('upload_files') ) {
13 13
 	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
14
+}
14 15
 
15 16
 $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
16 17
 $modes = array( 'grid', 'list' );
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 
115 116
 	$location = 'upload.php';
116 117
 	if ( $referer = wp_get_referer() ) {
117
-		if ( false !== strpos( $referer, 'upload.php' ) )
118
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
118
+		if ( false !== strpos( $referer, 'upload.php' ) ) {
119
+					$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
120
+		}
119 121
 	}
120 122
 
121 123
 	switch ( $doaction ) {
@@ -128,38 +130,47 @@  discard block
 block discarded – undo
128 130
 			break;
129 131
 
130 132
 		case 'trash':
131
-			if ( !isset( $post_ids ) )
132
-				break;
133
+			if ( !isset( $post_ids ) ) {
134
+							break;
135
+			}
133 136
 			foreach ( (array) $post_ids as $post_id ) {
134
-				if ( !current_user_can( 'delete_post', $post_id ) )
135
-					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
137
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
138
+									wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
139
+				}
136 140
 
137
-				if ( !wp_trash_post( $post_id ) )
138
-					wp_die( __( 'Error in moving to Trash.' ) );
141
+				if ( !wp_trash_post( $post_id ) ) {
142
+									wp_die( __( 'Error in moving to Trash.' ) );
143
+				}
139 144
 			}
140 145
 			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
141 146
 			break;
142 147
 		case 'untrash':
143
-			if ( !isset( $post_ids ) )
144
-				break;
148
+			if ( !isset( $post_ids ) ) {
149
+							break;
150
+			}
145 151
 			foreach ( (array) $post_ids as $post_id ) {
146
-				if ( !current_user_can( 'delete_post', $post_id ) )
147
-					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
152
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
153
+									wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
154
+				}
148 155
 
149
-				if ( !wp_untrash_post( $post_id ) )
150
-					wp_die( __( 'Error in restoring from Trash.' ) );
156
+				if ( !wp_untrash_post( $post_id ) ) {
157
+									wp_die( __( 'Error in restoring from Trash.' ) );
158
+				}
151 159
 			}
152 160
 			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
153 161
 			break;
154 162
 		case 'delete':
155
-			if ( !isset( $post_ids ) )
156
-				break;
163
+			if ( !isset( $post_ids ) ) {
164
+							break;
165
+			}
157 166
 			foreach ( (array) $post_ids as $post_id_del ) {
158
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
159
-					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
167
+				if ( !current_user_can( 'delete_post', $post_id_del ) ) {
168
+									wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
169
+				}
160 170
 
161
-				if ( !wp_delete_attachment( $post_id_del ) )
162
-					wp_die( __( 'Error in deleting.' ) );
171
+				if ( !wp_delete_attachment( $post_id_del ) ) {
172
+									wp_die( __( 'Error in deleting.' ) );
173
+				}
163 174
 			}
164 175
 			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
165 176
 			break;
Please login to merge, or discard this patch.
src/wp-admin/revision.php 2 patches
Switch Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
 $redirect = 'edit.php';
31 31
 
32 32
 switch ( $action ) {
33
-case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
-		break;
33
+	case 'restore' :
34
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
+			break;
36 36
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
-		break;
37
+		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
+			break;
39 39
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
41
-		break;
40
+		if ( ! $post = get_post( $revision->post_parent ) )
41
+			break;
42 42
 
43
-	// Restore if revisions are enabled or this is an autosave.
44
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
45
-		$redirect = 'edit.php?post_type=' . $post->post_type;
46
-		break;
47
-	}
43
+		// Restore if revisions are enabled or this is an autosave.
44
+		if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
45
+			$redirect = 'edit.php?post_type=' . $post->post_type;
46
+			break;
47
+		}
48 48
 
49
-	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
51
-		break;
49
+		// Don't allow revision restore when post is locked
50
+		if ( wp_check_post_lock( $post->ID ) )
51
+			break;
52 52
 
53
-	check_admin_referer( "restore-post_{$revision->ID}" );
53
+		check_admin_referer( "restore-post_{$revision->ID}" );
54 54
 
55
-	wp_restore_post_revision( $revision->ID );
56
-	$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
57
-	break;
58
-case 'view' :
59
-case 'edit' :
60
-default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
55
+		wp_restore_post_revision( $revision->ID );
56
+		$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
62 57
 		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
58
+	case 'view' :
59
+	case 'edit' :
60
+	default :
61
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
62
+			break;
63
+		if ( ! $post = get_post( $revision->post_parent ) )
64
+			break;
65
+
66
+		if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
67
+			break;
68
+
69
+		// Revisions disabled and we're not looking at an autosave
70
+		if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
+			$redirect = 'edit.php?post_type=' . $post->post_type;
72
+			break;
73
+		}
74
+
75
+		$post_edit_link = get_edit_post_link();
76
+		$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
+		$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
+		$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to editor' ) . '</a>';
79
+		$title          = __( 'Revisions' );
80
+
81
+		$redirect = false;
64 82
 		break;
65
-
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
67
-		break;
68
-
69
-	// Revisions disabled and we're not looking at an autosave
70
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
-		$redirect = 'edit.php?post_type=' . $post->post_type;
72
-		break;
73
-	}
74
-
75
-	$post_edit_link = get_edit_post_link();
76
-	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
-	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
-	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to editor' ) . '</a>';
79
-	$title          = __( 'Revisions' );
80
-
81
-	$redirect = false;
82
-	break;
83 83
 }
84 84
 
85 85
 // Empty post_type means either malformed object found, or no valid parent was found.
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,112 +16,112 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 /** WordPress Administration Bootstrap */
19
-require_once( dirname( __FILE__ ) . '/admin.php' );
19
+require_once(dirname(__FILE__).'/admin.php');
20 20
 
21
-require ABSPATH . 'wp-admin/includes/revision.php';
21
+require ABSPATH.'wp-admin/includes/revision.php';
22 22
 
23
-wp_reset_vars( array( 'revision', 'action', 'from', 'to' ) );
23
+wp_reset_vars(array('revision', 'action', 'from', 'to'));
24 24
 
25
-$revision_id = absint( $revision );
25
+$revision_id = absint($revision);
26 26
 
27
-$from = is_numeric( $from ) ? absint( $from ) : null;
28
-if ( ! $revision_id )
29
-	$revision_id = absint( $to );
27
+$from = is_numeric($from) ? absint($from) : null;
28
+if ( ! $revision_id)
29
+	$revision_id = absint($to);
30 30
 $redirect = 'edit.php';
31 31
 
32
-switch ( $action ) {
32
+switch ($action) {
33 33
 case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
34
+	if ( ! $revision = wp_get_post_revision($revision_id))
35 35
 		break;
36 36
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
37
+	if ( ! current_user_can('edit_post', $revision->post_parent))
38 38
 		break;
39 39
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
40
+	if ( ! $post = get_post($revision->post_parent))
41 41
 		break;
42 42
 
43 43
 	// Restore if revisions are enabled or this is an autosave.
44
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
45
-		$redirect = 'edit.php?post_type=' . $post->post_type;
44
+	if ( ! wp_revisions_enabled($post) && ! wp_is_post_autosave($revision)) {
45
+		$redirect = 'edit.php?post_type='.$post->post_type;
46 46
 		break;
47 47
 	}
48 48
 
49 49
 	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
50
+	if (wp_check_post_lock($post->ID))
51 51
 		break;
52 52
 
53
-	check_admin_referer( "restore-post_{$revision->ID}" );
53
+	check_admin_referer("restore-post_{$revision->ID}");
54 54
 
55
-	wp_restore_post_revision( $revision->ID );
56
-	$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
55
+	wp_restore_post_revision($revision->ID);
56
+	$redirect = add_query_arg(array('message' => 5, 'revision' => $revision->ID), get_edit_post_link($post->ID, 'url'));
57 57
 	break;
58 58
 case 'view' :
59 59
 case 'edit' :
60 60
 default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
61
+	if ( ! $revision = wp_get_post_revision($revision_id))
62 62
 		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
63
+	if ( ! $post = get_post($revision->post_parent))
64 64
 		break;
65 65
 
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'edit_post', $revision->post_parent ) )
66
+	if ( ! current_user_can('read_post', $revision->ID) || ! current_user_can('edit_post', $revision->post_parent))
67 67
 		break;
68 68
 
69 69
 	// Revisions disabled and we're not looking at an autosave
70
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
-		$redirect = 'edit.php?post_type=' . $post->post_type;
70
+	if ( ! wp_revisions_enabled($post) && ! wp_is_post_autosave($revision)) {
71
+		$redirect = 'edit.php?post_type='.$post->post_type;
72 72
 		break;
73 73
 	}
74 74
 
75 75
 	$post_edit_link = get_edit_post_link();
76
-	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
-	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
-	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to editor' ) . '</a>';
79
-	$title          = __( 'Revisions' );
76
+	$post_title     = '<a href="'.$post_edit_link.'">'._draft_or_post_title().'</a>';
77
+	$h1             = sprintf(__('Compare Revisions of &#8220;%1$s&#8221;'), $post_title);
78
+	$return_to_post = '<a href="'.$post_edit_link.'">'.__('&larr; Return to editor').'</a>';
79
+	$title          = __('Revisions');
80 80
 
81 81
 	$redirect = false;
82 82
 	break;
83 83
 }
84 84
 
85 85
 // Empty post_type means either malformed object found, or no valid parent was found.
86
-if ( ! $redirect && empty( $post->post_type ) )
86
+if ( ! $redirect && empty($post->post_type))
87 87
 	$redirect = 'edit.php';
88 88
 
89
-if ( ! empty( $redirect ) ) {
90
-	wp_redirect( $redirect );
89
+if ( ! empty($redirect)) {
90
+	wp_redirect($redirect);
91 91
 	exit;
92 92
 }
93 93
 
94 94
 // This is so that the correct "Edit" menu item is selected.
95
-if ( ! empty( $post->post_type ) && 'post' != $post->post_type )
96
-	$parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
95
+if ( ! empty($post->post_type) && 'post' != $post->post_type)
96
+	$parent_file = $submenu_file = 'edit.php?post_type='.$post->post_type;
97 97
 else
98 98
 	$parent_file = $submenu_file = 'edit.php';
99 99
 
100
-wp_enqueue_script( 'revisions' );
101
-wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
100
+wp_enqueue_script('revisions');
101
+wp_localize_script('revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js($post, $revision_id, $from));
102 102
 
103 103
 /* Revisions Help Tab */
104 104
 
105
-$revisions_overview  = '<p>' . __( 'This screen is used for managing your content revisions.' ) . '</p>';
106
-$revisions_overview .= '<p>' . __( 'Revisions are saved copies of your post or page, which are periodically created as you update your content. The red text on the left shows the content that was removed. The green text on the right shows the content that was added.' ) . '</p>';
107
-$revisions_overview .= '<p>' . __( 'From this screen you can review, compare, and restore revisions:' ) . '</p>';
108
-$revisions_overview .= '<ul><li>' . __( 'To navigate between revisions, <strong>drag the slider handle left or right</strong> or <strong>use the Previous or Next buttons</strong>.' ) . '</li>';
109
-$revisions_overview .= '<li>' . __( 'Compare two different revisions by <strong>selecting the &#8220;Compare any two revisions&#8221; box</strong> to the side.' ) . '</li>';
110
-$revisions_overview .= '<li>' . __( 'To restore a revision, <strong>click Restore This Revision</strong>.' ) . '</li></ul>';
105
+$revisions_overview  = '<p>'.__('This screen is used for managing your content revisions.').'</p>';
106
+$revisions_overview .= '<p>'.__('Revisions are saved copies of your post or page, which are periodically created as you update your content. The red text on the left shows the content that was removed. The green text on the right shows the content that was added.').'</p>';
107
+$revisions_overview .= '<p>'.__('From this screen you can review, compare, and restore revisions:').'</p>';
108
+$revisions_overview .= '<ul><li>'.__('To navigate between revisions, <strong>drag the slider handle left or right</strong> or <strong>use the Previous or Next buttons</strong>.').'</li>';
109
+$revisions_overview .= '<li>'.__('Compare two different revisions by <strong>selecting the &#8220;Compare any two revisions&#8221; box</strong> to the side.').'</li>';
110
+$revisions_overview .= '<li>'.__('To restore a revision, <strong>click Restore This Revision</strong>.').'</li></ul>';
111 111
 
112
-get_current_screen()->add_help_tab( array(
112
+get_current_screen()->add_help_tab(array(
113 113
 	'id'      => 'revisions-overview',
114
-	'title'   => __( 'Overview' ),
114
+	'title'   => __('Overview'),
115 115
 	'content' => $revisions_overview
116
-) );
116
+));
117 117
 
118
-$revisions_sidebar  = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
119
-$revisions_sidebar .= '<p>' . __( '<a href="https://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>' ) . '</p>';
120
-$revisions_sidebar .= '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>';
118
+$revisions_sidebar  = '<p><strong>'.__('For more information:').'</strong></p>';
119
+$revisions_sidebar .= '<p>'.__('<a href="https://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>').'</p>';
120
+$revisions_sidebar .= '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>';
121 121
 
122
-get_current_screen()->set_help_sidebar( $revisions_sidebar );
122
+get_current_screen()->set_help_sidebar($revisions_sidebar);
123 123
 
124
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
124
+require_once(ABSPATH.'wp-admin/admin-header.php');
125 125
 
126 126
 ?>
127 127
 
@@ -132,4 +132,4 @@  discard block
 block discarded – undo
132 132
 <?php
133 133
 wp_print_revision_templates();
134 134
 
135
-require_once( ABSPATH . 'wp-admin/admin-footer.php' );
135
+require_once(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/network.php 1 patch
Spacing   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -10,104 +10,104 @@  discard block
 block discarded – undo
10 10
  * @subpackage Administration
11 11
  */
12 12
 
13
-define( 'WP_INSTALLING_NETWORK', true );
13
+define('WP_INSTALLING_NETWORK', true);
14 14
 
15 15
 /** WordPress Administration Bootstrap */
16
-require_once( dirname( __FILE__ ) . '/admin.php' );
16
+require_once(dirname(__FILE__).'/admin.php');
17 17
 
18
-if ( ! is_super_admin() ) {
19
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
18
+if ( ! is_super_admin()) {
19
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
20 20
 }
21 21
 
22
-if ( is_multisite() ) {
23
-	if ( ! is_network_admin() ) {
24
-		wp_redirect( network_admin_url( 'setup.php' ) );
22
+if (is_multisite()) {
23
+	if ( ! is_network_admin()) {
24
+		wp_redirect(network_admin_url('setup.php'));
25 25
 		exit;
26 26
 	}
27 27
 
28
-	if ( ! defined( 'MULTISITE' ) ) {
29
-		wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) );
28
+	if ( ! defined('MULTISITE')) {
29
+		wp_die(__('The Network creation panel is not for WordPress MU networks.'));
30 30
 	}
31 31
 }
32 32
 
33
-require_once( dirname( __FILE__ ) . '/includes/network.php' );
33
+require_once(dirname(__FILE__).'/includes/network.php');
34 34
 
35 35
 // We need to create references to ms global tables to enable Network.
36
-foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) {
36
+foreach ($wpdb->tables('ms_global') as $table => $prefixed_table) {
37 37
 	$wpdb->$table = $prefixed_table;
38 38
 }
39 39
 
40
-if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) {
40
+if ( ! network_domain_check() && ( ! defined('WP_ALLOW_MULTISITE') || ! WP_ALLOW_MULTISITE)) {
41 41
 	wp_die(
42 42
 		printf(
43 43
 			/* translators: 1: WP_ALLOW_MULTISITE 2: wp-config.php */
44
-			__( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ),
44
+			__('You must define the %1$s constant as true in your %2$s file to allow creation of a Network.'),
45 45
 			'<code>WP_ALLOW_MULTISITE</code>',
46 46
 			'<code>wp-config.php</code>'
47 47
 		)
48 48
 	);
49 49
 }
50 50
 
51
-if ( is_network_admin() ) {
52
-	$title = __( 'Network Setup' );
51
+if (is_network_admin()) {
52
+	$title = __('Network Setup');
53 53
 	$parent_file = 'settings.php';
54 54
 } else {
55
-	$title = __( 'Create a Network of WordPress Sites' );
55
+	$title = __('Create a Network of WordPress Sites');
56 56
 	$parent_file = 'tools.php';
57 57
 }
58 58
 
59
-$network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' .
60
-	'<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' .
61
-	'<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' .
62
-	'<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' .
63
-	'<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' .
64
-	'<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.') . '</p>' .
65
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
66
-	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
67
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>';
68
-
69
-get_current_screen()->add_help_tab( array(
59
+$network_help = '<p>'.__('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.').'</p>'.
60
+	'<p>'.__('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).').'</p>'.
61
+	'<p>'.__('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.').'</p>'.
62
+	'<p>'.__('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).').'</p>'.
63
+	'<p>'.__('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.').'</p>'.
64
+	'<p>'.__('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with &#8220;/blog/&#8221; from the main site. This disabling will be addressed in a future version.').'</p>'.
65
+	'<p><strong>'.__('For more information:').'</strong></p>'.
66
+	'<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>').'</p>'.
67
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>').'</p>';
68
+
69
+get_current_screen()->add_help_tab(array(
70 70
 	'id'      => 'network',
71 71
 	'title'   => __('Network'),
72 72
 	'content' => $network_help,
73
-) );
73
+));
74 74
 
75 75
 get_current_screen()->set_help_sidebar(
76
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
77
-	'<p>' . __('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>') . '</p>' .
78
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>') . '</p>' .
79
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
76
+	'<p><strong>'.__('For more information:').'</strong></p>'.
77
+	'<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network" target="_blank">Documentation on Creating a Network</a>').'</p>'.
78
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen" target="_blank">Documentation on the Network Screen</a>').'</p>'.
79
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
80 80
 );
81 81
 
82
-include( ABSPATH . 'wp-admin/admin-header.php' );
82
+include(ABSPATH.'wp-admin/admin-header.php');
83 83
 ?>
84 84
 <div class="wrap">
85
-<h1><?php echo esc_html( $title ); ?></h1>
85
+<h1><?php echo esc_html($title); ?></h1>
86 86
 
87 87
 <?php
88
-if ( $_POST ) {
88
+if ($_POST) {
89 89
 
90
-	check_admin_referer( 'install-network-1' );
90
+	check_admin_referer('install-network-1');
91 91
 
92
-	require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
92
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
93 93
 	// Create network tables.
94 94
 	install_network();
95
-	$base              = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH );
96
-	$subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false;
97
-	if ( ! network_domain_check() ) {
98
-		$result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install );
99
-		if ( is_wp_error( $result ) ) {
100
-			if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() )
101
-				network_step2( $result );
95
+	$base              = parse_url(trailingslashit(get_option('home')), PHP_URL_PATH);
96
+	$subdomain_install = allow_subdomain_install() ? ! empty($_POST['subdomain_install']) : false;
97
+	if ( ! network_domain_check()) {
98
+		$result = populate_network(1, get_clean_basedomain(), sanitize_email($_POST['email']), wp_unslash($_POST['sitename']), $base, $subdomain_install);
99
+		if (is_wp_error($result)) {
100
+			if (1 == count($result->get_error_codes()) && 'no_wildcard_dns' == $result->get_error_code())
101
+				network_step2($result);
102 102
 			else
103
-				network_step1( $result );
103
+				network_step1($result);
104 104
 		} else {
105 105
 			network_step2();
106 106
 		}
107 107
 	} else {
108 108
 		network_step2();
109 109
 	}
110
-} elseif ( is_multisite() || network_domain_check() ) {
110
+} elseif (is_multisite() || network_domain_check()) {
111 111
 	network_step2();
112 112
 } else {
113 113
 	network_step1();
@@ -115,4 +115,4 @@  discard block
 block discarded – undo
115 115
 ?>
116 116
 </div>
117 117
 
118
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
118
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
src/wp-admin/options-media.php 1 patch
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -7,46 +7,46 @@  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( __( 'Sorry, you are not allowed to manage options for this site.' ) );
12
+if ( ! current_user_can('manage_options'))
13
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
14 14
 
15 15
 $title = __('Media Settings');
16 16
 $parent_file = 'options-general.php';
17 17
 
18
-$media_options_help = '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>';
18
+$media_options_help = '<p>'.__('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.').'</p>';
19 19
 
20
-if ( ! is_multisite() && ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) ) {
21
-	$media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
20
+if ( ! is_multisite() && (get_option('upload_url_path') || (get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path')))) {
21
+	$media_options_help .= '<p>'.__('Uploading Files allows you to choose the folder and path for storing your uploaded files.').'</p>';
22 22
 }
23 23
 
24
-$media_options_help .= '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>';
24
+$media_options_help .= '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>';
25 25
 
26
-get_current_screen()->add_help_tab( array(
26
+get_current_screen()->add_help_tab(array(
27 27
 	'id'      => 'overview',
28 28
 	'title'   => __('Overview'),
29 29
 	'content' => $media_options_help,
30
-) );
30
+));
31 31
 
32 32
 get_current_screen()->set_help_sidebar(
33
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
34
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Media_Screen" target="_blank">Documentation on Media Settings</a>') . '</p>' .
35
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
33
+	'<p><strong>'.__('For more information:').'</strong></p>'.
34
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_Media_Screen" target="_blank">Documentation on Media Settings</a>').'</p>'.
35
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
36 36
 );
37 37
 
38
-include( ABSPATH . 'wp-admin/admin-header.php' );
38
+include(ABSPATH.'wp-admin/admin-header.php');
39 39
 
40 40
 ?>
41 41
 
42 42
 <div class="wrap">
43
-<h1><?php echo esc_html( $title ); ?></h1>
43
+<h1><?php echo esc_html($title); ?></h1>
44 44
 
45 45
 <form action="options.php" method="post">
46 46
 <?php settings_fields('media'); ?>
47 47
 
48 48
 <h2 class="title"><?php _e('Image sizes') ?></h2>
49
-<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
49
+<p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.'); ?></p>
50 50
 
51 51
 <table class="form-table">
52 52
 <tr>
@@ -88,33 +88,33 @@  discard block
 block discarded – undo
88 88
 /**
89 89
  * @global array $wp_settings
90 90
  */
91
-if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) : ?>
91
+if (isset($GLOBALS['wp_settings']['media']['embeds'])) : ?>
92 92
 <h2 class="title"><?php _e('Embeds') ?></h2>
93 93
 <table class="form-table">
94
-<?php do_settings_fields( 'media', 'embeds' ); ?>
94
+<?php do_settings_fields('media', 'embeds'); ?>
95 95
 </table>
96 96
 <?php endif; ?>
97 97
 
98
-<?php if ( !is_multisite() ) : ?>
98
+<?php if ( ! is_multisite()) : ?>
99 99
 <h2 class="title"><?php _e('Uploading Files'); ?></h2>
100 100
 <table class="form-table">
101 101
 <?php
102 102
 // If upload_url_path is not the default (empty), and upload_path is not the default ('wp-content/uploads' or empty)
103
-if ( get_option('upload_url_path') || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) :
103
+if (get_option('upload_url_path') || (get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path'))) :
104 104
 ?>
105 105
 <tr>
106 106
 <th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
107 107
 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
108 108
 <p class="description"><?php
109 109
 	/* translators: %s: wp-content/uploads */
110
-	printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
110
+	printf(__('Default is %s'), '<code>wp-content/uploads</code>');
111 111
 ?></p>
112 112
 </td>
113 113
 </tr>
114 114
 
115 115
 <tr>
116 116
 <th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
117
-<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option('upload_url_path')); ?>" class="regular-text code" />
117
+<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr(get_option('upload_url_path')); ?>" class="regular-text code" />
118 118
 <p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
119 119
 </td>
120 120
 </tr>
@@ -140,4 +140,4 @@  discard block
 block discarded – undo
140 140
 
141 141
 </div>
142 142
 
143
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
143
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
src/wp-admin/users.php 1 patch
Spacing   +175 added lines, -175 removed lines patch added patch discarded remove patch
@@ -8,12 +8,12 @@  discard block
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-if ( ! current_user_can( 'list_users' ) ) {
13
+if ( ! current_user_can('list_users')) {
14 14
 	wp_die(
15
-		'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
16
-		'<p>' . __( 'Sorry, you are not allowed to browse users.' ) . '</p>',
15
+		'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
16
+		'<p>'.__('Sorry, you are not allowed to browse users.').'</p>',
17 17
 		403
18 18
 	);
19 19
 }
@@ -23,63 +23,63 @@  discard block
 block discarded – undo
23 23
 $title = __('Users');
24 24
 $parent_file = 'users.php';
25 25
 
26
-add_screen_option( 'per_page' );
26
+add_screen_option('per_page');
27 27
 
28 28
 // contextual help - choose Help on the top right of admin panel to preview this.
29
-get_current_screen()->add_help_tab( array(
29
+get_current_screen()->add_help_tab(array(
30 30
 	'id'      => 'overview',
31 31
 	'title'   => __('Overview'),
32
-	'content' => '<p>' . __('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.') . '</p>' .
33
-				 '<p>' . __('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.') . '</p>'
34
-) ) ;
32
+	'content' => '<p>'.__('This screen lists all the existing users for your site. Each user has one of five defined roles as set by the site admin: Site Administrator, Editor, Author, Contributor, or Subscriber. Users with roles other than Administrator will see fewer options in the dashboard navigation when they are logged in, based on their role.').'</p>'.
33
+				 '<p>'.__('To add a new user for your site, click the Add New button at the top of the screen or Add New in the Users menu section.').'</p>'
34
+));
35 35
 
36
-get_current_screen()->add_help_tab( array(
36
+get_current_screen()->add_help_tab(array(
37 37
 	'id'      => 'screen-display',
38 38
 	'title'   => __('Screen Display'),
39
-	'content' => '<p>' . __('You can customize the display of this screen in a number of ways:') . '</p>' .
40
-					'<ul>' .
41
-					'<li>' . __('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.') . '</li>' .
42
-					'<li>' . __( 'You can filter the list of users by User Role using the text links above the users list to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.' ) . '</li>' .
43
-					'<li>' . __('You can view all posts made by a user by clicking on the number under the Posts column.') . '</li>' .
39
+	'content' => '<p>'.__('You can customize the display of this screen in a number of ways:').'</p>'.
40
+					'<ul>'.
41
+					'<li>'.__('You can hide/display columns based on your needs and decide how many users to list per screen using the Screen Options tab.').'</li>'.
42
+					'<li>'.__('You can filter the list of users by User Role using the text links above the users list to show All, Administrator, Editor, Author, Contributor, or Subscriber. The default view is to show all users. Unused User Roles are not listed.').'</li>'.
43
+					'<li>'.__('You can view all posts made by a user by clicking on the number under the Posts column.').'</li>'.
44 44
 					'</ul>'
45
-) );
45
+));
46 46
 
47
-$help = '<p>' . __('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:') . '</p>' .
48
-	'<ul>' .
49
-	'<li>' . __('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.') . '</li>';
47
+$help = '<p>'.__('Hovering over a row in the users list will display action links that allow you to manage users. You can perform the following actions:').'</p>'.
48
+	'<ul>'.
49
+	'<li>'.__('Edit takes you to the editable profile screen for that user. You can also reach that screen by clicking on the username.').'</li>';
50 50
 
51
-if ( is_multisite() )
52
-	$help .= '<li>' . __( 'Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.' ) . '</li>';
51
+if (is_multisite())
52
+	$help .= '<li>'.__('Remove allows you to remove a user from your site. It does not delete their content. You can also remove multiple users at once by using Bulk Actions.').'</li>';
53 53
 else
54
-	$help .= '<li>' . __( 'Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.' ) . '</li>';
54
+	$help .= '<li>'.__('Delete brings you to the Delete Users screen for confirmation, where you can permanently remove a user from your site and delete their content. You can also delete multiple users at once by using Bulk Actions.').'</li>';
55 55
 
56 56
 $help .= '</ul>';
57 57
 
58
-get_current_screen()->add_help_tab( array(
58
+get_current_screen()->add_help_tab(array(
59 59
 	'id'      => 'actions',
60 60
 	'title'   => __('Actions'),
61 61
 	'content' => $help,
62
-) );
63
-unset( $help );
62
+));
63
+unset($help);
64 64
 
65 65
 get_current_screen()->set_help_sidebar(
66
-    '<p><strong>' . __('For more information:') . '</strong></p>' .
67
-    '<p>' . __('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>') . '</p>' .
68
-    '<p>' . __('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>') . '</p>' .
69
-    '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
66
+    '<p><strong>'.__('For more information:').'</strong></p>'.
67
+    '<p>'.__('<a href="https://codex.wordpress.org/Users_Screen" target="_blank">Documentation on Managing Users</a>').'</p>'.
68
+    '<p>'.__('<a href="https://codex.wordpress.org/Roles_and_Capabilities" target="_blank">Descriptions of Roles and Capabilities</a>').'</p>'.
69
+    '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
70 70
 );
71 71
 
72
-get_current_screen()->set_screen_reader_content( array(
73
-	'heading_views'      => __( 'Filter users list' ),
74
-	'heading_pagination' => __( 'Users list navigation' ),
75
-	'heading_list'       => __( 'Users list' ),
76
-) );
77
-
78
-if ( empty($_REQUEST) ) {
79
-	$referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr( wp_unslash( $_SERVER['REQUEST_URI'] ) ) . '" />';
80
-} elseif ( isset($_REQUEST['wp_http_referer']) ) {
81
-	$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash( $_REQUEST['wp_http_referer'] ) );
82
-	$referer = '<input type="hidden" name="wp_http_referer" value="' . esc_attr($redirect) . '" />';
72
+get_current_screen()->set_screen_reader_content(array(
73
+	'heading_views'      => __('Filter users list'),
74
+	'heading_pagination' => __('Users list navigation'),
75
+	'heading_list'       => __('Users list'),
76
+));
77
+
78
+if (empty($_REQUEST)) {
79
+	$referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr(wp_unslash($_SERVER['REQUEST_URI'])).'" />';
80
+} elseif (isset($_REQUEST['wp_http_referer'])) {
81
+	$redirect = remove_query_arg(array('wp_http_referer', 'updated', 'delete_count'), wp_unslash($_REQUEST['wp_http_referer']));
82
+	$referer = '<input type="hidden" name="wp_http_referer" value="'.esc_attr($redirect).'" />';
83 83
 } else {
84 84
 	$redirect = 'users.php';
85 85
 	$referer = '';
@@ -87,197 +87,197 @@  discard block
 block discarded – undo
87 87
 
88 88
 $update = '';
89 89
 
90
-switch ( $wp_list_table->current_action() ) {
90
+switch ($wp_list_table->current_action()) {
91 91
 
92 92
 /* Bulk Dropdown menu Role changes */
93 93
 case 'promote':
94 94
 	check_admin_referer('bulk-users');
95 95
 
96
-	if ( ! current_user_can( 'promote_users' ) )
97
-		wp_die( __( 'You can&#8217;t edit that user.' ) );
96
+	if ( ! current_user_can('promote_users'))
97
+		wp_die(__('You can&#8217;t edit that user.'));
98 98
 
99
-	if ( empty($_REQUEST['users']) ) {
99
+	if (empty($_REQUEST['users'])) {
100 100
 		wp_redirect($redirect);
101 101
 		exit();
102 102
 	}
103 103
 
104 104
 	$editable_roles = get_editable_roles();
105 105
 	$role = false;
106
-	if ( ! empty( $_REQUEST['new_role2'] ) ) {
106
+	if ( ! empty($_REQUEST['new_role2'])) {
107 107
 		$role = $_REQUEST['new_role2'];
108
-	} elseif ( ! empty( $_REQUEST['new_role'] ) ) {
108
+	} elseif ( ! empty($_REQUEST['new_role'])) {
109 109
 		$role = $_REQUEST['new_role'];
110 110
 	}
111 111
 
112
-	if ( ! $role || empty( $editable_roles[ $role ] ) ) {
113
-		wp_die( __( 'You can&#8217;t give users that role.' ) );
112
+	if ( ! $role || empty($editable_roles[$role])) {
113
+		wp_die(__('You can&#8217;t give users that role.'));
114 114
 	}
115 115
 
116 116
 	$userids = $_REQUEST['users'];
117 117
 	$update = 'promote';
118
-	foreach ( $userids as $id ) {
118
+	foreach ($userids as $id) {
119 119
 		$id = (int) $id;
120 120
 
121
-		if ( ! current_user_can('promote_user', $id) )
121
+		if ( ! current_user_can('promote_user', $id))
122 122
 			wp_die(__('You can&#8217;t edit that user.'));
123 123
 		// The new role of the current user must also have the promote_users cap or be a multisite super admin
124
-		if ( $id == $current_user->ID && ! $wp_roles->role_objects[ $role ]->has_cap('promote_users')
125
-			&& ! ( is_multisite() && is_super_admin() ) ) {
124
+		if ($id == $current_user->ID && ! $wp_roles->role_objects[$role]->has_cap('promote_users')
125
+			&& ! (is_multisite() && is_super_admin())) {
126 126
 				$update = 'err_admin_role';
127 127
 				continue;
128 128
 		}
129 129
 
130 130
 		// If the user doesn't already belong to the blog, bail.
131
-		if ( is_multisite() && !is_user_member_of_blog( $id ) ) {
131
+		if (is_multisite() && ! is_user_member_of_blog($id)) {
132 132
 			wp_die(
133
-				'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
134
-				'<p>' . __( 'One of the selected users is not a member of this site.' ) . '</p>',
133
+				'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
134
+				'<p>'.__('One of the selected users is not a member of this site.').'</p>',
135 135
 				403
136 136
 			);
137 137
 		}
138 138
 
139
-		$user = get_userdata( $id );
140
-		$user->set_role( $role );
139
+		$user = get_userdata($id);
140
+		$user->set_role($role);
141 141
 	}
142 142
 
143 143
 	wp_redirect(add_query_arg('update', $update, $redirect));
144 144
 	exit();
145 145
 
146 146
 case 'dodelete':
147
-	if ( is_multisite() )
148
-		wp_die( __('User deletion is not allowed from this screen.') );
147
+	if (is_multisite())
148
+		wp_die(__('User deletion is not allowed from this screen.'));
149 149
 
150 150
 	check_admin_referer('delete-users');
151 151
 
152
-	if ( empty($_REQUEST['users']) ) {
152
+	if (empty($_REQUEST['users'])) {
153 153
 		wp_redirect($redirect);
154 154
 		exit();
155 155
 	}
156 156
 
157
-	$userids = array_map( 'intval', (array) $_REQUEST['users'] );
157
+	$userids = array_map('intval', (array) $_REQUEST['users']);
158 158
 
159
-	if ( empty( $_REQUEST['delete_option'] ) ) {
160
-		$url = self_admin_url( 'users.php?action=delete&users[]=' . implode( '&users[]=', $userids ) . '&error=true' );
161
-		$url = str_replace( '&amp;', '&', wp_nonce_url( $url, 'bulk-users' ) );
162
-		wp_redirect( $url );
159
+	if (empty($_REQUEST['delete_option'])) {
160
+		$url = self_admin_url('users.php?action=delete&users[]='.implode('&users[]=', $userids).'&error=true');
161
+		$url = str_replace('&amp;', '&', wp_nonce_url($url, 'bulk-users'));
162
+		wp_redirect($url);
163 163
 		exit;
164 164
 	}
165 165
 
166
-	if ( ! current_user_can( 'delete_users' ) )
166
+	if ( ! current_user_can('delete_users'))
167 167
 		wp_die(__('You can&#8217;t delete users.'));
168 168
 
169 169
 	$update = 'del';
170 170
 	$delete_count = 0;
171 171
 
172
-	foreach ( $userids as $id ) {
173
-		if ( ! current_user_can( 'delete_user', $id ) )
174
-			wp_die(__( 'You can&#8217;t delete that user.' ) );
172
+	foreach ($userids as $id) {
173
+		if ( ! current_user_can('delete_user', $id))
174
+			wp_die(__('You can&#8217;t delete that user.'));
175 175
 
176
-		if ( $id == $current_user->ID ) {
176
+		if ($id == $current_user->ID) {
177 177
 			$update = 'err_admin_del';
178 178
 			continue;
179 179
 		}
180
-		switch ( $_REQUEST['delete_option'] ) {
180
+		switch ($_REQUEST['delete_option']) {
181 181
 		case 'delete':
182
-			wp_delete_user( $id );
182
+			wp_delete_user($id);
183 183
 			break;
184 184
 		case 'reassign':
185
-			wp_delete_user( $id, $_REQUEST['reassign_user'] );
185
+			wp_delete_user($id, $_REQUEST['reassign_user']);
186 186
 			break;
187 187
 		}
188 188
 		++$delete_count;
189 189
 	}
190 190
 
191
-	$redirect = add_query_arg( array('delete_count' => $delete_count, 'update' => $update), $redirect);
191
+	$redirect = add_query_arg(array('delete_count' => $delete_count, 'update' => $update), $redirect);
192 192
 	wp_redirect($redirect);
193 193
 	exit();
194 194
 
195 195
 case 'delete':
196
-	if ( is_multisite() )
197
-		wp_die( __('User deletion is not allowed from this screen.') );
196
+	if (is_multisite())
197
+		wp_die(__('User deletion is not allowed from this screen.'));
198 198
 
199 199
 	check_admin_referer('bulk-users');
200 200
 
201
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
201
+	if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) {
202 202
 		wp_redirect($redirect);
203 203
 		exit();
204 204
 	}
205 205
 
206
-	if ( ! current_user_can( 'delete_users' ) )
207
-		$errors = new WP_Error( 'edit_users', __( 'You can&#8217;t delete users.' ) );
206
+	if ( ! current_user_can('delete_users'))
207
+		$errors = new WP_Error('edit_users', __('You can&#8217;t delete users.'));
208 208
 
209
-	if ( empty($_REQUEST['users']) )
210
-		$userids = array( intval( $_REQUEST['user'] ) );
209
+	if (empty($_REQUEST['users']))
210
+		$userids = array(intval($_REQUEST['user']));
211 211
 	else
212
-		$userids = array_map( 'intval', (array) $_REQUEST['users'] );
212
+		$userids = array_map('intval', (array) $_REQUEST['users']);
213 213
 
214 214
 	$users_have_content = false;
215
-	if ( $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE post_author IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
215
+	if ($wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_author IN( ".implode(',', $userids)." ) LIMIT 1")) {
216 216
 		$users_have_content = true;
217
-	} elseif ( $wpdb->get_var( "SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( " . implode( ',', $userids ) . " ) LIMIT 1" ) ) {
217
+	} elseif ($wpdb->get_var("SELECT link_id FROM {$wpdb->links} WHERE link_owner IN( ".implode(',', $userids)." ) LIMIT 1")) {
218 218
 		$users_have_content = true;
219 219
 	}
220 220
 
221
-	if ( $users_have_content ) {
222
-		add_action( 'admin_head', 'delete_users_add_js' );
221
+	if ($users_have_content) {
222
+		add_action('admin_head', 'delete_users_add_js');
223 223
 	}
224 224
 
225
-	include( ABSPATH . 'wp-admin/admin-header.php' );
225
+	include(ABSPATH.'wp-admin/admin-header.php');
226 226
 ?>
227 227
 <form method="post" name="updateusers" id="updateusers">
228 228
 <?php wp_nonce_field('delete-users') ?>
229 229
 <?php echo $referer; ?>
230 230
 
231 231
 <div class="wrap">
232
-<h1><?php _e( 'Delete Users' ); ?></h1>
233
-<?php if ( isset( $_REQUEST['error'] ) ) : ?>
232
+<h1><?php _e('Delete Users'); ?></h1>
233
+<?php if (isset($_REQUEST['error'])) : ?>
234 234
 	<div class="error">
235
-		<p><strong><?php _e( 'ERROR:' ); ?></strong> <?php _e( 'Please select an option.' ); ?></p>
235
+		<p><strong><?php _e('ERROR:'); ?></strong> <?php _e('Please select an option.'); ?></p>
236 236
 	</div>
237 237
 <?php endif; ?>
238 238
 
239
-<?php if ( 1 == count( $userids ) ) : ?>
240
-	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
239
+<?php if (1 == count($userids)) : ?>
240
+	<p><?php _e('You have specified this user for deletion:'); ?></p>
241 241
 <?php else : ?>
242
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
242
+	<p><?php _e('You have specified these users for deletion:'); ?></p>
243 243
 <?php endif; ?>
244 244
 
245 245
 <ul>
246 246
 <?php
247 247
 	$go_delete = 0;
248
-	foreach ( $userids as $id ) {
249
-		$user = get_userdata( $id );
250
-		if ( $id == $current_user->ID ) {
248
+	foreach ($userids as $id) {
249
+		$user = get_userdata($id);
250
+		if ($id == $current_user->ID) {
251 251
 			/* translators: 1: user id, 2: user login */
252
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login) . "</li>\n";
252
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be deleted.</strong>'), $id, $user->user_login)."</li>\n";
253 253
 		} else {
254 254
 			/* translators: 1: user id, 2: user login */
255
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"" . esc_attr($id) . "\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
255
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"".esc_attr($id)."\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n";
256 256
 			$go_delete++;
257 257
 		}
258 258
 	}
259 259
 	?>
260 260
 	</ul>
261
-<?php if ( $go_delete ) :
261
+<?php if ($go_delete) :
262 262
 
263
-	if ( ! $users_have_content ) : ?>
263
+	if ( ! $users_have_content) : ?>
264 264
 		<input type="hidden" name="delete_option" value="delete" />
265 265
 	<?php else: ?>
266
-		<?php if ( 1 == $go_delete ) : ?>
267
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
266
+		<?php if (1 == $go_delete) : ?>
267
+			<fieldset><p><legend><?php _e('What should be done with content owned by this user?'); ?></legend></p>
268 268
 		<?php else : ?>
269
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
269
+			<fieldset><p><legend><?php _e('What should be done with content owned by these users?'); ?></legend></p>
270 270
 		<?php endif; ?>
271 271
 		<ul style="list-style:none;">
272 272
 			<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
273 273
 			<?php _e('Delete all content.'); ?></label></li>
274 274
 			<li><input type="radio" id="delete_option1" name="delete_option" value="reassign" />
275
-			<?php echo '<label for="delete_option1">' . __( 'Attribute all content to:' ) . '</label> ';
276
-			wp_dropdown_users( array(
275
+			<?php echo '<label for="delete_option1">'.__('Attribute all content to:').'</label> ';
276
+			wp_dropdown_users(array(
277 277
 				'name' => 'reassign_user',
278
-				'exclude' => array_diff( $userids, array( $current_user->ID ) ),
278
+				'exclude' => array_diff($userids, array($current_user->ID)),
279 279
 				'show' => 'display_name_with_login',
280
-			) ); ?></li>
280
+			)); ?></li>
281 281
 		</ul></fieldset>
282 282
 	<?php endif;
283 283
 	/**
@@ -289,10 +289,10 @@  discard block
 block discarded – undo
289 289
 	 * @param WP_User $current_user WP_User object for the current user.
290 290
 	 * @param array   $userids      Array of IDs for users being deleted.
291 291
 	 */
292
-	do_action( 'delete_user_form', $current_user, $userids );
292
+	do_action('delete_user_form', $current_user, $userids);
293 293
 	?>
294 294
 	<input type="hidden" name="action" value="dodelete" />
295
-	<?php submit_button( __('Confirm Deletion'), 'primary' ); ?>
295
+	<?php submit_button(__('Confirm Deletion'), 'primary'); ?>
296 296
 <?php else : ?>
297 297
 	<p><?php _e('There are no valid users selected for deletion.'); ?></p>
298 298
 <?php endif; ?>
@@ -305,34 +305,34 @@  discard block
 block discarded – undo
305 305
 case 'doremove':
306 306
 	check_admin_referer('remove-users');
307 307
 
308
-	if ( ! is_multisite() )
309
-		wp_die( __( 'You can&#8217;t remove users.' ) );
308
+	if ( ! is_multisite())
309
+		wp_die(__('You can&#8217;t remove users.'));
310 310
 
311
-	if ( empty($_REQUEST['users']) ) {
311
+	if (empty($_REQUEST['users'])) {
312 312
 		wp_redirect($redirect);
313 313
 		exit;
314 314
 	}
315 315
 
316
-	if ( ! current_user_can( 'remove_users' ) )
317
-		wp_die( __( 'You can&#8217;t remove users.' ) );
316
+	if ( ! current_user_can('remove_users'))
317
+		wp_die(__('You can&#8217;t remove users.'));
318 318
 
319 319
 	$userids = $_REQUEST['users'];
320 320
 
321 321
 	$update = 'remove';
322
- 	foreach ( $userids as $id ) {
322
+ 	foreach ($userids as $id) {
323 323
 		$id = (int) $id;
324
-		if ( $id == $current_user->ID && !is_super_admin() ) {
324
+		if ($id == $current_user->ID && ! is_super_admin()) {
325 325
 			$update = 'err_admin_remove';
326 326
 			continue;
327 327
 		}
328
-		if ( !current_user_can('remove_user', $id) ) {
328
+		if ( ! current_user_can('remove_user', $id)) {
329 329
 			$update = 'err_admin_remove';
330 330
 			continue;
331 331
 		}
332 332
 		remove_user_from_blog($id, $blog_id);
333 333
 	}
334 334
 
335
-	$redirect = add_query_arg( array('update' => $update), $redirect);
335
+	$redirect = add_query_arg(array('update' => $update), $redirect);
336 336
 	wp_redirect($redirect);
337 337
 	exit;
338 338
 
@@ -340,60 +340,60 @@  discard block
 block discarded – undo
340 340
 
341 341
 	check_admin_referer('bulk-users');
342 342
 
343
-	if ( ! is_multisite() )
344
-		wp_die( __( 'You can&#8217;t remove users.' ) );
343
+	if ( ! is_multisite())
344
+		wp_die(__('You can&#8217;t remove users.'));
345 345
 
346
-	if ( empty($_REQUEST['users']) && empty($_REQUEST['user']) ) {
346
+	if (empty($_REQUEST['users']) && empty($_REQUEST['user'])) {
347 347
 		wp_redirect($redirect);
348 348
 		exit();
349 349
 	}
350 350
 
351
-	if ( !current_user_can('remove_users') )
351
+	if ( ! current_user_can('remove_users'))
352 352
 		$error = new WP_Error('edit_users', __('You can&#8217;t remove users.'));
353 353
 
354
-	if ( empty($_REQUEST['users']) )
354
+	if (empty($_REQUEST['users']))
355 355
 		$userids = array(intval($_REQUEST['user']));
356 356
 	else
357 357
 		$userids = $_REQUEST['users'];
358 358
 
359
-	include( ABSPATH . 'wp-admin/admin-header.php' );
359
+	include(ABSPATH.'wp-admin/admin-header.php');
360 360
 ?>
361 361
 <form method="post" name="updateusers" id="updateusers">
362 362
 <?php wp_nonce_field('remove-users') ?>
363 363
 <?php echo $referer; ?>
364 364
 
365 365
 <div class="wrap">
366
-<h1><?php _e( 'Remove Users from Site' ); ?></h1>
366
+<h1><?php _e('Remove Users from Site'); ?></h1>
367 367
 
368
-<?php if ( 1 == count( $userids ) ) : ?>
369
-	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
368
+<?php if (1 == count($userids)) : ?>
369
+	<p><?php _e('You have specified this user for removal:'); ?></p>
370 370
 <?php else : ?>
371
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
371
+	<p><?php _e('You have specified these users for removal:'); ?></p>
372 372
 <?php endif; ?>
373 373
 
374 374
 <ul>
375 375
 <?php
376 376
 	$go_remove = false;
377
- 	foreach ( $userids as $id ) {
377
+ 	foreach ($userids as $id) {
378 378
 		$id = (int) $id;
379
- 		$user = get_userdata( $id );
380
-		if ( $id == $current_user->ID && !is_super_admin() ) {
379
+ 		$user = get_userdata($id);
380
+		if ($id == $current_user->ID && ! is_super_admin()) {
381 381
 			/* translators: 1: user id, 2: user login */
382
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login) . "</li>\n";
383
-		} elseif ( !current_user_can('remove_user', $id) ) {
382
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>The current user will not be removed.</strong>'), $id, $user->user_login)."</li>\n";
383
+		} elseif ( ! current_user_can('remove_user', $id)) {
384 384
 			/* translators: 1: user id, 2: user login */
385
-			echo "<li>" . sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login) . "</li>\n";
385
+			echo "<li>".sprintf(__('ID #%1$s: %2$s <strong>You don&#8217;t have permission to remove this user.</strong>'), $id, $user->user_login)."</li>\n";
386 386
 		} else {
387 387
 			/* translators: 1: user id, 2: user login */
388
-			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />" . sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login) . "</li>\n";
388
+			echo "<li><input type=\"hidden\" name=\"users[]\" value=\"{$id}\" />".sprintf(__('ID #%1$s: %2$s'), $id, $user->user_login)."</li>\n";
389 389
 			$go_remove = true;
390 390
 		}
391 391
  	}
392 392
  	?>
393 393
 </ul>
394
-<?php if ( $go_remove ) : ?>
394
+<?php if ($go_remove) : ?>
395 395
 		<input type="hidden" name="action" value="doremove" />
396
-		<?php submit_button( __('Confirm Removal'), 'primary' ); ?>
396
+		<?php submit_button(__('Confirm Removal'), 'primary'); ?>
397 397
 <?php else : ?>
398 398
 	<p><?php _e('There are no valid users selected for removal.'); ?></p>
399 399
 <?php endif; ?>
@@ -405,93 +405,93 @@  discard block
 block discarded – undo
405 405
 
406 406
 default:
407 407
 
408
-	if ( !empty($_GET['_wp_http_referer']) ) {
409
-		wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce'), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
408
+	if ( ! empty($_GET['_wp_http_referer'])) {
409
+		wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
410 410
 		exit;
411 411
 	}
412 412
 
413 413
 	$wp_list_table->prepare_items();
414
-	$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' );
415
-	if ( $pagenum > $total_pages && $total_pages > 0 ) {
416
-		wp_redirect( add_query_arg( 'paged', $total_pages ) );
414
+	$total_pages = $wp_list_table->get_pagination_arg('total_pages');
415
+	if ($pagenum > $total_pages && $total_pages > 0) {
416
+		wp_redirect(add_query_arg('paged', $total_pages));
417 417
 		exit;
418 418
 	}
419 419
 
420
-	include( ABSPATH . 'wp-admin/admin-header.php' );
420
+	include(ABSPATH.'wp-admin/admin-header.php');
421 421
 
422 422
 	$messages = array();
423
-	if ( isset($_GET['update']) ) :
424
-		switch($_GET['update']) {
423
+	if (isset($_GET['update'])) :
424
+		switch ($_GET['update']) {
425 425
 		case 'del':
426 426
 		case 'del_many':
427 427
 			$delete_count = isset($_GET['delete_count']) ? (int) $_GET['delete_count'] : 0;
428
-			if ( 1 == $delete_count ) {
429
-				$message = __( 'User deleted.' );
428
+			if (1 == $delete_count) {
429
+				$message = __('User deleted.');
430 430
 			} else {
431
-				$message = _n( '%s user deleted.', '%s users deleted.', $delete_count );
431
+				$message = _n('%s user deleted.', '%s users deleted.', $delete_count);
432 432
 			}
433
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( $message, number_format_i18n( $delete_count ) ) . '</p></div>';
433
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf($message, number_format_i18n($delete_count)).'</p></div>';
434 434
 			break;
435 435
 		case 'add':
436
-			if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) {
436
+			if (isset($_GET['id']) && ($user_id = $_GET['id']) && current_user_can('edit_user', $user_id)) {
437 437
 				/* translators: %s: edit page url */
438
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . sprintf( __( 'New user created. <a href="%s">Edit user</a>' ),
439
-					esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
440
-						self_admin_url( 'user-edit.php?user_id=' . $user_id ) ) ) ) . '</p></div>';
438
+				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.sprintf(__('New user created. <a href="%s">Edit user</a>'),
439
+					esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])),
440
+						self_admin_url('user-edit.php?user_id='.$user_id)))).'</p></div>';
441 441
 			} else {
442
-				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'New user created.' ) . '</p></div>';
442
+				$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('New user created.').'</p></div>';
443 443
 			}
444 444
 			break;
445 445
 		case 'promote':
446
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Changed roles.') . '</p></div>';
446
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Changed roles.').'</p></div>';
447 447
 			break;
448 448
 		case 'err_admin_role':
449
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('The current user&#8217;s role must have user editing capabilities.') . '</p></div>';
450
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other user roles have been changed.') . '</p></div>';
449
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('The current user&#8217;s role must have user editing capabilities.').'</p></div>';
450
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other user roles have been changed.').'</p></div>';
451 451
 			break;
452 452
 		case 'err_admin_del':
453
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __('You can&#8217;t delete the current user.') . '</p></div>';
454
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('Other users have been deleted.') . '</p></div>';
453
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('You can&#8217;t delete the current user.').'</p></div>';
454
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Other users have been deleted.').'</p></div>';
455 455
 			break;
456 456
 		case 'remove':
457
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('User removed from this site.') . '</p></div>';
457
+			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('User removed from this site.').'</p></div>';
458 458
 			break;
459 459
 		case 'err_admin_remove':
460
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __("You can't remove the current user.") . '</p></div>';
461
-			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>' . __('Other users have been removed.') . '</p></div>';
460
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__("You can't remove the current user.").'</p></div>';
461
+			$messages[] = '<div id="message" class="updated notice is-dismissible fade"><p>'.__('Other users have been removed.').'</p></div>';
462 462
 			break;
463 463
 		}
464 464
 	endif; ?>
465 465
 
466
-<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?>
466
+<?php if (isset($errors) && is_wp_error($errors)) : ?>
467 467
 	<div class="error">
468 468
 		<ul>
469 469
 		<?php
470
-			foreach ( $errors->get_error_messages() as $err )
470
+			foreach ($errors->get_error_messages() as $err)
471 471
 				echo "<li>$err</li>\n";
472 472
 		?>
473 473
 		</ul>
474 474
 	</div>
475 475
 <?php endif;
476 476
 
477
-if ( ! empty($messages) ) {
478
-	foreach ( $messages as $msg )
477
+if ( ! empty($messages)) {
478
+	foreach ($messages as $msg)
479 479
 		echo $msg;
480 480
 } ?>
481 481
 
482 482
 <div class="wrap">
483 483
 <h1>
484 484
 <?php
485
-echo esc_html( $title );
486
-if ( current_user_can( 'create_users' ) ) { ?>
487
-	<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
488
-<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
489
-	<a href="<?php echo admin_url( 'user-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
485
+echo esc_html($title);
486
+if (current_user_can('create_users')) { ?>
487
+	<a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a>
488
+<?php } elseif (is_multisite() && current_user_can('promote_users')) { ?>
489
+	<a href="<?php echo admin_url('user-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add Existing', 'user'); ?></a>
490 490
 <?php }
491 491
 
492
-if ( strlen( $usersearch ) ) {
492
+if (strlen($usersearch)) {
493 493
 	/* translators: %s: search keywords */
494
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $usersearch ) );
494
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', esc_html($usersearch));
495 495
 }
496 496
 ?>
497 497
 </h1>
@@ -500,7 +500,7 @@  discard block
 block discarded – undo
500 500
 
501 501
 <form method="get">
502 502
 
503
-<?php $wp_list_table->search_box( __( 'Search Users' ), 'user' ); ?>
503
+<?php $wp_list_table->search_box(__('Search Users'), 'user'); ?>
504 504
 
505 505
 <?php $wp_list_table->display(); ?>
506 506
 </form>
@@ -512,4 +512,4 @@  discard block
 block discarded – undo
512 512
 
513 513
 } // end of the $doaction switch
514 514
 
515
-include( ABSPATH . 'wp-admin/admin-footer.php' );
515
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/user-edit.php 1 patch
Spacing   +174 added lines, -174 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
  * Filters whether to allow administrators on Multisite to edit every user.
@@ -72,47 +72,47 @@  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( __( 'Sorry, you are not allowed to edit this user.' ) );
80
+	wp_die(__('Sorry, you are not allowed 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 && hash_equals( $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 && hash_equals($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
-	check_admin_referer( 'dismiss-' . $current_user->ID . '_new_email' );
102
-	delete_user_meta( $current_user->ID, '_new_email' );
103
-	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
+	check_admin_referer('dismiss-'.$current_user->ID.'_new_email');
102
+	delete_user_meta($current_user->ID, '_new_email');
103
+	wp_redirect(add_query_arg(array('updated' => 'true'), self_admin_url('profile.php')));
104 104
 	die();
105 105
 }
106 106
 
107 107
 switch ($action) {
108 108
 case 'update':
109 109
 
110
-check_admin_referer('update-user_' . $user_id);
110
+check_admin_referer('update-user_'.$user_id);
111 111
 
112
-if ( !current_user_can('edit_user', $user_id) )
112
+if ( ! current_user_can('edit_user', $user_id))
113 113
 	wp_die(__('Sorry, you are not allowed to edit this user.'));
114 114
 
115
-if ( IS_PROFILE_PAGE ) {
115
+if (IS_PROFILE_PAGE) {
116 116
 	/**
117 117
 	 * Fires before the page loads on the 'Your Profile' editing screen.
118 118
 	 *
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 *
123 123
 	 * @param int $user_id The user ID.
124 124
 	 */
125
-	do_action( 'personal_options_update', $user_id );
125
+	do_action('personal_options_update', $user_id);
126 126
 } else {
127 127
 	/**
128 128
 	 * Fires before the page loads on the 'Edit User' screen.
@@ -131,29 +131,29 @@  discard block
 block discarded – undo
131 131
 	 *
132 132
 	 * @param int $user_id The user ID.
133 133
 	 */
134
-	do_action( 'edit_user_profile_update', $user_id );
134
+	do_action('edit_user_profile_update', $user_id);
135 135
 }
136 136
 
137 137
 // Update the email address in signups, if present.
138
-if ( is_multisite() ) {
139
-	$user = get_userdata( $user_id );
138
+if (is_multisite()) {
139
+	$user = get_userdata($user_id);
140 140
 
141
-	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 ) ) ) {
142
-		$wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST[ 'email' ], $user_login ) );
141
+	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))) {
142
+		$wpdb->query($wpdb->prepare("UPDATE {$wpdb->signups} SET user_email = %s WHERE user_login = %s", $_POST['email'], $user_login));
143 143
 	}
144 144
 }
145 145
 
146 146
 // Update the user.
147
-$errors = edit_user( $user_id );
147
+$errors = edit_user($user_id);
148 148
 
149 149
 // Grant or revoke super admin status if requested.
150
-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 ) ) {
151
-	empty( $_POST['super_admin'] ) ? revoke_super_admin( $user_id ) : grant_super_admin( $user_id );
150
+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)) {
151
+	empty($_POST['super_admin']) ? revoke_super_admin($user_id) : grant_super_admin($user_id);
152 152
 }
153 153
 
154
-if ( !is_wp_error( $errors ) ) {
155
-	$redirect = add_query_arg( 'updated', true, get_edit_user_link( $user_id ) );
156
-	if ( $wp_http_referer )
154
+if ( ! is_wp_error($errors)) {
155
+	$redirect = add_query_arg('updated', true, get_edit_user_link($user_id));
156
+	if ($wp_http_referer)
157 157
 		$redirect = add_query_arg('wp_http_referer', urlencode($wp_http_referer), $redirect);
158 158
 	wp_redirect($redirect);
159 159
 	exit;
@@ -162,62 +162,62 @@  discard block
 block discarded – undo
162 162
 default:
163 163
 $profileuser = get_user_to_edit($user_id);
164 164
 
165
-if ( !current_user_can('edit_user', $user_id) )
165
+if ( ! current_user_can('edit_user', $user_id))
166 166
 	wp_die(__('Sorry, you are not allowed to edit this user.'));
167 167
 
168
-$sessions = WP_Session_Tokens::get_instance( $profileuser->ID );
168
+$sessions = WP_Session_Tokens::get_instance($profileuser->ID);
169 169
 
170
-include(ABSPATH . 'wp-admin/admin-header.php');
170
+include(ABSPATH.'wp-admin/admin-header.php');
171 171
 ?>
172 172
 
173
-<?php if ( !IS_PROFILE_PAGE && is_super_admin( $profileuser->ID ) && current_user_can( 'manage_network_options' ) ) { ?>
173
+<?php if ( ! IS_PROFILE_PAGE && is_super_admin($profileuser->ID) && current_user_can('manage_network_options')) { ?>
174 174
 	<div class="updated"><p><strong><?php _e('Important:'); ?></strong> <?php _e('This user has super admin privileges.'); ?></p></div>
175 175
 <?php } ?>
176
-<?php if ( isset($_GET['updated']) ) : ?>
176
+<?php if (isset($_GET['updated'])) : ?>
177 177
 <div id="message" class="updated notice is-dismissible">
178
-	<?php if ( IS_PROFILE_PAGE ) : ?>
178
+	<?php if (IS_PROFILE_PAGE) : ?>
179 179
 	<p><strong><?php _e('Profile updated.') ?></strong></p>
180 180
 	<?php else: ?>
181 181
 	<p><strong><?php _e('User updated.') ?></strong></p>
182 182
 	<?php endif; ?>
183
-	<?php if ( $wp_http_referer && false === strpos( $wp_http_referer, 'user-new.php' ) && ! IS_PROFILE_PAGE ) : ?>
184
-	<p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
183
+	<?php if ($wp_http_referer && false === strpos($wp_http_referer, 'user-new.php') && ! IS_PROFILE_PAGE) : ?>
184
+	<p><a href="<?php echo esc_url($wp_http_referer); ?>"><?php _e('&larr; Back to Users'); ?></a></p>
185 185
 	<?php endif; ?>
186 186
 </div>
187 187
 <?php endif; ?>
188
-<?php if ( isset( $_GET['error'] ) ) : ?>
188
+<?php if (isset($_GET['error'])) : ?>
189 189
 <div class="notice notice-error">
190
-	<?php if ( 'new-email' == $_GET['error'] ) : ?>
191
-	<p><?php _e( 'Error while saving the new email address. Please try again.' ); ?></p>
190
+	<?php if ('new-email' == $_GET['error']) : ?>
191
+	<p><?php _e('Error while saving the new email address. Please try again.'); ?></p>
192 192
 	<?php endif; ?>
193 193
 </div>
194 194
 <?php endif; ?>
195
-<?php if ( isset( $errors ) && is_wp_error( $errors ) ) : ?>
196
-<div class="error"><p><?php echo implode( "</p>\n<p>", $errors->get_error_messages() ); ?></p></div>
195
+<?php if (isset($errors) && is_wp_error($errors)) : ?>
196
+<div class="error"><p><?php echo implode("</p>\n<p>", $errors->get_error_messages()); ?></p></div>
197 197
 <?php endif; ?>
198 198
 
199 199
 <div class="wrap" id="profile-page">
200 200
 <h1>
201 201
 <?php
202
-echo esc_html( $title );
203
-if ( ! IS_PROFILE_PAGE ) {
204
-	if ( current_user_can( 'create_users' ) ) { ?>
205
-		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'user' ); ?></a>
206
-	<?php } elseif ( is_multisite() && current_user_can( 'promote_users' ) ) { ?>
207
-		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x( 'Add Existing', 'user' ); ?></a>
202
+echo esc_html($title);
203
+if ( ! IS_PROFILE_PAGE) {
204
+	if (current_user_can('create_users')) { ?>
205
+		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'user'); ?></a>
206
+	<?php } elseif (is_multisite() && current_user_can('promote_users')) { ?>
207
+		<a href="user-new.php" class="page-title-action"><?php echo esc_html_x('Add Existing', 'user'); ?></a>
208 208
 	<?php }
209 209
 } ?>
210 210
 </h1>
211
-<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
+<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
212 212
 	/**
213 213
 	 * Fires inside the your-profile form tag on the user editing screen.
214 214
 	 *
215 215
 	 * @since 3.0.0
216 216
 	 */
217
-	do_action( 'user_edit_form_tag' );
217
+	do_action('user_edit_form_tag');
218 218
 ?>>
219
-<?php wp_nonce_field('update-user_' . $user_id) ?>
220
-<?php if ( $wp_http_referer ) : ?>
219
+<?php wp_nonce_field('update-user_'.$user_id) ?>
220
+<?php if ($wp_http_referer) : ?>
221 221
 	<input type="hidden" name="wp_http_referer" value="<?php echo esc_url($wp_http_referer); ?>" />
222 222
 <?php endif; ?>
223 223
 <p>
@@ -225,16 +225,16 @@  discard block
 block discarded – undo
225 225
 <input type="hidden" name="checkuser_id" value="<?php echo get_current_user_id(); ?>" />
226 226
 </p>
227 227
 
228
-<h2><?php _e( 'Personal Options' ); ?></h2>
228
+<h2><?php _e('Personal Options'); ?></h2>
229 229
 
230 230
 <table class="form-table">
231
-<?php if ( ! ( IS_PROFILE_PAGE && ! $user_can_edit ) ) : ?>
231
+<?php if ( ! (IS_PROFILE_PAGE && ! $user_can_edit)) : ?>
232 232
 	<tr class="user-rich-editing-wrap">
233
-		<th scope="row"><?php _e( 'Visual Editor' ); ?></th>
234
-		<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>
233
+		<th scope="row"><?php _e('Visual Editor'); ?></th>
234
+		<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>
235 235
 	</tr>
236 236
 <?php endif; ?>
237
-<?php if ( count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker') ) : ?>
237
+<?php if (count($_wp_admin_css_colors) > 1 && has_action('admin_color_scheme_picker')) : ?>
238 238
 <tr class="user-admin-color-wrap">
239 239
 <th scope="row"><?php _e('Admin Color Scheme')?></th>
240 240
 <td><?php
@@ -249,23 +249,23 @@  discard block
 block discarded – undo
249 249
 	 *
250 250
 	 * @param int $user_id The user ID.
251 251
 	 */
252
-	do_action( 'admin_color_scheme_picker', $user_id );
252
+	do_action('admin_color_scheme_picker', $user_id);
253 253
 ?></td>
254 254
 </tr>
255 255
 <?php
256 256
 endif; // $_wp_admin_css_colors
257
-if ( !( IS_PROFILE_PAGE && !$user_can_edit ) ) : ?>
257
+if ( ! (IS_PROFILE_PAGE && ! $user_can_edit)) : ?>
258 258
 <tr class="user-comment-shortcuts-wrap">
259
-<th scope="row"><?php _e( 'Keyboard Shortcuts' ); ?></th>
260
-<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>
259
+<th scope="row"><?php _e('Keyboard Shortcuts'); ?></th>
260
+<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>
261 261
 </tr>
262 262
 <?php endif; ?>
263 263
 <tr class="show-admin-bar user-admin-bar-front-wrap">
264
-<th scope="row"><?php _e( 'Toolbar' ); ?></th>
264
+<th scope="row"><?php _e('Toolbar'); ?></th>
265 265
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Toolbar') ?></span></legend>
266 266
 <label for="admin_bar_front">
267
-<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked( _get_admin_bar_pref( 'front', $profileuser->ID ) ); ?> />
268
-<?php _e( 'Show Toolbar when viewing site' ); ?></label><br />
267
+<input name="admin_bar_front" type="checkbox" id="admin_bar_front" value="1"<?php checked(_get_admin_bar_pref('front', $profileuser->ID)); ?> />
268
+<?php _e('Show Toolbar when viewing site'); ?></label><br />
269 269
 </fieldset>
270 270
 </td>
271 271
 </tr>
@@ -277,12 +277,12 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @param WP_User $profileuser The current WP_User object.
279 279
  */
280
-do_action( 'personal_options', $profileuser );
280
+do_action('personal_options', $profileuser);
281 281
 ?>
282 282
 
283 283
 </table>
284 284
 <?php
285
-	if ( IS_PROFILE_PAGE ) {
285
+	if (IS_PROFILE_PAGE) {
286 286
 		/**
287 287
 		 * Fires after the 'Personal Options' settings table on the 'Your Profile' editing screen.
288 288
 		 *
@@ -292,11 +292,11 @@  discard block
 block discarded – undo
292 292
 		 *
293 293
 		 * @param WP_User $profileuser The current WP_User object.
294 294
 		 */
295
-		do_action( 'profile_personal_options', $profileuser );
295
+		do_action('profile_personal_options', $profileuser);
296 296
 	}
297 297
 ?>
298 298
 
299
-<h2><?php _e( 'Name' ); ?></h2>
299
+<h2><?php _e('Name'); ?></h2>
300 300
 
301 301
 <table class="form-table">
302 302
 	<tr class="user-user-login-wrap">
@@ -304,33 +304,33 @@  discard block
 block discarded – undo
304 304
 		<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>
305 305
 	</tr>
306 306
 
307
-<?php if ( !IS_PROFILE_PAGE && !is_network_admin() ) : ?>
307
+<?php if ( ! IS_PROFILE_PAGE && ! is_network_admin()) : ?>
308 308
 <tr class="user-role-wrap"><th><label for="role"><?php _e('Role') ?></label></th>
309 309
 <td><select name="role" id="role">
310 310
 <?php
311 311
 // Compare user role against currently editable roles
312
-$user_roles = array_intersect( array_values( $profileuser->roles ), array_keys( get_editable_roles() ) );
313
-$user_role  = reset( $user_roles );
312
+$user_roles = array_intersect(array_values($profileuser->roles), array_keys(get_editable_roles()));
313
+$user_role  = reset($user_roles);
314 314
 
315 315
 // print the full list of roles with the primary one selected.
316 316
 wp_dropdown_roles($user_role);
317 317
 
318 318
 // print the 'no role' option. Make it selected if the user has no role yet.
319
-if ( $user_role )
320
-	echo '<option value="">' . __('&mdash; No role for this site &mdash;') . '</option>';
319
+if ($user_role)
320
+	echo '<option value="">'.__('&mdash; No role for this site &mdash;').'</option>';
321 321
 else
322
-	echo '<option value="" selected="selected">' . __('&mdash; No role for this site &mdash;') . '</option>';
322
+	echo '<option value="" selected="selected">'.__('&mdash; No role for this site &mdash;').'</option>';
323 323
 ?>
324 324
 </select></td></tr>
325 325
 <?php endif; //!IS_PROFILE_PAGE
326 326
 
327
-if ( is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can( 'manage_network_options' ) && !isset($super_admins) ) { ?>
327
+if (is_multisite() && is_network_admin() && ! IS_PROFILE_PAGE && current_user_can('manage_network_options') && ! isset($super_admins)) { ?>
328 328
 <tr class="user-super-admin-wrap"><th><?php _e('Super Admin'); ?></th>
329 329
 <td>
330
-<?php if ( $profileuser->user_email != get_site_option( 'admin_email' ) || ! is_super_admin( $profileuser->ID ) ) : ?>
331
-<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>
330
+<?php if ($profileuser->user_email != get_site_option('admin_email') || ! is_super_admin($profileuser->ID)) : ?>
331
+<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>
332 332
 <?php else : ?>
333
-<p><?php _e( 'Super admin privileges cannot be removed because this user has the network admin email.' ); ?></p>
333
+<p><?php _e('Super admin privileges cannot be removed because this user has the network admin email.'); ?></p>
334 334
 <?php endif; ?>
335 335
 </td></tr>
336 336
 <?php } ?>
@@ -359,26 +359,26 @@  discard block
 block discarded – undo
359 359
 			$public_display['display_nickname']  = $profileuser->nickname;
360 360
 			$public_display['display_username']  = $profileuser->user_login;
361 361
 
362
-			if ( !empty($profileuser->first_name) )
362
+			if ( ! empty($profileuser->first_name))
363 363
 				$public_display['display_firstname'] = $profileuser->first_name;
364 364
 
365
-			if ( !empty($profileuser->last_name) )
365
+			if ( ! empty($profileuser->last_name))
366 366
 				$public_display['display_lastname'] = $profileuser->last_name;
367 367
 
368
-			if ( !empty($profileuser->first_name) && !empty($profileuser->last_name) ) {
369
-				$public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;
370
-				$public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;
368
+			if ( ! empty($profileuser->first_name) && ! empty($profileuser->last_name)) {
369
+				$public_display['display_firstlast'] = $profileuser->first_name.' '.$profileuser->last_name;
370
+				$public_display['display_lastfirst'] = $profileuser->last_name.' '.$profileuser->first_name;
371 371
 			}
372 372
 
373
-			if ( !in_array( $profileuser->display_name, $public_display ) ) // Only add this if it isn't duplicated elsewhere
374
-				$public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;
373
+			if ( ! in_array($profileuser->display_name, $public_display)) // Only add this if it isn't duplicated elsewhere
374
+				$public_display = array('display_displayname' => $profileuser->display_name) + $public_display;
375 375
 
376
-			$public_display = array_map( 'trim', $public_display );
377
-			$public_display = array_unique( $public_display );
376
+			$public_display = array_map('trim', $public_display);
377
+			$public_display = array_unique($public_display);
378 378
 
379
-			foreach ( $public_display as $id => $item ) {
379
+			foreach ($public_display as $id => $item) {
380 380
 		?>
381
-			<option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>
381
+			<option <?php selected($profileuser->display_name, $item); ?>><?php echo $item; ?></option>
382 382
 		<?php
383 383
 			}
384 384
 		?>
@@ -387,26 +387,26 @@  discard block
 block discarded – undo
387 387
 </tr>
388 388
 </table>
389 389
 
390
-<h2><?php _e( 'Contact Info' ); ?></h2>
390
+<h2><?php _e('Contact Info'); ?></h2>
391 391
 
392 392
 <table class="form-table">
393 393
 <tr class="user-email-wrap">
394 394
 	<th><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th>
395
-	<td><input type="email" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ) ?>" class="regular-text ltr" />
395
+	<td><input type="email" name="email" id="email" value="<?php echo esc_attr($profileuser->user_email) ?>" class="regular-text ltr" />
396 396
 	<?php
397
-	$new_email = get_user_meta( $current_user->ID, '_new_email', true );
398
-	if ( $new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID ) : ?>
397
+	$new_email = get_user_meta($current_user->ID, '_new_email', true);
398
+	if ($new_email && $new_email['newemail'] != $current_user->user_email && $profileuser->ID == $current_user->ID) : ?>
399 399
 	<div class="updated inline">
400 400
 	<p><?php
401 401
 		printf(
402 402
 			/* translators: %s: new email */
403
-			__( 'There is a pending change of your email to %s.' ),
404
-			'<code>' . esc_html( $new_email['newemail'] ) . '</code>'
403
+			__('There is a pending change of your email to %s.'),
404
+			'<code>'.esc_html($new_email['newemail']).'</code>'
405 405
 		);
406 406
 		printf(
407 407
 			' <a href="%1$s">%2$s</a>',
408
-			esc_url( wp_nonce_url( self_admin_url( 'profile.php?dismiss=' . $current_user->ID . '_new_email' ), 'dismiss-' . $current_user->ID . '_new_email' ) ),
409
-			__( 'Cancel' )
408
+			esc_url(wp_nonce_url(self_admin_url('profile.php?dismiss='.$current_user->ID.'_new_email'), 'dismiss-'.$current_user->ID.'_new_email')),
409
+			__('Cancel')
410 410
 		);
411 411
 	?></p>
412 412
 	</div>
@@ -416,11 +416,11 @@  discard block
 block discarded – undo
416 416
 
417 417
 <tr class="user-url-wrap">
418 418
 	<th><label for="url"><?php _e('Website') ?></label></th>
419
-	<td><input type="url" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ) ?>" class="regular-text code" /></td>
419
+	<td><input type="url" name="url" id="url" value="<?php echo esc_attr($profileuser->user_url) ?>" class="regular-text code" /></td>
420 420
 </tr>
421 421
 
422 422
 <?php
423
-	foreach ( wp_get_user_contact_methods( $profileuser ) as $name => $desc ) {
423
+	foreach (wp_get_user_contact_methods($profileuser) as $name => $desc) {
424 424
 ?>
425 425
 <tr class="user-<?php echo $name; ?>-wrap">
426 426
 	<th><label for="<?php echo $name; ?>">
@@ -435,7 +435,7 @@  discard block
 block discarded – undo
435 435
 		 *
436 436
 		 * @param string $desc The translatable label for the contactmethod.
437 437
 		 */
438
-		echo apply_filters( "user_{$name}_label", $desc );
438
+		echo apply_filters("user_{$name}_label", $desc);
439 439
 		?>
440 440
 	</label></th>
441 441
 	<td><input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr($profileuser->$name) ?>" class="regular-text" /></td>
@@ -445,7 +445,7 @@  discard block
 block discarded – undo
445 445
 ?>
446 446
 </table>
447 447
 
448
-<h2><?php IS_PROFILE_PAGE ? _e( 'About Yourself' ) : _e( 'About the user' ); ?></h2>
448
+<h2><?php IS_PROFILE_PAGE ? _e('About Yourself') : _e('About the user'); ?></h2>
449 449
 
450 450
 <table class="form-table">
451 451
 <tr class="user-description-wrap">
@@ -454,16 +454,16 @@  discard block
 block discarded – undo
454 454
 	<p class="description"><?php _e('Share a little biographical information to fill out your profile. This may be shown publicly.'); ?></p></td>
455 455
 </tr>
456 456
 
457
-<?php if ( get_option( 'show_avatars' ) ) : ?>
457
+<?php if (get_option('show_avatars')) : ?>
458 458
 <tr class="user-profile-picture">
459
-	<th><?php _e( 'Profile Picture' ); ?></th>
459
+	<th><?php _e('Profile Picture'); ?></th>
460 460
 	<td>
461
-		<?php echo get_avatar( $user_id ); ?>
461
+		<?php echo get_avatar($user_id); ?>
462 462
 		<p class="description"><?php
463
-			if ( IS_PROFILE_PAGE ) {
463
+			if (IS_PROFILE_PAGE) {
464 464
 				/* translators: %s: Gravatar URL */
465
-				$description = sprintf( __( 'You can change your profile picture on <a href="%s">Gravatar</a>.' ),
466
-					__( 'https://en.gravatar.com/' )
465
+				$description = sprintf(__('You can change your profile picture on <a href="%s">Gravatar</a>.'),
466
+					__('https://en.gravatar.com/')
467 467
 				);
468 468
 			} else {
469 469
 				$description = '';
@@ -476,7 +476,7 @@  discard block
 block discarded – undo
476 476
 			 *
477 477
 			 * @param string $description The description that will be printed.
478 478
 			 */
479
-			echo apply_filters( 'user_profile_picture_description', $description );
479
+			echo apply_filters('user_profile_picture_description', $description);
480 480
 		?></p>
481 481
 	</td>
482 482
 </tr>
@@ -493,80 +493,80 @@  discard block
 block discarded – undo
493 493
  * @param bool    $show        Whether to show the password fields. Default true.
494 494
  * @param WP_User $profileuser User object for the current user to edit.
495 495
  */
496
-if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) :
496
+if ($show_password_fields = apply_filters('show_password_fields', true, $profileuser)) :
497 497
 ?>
498 498
 </table>
499 499
 
500
-<h2><?php _e( 'Account Management' ); ?></h2>
500
+<h2><?php _e('Account Management'); ?></h2>
501 501
 <table class="form-table">
502 502
 <tr id="password" class="user-pass1-wrap">
503
-	<th><label for="pass1"><?php _e( 'New Password' ); ?></label></th>
503
+	<th><label for="pass1"><?php _e('New Password'); ?></label></th>
504 504
 	<td>
505 505
 		<input class="hidden" value=" " /><!-- #24364 workaround -->
506
-		<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e( 'Generate Password' ); ?></button>
506
+		<button type="button" class="button button-secondary wp-generate-pw hide-if-no-js"><?php _e('Generate Password'); ?></button>
507 507
 		<div class="wp-pwd hide-if-js">
508 508
 			<span class="password-input-wrapper">
509
-				<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
+				<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" />
510 510
 			</span>
511
-			<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
+			<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'); ?>">
512 512
 				<span class="dashicons dashicons-hidden"></span>
513
-				<span class="text"><?php _e( 'Hide' ); ?></span>
513
+				<span class="text"><?php _e('Hide'); ?></span>
514 514
 			</button>
515
-			<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' ); ?>">
516
-				<span class="text"><?php _e( 'Cancel' ); ?></span>
515
+			<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'); ?>">
516
+				<span class="text"><?php _e('Cancel'); ?></span>
517 517
 			</button>
518 518
 			<div style="display:none" id="pass-strength-result" aria-live="polite"></div>
519 519
 		</div>
520 520
 	</td>
521 521
 </tr>
522 522
 <tr class="user-pass2-wrap hide-if-js">
523
-	<th scope="row"><label for="pass2"><?php _e( 'Repeat New Password' ); ?></label></th>
523
+	<th scope="row"><label for="pass2"><?php _e('Repeat New Password'); ?></label></th>
524 524
 	<td>
525 525
 	<input name="pass2" type="password" id="pass2" class="regular-text" value="" autocomplete="off" />
526
-	<p class="description"><?php _e( 'Type your new password again.' ); ?></p>
526
+	<p class="description"><?php _e('Type your new password again.'); ?></p>
527 527
 	</td>
528 528
 </tr>
529 529
 <tr class="pw-weak">
530
-	<th><?php _e( 'Confirm Password' ); ?></th>
530
+	<th><?php _e('Confirm Password'); ?></th>
531 531
 	<td>
532 532
 		<label>
533 533
 			<input type="checkbox" name="pw_weak" class="pw-checkbox" />
534
-			<span id="pw-weak-text-label"><?php _e( 'Confirm use of potentially weak password' ); ?></span>
534
+			<span id="pw-weak-text-label"><?php _e('Confirm use of potentially weak password'); ?></span>
535 535
 		</label>
536 536
 	</td>
537 537
 </tr>
538 538
 <?php endif; ?>
539 539
 
540 540
 <?php
541
-if ( IS_PROFILE_PAGE && count( $sessions->get_all() ) === 1 ) : ?>
541
+if (IS_PROFILE_PAGE && count($sessions->get_all()) === 1) : ?>
542 542
 	<tr class="user-sessions-wrap hide-if-no-js">
543
-		<th><?php _e( 'Sessions' ); ?></th>
543
+		<th><?php _e('Sessions'); ?></th>
544 544
 		<td aria-live="assertive">
545
-			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
545
+			<div class="destroy-sessions"><button type="button" disabled class="button button-secondary"><?php _e('Log Out Everywhere Else'); ?></button></div>
546 546
 			<p class="description">
547
-				<?php _e( 'You are only logged in at this location.' ); ?>
547
+				<?php _e('You are only logged in at this location.'); ?>
548 548
 			</p>
549 549
 		</td>
550 550
 	</tr>
551
-<?php elseif ( IS_PROFILE_PAGE && count( $sessions->get_all() ) > 1 ) : ?>
551
+<?php elseif (IS_PROFILE_PAGE && count($sessions->get_all()) > 1) : ?>
552 552
 	<tr class="user-sessions-wrap hide-if-no-js">
553
-		<th><?php _e( 'Sessions' ); ?></th>
553
+		<th><?php _e('Sessions'); ?></th>
554 554
 		<td aria-live="assertive">
555
-			<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out Everywhere Else' ); ?></button></div>
555
+			<div class="destroy-sessions"><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e('Log Out Everywhere Else'); ?></button></div>
556 556
 			<p class="description">
557
-				<?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
+				<?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.'); ?>
558 558
 			</p>
559 559
 		</td>
560 560
 	</tr>
561
-<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all() ) : ?>
561
+<?php elseif ( ! IS_PROFILE_PAGE && $sessions->get_all()) : ?>
562 562
 	<tr class="user-sessions-wrap hide-if-no-js">
563
-		<th><?php _e( 'Sessions' ); ?></th>
563
+		<th><?php _e('Sessions'); ?></th>
564 564
 		<td>
565
-			<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e( 'Log Out Everywhere' ); ?></button></p>
565
+			<p><button type="button" class="button button-secondary" id="destroy-sessions"><?php _e('Log Out Everywhere'); ?></button></p>
566 566
 			<p class="description">
567 567
 				<?php
568 568
 				/* translators: 1: User's display name. */
569
-				printf( __( 'Log %s out of all locations.' ), $profileuser->display_name );
569
+				printf(__('Log %s out of all locations.'), $profileuser->display_name);
570 570
 				?>
571 571
 			</p>
572 572
 		</td>
@@ -576,7 +576,7 @@  discard block
 block discarded – undo
576 576
 </table>
577 577
 
578 578
 <?php
579
-	if ( IS_PROFILE_PAGE ) {
579
+	if (IS_PROFILE_PAGE) {
580 580
 		/**
581 581
 		 * Fires after the 'About Yourself' settings table on the 'Your Profile' editing screen.
582 582
 		 *
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 		 *
587 587
 		 * @param WP_User $profileuser The current WP_User object.
588 588
 		 */
589
-		do_action( 'show_user_profile', $profileuser );
589
+		do_action('show_user_profile', $profileuser);
590 590
 	} else {
591 591
 		/**
592 592
 		 * Fires after the 'About the User' settings table on the 'Edit User' screen.
@@ -595,7 +595,7 @@  discard block
 block discarded – undo
595 595
 		 *
596 596
 		 * @param WP_User $profileuser The current WP_User object.
597 597
 		 */
598
-		do_action( 'edit_user_profile', $profileuser );
598
+		do_action('edit_user_profile', $profileuser);
599 599
 	}
600 600
 ?>
601 601
 
@@ -612,21 +612,21 @@  discard block
 block discarded – undo
612 612
  * @param bool    $enable      Whether to display the capabilities. Default true.
613 613
  * @param WP_User $profileuser The current WP_User object.
614 614
  */
615
-if ( count( $profileuser->caps ) > count( $profileuser->roles )
616
-	&& apply_filters( 'additional_capabilities_display', true, $profileuser )
615
+if (count($profileuser->caps) > count($profileuser->roles)
616
+	&& apply_filters('additional_capabilities_display', true, $profileuser)
617 617
 ) : ?>
618
-<h2><?php _e( 'Additional Capabilities' ); ?></h2>
618
+<h2><?php _e('Additional Capabilities'); ?></h2>
619 619
 <table class="form-table">
620 620
 <tr class="user-capabilities-wrap">
621
-	<th scope="row"><?php _e( 'Capabilities' ); ?></th>
621
+	<th scope="row"><?php _e('Capabilities'); ?></th>
622 622
 	<td>
623 623
 <?php
624 624
 	$output = '';
625
-	foreach ( $profileuser->caps as $cap => $value ) {
626
-		if ( ! $wp_roles->is_role( $cap ) ) {
627
-			if ( '' != $output )
625
+	foreach ($profileuser->caps as $cap => $value) {
626
+		if ( ! $wp_roles->is_role($cap)) {
627
+			if ('' != $output)
628 628
 				$output .= ', ';
629
-			$output .= $value ? $cap : sprintf( __( 'Denied: %s' ), $cap );
629
+			$output .= $value ? $cap : sprintf(__('Denied: %s'), $cap);
630 630
 		}
631 631
 	}
632 632
 	echo $output;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
 <input type="hidden" name="action" value="update" />
640 640
 <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr($user_id); ?>" />
641 641
 
642
-<?php submit_button( IS_PROFILE_PAGE ? __('Update Profile') : __('Update User') ); ?>
642
+<?php submit_button(IS_PROFILE_PAGE ? __('Update Profile') : __('Update User')); ?>
643 643
 
644 644
 </form>
645 645
 </div>
@@ -653,4 +653,4 @@  discard block
 block discarded – undo
653 653
 	}
654 654
 </script>
655 655
 <?php
656
-include( ABSPATH . 'wp-admin/admin-footer.php');
656
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/async-upload.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,70 +6,70 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
10
-	define( 'DOING_AJAX', true );
9
+if (isset($_REQUEST['action']) && 'upload-attachment' === $_REQUEST['action']) {
10
+	define('DOING_AJAX', true);
11 11
 }
12 12
 
13
-if ( ! defined( 'WP_ADMIN' ) ) {
14
-	define( 'WP_ADMIN', true );
13
+if ( ! defined('WP_ADMIN')) {
14
+	define('WP_ADMIN', true);
15 15
 }
16 16
 
17
-if ( defined('ABSPATH') )
18
-	require_once(ABSPATH . 'wp-load.php');
17
+if (defined('ABSPATH'))
18
+	require_once(ABSPATH.'wp-load.php');
19 19
 else
20
-	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
20
+	require_once(dirname(dirname(__FILE__)).'/wp-load.php');
21 21
 
22
-if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
22
+if ( ! (isset($_REQUEST['action']) && 'upload-attachment' == $_REQUEST['action'])) {
23 23
 	// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
24
-	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
24
+	if (is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && ! empty($_REQUEST['auth_cookie']))
25 25
 		$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
26
-	elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
26
+	elseif (empty($_COOKIE[AUTH_COOKIE]) && ! empty($_REQUEST['auth_cookie']))
27 27
 		$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
28
-	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
28
+	if (empty($_COOKIE[LOGGED_IN_COOKIE]) && ! empty($_REQUEST['logged_in_cookie']))
29 29
 		$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
30 30
 	unset($current_user);
31 31
 }
32 32
 
33
-require_once( ABSPATH . 'wp-admin/admin.php' );
33
+require_once(ABSPATH.'wp-admin/admin.php');
34 34
 
35
-header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
35
+header('Content-Type: text/html; charset='.get_option('blog_charset'));
36 36
 
37
-if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
38
-	include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
37
+if (isset($_REQUEST['action']) && 'upload-attachment' === $_REQUEST['action']) {
38
+	include(ABSPATH.'wp-admin/includes/ajax-actions.php');
39 39
 
40 40
 	send_nosniff_header();
41 41
 	nocache_headers();
42 42
 
43 43
 	wp_ajax_upload_attachment();
44
-	die( '0' );
44
+	die('0');
45 45
 }
46 46
 
47
-if ( ! current_user_can( 'upload_files' ) ) {
48
-	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
47
+if ( ! current_user_can('upload_files')) {
48
+	wp_die(__('Sorry, you are not allowed to upload files.'));
49 49
 }
50 50
 
51 51
 // just fetch the detail form for that attachment
52
-if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
53
-	$post = get_post( $id );
54
-	if ( 'attachment' != $post->post_type )
55
-		wp_die( __( 'Unknown post type.' ) );
56
-	if ( ! current_user_can( 'edit_post', $id ) )
57
-		wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
58
-
59
-	switch ( $_REQUEST['fetch'] ) {
52
+if (isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch']) {
53
+	$post = get_post($id);
54
+	if ('attachment' != $post->post_type)
55
+		wp_die(__('Unknown post type.'));
56
+	if ( ! current_user_can('edit_post', $id))
57
+		wp_die(__('Sorry, you are not allowed to edit this item.'));
58
+
59
+	switch ($_REQUEST['fetch']) {
60 60
 		case 3 :
61
-			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
62
-				echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
63
-			echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
61
+			if ($thumb_url = wp_get_attachment_image_src($id, 'thumbnail', true))
62
+				echo '<img class="pinkynail" src="'.esc_url($thumb_url[0]).'" alt="" />';
63
+			echo '<a class="edit-attachment" href="'.esc_url(get_edit_post_link($id)).'" target="_blank">'._x('Edit', 'media item').'</a>';
64 64
 
65 65
 			// Title shouldn't ever be empty, but use filename just in case.
66
-			$file = get_attached_file( $post->ID );
67
-			$title = $post->post_title ? $post->post_title : wp_basename( $file );
68
-			echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</span></div>';
66
+			$file = get_attached_file($post->ID);
67
+			$title = $post->post_title ? $post->post_title : wp_basename($file);
68
+			echo '<div class="filename new"><span class="title">'.esc_html(wp_html_excerpt($title, 60, '&hellip;')).'</span></div>';
69 69
 			break;
70 70
 		case 2 :
71 71
 			add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
72
-			echo get_media_item($id, array( 'send' => false, 'delete' => true ));
72
+			echo get_media_item($id, array('send' => false, 'delete' => true));
73 73
 			break;
74 74
 		default:
75 75
 			add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
 check_admin_referer('media-form');
83 83
 
84 84
 $post_id = 0;
85
-if ( isset( $_REQUEST['post_id'] ) ) {
86
-	$post_id = absint( $_REQUEST['post_id'] );
87
-	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
85
+if (isset($_REQUEST['post_id'])) {
86
+	$post_id = absint($_REQUEST['post_id']);
87
+	if ( ! get_post($post_id) || ! current_user_can('edit_post', $post_id))
88 88
 		$post_id = 0;
89 89
 }
90 90
 
91
-$id = media_handle_upload( 'async-upload', $post_id );
92
-if ( is_wp_error($id) ) {
91
+$id = media_handle_upload('async-upload', $post_id);
92
+if (is_wp_error($id)) {
93 93
 	echo '<div class="error-div error">
94
-	<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss') . '</a>
95
-	<strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload.'), esc_html($_FILES['async-upload']['name']) ) . '</strong><br />' .
96
-	esc_html($id->get_error_message()) . '</div>';
94
+	<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss').'</a>
95
+	<strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload.'), esc_html($_FILES['async-upload']['name'])).'</strong><br />'.
96
+	esc_html($id->get_error_message()).'</div>';
97 97
 	exit;
98 98
 }
99 99
 
100
-if ( $_REQUEST['short'] ) {
100
+if ($_REQUEST['short']) {
101 101
 	// Short form response - attachment ID only.
102 102
 	echo $id;
103 103
 } else {
@@ -114,5 +114,5 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param int $id Uploaded attachment ID.
116 116
 	 */
117
-	echo apply_filters( "async_upload_{$type}", $id );
117
+	echo apply_filters("async_upload_{$type}", $id);
118 118
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,19 +14,22 @@  discard block
 block discarded – undo
14 14
 	define( 'WP_ADMIN', true );
15 15
 }
16 16
 
17
-if ( defined('ABSPATH') )
17
+if ( defined('ABSPATH') ) {
18 18
 	require_once(ABSPATH . 'wp-load.php');
19
-else
19
+} else {
20 20
 	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
21
+}
21 22
 
22 23
 if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
23 24
 	// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
24
-	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
25
-		$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
26
-	elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
27
-		$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
28
-	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
29
-		$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
25
+	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) {
26
+			$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
27
+	} elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) {
28
+			$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
29
+	}
30
+	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) ) {
31
+			$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
32
+	}
30 33
 	unset($current_user);
31 34
 }
32 35
 
@@ -51,15 +54,18 @@  discard block
 block discarded – undo
51 54
 // just fetch the detail form for that attachment
52 55
 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
53 56
 	$post = get_post( $id );
54
-	if ( 'attachment' != $post->post_type )
55
-		wp_die( __( 'Unknown post type.' ) );
56
-	if ( ! current_user_can( 'edit_post', $id ) )
57
-		wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
57
+	if ( 'attachment' != $post->post_type ) {
58
+			wp_die( __( 'Unknown post type.' ) );
59
+	}
60
+	if ( ! current_user_can( 'edit_post', $id ) ) {
61
+			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
62
+	}
58 63
 
59 64
 	switch ( $_REQUEST['fetch'] ) {
60 65
 		case 3 :
61
-			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
62
-				echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
66
+			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) ) {
67
+							echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
68
+			}
63 69
 			echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
64 70
 
65 71
 			// Title shouldn't ever be empty, but use filename just in case.
@@ -84,9 +90,10 @@  discard block
 block discarded – undo
84 90
 $post_id = 0;
85 91
 if ( isset( $_REQUEST['post_id'] ) ) {
86 92
 	$post_id = absint( $_REQUEST['post_id'] );
87
-	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
88
-		$post_id = 0;
89
-}
93
+	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
94
+			$post_id = 0;
95
+	}
96
+	}
90 97
 
91 98
 $id = media_handle_upload( 'async-upload', $post_id );
92 99
 if ( is_wp_error($id) ) {
Please login to merge, or discard this patch.
src/wp-admin/update-core.php 2 patches
Spacing   +240 added lines, -240 removed lines patch added patch discarded remove patch
@@ -7,20 +7,20 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_enqueue_style( 'plugin-install' );
13
-wp_enqueue_script( 'plugin-install' );
14
-wp_enqueue_script( 'updates' );
12
+wp_enqueue_style('plugin-install');
13
+wp_enqueue_script('plugin-install');
14
+wp_enqueue_script('updates');
15 15
 add_thickbox();
16 16
 
17
-if ( is_multisite() && ! is_network_admin() ) {
18
-	wp_redirect( network_admin_url( 'update-core.php' ) );
17
+if (is_multisite() && ! is_network_admin()) {
18
+	wp_redirect(network_admin_url('update-core.php'));
19 19
 	exit();
20 20
 }
21 21
 
22
-if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
23
-	wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
22
+if ( ! current_user_can('update_core') && ! current_user_can('update_themes') && ! current_user_can('update_plugins'))
23
+	wp_die(__('Sorry, you are not allowed to update this site.'));
24 24
 
25 25
 /**
26 26
  *
@@ -32,50 +32,50 @@  discard block
 block discarded – undo
32 32
  *
33 33
  * @param object $update
34 34
  */
35
-function list_core_update( $update ) {
35
+function list_core_update($update) {
36 36
  	global $wp_local_package, $wpdb, $wp_version;
37 37
   	static $first_pass = true;
38 38
 
39
- 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
39
+ 	if ('en_US' == $update->locale && 'en_US' == get_locale())
40 40
  		$version_string = $update->current;
41 41
  	// If the only available update is a partial builds, it doesn't need a language-specific version string.
42
- 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
42
+ 	elseif ('en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ($updates = get_core_updates()) && 1 == count($updates))
43 43
  		$version_string = $update->current;
44 44
  	else
45
- 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
45
+ 		$version_string = sprintf("%s&ndash;<strong>%s</strong>", $update->current, $update->locale);
46 46
 
47 47
 	$current = false;
48
-	if ( !isset($update->response) || 'latest' == $update->response )
48
+	if ( ! isset($update->response) || 'latest' == $update->response)
49 49
 		$current = true;
50 50
 	$submit = __('Update Now');
51 51
 	$form_action = 'update-core.php?action=do-core-upgrade';
52 52
 	$php_version    = phpversion();
53 53
 	$mysql_version  = $wpdb->db_version();
54 54
 	$show_buttons = true;
55
-	if ( 'development' == $update->response ) {
55
+	if ('development' == $update->response) {
56 56
 		$message = __('You are using a development version of WordPress. You can update to the latest nightly build automatically or download the nightly build and install it manually:');
57 57
 		$download = __('Download nightly build');
58 58
 	} else {
59
-		if ( $current ) {
60
-			$message = sprintf( __( 'If you need to re-install version %s, you can do so here or download the package and re-install manually:' ), $version_string );
59
+		if ($current) {
60
+			$message = sprintf(__('If you need to re-install version %s, you can do so here or download the package and re-install manually:'), $version_string);
61 61
 			$submit = __('Re-install Now');
62 62
 			$form_action = 'update-core.php?action=do-core-reinstall';
63 63
 		} else {
64
-			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );
65
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
64
+			$php_compat = version_compare($php_version, $update->php_version, '>=');
65
+			if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql))
66 66
 				$mysql_compat = true;
67 67
 			else
68
-				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
69
-
70
-			if ( !$mysql_compat && !$php_compat )
71
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
72
-			elseif ( !$php_compat )
73
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
74
-			elseif ( !$mysql_compat )
75
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
68
+				$mysql_compat = version_compare($mysql_version, $update->mysql_version, '>=');
69
+
70
+			if ( ! $mysql_compat && ! $php_compat)
71
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version);
72
+			elseif ( ! $php_compat)
73
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version);
74
+			elseif ( ! $mysql_compat)
75
+				$message = sprintf(__('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version);
76 76
 			else
77
-				$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
-			if ( !$mysql_compat || !$php_compat )
77
+				$message = sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
+			if ( ! $mysql_compat || ! $php_compat)
79 79
 				$show_buttons = false;
80 80
 		}
81 81
 		$download = sprintf(__('Download %s'), $version_string);
@@ -84,31 +84,31 @@  discard block
 block discarded – undo
84 84
 	echo '<p>';
85 85
 	echo $message;
86 86
 	echo '</p>';
87
-	echo '<form method="post" action="' . $form_action . '" name="upgrade" class="upgrade">';
87
+	echo '<form method="post" action="'.$form_action.'" name="upgrade" class="upgrade">';
88 88
 	wp_nonce_field('upgrade-core');
89 89
 	echo '<p>';
90
-	echo '<input name="version" value="'. esc_attr($update->current) .'" type="hidden"/>';
91
-	echo '<input name="locale" value="'. esc_attr($update->locale) .'" type="hidden"/>';
92
-	if ( $show_buttons ) {
93
-		if ( $first_pass ) {
94
-			submit_button( $submit, $current ? 'button' : 'primary regular', 'upgrade', false );
90
+	echo '<input name="version" value="'.esc_attr($update->current).'" type="hidden"/>';
91
+	echo '<input name="locale" value="'.esc_attr($update->locale).'" type="hidden"/>';
92
+	if ($show_buttons) {
93
+		if ($first_pass) {
94
+			submit_button($submit, $current ? 'button' : 'primary regular', 'upgrade', false);
95 95
 			$first_pass = false;
96 96
 		} else {
97
-			submit_button( $submit, 'button', 'upgrade', false );
97
+			submit_button($submit, 'button', 'upgrade', false);
98 98
 		}
99
-		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
99
+		echo '&nbsp;<a href="'.esc_url($update->download).'" class="button">'.$download.'</a>&nbsp;';
100 100
 	}
101
-	if ( 'en_US' != $update->locale )
102
-		if ( !isset( $update->dismissed ) || !$update->dismissed )
103
-			submit_button( __('Hide this update'), 'button', 'dismiss', false );
101
+	if ('en_US' != $update->locale)
102
+		if ( ! isset($update->dismissed) || ! $update->dismissed)
103
+			submit_button(__('Hide this update'), 'button', 'dismiss', false);
104 104
 		else
105
-			submit_button( __('Bring back this update'), 'button', 'undismiss', false );
105
+			submit_button(__('Bring back this update'), 'button', 'undismiss', false);
106 106
 	echo '</p>';
107
-	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
107
+	if ('en_US' != $update->locale && ( ! isset($wp_local_package) || $wp_local_package != $update->locale))
108 108
 	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
109 109
 	// Partial builds don't need language-specific warnings.
110
-	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111
-	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
110
+	elseif ('en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version)) {
111
+	    echo '<p class="hint">'.sprintf(__('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '').'</p>';
112 112
 	}
113 113
 	echo '</form>';
114 114
 
@@ -118,8 +118,8 @@  discard block
 block discarded – undo
118 118
  * @since 2.7.0
119 119
  */
120 120
 function dismissed_updates() {
121
-	$dismissed = get_core_updates( array( 'dismissed' => true, 'available' => false ) );
122
-	if ( $dismissed ) {
121
+	$dismissed = get_core_updates(array('dismissed' => true, 'available' => false));
122
+	if ($dismissed) {
123 123
 
124 124
 		$show_text = esc_js(__('Show hidden updates'));
125 125
 		$hide_text = esc_js(__('Hide hidden updates'));
@@ -135,9 +135,9 @@  discard block
 block discarded – undo
135 135
 	<?php
136 136
 		echo '<p class="hide-if-no-js"><a id="show-dismissed" href="#">'.__('Show hidden updates').'</a></p>';
137 137
 		echo '<ul id="dismissed-updates" class="core-updates dismissed">';
138
-		foreach ( (array) $dismissed as $update) {
138
+		foreach ((array) $dismissed as $update) {
139 139
 			echo '<li>';
140
-			list_core_update( $update );
140
+			list_core_update($update);
141 141
 			echo '</li>';
142 142
 		}
143 143
 		echo '</ul>';
@@ -158,22 +158,22 @@  discard block
 block discarded – undo
158 158
 
159 159
 	$updates = get_core_updates();
160 160
 
161
-	if ( !isset($updates[0]->response) || 'latest' == $updates[0]->response ) {
161
+	if ( ! isset($updates[0]->response) || 'latest' == $updates[0]->response) {
162 162
 		echo '<h2>';
163 163
 		_e('You have the latest version of WordPress.');
164 164
 
165
-		if ( wp_http_supports( array( 'ssl' ) ) ) {
166
-			require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
165
+		if (wp_http_supports(array('ssl'))) {
166
+			require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
167 167
 			$upgrader = new WP_Automatic_Updater;
168 168
 			$future_minor_update = (object) array(
169
-				'current'       => $wp_version . '.1.next.minor',
170
-				'version'       => $wp_version . '.1.next.minor',
169
+				'current'       => $wp_version.'.1.next.minor',
170
+				'version'       => $wp_version.'.1.next.minor',
171 171
 				'php_version'   => $required_php_version,
172 172
 				'mysql_version' => $required_mysql_version,
173 173
 			);
174
-			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
175
-			if ( $should_auto_update )
176
-				echo ' ' . __( 'Future security updates will be applied automatically.' );
174
+			$should_auto_update = $upgrader->should_update('core', $future_minor_update, ABSPATH);
175
+			if ($should_auto_update)
176
+				echo ' '.__('Future security updates will be applied automatically.');
177 177
 		}
178 178
 		echo '</h2>';
179 179
 	} else {
@@ -182,33 +182,33 @@  discard block
 block discarded – undo
182 182
 		echo '</p></div>';
183 183
 
184 184
 		echo '<h2 class="response">';
185
-		_e( 'An updated version of WordPress is available.' );
185
+		_e('An updated version of WordPress is available.');
186 186
 		echo '</h2>';
187 187
 	}
188 188
 
189
-	if ( isset( $updates[0] ) && $updates[0]->response == 'development' ) {
190
-		require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
189
+	if (isset($updates[0]) && $updates[0]->response == 'development') {
190
+		require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
191 191
 		$upgrader = new WP_Automatic_Updater;
192
-		if ( wp_http_supports( 'ssl' ) && $upgrader->should_update( 'core', $updates[0], ABSPATH ) ) {
192
+		if (wp_http_supports('ssl') && $upgrader->should_update('core', $updates[0], ABSPATH)) {
193 193
 			echo '<div class="updated inline"><p>';
194
-			echo '<strong>' . __( 'BETA TESTERS:' ) . '</strong> ' . __( 'This site is set up to install updates of future beta versions automatically.' );
194
+			echo '<strong>'.__('BETA TESTERS:').'</strong> '.__('This site is set up to install updates of future beta versions automatically.');
195 195
 			echo '</p></div>';
196 196
 		}
197 197
 	}
198 198
 
199 199
 	echo '<ul class="core-updates">';
200
-	foreach ( (array) $updates as $update ) {
200
+	foreach ((array) $updates as $update) {
201 201
 		echo '<li>';
202
-		list_core_update( $update );
202
+		list_core_update($update);
203 203
 		echo '</li>';
204 204
 	}
205 205
 	echo '</ul>';
206 206
 	// Don't show the maintenance mode notice when we are only showing a single re-install option.
207
-	if ( $updates && ( count( $updates ) > 1 || $updates[0]->response != 'latest' ) ) {
208
-		echo '<p>' . __( 'While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.' ) . '</p>';
209
-	} elseif ( ! $updates ) {
210
-		list( $normalized_version ) = explode( '-', $wp_version );
211
-		echo '<p>' . sprintf( __( '<a href="%s">Learn more about WordPress %s</a>.' ), esc_url( self_admin_url( 'about.php' ) ), $normalized_version ) . '</p>';
207
+	if ($updates && (count($updates) > 1 || $updates[0]->response != 'latest')) {
208
+		echo '<p>'.__('While your site is being updated, it will be in maintenance mode. As soon as your updates are complete, your site will return to normal.').'</p>';
209
+	} elseif ( ! $updates) {
210
+		list($normalized_version) = explode('-', $wp_version);
211
+		echo '<p>'.sprintf(__('<a href="%s">Learn more about WordPress %s</a>.'), esc_url(self_admin_url('about.php')), $normalized_version).'</p>';
212 212
 	}
213 213
 	dismissed_updates();
214 214
 }
@@ -222,82 +222,82 @@  discard block
 block discarded – undo
222 222
 
223 223
 	$cur_wp_version = preg_replace('/-.*$/', '', $wp_version);
224 224
 
225
-	require_once(ABSPATH . 'wp-admin/includes/plugin-install.php');
225
+	require_once(ABSPATH.'wp-admin/includes/plugin-install.php');
226 226
 	$plugins = get_plugin_updates();
227
-	if ( empty( $plugins ) ) {
228
-		echo '<h2>' . __( 'Plugins' ) . '</h2>';
229
-		echo '<p>' . __( 'Your plugins are all up to date.' ) . '</p>';
227
+	if (empty($plugins)) {
228
+		echo '<h2>'.__('Plugins').'</h2>';
229
+		echo '<p>'.__('Your plugins are all up to date.').'</p>';
230 230
 		return;
231 231
 	}
232 232
 	$form_action = 'update-core.php?action=do-plugin-upgrade';
233 233
 
234 234
 	$core_updates = get_core_updates();
235
-	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
235
+	if ( ! isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare($core_updates[0]->current, $cur_wp_version, '='))
236 236
 		$core_update_version = false;
237 237
 	else
238 238
 		$core_update_version = $core_updates[0]->current;
239 239
 	?>
240
-<h2><?php _e( 'Plugins' ); ?></h2>
241
-<p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
242
-<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-plugins" class="upgrade">
240
+<h2><?php _e('Plugins'); ?></h2>
241
+<p><?php _e('The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.'); ?></p>
242
+<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-plugins" class="upgrade">
243 243
 <?php wp_nonce_field('upgrade-core'); ?>
244 244
 <p><input id="upgrade-plugins" class="button" type="submit" value="<?php esc_attr_e('Update Plugins'); ?>" name="upgrade" /></p>
245 245
 <table class="widefat updates-table" id="update-plugins-table">
246 246
 	<thead>
247 247
 	<tr>
248 248
 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all" /></td>
249
-		<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
249
+		<td class="manage-column"><label for="plugins-select-all"><?php _e('Select All'); ?></label></td>
250 250
 	</tr>
251 251
 	</thead>
252 252
 
253 253
 	<tbody class="plugins">
254 254
 <?php
255
-	foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
255
+	foreach ((array) $plugins as $plugin_file => $plugin_data) {
256 256
 		// Get plugin compat for running version of WordPress.
257
-		if ( isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=') ) {
258
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
259
-		} elseif ( isset($plugin_data->update->compatibility->{$cur_wp_version}) ) {
257
+		if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $cur_wp_version, '>=')) {
258
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $cur_wp_version);
259
+		} elseif (isset($plugin_data->update->compatibility->{$cur_wp_version})) {
260 260
 			$compat = $plugin_data->update->compatibility->{$cur_wp_version};
261
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
261
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $cur_wp_version, $compat->percent, $compat->votes, $compat->total_votes);
262 262
 		} else {
263
-			$compat = '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
263
+			$compat = '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $cur_wp_version);
264 264
 		}
265 265
 		// Get plugin compat for updated version of WordPress.
266
-		if ( $core_update_version ) {
267
-			if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
268
-				$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %1$s: 100%% (according to its author)' ), $core_update_version );
269
-			} elseif ( isset( $plugin_data->update->compatibility->{$core_update_version} ) ) {
266
+		if ($core_update_version) {
267
+			if (isset($plugin_data->update->tested) && version_compare($plugin_data->update->tested, $core_update_version, '>=')) {
268
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: 100%% (according to its author)'), $core_update_version);
269
+			} elseif (isset($plugin_data->update->compatibility->{$core_update_version} )) {
270 270
 				$update_compat = $plugin_data->update->compatibility->{$core_update_version};
271
-				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
271
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: %2$d%% (%3$d "works" votes out of %4$d total)'), $core_update_version, $update_compat->percent, $update_compat->votes, $update_compat->total_votes);
272 272
 			} else {
273
-				$compat .= '<br />' . sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
273
+				$compat .= '<br />'.sprintf(__('Compatibility with WordPress %1$s: Unknown'), $core_update_version);
274 274
 			}
275 275
 		}
276 276
 		// Get the upgrade notice for the new plugin version.
277
-		if ( isset($plugin_data->update->upgrade_notice) ) {
278
-			$upgrade_notice = '<br />' . strip_tags($plugin_data->update->upgrade_notice);
277
+		if (isset($plugin_data->update->upgrade_notice)) {
278
+			$upgrade_notice = '<br />'.strip_tags($plugin_data->update->upgrade_notice);
279 279
 		} else {
280 280
 			$upgrade_notice = '';
281 281
 		}
282 282
 
283
-		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '&section=changelog&TB_iframe=true&width=640&height=662');
283
+		$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data->update->slug.'&section=changelog&TB_iframe=true&width=640&height=662');
284 284
 		$details = sprintf(
285 285
 			'<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
286
-			esc_url( $details_url ),
286
+			esc_url($details_url),
287 287
 			/* translators: 1: plugin name, 2: version number */
288
-			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
288
+			esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_data->Name, $plugin_data->update->new_version)),
289 289
 			/* translators: %s: plugin version */
290
-			sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
290
+			sprintf(__('View version %s details.'), $plugin_data->update->new_version)
291 291
 		);
292 292
 
293
-		$checkbox_id = "checkbox_" . md5( $plugin_data->Name );
293
+		$checkbox_id = "checkbox_".md5($plugin_data->Name);
294 294
 		?>
295 295
 		<tr>
296 296
 			<td class="check-column">
297
-				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
297
+				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($plugin_file); ?>" />
298 298
 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
299 299
 					/* translators: %s: plugin name */
300
-					printf( __( 'Select %s' ),
300
+					printf(__('Select %s'),
301 301
 						$plugin_data->Name
302 302
 					);
303 303
 				?></label>
@@ -306,11 +306,11 @@  discard block
 block discarded – undo
306 306
 				<strong><?php echo $plugin_data->Name; ?></strong>
307 307
 				<?php
308 308
 					/* translators: 1: plugin version, 2: new version */
309
-					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
309
+					printf(__('You have version %1$s installed. Update to %2$s.'),
310 310
 						$plugin_data->Version,
311 311
 						$plugin_data->update->new_version
312 312
 					);
313
-					echo ' ' . $details . $compat . $upgrade_notice;
313
+					echo ' '.$details.$compat.$upgrade_notice;
314 314
 				?>
315 315
 			</p></td>
316 316
 		</tr>
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 	<tfoot>
323 323
 	<tr>
324 324
 		<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
325
-		<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
325
+		<td class="manage-column"><label for="plugins-select-all-2"><?php _e('Select All'); ?></label></td>
326 326
 	</tr>
327 327
 	</tfoot>
328 328
 </table>
@@ -336,50 +336,50 @@  discard block
 block discarded – undo
336 336
  */
337 337
 function list_theme_updates() {
338 338
 	$themes = get_theme_updates();
339
-	if ( empty( $themes ) ) {
340
-		echo '<h2>' . __( 'Themes' ) . '</h2>';
341
-		echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
339
+	if (empty($themes)) {
340
+		echo '<h2>'.__('Themes').'</h2>';
341
+		echo '<p>'.__('Your themes are all up to date.').'</p>';
342 342
 		return;
343 343
 	}
344 344
 
345 345
 	$form_action = 'update-core.php?action=do-theme-upgrade';
346 346
 ?>
347
-<h2><?php _e( 'Themes' ); ?></h2>
348
-<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.' ); ?></p>
349
-<p><?php printf( __( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ), __( 'https://codex.wordpress.org/Child_Themes' ) ); ?></p>
350
-<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
347
+<h2><?php _e('Themes'); ?></h2>
348
+<p><?php _e('The following themes have new versions available. Check the ones you want to update and then click &#8220;Update Themes&#8221;.'); ?></p>
349
+<p><?php printf(__('<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.'), __('https://codex.wordpress.org/Child_Themes')); ?></p>
350
+<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-themes" class="upgrade">
351 351
 <?php wp_nonce_field('upgrade-core'); ?>
352 352
 <p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e('Update Themes'); ?>" name="upgrade" /></p>
353 353
 <table class="widefat updates-table" id="update-themes-table">
354 354
 	<thead>
355 355
 	<tr>
356 356
 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
357
-		<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
357
+		<td class="manage-column"><label for="themes-select-all"><?php _e('Select All'); ?></label></td>
358 358
 	</tr>
359 359
 	</thead>
360 360
 
361 361
 	<tbody class="plugins">
362 362
 <?php
363
-	foreach ( $themes as $stylesheet => $theme ) {
364
-		$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
363
+	foreach ($themes as $stylesheet => $theme) {
364
+		$checkbox_id = 'checkbox_'.md5($theme->get('Name'));
365 365
 		?>
366 366
 		<tr>
367 367
 			<td class="check-column">
368
-				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
368
+				<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr($stylesheet); ?>" />
369 369
 				<label for="<?php echo $checkbox_id; ?>" class="screen-reader-text"><?php
370 370
 					/* translators: %s: theme name */
371
-					printf( __( 'Select %s' ),
372
-						$theme->display( 'Name' )
371
+					printf(__('Select %s'),
372
+						$theme->display('Name')
373 373
 					);
374 374
 				?></label>
375 375
 			</td>
376 376
 			<td class="plugin-title"><p>
377
-				<img src="<?php echo esc_url( $theme->get_screenshot() ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
378
-				<strong><?php echo $theme->display( 'Name' ); ?></strong>
377
+				<img src="<?php echo esc_url($theme->get_screenshot()); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
378
+				<strong><?php echo $theme->display('Name'); ?></strong>
379 379
 				<?php
380 380
 					/* translators: 1: theme version, 2: new version */
381
-					printf( __( 'You have version %1$s installed. Update to %2$s.' ),
382
-						$theme->display( 'Version' ),
381
+					printf(__('You have version %1$s installed. Update to %2$s.'),
382
+						$theme->display('Version'),
383 383
 						$theme->update['new_version']
384 384
 					);
385 385
 				?>
@@ -393,7 +393,7 @@  discard block
 block discarded – undo
393 393
 	<tfoot>
394 394
 	<tr>
395 395
 		<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
396
-		<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
396
+		<td class="manage-column"><label for="themes-select-all-2"><?php _e('Select All'); ?></label></td>
397 397
 	</tr>
398 398
 	</tfoot>
399 399
 </table>
@@ -407,21 +407,21 @@  discard block
 block discarded – undo
407 407
  */
408 408
 function list_translation_updates() {
409 409
 	$updates = wp_get_translation_updates();
410
-	if ( ! $updates ) {
411
-		if ( 'en_US' != get_locale() ) {
412
-			echo '<h2>' . __( 'Translations' ) . '</h2>';
413
-			echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
410
+	if ( ! $updates) {
411
+		if ('en_US' != get_locale()) {
412
+			echo '<h2>'.__('Translations').'</h2>';
413
+			echo '<p>'.__('Your translations are all up to date.').'</p>';
414 414
 		}
415 415
 		return;
416 416
 	}
417 417
 
418 418
 	$form_action = 'update-core.php?action=do-translation-upgrade';
419 419
 	?>
420
-	<h2><?php _e( 'Translations' ); ?></h2>
421
-	<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
422
-		<p><?php _e( 'New translations are available.' ); ?></p>
423
-		<?php wp_nonce_field( 'upgrade-translations' ); ?>
424
-		<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
420
+	<h2><?php _e('Translations'); ?></h2>
421
+	<form method="post" action="<?php echo esc_url($form_action); ?>" name="upgrade-translations" class="upgrade">
422
+		<p><?php _e('New translations are available.'); ?></p>
423
+		<?php wp_nonce_field('upgrade-translations'); ?>
424
+		<p><input class="button" type="submit" value="<?php esc_attr_e('Update Translations'); ?>" name="upgrade" /></p>
425 425
 	</form>
426 426
 	<?php
427 427
 }
@@ -435,76 +435,76 @@  discard block
 block discarded – undo
435 435
  *
436 436
  * @param bool $reinstall
437 437
  */
438
-function do_core_upgrade( $reinstall = false ) {
438
+function do_core_upgrade($reinstall = false) {
439 439
 	global $wp_filesystem;
440 440
 
441
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
441
+	include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
442 442
 
443
-	if ( $reinstall )
443
+	if ($reinstall)
444 444
 		$url = 'update-core.php?action=do-core-reinstall';
445 445
 	else
446 446
 		$url = 'update-core.php?action=do-core-upgrade';
447 447
 	$url = wp_nonce_url($url, 'upgrade-core');
448 448
 
449
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
450
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
451
-	$update = find_core_update( $version, $locale );
452
-	if ( !$update )
449
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
450
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
451
+	$update = find_core_update($version, $locale);
452
+	if ( ! $update)
453 453
 		return;
454 454
 
455 455
 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
456 456
 	// that it's safe to do so. This only happens when there are no new files to create.
457
-	$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
457
+	$allow_relaxed_file_ownership = ! $reinstall && isset($update->new_files) && ! $update->new_files;
458 458
 
459 459
 ?>
460 460
 	<div class="wrap">
461
-	<h1><?php _e( 'Update WordPress' ); ?></h1>
461
+	<h1><?php _e('Update WordPress'); ?></h1>
462 462
 <?php
463 463
 
464
-	if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) {
464
+	if (false === ($credentials = request_filesystem_credentials($url, '', false, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership))) {
465 465
 		echo '</div>';
466 466
 		return;
467 467
 	}
468 468
 
469
-	if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
469
+	if ( ! WP_Filesystem($credentials, ABSPATH, $allow_relaxed_file_ownership)) {
470 470
 		// Failed to connect, Error and request again
471
-		request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
471
+		request_filesystem_credentials($url, '', true, ABSPATH, array('version', 'locale'), $allow_relaxed_file_ownership);
472 472
 		echo '</div>';
473 473
 		return;
474 474
 	}
475 475
 
476
-	if ( $wp_filesystem->errors->get_error_code() ) {
477
-		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
476
+	if ($wp_filesystem->errors->get_error_code()) {
477
+		foreach ($wp_filesystem->errors->get_error_messages() as $message)
478 478
 			show_message($message);
479 479
 		echo '</div>';
480 480
 		return;
481 481
 	}
482 482
 
483
-	if ( $reinstall )
483
+	if ($reinstall)
484 484
 		$update->response = 'reinstall';
485 485
 
486
-	add_filter( 'update_feedback', 'show_message' );
486
+	add_filter('update_feedback', 'show_message');
487 487
 
488 488
 	$upgrader = new Core_Upgrader();
489
-	$result = $upgrader->upgrade( $update, array(
489
+	$result = $upgrader->upgrade($update, array(
490 490
 		'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership
491
-	) );
491
+	));
492 492
 
493
-	if ( is_wp_error($result) ) {
493
+	if (is_wp_error($result)) {
494 494
 		show_message($result);
495
-		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
496
-			show_message( __('Installation Failed') );
495
+		if ('up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code())
496
+			show_message(__('Installation Failed'));
497 497
 		echo '</div>';
498 498
 		return;
499 499
 	}
500 500
 
501
-	show_message( __('WordPress updated successfully') );
502
-	show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
503
-	show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $result, esc_url( self_admin_url( 'about.php?updated' ) ) ) . '</span>' );
501
+	show_message(__('WordPress updated successfully'));
502
+	show_message('<span class="hide-if-no-js">'.sprintf(__('Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>');
503
+	show_message('<span class="hide-if-js">'.sprintf(__('Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.'), $result, esc_url(self_admin_url('about.php?updated'))).'</span>');
504 504
 	?>
505 505
 	</div>
506 506
 	<script type="text/javascript">
507
-	window.location = '<?php echo self_admin_url( 'about.php?updated' ); ?>';
507
+	window.location = '<?php echo self_admin_url('about.php?updated'); ?>';
508 508
 	</script>
509 509
 	<?php
510 510
 }
@@ -513,13 +513,13 @@  discard block
 block discarded – undo
513 513
  * @since 2.7.0
514 514
  */
515 515
 function do_dismiss_core_update() {
516
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
517
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
518
-	$update = find_core_update( $version, $locale );
519
-	if ( !$update )
516
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
517
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
518
+	$update = find_core_update($version, $locale);
519
+	if ( ! $update)
520 520
 		return;
521
-	dismiss_core_update( $update );
522
-	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
521
+	dismiss_core_update($update);
522
+	wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core'));
523 523
 	exit;
524 524
 }
525 525
 
@@ -527,21 +527,21 @@  discard block
 block discarded – undo
527 527
  * @since 2.7.0
528 528
  */
529 529
 function do_undismiss_core_update() {
530
-	$version = isset( $_POST['version'] )? $_POST['version'] : false;
531
-	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
532
-	$update = find_core_update( $version, $locale );
533
-	if ( !$update )
530
+	$version = isset($_POST['version']) ? $_POST['version'] : false;
531
+	$locale = isset($_POST['locale']) ? $_POST['locale'] : 'en_US';
532
+	$update = find_core_update($version, $locale);
533
+	if ( ! $update)
534 534
 		return;
535
-	undismiss_core_update( $version, $locale );
536
-	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
535
+	undismiss_core_update($version, $locale);
536
+	wp_redirect(wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core'));
537 537
 	exit;
538 538
 }
539 539
 
540 540
 $action = isset($_GET['action']) ? $_GET['action'] : 'upgrade-core';
541 541
 
542 542
 $upgrade_error = false;
543
-if ( ( 'do-theme-upgrade' == $action || ( 'do-plugin-upgrade' == $action && ! isset( $_GET['plugins'] ) ) )
544
-	&& ! isset( $_POST['checked'] ) ) {
543
+if (('do-theme-upgrade' == $action || ('do-plugin-upgrade' == $action && ! isset($_GET['plugins'])))
544
+	&& ! isset($_POST['checked'])) {
545 545
 	$upgrade_error = $action == 'do-theme-upgrade' ? 'themes' : 'plugins';
546 546
 	$action = 'upgrade-core';
547 547
 }
@@ -549,47 +549,47 @@  discard block
 block discarded – undo
549 549
 $title = __('WordPress Updates');
550 550
 $parent_file = 'index.php';
551 551
 
552
-$updates_overview  = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
553
-$updates_overview .= '<p>' . __( 'If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
552
+$updates_overview  = '<p>'.__('On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.').'</p>';
553
+$updates_overview .= '<p>'.__('If an update is available, you&#8127;ll see a notification appear in the Toolbar and navigation menu.').' '.__('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.').'</p>';
554 554
 
555
-get_current_screen()->add_help_tab( array(
555
+get_current_screen()->add_help_tab(array(
556 556
 	'id'      => 'overview',
557
-	'title'   => __( 'Overview' ),
557
+	'title'   => __('Overview'),
558 558
 	'content' => $updates_overview
559
-) );
559
+));
560 560
 
561
-$updates_howto  = '<p>' . __( '<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.' ) . ' ' . __( 'In most cases, WordPress will automatically apply maintenance and security updates in the background for you.' ) . '</p>';
562
-$updates_howto .= '<p>' . __( '<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.' ) . '</p>';
561
+$updates_howto  = '<p>'.__('<strong>WordPress</strong> &mdash; Updating your WordPress installation is a simple one-click procedure: just <strong>click on the &#8220;Update Now&#8221; button</strong> when you are notified that a new version is available.').' '.__('In most cases, WordPress will automatically apply maintenance and security updates in the background for you.').'</p>';
562
+$updates_howto .= '<p>'.__('<strong>Themes and Plugins</strong> &mdash; To update individual themes or plugins from this screen, use the checkboxes to make your selection, then <strong>click on the appropriate &#8220;Update&#8221; button</strong>. To update all of your themes or plugins at once, you can check the box at the top of the section to select all before clicking the update button.').'</p>';
563 563
 
564
-if ( 'en_US' != get_locale() ) {
565
-	$updates_howto .= '<p>' . __( '<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.' ) . '</p>';
564
+if ('en_US' != get_locale()) {
565
+	$updates_howto .= '<p>'.__('<strong>Translations</strong> &mdash; The files translating WordPress into your language are updated for you whenever any other updates occur. But if these files are out of date, you can <strong>click the &#8220;Update Translations&#8221;</strong> button.').'</p>';
566 566
 }
567 567
 
568
-get_current_screen()->add_help_tab( array(
568
+get_current_screen()->add_help_tab(array(
569 569
 	'id'      => 'how-to-update',
570
-	'title'   => __( 'How to Update' ),
570
+	'title'   => __('How to Update'),
571 571
 	'content' => $updates_howto
572
-) );
572
+));
573 573
 
574 574
 get_current_screen()->set_help_sidebar(
575
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
576
-	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>' ) . '</p>' .
577
-	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
575
+	'<p><strong>'.__('For more information:').'</strong></p>'.
576
+	'<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Updates_Screen" target="_blank">Documentation on Updating WordPress</a>').'</p>'.
577
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
578 578
 );
579 579
 
580
-if ( 'upgrade-core' == $action ) {
580
+if ('upgrade-core' == $action) {
581 581
 	// Force a update check when requested
582
-	$force_check = ! empty( $_GET['force-check'] );
583
-	wp_version_check( array(), $force_check );
582
+	$force_check = ! empty($_GET['force-check']);
583
+	wp_version_check(array(), $force_check);
584 584
 
585
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
585
+	require_once(ABSPATH.'wp-admin/admin-header.php');
586 586
 	?>
587 587
 	<div class="wrap">
588
-	<h1><?php _e( 'WordPress Updates' ); ?></h1>
588
+	<h1><?php _e('WordPress Updates'); ?></h1>
589 589
 	<?php
590
-	if ( $upgrade_error ) {
590
+	if ($upgrade_error) {
591 591
 		echo '<div class="error"><p>';
592
-		if ( $upgrade_error == 'themes' )
592
+		if ($upgrade_error == 'themes')
593 593
 			_e('Please select one or more themes to update.');
594 594
 		else
595 595
 			_e('Please select one or more plugins to update.');
@@ -598,129 +598,129 @@  discard block
 block discarded – undo
598 598
 
599 599
 	echo '<p>';
600 600
 	/* translators: %1 date, %2 time. */
601
-	printf( __( 'Last checked on %1$s at %2$s.' ), date_i18n( __( 'F j, Y' ) ), date_i18n( __( 'g:i a' ) ) );
602
-	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
601
+	printf(__('Last checked on %1$s at %2$s.'), date_i18n(__('F j, Y')), date_i18n(__('g:i a')));
602
+	echo ' &nbsp; <a class="button" href="'.esc_url(self_admin_url('update-core.php?force-check=1')).'">'.__('Check Again').'</a>';
603 603
 	echo '</p>';
604 604
 
605
-	if ( $core = current_user_can( 'update_core' ) )
605
+	if ($core = current_user_can('update_core'))
606 606
 		core_upgrade_preamble();
607
-	if ( $plugins = current_user_can( 'update_plugins' ) )
607
+	if ($plugins = current_user_can('update_plugins'))
608 608
 		list_plugin_updates();
609
-	if ( $themes = current_user_can( 'update_themes' ) )
609
+	if ($themes = current_user_can('update_themes'))
610 610
 		list_theme_updates();
611
-	if ( $core || $plugins || $themes )
611
+	if ($core || $plugins || $themes)
612 612
 		list_translation_updates();
613
-	unset( $core, $plugins, $themes );
613
+	unset($core, $plugins, $themes);
614 614
 	/**
615 615
 	 * Fires after the core, plugin, and theme update tables.
616 616
 	 *
617 617
 	 * @since 2.9.0
618 618
 	 */
619
-	do_action( 'core_upgrade_preamble' );
619
+	do_action('core_upgrade_preamble');
620 620
 	echo '</div>';
621
-	include(ABSPATH . 'wp-admin/admin-footer.php');
621
+	include(ABSPATH.'wp-admin/admin-footer.php');
622 622
 
623
-} elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
623
+} elseif ('do-core-upgrade' == $action || 'do-core-reinstall' == $action) {
624 624
 
625
-	if ( ! current_user_can( 'update_core' ) )
626
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
625
+	if ( ! current_user_can('update_core'))
626
+		wp_die(__('Sorry, you are not allowed to update this site.'));
627 627
 
628 628
 	check_admin_referer('upgrade-core');
629 629
 
630 630
 	// Do the (un)dismiss actions before headers, so that they can redirect.
631
-	if ( isset( $_POST['dismiss'] ) )
631
+	if (isset($_POST['dismiss']))
632 632
 		do_dismiss_core_update();
633
-	elseif ( isset( $_POST['undismiss'] ) )
633
+	elseif (isset($_POST['undismiss']))
634 634
 		do_undismiss_core_update();
635 635
 
636
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
637
-	if ( 'do-core-reinstall' == $action )
636
+	require_once(ABSPATH.'wp-admin/admin-header.php');
637
+	if ('do-core-reinstall' == $action)
638 638
 		$reinstall = true;
639 639
 	else
640 640
 		$reinstall = false;
641 641
 
642
-	if ( isset( $_POST['upgrade'] ) )
642
+	if (isset($_POST['upgrade']))
643 643
 		do_core_upgrade($reinstall);
644 644
 
645
-	include(ABSPATH . 'wp-admin/admin-footer.php');
645
+	include(ABSPATH.'wp-admin/admin-footer.php');
646 646
 
647
-} elseif ( 'do-plugin-upgrade' == $action ) {
647
+} elseif ('do-plugin-upgrade' == $action) {
648 648
 
649
-	if ( ! current_user_can( 'update_plugins' ) )
650
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
649
+	if ( ! current_user_can('update_plugins'))
650
+		wp_die(__('Sorry, you are not allowed to update this site.'));
651 651
 
652 652
 	check_admin_referer('upgrade-core');
653 653
 
654
-	if ( isset( $_GET['plugins'] ) ) {
655
-		$plugins = explode( ',', $_GET['plugins'] );
656
-	} elseif ( isset( $_POST['checked'] ) ) {
654
+	if (isset($_GET['plugins'])) {
655
+		$plugins = explode(',', $_GET['plugins']);
656
+	} elseif (isset($_POST['checked'])) {
657 657
 		$plugins = (array) $_POST['checked'];
658 658
 	} else {
659
-		wp_redirect( admin_url('update-core.php') );
659
+		wp_redirect(admin_url('update-core.php'));
660 660
 		exit;
661 661
 	}
662 662
 
663
-	$url = 'update.php?action=update-selected&plugins=' . urlencode(implode(',', $plugins));
663
+	$url = 'update.php?action=update-selected&plugins='.urlencode(implode(',', $plugins));
664 664
 	$url = wp_nonce_url($url, 'bulk-update-plugins');
665 665
 
666 666
 	$title = __('Update Plugins');
667 667
 
668
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
668
+	require_once(ABSPATH.'wp-admin/admin-header.php');
669 669
 	echo '<div class="wrap">';
670
-	echo '<h1>' . __( 'Update Plugins' ) . '</h1>';
671
-	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="' . esc_attr__( 'Update progress' ) . '"></iframe>';
670
+	echo '<h1>'.__('Update Plugins').'</h1>';
671
+	echo '<iframe src="', $url, '" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="'.esc_attr__('Update progress').'"></iframe>';
672 672
 	echo '</div>';
673
-	include(ABSPATH . 'wp-admin/admin-footer.php');
673
+	include(ABSPATH.'wp-admin/admin-footer.php');
674 674
 
675
-} elseif ( 'do-theme-upgrade' == $action ) {
675
+} elseif ('do-theme-upgrade' == $action) {
676 676
 
677
-	if ( ! current_user_can( 'update_themes' ) )
678
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
677
+	if ( ! current_user_can('update_themes'))
678
+		wp_die(__('Sorry, you are not allowed to update this site.'));
679 679
 
680 680
 	check_admin_referer('upgrade-core');
681 681
 
682
-	if ( isset( $_GET['themes'] ) ) {
683
-		$themes = explode( ',', $_GET['themes'] );
684
-	} elseif ( isset( $_POST['checked'] ) ) {
682
+	if (isset($_GET['themes'])) {
683
+		$themes = explode(',', $_GET['themes']);
684
+	} elseif (isset($_POST['checked'])) {
685 685
 		$themes = (array) $_POST['checked'];
686 686
 	} else {
687
-		wp_redirect( admin_url('update-core.php') );
687
+		wp_redirect(admin_url('update-core.php'));
688 688
 		exit;
689 689
 	}
690 690
 
691
-	$url = 'update.php?action=update-selected-themes&themes=' . urlencode(implode(',', $themes));
691
+	$url = 'update.php?action=update-selected-themes&themes='.urlencode(implode(',', $themes));
692 692
 	$url = wp_nonce_url($url, 'bulk-update-themes');
693 693
 
694 694
 	$title = __('Update Themes');
695 695
 
696
-	require_once(ABSPATH . 'wp-admin/admin-header.php');
696
+	require_once(ABSPATH.'wp-admin/admin-header.php');
697 697
 	?>
698 698
 	<div class="wrap">
699
-		<h1><?php _e( 'Update Themes' ); ?></h1>
700
-		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e( 'Update progress' ); ?>"></iframe>
699
+		<h1><?php _e('Update Themes'); ?></h1>
700
+		<iframe src="<?php echo $url ?>" style="width: 100%; height: 100%; min-height: 750px;" frameborder="0" title="<?php esc_attr_e('Update progress'); ?>"></iframe>
701 701
 	</div>
702 702
 	<?php
703
-	include(ABSPATH . 'wp-admin/admin-footer.php');
703
+	include(ABSPATH.'wp-admin/admin-footer.php');
704 704
 
705
-} elseif ( 'do-translation-upgrade' == $action ) {
705
+} elseif ('do-translation-upgrade' == $action) {
706 706
 
707
-	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
708
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
707
+	if ( ! current_user_can('update_core') && ! current_user_can('update_plugins') && ! current_user_can('update_themes'))
708
+		wp_die(__('Sorry, you are not allowed to update this site.'));
709 709
 
710
-	check_admin_referer( 'upgrade-translations' );
710
+	check_admin_referer('upgrade-translations');
711 711
 
712
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
713
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
712
+	require_once(ABSPATH.'wp-admin/admin-header.php');
713
+	include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
714 714
 
715 715
 	$url = 'update-core.php?action=do-translation-upgrade';
716 716
 	$nonce = 'upgrade-translations';
717
-	$title = __( 'Update Translations' );
717
+	$title = __('Update Translations');
718 718
 	$context = WP_LANG_DIR;
719 719
 
720
-	$upgrader = new Language_Pack_Upgrader( new Language_Pack_Upgrader_Skin( compact( 'url', 'nonce', 'title', 'context' ) ) );
720
+	$upgrader = new Language_Pack_Upgrader(new Language_Pack_Upgrader_Skin(compact('url', 'nonce', 'title', 'context')));
721 721
 	$result = $upgrader->bulk_upgrade();
722 722
 
723
-	require_once( ABSPATH . 'wp-admin/admin-footer.php' );
723
+	require_once(ABSPATH.'wp-admin/admin-footer.php');
724 724
 
725 725
 } else {
726 726
 	/**
@@ -732,5 +732,5 @@  discard block
 block discarded – undo
732 732
 	 *
733 733
 	 * @since 3.2.0
734 734
 	 */
735
-	do_action( "update-core-custom_{$action}" );
735
+	do_action("update-core-custom_{$action}");
736 736
 }
Please login to merge, or discard this patch.
Braces   +112 added lines, -82 removed lines patch added patch discarded remove patch
@@ -19,8 +19,9 @@  discard block
 block discarded – undo
19 19
 	exit();
20 20
 }
21 21
 
22
-if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) )
22
+if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_themes' ) && ! current_user_can( 'update_plugins' ) ) {
23 23
 	wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
24
+}
24 25
 
25 26
 /**
26 27
  *
@@ -36,17 +37,20 @@  discard block
 block discarded – undo
36 37
  	global $wp_local_package, $wpdb, $wp_version;
37 38
   	static $first_pass = true;
38 39
 
39
- 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() )
40
- 		$version_string = $update->current;
40
+ 	if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) {
41
+ 	 		$version_string = $update->current;
42
+ 	}
41 43
  	// If the only available update is a partial builds, it doesn't need a language-specific version string.
42
- 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) )
43
- 		$version_string = $update->current;
44
- 	else
45
- 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
44
+ 	elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) {
45
+ 	 		$version_string = $update->current;
46
+ 	} else {
47
+ 	 		$version_string = sprintf( "%s&ndash;<strong>%s</strong>", $update->current, $update->locale );
48
+ 	}
46 49
 
47 50
 	$current = false;
48
-	if ( !isset($update->response) || 'latest' == $update->response )
49
-		$current = true;
51
+	if ( !isset($update->response) || 'latest' == $update->response ) {
52
+			$current = true;
53
+	}
50 54
 	$submit = __('Update Now');
51 55
 	$form_action = 'update-core.php?action=do-core-upgrade';
52 56
 	$php_version    = phpversion();
@@ -62,21 +66,24 @@  discard block
 block discarded – undo
62 66
 			$form_action = 'update-core.php?action=do-core-reinstall';
63 67
 		} else {
64 68
 			$php_compat     = version_compare( $php_version, $update->php_version, '>=' );
65
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
66
-				$mysql_compat = true;
67
-			else
68
-				$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
69
-
70
-			if ( !$mysql_compat && !$php_compat )
71
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
72
-			elseif ( !$php_compat )
73
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
74
-			elseif ( !$mysql_compat )
75
-				$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
76
-			else
77
-				$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
78
-			if ( !$mysql_compat || !$php_compat )
79
-				$show_buttons = false;
69
+			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
70
+							$mysql_compat = true;
71
+			} else {
72
+							$mysql_compat = version_compare( $mysql_version, $update->mysql_version, '>=' );
73
+			}
74
+
75
+			if ( !$mysql_compat && !$php_compat ) {
76
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $update->current, $update->php_version, $update->mysql_version, $php_version, $mysql_version );
77
+			} elseif ( !$php_compat ) {
78
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $update->current, $update->php_version, $php_version );
79
+			} elseif ( !$mysql_compat ) {
80
+							$message = sprintf( __('You cannot update because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $update->current, $update->mysql_version, $mysql_version );
81
+			} else {
82
+							$message = 	sprintf(__('You can update to <a href="https://codex.wordpress.org/Version_%1$s">WordPress %2$s</a> automatically or download the package and install it manually:'), $update->current, $version_string);
83
+			}
84
+			if ( !$mysql_compat || !$php_compat ) {
85
+							$show_buttons = false;
86
+			}
80 87
 		}
81 88
 		$download = sprintf(__('Download %s'), $version_string);
82 89
 	}
@@ -98,14 +105,16 @@  discard block
 block discarded – undo
98 105
 		}
99 106
 		echo '&nbsp;<a href="' . esc_url( $update->download ) . '" class="button">' . $download . '</a>&nbsp;';
100 107
 	}
101
-	if ( 'en_US' != $update->locale )
102
-		if ( !isset( $update->dismissed ) || !$update->dismissed )
108
+	if ( 'en_US' != $update->locale ) {
109
+			if ( !isset( $update->dismissed ) || !$update->dismissed )
103 110
 			submit_button( __('Hide this update'), 'button', 'dismiss', false );
104
-		else
105
-			submit_button( __('Bring back this update'), 'button', 'undismiss', false );
111
+	} else {
112
+					submit_button( __('Bring back this update'), 'button', 'undismiss', false );
113
+		}
106 114
 	echo '</p>';
107
-	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) )
108
-	    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
115
+	if ( 'en_US' != $update->locale && ( !isset($wp_local_package) || $wp_local_package != $update->locale ) ) {
116
+		    echo '<p class="hint">'.__('This localized version contains both the translation and various other localization fixes. You can skip upgrading if you want to keep your current translation.').'</p>';
117
+	}
109 118
 	// Partial builds don't need language-specific warnings.
110 119
 	elseif ( 'en_US' == $update->locale && get_locale() != 'en_US' && ( ! $update->packages->partial && $wp_version == $update->partial_version ) ) {
111 120
 	    echo '<p class="hint">'.sprintf( __('You are about to install WordPress %s <strong>in English (US).</strong> There is a chance this update will break your translation. You may prefer to wait for the localized version to be released.'), $update->response != 'development' ? $update->current : '' ).'</p>';
@@ -172,8 +181,9 @@  discard block
 block discarded – undo
172 181
 				'mysql_version' => $required_mysql_version,
173 182
 			);
174 183
 			$should_auto_update = $upgrader->should_update( 'core', $future_minor_update, ABSPATH );
175
-			if ( $should_auto_update )
176
-				echo ' ' . __( 'Future security updates will be applied automatically.' );
184
+			if ( $should_auto_update ) {
185
+							echo ' ' . __( 'Future security updates will be applied automatically.' );
186
+			}
177 187
 		}
178 188
 		echo '</h2>';
179 189
 	} else {
@@ -232,10 +242,11 @@  discard block
 block discarded – undo
232 242
 	$form_action = 'update-core.php?action=do-plugin-upgrade';
233 243
 
234 244
 	$core_updates = get_core_updates();
235
-	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') )
236
-		$core_update_version = false;
237
-	else
238
-		$core_update_version = $core_updates[0]->current;
245
+	if ( !isset($core_updates[0]->response) || 'latest' == $core_updates[0]->response || 'development' == $core_updates[0]->response || version_compare( $core_updates[0]->current, $cur_wp_version, '=') ) {
246
+			$core_update_version = false;
247
+	} else {
248
+			$core_update_version = $core_updates[0]->current;
249
+	}
239 250
 	?>
240 251
 <h2><?php _e( 'Plugins' ); ?></h2>
241 252
 <p><?php _e( 'The following plugins have new versions available. Check the ones you want to update and then click &#8220;Update Plugins&#8221;.' ); ?></p>
@@ -440,17 +451,19 @@  discard block
 block discarded – undo
440 451
 
441 452
 	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
442 453
 
443
-	if ( $reinstall )
444
-		$url = 'update-core.php?action=do-core-reinstall';
445
-	else
446
-		$url = 'update-core.php?action=do-core-upgrade';
454
+	if ( $reinstall ) {
455
+			$url = 'update-core.php?action=do-core-reinstall';
456
+	} else {
457
+			$url = 'update-core.php?action=do-core-upgrade';
458
+	}
447 459
 	$url = wp_nonce_url($url, 'upgrade-core');
448 460
 
449 461
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
450 462
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
451 463
 	$update = find_core_update( $version, $locale );
452
-	if ( !$update )
453
-		return;
464
+	if ( !$update ) {
465
+			return;
466
+	}
454 467
 
455 468
 	// Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
456 469
 	// that it's safe to do so. This only happens when there are no new files to create.
@@ -474,14 +487,16 @@  discard block
 block discarded – undo
474 487
 	}
475 488
 
476 489
 	if ( $wp_filesystem->errors->get_error_code() ) {
477
-		foreach ( $wp_filesystem->errors->get_error_messages() as $message )
478
-			show_message($message);
490
+		foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
491
+					show_message($message);
492
+		}
479 493
 		echo '</div>';
480 494
 		return;
481 495
 	}
482 496
 
483
-	if ( $reinstall )
484
-		$update->response = 'reinstall';
497
+	if ( $reinstall ) {
498
+			$update->response = 'reinstall';
499
+	}
485 500
 
486 501
 	add_filter( 'update_feedback', 'show_message' );
487 502
 
@@ -492,8 +507,9 @@  discard block
 block discarded – undo
492 507
 
493 508
 	if ( is_wp_error($result) ) {
494 509
 		show_message($result);
495
-		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() )
496
-			show_message( __('Installation Failed') );
510
+		if ( 'up_to_date' != $result->get_error_code() && 'locked' != $result->get_error_code() ) {
511
+					show_message( __('Installation Failed') );
512
+		}
497 513
 		echo '</div>';
498 514
 		return;
499 515
 	}
@@ -516,8 +532,9 @@  discard block
 block discarded – undo
516 532
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
517 533
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
518 534
 	$update = find_core_update( $version, $locale );
519
-	if ( !$update )
520
-		return;
535
+	if ( !$update ) {
536
+			return;
537
+	}
521 538
 	dismiss_core_update( $update );
522 539
 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
523 540
 	exit;
@@ -530,8 +547,9 @@  discard block
 block discarded – undo
530 547
 	$version = isset( $_POST['version'] )? $_POST['version'] : false;
531 548
 	$locale = isset( $_POST['locale'] )? $_POST['locale'] : 'en_US';
532 549
 	$update = find_core_update( $version, $locale );
533
-	if ( !$update )
534
-		return;
550
+	if ( !$update ) {
551
+			return;
552
+	}
535 553
 	undismiss_core_update( $version, $locale );
536 554
 	wp_redirect( wp_nonce_url('update-core.php?action=upgrade-core', 'upgrade-core') );
537 555
 	exit;
@@ -589,10 +607,11 @@  discard block
 block discarded – undo
589 607
 	<?php
590 608
 	if ( $upgrade_error ) {
591 609
 		echo '<div class="error"><p>';
592
-		if ( $upgrade_error == 'themes' )
593
-			_e('Please select one or more themes to update.');
594
-		else
595
-			_e('Please select one or more plugins to update.');
610
+		if ( $upgrade_error == 'themes' ) {
611
+					_e('Please select one or more themes to update.');
612
+		} else {
613
+					_e('Please select one or more plugins to update.');
614
+		}
596 615
 		echo '</p></div>';
597 616
 	}
598 617
 
@@ -602,14 +621,18 @@  discard block
 block discarded – undo
602 621
 	echo ' &nbsp; <a class="button" href="' . esc_url( self_admin_url('update-core.php?force-check=1') ) . '">' . __( 'Check Again' ) . '</a>';
603 622
 	echo '</p>';
604 623
 
605
-	if ( $core = current_user_can( 'update_core' ) )
606
-		core_upgrade_preamble();
607
-	if ( $plugins = current_user_can( 'update_plugins' ) )
608
-		list_plugin_updates();
609
-	if ( $themes = current_user_can( 'update_themes' ) )
610
-		list_theme_updates();
611
-	if ( $core || $plugins || $themes )
612
-		list_translation_updates();
624
+	if ( $core = current_user_can( 'update_core' ) ) {
625
+			core_upgrade_preamble();
626
+	}
627
+	if ( $plugins = current_user_can( 'update_plugins' ) ) {
628
+			list_plugin_updates();
629
+	}
630
+	if ( $themes = current_user_can( 'update_themes' ) ) {
631
+			list_theme_updates();
632
+	}
633
+	if ( $core || $plugins || $themes ) {
634
+			list_translation_updates();
635
+	}
613 636
 	unset( $core, $plugins, $themes );
614 637
 	/**
615 638
 	 * Fires after the core, plugin, and theme update tables.
@@ -622,32 +645,37 @@  discard block
 block discarded – undo
622 645
 
623 646
 } elseif ( 'do-core-upgrade' == $action || 'do-core-reinstall' == $action ) {
624 647
 
625
-	if ( ! current_user_can( 'update_core' ) )
626
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
648
+	if ( ! current_user_can( 'update_core' ) ) {
649
+			wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
650
+	}
627 651
 
628 652
 	check_admin_referer('upgrade-core');
629 653
 
630 654
 	// Do the (un)dismiss actions before headers, so that they can redirect.
631
-	if ( isset( $_POST['dismiss'] ) )
632
-		do_dismiss_core_update();
633
-	elseif ( isset( $_POST['undismiss'] ) )
634
-		do_undismiss_core_update();
655
+	if ( isset( $_POST['dismiss'] ) ) {
656
+			do_dismiss_core_update();
657
+	} elseif ( isset( $_POST['undismiss'] ) ) {
658
+			do_undismiss_core_update();
659
+	}
635 660
 
636 661
 	require_once(ABSPATH . 'wp-admin/admin-header.php');
637
-	if ( 'do-core-reinstall' == $action )
638
-		$reinstall = true;
639
-	else
640
-		$reinstall = false;
662
+	if ( 'do-core-reinstall' == $action ) {
663
+			$reinstall = true;
664
+	} else {
665
+			$reinstall = false;
666
+	}
641 667
 
642
-	if ( isset( $_POST['upgrade'] ) )
643
-		do_core_upgrade($reinstall);
668
+	if ( isset( $_POST['upgrade'] ) ) {
669
+			do_core_upgrade($reinstall);
670
+	}
644 671
 
645 672
 	include(ABSPATH . 'wp-admin/admin-footer.php');
646 673
 
647 674
 } elseif ( 'do-plugin-upgrade' == $action ) {
648 675
 
649
-	if ( ! current_user_can( 'update_plugins' ) )
650
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
676
+	if ( ! current_user_can( 'update_plugins' ) ) {
677
+			wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
678
+	}
651 679
 
652 680
 	check_admin_referer('upgrade-core');
653 681
 
@@ -674,8 +702,9 @@  discard block
 block discarded – undo
674 702
 
675 703
 } elseif ( 'do-theme-upgrade' == $action ) {
676 704
 
677
-	if ( ! current_user_can( 'update_themes' ) )
678
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
705
+	if ( ! current_user_can( 'update_themes' ) ) {
706
+			wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
707
+	}
679 708
 
680 709
 	check_admin_referer('upgrade-core');
681 710
 
@@ -704,8 +733,9 @@  discard block
 block discarded – undo
704 733
 
705 734
 } elseif ( 'do-translation-upgrade' == $action ) {
706 735
 
707
-	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) )
708
-		wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
736
+	if ( ! current_user_can( 'update_core' ) && ! current_user_can( 'update_plugins' ) && ! current_user_can( 'update_themes' ) ) {
737
+			wp_die( __( 'Sorry, you are not allowed to update this site.' ) );
738
+	}
709 739
 
710 740
 	check_admin_referer( 'upgrade-translations' );
711 741
 
Please login to merge, or discard this patch.