Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-admin/menu.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -174,8 +174,8 @@
 block discarded – undo
174 174
 	add_action('admin_menu', '_add_themes_utility_last', 101);
175 175
 }
176 176
 /**
177
- *
178
- */
177
+	 *
178
+	 */
179 179
 function _add_themes_utility_last() {
180 180
 	// Must use API on the admin_menu hook, direct modification is only possible on/before the _admin_menu hook
181 181
 	add_submenu_page('themes.php', _x('Editor', 'theme editor'), _x('Editor', 'theme editor'), 'edit_themes', 'theme-editor.php');
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -20,98 +20,98 @@  discard block
 block discarded – undo
20 20
  * @global array $menu
21 21
  */
22 22
 
23
-$menu[2] = array( __('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard' );
23
+$menu[2] = array(__('Dashboard'), 'read', 'index.php', '', 'menu-top menu-top-first menu-icon-dashboard', 'menu-dashboard', 'dashicons-dashboard');
24 24
 
25
-$submenu[ 'index.php' ][0] = array( __('Home'), 'read', 'index.php' );
25
+$submenu['index.php'][0] = array(__('Home'), 'read', 'index.php');
26 26
 
27
-if ( is_multisite() ) {
28
-	$submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
27
+if (is_multisite()) {
28
+	$submenu['index.php'][5] = array(__('My Sites'), 'read', 'my-sites.php');
29 29
 }
30 30
 
31
-if ( ! is_multisite() || is_super_admin() )
31
+if ( ! is_multisite() || is_super_admin())
32 32
 	$update_data = wp_get_update_data();
33 33
 
34
-if ( ! is_multisite() ) {
35
-	if ( current_user_can( 'update_core' ) )
34
+if ( ! is_multisite()) {
35
+	if (current_user_can('update_core'))
36 36
 		$cap = 'update_core';
37
-	elseif ( current_user_can( 'update_plugins' ) )
37
+	elseif (current_user_can('update_plugins'))
38 38
 		$cap = 'update_plugins';
39 39
 	else
40 40
 		$cap = 'update_themes';
41
-	$submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
42
-	unset( $cap );
41
+	$submenu['index.php'][10] = array(sprintf(__('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>".number_format_i18n($update_data['counts']['total'])."</span></span>"), $cap, 'update-core.php');
42
+	unset($cap);
43 43
 }
44 44
 
45
-$menu[4] = array( '', 'read', 'separator1', '', 'wp-menu-separator' );
45
+$menu[4] = array('', 'read', 'separator1', '', 'wp-menu-separator');
46 46
 
47
-$menu[5] = array( __('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'dashicons-admin-post' );
48
-	$submenu['edit.php'][5]  = array( __('All Posts'), 'edit_posts', 'edit.php' );
47
+$menu[5] = array(__('Posts'), 'edit_posts', 'edit.php', '', 'open-if-no-js menu-top menu-icon-post', 'menu-posts', 'dashicons-admin-post');
48
+	$submenu['edit.php'][5] = array(__('All Posts'), 'edit_posts', 'edit.php');
49 49
 	/* translators: add new post */
50
-	$submenu['edit.php'][10]  = array( _x('Add New', 'post'), get_post_type_object( 'post' )->cap->create_posts, 'post-new.php' );
50
+	$submenu['edit.php'][10] = array(_x('Add New', 'post'), get_post_type_object('post')->cap->create_posts, 'post-new.php');
51 51
 
52 52
 	$i = 15;
53
-	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
54
-		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
53
+	foreach (get_taxonomies(array(), 'objects') as $tax) {
54
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true))
55 55
 			continue;
56 56
 
57
-		$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
57
+		$submenu['edit.php'][$i++] = array(esc_attr($tax->labels->menu_name), $tax->cap->manage_terms, 'edit-tags.php?taxonomy='.$tax->name);
58 58
 	}
59 59
 	unset($tax);
60 60
 
61
-$menu[10] = array( __('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media' );
62
-	$submenu['upload.php'][5] = array( __('Library'), 'upload_files', 'upload.php');
61
+$menu[10] = array(__('Media'), 'upload_files', 'upload.php', '', 'menu-top menu-icon-media', 'menu-media', 'dashicons-admin-media');
62
+	$submenu['upload.php'][5] = array(__('Library'), 'upload_files', 'upload.php');
63 63
 	/* translators: add new file */
64
-	$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
65
-	foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
66
-		if ( ! $tax->show_ui || ! $tax->show_in_menu )
64
+	$submenu['upload.php'][10] = array(_x('Add New', 'file'), 'upload_files', 'media-new.php');
65
+	foreach (get_taxonomies_for_attachments('objects') as $tax) {
66
+		if ( ! $tax->show_ui || ! $tax->show_in_menu)
67 67
 			continue;
68 68
 
69
-		$submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
69
+		$submenu['upload.php'][$i++] = array(esc_attr($tax->labels->menu_name), $tax->cap->manage_terms, 'edit-tags.php?taxonomy='.$tax->name.'&amp;post_type=attachment');
70 70
 	}
71 71
 	unset($tax);
72 72
 
73
-$menu[15] = array( __('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links' );
74
-	$submenu['link-manager.php'][5] = array( _x('All Links', 'admin menu'), 'manage_links', 'link-manager.php' );
73
+$menu[15] = array(__('Links'), 'manage_links', 'link-manager.php', '', 'menu-top menu-icon-links', 'menu-links', 'dashicons-admin-links');
74
+	$submenu['link-manager.php'][5] = array(_x('All Links', 'admin menu'), 'manage_links', 'link-manager.php');
75 75
 	/* translators: add new links */
76
-	$submenu['link-manager.php'][10] = array( _x('Add New', 'link'), 'manage_links', 'link-add.php' );
77
-	$submenu['link-manager.php'][15] = array( __('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category' );
76
+	$submenu['link-manager.php'][10] = array(_x('Add New', 'link'), 'manage_links', 'link-add.php');
77
+	$submenu['link-manager.php'][15] = array(__('Link Categories'), 'manage_categories', 'edit-tags.php?taxonomy=link_category');
78 78
 
79
-$menu[20] = array( __('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'dashicons-admin-page' );
80
-	$submenu['edit.php?post_type=page'][5] = array( __('All Pages'), 'edit_pages', 'edit.php?post_type=page' );
79
+$menu[20] = array(__('Pages'), 'edit_pages', 'edit.php?post_type=page', '', 'menu-top menu-icon-page', 'menu-pages', 'dashicons-admin-page');
80
+	$submenu['edit.php?post_type=page'][5] = array(__('All Pages'), 'edit_pages', 'edit.php?post_type=page');
81 81
 	/* translators: add new page */
82
-	$submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
82
+	$submenu['edit.php?post_type=page'][10] = array(_x('Add New', 'page'), get_post_type_object('page')->cap->create_posts, 'post-new.php?post_type=page');
83 83
 	$i = 15;
84
-	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
85
-		if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) )
84
+	foreach (get_taxonomies(array(), 'objects') as $tax) {
85
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('page', (array) $tax->object_type, true))
86 86
 			continue;
87 87
 
88
-		$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=page' );
88
+		$submenu['edit.php?post_type=page'][$i++] = array(esc_attr($tax->labels->menu_name), $tax->cap->manage_terms, 'edit-tags.php?taxonomy='.$tax->name.'&amp;post_type=page');
89 89
 	}
90 90
 	unset($tax);
91 91
 
92 92
 $awaiting_mod = wp_count_comments();
93 93
 $awaiting_mod = $awaiting_mod->moderated;
94
-$menu[25] = array( sprintf( __('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'dashicons-admin-comments' );
94
+$menu[25] = array(sprintf(__('Comments %s'), "<span class='awaiting-mod count-$awaiting_mod'><span class='pending-count'>".number_format_i18n($awaiting_mod)."</span></span>"), 'edit_posts', 'edit-comments.php', '', 'menu-top menu-icon-comments', 'menu-comments', 'dashicons-admin-comments');
95 95
 unset($awaiting_mod);
96 96
 
97
-$submenu[ 'edit-comments.php' ][0] = array( __('All Comments'), 'edit_posts', 'edit-comments.php' );
97
+$submenu['edit-comments.php'][0] = array(__('All Comments'), 'edit_posts', 'edit-comments.php');
98 98
 
99 99
 $_wp_last_object_menu = 25; // The index of the last top-level menu in the object menu group
100 100
 
101
-foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) {
102
-	$ptype_obj = get_post_type_object( $ptype );
101
+foreach ((array) get_post_types(array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true)) as $ptype) {
102
+	$ptype_obj = get_post_type_object($ptype);
103 103
 	// Check if it should be a submenu.
104
-	if ( $ptype_obj->show_in_menu !== true )
104
+	if ($ptype_obj->show_in_menu !== true)
105 105
 		continue;
106
-	$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
107
-	$ptype_for_id = sanitize_html_class( $ptype );
106
+	$ptype_menu_position = is_int($ptype_obj->menu_position) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
107
+	$ptype_for_id = sanitize_html_class($ptype);
108 108
 
109
-	if ( is_string( $ptype_obj->menu_icon ) ) {
109
+	if (is_string($ptype_obj->menu_icon)) {
110 110
 		// Special handling for data:image/svg+xml and Dashicons.
111
-		if ( 0 === strpos( $ptype_obj->menu_icon, 'data:image/svg+xml;base64,' ) || 0 === strpos( $ptype_obj->menu_icon, 'dashicons-' ) ) {
111
+		if (0 === strpos($ptype_obj->menu_icon, 'data:image/svg+xml;base64,') || 0 === strpos($ptype_obj->menu_icon, 'dashicons-')) {
112 112
 			$menu_icon = $ptype_obj->menu_icon;
113 113
 		} else {
114
-			$menu_icon = esc_url( $ptype_obj->menu_icon );
114
+			$menu_icon = esc_url($ptype_obj->menu_icon);
115 115
 		}
116 116
 		$ptype_class = $ptype_for_id;
117 117
 	} else {
@@ -124,53 +124,53 @@  discard block
 block discarded – undo
124 124
 	 * by a hard-coded value below, increment the position.
125 125
 	 */
126 126
 	$core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
127
-	while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
127
+	while (isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions))
128 128
 		$ptype_menu_position++;
129 129
 
130
-	$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
131
-	$submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype");
132
-	$submenu["edit.php?post_type=$ptype"][10]  = array( $ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype" );
130
+	$menu[$ptype_menu_position] = array(esc_attr($ptype_obj->labels->menu_name), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-'.$ptype_class, 'menu-posts-'.$ptype_for_id, $menu_icon);
131
+	$submenu["edit.php?post_type=$ptype"][5] = array($ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
132
+	$submenu["edit.php?post_type=$ptype"][10] = array($ptype_obj->labels->add_new, $ptype_obj->cap->create_posts, "post-new.php?post_type=$ptype");
133 133
 
134 134
 	$i = 15;
135
-	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
136
-		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
135
+	foreach (get_taxonomies(array(), 'objects') as $tax) {
136
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true))
137 137
 			continue;
138 138
 
139
-		$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
139
+		$submenu["edit.php?post_type=$ptype"][$i++] = array(esc_attr($tax->labels->menu_name), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype");
140 140
 	}
141 141
 }
142 142
 unset($ptype, $ptype_obj, $ptype_class, $ptype_for_id, $ptype_menu_position, $menu_icon, $i, $tax);
143 143
 
144
-$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
144
+$menu[59] = array('', 'read', 'separator2', '', 'wp-menu-separator');
145 145
 
146
-$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
146
+$appearance_cap = current_user_can('switch_themes') ? 'switch_themes' : 'edit_theme_options';
147 147
 
148
-$menu[60] = array( __( 'Appearance' ), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance' );
149
-	$submenu['themes.php'][5] = array( __( 'Themes' ), $appearance_cap, 'themes.php' );
148
+$menu[60] = array(__('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'dashicons-admin-appearance');
149
+	$submenu['themes.php'][5] = array(__('Themes'), $appearance_cap, 'themes.php');
150 150
 
151
-	$customize_url = add_query_arg( 'return', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), 'customize.php' );
152
-	$submenu['themes.php'][6] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
151
+	$customize_url = add_query_arg('return', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), 'customize.php');
152
+	$submenu['themes.php'][6] = array(__('Customize'), 'customize', esc_url($customize_url), '', 'hide-if-no-customize');
153 153
 
154
-	if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
155
-		$submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
154
+	if (current_theme_supports('menus') || current_theme_supports('widgets')) {
155
+		$submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
156 156
 	}
157 157
 
158
-	if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize') ) {
159
-		$customize_header_url = add_query_arg( array( 'autofocus' => array( 'control' => 'header_image' ) ), $customize_url );
160
-		$submenu['themes.php'][15] = array( __( 'Header' ), $appearance_cap, esc_url( $customize_header_url ), '', 'hide-if-no-customize' );
158
+	if (current_theme_supports('custom-header') && current_user_can('customize')) {
159
+		$customize_header_url = add_query_arg(array('autofocus' => array('control' => 'header_image')), $customize_url);
160
+		$submenu['themes.php'][15] = array(__('Header'), $appearance_cap, esc_url($customize_header_url), '', 'hide-if-no-customize');
161 161
 	}
162 162
 
163
-	if ( current_theme_supports( 'custom-background' ) && current_user_can( 'customize') ) {
164
-		$customize_background_url = add_query_arg( array( 'autofocus' => array( 'control' => 'background_image' ) ), $customize_url );
165
-		$submenu['themes.php'][20] = array( __( 'Background' ), $appearance_cap, esc_url( $customize_background_url ), '', 'hide-if-no-customize' );
163
+	if (current_theme_supports('custom-background') && current_user_can('customize')) {
164
+		$customize_background_url = add_query_arg(array('autofocus' => array('control' => 'background_image')), $customize_url);
165
+		$submenu['themes.php'][20] = array(__('Background'), $appearance_cap, esc_url($customize_background_url), '', 'hide-if-no-customize');
166 166
 	}
167 167
 
168
-	unset( $customize_url );
168
+	unset($customize_url);
169 169
 
170
-unset( $appearance_cap );
170
+unset($appearance_cap);
171 171
 
172 172
 // Add 'Editor' to the bottom of the Appearance menu.
173
-if ( ! is_multisite() ) {
173
+if ( ! is_multisite()) {
174 174
 	add_action('admin_menu', '_add_themes_utility_last', 101);
175 175
 }
176 176
 /**
@@ -182,35 +182,35 @@  discard block
 block discarded – undo
182 182
 }
183 183
 
184 184
 $count = '';
185
-if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
186
-	if ( ! isset( $update_data ) )
185
+if ( ! is_multisite() && current_user_can('update_plugins')) {
186
+	if ( ! isset($update_data))
187 187
 		$update_data = wp_get_update_data();
188
-	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
188
+	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>".number_format_i18n($update_data['counts']['plugins'])."</span></span>";
189 189
 }
190 190
 
191
-$menu[65] = array( sprintf( __('Plugins %s'), $count ), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins' );
191
+$menu[65] = array(sprintf(__('Plugins %s'), $count), 'activate_plugins', 'plugins.php', '', 'menu-top menu-icon-plugins', 'menu-plugins', 'dashicons-admin-plugins');
192 192
 
193
-$submenu['plugins.php'][5]  = array( __('Installed Plugins'), 'activate_plugins', 'plugins.php' );
193
+$submenu['plugins.php'][5] = array(__('Installed Plugins'), 'activate_plugins', 'plugins.php');
194 194
 
195
-	if ( ! is_multisite() ) {
195
+	if ( ! is_multisite()) {
196 196
 		/* translators: add new plugin */
197
-		$submenu['plugins.php'][10] = array( _x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php' );
198
-		$submenu['plugins.php'][15] = array( _x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php' );
197
+		$submenu['plugins.php'][10] = array(_x('Add New', 'plugin'), 'install_plugins', 'plugin-install.php');
198
+		$submenu['plugins.php'][15] = array(_x('Editor', 'plugin editor'), 'edit_plugins', 'plugin-editor.php');
199 199
 	}
200 200
 
201
-unset( $update_data );
201
+unset($update_data);
202 202
 
203
-if ( current_user_can('list_users') )
204
-	$menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
203
+if (current_user_can('list_users'))
204
+	$menu[70] = array(__('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users');
205 205
 else
206
-	$menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
206
+	$menu[70] = array(__('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users');
207 207
 
208
-if ( current_user_can('list_users') ) {
208
+if (current_user_can('list_users')) {
209 209
 	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
210 210
 	$submenu['users.php'][5] = array(__('All Users'), 'list_users', 'users.php');
211
-	if ( current_user_can( 'create_users' ) ) {
211
+	if (current_user_can('create_users')) {
212 212
 		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'create_users', 'user-new.php');
213
-	} elseif ( is_multisite() ) {
213
+	} elseif (is_multisite()) {
214 214
 		$submenu['users.php'][10] = array(_x('Add New', 'user'), 'promote_users', 'user-new.php');
215 215
 	}
216 216
 
@@ -218,23 +218,23 @@  discard block
 block discarded – undo
218 218
 } else {
219 219
 	$_wp_real_parent_file['users.php'] = 'profile.php';
220 220
 	$submenu['profile.php'][5] = array(__('Your Profile'), 'read', 'profile.php');
221
-	if ( current_user_can( 'create_users' ) ) {
221
+	if (current_user_can('create_users')) {
222 222
 		$submenu['profile.php'][10] = array(__('Add New User'), 'create_users', 'user-new.php');
223
-	} elseif ( is_multisite() ) {
223
+	} elseif (is_multisite()) {
224 224
 		$submenu['profile.php'][10] = array(__('Add New User'), 'promote_users', 'user-new.php');
225 225
 	}
226 226
 }
227 227
 
228
-$menu[75] = array( __('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools' );
229
-	$submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
230
-	$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
231
-	$submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
232
-	if ( is_multisite() && !is_main_site() )
233
-		$submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
234
-	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
228
+$menu[75] = array(__('Tools'), 'edit_posts', 'tools.php', '', 'menu-top menu-icon-tools', 'menu-tools', 'dashicons-admin-tools');
229
+	$submenu['tools.php'][5] = array(__('Available Tools'), 'edit_posts', 'tools.php');
230
+	$submenu['tools.php'][10] = array(__('Import'), 'import', 'import.php');
231
+	$submenu['tools.php'][15] = array(__('Export'), 'export', 'export.php');
232
+	if (is_multisite() && ! is_main_site())
233
+		$submenu['tools.php'][25] = array(__('Delete Site'), 'delete_site', 'ms-delete-site.php');
234
+	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE)
235 235
 		$submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
236 236
 
237
-$menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
237
+$menu[80] = array(__('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings');
238 238
 	$submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
239 239
 	$submenu['options-general.php'][15] = array(__('Writing'), 'manage_options', 'options-writing.php');
240 240
 	$submenu['options-general.php'][20] = array(__('Reading'), 'manage_options', 'options-reading.php');
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 $_wp_last_utility_menu = 80; // The index of the last top-level menu in the utility menu group
246 246
 
247
-$menu[99] = array( '', 'read', 'separator-last', '', 'wp-menu-separator' );
247
+$menu[99] = array('', 'read', 'separator-last', '', 'wp-menu-separator');
248 248
 
249 249
 // Back-compat for old top-levels
250 250
 $_wp_real_parent_file['post.php'] = 'edit.php';
@@ -268,4 +268,4 @@  discard block
 block discarded – undo
268 268
 	'themes' => 'appearance',
269 269
 	);
270 270
 
271
-require_once(ABSPATH . 'wp-admin/includes/menu.php');
271
+require_once(ABSPATH.'wp-admin/includes/menu.php');
Please login to merge, or discard this patch.
Braces   +39 added lines, -27 removed lines patch added patch discarded remove patch
@@ -28,16 +28,18 @@  discard block
 block discarded – undo
28 28
 	$submenu[ 'index.php' ][5] = array( __('My Sites'), 'read', 'my-sites.php' );
29 29
 }
30 30
 
31
-if ( ! is_multisite() || is_super_admin() )
31
+if ( ! is_multisite() || is_super_admin() ) {
32 32
 	$update_data = wp_get_update_data();
33
+}
33 34
 
34 35
 if ( ! is_multisite() ) {
35
-	if ( current_user_can( 'update_core' ) )
36
-		$cap = 'update_core';
37
-	elseif ( current_user_can( 'update_plugins' ) )
38
-		$cap = 'update_plugins';
39
-	else
40
-		$cap = 'update_themes';
36
+	if ( current_user_can( 'update_core' ) ) {
37
+			$cap = 'update_core';
38
+	} elseif ( current_user_can( 'update_plugins' ) ) {
39
+			$cap = 'update_plugins';
40
+	} else {
41
+			$cap = 'update_themes';
42
+	}
41 43
 	$submenu[ 'index.php' ][10] = array( sprintf( __('Updates %s'), "<span class='update-plugins count-{$update_data['counts']['total']}' title='{$update_data['title']}'><span class='update-count'>" . number_format_i18n($update_data['counts']['total']) . "</span></span>" ), $cap, 'update-core.php');
42 44
 	unset( $cap );
43 45
 }
@@ -51,8 +53,9 @@  discard block
 block discarded – undo
51 53
 
52 54
 	$i = 15;
53 55
 	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
54
-		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) )
55
-			continue;
56
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array('post', (array) $tax->object_type, true) ) {
57
+					continue;
58
+		}
56 59
 
57 60
 		$submenu['edit.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name );
58 61
 	}
@@ -63,8 +66,9 @@  discard block
 block discarded – undo
63 66
 	/* translators: add new file */
64 67
 	$submenu['upload.php'][10] = array( _x('Add New', 'file'), 'upload_files', 'media-new.php');
65 68
 	foreach ( get_taxonomies_for_attachments( 'objects' ) as $tax ) {
66
-		if ( ! $tax->show_ui || ! $tax->show_in_menu )
67
-			continue;
69
+		if ( ! $tax->show_ui || ! $tax->show_in_menu ) {
70
+					continue;
71
+		}
68 72
 
69 73
 		$submenu['upload.php'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=attachment' );
70 74
 	}
@@ -82,8 +86,9 @@  discard block
 block discarded – undo
82 86
 	$submenu['edit.php?post_type=page'][10] = array( _x('Add New', 'page'), get_post_type_object( 'page' )->cap->create_posts, 'post-new.php?post_type=page' );
83 87
 	$i = 15;
84 88
 	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
85
-		if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) )
86
-			continue;
89
+		if ( ! $tax->show_ui || ! $tax->show_in_menu  || ! in_array('page', (array) $tax->object_type, true) ) {
90
+					continue;
91
+		}
87 92
 
88 93
 		$submenu['edit.php?post_type=page'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, 'edit-tags.php?taxonomy=' . $tax->name . '&amp;post_type=page' );
89 94
 	}
@@ -101,8 +106,9 @@  discard block
 block discarded – undo
101 106
 foreach ( (array) get_post_types( array('show_ui' => true, '_builtin' => false, 'show_in_menu' => true ) ) as $ptype ) {
102 107
 	$ptype_obj = get_post_type_object( $ptype );
103 108
 	// Check if it should be a submenu.
104
-	if ( $ptype_obj->show_in_menu !== true )
105
-		continue;
109
+	if ( $ptype_obj->show_in_menu !== true ) {
110
+			continue;
111
+	}
106 112
 	$ptype_menu_position = is_int( $ptype_obj->menu_position ) ? $ptype_obj->menu_position : ++$_wp_last_object_menu; // If we're to use $_wp_last_object_menu, increment it first.
107 113
 	$ptype_for_id = sanitize_html_class( $ptype );
108 114
 
@@ -124,8 +130,9 @@  discard block
 block discarded – undo
124 130
 	 * by a hard-coded value below, increment the position.
125 131
 	 */
126 132
 	$core_menu_positions = array(59, 60, 65, 70, 75, 80, 85, 99);
127
-	while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) )
128
-		$ptype_menu_position++;
133
+	while ( isset($menu[$ptype_menu_position]) || in_array($ptype_menu_position, $core_menu_positions) ) {
134
+			$ptype_menu_position++;
135
+	}
129 136
 
130 137
 	$menu[$ptype_menu_position] = array( esc_attr( $ptype_obj->labels->menu_name ), $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype", '', 'menu-top menu-icon-' . $ptype_class, 'menu-posts-' . $ptype_for_id, $menu_icon );
131 138
 	$submenu["edit.php?post_type=$ptype"][5]  = array( $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts,  "edit.php?post_type=$ptype");
@@ -133,8 +140,9 @@  discard block
 block discarded – undo
133 140
 
134 141
 	$i = 15;
135 142
 	foreach ( get_taxonomies( array(), 'objects' ) as $tax ) {
136
-		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) )
137
-			continue;
143
+		if ( ! $tax->show_ui || ! $tax->show_in_menu || ! in_array($ptype, (array) $tax->object_type, true) ) {
144
+					continue;
145
+		}
138 146
 
139 147
 		$submenu["edit.php?post_type=$ptype"][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, "edit-tags.php?taxonomy=$tax->name&amp;post_type=$ptype" );
140 148
 	}
@@ -183,8 +191,9 @@  discard block
 block discarded – undo
183 191
 
184 192
 $count = '';
185 193
 if ( ! is_multisite() && current_user_can( 'update_plugins' ) ) {
186
-	if ( ! isset( $update_data ) )
187
-		$update_data = wp_get_update_data();
194
+	if ( ! isset( $update_data ) ) {
195
+			$update_data = wp_get_update_data();
196
+	}
188 197
 	$count = "<span class='update-plugins count-{$update_data['counts']['plugins']}'><span class='plugin-count'>" . number_format_i18n($update_data['counts']['plugins']) . "</span></span>";
189 198
 }
190 199
 
@@ -200,10 +209,11 @@  discard block
 block discarded – undo
200 209
 
201 210
 unset( $update_data );
202 211
 
203
-if ( current_user_can('list_users') )
212
+if ( current_user_can('list_users') ) {
204 213
 	$menu[70] = array( __('Users'), 'list_users', 'users.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
205
-else
214
+} else {
206 215
 	$menu[70] = array( __('Profile'), 'read', 'profile.php', '', 'menu-top menu-icon-users', 'menu-users', 'dashicons-admin-users' );
216
+}
207 217
 
208 218
 if ( current_user_can('list_users') ) {
209 219
 	$_wp_real_parent_file['profile.php'] = 'users.php'; // Back-compat for plugins adding submenus to profile.php.
@@ -229,10 +239,12 @@  discard block
 block discarded – undo
229 239
 	$submenu['tools.php'][5] = array( __('Available Tools'), 'edit_posts', 'tools.php' );
230 240
 	$submenu['tools.php'][10] = array( __('Import'), 'import', 'import.php' );
231 241
 	$submenu['tools.php'][15] = array( __('Export'), 'export', 'export.php' );
232
-	if ( is_multisite() && !is_main_site() )
233
-		$submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
234
-	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE )
235
-		$submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
242
+	if ( is_multisite() && !is_main_site() ) {
243
+			$submenu['tools.php'][25] = array( __('Delete Site'), 'delete_site', 'ms-delete-site.php' );
244
+	}
245
+	if ( ! is_multisite() && defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE ) {
246
+			$submenu['tools.php'][50] = array(__('Network Setup'), 'manage_options', 'network.php');
247
+	}
236 248
 
237 249
 $menu[80] = array( __('Settings'), 'manage_options', 'options-general.php', '', 'menu-top menu-icon-settings', 'menu-settings', 'dashicons-admin-settings' );
238 250
 	$submenu['options-general.php'][10] = array(_x('General', 'settings screen'), 'manage_options', 'options-general.php');
Please login to merge, or discard this patch.
src/wp-admin/admin-footer.php 3 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -58,12 +58,12 @@
 block discarded – undo
58 58
 </div>
59 59
 <?php
60 60
 /**
61
- * Print scripts or data before the default footer scripts.
62
- *
63
- * @since 1.2.0
64
- *
65
- * @param string $data The data to print.
66
- */
61
+		 * Print scripts or data before the default footer scripts.
62
+		 *
63
+		 * @since 1.2.0
64
+		 *
65
+		 * @param string $data The data to print.
66
+		 */
67 67
 do_action( 'admin_footer', '' );
68 68
 
69 69
 /**
Please login to merge, or discard this patch.
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // don't load directly
10
-if ( !defined('ABSPATH') )
10
+if ( ! defined('ABSPATH'))
11 11
 	die('-1');
12 12
 ?>
13 13
 
@@ -22,11 +22,11 @@  discard block
 block discarded – undo
22 22
 	 *
23 23
 	 * @since 2.5.0
24 24
 	 */
25
-	do_action( 'in_admin_footer' );
25
+	do_action('in_admin_footer');
26 26
 	?>
27 27
 	<p id="footer-left" class="alignleft">
28 28
 		<?php
29
-		$text = sprintf( __( 'Thank you for creating with <a href="%s">WordPress</a>.' ), __( 'https://wordpress.org/' ) );
29
+		$text = sprintf(__('Thank you for creating with <a href="%s">WordPress</a>.'), __('https://wordpress.org/'));
30 30
 		/**
31 31
 		 * Filter the "Thank you" text displayed in the admin footer.
32 32
 		 *
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
 		 *
35 35
 		 * @param string $text The content that will be printed.
36 36
 		 */
37
-		echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' );
37
+		echo apply_filters('admin_footer_text', '<span id="footer-thankyou">'.$text.'</span>');
38 38
 		?>
39 39
 	</p>
40 40
 	<p id="footer-upgrade" class="alignright">
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 		 *
52 52
 		 * @param string $content The content that will be printed.
53 53
 		 */
54
-		echo apply_filters( 'update_footer', '' );
54
+		echo apply_filters('update_footer', '');
55 55
 		?>
56 56
 	</p>
57 57
 	<div class="clear"></div>
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
  *
65 65
  * @param string $data The data to print.
66 66
  */
67
-do_action( 'admin_footer', '' );
67
+do_action('admin_footer', '');
68 68
 
69 69
 /**
70 70
  * Prints any scripts and data queued for the footer.
71 71
  *
72 72
  * @since 2.8.0
73 73
  */
74
-do_action( 'admin_print_footer_scripts' );
74
+do_action('admin_print_footer_scripts');
75 75
 
76 76
 /**
77 77
  * Print scripts or data after the default footer scripts.
@@ -84,11 +84,11 @@  discard block
 block discarded – undo
84 84
  * @global string $hook_suffix
85 85
  * @param string $hook_suffix The current admin page.
86 86
  */
87
-do_action( "admin_footer-" . $GLOBALS['hook_suffix'] );
87
+do_action("admin_footer-".$GLOBALS['hook_suffix']);
88 88
 
89 89
 // get_site_option() won't exist when auto upgrading from <= 2.7
90
-if ( function_exists('get_site_option') ) {
91
-	if ( false === get_site_option('can_compress_scripts') )
90
+if (function_exists('get_site_option')) {
91
+	if (false === get_site_option('can_compress_scripts'))
92 92
 		compression_test();
93 93
 }
94 94
 
Please login to merge, or discard this patch.
Braces   +6 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,8 +7,9 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // don't load directly
10
-if ( !defined('ABSPATH') )
10
+if ( !defined('ABSPATH') ) {
11 11
 	die('-1');
12
+}
12 13
 ?>
13 14
 
14 15
 <div class="clear"></div></div><!-- wpbody-content -->
@@ -88,9 +89,10 @@  discard block
 block discarded – undo
88 89
 
89 90
 // get_site_option() won't exist when auto upgrading from <= 2.7
90 91
 if ( function_exists('get_site_option') ) {
91
-	if ( false === get_site_option('can_compress_scripts') )
92
-		compression_test();
93
-}
92
+	if ( false === get_site_option('can_compress_scripts') ) {
93
+			compression_test();
94
+	}
95
+	}
94 96
 
95 97
 ?>
96 98
 
Please login to merge, or discard this patch.
src/wp-admin/update.php 2 patches
Spacing   +110 added lines, -110 removed lines patch added patch discarded remove patch
@@ -6,125 +6,125 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
10
-	define( 'IFRAME_REQUEST', true );
9
+if ( ! defined('IFRAME_REQUEST') && isset($_GET['action']) && in_array($_GET['action'], array('update-selected', 'activate-plugin', 'update-selected-themes')))
10
+	define('IFRAME_REQUEST', true);
11 11
 
12 12
 /** WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15
-include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
15
+include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
16 16
 
17
-if ( isset($_GET['action']) ) {
17
+if (isset($_GET['action'])) {
18 18
 	$plugin = isset($_REQUEST['plugin']) ? trim($_REQUEST['plugin']) : '';
19 19
 	$theme = isset($_REQUEST['theme']) ? urldecode($_REQUEST['theme']) : '';
20 20
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 21
 
22
-	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
22
+	if ('update-selected' == $action) {
23
+		if ( ! current_user_can('update_plugins'))
24
+			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
25 25
 
26
-		check_admin_referer( 'bulk-update-plugins' );
26
+		check_admin_referer('bulk-update-plugins');
27 27
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
28
+		if (isset($_GET['plugins']))
29
+			$plugins = explode(',', stripslashes($_GET['plugins']));
30
+		elseif (isset($_POST['checked']))
31 31
 			$plugins = (array) $_POST['checked'];
32 32
 		else
33 33
 			$plugins = array();
34 34
 
35 35
 		$plugins = array_map('urldecode', $plugins);
36 36
 
37
-		$url = 'update.php?action=update-selected&amp;plugins=' . urlencode(implode(',', $plugins));
37
+		$url = 'update.php?action=update-selected&amp;plugins='.urlencode(implode(',', $plugins));
38 38
 		$nonce = 'bulk-update-plugins';
39 39
 
40
-		wp_enqueue_script( 'updates' );
40
+		wp_enqueue_script('updates');
41 41
 		iframe_header();
42 42
 
43
-		$upgrader = new Plugin_Upgrader( new Bulk_Plugin_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
44
-		$upgrader->bulk_upgrade( $plugins );
43
+		$upgrader = new Plugin_Upgrader(new Bulk_Plugin_Upgrader_Skin(compact('nonce', 'url')));
44
+		$upgrader->bulk_upgrade($plugins);
45 45
 
46 46
 		iframe_footer();
47 47
 
48
-	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
48
+	} elseif ('upgrade-plugin' == $action) {
49
+		if ( ! current_user_can('update_plugins'))
50 50
 			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
51 51
 
52
-		check_admin_referer('upgrade-plugin_' . $plugin);
52
+		check_admin_referer('upgrade-plugin_'.$plugin);
53 53
 
54 54
 		$title = __('Update Plugin');
55 55
 		$parent_file = 'plugins.php';
56 56
 		$submenu_file = 'plugins.php';
57 57
 
58
-		wp_enqueue_script( 'updates' );
59
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
58
+		wp_enqueue_script('updates');
59
+		require_once(ABSPATH.'wp-admin/admin-header.php');
60 60
 
61
-		$nonce = 'upgrade-plugin_' . $plugin;
62
-		$url = 'update.php?action=upgrade-plugin&plugin=' . urlencode( $plugin );
61
+		$nonce = 'upgrade-plugin_'.$plugin;
62
+		$url = 'update.php?action=upgrade-plugin&plugin='.urlencode($plugin);
63 63
 
64
-		$upgrader = new Plugin_Upgrader( new Plugin_Upgrader_Skin( compact('title', 'nonce', 'url', 'plugin') ) );
64
+		$upgrader = new Plugin_Upgrader(new Plugin_Upgrader_Skin(compact('title', 'nonce', 'url', 'plugin')));
65 65
 		$upgrader->upgrade($plugin);
66 66
 
67
-		include(ABSPATH . 'wp-admin/admin-footer.php');
67
+		include(ABSPATH.'wp-admin/admin-footer.php');
68 68
 
69
-	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
69
+	} elseif ('activate-plugin' == $action) {
70
+		if ( ! current_user_can('update_plugins'))
71 71
 			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
72 72
 
73
-		check_admin_referer('activate-plugin_' . $plugin);
74
-		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
75
-			wp_redirect( admin_url('update.php?action=activate-plugin&failure=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
76
-			activate_plugin( $plugin, '', ! empty( $_GET['networkwide'] ), true );
77
-			wp_redirect( admin_url('update.php?action=activate-plugin&success=true&plugin=' . urlencode( $plugin ) . '&_wpnonce=' . $_GET['_wpnonce']) );
73
+		check_admin_referer('activate-plugin_'.$plugin);
74
+		if ( ! isset($_GET['failure']) && ! isset($_GET['success'])) {
75
+			wp_redirect(admin_url('update.php?action=activate-plugin&failure=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
76
+			activate_plugin($plugin, '', ! empty($_GET['networkwide']), true);
77
+			wp_redirect(admin_url('update.php?action=activate-plugin&success=true&plugin='.urlencode($plugin).'&_wpnonce='.$_GET['_wpnonce']));
78 78
 			die();
79 79
 		}
80
-		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
80
+		iframe_header(__('Plugin Reactivation'), true);
81
+		if (isset($_GET['success']))
82
+			echo '<p>'.__('Plugin reactivated successfully.').'</p>';
83 83
 
84
-		if ( isset($_GET['failure']) ){
85
-			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
84
+		if (isset($_GET['failure'])) {
85
+			echo '<p>'.__('Plugin failed to reactivate due to a fatal error.').'</p>';
86 86
 
87
-			error_reporting( E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR );
87
+			error_reporting(E_CORE_ERROR | E_CORE_WARNING | E_COMPILE_ERROR | E_ERROR | E_WARNING | E_PARSE | E_USER_ERROR | E_USER_WARNING | E_RECOVERABLE_ERROR);
88 88
 			@ini_set('display_errors', true); //Ensure that Fatal errors are displayed.
89
-			wp_register_plugin_realpath( WP_PLUGIN_DIR . '/' . $plugin );
90
-			include( WP_PLUGIN_DIR . '/' . $plugin );
89
+			wp_register_plugin_realpath(WP_PLUGIN_DIR.'/'.$plugin);
90
+			include(WP_PLUGIN_DIR.'/'.$plugin);
91 91
 		}
92 92
 		iframe_footer();
93
-	} elseif ( 'install-plugin' == $action ) {
93
+	} elseif ('install-plugin' == $action) {
94 94
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
95
+		if ( ! current_user_can('install_plugins'))
96
+			wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
97 97
 
98
-		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
98
+		include_once(ABSPATH.'wp-admin/includes/plugin-install.php'); //for plugins_api..
99 99
 
100
-		check_admin_referer('install-plugin_' . $plugin);
101
-		$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
100
+		check_admin_referer('install-plugin_'.$plugin);
101
+		$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false))); //Save on a bit of bandwidth.
102 102
 
103
-		if ( is_wp_error($api) )
103
+		if (is_wp_error($api))
104 104
 	 		wp_die($api);
105 105
 
106 106
 		$title = __('Plugin Install');
107 107
 		$parent_file = 'plugins.php';
108 108
 		$submenu_file = 'plugin-install.php';
109
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
109
+		require_once(ABSPATH.'wp-admin/admin-header.php');
110 110
 
111
-		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
112
-		$nonce = 'install-plugin_' . $plugin;
113
-		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
114
-		if ( isset($_GET['from']) )
115
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
111
+		$title = sprintf(__('Installing Plugin: %s'), $api->name.' '.$api->version);
112
+		$nonce = 'install-plugin_'.$plugin;
113
+		$url = 'update.php?action=install-plugin&plugin='.urlencode($plugin);
114
+		if (isset($_GET['from']))
115
+			$url .= '&from='.urlencode(stripslashes($_GET['from']));
116 116
 
117 117
 		$type = 'web'; //Install plugin type, From Web or an Upload.
118 118
 
119
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
119
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
120 120
 		$upgrader->install($api->download_link);
121 121
 
122
-		include(ABSPATH . 'wp-admin/admin-footer.php');
122
+		include(ABSPATH.'wp-admin/admin-footer.php');
123 123
 
124
-	} elseif ( 'upload-plugin' == $action ) {
124
+	} elseif ('upload-plugin' == $action) {
125 125
 
126
-		if ( ! current_user_can( 'upload_plugins' ) ) {
127
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
126
+		if ( ! current_user_can('upload_plugins')) {
127
+			wp_die(__('You do not have sufficient permissions to install plugins on this site.'));
128 128
 		}
129 129
 
130 130
 		check_admin_referer('plugin-upload');
@@ -134,128 +134,128 @@  discard block
 block discarded – undo
134 134
 		$title = __('Upload Plugin');
135 135
 		$parent_file = 'plugins.php';
136 136
 		$submenu_file = 'plugin-install.php';
137
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
137
+		require_once(ABSPATH.'wp-admin/admin-header.php');
138 138
 
139
-		$title = sprintf( __('Installing Plugin from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
139
+		$title = sprintf(__('Installing Plugin from uploaded file: %s'), esc_html(basename($file_upload->filename)));
140 140
 		$nonce = 'plugin-upload';
141 141
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-plugin');
142 142
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
143 143
 
144
-		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
145
-		$result = $upgrader->install( $file_upload->package );
144
+		$upgrader = new Plugin_Upgrader(new Plugin_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
145
+		$result = $upgrader->install($file_upload->package);
146 146
 
147
-		if ( $result || is_wp_error($result) )
147
+		if ($result || is_wp_error($result))
148 148
 			$file_upload->cleanup();
149 149
 
150
-		include(ABSPATH . 'wp-admin/admin-footer.php');
150
+		include(ABSPATH.'wp-admin/admin-footer.php');
151 151
 
152
-	} elseif ( 'upgrade-theme' == $action ) {
152
+	} elseif ('upgrade-theme' == $action) {
153 153
 
154
-		if ( ! current_user_can('update_themes') )
154
+		if ( ! current_user_can('update_themes'))
155 155
 			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
156 156
 
157
-		check_admin_referer('upgrade-theme_' . $theme);
157
+		check_admin_referer('upgrade-theme_'.$theme);
158 158
 
159
-		wp_enqueue_script( 'customize-loader' );
160
-		wp_enqueue_script( 'updates' );
159
+		wp_enqueue_script('customize-loader');
160
+		wp_enqueue_script('updates');
161 161
 
162 162
 		$title = __('Update Theme');
163 163
 		$parent_file = 'themes.php';
164 164
 		$submenu_file = 'themes.php';
165
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
165
+		require_once(ABSPATH.'wp-admin/admin-header.php');
166 166
 
167
-		$nonce = 'upgrade-theme_' . $theme;
168
-		$url = 'update.php?action=upgrade-theme&theme=' . urlencode( $theme );
167
+		$nonce = 'upgrade-theme_'.$theme;
168
+		$url = 'update.php?action=upgrade-theme&theme='.urlencode($theme);
169 169
 
170
-		$upgrader = new Theme_Upgrader( new Theme_Upgrader_Skin( compact('title', 'nonce', 'url', 'theme') ) );
170
+		$upgrader = new Theme_Upgrader(new Theme_Upgrader_Skin(compact('title', 'nonce', 'url', 'theme')));
171 171
 		$upgrader->upgrade($theme);
172 172
 
173
-		include(ABSPATH . 'wp-admin/admin-footer.php');
174
-	} elseif ( 'update-selected-themes' == $action ) {
175
-		if ( ! current_user_can( 'update_themes' ) )
176
-			wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
173
+		include(ABSPATH.'wp-admin/admin-footer.php');
174
+	} elseif ('update-selected-themes' == $action) {
175
+		if ( ! current_user_can('update_themes'))
176
+			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
177 177
 
178
-		check_admin_referer( 'bulk-update-themes' );
178
+		check_admin_referer('bulk-update-themes');
179 179
 
180
-		if ( isset( $_GET['themes'] ) )
181
-			$themes = explode( ',', stripslashes($_GET['themes']) );
182
-		elseif ( isset( $_POST['checked'] ) )
180
+		if (isset($_GET['themes']))
181
+			$themes = explode(',', stripslashes($_GET['themes']));
182
+		elseif (isset($_POST['checked']))
183 183
 			$themes = (array) $_POST['checked'];
184 184
 		else
185 185
 			$themes = array();
186 186
 
187 187
 		$themes = array_map('urldecode', $themes);
188 188
 
189
-		$url = 'update.php?action=update-selected-themes&amp;themes=' . urlencode(implode(',', $themes));
189
+		$url = 'update.php?action=update-selected-themes&amp;themes='.urlencode(implode(',', $themes));
190 190
 		$nonce = 'bulk-update-themes';
191 191
 
192
-		wp_enqueue_script( 'updates' );
192
+		wp_enqueue_script('updates');
193 193
 		iframe_header();
194 194
 
195
-		$upgrader = new Theme_Upgrader( new Bulk_Theme_Upgrader_Skin( compact( 'nonce', 'url' ) ) );
196
-		$upgrader->bulk_upgrade( $themes );
195
+		$upgrader = new Theme_Upgrader(new Bulk_Theme_Upgrader_Skin(compact('nonce', 'url')));
196
+		$upgrader->bulk_upgrade($themes);
197 197
 
198 198
 		iframe_footer();
199
-	} elseif ( 'install-theme' == $action ) {
199
+	} elseif ('install-theme' == $action) {
200 200
 
201
-		if ( ! current_user_can('install_themes') )
202
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
201
+		if ( ! current_user_can('install_themes'))
202
+			wp_die(__('You do not have sufficient permissions to install themes on this site.'));
203 203
 
204
-		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
204
+		include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php'); //for themes_api..
205 205
 
206
-		check_admin_referer( 'install-theme_' . $theme );
207
-		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
206
+		check_admin_referer('install-theme_'.$theme);
207
+		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false))); //Save on a bit of bandwidth.
208 208
 
209
-		if ( is_wp_error($api) )
209
+		if (is_wp_error($api))
210 210
 	 		wp_die($api);
211 211
 
212
-		wp_enqueue_script( 'customize-loader' );
212
+		wp_enqueue_script('customize-loader');
213 213
 
214 214
 		$title = __('Install Themes');
215 215
 		$parent_file = 'themes.php';
216 216
 		$submenu_file = 'themes.php';
217
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
217
+		require_once(ABSPATH.'wp-admin/admin-header.php');
218 218
 
219
-		$title = sprintf( __('Installing Theme: %s'), $api->name . ' ' . $api->version );
220
-		$nonce = 'install-theme_' . $theme;
221
-		$url = 'update.php?action=install-theme&theme=' . urlencode( $theme );
219
+		$title = sprintf(__('Installing Theme: %s'), $api->name.' '.$api->version);
220
+		$nonce = 'install-theme_'.$theme;
221
+		$url = 'update.php?action=install-theme&theme='.urlencode($theme);
222 222
 		$type = 'web'; //Install theme type, From Web or an Upload.
223 223
 
224
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('title', 'url', 'nonce', 'plugin', 'api') ) );
224
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('title', 'url', 'nonce', 'plugin', 'api')));
225 225
 		$upgrader->install($api->download_link);
226 226
 
227
-		include(ABSPATH . 'wp-admin/admin-footer.php');
227
+		include(ABSPATH.'wp-admin/admin-footer.php');
228 228
 
229
-	} elseif ( 'upload-theme' == $action ) {
229
+	} elseif ('upload-theme' == $action) {
230 230
 
231
-		if ( ! current_user_can( 'upload_themes' ) ) {
232
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
231
+		if ( ! current_user_can('upload_themes')) {
232
+			wp_die(__('You do not have sufficient permissions to install themes on this site.'));
233 233
 		}
234 234
 
235 235
 		check_admin_referer('theme-upload');
236 236
 
237 237
 		$file_upload = new File_Upload_Upgrader('themezip', 'package');
238 238
 
239
-		wp_enqueue_script( 'customize-loader' );
239
+		wp_enqueue_script('customize-loader');
240 240
 
241 241
 		$title = __('Upload Theme');
242 242
 		$parent_file = 'themes.php';
243 243
 		$submenu_file = 'theme-install.php';
244 244
 
245
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
245
+		require_once(ABSPATH.'wp-admin/admin-header.php');
246 246
 
247
-		$title = sprintf( __('Installing Theme from uploaded file: %s'), esc_html( basename( $file_upload->filename ) ) );
247
+		$title = sprintf(__('Installing Theme from uploaded file: %s'), esc_html(basename($file_upload->filename)));
248 248
 		$nonce = 'theme-upload';
249 249
 		$url = add_query_arg(array('package' => $file_upload->id), 'update.php?action=upload-theme');
250 250
 		$type = 'upload'; //Install plugin type, From Web or an Upload.
251 251
 
252
-		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
253
-		$result = $upgrader->install( $file_upload->package );
252
+		$upgrader = new Theme_Upgrader(new Theme_Installer_Skin(compact('type', 'title', 'nonce', 'url')));
253
+		$result = $upgrader->install($file_upload->package);
254 254
 
255
-		if ( $result || is_wp_error($result) )
255
+		if ($result || is_wp_error($result))
256 256
 			$file_upload->cleanup();
257 257
 
258
-		include(ABSPATH . 'wp-admin/admin-footer.php');
258
+		include(ABSPATH.'wp-admin/admin-footer.php');
259 259
 
260 260
 	} else {
261 261
 		/**
@@ -267,6 +267,6 @@  discard block
 block discarded – undo
267 267
 		 *
268 268
 		 * @since 2.8.0
269 269
 		 */
270
-		do_action( "update-custom_{$action}" );
270
+		do_action("update-custom_{$action}");
271 271
 	}
272 272
 }
Please login to merge, or discard this patch.
Braces   +55 added lines, -39 removed lines patch added patch discarded remove patch
@@ -6,8 +6,9 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) )
9
+if ( ! defined( 'IFRAME_REQUEST' ) && isset( $_GET['action'] ) && in_array( $_GET['action'], array( 'update-selected', 'activate-plugin', 'update-selected-themes' ) ) ) {
10 10
 	define( 'IFRAME_REQUEST', true );
11
+}
11 12
 
12 13
 /** WordPress Administration Bootstrap */
13 14
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -20,17 +21,19 @@  discard block
 block discarded – undo
20 21
 	$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : '';
21 22
 
22 23
 	if ( 'update-selected' == $action ) {
23
-		if ( ! current_user_can( 'update_plugins' ) )
24
-			wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
24
+		if ( ! current_user_can( 'update_plugins' ) ) {
25
+					wp_die( __( 'You do not have sufficient permissions to update plugins for this site.' ) );
26
+		}
25 27
 
26 28
 		check_admin_referer( 'bulk-update-plugins' );
27 29
 
28
-		if ( isset( $_GET['plugins'] ) )
29
-			$plugins = explode( ',', stripslashes($_GET['plugins']) );
30
-		elseif ( isset( $_POST['checked'] ) )
31
-			$plugins = (array) $_POST['checked'];
32
-		else
33
-			$plugins = array();
30
+		if ( isset( $_GET['plugins'] ) ) {
31
+					$plugins = explode( ',', stripslashes($_GET['plugins']) );
32
+		} elseif ( isset( $_POST['checked'] ) ) {
33
+					$plugins = (array) $_POST['checked'];
34
+		} else {
35
+					$plugins = array();
36
+		}
34 37
 
35 38
 		$plugins = array_map('urldecode', $plugins);
36 39
 
@@ -46,8 +49,9 @@  discard block
 block discarded – undo
46 49
 		iframe_footer();
47 50
 
48 51
 	} elseif ( 'upgrade-plugin' == $action ) {
49
-		if ( ! current_user_can('update_plugins') )
50
-			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
52
+		if ( ! current_user_can('update_plugins') ) {
53
+					wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
54
+		}
51 55
 
52 56
 		check_admin_referer('upgrade-plugin_' . $plugin);
53 57
 
@@ -67,8 +71,9 @@  discard block
 block discarded – undo
67 71
 		include(ABSPATH . 'wp-admin/admin-footer.php');
68 72
 
69 73
 	} elseif ('activate-plugin' == $action ) {
70
-		if ( ! current_user_can('update_plugins') )
71
-			wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
74
+		if ( ! current_user_can('update_plugins') ) {
75
+					wp_die(__('You do not have sufficient permissions to update plugins for this site.'));
76
+		}
72 77
 
73 78
 		check_admin_referer('activate-plugin_' . $plugin);
74 79
 		if ( ! isset($_GET['failure']) && ! isset($_GET['success']) ) {
@@ -78,8 +83,9 @@  discard block
 block discarded – undo
78 83
 			die();
79 84
 		}
80 85
 		iframe_header( __('Plugin Reactivation'), true );
81
-		if ( isset($_GET['success']) )
82
-			echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
86
+		if ( isset($_GET['success']) ) {
87
+					echo '<p>' . __('Plugin reactivated successfully.') . '</p>';
88
+		}
83 89
 
84 90
 		if ( isset($_GET['failure']) ){
85 91
 			echo '<p>' . __('Plugin failed to reactivate due to a fatal error.') . '</p>';
@@ -92,16 +98,18 @@  discard block
 block discarded – undo
92 98
 		iframe_footer();
93 99
 	} elseif ( 'install-plugin' == $action ) {
94 100
 
95
-		if ( ! current_user_can('install_plugins') )
96
-			wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
101
+		if ( ! current_user_can('install_plugins') ) {
102
+					wp_die( __( 'You do not have sufficient permissions to install plugins on this site.' ) );
103
+		}
97 104
 
98 105
 		include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' ); //for plugins_api..
99 106
 
100 107
 		check_admin_referer('install-plugin_' . $plugin);
101 108
 		$api = plugins_api('plugin_information', array('slug' => $plugin, 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth.
102 109
 
103
-		if ( is_wp_error($api) )
104
-	 		wp_die($api);
110
+		if ( is_wp_error($api) ) {
111
+			 		wp_die($api);
112
+		}
105 113
 
106 114
 		$title = __('Plugin Install');
107 115
 		$parent_file = 'plugins.php';
@@ -111,8 +119,9 @@  discard block
 block discarded – undo
111 119
 		$title = sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version );
112 120
 		$nonce = 'install-plugin_' . $plugin;
113 121
 		$url = 'update.php?action=install-plugin&plugin=' . urlencode( $plugin );
114
-		if ( isset($_GET['from']) )
115
-			$url .= '&from=' . urlencode(stripslashes($_GET['from']));
122
+		if ( isset($_GET['from']) ) {
123
+					$url .= '&from=' . urlencode(stripslashes($_GET['from']));
124
+		}
116 125
 
117 126
 		$type = 'web'; //Install plugin type, From Web or an Upload.
118 127
 
@@ -144,15 +153,17 @@  discard block
 block discarded – undo
144 153
 		$upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
145 154
 		$result = $upgrader->install( $file_upload->package );
146 155
 
147
-		if ( $result || is_wp_error($result) )
148
-			$file_upload->cleanup();
156
+		if ( $result || is_wp_error($result) ) {
157
+					$file_upload->cleanup();
158
+		}
149 159
 
150 160
 		include(ABSPATH . 'wp-admin/admin-footer.php');
151 161
 
152 162
 	} elseif ( 'upgrade-theme' == $action ) {
153 163
 
154
-		if ( ! current_user_can('update_themes') )
155
-			wp_die(__('You do not have sufficient permissions to update themes for this site.'));
164
+		if ( ! current_user_can('update_themes') ) {
165
+					wp_die(__('You do not have sufficient permissions to update themes for this site.'));
166
+		}
156 167
 
157 168
 		check_admin_referer('upgrade-theme_' . $theme);
158 169
 
@@ -172,17 +183,19 @@  discard block
 block discarded – undo
172 183
 
173 184
 		include(ABSPATH . 'wp-admin/admin-footer.php');
174 185
 	} elseif ( 'update-selected-themes' == $action ) {
175
-		if ( ! current_user_can( 'update_themes' ) )
176
-			wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
186
+		if ( ! current_user_can( 'update_themes' ) ) {
187
+					wp_die( __( 'You do not have sufficient permissions to update themes for this site.' ) );
188
+		}
177 189
 
178 190
 		check_admin_referer( 'bulk-update-themes' );
179 191
 
180
-		if ( isset( $_GET['themes'] ) )
181
-			$themes = explode( ',', stripslashes($_GET['themes']) );
182
-		elseif ( isset( $_POST['checked'] ) )
183
-			$themes = (array) $_POST['checked'];
184
-		else
185
-			$themes = array();
192
+		if ( isset( $_GET['themes'] ) ) {
193
+					$themes = explode( ',', stripslashes($_GET['themes']) );
194
+		} elseif ( isset( $_POST['checked'] ) ) {
195
+					$themes = (array) $_POST['checked'];
196
+		} else {
197
+					$themes = array();
198
+		}
186 199
 
187 200
 		$themes = array_map('urldecode', $themes);
188 201
 
@@ -198,16 +211,18 @@  discard block
 block discarded – undo
198 211
 		iframe_footer();
199 212
 	} elseif ( 'install-theme' == $action ) {
200 213
 
201
-		if ( ! current_user_can('install_themes') )
202
-			wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
214
+		if ( ! current_user_can('install_themes') ) {
215
+					wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
216
+		}
203 217
 
204 218
 		include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' ); //for themes_api..
205 219
 
206 220
 		check_admin_referer( 'install-theme_' . $theme );
207 221
 		$api = themes_api('theme_information', array('slug' => $theme, 'fields' => array('sections' => false, 'tags' => false) ) ); //Save on a bit of bandwidth.
208 222
 
209
-		if ( is_wp_error($api) )
210
-	 		wp_die($api);
223
+		if ( is_wp_error($api) ) {
224
+			 		wp_die($api);
225
+		}
211 226
 
212 227
 		wp_enqueue_script( 'customize-loader' );
213 228
 
@@ -252,8 +267,9 @@  discard block
 block discarded – undo
252 267
 		$upgrader = new Theme_Upgrader( new Theme_Installer_Skin( compact('type', 'title', 'nonce', 'url') ) );
253 268
 		$result = $upgrader->install( $file_upload->package );
254 269
 
255
-		if ( $result || is_wp_error($result) )
256
-			$file_upload->cleanup();
270
+		if ( $result || is_wp_error($result) ) {
271
+					$file_upload->cleanup();
272
+		}
257 273
 
258 274
 		include(ABSPATH . 'wp-admin/admin-footer.php');
259 275
 
Please login to merge, or discard this patch.
src/wp-admin/custom-background.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * The custom background script.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * The custom background script.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * The custom background class.
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -47,12 +47,12 @@  discard block
 block discarded – undo
47 47
 		$this->admin_header_callback = $admin_header_callback;
48 48
 		$this->admin_image_div_callback = $admin_image_div_callback;
49 49
 
50
-		add_action( 'admin_menu', array( $this, 'init' ) );
50
+		add_action('admin_menu', array($this, 'init'));
51 51
 
52
-		add_action( 'wp_ajax_custom-background-add', array( $this, 'ajax_background_add' ) );
52
+		add_action('wp_ajax_custom-background-add', array($this, 'ajax_background_add'));
53 53
 
54 54
 		// Unused since 3.5.0.
55
-		add_action( 'wp_ajax_set-background-image', array( $this, 'wp_set_background_image' ) );
55
+		add_action('wp_ajax_set-background-image', array($this, 'wp_set_background_image'));
56 56
 	}
57 57
 
58 58
 	/**
@@ -61,17 +61,17 @@  discard block
 block discarded – undo
61 61
 	 * @since 3.0.0
62 62
 	 */
63 63
 	public function init() {
64
-		$page = add_theme_page( __( 'Background' ), __( 'Background' ), 'edit_theme_options', 'custom-background', array( $this, 'admin_page' ) );
65
-		if ( ! $page ) {
64
+		$page = add_theme_page(__('Background'), __('Background'), 'edit_theme_options', 'custom-background', array($this, 'admin_page'));
65
+		if ( ! $page) {
66 66
 			return;
67 67
 		}
68 68
 
69
-		add_action( "load-$page", array( $this, 'admin_load' ) );
70
-		add_action( "load-$page", array( $this, 'take_action' ), 49 );
71
-		add_action( "load-$page", array( $this, 'handle_upload' ), 49 );
69
+		add_action("load-$page", array($this, 'admin_load'));
70
+		add_action("load-$page", array($this, 'take_action'), 49);
71
+		add_action("load-$page", array($this, 'handle_upload'), 49);
72 72
 
73
-		if ( $this->admin_header_callback ) {
74
-			add_action( "admin_head-$page", $this->admin_header_callback, 51 );
73
+		if ($this->admin_header_callback) {
74
+			add_action("admin_head-$page", $this->admin_header_callback, 51);
75 75
 		}
76 76
 	}
77 77
 
@@ -81,20 +81,20 @@  discard block
 block discarded – undo
81 81
 	 * @since 3.0.0
82 82
 	 */
83 83
 	public function admin_load() {
84
-		get_current_screen()->add_help_tab( array(
84
+		get_current_screen()->add_help_tab(array(
85 85
 			'id'      => 'overview',
86 86
 			'title'   => __('Overview'),
87 87
 			'content' =>
88
-				'<p>' . __( 'You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.' ) . '</p>' .
89
-				'<p>' . __( 'To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.' ) . '</p>' .
90
-				'<p>' . __( 'You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.' ) . '</p>' .
91
-				'<p>' . __( 'Don&#8217;t forget to click on the Save Changes button when you are finished.' ) . '</p>'
92
-		) );
88
+				'<p>'.__('You can customize the look of your site without touching any of your theme&#8217;s code by using a custom background. Your background can be an image or a color.').'</p>'.
89
+				'<p>'.__('To use a background image, simply upload it or choose an image that has already been uploaded to your Media Library by clicking the &#8220;Choose Image&#8221; button. You can display a single instance of your image, or tile it to fill the screen. You can have your background fixed in place, so your site content moves on top of it, or you can have it scroll with your site.').'</p>'.
90
+				'<p>'.__('You can also choose a background color by clicking the Select Color button and either typing in a legitimate HTML hex value, e.g. &#8220;#ff0000&#8221; for red, or by choosing a color using the color picker.').'</p>'.
91
+				'<p>'.__('Don&#8217;t forget to click on the Save Changes button when you are finished.').'</p>'
92
+		));
93 93
 
94 94
 		get_current_screen()->set_help_sidebar(
95
-			'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
96
-			'<p>' . __( '<a href="https://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>' ) . '</p>' .
97
-			'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
95
+			'<p><strong>'.__('For more information:').'</strong></p>'.
96
+			'<p>'.__('<a href="https://codex.wordpress.org/Appearance_Background_Screen" target="_blank">Documentation on Custom Background</a>').'</p>'.
97
+			'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
98 98
 		);
99 99
 
100 100
 		wp_enqueue_media();
@@ -108,10 +108,10 @@  discard block
 block discarded – undo
108 108
 	 * @since 3.0.0
109 109
 	 */
110 110
 	public function take_action() {
111
-		if ( empty($_POST) )
111
+		if (empty($_POST))
112 112
 			return;
113 113
 
114
-		if ( isset($_POST['reset-background']) ) {
114
+		if (isset($_POST['reset-background'])) {
115 115
 			check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset');
116 116
 			remove_theme_mod('background_image');
117 117
 			remove_theme_mod('background_image_thumb');
@@ -119,47 +119,47 @@  discard block
 block discarded – undo
119 119
 			return;
120 120
 		}
121 121
 
122
-		if ( isset($_POST['remove-background']) ) {
122
+		if (isset($_POST['remove-background'])) {
123 123
 			// @TODO: Uploaded files are not removed here.
124 124
 			check_admin_referer('custom-background-remove', '_wpnonce-custom-background-remove');
125 125
 			set_theme_mod('background_image', '');
126 126
 			set_theme_mod('background_image_thumb', '');
127 127
 			$this->updated = true;
128
-			wp_safe_redirect( $_POST['_wp_http_referer'] );
128
+			wp_safe_redirect($_POST['_wp_http_referer']);
129 129
 			return;
130 130
 		}
131 131
 
132
-		if ( isset($_POST['background-repeat']) ) {
132
+		if (isset($_POST['background-repeat'])) {
133 133
 			check_admin_referer('custom-background');
134
-			if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) )
134
+			if (in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')))
135 135
 				$repeat = $_POST['background-repeat'];
136 136
 			else
137 137
 				$repeat = 'repeat';
138 138
 			set_theme_mod('background_repeat', $repeat);
139 139
 		}
140 140
 
141
-		if ( isset($_POST['background-position-x']) ) {
141
+		if (isset($_POST['background-position-x'])) {
142 142
 			check_admin_referer('custom-background');
143
-			if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) )
143
+			if (in_array($_POST['background-position-x'], array('center', 'right', 'left')))
144 144
 				$position = $_POST['background-position-x'];
145 145
 			else
146 146
 				$position = 'left';
147 147
 			set_theme_mod('background_position_x', $position);
148 148
 		}
149 149
 
150
-		if ( isset($_POST['background-attachment']) ) {
150
+		if (isset($_POST['background-attachment'])) {
151 151
 			check_admin_referer('custom-background');
152
-			if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
152
+			if (in_array($_POST['background-attachment'], array('fixed', 'scroll')))
153 153
 				$attachment = $_POST['background-attachment'];
154 154
 			else
155 155
 				$attachment = 'fixed';
156 156
 			set_theme_mod('background_attachment', $attachment);
157 157
 		}
158 158
 
159
-		if ( isset($_POST['background-color']) ) {
159
+		if (isset($_POST['background-color'])) {
160 160
 			check_admin_referer('custom-background');
161 161
 			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']);
162
-			if ( strlen($color) == 6 || strlen($color) == 3 )
162
+			if (strlen($color) == 6 || strlen($color) == 3)
163 163
 				set_theme_mod('background_color', $color);
164 164
 			else
165 165
 				set_theme_mod('background_color', '');
@@ -176,54 +176,54 @@  discard block
 block discarded – undo
176 176
 	public function admin_page() {
177 177
 ?>
178 178
 <div class="wrap" id="custom-background">
179
-<h1><?php _e( 'Custom Background' ); ?></h1>
179
+<h1><?php _e('Custom Background'); ?></h1>
180 180
 
181
-<?php if ( current_user_can( 'customize' ) ) { ?>
181
+<?php if (current_user_can('customize')) { ?>
182 182
 <div class="notice notice-info hide-if-no-customize">
183 183
 	<p>
184 184
 		<?php
185 185
 		printf(
186
-			__( 'You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.' ),
187
-			admin_url( 'customize.php?autofocus[control]=background_image' )
186
+			__('You can now manage and live-preview Custom Backgrounds in the <a href="%1$s">Customizer</a>.'),
187
+			admin_url('customize.php?autofocus[control]=background_image')
188 188
 		);
189 189
 		?>
190 190
 	</p>
191 191
 </div>
192 192
 <?php } ?>
193 193
 
194
-<?php if ( ! empty( $this->updated ) ) { ?>
194
+<?php if ( ! empty($this->updated)) { ?>
195 195
 <div id="message" class="updated">
196
-<p><?php printf( __( 'Background updated. <a href="%s">Visit your site</a> to see how it looks.' ), home_url( '/' ) ); ?></p>
196
+<p><?php printf(__('Background updated. <a href="%s">Visit your site</a> to see how it looks.'), home_url('/')); ?></p>
197 197
 </div>
198 198
 <?php } ?>
199 199
 
200
-<h3><?php _e( 'Background Image' ); ?></h3>
200
+<h3><?php _e('Background Image'); ?></h3>
201 201
 
202 202
 <table class="form-table">
203 203
 <tbody>
204 204
 <tr>
205
-<th scope="row"><?php _e( 'Preview' ); ?></th>
205
+<th scope="row"><?php _e('Preview'); ?></th>
206 206
 <td>
207 207
 	<?php
208
-	if ( $this->admin_image_div_callback ) {
209
-		call_user_func( $this->admin_image_div_callback );
208
+	if ($this->admin_image_div_callback) {
209
+		call_user_func($this->admin_image_div_callback);
210 210
 	} else {
211 211
 		$background_styles = '';
212
-		if ( $bgcolor = get_background_color() )
213
-			$background_styles .= 'background-color: #' . $bgcolor . ';';
212
+		if ($bgcolor = get_background_color())
213
+			$background_styles .= 'background-color: #'.$bgcolor.';';
214 214
 
215 215
 		$background_image_thumb = get_background_image();
216
-		if ( $background_image_thumb ) {
217
-			$background_image_thumb = esc_url( set_url_scheme( get_theme_mod( 'background_image_thumb', str_replace( '%', '%%', $background_image_thumb ) ) ) );
216
+		if ($background_image_thumb) {
217
+			$background_image_thumb = esc_url(set_url_scheme(get_theme_mod('background_image_thumb', str_replace('%', '%%', $background_image_thumb))));
218 218
 
219 219
 			// Background-image URL must be single quote, see below.
220
-			$background_styles .= ' background-image: url(\'' . $background_image_thumb . '\');'
221
-				. ' background-repeat: ' . get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) . ';'
222
-				. ' background-position: top ' . get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) );
220
+			$background_styles .= ' background-image: url(\''.$background_image_thumb.'\');'
221
+				. ' background-repeat: '.get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat')).';'
222
+				. ' background-position: top '.get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'));
223 223
 		}
224 224
 	?>
225 225
 	<div id="custom-background-image" style="<?php echo $background_styles; ?>"><?php // must be double quote, see above ?>
226
-		<?php if ( $background_image_thumb ) { ?>
226
+		<?php if ($background_image_thumb) { ?>
227 227
 		<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" /><br />
228 228
 		<img class="custom-background-image" src="<?php echo $background_image_thumb; ?>" style="visibility:hidden;" alt="" />
229 229
 		<?php } ?>
@@ -232,49 +232,49 @@  discard block
 block discarded – undo
232 232
 </td>
233 233
 </tr>
234 234
 
235
-<?php if ( get_background_image() ) : ?>
235
+<?php if (get_background_image()) : ?>
236 236
 <tr>
237 237
 <th scope="row"><?php _e('Remove Image'); ?></th>
238 238
 <td>
239 239
 <form method="post">
240 240
 <?php wp_nonce_field('custom-background-remove', '_wpnonce-custom-background-remove'); ?>
241
-<?php submit_button( __( 'Remove Background Image' ), 'button', 'remove-background', false ); ?><br/>
241
+<?php submit_button(__('Remove Background Image'), 'button', 'remove-background', false); ?><br/>
242 242
 <?php _e('This will remove the background image. You will not be able to restore any customizations.') ?>
243 243
 </form>
244 244
 </td>
245 245
 </tr>
246 246
 <?php endif; ?>
247 247
 
248
-<?php $default_image = get_theme_support( 'custom-background', 'default-image' ); ?>
249
-<?php if ( $default_image && get_background_image() != $default_image ) : ?>
248
+<?php $default_image = get_theme_support('custom-background', 'default-image'); ?>
249
+<?php if ($default_image && get_background_image() != $default_image) : ?>
250 250
 <tr>
251 251
 <th scope="row"><?php _e('Restore Original Image'); ?></th>
252 252
 <td>
253 253
 <form method="post">
254 254
 <?php wp_nonce_field('custom-background-reset', '_wpnonce-custom-background-reset'); ?>
255
-<?php submit_button( __( 'Restore Original Image' ), 'button', 'reset-background', false ); ?><br/>
255
+<?php submit_button(__('Restore Original Image'), 'button', 'reset-background', false); ?><br/>
256 256
 <?php _e('This will restore the original background image. You will not be able to restore any customizations.') ?>
257 257
 </form>
258 258
 </td>
259 259
 </tr>
260 260
 <?php endif; ?>
261 261
 
262
-<?php if ( current_user_can( 'upload_files' ) ): ?>
262
+<?php if (current_user_can('upload_files')): ?>
263 263
 <tr>
264 264
 <th scope="row"><?php _e('Select Image'); ?></th>
265 265
 <td><form enctype="multipart/form-data" id="upload-form" class="wp-upload-form" method="post">
266 266
 	<p>
267
-		<label for="upload"><?php _e( 'Choose an image from your computer:' ); ?></label><br />
267
+		<label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br />
268 268
 		<input type="file" id="upload" name="import" />
269 269
 		<input type="hidden" name="action" value="save" />
270
-		<?php wp_nonce_field( 'custom-background-upload', '_wpnonce-custom-background-upload' ); ?>
271
-		<?php submit_button( __( 'Upload' ), 'button', 'submit', false ); ?>
270
+		<?php wp_nonce_field('custom-background-upload', '_wpnonce-custom-background-upload'); ?>
271
+		<?php submit_button(__('Upload'), 'button', 'submit', false); ?>
272 272
 	</p>
273 273
 	<p>
274
-		<label for="choose-from-library-link"><?php _e( 'Or choose an image from your media library:' ); ?></label><br />
274
+		<label for="choose-from-library-link"><?php _e('Or choose an image from your media library:'); ?></label><br />
275 275
 		<button id="choose-from-library-link" class="button"
276
-			data-choose="<?php esc_attr_e( 'Choose a Background Image' ); ?>"
277
-			data-update="<?php esc_attr_e( 'Set as background' ); ?>"><?php _e( 'Choose Image' ); ?></button>
276
+			data-choose="<?php esc_attr_e('Choose a Background Image'); ?>"
277
+			data-update="<?php esc_attr_e('Set as background'); ?>"><?php _e('Choose Image'); ?></button>
278 278
 	</p>
279 279
 	</form>
280 280
 </td>
@@ -287,65 +287,65 @@  discard block
 block discarded – undo
287 287
 <form method="post">
288 288
 <table class="form-table">
289 289
 <tbody>
290
-<?php if ( get_background_image() ) : ?>
290
+<?php if (get_background_image()) : ?>
291 291
 <tr>
292
-<th scope="row"><?php _e( 'Position' ); ?></th>
293
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Position' ); ?></span></legend>
292
+<th scope="row"><?php _e('Position'); ?></th>
293
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Position'); ?></span></legend>
294 294
 <label>
295
-<input name="background-position-x" type="radio" value="left"<?php checked( 'left', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
295
+<input name="background-position-x" type="radio" value="left"<?php checked('left', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> />
296 296
 <?php _e('Left') ?>
297 297
 </label>
298 298
 <label>
299
-<input name="background-position-x" type="radio" value="center"<?php checked( 'center', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
299
+<input name="background-position-x" type="radio" value="center"<?php checked('center', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> />
300 300
 <?php _e('Center') ?>
301 301
 </label>
302 302
 <label>
303
-<input name="background-position-x" type="radio" value="right"<?php checked( 'right', get_theme_mod( 'background_position_x', get_theme_support( 'custom-background', 'default-position-x' ) ) ); ?> />
303
+<input name="background-position-x" type="radio" value="right"<?php checked('right', get_theme_mod('background_position_x', get_theme_support('custom-background', 'default-position-x'))); ?> />
304 304
 <?php _e('Right') ?>
305 305
 </label>
306 306
 </fieldset></td>
307 307
 </tr>
308 308
 
309 309
 <tr>
310
-<th scope="row"><?php _e( 'Repeat' ); ?></th>
311
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Repeat' ); ?></span></legend>
312
-<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked( 'no-repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('No Repeat'); ?></label>
313
-	<label><input type="radio" name="background-repeat" value="repeat"<?php checked( 'repeat', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile'); ?></label>
314
-	<label><input type="radio" name="background-repeat" value="repeat-x"<?php checked( 'repeat-x', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Horizontally'); ?></label>
315
-	<label><input type="radio" name="background-repeat" value="repeat-y"<?php checked( 'repeat-y', get_theme_mod( 'background_repeat', get_theme_support( 'custom-background', 'default-repeat' ) ) ); ?> /> <?php _e('Tile Vertically'); ?></label>
310
+<th scope="row"><?php _e('Repeat'); ?></th>
311
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Repeat'); ?></span></legend>
312
+<label><input type="radio" name="background-repeat" value="no-repeat"<?php checked('no-repeat', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('No Repeat'); ?></label>
313
+	<label><input type="radio" name="background-repeat" value="repeat"<?php checked('repeat', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile'); ?></label>
314
+	<label><input type="radio" name="background-repeat" value="repeat-x"<?php checked('repeat-x', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile Horizontally'); ?></label>
315
+	<label><input type="radio" name="background-repeat" value="repeat-y"<?php checked('repeat-y', get_theme_mod('background_repeat', get_theme_support('custom-background', 'default-repeat'))); ?> /> <?php _e('Tile Vertically'); ?></label>
316 316
 </fieldset></td>
317 317
 </tr>
318 318
 
319 319
 <tr>
320
-<th scope="row"><?php _ex( 'Attachment', 'Background Attachment' ); ?></th>
321
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Attachment' ); ?></span></legend>
320
+<th scope="row"><?php _ex('Attachment', 'Background Attachment'); ?></th>
321
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Attachment'); ?></span></legend>
322 322
 <label>
323
-<input name="background-attachment" type="radio" value="scroll" <?php checked( 'scroll', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
324
-<?php _e( 'Scroll' ); ?>
323
+<input name="background-attachment" type="radio" value="scroll" <?php checked('scroll', get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment'))); ?> />
324
+<?php _e('Scroll'); ?>
325 325
 </label>
326 326
 <label>
327
-<input name="background-attachment" type="radio" value="fixed" <?php checked( 'fixed', get_theme_mod( 'background_attachment', get_theme_support( 'custom-background', 'default-attachment' ) ) ); ?> />
328
-<?php _e( 'Fixed' ); ?>
327
+<input name="background-attachment" type="radio" value="fixed" <?php checked('fixed', get_theme_mod('background_attachment', get_theme_support('custom-background', 'default-attachment'))); ?> />
328
+<?php _e('Fixed'); ?>
329 329
 </label>
330 330
 </fieldset></td>
331 331
 </tr>
332 332
 <?php endif; // get_background_image() ?>
333 333
 <tr>
334
-<th scope="row"><?php _e( 'Background Color' ); ?></th>
335
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend>
334
+<th scope="row"><?php _e('Background Color'); ?></th>
335
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Background Color'); ?></span></legend>
336 336
 <?php
337 337
 $default_color = '';
338
-if ( current_theme_supports( 'custom-background', 'default-color' ) )
339
-	$default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"';
338
+if (current_theme_supports('custom-background', 'default-color'))
339
+	$default_color = ' data-default-color="#'.esc_attr(get_theme_support('custom-background', 'default-color')).'"';
340 340
 ?>
341
-<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> />
341
+<input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr(get_background_color()); ?>"<?php echo $default_color ?> />
342 342
 </fieldset></td>
343 343
 </tr>
344 344
 </tbody>
345 345
 </table>
346 346
 
347 347
 <?php wp_nonce_field('custom-background'); ?>
348
-<?php submit_button( null, 'primary', 'save-background-options' ); ?>
348
+<?php submit_button(null, 'primary', 'save-background-options'); ?>
349 349
 </form>
350 350
 
351 351
 </div>
@@ -358,21 +358,21 @@  discard block
 block discarded – undo
358 358
 	 * @since 3.0.0
359 359
 	 */
360 360
 	public function handle_upload() {
361
-		if ( empty($_FILES) )
361
+		if (empty($_FILES))
362 362
 			return;
363 363
 
364 364
 		check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload');
365 365
 		$overrides = array('test_form' => false);
366 366
 
367 367
 		$uploaded_file = $_FILES['import'];
368
-		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
369
-		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
370
-			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
368
+		$wp_filetype = wp_check_filetype_and_ext($uploaded_file['tmp_name'], $uploaded_file['name']);
369
+		if ( ! wp_match_mime_types('image', $wp_filetype['type']))
370
+			wp_die(__('The uploaded file is not a valid image. Please try again.'));
371 371
 
372 372
 		$file = wp_handle_upload($uploaded_file, $overrides);
373 373
 
374
-		if ( isset($file['error']) )
375
-			wp_die( $file['error'] );
374
+		if (isset($file['error']))
375
+			wp_die($file['error']);
376 376
 
377 377
 		$url = $file['url'];
378 378
 		$type = $file['type'];
@@ -392,16 +392,16 @@  discard block
 block discarded – undo
392 392
 		$id = wp_insert_attachment($object, $file);
393 393
 
394 394
 		// Add the meta-data
395
-		wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
396
-		update_post_meta( $id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
395
+		wp_update_attachment_metadata($id, wp_generate_attachment_metadata($id, $file));
396
+		update_post_meta($id, '_wp_attachment_is_custom_background', get_option('stylesheet'));
397 397
 
398 398
 		set_theme_mod('background_image', esc_url_raw($url));
399 399
 
400
-		$thumbnail = wp_get_attachment_image_src( $id, 'thumbnail' );
401
-		set_theme_mod('background_image_thumb', esc_url_raw( $thumbnail[0] ) );
400
+		$thumbnail = wp_get_attachment_image_src($id, 'thumbnail');
401
+		set_theme_mod('background_image_thumb', esc_url_raw($thumbnail[0]));
402 402
 
403 403
 		/** This action is documented in wp-admin/custom-header.php */
404
-		do_action( 'wp_create_file_in_uploads', $file, $id ); // For replication
404
+		do_action('wp_create_file_in_uploads', $file, $id); // For replication
405 405
 		$this->updated = true;
406 406
 	}
407 407
 
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 	 * @since 4.1.0
415 415
 	 */
416 416
 	public function ajax_background_add() {
417
-		check_ajax_referer( 'background-add', 'nonce' );
417
+		check_ajax_referer('background-add', 'nonce');
418 418
 
419
-		if ( ! current_user_can( 'edit_theme_options' ) ) {
419
+		if ( ! current_user_can('edit_theme_options')) {
420 420
 			wp_send_json_error();
421 421
 		}
422 422
 
423
-		$attachment_id = absint( $_POST['attachment_id'] );
424
-		if ( $attachment_id < 1 ) {
423
+		$attachment_id = absint($_POST['attachment_id']);
424
+		if ($attachment_id < 1) {
425 425
 			wp_send_json_error();
426 426
 		}
427 427
 
428
-		update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_stylesheet() );
428
+		update_post_meta($attachment_id, '_wp_attachment_is_custom_background', get_stylesheet());
429 429
 
430 430
 		wp_send_json_success();
431 431
 	}
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	 * @param array $form_fields
439 439
 	 * @return array $form_fields
440 440
 	 */
441
-	public function attachment_fields_to_edit( $form_fields ) {
441
+	public function attachment_fields_to_edit($form_fields) {
442 442
 		return $form_fields;
443 443
 	}
444 444
 
@@ -450,7 +450,7 @@  discard block
 block discarded – undo
450 450
 	 * @param array $tabs
451 451
 	 * @return array $tabs
452 452
 	 */
453
-	public function filter_upload_tabs( $tabs ) {
453
+	public function filter_upload_tabs($tabs) {
454 454
 		return $tabs;
455 455
 	}
456 456
 
@@ -460,19 +460,19 @@  discard block
 block discarded – undo
460 460
 	 * @deprecated 3.5.0
461 461
 	 */
462 462
 	public function wp_set_background_image() {
463
-		if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit;
463
+		if ( ! current_user_can('edit_theme_options') || ! isset($_POST['attachment_id'])) exit;
464 464
 		$attachment_id = absint($_POST['attachment_id']);
465 465
 		/** This filter is documented in wp-admin/includes/media.php */
466
-		$sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) ));
466
+		$sizes = array_keys(apply_filters('image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size'))));
467 467
 		$size = 'thumbnail';
468
-		if ( in_array( $_POST['size'], $sizes ) )
469
-			$size = esc_attr( $_POST['size'] );
470
-
471
-		update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
472
-		$url = wp_get_attachment_image_src( $attachment_id, $size );
473
-		$thumbnail = wp_get_attachment_image_src( $attachment_id, 'thumbnail' );
474
-		set_theme_mod( 'background_image', esc_url_raw( $url[0] ) );
475
-		set_theme_mod( 'background_image_thumb', esc_url_raw( $thumbnail[0] ) );
468
+		if (in_array($_POST['size'], $sizes))
469
+			$size = esc_attr($_POST['size']);
470
+
471
+		update_post_meta($attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet'));
472
+		$url = wp_get_attachment_image_src($attachment_id, $size);
473
+		$thumbnail = wp_get_attachment_image_src($attachment_id, 'thumbnail');
474
+		set_theme_mod('background_image', esc_url_raw($url[0]));
475
+		set_theme_mod('background_image_thumb', esc_url_raw($thumbnail[0]));
476 476
 		exit;
477 477
 	}
478 478
 }
Please login to merge, or discard this patch.
Braces   +43 added lines, -30 removed lines patch added patch discarded remove patch
@@ -108,8 +108,9 @@  discard block
 block discarded – undo
108 108
 	 * @since 3.0.0
109 109
 	 */
110 110
 	public function take_action() {
111
-		if ( empty($_POST) )
112
-			return;
111
+		if ( empty($_POST) ) {
112
+					return;
113
+		}
113 114
 
114 115
 		if ( isset($_POST['reset-background']) ) {
115 116
 			check_admin_referer('custom-background-reset', '_wpnonce-custom-background-reset');
@@ -131,38 +132,42 @@  discard block
 block discarded – undo
131 132
 
132 133
 		if ( isset($_POST['background-repeat']) ) {
133 134
 			check_admin_referer('custom-background');
134
-			if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) )
135
-				$repeat = $_POST['background-repeat'];
136
-			else
137
-				$repeat = 'repeat';
135
+			if ( in_array($_POST['background-repeat'], array('repeat', 'no-repeat', 'repeat-x', 'repeat-y')) ) {
136
+							$repeat = $_POST['background-repeat'];
137
+			} else {
138
+							$repeat = 'repeat';
139
+			}
138 140
 			set_theme_mod('background_repeat', $repeat);
139 141
 		}
140 142
 
141 143
 		if ( isset($_POST['background-position-x']) ) {
142 144
 			check_admin_referer('custom-background');
143
-			if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) )
144
-				$position = $_POST['background-position-x'];
145
-			else
146
-				$position = 'left';
145
+			if ( in_array($_POST['background-position-x'], array('center', 'right', 'left')) ) {
146
+							$position = $_POST['background-position-x'];
147
+			} else {
148
+							$position = 'left';
149
+			}
147 150
 			set_theme_mod('background_position_x', $position);
148 151
 		}
149 152
 
150 153
 		if ( isset($_POST['background-attachment']) ) {
151 154
 			check_admin_referer('custom-background');
152
-			if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) )
153
-				$attachment = $_POST['background-attachment'];
154
-			else
155
-				$attachment = 'fixed';
155
+			if ( in_array($_POST['background-attachment'], array('fixed', 'scroll')) ) {
156
+							$attachment = $_POST['background-attachment'];
157
+			} else {
158
+							$attachment = 'fixed';
159
+			}
156 160
 			set_theme_mod('background_attachment', $attachment);
157 161
 		}
158 162
 
159 163
 		if ( isset($_POST['background-color']) ) {
160 164
 			check_admin_referer('custom-background');
161 165
 			$color = preg_replace('/[^0-9a-fA-F]/', '', $_POST['background-color']);
162
-			if ( strlen($color) == 6 || strlen($color) == 3 )
163
-				set_theme_mod('background_color', $color);
164
-			else
165
-				set_theme_mod('background_color', '');
166
+			if ( strlen($color) == 6 || strlen($color) == 3 ) {
167
+							set_theme_mod('background_color', $color);
168
+			} else {
169
+							set_theme_mod('background_color', '');
170
+			}
166 171
 		}
167 172
 
168 173
 		$this->updated = true;
@@ -209,8 +214,9 @@  discard block
 block discarded – undo
209 214
 		call_user_func( $this->admin_image_div_callback );
210 215
 	} else {
211 216
 		$background_styles = '';
212
-		if ( $bgcolor = get_background_color() )
213
-			$background_styles .= 'background-color: #' . $bgcolor . ';';
217
+		if ( $bgcolor = get_background_color() ) {
218
+					$background_styles .= 'background-color: #' . $bgcolor . ';';
219
+		}
214 220
 
215 221
 		$background_image_thumb = get_background_image();
216 222
 		if ( $background_image_thumb ) {
@@ -335,8 +341,9 @@  discard block
 block discarded – undo
335 341
 <td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Background Color' ); ?></span></legend>
336 342
 <?php
337 343
 $default_color = '';
338
-if ( current_theme_supports( 'custom-background', 'default-color' ) )
344
+if ( current_theme_supports( 'custom-background', 'default-color' ) ) {
339 345
 	$default_color = ' data-default-color="#' . esc_attr( get_theme_support( 'custom-background', 'default-color' ) ) . '"';
346
+}
340 347
 ?>
341 348
 <input type="text" name="background-color" id="background-color" value="#<?php echo esc_attr( get_background_color() ); ?>"<?php echo $default_color ?> />
342 349
 </fieldset></td>
@@ -358,21 +365,24 @@  discard block
 block discarded – undo
358 365
 	 * @since 3.0.0
359 366
 	 */
360 367
 	public function handle_upload() {
361
-		if ( empty($_FILES) )
362
-			return;
368
+		if ( empty($_FILES) ) {
369
+					return;
370
+		}
363 371
 
364 372
 		check_admin_referer('custom-background-upload', '_wpnonce-custom-background-upload');
365 373
 		$overrides = array('test_form' => false);
366 374
 
367 375
 		$uploaded_file = $_FILES['import'];
368 376
 		$wp_filetype = wp_check_filetype_and_ext( $uploaded_file['tmp_name'], $uploaded_file['name'] );
369
-		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) )
370
-			wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
377
+		if ( ! wp_match_mime_types( 'image', $wp_filetype['type'] ) ) {
378
+					wp_die( __( 'The uploaded file is not a valid image. Please try again.' ) );
379
+		}
371 380
 
372 381
 		$file = wp_handle_upload($uploaded_file, $overrides);
373 382
 
374
-		if ( isset($file['error']) )
375
-			wp_die( $file['error'] );
383
+		if ( isset($file['error']) ) {
384
+					wp_die( $file['error'] );
385
+		}
376 386
 
377 387
 		$url = $file['url'];
378 388
 		$type = $file['type'];
@@ -460,13 +470,16 @@  discard block
 block discarded – undo
460 470
 	 * @deprecated 3.5.0
461 471
 	 */
462 472
 	public function wp_set_background_image() {
463
-		if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) exit;
473
+		if ( ! current_user_can('edit_theme_options') || ! isset( $_POST['attachment_id'] ) ) {
474
+			exit;
475
+		}
464 476
 		$attachment_id = absint($_POST['attachment_id']);
465 477
 		/** This filter is documented in wp-admin/includes/media.php */
466 478
 		$sizes = array_keys(apply_filters( 'image_size_names_choose', array('thumbnail' => __('Thumbnail'), 'medium' => __('Medium'), 'large' => __('Large'), 'full' => __('Full Size')) ));
467 479
 		$size = 'thumbnail';
468
-		if ( in_array( $_POST['size'], $sizes ) )
469
-			$size = esc_attr( $_POST['size'] );
480
+		if ( in_array( $_POST['size'], $sizes ) ) {
481
+					$size = esc_attr( $_POST['size'] );
482
+		}
470 483
 
471 484
 		update_post_meta( $attachment_id, '_wp_attachment_is_custom_background', get_option('stylesheet' ) );
472 485
 		$url = wp_get_attachment_image_src( $attachment_id, $size );
Please login to merge, or discard this patch.
src/wp-admin/upgrade.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Upgrade WordPress Page.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Upgrade WordPress Page.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * We are upgrading WordPress.
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -12,27 +12,27 @@  discard block
 block discarded – undo
12 12
  * @since 1.5.1
13 13
  * @var bool
14 14
  */
15
-define( 'WP_INSTALLING', true );
15
+define('WP_INSTALLING', true);
16 16
 
17 17
 /** Load WordPress Bootstrap */
18
-require( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
18
+require(dirname(dirname(__FILE__)).'/wp-load.php');
19 19
 
20 20
 nocache_headers();
21 21
 
22 22
 timer_start();
23
-require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
23
+require_once(ABSPATH.'wp-admin/includes/upgrade.php');
24 24
 
25 25
 delete_site_transient('update_core');
26 26
 
27
-if ( isset( $_GET['step'] ) )
27
+if (isset($_GET['step']))
28 28
 	$step = $_GET['step'];
29 29
 else
30 30
 	$step = 0;
31 31
 
32 32
 // Do it. No output.
33
-if ( 'upgrade_db' === $step ) {
33
+if ('upgrade_db' === $step) {
34 34
 	wp_upgrade();
35
-	die( '0' );
35
+	die('0');
36 36
 }
37 37
 
38 38
 /**
@@ -47,73 +47,73 @@  discard block
 block discarded – undo
47 47
 
48 48
 $php_version    = phpversion();
49 49
 $mysql_version  = $wpdb->db_version();
50
-$php_compat     = version_compare( $php_version, $required_php_version, '>=' );
51
-if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
50
+$php_compat     = version_compare($php_version, $required_php_version, '>=');
51
+if (file_exists(WP_CONTENT_DIR.'/db.php') && empty($wpdb->is_mysql))
52 52
 	$mysql_compat = true;
53 53
 else
54
-	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
54
+	$mysql_compat = version_compare($mysql_version, $required_mysql_version, '>=');
55 55
 
56
-@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
56
+@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset'));
57 57
 ?>
58 58
 <!DOCTYPE html>
59 59
 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
60 60
 <head>
61 61
 	<meta name="viewport" content="width=device-width" />
62
-	<meta http-equiv="Content-Type" content="<?php bloginfo( 'html_type' ); ?>; charset=<?php echo get_option( 'blog_charset' ); ?>" />
63
-	<title><?php _e( 'WordPress &rsaquo; Update' ); ?></title>
62
+	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
63
+	<title><?php _e('WordPress &rsaquo; Update'); ?></title>
64 64
 	<?php
65
-	wp_admin_css( 'install', true );
66
-	wp_admin_css( 'ie', true );
65
+	wp_admin_css('install', true);
66
+	wp_admin_css('ie', true);
67 67
 	?>
68 68
 </head>
69 69
 <body class="wp-core-ui">
70
-<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
70
+<h1 id="logo"><a href="<?php echo esc_url(__('https://wordpress.org/')); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></h1>
71 71
 
72
-<?php if ( get_option( 'db_version' ) == $wp_db_version || !is_blog_installed() ) : ?>
72
+<?php if (get_option('db_version') == $wp_db_version || ! is_blog_installed()) : ?>
73 73
 
74
-<h2><?php _e( 'No Update Required' ); ?></h2>
75
-<p><?php _e( 'Your WordPress database is already up-to-date!' ); ?></p>
76
-<p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
74
+<h2><?php _e('No Update Required'); ?></h2>
75
+<p><?php _e('Your WordPress database is already up-to-date!'); ?></p>
76
+<p class="step"><a class="button button-large" href="<?php echo get_option('home'); ?>/"><?php _e('Continue'); ?></a></p>
77 77
 
78
-<?php elseif ( !$php_compat || !$mysql_compat ) :
79
-	if ( !$mysql_compat && !$php_compat )
80
-		printf( __('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.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
81
-	elseif ( !$php_compat )
82
-		printf( __('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.'), $wp_version, $required_php_version, $php_version );
83
-	elseif ( !$mysql_compat )
84
-		printf( __('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.'), $wp_version, $required_mysql_version, $mysql_version );
78
+<?php elseif ( ! $php_compat || ! $mysql_compat) :
79
+	if ( ! $mysql_compat && ! $php_compat)
80
+		printf(__('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.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version);
81
+	elseif ( ! $php_compat)
82
+		printf(__('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.'), $wp_version, $required_php_version, $php_version);
83
+	elseif ( ! $mysql_compat)
84
+		printf(__('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.'), $wp_version, $required_mysql_version, $mysql_version);
85 85
 ?>
86 86
 <?php else :
87
-switch ( $step ) :
87
+switch ($step) :
88 88
 	case 0:
89 89
 		$goback = wp_get_referer();
90
-		if ( $goback ) {
91
-			$goback = esc_url_raw( $goback );
92
-			$goback = urlencode( $goback );
90
+		if ($goback) {
91
+			$goback = esc_url_raw($goback);
92
+			$goback = urlencode($goback);
93 93
 		}
94 94
 ?>
95
-<h2><?php _e( 'Database Update Required' ); ?></h2>
96
-<p><?php _e( 'WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.' ); ?></p>
97
-<p><?php _e( 'The update process may take a little while, so please be patient.' ); ?></p>
98
-<p class="step"><a class="button button-large" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e( 'Update WordPress Database' ); ?></a></p>
95
+<h2><?php _e('Database Update Required'); ?></h2>
96
+<p><?php _e('WordPress has been updated! Before we send you on your way, we have to update your database to the newest version.'); ?></p>
97
+<p><?php _e('The update process may take a little while, so please be patient.'); ?></p>
98
+<p class="step"><a class="button button-large" href="upgrade.php?step=1&amp;backto=<?php echo $goback; ?>"><?php _e('Update WordPress Database'); ?></a></p>
99 99
 <?php
100 100
 		break;
101 101
 	case 1:
102 102
 		wp_upgrade();
103 103
 
104
-			$backto = !empty($_GET['backto']) ? wp_unslash( urldecode( $_GET['backto'] ) ) : __get_option( 'home' ) . '/';
105
-			$backto = esc_url( $backto );
106
-			$backto = wp_validate_redirect($backto, __get_option( 'home' ) . '/');
104
+			$backto = ! empty($_GET['backto']) ? wp_unslash(urldecode($_GET['backto'])) : __get_option('home').'/';
105
+			$backto = esc_url($backto);
106
+			$backto = wp_validate_redirect($backto, __get_option('home').'/');
107 107
 ?>
108
-<h2><?php _e( 'Update Complete' ); ?></h2>
109
-	<p><?php _e( 'Your WordPress database has been successfully updated!' ); ?></p>
110
-	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e( 'Continue' ); ?></a></p>
108
+<h2><?php _e('Update Complete'); ?></h2>
109
+	<p><?php _e('Your WordPress database has been successfully updated!'); ?></p>
110
+	<p class="step"><a class="button button-large" href="<?php echo $backto; ?>"><?php _e('Continue'); ?></a></p>
111 111
 
112 112
 <!--
113 113
 <pre>
114
-<?php printf( __( '%s queries' ), $wpdb->num_queries ); ?>
114
+<?php printf(__('%s queries'), $wpdb->num_queries); ?>
115 115
 
116
-<?php printf( __( '%s seconds' ), timer_stop( 0 ) ); ?>
116
+<?php printf(__('%s seconds'), timer_stop(0)); ?>
117 117
 </pre>
118 118
 -->
119 119
 
Please login to merge, or discard this patch.
Braces   +17 added lines, -12 removed lines patch added patch discarded remove patch
@@ -24,10 +24,11 @@  discard block
 block discarded – undo
24 24
 
25 25
 delete_site_transient('update_core');
26 26
 
27
-if ( isset( $_GET['step'] ) )
27
+if ( isset( $_GET['step'] ) ) {
28 28
 	$step = $_GET['step'];
29
-else
29
+} else {
30 30
 	$step = 0;
31
+}
31 32
 
32 33
 // Do it. No output.
33 34
 if ( 'upgrade_db' === $step ) {
@@ -48,10 +49,11 @@  discard block
 block discarded – undo
48 49
 $php_version    = phpversion();
49 50
 $mysql_version  = $wpdb->db_version();
50 51
 $php_compat     = version_compare( $php_version, $required_php_version, '>=' );
51
-if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) )
52
+if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
52 53
 	$mysql_compat = true;
53
-else
54
+} else {
54 55
 	$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' );
56
+}
55 57
 
56 58
 @header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
57 59
 ?>
@@ -76,17 +78,20 @@  discard block
 block discarded – undo
76 78
 <p class="step"><a class="button button-large" href="<?php echo get_option( 'home' ); ?>/"><?php _e( 'Continue' ); ?></a></p>
77 79
 
78 80
 <?php elseif ( !$php_compat || !$mysql_compat ) :
79
-	if ( !$mysql_compat && !$php_compat )
80
-		printf( __('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.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
81
-	elseif ( !$php_compat )
82
-		printf( __('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.'), $wp_version, $required_php_version, $php_version );
83
-	elseif ( !$mysql_compat )
84
-		printf( __('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.'), $wp_version, $required_mysql_version, $mysql_version );
85
-?>
86
-<?php else :
81
+	if ( !$mysql_compat && !$php_compat ) {
82
+			printf( __('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.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version );
83
+	} elseif ( !$php_compat ) {
84
+			printf( __('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.'), $wp_version, $required_php_version, $php_version );
85
+	} elseif ( !$mysql_compat ) {
86
+			printf( __('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.'), $wp_version, $required_mysql_version, $mysql_version );
87
+	}
88
+	?>
89
+<?php else {
90
+	:
87 91
 switch ( $step ) :
88 92
 	case 0:
89 93
 		$goback = wp_get_referer();
94
+}
90 95
 		if ( $goback ) {
91 96
 			$goback = esc_url_raw( $goback );
92 97
 			$goback = urlencode( $goback );
Please login to merge, or discard this patch.
src/wp-admin/upload.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Media Library administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+		 * Media Library administration panel.
4
+		 *
5
+		 * @package WordPress
6
+		 * @subpackage Administration
7
+		 */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -7,84 +7,84 @@  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( __( 'You do not have permission to upload files.' ) );
12
+if ( ! current_user_can('upload_files'))
13
+	wp_die(__('You do not have permission 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 28
 	$q = $_GET;
29 29
 	// let JS handle this
30
-	unset( $q['s'] );
31
-	$vars = wp_edit_attachments_query_vars( $q );
32
-	$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
33
-	foreach ( $vars as $key => $value ) {
34
-		if ( ! $value || in_array( $key, $ignore ) ) {
35
-			unset( $vars[ $key ] );
30
+	unset($q['s']);
31
+	$vars = wp_edit_attachments_query_vars($q);
32
+	$ignore = array('mode', 'post_type', 'post_status', 'posts_per_page');
33
+	foreach ($vars as $key => $value) {
34
+		if ( ! $value || in_array($key, $ignore)) {
35
+			unset($vars[$key]);
36 36
 		}
37 37
 	}
38 38
 
39
-	wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
40
-		'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
39
+	wp_localize_script('media-grid', '_wpMediaGridSettings', array(
40
+		'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH),
41 41
 		'queryVars' => (object) $vars
42
-	) );
42
+	));
43 43
 
44
-	get_current_screen()->add_help_tab( array(
44
+	get_current_screen()->add_help_tab(array(
45 45
 		'id'		=> 'overview',
46
-		'title'		=> __( 'Overview' ),
46
+		'title'		=> __('Overview'),
47 47
 		'content'	=>
48
-			'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
49
-			'<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>' .
50
-			'<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>'
51
-	) );
48
+			'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.').'</p>'.
49
+			'<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>'.
50
+			'<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>'
51
+	));
52 52
 
53
-	get_current_screen()->add_help_tab( array(
53
+	get_current_screen()->add_help_tab(array(
54 54
 		'id'		=> 'attachment-details',
55
-		'title'		=> __( 'Attachment Details' ),
55
+		'title'		=> __('Attachment Details'),
56 56
 		'content'	=>
57
-			'<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>' .
58
-			'<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>' .
59
-			'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
60
-	) );
57
+			'<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>'.
58
+			'<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>'.
59
+			'<p>'.__('You can also delete individual items and access the extended edit screen from the details dialog.').'</p>'
60
+	));
61 61
 
62 62
 	get_current_screen()->set_help_sidebar(
63
-		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
64
-		'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
65
-		'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
63
+		'<p><strong>'.__('For more information:').'</strong></p>'.
64
+		'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
65
+		'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
66 66
 	);
67 67
 
68 68
 	$title = __('Media Library');
69 69
 	$parent_file = 'upload.php';
70 70
 
71
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
71
+	require_once(ABSPATH.'wp-admin/admin-header.php');
72 72
 	?>
73 73
 	<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
74 74
 		<h1>
75 75
 		<?php
76
-		echo esc_html( $title );
77
-		if ( current_user_can( 'upload_files' ) ) { ?>
78
-			<a href="media-new.php" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
76
+		echo esc_html($title);
77
+		if (current_user_can('upload_files')) { ?>
78
+			<a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
79 79
 		}
80 80
 		?>
81 81
 		</h1>
82 82
 		<div class="error hide-if-js">
83
-			<p><?php _e( 'The grid view for the Media Library requires JavaScript. <a href="upload.php?mode=list">Switch to the list view</a>.' ); ?></p>
83
+			<p><?php _e('The grid view for the Media Library requires JavaScript. <a href="upload.php?mode=list">Switch to the list view</a>.'); ?></p>
84 84
 		</div>
85 85
 	</div>
86 86
 	<?php
87
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
87
+	include(ABSPATH.'wp-admin/admin-footer.php');
88 88
 	exit;
89 89
 }
90 90
 
@@ -94,75 +94,75 @@  discard block
 block discarded – undo
94 94
 // Handle bulk actions
95 95
 $doaction = $wp_list_table->current_action();
96 96
 
97
-if ( $doaction ) {
97
+if ($doaction) {
98 98
 	check_admin_referer('bulk-media');
99 99
 
100
-	if ( 'delete_all' == $doaction ) {
101
-		$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
100
+	if ('delete_all' == $doaction) {
101
+		$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'");
102 102
 		$doaction = 'delete';
103
-	} elseif ( isset( $_REQUEST['media'] ) ) {
103
+	} elseif (isset($_REQUEST['media'])) {
104 104
 		$post_ids = $_REQUEST['media'];
105
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
106
-		$post_ids = explode( ',', $_REQUEST['ids'] );
105
+	} elseif (isset($_REQUEST['ids'])) {
106
+		$post_ids = explode(',', $_REQUEST['ids']);
107 107
 	}
108 108
 
109 109
 	$location = 'upload.php';
110
-	if ( $referer = wp_get_referer() ) {
111
-		if ( false !== strpos( $referer, 'upload.php' ) )
112
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
110
+	if ($referer = wp_get_referer()) {
111
+		if (false !== strpos($referer, 'upload.php'))
112
+			$location = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer);
113 113
 	}
114 114
 
115
-	switch ( $doaction ) {
115
+	switch ($doaction) {
116 116
 		case 'detach':
117
-			wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' );
117
+			wp_media_attach_action($_REQUEST['parent_post_id'], 'detach');
118 118
 			break;
119 119
 
120 120
 		case 'attach':
121
-			wp_media_attach_action( $_REQUEST['found_post_id'] );
121
+			wp_media_attach_action($_REQUEST['found_post_id']);
122 122
 			break;
123 123
 
124 124
 		case 'trash':
125
-			if ( !isset( $post_ids ) )
125
+			if ( ! isset($post_ids))
126 126
 				break;
127
-			foreach ( (array) $post_ids as $post_id ) {
128
-				if ( !current_user_can( 'delete_post', $post_id ) )
129
-					wp_die( __( 'You are not allowed to move this post to the trash.' ) );
127
+			foreach ((array) $post_ids as $post_id) {
128
+				if ( ! current_user_can('delete_post', $post_id))
129
+					wp_die(__('You are not allowed to move this post to the trash.'));
130 130
 
131
-				if ( !wp_trash_post( $post_id ) )
132
-					wp_die( __( 'Error in moving to Trash.' ) );
131
+				if ( ! wp_trash_post($post_id))
132
+					wp_die(__('Error in moving to Trash.'));
133 133
 			}
134
-			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
134
+			$location = add_query_arg(array('trashed' => count($post_ids), 'ids' => join(',', $post_ids)), $location);
135 135
 			break;
136 136
 		case 'untrash':
137
-			if ( !isset( $post_ids ) )
137
+			if ( ! isset($post_ids))
138 138
 				break;
139
-			foreach ( (array) $post_ids as $post_id ) {
140
-				if ( !current_user_can( 'delete_post', $post_id ) )
141
-					wp_die( __( 'You are not allowed to move this post out of the trash.' ) );
139
+			foreach ((array) $post_ids as $post_id) {
140
+				if ( ! current_user_can('delete_post', $post_id))
141
+					wp_die(__('You are not allowed to move this post out of the trash.'));
142 142
 
143
-				if ( !wp_untrash_post( $post_id ) )
144
-					wp_die( __( 'Error in restoring from Trash.' ) );
143
+				if ( ! wp_untrash_post($post_id))
144
+					wp_die(__('Error in restoring from Trash.'));
145 145
 			}
146
-			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
146
+			$location = add_query_arg('untrashed', count($post_ids), $location);
147 147
 			break;
148 148
 		case 'delete':
149
-			if ( !isset( $post_ids ) )
149
+			if ( ! isset($post_ids))
150 150
 				break;
151
-			foreach ( (array) $post_ids as $post_id_del ) {
152
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
153
-					wp_die( __( 'You are not allowed to delete this post.' ) );
151
+			foreach ((array) $post_ids as $post_id_del) {
152
+				if ( ! current_user_can('delete_post', $post_id_del))
153
+					wp_die(__('You are not allowed to delete this post.'));
154 154
 
155
-				if ( !wp_delete_attachment( $post_id_del ) )
156
-					wp_die( __( 'Error in deleting.' ) );
155
+				if ( ! wp_delete_attachment($post_id_del))
156
+					wp_die(__('Error in deleting.'));
157 157
 			}
158
-			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
158
+			$location = add_query_arg('deleted', count($post_ids), $location);
159 159
 			break;
160 160
 	}
161 161
 
162
-	wp_redirect( $location );
162
+	wp_redirect($location);
163 163
 	exit;
164
-} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
165
-	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
164
+} elseif ( ! empty($_GET['_wp_http_referer'])) {
165
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
166 166
 	 exit;
167 167
 }
168 168
 
@@ -171,111 +171,111 @@  discard block
 block discarded – undo
171 171
 $title = __('Media Library');
172 172
 $parent_file = 'upload.php';
173 173
 
174
-wp_enqueue_script( 'media' );
174
+wp_enqueue_script('media');
175 175
 
176
-add_screen_option( 'per_page' );
176
+add_screen_option('per_page');
177 177
 
178
-get_current_screen()->add_help_tab( array(
178
+get_current_screen()->add_help_tab(array(
179 179
 'id'		=> 'overview',
180 180
 'title'		=> __('Overview'),
181 181
 'content'	=>
182
-	'<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>' .
183
-	'<p>' . __( 'You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.' ) . '</p>' .
184
-	'<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>'
185
-) );
186
-get_current_screen()->add_help_tab( array(
182
+	'<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>'.
183
+	'<p>'.__('You can narrow the list by file type/status using the text link filters at the top of the screen. You also can refine the list by date using the dropdown menu above the media table.').'</p>'.
184
+	'<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>'
185
+));
186
+get_current_screen()->add_help_tab(array(
187 187
 'id'		=> 'actions-links',
188 188
 'title'		=> __('Available Actions'),
189 189
 'content'	=>
190
-	'<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>'
191
-) );
192
-get_current_screen()->add_help_tab( array(
190
+	'<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>'
191
+));
192
+get_current_screen()->add_help_tab(array(
193 193
 'id'		=> 'attaching-files',
194 194
 'title'		=> __('Attaching Files'),
195 195
 'content'	=>
196
-	'<p>' . __( 'If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.' ) . '</p>'
197
-) );
196
+	'<p>'.__('If a media file has not been attached to any post, you will see that in the Attached To column, and can click on Attach File to launch a small popup that will allow you to search for a post and attach the file.').'</p>'
197
+));
198 198
 
199 199
 get_current_screen()->set_help_sidebar(
200
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
201
-	'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
202
-	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
200
+	'<p><strong>'.__('For more information:').'</strong></p>'.
201
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
202
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
203 203
 );
204 204
 
205
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
205
+require_once(ABSPATH.'wp-admin/admin-header.php');
206 206
 ?>
207 207
 
208 208
 <div class="wrap">
209 209
 <h1>
210 210
 <?php
211
-echo esc_html( $title );
212
-if ( current_user_can( 'upload_files' ) ) { ?>
211
+echo esc_html($title);
212
+if (current_user_can('upload_files')) { ?>
213 213
 	<a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
214 214
 }
215
-if ( ! empty( $_REQUEST['s'] ) )
216
-	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
215
+if ( ! empty($_REQUEST['s']))
216
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query()); ?>
217 217
 </h1>
218 218
 
219 219
 <?php
220 220
 $message = '';
221
-if ( ! empty( $_GET['posted'] ) ) {
222
-	$message = __( 'Media attachment updated.' );
221
+if ( ! empty($_GET['posted'])) {
222
+	$message = __('Media attachment updated.');
223 223
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
224 224
 }
225 225
 
226
-if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
227
-	$message = sprintf( _n( 'Reattached %d attachment.', 'Reattached %d attachments.', $attached ), $attached );
228
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
226
+if ( ! empty($_GET['attached']) && $attached = absint($_GET['attached'])) {
227
+	$message = sprintf(_n('Reattached %d attachment.', 'Reattached %d attachments.', $attached), $attached);
228
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
229 229
 }
230 230
 
231
-if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
232
-	$message = sprintf( _n( 'Detached %d attachment.', 'Detached %d attachments.', $detached ), $detached );
233
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
231
+if ( ! empty($_GET['detach']) && $detached = absint($_GET['detach'])) {
232
+	$message = sprintf(_n('Detached %d attachment.', 'Detached %d attachments.', $detached), $detached);
233
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
234 234
 }
235 235
 
236
-if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
237
-	if ( 1 == $deleted ) {
238
-		$message = __( 'Media attachment permanently deleted.' );
236
+if ( ! empty($_GET['deleted']) && $deleted = absint($_GET['deleted'])) {
237
+	if (1 == $deleted) {
238
+		$message = __('Media attachment permanently deleted.');
239 239
 	} else {
240
-		$message = _n( '%d media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted );
240
+		$message = _n('%d media attachment permanently deleted.', '%d media attachments permanently deleted.', $deleted);
241 241
 	}
242
-	$message = sprintf( $message, number_format_i18n( $deleted ) );
242
+	$message = sprintf($message, number_format_i18n($deleted));
243 243
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
244 244
 }
245 245
 
246
-if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
247
-	if ( 1 == $trashed ) {
248
-		$message = __( 'Media attachment moved to the trash.' );
246
+if ( ! empty($_GET['trashed']) && $trashed = absint($_GET['trashed'])) {
247
+	if (1 == $trashed) {
248
+		$message = __('Media attachment moved to the trash.');
249 249
 	} else {
250
-		$message = _n( '%d media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed );
250
+		$message = _n('%d media attachment moved to the trash.', '%d media attachments moved to the trash.', $trashed);
251 251
 	}
252
-	$message = sprintf( $message, number_format_i18n( $trashed ) );
253
-	$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
252
+	$message = sprintf($message, number_format_i18n($trashed));
253
+	$message .= ' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
254 254
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
255 255
 }
256 256
 
257
-if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
258
-	if ( 1 == $untrashed ) {
259
-		$message = __( 'Media attachment restored from the trash.' );
257
+if ( ! empty($_GET['untrashed']) && $untrashed = absint($_GET['untrashed'])) {
258
+	if (1 == $untrashed) {
259
+		$message = __('Media attachment restored from the trash.');
260 260
 	} else {
261
-		$message = _n( '%d media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed );
261
+		$message = _n('%d media attachment restored from the trash.', '%d media attachments restored from the trash.', $untrashed);
262 262
 	}
263
-	$message = sprintf( $message, number_format_i18n( $untrashed ) );
263
+	$message = sprintf($message, number_format_i18n($untrashed));
264 264
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
265 265
 }
266 266
 
267
-$messages[1] = __( 'Media attachment updated.' );
268
-$messages[2] = __( 'Media attachment permanently deleted.' );
269
-$messages[3] = __( 'Error saving media attachment.' );
270
-$messages[4] = __( 'Media attachment 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>';
271
-$messages[5] = __( 'Media attachment restored from the trash.' );
267
+$messages[1] = __('Media attachment updated.');
268
+$messages[2] = __('Media attachment permanently deleted.');
269
+$messages[3] = __('Error saving media attachment.');
270
+$messages[4] = __('Media attachment 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>';
271
+$messages[5] = __('Media attachment restored from the trash.');
272 272
 
273
-if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
274
-	$message = $messages[ $_GET['message'] ];
273
+if ( ! empty($_GET['message']) && isset($messages[$_GET['message']])) {
274
+	$message = $messages[$_GET['message']];
275 275
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
276 276
 }
277 277
 
278
-if ( !empty($message) ) { ?>
278
+if ( ! empty($message)) { ?>
279 279
 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
280 280
 <?php } ?>
281 281
 
@@ -291,4 +291,4 @@  discard block
 block discarded – undo
291 291
 </div>
292 292
 
293 293
 <?php
294
-include( ABSPATH . 'wp-admin/admin-footer.php' );
294
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +36 added lines, -23 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( __( 'You do not have permission 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' );
@@ -108,8 +109,9 @@  discard block
 block discarded – undo
108 109
 
109 110
 	$location = 'upload.php';
110 111
 	if ( $referer = wp_get_referer() ) {
111
-		if ( false !== strpos( $referer, 'upload.php' ) )
112
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
112
+		if ( false !== strpos( $referer, 'upload.php' ) ) {
113
+					$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
114
+		}
113 115
 	}
114 116
 
115 117
 	switch ( $doaction ) {
@@ -122,38 +124,47 @@  discard block
 block discarded – undo
122 124
 			break;
123 125
 
124 126
 		case 'trash':
125
-			if ( !isset( $post_ids ) )
126
-				break;
127
+			if ( !isset( $post_ids ) ) {
128
+							break;
129
+			}
127 130
 			foreach ( (array) $post_ids as $post_id ) {
128
-				if ( !current_user_can( 'delete_post', $post_id ) )
129
-					wp_die( __( 'You are not allowed to move this post to the trash.' ) );
131
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
132
+									wp_die( __( 'You are not allowed to move this post to the trash.' ) );
133
+				}
130 134
 
131
-				if ( !wp_trash_post( $post_id ) )
132
-					wp_die( __( 'Error in moving to Trash.' ) );
135
+				if ( !wp_trash_post( $post_id ) ) {
136
+									wp_die( __( 'Error in moving to Trash.' ) );
137
+				}
133 138
 			}
134 139
 			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
135 140
 			break;
136 141
 		case 'untrash':
137
-			if ( !isset( $post_ids ) )
138
-				break;
142
+			if ( !isset( $post_ids ) ) {
143
+							break;
144
+			}
139 145
 			foreach ( (array) $post_ids as $post_id ) {
140
-				if ( !current_user_can( 'delete_post', $post_id ) )
141
-					wp_die( __( 'You are not allowed to move this post out of the trash.' ) );
146
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
147
+									wp_die( __( 'You are not allowed to move this post out of the trash.' ) );
148
+				}
142 149
 
143
-				if ( !wp_untrash_post( $post_id ) )
144
-					wp_die( __( 'Error in restoring from Trash.' ) );
150
+				if ( !wp_untrash_post( $post_id ) ) {
151
+									wp_die( __( 'Error in restoring from Trash.' ) );
152
+				}
145 153
 			}
146 154
 			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
147 155
 			break;
148 156
 		case 'delete':
149
-			if ( !isset( $post_ids ) )
150
-				break;
157
+			if ( !isset( $post_ids ) ) {
158
+							break;
159
+			}
151 160
 			foreach ( (array) $post_ids as $post_id_del ) {
152
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
153
-					wp_die( __( 'You are not allowed to delete this post.' ) );
161
+				if ( !current_user_can( 'delete_post', $post_id_del ) ) {
162
+									wp_die( __( 'You are not allowed to delete this post.' ) );
163
+				}
154 164
 
155
-				if ( !wp_delete_attachment( $post_id_del ) )
156
-					wp_die( __( 'Error in deleting.' ) );
165
+				if ( !wp_delete_attachment( $post_id_del ) ) {
166
+									wp_die( __( 'Error in deleting.' ) );
167
+				}
157 168
 			}
158 169
 			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
159 170
 			break;
@@ -212,8 +223,10 @@  discard block
 block discarded – undo
212 223
 if ( current_user_can( 'upload_files' ) ) { ?>
213 224
 	<a href="media-new.php" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
214 225
 }
215
-if ( ! empty( $_REQUEST['s'] ) )
216
-	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() ); ?>
226
+if ( ! empty( $_REQUEST['s'] ) ) {
227
+	printf( '<span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
228
+}
229
+?>
217 230
 </h1>
218 231
 
219 232
 <?php
Please login to merge, or discard this patch.
src/wp-admin/media-upload.php 2 patches
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,38 +9,38 @@  discard block
 block discarded – undo
9 9
  * @subpackage Administration
10 10
  */
11 11
 
12
-if ( ! isset( $_GET['inline'] ) )
13
-	define( 'IFRAME_REQUEST' , true );
12
+if ( ! isset($_GET['inline']))
13
+	define('IFRAME_REQUEST', true);
14 14
 
15 15
 /** Load WordPress Administration Bootstrap */
16
-require_once( dirname( __FILE__ ) . '/admin.php' );
16
+require_once(dirname(__FILE__).'/admin.php');
17 17
 
18
-if (!current_user_can('upload_files'))
18
+if ( ! current_user_can('upload_files'))
19 19
 	wp_die(__('You do not have permission to upload files.'));
20 20
 
21 21
 wp_enqueue_script('plupload-handlers');
22 22
 wp_enqueue_script('image-edit');
23
-wp_enqueue_script('set-post-thumbnail' );
23
+wp_enqueue_script('set-post-thumbnail');
24 24
 wp_enqueue_style('imgareaselect');
25
-wp_enqueue_script( 'media-gallery' );
25
+wp_enqueue_script('media-gallery');
26 26
 
27
-@header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
27
+@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset'));
28 28
 
29 29
 // IDs should be integers
30 30
 $ID = isset($ID) ? (int) $ID : 0;
31
-$post_id = isset($post_id)? (int) $post_id : 0;
31
+$post_id = isset($post_id) ? (int) $post_id : 0;
32 32
 
33 33
 // Require an ID for the edit screen.
34
-if ( isset($action) && $action == 'edit' && !$ID ) {
35
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
34
+if (isset($action) && $action == 'edit' && ! $ID) {
35
+	wp_die(__('Cheatin&#8217; uh?'), 403);
36 36
 }
37 37
 
38
-if ( ! empty( $_REQUEST['post_id'] ) && ! current_user_can( 'edit_post' , $_REQUEST['post_id'] ) ) {
39
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
38
+if ( ! empty($_REQUEST['post_id']) && ! current_user_can('edit_post', $_REQUEST['post_id'])) {
39
+	wp_die(__('Cheatin&#8217; uh?'), 403);
40 40
 }
41 41
 
42 42
 // Upload type: image, video, file, ..?
43
-if ( isset($_GET['type']) ) {
43
+if (isset($_GET['type'])) {
44 44
 	$type = strval($_GET['type']);
45 45
 } else {
46 46
 	/**
@@ -51,11 +51,11 @@  discard block
 block discarded – undo
51 51
 	 * @param string $type The default media upload type. Possible values include
52 52
 	 *                     'image', 'audio', 'video', 'file', etc. Default 'file'.
53 53
 	 */
54
-	$type = apply_filters( 'media_upload_default_type', 'file' );
54
+	$type = apply_filters('media_upload_default_type', 'file');
55 55
 }
56 56
 
57 57
 // Tab: gallery, library, or type-specific.
58
-if ( isset($_GET['tab']) ) {
58
+if (isset($_GET['tab'])) {
59 59
 	$tab = strval($_GET['tab']);
60 60
 } else {
61 61
 	/**
@@ -65,13 +65,13 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param string $type The default media popup tab. Default 'type' (From Computer).
67 67
 	 */
68
-	$tab = apply_filters( 'media_upload_default_tab', 'type' );
68
+	$tab = apply_filters('media_upload_default_tab', 'type');
69 69
 }
70 70
 
71 71
 $body_id = 'media-upload';
72 72
 
73 73
 // Let the action code decide how to handle the request.
74
-if ( $tab == 'type' || $tab == 'type_url' || ! array_key_exists( $tab , media_upload_tabs() ) ) {
74
+if ($tab == 'type' || $tab == 'type_url' || ! array_key_exists($tab, media_upload_tabs())) {
75 75
 	/**
76 76
 	 * Fires inside specific upload-type views in the legacy (pre-3.5.0)
77 77
 	 * media popup based on the current tab.
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 *
87 87
 	 * @since 2.5.0
88 88
 	 */
89
-	do_action( "media_upload_$type" );
89
+	do_action("media_upload_$type");
90 90
 } else {
91 91
 	/**
92 92
 	 * Fires inside limited and specific upload-tab views in the legacy
@@ -98,6 +98,6 @@  discard block
 block discarded – undo
98 98
 	 *
99 99
 	 * @since 2.5.0
100 100
 	 */
101
-	do_action( "media_upload_$tab" );
101
+	do_action("media_upload_$tab");
102 102
 }
103 103
 
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,14 +9,16 @@
 block discarded – undo
9 9
  * @subpackage Administration
10 10
  */
11 11
 
12
-if ( ! isset( $_GET['inline'] ) )
12
+if ( ! isset( $_GET['inline'] ) ) {
13 13
 	define( 'IFRAME_REQUEST' , true );
14
+}
14 15
 
15 16
 /** Load WordPress Administration Bootstrap */
16 17
 require_once( dirname( __FILE__ ) . '/admin.php' );
17 18
 
18
-if (!current_user_can('upload_files'))
19
+if (!current_user_can('upload_files')) {
19 20
 	wp_die(__('You do not have permission to upload files.'));
21
+}
20 22
 
21 23
 wp_enqueue_script('plupload-handlers');
22 24
 wp_enqueue_script('image-edit');
Please login to merge, or discard this patch.
src/wp-admin/options.php 2 patches
Spacing   +86 added lines, -86 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  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 21
 $title = __('Settings');
22 22
 $this_file = 'options.php';
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 $capability = 'manage_options';
28 28
 
29 29
 // This is for back compat and will eventually be removed.
30
-if ( empty($option_page) ) {
30
+if (empty($option_page)) {
31 31
 	$option_page = 'options';
32 32
 } else {
33 33
 
@@ -41,59 +41,59 @@  discard block
 block discarded – undo
41 41
 	 *
42 42
 	 * @param string $capability The capability used for the page, which is manage_options by default.
43 43
 	 */
44
-	$capability = apply_filters( "option_page_capability_{$option_page}", $capability );
44
+	$capability = apply_filters("option_page_capability_{$option_page}", $capability);
45 45
 }
46 46
 
47
-if ( !current_user_can( $capability ) )
48
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
47
+if ( ! current_user_can($capability))
48
+	wp_die(__('Cheatin&#8217; uh?'), 403);
49 49
 
50 50
 // Handle admin email change requests
51
-if ( is_multisite() ) {
52
-	if ( ! empty($_GET[ 'adminhash' ] ) ) {
53
-		$new_admin_details = get_option( 'adminhash' );
51
+if (is_multisite()) {
52
+	if ( ! empty($_GET['adminhash'])) {
53
+		$new_admin_details = get_option('adminhash');
54 54
 		$redirect = 'options-general.php?updated=false';
55
-		if ( is_array( $new_admin_details ) && $new_admin_details[ 'hash' ] == $_GET[ 'adminhash' ] && !empty($new_admin_details[ 'newemail' ]) ) {
56
-			update_option( 'admin_email', $new_admin_details[ 'newemail' ] );
57
-			delete_option( 'adminhash' );
58
-			delete_option( 'new_admin_email' );
55
+		if (is_array($new_admin_details) && $new_admin_details['hash'] == $_GET['adminhash'] && ! empty($new_admin_details['newemail'])) {
56
+			update_option('admin_email', $new_admin_details['newemail']);
57
+			delete_option('adminhash');
58
+			delete_option('new_admin_email');
59 59
 			$redirect = 'options-general.php?updated=true';
60 60
 		}
61
-		wp_redirect( admin_url( $redirect ) );
61
+		wp_redirect(admin_url($redirect));
62 62
 		exit;
63
-	} elseif ( ! empty( $_GET['dismiss'] ) && 'new_admin_email' == $_GET['dismiss'] ) {
64
-		delete_option( 'adminhash' );
65
-		delete_option( 'new_admin_email' );
66
-		wp_redirect( admin_url( 'options-general.php?updated=true' ) );
63
+	} elseif ( ! empty($_GET['dismiss']) && 'new_admin_email' == $_GET['dismiss']) {
64
+		delete_option('adminhash');
65
+		delete_option('new_admin_email');
66
+		wp_redirect(admin_url('options-general.php?updated=true'));
67 67
 		exit;
68 68
 	}
69 69
 }
70 70
 
71
-if ( is_multisite() && !is_super_admin() && 'update' != $action )
72
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
71
+if (is_multisite() && ! is_super_admin() && 'update' != $action)
72
+	wp_die(__('Cheatin&#8217; uh?'), 403);
73 73
 
74 74
 $whitelist_options = array(
75
-	'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
76
-	'discussion' => array( 'default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration' ),
77
-	'media' => array( 'thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type' ),
78
-	'reading' => array( 'posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public' ),
79
-	'writing' => array( 'default_category', 'default_email_category', 'default_link_category', 'default_post_format' )
75
+	'general' => array('blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG'),
76
+	'discussion' => array('default_pingback_flag', 'default_ping_status', 'default_comment_status', 'comments_notify', 'moderation_notify', 'comment_moderation', 'require_name_email', 'comment_whitelist', 'comment_max_links', 'moderation_keys', 'blacklist_keys', 'show_avatars', 'avatar_rating', 'avatar_default', 'close_comments_for_old_posts', 'close_comments_days_old', 'thread_comments', 'thread_comments_depth', 'page_comments', 'comments_per_page', 'default_comments_page', 'comment_order', 'comment_registration'),
77
+	'media' => array('thumbnail_size_w', 'thumbnail_size_h', 'thumbnail_crop', 'medium_size_w', 'medium_size_h', 'large_size_w', 'large_size_h', 'image_default_size', 'image_default_align', 'image_default_link_type'),
78
+	'reading' => array('posts_per_page', 'posts_per_rss', 'rss_use_excerpt', 'show_on_front', 'page_on_front', 'page_for_posts', 'blog_public'),
79
+	'writing' => array('default_category', 'default_email_category', 'default_link_category', 'default_post_format')
80 80
 );
81 81
 $whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array();
82 82
 
83 83
 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
84 84
 
85
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
85
+if ( ! in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8')))
86 86
 	$whitelist_options['reading'][] = 'blog_charset';
87 87
 
88
-if ( get_site_option( 'initial_db_version' ) < 32453 ) {
88
+if (get_site_option('initial_db_version') < 32453) {
89 89
 	$whitelist_options['writing'][] = 'use_smilies';
90 90
 	$whitelist_options['writing'][] = 'use_balanceTags';
91 91
 }
92 92
 
93
-if ( !is_multisite() ) {
94
-	if ( !defined( 'WP_SITEURL' ) )
93
+if ( ! is_multisite()) {
94
+	if ( ! defined('WP_SITEURL'))
95 95
 		$whitelist_options['general'][] = 'siteurl';
96
-	if ( !defined( 'WP_HOME' ) )
96
+	if ( ! defined('WP_HOME'))
97 97
 		$whitelist_options['general'][] = 'home';
98 98
 
99 99
 	$whitelist_options['general'][] = 'admin_email';
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
 	$whitelist_options['media'][] = 'uploads_use_yearmonth_folders';
107 107
 
108 108
 	// If upload_url_path and upload_path are both default values, they're locked.
109
-	if ( get_option( 'upload_url_path' ) || ( get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path') ) ) {
109
+	if (get_option('upload_url_path') || (get_option('upload_path') != 'wp-content/uploads' && get_option('upload_path'))) {
110 110
 		$whitelist_options['media'][] = 'upload_path';
111 111
 		$whitelist_options['media'][] = 'upload_url_path';
112 112
 	}
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
 	 *
121 121
 	 * @param bool $enabled Whether post-by-email configuration is enabled. Default true.
122 122
 	 */
123
-	if ( apply_filters( 'enable_post_by_email_configuration', true ) )
123
+	if (apply_filters('enable_post_by_email_configuration', true))
124 124
 		$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
125 125
 }
126 126
 
@@ -131,79 +131,79 @@  discard block
 block discarded – undo
131 131
  *
132 132
  * @param array White list options.
133 133
  */
134
-$whitelist_options = apply_filters( 'whitelist_options', $whitelist_options );
134
+$whitelist_options = apply_filters('whitelist_options', $whitelist_options);
135 135
 
136 136
 /*
137 137
  * If $_GET['action'] == 'update' we are saving settings sent from a settings page
138 138
  */
139
-if ( 'update' == $action ) {
140
-	if ( 'options' == $option_page && !isset( $_POST['option_page'] ) ) { // This is for back compat and will eventually be removed.
139
+if ('update' == $action) {
140
+	if ('options' == $option_page && ! isset($_POST['option_page'])) { // This is for back compat and will eventually be removed.
141 141
 		$unregistered = true;
142
-		check_admin_referer( 'update-options' );
142
+		check_admin_referer('update-options');
143 143
 	} else {
144 144
 		$unregistered = false;
145
-		check_admin_referer( $option_page . '-options' );
145
+		check_admin_referer($option_page.'-options');
146 146
 	}
147 147
 
148
-	if ( !isset( $whitelist_options[ $option_page ] ) )
149
-		wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
148
+	if ( ! isset($whitelist_options[$option_page]))
149
+		wp_die(__('<strong>ERROR</strong>: options page not found.'));
150 150
 
151
-	if ( 'options' == $option_page ) {
152
-		if ( is_multisite() && ! is_super_admin() )
153
-			wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
154
-		$options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
151
+	if ('options' == $option_page) {
152
+		if (is_multisite() && ! is_super_admin())
153
+			wp_die(__('You do not have sufficient permissions to modify unregistered settings for this site.'));
154
+		$options = explode(',', wp_unslash($_POST['page_options']));
155 155
 	} else {
156
-		$options = $whitelist_options[ $option_page ];
156
+		$options = $whitelist_options[$option_page];
157 157
 	}
158 158
 
159
-	if ( 'general' == $option_page ) {
159
+	if ('general' == $option_page) {
160 160
 		// Handle custom date/time formats.
161
-		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
161
+		if ( ! empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash($_POST['date_format']))
162 162
 			$_POST['date_format'] = $_POST['date_format_custom'];
163
-		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
163
+		if ( ! empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash($_POST['time_format']))
164 164
 			$_POST['time_format'] = $_POST['time_format_custom'];
165 165
 		// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
166
-		if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
166
+		if ( ! empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string'])) {
167 167
 			$_POST['gmt_offset'] = $_POST['timezone_string'];
168 168
 			$_POST['gmt_offset'] = preg_replace('/UTC\+?/', '', $_POST['gmt_offset']);
169 169
 			$_POST['timezone_string'] = '';
170 170
 		}
171 171
 
172 172
 		// Handle translation install.
173
-		if ( ! empty( $_POST['WPLANG'] ) && ( ! is_multisite() || is_super_admin() ) ) { // @todo: Skip if already installed
174
-			require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
173
+		if ( ! empty($_POST['WPLANG']) && ( ! is_multisite() || is_super_admin())) { // @todo: Skip if already installed
174
+			require_once(ABSPATH.'wp-admin/includes/translation-install.php');
175 175
 
176
-			if ( wp_can_install_language_pack() ) {
177
-				$language = wp_download_language_pack( $_POST['WPLANG'] );
178
-				if ( $language ) {
176
+			if (wp_can_install_language_pack()) {
177
+				$language = wp_download_language_pack($_POST['WPLANG']);
178
+				if ($language) {
179 179
 					$_POST['WPLANG'] = $language;
180 180
 				}
181 181
 			}
182 182
 		}
183 183
 	}
184 184
 
185
-	if ( $options ) {
186
-		foreach ( $options as $option ) {
187
-			if ( $unregistered )
188
-				_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
185
+	if ($options) {
186
+		foreach ($options as $option) {
187
+			if ($unregistered)
188
+				_deprecated_argument('options.php', '2.7', sprintf(__('The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API'), $option, $option_page));
189 189
 
190
-			$option = trim( $option );
190
+			$option = trim($option);
191 191
 			$value = null;
192
-			if ( isset( $_POST[ $option ] ) ) {
193
-				$value = $_POST[ $option ];
194
-				if ( ! is_array( $value ) )
195
-					$value = trim( $value );
196
-				$value = wp_unslash( $value );
192
+			if (isset($_POST[$option])) {
193
+				$value = $_POST[$option];
194
+				if ( ! is_array($value))
195
+					$value = trim($value);
196
+				$value = wp_unslash($value);
197 197
 			}
198
-			update_option( $option, $value );
198
+			update_option($option, $value);
199 199
 		}
200 200
 
201 201
 		// Switch translation in case WPLANG was changed.
202
-		$language = get_option( 'WPLANG' );
203
-		if ( $language ) {
204
-			load_default_textdomain( $language );
202
+		$language = get_option('WPLANG');
203
+		if ($language) {
204
+			load_default_textdomain($language);
205 205
 		} else {
206
-			unload_textdomain( 'default' );
206
+			unload_textdomain('default');
207 207
 		}
208 208
 	}
209 209
 
@@ -211,38 +211,38 @@  discard block
 block discarded – undo
211 211
 	 * Handle settings errors and return to options page
212 212
 	 */
213 213
 	// If no settings errors were registered add a general 'updated' message.
214
-	if ( !count( get_settings_errors() ) )
214
+	if ( ! count(get_settings_errors()))
215 215
 		add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
216 216
 	set_transient('settings_errors', get_settings_errors(), 30);
217 217
 
218 218
 	/**
219 219
 	 * Redirect back to the settings page that was submitted
220 220
 	 */
221
-	$goback = add_query_arg( 'settings-updated', 'true',  wp_get_referer() );
222
-	wp_redirect( $goback );
221
+	$goback = add_query_arg('settings-updated', 'true', wp_get_referer());
222
+	wp_redirect($goback);
223 223
 	exit;
224 224
 }
225 225
 
226
-include( ABSPATH . 'wp-admin/admin-header.php' ); ?>
226
+include(ABSPATH.'wp-admin/admin-header.php'); ?>
227 227
 
228 228
 <div class="wrap">
229
-  <h1><?php esc_html_e( 'All Settings' ); ?></h1>
229
+  <h1><?php esc_html_e('All Settings'); ?></h1>
230 230
   <form name="form" action="options.php" method="post" id="all-options">
231 231
   <?php wp_nonce_field('options-options') ?>
232 232
   <input type="hidden" name="action" value="update" />
233 233
   <input type="hidden" name="option_page" value="options" />
234 234
   <table class="form-table">
235 235
 <?php
236
-$options = $wpdb->get_results( "SELECT * FROM $wpdb->options ORDER BY option_name" );
236
+$options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
237 237
 
238
-foreach ( (array) $options as $option ) :
238
+foreach ((array) $options as $option) :
239 239
 	$disabled = false;
240
-	if ( $option->option_name == '' )
240
+	if ($option->option_name == '')
241 241
 		continue;
242
-	if ( is_serialized( $option->option_value ) ) {
243
-		if ( is_serialized_string( $option->option_value ) ) {
242
+	if (is_serialized($option->option_value)) {
243
+		if (is_serialized_string($option->option_value)) {
244 244
 			// This is a serialized string, so we should display it.
245
-			$value = maybe_unserialize( $option->option_value );
245
+			$value = maybe_unserialize($option->option_value);
246 246
 			$options_to_update[] = $option->option_name;
247 247
 			$class = 'all-options';
248 248
 		} else {
@@ -255,28 +255,28 @@  discard block
 block discarded – undo
255 255
 		$options_to_update[] = $option->option_name;
256 256
 		$class = 'all-options';
257 257
 	}
258
-	$name = esc_attr( $option->option_name );
258
+	$name = esc_attr($option->option_name);
259 259
 	?>
260 260
 <tr>
261
-	<th scope="row"><label for="<?php echo $name ?>"><?php echo esc_html( $option->option_name ); ?></label></th>
261
+	<th scope="row"><label for="<?php echo $name ?>"><?php echo esc_html($option->option_name); ?></label></th>
262 262
 <td>
263
-<?php if ( strpos( $value, "\n" ) !== false ) : ?>
263
+<?php if (strpos($value, "\n") !== false) : ?>
264 264
 	<textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php
265
-		echo esc_textarea( $value );
265
+		echo esc_textarea($value);
266 266
 	?></textarea>
267 267
 	<?php else: ?>
268
-		<input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> />
268
+		<input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr($value) ?>"<?php disabled($disabled, true) ?> />
269 269
 	<?php endif ?></td>
270 270
 </tr>
271 271
 <?php endforeach; ?>
272 272
   </table>
273 273
 
274
-<input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" />
274
+<input type="hidden" name="page_options" value="<?php echo esc_attr(implode(',', $options_to_update)); ?>" />
275 275
 
276
-<?php submit_button( __( 'Save Changes' ), 'primary', 'Update' ); ?>
276
+<?php submit_button(__('Save Changes'), 'primary', 'Update'); ?>
277 277
 
278 278
   </form>
279 279
 </div>
280 280
 
281 281
 <?php
282
-include( ABSPATH . 'wp-admin/admin-footer.php' );
282
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +45 added lines, -28 removed lines patch added patch discarded remove patch
@@ -44,8 +44,9 @@  discard block
 block discarded – undo
44 44
 	$capability = apply_filters( "option_page_capability_{$option_page}", $capability );
45 45
 }
46 46
 
47
-if ( !current_user_can( $capability ) )
47
+if ( !current_user_can( $capability ) ) {
48 48
 	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
49
+}
49 50
 
50 51
 // Handle admin email change requests
51 52
 if ( is_multisite() ) {
@@ -68,8 +69,9 @@  discard block
 block discarded – undo
68 69
 	}
69 70
 }
70 71
 
71
-if ( is_multisite() && !is_super_admin() && 'update' != $action )
72
+if ( is_multisite() && !is_super_admin() && 'update' != $action ) {
72 73
 	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
74
+}
73 75
 
74 76
 $whitelist_options = array(
75 77
 	'general' => array( 'blogname', 'blogdescription', 'gmt_offset', 'date_format', 'time_format', 'start_of_week', 'timezone_string', 'WPLANG' ),
@@ -82,8 +84,9 @@  discard block
 block discarded – undo
82 84
 
83 85
 $mail_options = array('mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass');
84 86
 
85
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
87
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
86 88
 	$whitelist_options['reading'][] = 'blog_charset';
89
+}
87 90
 
88 91
 if ( get_site_option( 'initial_db_version' ) < 32453 ) {
89 92
 	$whitelist_options['writing'][] = 'use_smilies';
@@ -91,10 +94,12 @@  discard block
 block discarded – undo
91 94
 }
92 95
 
93 96
 if ( !is_multisite() ) {
94
-	if ( !defined( 'WP_SITEURL' ) )
95
-		$whitelist_options['general'][] = 'siteurl';
96
-	if ( !defined( 'WP_HOME' ) )
97
-		$whitelist_options['general'][] = 'home';
97
+	if ( !defined( 'WP_SITEURL' ) ) {
98
+			$whitelist_options['general'][] = 'siteurl';
99
+	}
100
+	if ( !defined( 'WP_HOME' ) ) {
101
+			$whitelist_options['general'][] = 'home';
102
+	}
98 103
 
99 104
 	$whitelist_options['general'][] = 'admin_email';
100 105
 	$whitelist_options['general'][] = 'users_can_register';
@@ -120,9 +125,10 @@  discard block
 block discarded – undo
120 125
 	 *
121 126
 	 * @param bool $enabled Whether post-by-email configuration is enabled. Default true.
122 127
 	 */
123
-	if ( apply_filters( 'enable_post_by_email_configuration', true ) )
124
-		$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
125
-}
128
+	if ( apply_filters( 'enable_post_by_email_configuration', true ) ) {
129
+			$whitelist_options['writing'] = array_merge($whitelist_options['writing'], $mail_options);
130
+	}
131
+	}
126 132
 
127 133
 /**
128 134
  * Filter the options white list.
@@ -145,12 +151,14 @@  discard block
 block discarded – undo
145 151
 		check_admin_referer( $option_page . '-options' );
146 152
 	}
147 153
 
148
-	if ( !isset( $whitelist_options[ $option_page ] ) )
149
-		wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
154
+	if ( !isset( $whitelist_options[ $option_page ] ) ) {
155
+			wp_die( __( '<strong>ERROR</strong>: options page not found.' ) );
156
+	}
150 157
 
151 158
 	if ( 'options' == $option_page ) {
152
-		if ( is_multisite() && ! is_super_admin() )
153
-			wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
159
+		if ( is_multisite() && ! is_super_admin() ) {
160
+					wp_die( __( 'You do not have sufficient permissions to modify unregistered settings for this site.' ) );
161
+		}
154 162
 		$options = explode( ',', wp_unslash( $_POST[ 'page_options' ] ) );
155 163
 	} else {
156 164
 		$options = $whitelist_options[ $option_page ];
@@ -158,10 +166,12 @@  discard block
 block discarded – undo
158 166
 
159 167
 	if ( 'general' == $option_page ) {
160 168
 		// Handle custom date/time formats.
161
-		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) )
162
-			$_POST['date_format'] = $_POST['date_format_custom'];
163
-		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) )
164
-			$_POST['time_format'] = $_POST['time_format_custom'];
169
+		if ( !empty($_POST['date_format']) && isset($_POST['date_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['date_format'] ) ) {
170
+					$_POST['date_format'] = $_POST['date_format_custom'];
171
+		}
172
+		if ( !empty($_POST['time_format']) && isset($_POST['time_format_custom']) && '\c\u\s\t\o\m' == wp_unslash( $_POST['time_format'] ) ) {
173
+					$_POST['time_format'] = $_POST['time_format_custom'];
174
+		}
165 175
 		// Map UTC+- timezones to gmt_offsets and set timezone_string to empty.
166 176
 		if ( !empty($_POST['timezone_string']) && preg_match('/^UTC[+-]/', $_POST['timezone_string']) ) {
167 177
 			$_POST['gmt_offset'] = $_POST['timezone_string'];
@@ -184,15 +194,17 @@  discard block
 block discarded – undo
184 194
 
185 195
 	if ( $options ) {
186 196
 		foreach ( $options as $option ) {
187
-			if ( $unregistered )
188
-				_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
197
+			if ( $unregistered ) {
198
+							_deprecated_argument( 'options.php', '2.7', sprintf( __( 'The <code>%1$s</code> setting is unregistered. Unregistered settings are deprecated. See https://codex.wordpress.org/Settings_API' ), $option, $option_page ) );
199
+			}
189 200
 
190 201
 			$option = trim( $option );
191 202
 			$value = null;
192 203
 			if ( isset( $_POST[ $option ] ) ) {
193 204
 				$value = $_POST[ $option ];
194
-				if ( ! is_array( $value ) )
195
-					$value = trim( $value );
205
+				if ( ! is_array( $value ) ) {
206
+									$value = trim( $value );
207
+				}
196 208
 				$value = wp_unslash( $value );
197 209
 			}
198 210
 			update_option( $option, $value );
@@ -211,8 +223,9 @@  discard block
 block discarded – undo
211 223
 	 * Handle settings errors and return to options page
212 224
 	 */
213 225
 	// If no settings errors were registered add a general 'updated' message.
214
-	if ( !count( get_settings_errors() ) )
215
-		add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
226
+	if ( !count( get_settings_errors() ) ) {
227
+			add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
228
+	}
216 229
 	set_transient('settings_errors', get_settings_errors(), 30);
217 230
 
218 231
 	/**
@@ -237,8 +250,9 @@  discard block
 block discarded – undo
237 250
 
238 251
 foreach ( (array) $options as $option ) :
239 252
 	$disabled = false;
240
-	if ( $option->option_name == '' )
241
-		continue;
253
+	if ( $option->option_name == '' ) {
254
+			continue;
255
+	}
242 256
 	if ( is_serialized( $option->option_value ) ) {
243 257
 		if ( is_serialized_string( $option->option_value ) ) {
244 258
 			// This is a serialized string, so we should display it.
@@ -264,11 +278,14 @@  discard block
 block discarded – undo
264 278
 	<textarea class="<?php echo $class ?>" name="<?php echo $name ?>" id="<?php echo $name ?>" cols="30" rows="5"><?php
265 279
 		echo esc_textarea( $value );
266 280
 	?></textarea>
267
-	<?php else: ?>
281
+	<?php else {
282
+	: ?>
268 283
 		<input class="regular-text <?php echo $class ?>" type="text" name="<?php echo $name ?>" id="<?php echo $name ?>" value="<?php echo esc_attr( $value ) ?>"<?php disabled( $disabled, true ) ?> />
269 284
 	<?php endif ?></td>
270 285
 </tr>
271
-<?php endforeach; ?>
286
+<?php endforeach;
287
+}
288
+?>
272 289
   </table>
273 290
 
274 291
 <input type="hidden" name="page_options" value="<?php echo esc_attr( implode( ',', $options_to_update ) ); ?>" />
Please login to merge, or discard this patch.
src/wp-admin/import.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Import WordPress Administration Screen
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Import WordPress Administration Screen
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 define('WP_LOAD_IMPORTERS', true);
10 10
 
Please login to merge, or discard this patch.
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -9,52 +9,52 @@  discard block
 block discarded – undo
9 9
 define('WP_LOAD_IMPORTERS', true);
10 10
 
11 11
 /** Load WordPress Bootstrap */
12
-require_once( dirname( __FILE__ ) . '/admin.php' );
12
+require_once(dirname(__FILE__).'/admin.php');
13 13
 
14
-if ( !current_user_can('import') )
14
+if ( ! current_user_can('import'))
15 15
 	wp_die(__('You do not have sufficient permissions to import content in this site.'));
16 16
 
17 17
 $title = __('Import');
18 18
 
19
-get_current_screen()->add_help_tab( array(
19
+get_current_screen()->add_help_tab(array(
20 20
 	'id'      => 'overview',
21 21
 	'title'   => __('Overview'),
22
-	'content' => '<p>' . __('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.') . '</p>' .
23
-		'<p>' . __('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.') . '</p>',
24
-) );
22
+	'content' => '<p>'.__('This screen lists links to plugins to import data from blogging/content management platforms. Choose the platform you want to import from, and click Install Now when you are prompted in the popup window. If your platform is not listed, click the link to search the plugin directory for other importer plugins to see if there is one for your platform.').'</p>'.
23
+		'<p>'.__('In previous versions of WordPress, all importers were built-in. They have been turned into plugins since most people only use them once or infrequently.').'</p>',
24
+));
25 25
 
26 26
 get_current_screen()->set_help_sidebar(
27
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
28
-	'<p>' . __('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>') . '</p>' .
29
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
27
+	'<p><strong>'.__('For more information:').'</strong></p>'.
28
+	'<p>'.__('<a href="https://codex.wordpress.org/Tools_Import_Screen" target="_blank">Documentation on Import</a>').'</p>'.
29
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
30 30
 );
31 31
 
32
-if ( current_user_can( 'install_plugins' ) )
32
+if (current_user_can('install_plugins'))
33 33
 	$popular_importers = wp_get_popular_importers();
34 34
 else
35 35
 	$popular_importers = array();
36 36
 
37 37
 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
38
-if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
39
-	$importer_id = $popular_importers[ $_GET['invalid'] ]['importer-id'];
40
-	if ( $importer_id != $_GET['invalid'] ) { // Prevent redirect loops.
41
-		wp_redirect( admin_url( 'admin.php?import=' . $importer_id ) );
38
+if ( ! empty($_GET['invalid']) && isset($popular_importers[$_GET['invalid']])) {
39
+	$importer_id = $popular_importers[$_GET['invalid']]['importer-id'];
40
+	if ($importer_id != $_GET['invalid']) { // Prevent redirect loops.
41
+		wp_redirect(admin_url('admin.php?import='.$importer_id));
42 42
 		exit;
43 43
 	}
44
-	unset( $importer_id );
44
+	unset($importer_id);
45 45
 }
46 46
 
47 47
 add_thickbox();
48
-wp_enqueue_script( 'plugin-install' );
48
+wp_enqueue_script('plugin-install');
49 49
 
50
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
50
+require_once(ABSPATH.'wp-admin/admin-header.php');
51 51
 $parent_file = 'tools.php';
52 52
 ?>
53 53
 
54 54
 <div class="wrap">
55
-<h1><?php echo esc_html( $title ); ?></h1>
56
-<?php if ( ! empty( $_GET['invalid'] ) ) : ?>
57
-	<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf( __('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html( $_GET['invalid'] ) ); ?></p></div>
55
+<h1><?php echo esc_html($title); ?></h1>
56
+<?php if ( ! empty($_GET['invalid'])) : ?>
57
+	<div class="error"><p><strong><?php _e('ERROR:')?></strong> <?php printf(__('The <strong>%s</strong> importer is invalid or is not installed.'), esc_html($_GET['invalid'])); ?></p></div>
58 58
 <?php endif; ?>
59 59
 <p><?php _e('If you have posts or comments in another system, WordPress can import those into this site. To get started, choose a system to import from below:'); ?></p>
60 60
 
@@ -63,48 +63,48 @@  discard block
 block discarded – undo
63 63
 $importers = get_importers();
64 64
 
65 65
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
66
-foreach ( $popular_importers as $pop_importer => $pop_data ) {
67
-	if ( isset( $importers[ $pop_importer ] ) )
66
+foreach ($popular_importers as $pop_importer => $pop_data) {
67
+	if (isset($importers[$pop_importer]))
68 68
 		continue;
69
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
69
+	if (isset($importers[$pop_data['importer-id']]))
70 70
 		continue;
71
-	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
71
+	$importers[$pop_data['importer-id']] = array($pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug']);
72 72
 }
73 73
 
74
-if ( empty( $importers ) ) {
75
-	echo '<p>' . __('No importers are available.') . '</p>'; // TODO: make more helpful
74
+if (empty($importers)) {
75
+	echo '<p>'.__('No importers are available.').'</p>'; // TODO: make more helpful
76 76
 } else {
77
-	uasort( $importers, '_usort_by_first_member' );
77
+	uasort($importers, '_usort_by_first_member');
78 78
 ?>
79 79
 <table class="widefat importers striped">
80 80
 
81 81
 <?php
82 82
 	foreach ($importers as $importer_id => $data) {
83 83
 		$action = '';
84
-		if ( isset( $data['install'] ) ) {
84
+		if (isset($data['install'])) {
85 85
 			$plugin_slug = $data['install'];
86
-			if ( file_exists( WP_PLUGIN_DIR . '/' . $plugin_slug ) ) {
86
+			if (file_exists(WP_PLUGIN_DIR.'/'.$plugin_slug)) {
87 87
 				// Looks like Importer is installed, But not active
88
-				$plugins = get_plugins( '/' . $plugin_slug );
89
-				if ( !empty($plugins) ) {
88
+				$plugins = get_plugins('/'.$plugin_slug);
89
+				if ( ! empty($plugins)) {
90 90
 					$keys = array_keys($plugins);
91
-					$plugin_file = $plugin_slug . '/' . $keys[0];
92
-					$action = '<a href="' . esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin=' . $plugin_file . '&from=import'), 'activate-plugin_' . $plugin_file)) .
93
-											'"title="' . esc_attr__('Activate importer') . '"">' . $data[0] . '</a>';
91
+					$plugin_file = $plugin_slug.'/'.$keys[0];
92
+					$action = '<a href="'.esc_url(wp_nonce_url(admin_url('plugins.php?action=activate&plugin='.$plugin_file.'&from=import'), 'activate-plugin_'.$plugin_file)).
93
+											'"title="'.esc_attr__('Activate importer').'"">'.$data[0].'</a>';
94 94
 				}
95 95
 			}
96
-			if ( empty($action) ) {
97
-				if ( is_main_site() ) {
98
-					$action = '<a href="' . esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug .
99
-										'&from=import&TB_iframe=true&width=600&height=550' ) ) . '" class="thickbox" title="' .
100
-										esc_attr__('Install importer') . '">' . $data[0] . '</a>';
96
+			if (empty($action)) {
97
+				if (is_main_site()) {
98
+					$action = '<a href="'.esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_slug.
99
+										'&from=import&TB_iframe=true&width=600&height=550')).'" class="thickbox" title="'.
100
+										esc_attr__('Install importer').'">'.$data[0].'</a>';
101 101
 				} else {
102 102
 					$action = $data[0];
103
-					$data[1] = sprintf( __( 'This importer is not installed. Please install importers from <a href="%s">the main site</a>.' ), get_admin_url( $current_site->blog_id, 'import.php' ) );
103
+					$data[1] = sprintf(__('This importer is not installed. Please install importers from <a href="%s">the main site</a>.'), get_admin_url($current_site->blog_id, 'import.php'));
104 104
 				}
105 105
 			}
106 106
 		} else {
107
-			$action = "<a href='" . esc_url( "admin.php?import=$importer_id" ) . "' title='" . esc_attr( wptexturize( strip_tags( $data[1] ) ) ) ."'>{$data[0]}</a>";
107
+			$action = "<a href='".esc_url("admin.php?import=$importer_id")."' title='".esc_attr(wptexturize(strip_tags($data[1])))."'>{$data[0]}</a>";
108 108
 		}
109 109
 
110 110
 		echo "
@@ -119,12 +119,12 @@  discard block
 block discarded – undo
119 119
 <?php
120 120
 }
121 121
 
122
-if ( current_user_can('install_plugins') )
123
-	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
122
+if (current_user_can('install_plugins'))
123
+	echo '<p>'.sprintf(__('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url(network_admin_url('plugin-install.php?tab=search&type=tag&s=importer'))).'</p>';
124 124
 ?>
125 125
 
126 126
 </div>
127 127
 
128 128
 <?php
129 129
 
130
-include( ABSPATH . 'wp-admin/admin-footer.php' );
130
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +13 added lines, -8 removed lines patch added patch discarded remove patch
@@ -11,8 +11,9 @@  discard block
 block discarded – undo
11 11
 /** Load WordPress Bootstrap */
12 12
 require_once( dirname( __FILE__ ) . '/admin.php' );
13 13
 
14
-if ( !current_user_can('import') )
14
+if ( !current_user_can('import') ) {
15 15
 	wp_die(__('You do not have sufficient permissions to import content in this site.'));
16
+}
16 17
 
17 18
 $title = __('Import');
18 19
 
@@ -29,10 +30,11 @@  discard block
 block discarded – undo
29 30
 	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
30 31
 );
31 32
 
32
-if ( current_user_can( 'install_plugins' ) )
33
+if ( current_user_can( 'install_plugins' ) ) {
33 34
 	$popular_importers = wp_get_popular_importers();
34
-else
35
+} else {
35 36
 	$popular_importers = array();
37
+}
36 38
 
37 39
 // Detect and redirect invalid importers like 'movabletype', which is registered as 'mt'
38 40
 if ( ! empty( $_GET['invalid'] ) && isset( $popular_importers[ $_GET['invalid'] ] ) ) {
@@ -64,10 +66,12 @@  discard block
 block discarded – undo
64 66
 
65 67
 // If a popular importer is not registered, create a dummy registration that links to the plugin installer.
66 68
 foreach ( $popular_importers as $pop_importer => $pop_data ) {
67
-	if ( isset( $importers[ $pop_importer ] ) )
68
-		continue;
69
-	if ( isset( $importers[ $pop_data['importer-id'] ] ) )
70
-		continue;
69
+	if ( isset( $importers[ $pop_importer ] ) ) {
70
+			continue;
71
+	}
72
+	if ( isset( $importers[ $pop_data['importer-id'] ] ) ) {
73
+			continue;
74
+	}
71 75
 	$importers[ $pop_data['importer-id'] ] = array( $pop_data['name'], $pop_data['description'], 'install' => $pop_data['plugin-slug'] );
72 76
 }
73 77
 
@@ -119,8 +123,9 @@  discard block
 block discarded – undo
119 123
 <?php
120 124
 }
121 125
 
122
-if ( current_user_can('install_plugins') )
126
+if ( current_user_can('install_plugins') ) {
123 127
 	echo '<p>' . sprintf( __('If the importer you need is not listed, <a href="%s">search the plugin directory</a> to see if an importer is available.'), esc_url( network_admin_url( 'plugin-install.php?tab=search&type=tag&s=importer' ) ) ) . '</p>';
128
+}
124 129
 ?>
125 130
 
126 131
 </div>
Please login to merge, or discard this patch.