Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-admin/user/freedoms.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Load WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-require( ABSPATH . 'wp-admin/freedoms.php' );
13
+require(ABSPATH.'wp-admin/freedoms.php');
Please login to merge, or discard this patch.
src/wp-admin/user/about.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Load WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-require( ABSPATH . 'wp-admin/about.php' );
13
+require(ABSPATH.'wp-admin/about.php');
Please login to merge, or discard this patch.
src/wp-admin/theme-install.php 2 patches
Braces   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -12,8 +12,9 @@
 block discarded – undo
12 12
 
13 13
 wp_reset_vars( array( 'tab' ) );
14 14
 
15
-if ( ! current_user_can('install_themes') )
15
+if ( ! current_user_can('install_themes') ) {
16 16
 	wp_die( __( 'You do not have sufficient permissions to install themes on this site.' ) );
17
+}
17 18
 
18 19
 if ( is_multisite() && ! is_network_admin() ) {
19 20
 	wp_redirect( network_admin_url( 'theme-install.php' ) );
Please login to merge, or discard this patch.
Spacing   +113 added lines, -113 removed lines patch added patch discarded remove patch
@@ -7,66 +7,66 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
-require( ABSPATH . 'wp-admin/includes/theme-install.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11
+require(ABSPATH.'wp-admin/includes/theme-install.php');
12 12
 
13
-wp_reset_vars( array( 'tab' ) );
13
+wp_reset_vars(array('tab'));
14 14
 
15
-if ( ! current_user_can('install_themes') )
16
-	wp_die( __( 'Sorry, you are not allowed to install themes on this site.' ) );
15
+if ( ! current_user_can('install_themes'))
16
+	wp_die(__('Sorry, you are not allowed to install themes on this site.'));
17 17
 
18
-if ( is_multisite() && ! is_network_admin() ) {
19
-	wp_redirect( network_admin_url( 'theme-install.php' ) );
18
+if (is_multisite() && ! is_network_admin()) {
19
+	wp_redirect(network_admin_url('theme-install.php'));
20 20
 	exit();
21 21
 }
22 22
 
23
-$title = __( 'Add Themes' );
23
+$title = __('Add Themes');
24 24
 $parent_file = 'themes.php';
25 25
 
26
-if ( ! is_network_admin() ) {
26
+if ( ! is_network_admin()) {
27 27
 	$submenu_file = 'themes.php';
28 28
 }
29 29
 
30 30
 $installed_themes = search_theme_directories();
31
-foreach ( $installed_themes as $k => $v ) {
32
-	if ( false !== strpos( $k, '/' ) ) {
33
-		unset( $installed_themes[ $k ] );
31
+foreach ($installed_themes as $k => $v) {
32
+	if (false !== strpos($k, '/')) {
33
+		unset($installed_themes[$k]);
34 34
 	}
35 35
 }
36 36
 
37
-wp_localize_script( 'theme', '_wpThemeSettings', array(
37
+wp_localize_script('theme', '_wpThemeSettings', array(
38 38
 	'themes'   => false,
39 39
 	'settings' => array(
40 40
 		'isInstall'  => true,
41
-		'canInstall' => current_user_can( 'install_themes' ),
42
-		'installURI' => current_user_can( 'install_themes' ) ? self_admin_url( 'theme-install.php' ) : null,
43
-		'adminUrl'   => parse_url( self_admin_url(), PHP_URL_PATH )
41
+		'canInstall' => current_user_can('install_themes'),
42
+		'installURI' => current_user_can('install_themes') ? self_admin_url('theme-install.php') : null,
43
+		'adminUrl'   => parse_url(self_admin_url(), PHP_URL_PATH)
44 44
 	),
45 45
 	'l10n' => array(
46
-		'addNew'              => __( 'Add New Theme' ),
47
-		'search'              => __( 'Search Themes' ),
48
-		'searchPlaceholder'   => __( 'Search themes...' ), // placeholder (no ellipsis)
49
-		'upload'              => __( 'Upload Theme' ),
50
-		'back'                => __( 'Back' ),
46
+		'addNew'              => __('Add New Theme'),
47
+		'search'              => __('Search Themes'),
48
+		'searchPlaceholder'   => __('Search themes...'), // placeholder (no ellipsis)
49
+		'upload'              => __('Upload Theme'),
50
+		'back'                => __('Back'),
51 51
 		'error'               => sprintf(
52 52
 			/* translators: %s: support forums URL */
53
-			__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ),
54
-			__( 'https://wordpress.org/support/' )
53
+			__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'),
54
+			__('https://wordpress.org/support/')
55 55
 		),
56
-		'themesFound'         => __( 'Number of Themes found: %d' ),
57
-		'noThemesFound'       => __( 'No themes found. Try a different search.' ),
58
-		'collapseSidebar'     => __( 'Collapse Sidebar' ),
59
-		'expandSidebar'       => __( 'Expand Sidebar' ),
56
+		'themesFound'         => __('Number of Themes found: %d'),
57
+		'noThemesFound'       => __('No themes found. Try a different search.'),
58
+		'collapseSidebar'     => __('Collapse Sidebar'),
59
+		'expandSidebar'       => __('Expand Sidebar'),
60 60
 		/* translators: hidden accessibility text */
61
-		'selectFeatureFilter' => __( 'Select one or more Theme features to filter by' ),
61
+		'selectFeatureFilter' => __('Select one or more Theme features to filter by'),
62 62
 	),
63
-	'installedThemes' => array_keys( $installed_themes ),
64
-) );
63
+	'installedThemes' => array_keys($installed_themes),
64
+));
65 65
 
66
-wp_enqueue_script( 'theme' );
67
-wp_enqueue_script( 'updates' );
66
+wp_enqueue_script('theme');
67
+wp_enqueue_script('updates');
68 68
 
69
-if ( $tab ) {
69
+if ($tab) {
70 70
 	/**
71 71
 	 * Fires before each of the tabs are rendered on the Install Themes page.
72 72
 	 *
@@ -76,50 +76,50 @@  discard block
 block discarded – undo
76 76
 	 *
77 77
 	 * @since 2.8.0
78 78
 	 */
79
-	do_action( "install_themes_pre_{$tab}" );
79
+	do_action("install_themes_pre_{$tab}");
80 80
 }
81 81
 
82 82
 $help_overview =
83
-	'<p>' . sprintf(
83
+	'<p>'.sprintf(
84 84
 			/* translators: %s: Theme Directory URL */
85
-			__( 'You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.' ),
86
-			__( 'https://wordpress.org/themes/' )
87
-		) . '</p>' .
88
-	'<p>' . __( 'You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.' ) . ' <span id="live-search-desc">' . __( 'The search results will be updated as you type.' ) . '</span></p>' .
89
-	'<p>' . __( 'Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.' ) . '</p>' .
90
-	'<p>' . sprintf(
85
+			__('You can find additional themes for your site by using the Theme Browser/Installer on this screen, which will display themes from the <a href="%s">WordPress Theme Directory</a>. These themes are designed and developed by third parties, are available free of charge, and are compatible with the license WordPress uses.'),
86
+			__('https://wordpress.org/themes/')
87
+		).'</p>'.
88
+	'<p>'.__('You can Search for themes by keyword, author, or tag, or can get more specific and search by criteria listed in the feature filter.').' <span id="live-search-desc">'.__('The search results will be updated as you type.').'</span></p>'.
89
+	'<p>'.__('Alternately, you can browse the themes that are Featured, Popular, or Latest. When you find a theme you like, you can preview it or install it.').'</p>'.
90
+	'<p>'.sprintf(
91 91
 			/* translators: %s: /wp-content/themes */
92
-			__( 'You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.' ),
92
+			__('You can Upload a theme manually if you have already downloaded its ZIP archive onto your computer (make sure it is from a trusted and original source). You can also do it the old-fashioned way and copy a downloaded theme&#8217;s folder via FTP into your %s directory.'),
93 93
 			'<code>/wp-content/themes</code>'
94
-		) . '</p>';
94
+		).'</p>';
95 95
 
96
-get_current_screen()->add_help_tab( array(
96
+get_current_screen()->add_help_tab(array(
97 97
 	'id'      => 'overview',
98 98
 	'title'   => __('Overview'),
99 99
 	'content' => $help_overview
100
-) );
100
+));
101 101
 
102 102
 $help_installing =
103
-	'<p>' . __('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.') . '</p>' .
104
-	'<p>' . __('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.') . '</p>';
103
+	'<p>'.__('Once you have generated a list of themes, you can preview and install any of them. Click on the thumbnail of the theme you&#8217;re interested in previewing. It will open up in a full-screen Preview page to give you a better idea of how that theme will look.').'</p>'.
104
+	'<p>'.__('To install the theme so you can preview it with your site&#8217;s content and customize its theme options, click the "Install" button at the top of the left-hand pane. The theme files will be downloaded to your website automatically. When this is complete, the theme is now available for activation, which you can do by clicking the "Activate" link, or by navigating to your Manage Themes screen and clicking the "Live Preview" link under any installed theme&#8217;s thumbnail image.').'</p>';
105 105
 
106
-get_current_screen()->add_help_tab( array(
106
+get_current_screen()->add_help_tab(array(
107 107
 	'id'      => 'installing',
108 108
 	'title'   => __('Previewing and Installing'),
109 109
 	'content' => $help_installing
110
-) );
110
+));
111 111
 
112 112
 get_current_screen()->set_help_sidebar(
113
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
114
-	'<p>' . __('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes">Documentation on Adding New Themes</a>') . '</p>' .
115
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
113
+	'<p><strong>'.__('For more information:').'</strong></p>'.
114
+	'<p>'.__('<a href="https://codex.wordpress.org/Using_Themes#Adding_New_Themes">Documentation on Adding New Themes</a>').'</p>'.
115
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
116 116
 );
117 117
 
118
-include(ABSPATH . 'wp-admin/admin-header.php');
118
+include(ABSPATH.'wp-admin/admin-header.php');
119 119
 
120 120
 ?>
121 121
 <div class="wrap">
122
-	<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
122
+	<h1 class="wp-heading-inline"><?php echo esc_html($title); ?></h1>
123 123
 
124 124
 	<?php
125 125
 
@@ -132,23 +132,23 @@  discard block
 block discarded – undo
132 132
 	 *
133 133
 	 * @param array $tabs The tabs shown on the Add Themes screen. Default is 'upload'.
134 134
 	 */
135
-	$tabs = apply_filters( 'install_themes_tabs', array( 'upload' => __( 'Upload Theme' ) ) );
136
-	if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_themes' ) ) {
137
-		echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">' . __( 'Upload Theme' ) . '</button>';
135
+	$tabs = apply_filters('install_themes_tabs', array('upload' => __('Upload Theme')));
136
+	if ( ! empty($tabs['upload']) && current_user_can('upload_themes')) {
137
+		echo ' <button type="button" class="upload-view-toggle page-title-action hide-if-no-js" aria-expanded="false">'.__('Upload Theme').'</button>';
138 138
 	}
139 139
 	?>
140 140
 
141 141
 	<hr class="wp-header-end">
142 142
 
143 143
 	<div class="error hide-if-js">
144
-		<p><?php _e( 'The Theme Installer screen requires JavaScript.' ); ?></p>
144
+		<p><?php _e('The Theme Installer screen requires JavaScript.'); ?></p>
145 145
 	</div>
146 146
 
147 147
 	<div class="upload-theme">
148 148
 	<?php install_themes_upload(); ?>
149 149
 	</div>
150 150
 
151
-	<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Filter themes list' ); ?></h2>
151
+	<h2 class="screen-reader-text hide-if-no-js"><?php _e('Filter themes list'); ?></h2>
152 152
 
153 153
 	<div class="wp-filter hide-if-no-js">
154 154
 		<div class="filter-count">
@@ -156,77 +156,77 @@  discard block
 block discarded – undo
156 156
 		</div>
157 157
 
158 158
 		<ul class="filter-links">
159
-			<li><a href="#" data-sort="featured"><?php _ex( 'Featured', 'themes' ); ?></a></li>
160
-			<li><a href="#" data-sort="popular"><?php _ex( 'Popular', 'themes' ); ?></a></li>
161
-			<li><a href="#" data-sort="new"><?php _ex( 'Latest', 'themes' ); ?></a></li>
162
-			<li><a href="#" data-sort="favorites"><?php _ex( 'Favorites', 'themes' ); ?></a></li>
159
+			<li><a href="#" data-sort="featured"><?php _ex('Featured', 'themes'); ?></a></li>
160
+			<li><a href="#" data-sort="popular"><?php _ex('Popular', 'themes'); ?></a></li>
161
+			<li><a href="#" data-sort="new"><?php _ex('Latest', 'themes'); ?></a></li>
162
+			<li><a href="#" data-sort="favorites"><?php _ex('Favorites', 'themes'); ?></a></li>
163 163
 		</ul>
164 164
 
165
-		<button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e( 'Feature Filter' ); ?></button>
165
+		<button type="button" class="button drawer-toggle" aria-expanded="false"><?php _e('Feature Filter'); ?></button>
166 166
 
167 167
 		<div class="search-form"></div>
168 168
 
169 169
 		<div class="favorites-form">
170 170
 			<?php
171
-			$action = 'save_wporg_username_' . get_current_user_id();
172
-			if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( wp_unslash( $_GET['_wpnonce'] ), $action ) ) {
173
-				$user = isset( $_GET['user'] ) ? wp_unslash( $_GET['user'] ) : get_user_option( 'wporg_favorites' );
174
-				update_user_meta( get_current_user_id(), 'wporg_favorites', $user );
171
+			$action = 'save_wporg_username_'.get_current_user_id();
172
+			if (isset($_GET['_wpnonce']) && wp_verify_nonce(wp_unslash($_GET['_wpnonce']), $action)) {
173
+				$user = isset($_GET['user']) ? wp_unslash($_GET['user']) : get_user_option('wporg_favorites');
174
+				update_user_meta(get_current_user_id(), 'wporg_favorites', $user);
175 175
 			} else {
176
-				$user = get_user_option( 'wporg_favorites' );
176
+				$user = get_user_option('wporg_favorites');
177 177
 			}
178 178
 			?>
179
-			<p class="install-help"><?php _e( 'If you have marked themes as favorites on WordPress.org, you can browse them here.' ); ?></p>
179
+			<p class="install-help"><?php _e('If you have marked themes as favorites on WordPress.org, you can browse them here.'); ?></p>
180 180
 
181 181
 			<p>
182
-				<label for="wporg-username-input"><?php _e( 'Your WordPress.org username:' ); ?></label>
183
-				<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr( wp_create_nonce( $action ) ); ?>" />
184
-				<input type="search" id="wporg-username-input" value="<?php echo esc_attr( $user ); ?>" />
185
-				<input type="button" class="button favorites-form-submit" value="<?php esc_attr_e( 'Get Favorites' ); ?>" />
182
+				<label for="wporg-username-input"><?php _e('Your WordPress.org username:'); ?></label>
183
+				<input type="hidden" id="wporg-username-nonce" name="_wpnonce" value="<?php echo esc_attr(wp_create_nonce($action)); ?>" />
184
+				<input type="search" id="wporg-username-input" value="<?php echo esc_attr($user); ?>" />
185
+				<input type="button" class="button favorites-form-submit" value="<?php esc_attr_e('Get Favorites'); ?>" />
186 186
 			</p>
187 187
 		</div>
188 188
 
189 189
 		<div class="filter-drawer">
190 190
 			<div class="buttons">
191
-				<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
192
-				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
191
+				<button type="button" class="apply-filters button"><?php _e('Apply Filters'); ?><span></span></button>
192
+				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e('Clear current filters'); ?>"><?php _e('Clear'); ?></button>
193 193
 			</div>
194 194
 		<?php
195 195
 		$feature_list = get_theme_feature_list();
196
-		foreach ( $feature_list as $feature_name => $features ) {
196
+		foreach ($feature_list as $feature_name => $features) {
197 197
 			echo '<fieldset class="filter-group">';
198
-			$feature_name = esc_html( $feature_name );
199
-			echo '<legend>' . $feature_name . '</legend>';
198
+			$feature_name = esc_html($feature_name);
199
+			echo '<legend>'.$feature_name.'</legend>';
200 200
 			echo '<div class="filter-group-feature">';
201
-			foreach ( $features as $feature => $feature_name ) {
202
-				$feature = esc_attr( $feature );
203
-				echo '<input type="checkbox" id="filter-id-' . $feature . '" value="' . $feature . '" /> ';
204
-				echo '<label for="filter-id-' . $feature . '">' . $feature_name . '</label><br>';
201
+			foreach ($features as $feature => $feature_name) {
202
+				$feature = esc_attr($feature);
203
+				echo '<input type="checkbox" id="filter-id-'.$feature.'" value="'.$feature.'" /> ';
204
+				echo '<label for="filter-id-'.$feature.'">'.$feature_name.'</label><br>';
205 205
 			}
206 206
 			echo '</div>';
207 207
 			echo '</fieldset>';
208 208
 		}
209 209
 		?>
210 210
 			<div class="buttons">
211
-				<button type="button" class="apply-filters button"><?php _e( 'Apply Filters' ); ?><span></span></button>
212
-				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e( 'Clear current filters' ); ?>"><?php _e( 'Clear' ); ?></button>
211
+				<button type="button" class="apply-filters button"><?php _e('Apply Filters'); ?><span></span></button>
212
+				<button type="button" class="clear-filters button" aria-label="<?php esc_attr_e('Clear current filters'); ?>"><?php _e('Clear'); ?></button>
213 213
 			</div>
214 214
 			<div class="filtered-by">
215
-				<span><?php _e( 'Filtering by:' ); ?></span>
215
+				<span><?php _e('Filtering by:'); ?></span>
216 216
 				<div class="tags"></div>
217
-				<button type="button" class="button-link edit-filters"><?php _e( 'Edit Filters' ); ?></button>
217
+				<button type="button" class="button-link edit-filters"><?php _e('Edit Filters'); ?></button>
218 218
 			</div>
219 219
 		</div>
220 220
 	</div>
221
-	<h2 class="screen-reader-text hide-if-no-js"><?php _e( 'Themes list' ); ?></h2>
221
+	<h2 class="screen-reader-text hide-if-no-js"><?php _e('Themes list'); ?></h2>
222 222
 	<div class="theme-browser content-filterable"></div>
223 223
 	<div class="theme-install-overlay wp-full-overlay expanded"></div>
224 224
 
225
-	<p class="no-themes"><?php _e( 'No themes found. Try a different search.' ); ?></p>
225
+	<p class="no-themes"><?php _e('No themes found. Try a different search.'); ?></p>
226 226
 	<span class="spinner"></span>
227 227
 
228 228
 <?php
229
-if ( $tab ) {
229
+if ($tab) {
230 230
 	/**
231 231
 	 * Fires at the top of each of the tabs on the Install Themes page.
232 232
 	 *
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @param int $paged Number of the current page of results being viewed.
240 240
 	 */
241
-	do_action( "install_themes_{$tab}", $paged );
241
+	do_action("install_themes_{$tab}", $paged);
242 242
 }
243 243
 ?>
244 244
 </div>
@@ -251,11 +251,11 @@  discard block
 block discarded – undo
251 251
 	<# } else { #>
252 252
 		<div class="theme-screenshot blank"></div>
253 253
 	<# } #>
254
-	<span class="more-details"><?php _ex( 'Details &amp; Preview', 'theme' ); ?></span>
254
+	<span class="more-details"><?php _ex('Details &amp; Preview', 'theme'); ?></span>
255 255
 	<div class="theme-author">
256 256
 		<?php
257 257
 		/* translators: %s: Theme author name */
258
-		printf( __( 'By %s' ), '{{ data.author }}' );
258
+		printf(__('By %s'), '{{ data.author }}');
259 259
 		?>
260 260
 	</div>
261 261
 	<h3 class="theme-name">{{ data.name }}</h3>
@@ -264,41 +264,41 @@  discard block
 block discarded – undo
264 264
 		<# if ( data.installed ) { #>
265 265
 			<?php
266 266
 			/* translators: %s: Theme name */
267
-			$aria_label = sprintf( _x( 'Activate %s', 'theme' ), '{{ data.name }}' );
267
+			$aria_label = sprintf(_x('Activate %s', 'theme'), '{{ data.name }}');
268 268
 			?>
269 269
 			<# if ( data.activate_url ) { #>
270
-				<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Activate' ); ?></a>
270
+				<a class="button button-primary activate" href="{{ data.activate_url }}" aria-label="<?php echo esc_attr($aria_label); ?>"><?php _e('Activate'); ?></a>
271 271
 			<# } #>
272 272
 			<# if ( data.customize_url ) { #>
273
-				<a class="button load-customize" href="{{ data.customize_url }}"><?php _e( 'Live Preview' ); ?></a>
273
+				<a class="button load-customize" href="{{ data.customize_url }}"><?php _e('Live Preview'); ?></a>
274 274
 			<# } else { #>
275
-				<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
275
+				<button class="button preview install-theme-preview"><?php _e('Preview'); ?></button>
276 276
 			<# } #>
277 277
 		<# } else { #>
278 278
 			<?php
279 279
 			/* translators: %s: Theme name */
280
-			$aria_label = sprintf( __( 'Install %s' ), '{{ data.name }}' );
280
+			$aria_label = sprintf(__('Install %s'), '{{ data.name }}');
281 281
 			?>
282
-			<a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr( $aria_label ); ?>"><?php _e( 'Install' ); ?></a>
283
-			<button class="button preview install-theme-preview"><?php _e( 'Preview' ); ?></button>
282
+			<a class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}" href="{{ data.install_url }}" aria-label="<?php echo esc_attr($aria_label); ?>"><?php _e('Install'); ?></a>
283
+			<button class="button preview install-theme-preview"><?php _e('Preview'); ?></button>
284 284
 		<# } #>
285 285
 	</div>
286 286
 
287 287
 	<# if ( data.installed ) { #>
288
-		<div class="notice notice-success notice-alt"><p><?php _ex( 'Installed', 'theme' ); ?></p></div>
288
+		<div class="notice notice-success notice-alt"><p><?php _ex('Installed', 'theme'); ?></p></div>
289 289
 	<# } #>
290 290
 </script>
291 291
 
292 292
 <script id="tmpl-theme-preview" type="text/template">
293 293
 	<div class="wp-full-overlay-sidebar">
294 294
 		<div class="wp-full-overlay-header">
295
-			<button class="close-full-overlay"><span class="screen-reader-text"><?php _e( 'Close' ); ?></span></button>
296
-			<button class="previous-theme"><span class="screen-reader-text"><?php _ex( 'Previous', 'Button label for a theme' ); ?></span></button>
297
-			<button class="next-theme"><span class="screen-reader-text"><?php _ex( 'Next', 'Button label for a theme' ); ?></span></button>
295
+			<button class="close-full-overlay"><span class="screen-reader-text"><?php _e('Close'); ?></span></button>
296
+			<button class="previous-theme"><span class="screen-reader-text"><?php _ex('Previous', 'Button label for a theme'); ?></span></button>
297
+			<button class="next-theme"><span class="screen-reader-text"><?php _ex('Next', 'Button label for a theme'); ?></span></button>
298 298
 			<# if ( data.installed ) { #>
299
-				<a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e( 'Activate' ); ?></a>
299
+				<a class="button button-primary activate" href="{{ data.activate_url }}"><?php _e('Activate'); ?></a>
300 300
 			<# } else { #>
301
-				<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e( 'Install' ); ?></a>
301
+				<a href="{{ data.install_url }}" class="button button-primary theme-install" data-name="{{ data.name }}" data-slug="{{ data.id }}"><?php _e('Install'); ?></a>
302 302
 			<# } #>
303 303
 		</div>
304 304
 		<div class="wp-full-overlay-sidebar-content">
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 					<span class="theme-by">
308 308
 						<?php
309 309
 						/* translators: %s: Theme author name */
310
-						printf( __( 'By %s' ), '{{ data.author }}' );
310
+						printf(__('By %s'), '{{ data.author }}');
311 311
 						?>
312 312
 					</span>
313 313
 
@@ -320,12 +320,12 @@  discard block
 block discarded – undo
320 320
 								<span class="num-ratings">({{ data.num_ratings }})</span>
321 321
 							</div>
322 322
 						<# } else { #>
323
-							<span class="no-rating"><?php _e( 'This theme has not been rated yet.' ); ?></span>
323
+							<span class="no-rating"><?php _e('This theme has not been rated yet.'); ?></span>
324 324
 						<# } #>
325 325
 						<div class="theme-version">
326 326
 							<?php
327 327
 							/* translators: %s: Theme version */
328
-							printf( __( 'Version: %s' ), '{{ data.version }}' );
328
+							printf(__('Version: %s'), '{{ data.version }}');
329 329
 							?>
330 330
 						</div>
331 331
 						<div class="theme-description">{{{ data.description }}}</div>
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 				</div>
334 334
 			</div>
335 335
 			<div class="wp-full-overlay-footer">
336
-				<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>">
336
+				<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>">
337 337
 					<span class="collapse-sidebar-arrow"></span>
338
-					<span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span>
338
+					<span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span>
339 339
 				</button>
340 340
 			</div>
341 341
 		</div>
342 342
 		<div class="wp-full-overlay-main">
343
-		<iframe src="{{ data.preview_url }}" title="<?php esc_attr_e( 'Preview' ); ?>"></iframe>
343
+		<iframe src="{{ data.preview_url }}" title="<?php esc_attr_e('Preview'); ?>"></iframe>
344 344
 	</div>
345 345
 </script>
346 346
 
@@ -348,4 +348,4 @@  discard block
 block discarded – undo
348 348
 wp_print_request_filesystem_credentials_modal();
349 349
 wp_print_admin_notice_templates();
350 350
 
351
-include(ABSPATH . 'wp-admin/admin-footer.php');
351
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/includes/image.php 3 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -156,12 +156,12 @@
 block discarded – undo
156 156
 		} else {
157 157
 			$ext = '.jpg';
158 158
 			switch ( $metadata['image']['mime'] ) {
159
-			case 'image/gif':
160
-				$ext = '.gif';
161
-				break;
162
-			case 'image/png':
163
-				$ext = '.png';
164
-				break;
159
+				case 'image/gif':
160
+					$ext = '.gif';
161
+					break;
162
+				case 'image/png':
163
+					$ext = '.png';
164
+					break;
165 165
 			}
166 166
 			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
167 167
 			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
Please login to merge, or discard this patch.
Spacing   +187 added lines, -187 removed lines patch added patch discarded remove patch
@@ -22,41 +22,41 @@  discard block
 block discarded – undo
22 22
  * @param string $dst_file Optional. The destination file to write to.
23 23
  * @return string|WP_Error New filepath on success, WP_Error on failure.
24 24
  */
25
-function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
25
+function wp_crop_image($src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false) {
26 26
 	$src_file = $src;
27
-	if ( is_numeric( $src ) ) { // Handle int as attachment ID
28
-		$src_file = get_attached_file( $src );
27
+	if (is_numeric($src)) { // Handle int as attachment ID
28
+		$src_file = get_attached_file($src);
29 29
 
30
-		if ( ! file_exists( $src_file ) ) {
30
+		if ( ! file_exists($src_file)) {
31 31
 			// If the file doesn't exist, attempt a URL fopen on the src link.
32 32
 			// This can occur with certain file replication plugins.
33
-			$src = _load_image_to_edit_path( $src, 'full' );
33
+			$src = _load_image_to_edit_path($src, 'full');
34 34
 		} else {
35 35
 			$src = $src_file;
36 36
 		}
37 37
 	}
38 38
 
39
-	$editor = wp_get_image_editor( $src );
40
-	if ( is_wp_error( $editor ) )
39
+	$editor = wp_get_image_editor($src);
40
+	if (is_wp_error($editor))
41 41
 		return $editor;
42 42
 
43
-	$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
44
-	if ( is_wp_error( $src ) )
43
+	$src = $editor->crop($src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs);
44
+	if (is_wp_error($src))
45 45
 		return $src;
46 46
 
47
-	if ( ! $dst_file )
48
-		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
47
+	if ( ! $dst_file)
48
+		$dst_file = str_replace(basename($src_file), 'cropped-'.basename($src_file), $src_file);
49 49
 
50 50
 	/*
51 51
 	 * The directory containing the original file may no longer exist when
52 52
 	 * using a replication plugin.
53 53
 	 */
54
-	wp_mkdir_p( dirname( $dst_file ) );
54
+	wp_mkdir_p(dirname($dst_file));
55 55
 
56
-	$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
56
+	$dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file));
57 57
 
58
-	$result = $editor->save( $dst_file );
59
-	if ( is_wp_error( $result ) )
58
+	$result = $editor->save($dst_file);
59
+	if (is_wp_error($result))
60 60
 		return $result;
61 61
 
62 62
 	return $dst_file;
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
  * @param string $file Filepath of the Attached image.
72 72
  * @return mixed Metadata for attachment.
73 73
  */
74
-function wp_generate_attachment_metadata( $attachment_id, $file ) {
75
-	$attachment = get_post( $attachment_id );
74
+function wp_generate_attachment_metadata($attachment_id, $file) {
75
+	$attachment = get_post($attachment_id);
76 76
 
77 77
 	$metadata = array();
78 78
 	$support = false;
79
-	$mime_type = get_post_mime_type( $attachment );
79
+	$mime_type = get_post_mime_type($attachment);
80 80
 
81
-	if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) {
82
-		$imagesize = getimagesize( $file );
81
+	if (preg_match('!^image/!', $mime_type) && file_is_displayable_image($file)) {
82
+		$imagesize = getimagesize($file);
83 83
 		$metadata['width'] = $imagesize[0];
84 84
 		$metadata['height'] = $imagesize[1];
85 85
 
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
 		$_wp_additional_image_sizes = wp_get_additional_image_sizes();
91 91
 
92 92
 		$sizes = array();
93
-		foreach ( get_intermediate_image_sizes() as $s ) {
94
-			$sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => false );
95
-			if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) {
93
+		foreach (get_intermediate_image_sizes() as $s) {
94
+			$sizes[$s] = array('width' => '', 'height' => '', 'crop' => false);
95
+			if (isset($_wp_additional_image_sizes[$s]['width'])) {
96 96
 				// For theme-added sizes
97
-				$sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] );
97
+				$sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']);
98 98
 			} else {
99 99
 				// For default sizes set in options
100
-				$sizes[$s]['width'] = get_option( "{$s}_size_w" );
100
+				$sizes[$s]['width'] = get_option("{$s}_size_w");
101 101
 			}
102 102
 
103
-			if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) {
103
+			if (isset($_wp_additional_image_sizes[$s]['height'])) {
104 104
 				// For theme-added sizes
105
-				$sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] );
105
+				$sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']);
106 106
 			} else {
107 107
 				// For default sizes set in options
108
-				$sizes[$s]['height'] = get_option( "{$s}_size_h" );
108
+				$sizes[$s]['height'] = get_option("{$s}_size_h");
109 109
 			}
110 110
 
111
-			if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) {
111
+			if (isset($_wp_additional_image_sizes[$s]['crop'])) {
112 112
 				// For theme-added sizes
113 113
 				$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
114 114
 			} else {
115 115
 				// For default sizes set in options
116
-				$sizes[$s]['crop'] = get_option( "{$s}_crop" );
116
+				$sizes[$s]['crop'] = get_option("{$s}_crop");
117 117
 			}
118 118
 		}
119 119
 
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 		 * @param array $sizes    An associative array of image sizes.
127 127
 		 * @param array $metadata An associative array of image metadata: width, height, file.
128 128
 		 */
129
-		$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata );
129
+		$sizes = apply_filters('intermediate_image_sizes_advanced', $sizes, $metadata);
130 130
 
131
-		if ( $sizes ) {
132
-			$editor = wp_get_image_editor( $file );
131
+		if ($sizes) {
132
+			$editor = wp_get_image_editor($file);
133 133
 
134
-			if ( ! is_wp_error( $editor ) )
135
-				$metadata['sizes'] = $editor->multi_resize( $sizes );
134
+			if ( ! is_wp_error($editor))
135
+				$metadata['sizes'] = $editor->multi_resize($sizes);
136 136
 		} else {
137 137
 			$metadata['sizes'] = array();
138 138
 		}
139 139
 
140 140
 		// Fetch additional metadata from EXIF/IPTC.
141
-		$image_meta = wp_read_image_metadata( $file );
142
-		if ( $image_meta )
141
+		$image_meta = wp_read_image_metadata($file);
142
+		if ($image_meta)
143 143
 			$metadata['image_meta'] = $image_meta;
144 144
 
145
-	} elseif ( wp_attachment_is( 'video', $attachment ) ) {
146
-		$metadata = wp_read_video_metadata( $file );
147
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' );
148
-	} elseif ( wp_attachment_is( 'audio', $attachment ) ) {
149
-		$metadata = wp_read_audio_metadata( $file );
150
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' );
145
+	} elseif (wp_attachment_is('video', $attachment)) {
146
+		$metadata = wp_read_video_metadata($file);
147
+		$support = current_theme_supports('post-thumbnails', 'attachment:video') || post_type_supports('attachment:video', 'thumbnail');
148
+	} elseif (wp_attachment_is('audio', $attachment)) {
149
+		$metadata = wp_read_audio_metadata($file);
150
+		$support = current_theme_supports('post-thumbnails', 'attachment:audio') || post_type_supports('attachment:audio', 'thumbnail');
151 151
 	}
152 152
 
153
-	if ( $support && ! empty( $metadata['image']['data'] ) ) {
153
+	if ($support && ! empty($metadata['image']['data'])) {
154 154
 		// Check for existing cover.
155
-		$hash = md5( $metadata['image']['data'] );
156
-		$posts = get_posts( array(
155
+		$hash = md5($metadata['image']['data']);
156
+		$posts = get_posts(array(
157 157
 			'fields' => 'ids',
158 158
 			'post_type' => 'attachment',
159 159
 			'post_mime_type' => $metadata['image']['mime'],
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 			'posts_per_page' => 1,
162 162
 			'meta_key' => '_cover_hash',
163 163
 			'meta_value' => $hash
164
-		) );
165
-		$exists = reset( $posts );
164
+		));
165
+		$exists = reset($posts);
166 166
 
167
-		if ( ! empty( $exists ) ) {
168
-			update_post_meta( $attachment_id, '_thumbnail_id', $exists );
167
+		if ( ! empty($exists)) {
168
+			update_post_meta($attachment_id, '_thumbnail_id', $exists);
169 169
 		} else {
170 170
 			$ext = '.jpg';
171
-			switch ( $metadata['image']['mime'] ) {
171
+			switch ($metadata['image']['mime']) {
172 172
 			case 'image/gif':
173 173
 				$ext = '.gif';
174 174
 				break;
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 				$ext = '.png';
177 177
 				break;
178 178
 			}
179
-			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
180
-			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
181
-			if ( false === $uploaded['error'] ) {
179
+			$basename = str_replace('.', '-', basename($file)).'-image'.$ext;
180
+			$uploaded = wp_upload_bits($basename, '', $metadata['image']['data']);
181
+			if (false === $uploaded['error']) {
182 182
 				$image_attachment = array(
183 183
 					'post_mime_type' => $metadata['image']['mime'],
184 184
 					'post_type' => 'attachment',
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
 				 * @param array $metadata         Current attachment metadata.
194 194
 				 * @param array $uploaded         An array containing the thumbnail path and url.
195 195
 				 */
196
-				$image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded );
196
+				$image_attachment = apply_filters('attachment_thumbnail_args', $image_attachment, $metadata, $uploaded);
197 197
 
198
-				$sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] );
199
-				add_post_meta( $sub_attachment_id, '_cover_hash', $hash );
200
-				$attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] );
201
-				wp_update_attachment_metadata( $sub_attachment_id, $attach_data );
202
-				update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id );
198
+				$sub_attachment_id = wp_insert_attachment($image_attachment, $uploaded['file']);
199
+				add_post_meta($sub_attachment_id, '_cover_hash', $hash);
200
+				$attach_data = wp_generate_attachment_metadata($sub_attachment_id, $uploaded['file']);
201
+				wp_update_attachment_metadata($sub_attachment_id, $attach_data);
202
+				update_post_meta($attachment_id, '_thumbnail_id', $sub_attachment_id);
203 203
 			}
204 204
 		}
205 205
 	}
206 206
 	// Try to create image thumbnails for PDFs
207
-	else if ( 'application/pdf' === $mime_type ) {
207
+	else if ('application/pdf' === $mime_type) {
208 208
 		$fallback_sizes = array(
209 209
 			'thumbnail',
210 210
 			'medium',
@@ -218,49 +218,49 @@  discard block
 block discarded – undo
218 218
 		 *
219 219
 		 * @param array $fallback_sizes An array of image size names.
220 220
 		 */
221
-		$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
221
+		$fallback_sizes = apply_filters('fallback_intermediate_image_sizes', $fallback_sizes, $metadata);
222 222
 
223 223
 		$sizes = array();
224 224
 		$_wp_additional_image_sizes = wp_get_additional_image_sizes();
225 225
 
226
-		foreach ( $fallback_sizes as $s ) {
227
-			if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) {
228
-				$sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] );
226
+		foreach ($fallback_sizes as $s) {
227
+			if (isset($_wp_additional_image_sizes[$s]['width'])) {
228
+				$sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']);
229 229
 			} else {
230
-				$sizes[ $s ]['width'] = get_option( "{$s}_size_w" );
230
+				$sizes[$s]['width'] = get_option("{$s}_size_w");
231 231
 			}
232 232
 
233
-			if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) {
234
-				$sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] );
233
+			if (isset($_wp_additional_image_sizes[$s]['height'])) {
234
+				$sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']);
235 235
 			} else {
236
-				$sizes[ $s ]['height'] = get_option( "{$s}_size_h" );
236
+				$sizes[$s]['height'] = get_option("{$s}_size_h");
237 237
 			}
238 238
 
239
-			if ( isset( $_wp_additional_image_sizes[ $s ]['crop'] ) ) {
240
-				$sizes[ $s ]['crop'] = $_wp_additional_image_sizes[ $s ]['crop'];
239
+			if (isset($_wp_additional_image_sizes[$s]['crop'])) {
240
+				$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
241 241
 			} else {
242 242
 				// Force thumbnails to be soft crops.
243
-				if ( ! 'thumbnail' === $s ) {
244
-					$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
243
+				if ( ! 'thumbnail' === $s) {
244
+					$sizes[$s]['crop'] = get_option("{$s}_crop");
245 245
 				}
246 246
 			}
247 247
 		}
248 248
 
249 249
 		// Only load PDFs in an image editor if we're processing sizes.
250
-		if ( ! empty( $sizes ) ) {
251
-			$editor = wp_get_image_editor( $file );
250
+		if ( ! empty($sizes)) {
251
+			$editor = wp_get_image_editor($file);
252 252
 
253
-			if ( ! is_wp_error( $editor ) ) { // No support for this type of file
254
-				$uploaded = $editor->save( $file, 'image/jpeg' );
255
-				unset( $editor );
253
+			if ( ! is_wp_error($editor)) { // No support for this type of file
254
+				$uploaded = $editor->save($file, 'image/jpeg');
255
+				unset($editor);
256 256
 
257 257
 				// Resize based on the full size image, rather than the source.
258
-				if ( ! is_wp_error( $uploaded ) ) {
259
-					$editor = wp_get_image_editor( $uploaded['path'] );
260
-					unset( $uploaded['path'] );
258
+				if ( ! is_wp_error($uploaded)) {
259
+					$editor = wp_get_image_editor($uploaded['path']);
260
+					unset($uploaded['path']);
261 261
 
262
-					if ( ! is_wp_error( $editor ) ) {
263
-						$metadata['sizes'] = $editor->multi_resize( $sizes );
262
+					if ( ! is_wp_error($editor)) {
263
+						$metadata['sizes'] = $editor->multi_resize($sizes);
264 264
 						$metadata['sizes']['full'] = $uploaded;
265 265
 					}
266 266
 				}
@@ -269,8 +269,8 @@  discard block
 block discarded – undo
269 269
 	}
270 270
 
271 271
 	// Remove the blob of binary data from the array.
272
-	if ( $metadata ) {
273
-		unset( $metadata['image']['data'] );
272
+	if ($metadata) {
273
+		unset($metadata['image']['data']);
274 274
 	}
275 275
 
276 276
 	/**
@@ -281,7 +281,7 @@  discard block
 block discarded – undo
281 281
 	 * @param array $metadata      An array of attachment meta data.
282 282
 	 * @param int   $attachment_id Current attachment ID.
283 283
 	 */
284
-	return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
284
+	return apply_filters('wp_generate_attachment_metadata', $metadata, $attachment_id);
285 285
 }
286 286
 
287 287
 /**
@@ -293,8 +293,8 @@  discard block
 block discarded – undo
293 293
  * @return int|float
294 294
  */
295 295
 function wp_exif_frac2dec($str) {
296
-	@list( $n, $d ) = explode( '/', $str );
297
-	if ( !empty($d) )
296
+	@list($n, $d) = explode('/', $str);
297
+	if ( ! empty($d))
298 298
 		return $n / $d;
299 299
 	return $str;
300 300
 }
@@ -308,10 +308,10 @@  discard block
 block discarded – undo
308 308
  * @return int
309 309
  */
310 310
 function wp_exif_date2ts($str) {
311
-	@list( $date, $time ) = explode( ' ', trim($str) );
312
-	@list( $y, $m, $d ) = explode( ':', $date );
311
+	@list($date, $time) = explode(' ', trim($str));
312
+	@list($y, $m, $d) = explode(':', $date);
313 313
 
314
-	return strtotime( "{$y}-{$m}-{$d} {$time}" );
314
+	return strtotime("{$y}-{$m}-{$d} {$time}");
315 315
 }
316 316
 
317 317
 /**
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
  * @param string $file
331 331
  * @return bool|array False on failure. Image metadata array on success.
332 332
  */
333
-function wp_read_image_metadata( $file ) {
334
-	if ( ! file_exists( $file ) )
333
+function wp_read_image_metadata($file) {
334
+	if ( ! file_exists($file))
335 335
 		return false;
336 336
 
337
-	list( , , $sourceImageType ) = getimagesize( $file );
337
+	list(,, $sourceImageType) = getimagesize($file);
338 338
 
339 339
 	/*
340 340
 	 * EXIF contains a bunch of data we'll probably never need formatted in ways
@@ -362,31 +362,31 @@  discard block
 block discarded – undo
362 362
 	 * Read IPTC first, since it might contain data not available in exif such
363 363
 	 * as caption, description etc.
364 364
 	 */
365
-	if ( is_callable( 'iptcparse' ) ) {
366
-		getimagesize( $file, $info );
365
+	if (is_callable('iptcparse')) {
366
+		getimagesize($file, $info);
367 367
 
368
-		if ( ! empty( $info['APP13'] ) ) {
369
-			$iptc = iptcparse( $info['APP13'] );
368
+		if ( ! empty($info['APP13'])) {
369
+			$iptc = iptcparse($info['APP13']);
370 370
 
371 371
 			// Headline, "A brief synopsis of the caption."
372
-			if ( ! empty( $iptc['2#105'][0] ) ) {
373
-				$meta['title'] = trim( $iptc['2#105'][0] );
372
+			if ( ! empty($iptc['2#105'][0])) {
373
+				$meta['title'] = trim($iptc['2#105'][0]);
374 374
 			/*
375 375
 			 * Title, "Many use the Title field to store the filename of the image,
376 376
 			 * though the field may be used in many ways."
377 377
 			 */
378
-			} elseif ( ! empty( $iptc['2#005'][0] ) ) {
379
-				$meta['title'] = trim( $iptc['2#005'][0] );
378
+			} elseif ( ! empty($iptc['2#005'][0])) {
379
+				$meta['title'] = trim($iptc['2#005'][0]);
380 380
 			}
381 381
 
382
-			if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
383
-				$caption = trim( $iptc['2#120'][0] );
382
+			if ( ! empty($iptc['2#120'][0])) { // description / legacy caption
383
+				$caption = trim($iptc['2#120'][0]);
384 384
 
385 385
 				mbstring_binary_safe_encoding();
386
-				$caption_length = strlen( $caption );
386
+				$caption_length = strlen($caption);
387 387
 				reset_mbstring_encoding();
388 388
 
389
-				if ( empty( $meta['title'] ) && $caption_length < 80 ) {
389
+				if (empty($meta['title']) && $caption_length < 80) {
390 390
 					// Assume the title is stored in 2:120 if it's short.
391 391
 					$meta['title'] = $caption;
392 392
 				}
@@ -394,19 +394,19 @@  discard block
 block discarded – undo
394 394
 				$meta['caption'] = $caption;
395 395
 			}
396 396
 
397
-			if ( ! empty( $iptc['2#110'][0] ) ) // credit
398
-				$meta['credit'] = trim( $iptc['2#110'][0] );
399
-			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
400
-				$meta['credit'] = trim( $iptc['2#080'][0] );
397
+			if ( ! empty($iptc['2#110'][0])) // credit
398
+				$meta['credit'] = trim($iptc['2#110'][0]);
399
+			elseif ( ! empty($iptc['2#080'][0])) // creator / legacy byline
400
+				$meta['credit'] = trim($iptc['2#080'][0]);
401 401
 
402
-			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time
403
-				$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
402
+			if ( ! empty($iptc['2#055'][0]) && ! empty($iptc['2#060'][0])) // created date and time
403
+				$meta['created_timestamp'] = strtotime($iptc['2#055'][0].' '.$iptc['2#060'][0]);
404 404
 
405
-			if ( ! empty( $iptc['2#116'][0] ) ) // copyright
406
-				$meta['copyright'] = trim( $iptc['2#116'][0] );
405
+			if ( ! empty($iptc['2#116'][0])) // copyright
406
+				$meta['copyright'] = trim($iptc['2#116'][0]);
407 407
 
408
-			if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
409
-				$meta['keywords'] = array_values( $iptc['2#025'] );
408
+			if ( ! empty($iptc['2#025'][0])) { // keywords array
409
+				$meta['keywords'] = array_values($iptc['2#025']);
410 410
 			}
411 411
 		 }
412 412
 	}
@@ -418,78 +418,78 @@  discard block
 block discarded – undo
418 418
 	 *
419 419
 	 * @param array $image_types Image types to check for exif data.
420 420
 	 */
421
-	if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) {
422
-		$exif = @exif_read_data( $file );
421
+	if (is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)))) {
422
+		$exif = @exif_read_data($file);
423 423
 
424
-		if ( ! empty( $exif['ImageDescription'] ) ) {
424
+		if ( ! empty($exif['ImageDescription'])) {
425 425
 			mbstring_binary_safe_encoding();
426
-			$description_length = strlen( $exif['ImageDescription'] );
426
+			$description_length = strlen($exif['ImageDescription']);
427 427
 			reset_mbstring_encoding();
428 428
 
429
-			if ( empty( $meta['title'] ) && $description_length < 80 ) {
429
+			if (empty($meta['title']) && $description_length < 80) {
430 430
 				// Assume the title is stored in ImageDescription
431
-				$meta['title'] = trim( $exif['ImageDescription'] );
431
+				$meta['title'] = trim($exif['ImageDescription']);
432 432
 			}
433 433
 
434
-			if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) {
435
-				$meta['caption'] = trim( $exif['COMPUTED']['UserComment'] );
434
+			if (empty($meta['caption']) && ! empty($exif['COMPUTED']['UserComment'])) {
435
+				$meta['caption'] = trim($exif['COMPUTED']['UserComment']);
436 436
 			}
437 437
 
438
-			if ( empty( $meta['caption'] ) ) {
439
-				$meta['caption'] = trim( $exif['ImageDescription'] );
438
+			if (empty($meta['caption'])) {
439
+				$meta['caption'] = trim($exif['ImageDescription']);
440 440
 			}
441
-		} elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) {
442
-			$meta['caption'] = trim( $exif['Comments'] );
441
+		} elseif (empty($meta['caption']) && ! empty($exif['Comments'])) {
442
+			$meta['caption'] = trim($exif['Comments']);
443 443
 		}
444 444
 
445
-		if ( empty( $meta['credit'] ) ) {
446
-			if ( ! empty( $exif['Artist'] ) ) {
447
-				$meta['credit'] = trim( $exif['Artist'] );
448
-			} elseif ( ! empty($exif['Author'] ) ) {
449
-				$meta['credit'] = trim( $exif['Author'] );
445
+		if (empty($meta['credit'])) {
446
+			if ( ! empty($exif['Artist'])) {
447
+				$meta['credit'] = trim($exif['Artist']);
448
+			} elseif ( ! empty($exif['Author'])) {
449
+				$meta['credit'] = trim($exif['Author']);
450 450
 			}
451 451
 		}
452 452
 
453
-		if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
454
-			$meta['copyright'] = trim( $exif['Copyright'] );
453
+		if (empty($meta['copyright']) && ! empty($exif['Copyright'])) {
454
+			$meta['copyright'] = trim($exif['Copyright']);
455 455
 		}
456
-		if ( ! empty( $exif['FNumber'] ) ) {
457
-			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
456
+		if ( ! empty($exif['FNumber'])) {
457
+			$meta['aperture'] = round(wp_exif_frac2dec($exif['FNumber']), 2);
458 458
 		}
459
-		if ( ! empty( $exif['Model'] ) ) {
460
-			$meta['camera'] = trim( $exif['Model'] );
459
+		if ( ! empty($exif['Model'])) {
460
+			$meta['camera'] = trim($exif['Model']);
461 461
 		}
462
-		if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
463
-			$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
462
+		if (empty($meta['created_timestamp']) && ! empty($exif['DateTimeDigitized'])) {
463
+			$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
464 464
 		}
465
-		if ( ! empty( $exif['FocalLength'] ) ) {
466
-			$meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
465
+		if ( ! empty($exif['FocalLength'])) {
466
+			$meta['focal_length'] = (string) wp_exif_frac2dec($exif['FocalLength']);
467 467
 		}
468
-		if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
469
-			$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
470
-			$meta['iso'] = trim( $meta['iso'] );
468
+		if ( ! empty($exif['ISOSpeedRatings'])) {
469
+			$meta['iso'] = is_array($exif['ISOSpeedRatings']) ? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings'];
470
+			$meta['iso'] = trim($meta['iso']);
471 471
 		}
472
-		if ( ! empty( $exif['ExposureTime'] ) ) {
473
-			$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
472
+		if ( ! empty($exif['ExposureTime'])) {
473
+			$meta['shutter_speed'] = (string) wp_exif_frac2dec($exif['ExposureTime']);
474 474
 		}
475
-		if ( ! empty( $exif['Orientation'] ) ) {
475
+		if ( ! empty($exif['Orientation'])) {
476 476
 			$meta['orientation'] = $exif['Orientation'];
477 477
 		}
478 478
 	}
479 479
 
480
-	foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
481
-		if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
482
-			$meta[ $key ] = utf8_encode( $meta[ $key ] );
480
+	foreach (array('title', 'caption', 'credit', 'copyright', 'camera', 'iso') as $key) {
481
+		if ($meta[$key] && ! seems_utf8($meta[$key])) {
482
+			$meta[$key] = utf8_encode($meta[$key]);
483 483
 		}
484 484
 	}
485 485
 
486
-	foreach ( $meta['keywords'] as $key => $keyword ) {
487
-		if ( ! seems_utf8( $keyword ) ) {
488
-			$meta['keywords'][ $key ] = utf8_encode( $keyword );
486
+	foreach ($meta['keywords'] as $key => $keyword) {
487
+		if ( ! seems_utf8($keyword)) {
488
+			$meta['keywords'][$key] = utf8_encode($keyword);
489 489
 		}
490 490
 	}
491 491
 
492
-	$meta = wp_kses_post_deep( $meta );
492
+	$meta = wp_kses_post_deep($meta);
493 493
 
494 494
 	/**
495 495
 	 * Filters the array of meta data read from an image's exif data.
@@ -502,7 +502,7 @@  discard block
 block discarded – undo
502 502
 	 * @param int    $sourceImageType Type of image.
503 503
 	 * @param array  $iptc            IPTC data.
504 504
 	 */
505
-	return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc );
505
+	return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc);
506 506
 
507 507
 }
508 508
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
  */
517 517
 function file_is_valid_image($path) {
518 518
 	$size = @getimagesize($path);
519
-	return !empty($size);
519
+	return ! empty($size);
520 520
 }
521 521
 
522 522
 /**
@@ -528,12 +528,12 @@  discard block
 block discarded – undo
528 528
  * @return bool True if suitable, false if not suitable.
529 529
  */
530 530
 function file_is_displayable_image($path) {
531
-	$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
531
+	$displayable_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP);
532 532
 
533
-	$info = @getimagesize( $path );
534
-	if ( empty( $info ) ) {
533
+	$info = @getimagesize($path);
534
+	if (empty($info)) {
535 535
 		$result = false;
536
-	} elseif ( ! in_array( $info[2], $displayable_image_types ) ) {
536
+	} elseif ( ! in_array($info[2], $displayable_image_types)) {
537 537
 		$result = false;
538 538
 	} else {
539 539
 		$result = true;
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
 	 * @param bool   $result Whether the image can be displayed. Default true.
548 548
 	 * @param string $path   Path to the image.
549 549
 	 */
550
-	return apply_filters( 'file_is_displayable_image', $result, $path );
550
+	return apply_filters('file_is_displayable_image', $result, $path);
551 551
 }
552 552
 
553 553
 /**
@@ -560,12 +560,12 @@  discard block
 block discarded – undo
560 560
  * @param string $size Optional. Image size, defaults to 'full'.
561 561
  * @return resource|false The resulting image resource on success, false on failure.
562 562
  */
563
-function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
564
-	$filepath = _load_image_to_edit_path( $attachment_id, $size );
565
-	if ( empty( $filepath ) )
563
+function load_image_to_edit($attachment_id, $mime_type, $size = 'full') {
564
+	$filepath = _load_image_to_edit_path($attachment_id, $size);
565
+	if (empty($filepath))
566 566
 		return false;
567 567
 
568
-	switch ( $mime_type ) {
568
+	switch ($mime_type) {
569 569
 		case 'image/jpeg':
570 570
 			$image = imagecreatefromjpeg($filepath);
571 571
 			break;
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 			$image = false;
580 580
 			break;
581 581
 	}
582
-	if ( is_resource($image) ) {
582
+	if (is_resource($image)) {
583 583
 		/**
584 584
 		 * Filters the current image being loaded for editing.
585 585
 		 *
@@ -589,8 +589,8 @@  discard block
 block discarded – undo
589 589
 		 * @param string   $attachment_id Attachment ID.
590 590
 		 * @param string   $size          Image size.
591 591
 		 */
592
-		$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
593
-		if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
592
+		$image = apply_filters('load_image_to_edit', $image, $attachment_id, $size);
593
+		if (function_exists('imagealphablending') && function_exists('imagesavealpha')) {
594 594
 			imagealphablending($image, false);
595 595
 			imagesavealpha($image, true);
596 596
 		}
@@ -611,11 +611,11 @@  discard block
 block discarded – undo
611 611
  * @param string $size Optional. Image size, defaults to 'full'.
612 612
  * @return string|false File path or url on success, false on failure.
613 613
  */
614
-function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
615
-	$filepath = get_attached_file( $attachment_id );
614
+function _load_image_to_edit_path($attachment_id, $size = 'full') {
615
+	$filepath = get_attached_file($attachment_id);
616 616
 
617
-	if ( $filepath && file_exists( $filepath ) ) {
618
-		if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) {
617
+	if ($filepath && file_exists($filepath)) {
618
+		if ('full' != $size && ($data = image_get_intermediate_size($attachment_id, $size))) {
619 619
 			/**
620 620
 			 * Filters the path to the current image.
621 621
 			 *
@@ -627,9 +627,9 @@  discard block
 block discarded – undo
627 627
 			 * @param string $attachment_id Attachment ID.
628 628
 			 * @param string $size          Size of the image.
629 629
 			 */
630
-			$filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size );
630
+			$filepath = apply_filters('load_image_to_edit_filesystempath', path_join(dirname($filepath), $data['file']), $attachment_id, $size);
631 631
 		}
632
-	} elseif ( function_exists( 'fopen' ) && true == ini_get( 'allow_url_fopen' ) ) {
632
+	} elseif (function_exists('fopen') && true == ini_get('allow_url_fopen')) {
633 633
 		/**
634 634
 		 * Filters the image URL if not in the local filesystem.
635 635
 		 *
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 		 * @param string $attachment_id Attachment ID.
642 642
 		 * @param string $size          Size of the image.
643 643
 		 */
644
-		$filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
644
+		$filepath = apply_filters('load_image_to_edit_attachmenturl', wp_get_attachment_url($attachment_id), $attachment_id, $size);
645 645
 	}
646 646
 
647 647
 	/**
@@ -653,7 +653,7 @@  discard block
 block discarded – undo
653 653
 	 * @param string      $attachment_id Attachment ID.
654 654
 	 * @param string      $size          Size of the image.
655 655
 	 */
656
-	return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
656
+	return apply_filters('load_image_to_edit_path', $filepath, $attachment_id, $size);
657 657
 }
658 658
 
659 659
 /**
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
  * @param string $attachment_id Attachment ID.
666 666
  * @return string|false New file path on success, false on failure.
667 667
  */
668
-function _copy_image_file( $attachment_id ) {
669
-	$dst_file = $src_file = get_attached_file( $attachment_id );
670
-	if ( ! file_exists( $src_file ) )
671
-		$src_file = _load_image_to_edit_path( $attachment_id );
668
+function _copy_image_file($attachment_id) {
669
+	$dst_file = $src_file = get_attached_file($attachment_id);
670
+	if ( ! file_exists($src_file))
671
+		$src_file = _load_image_to_edit_path($attachment_id);
672 672
 
673
-	if ( $src_file ) {
674
-		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
675
-		$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
673
+	if ($src_file) {
674
+		$dst_file = str_replace(basename($dst_file), 'copy-'.basename($dst_file), $dst_file);
675
+		$dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file));
676 676
 
677 677
 		/*
678 678
 		 * The directory containing the original file may no longer
679 679
 		 * exist when using a replication plugin.
680 680
 		 */
681
-		wp_mkdir_p( dirname( $dst_file ) );
681
+		wp_mkdir_p(dirname($dst_file));
682 682
 
683
-		if ( ! @copy( $src_file, $dst_file ) )
683
+		if ( ! @copy($src_file, $dst_file))
684 684
 			$dst_file = false;
685 685
 	} else {
686 686
 		$dst_file = false;
Please login to merge, or discard this patch.
Braces   +44 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,15 +37,18 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	$editor = wp_get_image_editor( $src );
40
-	if ( is_wp_error( $editor ) )
41
-		return $editor;
40
+	if ( is_wp_error( $editor ) ) {
41
+			return $editor;
42
+	}
42 43
 
43 44
 	$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
44
-	if ( is_wp_error( $src ) )
45
-		return $src;
45
+	if ( is_wp_error( $src ) ) {
46
+			return $src;
47
+	}
46 48
 
47
-	if ( ! $dst_file )
48
-		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
49
+	if ( ! $dst_file ) {
50
+			$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
51
+	}
49 52
 
50 53
 	/*
51 54
 	 * The directory containing the original file may no longer exist when
@@ -56,8 +59,9 @@  discard block
 block discarded – undo
56 59
 	$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
57 60
 
58 61
 	$result = $editor->save( $dst_file );
59
-	if ( is_wp_error( $result ) )
60
-		return $result;
62
+	if ( is_wp_error( $result ) ) {
63
+			return $result;
64
+	}
61 65
 
62 66
 	return $dst_file;
63 67
 }
@@ -131,16 +135,18 @@  discard block
 block discarded – undo
131 135
 		if ( $sizes ) {
132 136
 			$editor = wp_get_image_editor( $file );
133 137
 
134
-			if ( ! is_wp_error( $editor ) )
135
-				$metadata['sizes'] = $editor->multi_resize( $sizes );
138
+			if ( ! is_wp_error( $editor ) ) {
139
+							$metadata['sizes'] = $editor->multi_resize( $sizes );
140
+			}
136 141
 		} else {
137 142
 			$metadata['sizes'] = array();
138 143
 		}
139 144
 
140 145
 		// Fetch additional metadata from EXIF/IPTC.
141 146
 		$image_meta = wp_read_image_metadata( $file );
142
-		if ( $image_meta )
143
-			$metadata['image_meta'] = $image_meta;
147
+		if ( $image_meta ) {
148
+					$metadata['image_meta'] = $image_meta;
149
+		}
144 150
 
145 151
 	} elseif ( wp_attachment_is( 'video', $attachment ) ) {
146 152
 		$metadata = wp_read_video_metadata( $file );
@@ -294,8 +300,9 @@  discard block
 block discarded – undo
294 300
  */
295 301
 function wp_exif_frac2dec($str) {
296 302
 	@list( $n, $d ) = explode( '/', $str );
297
-	if ( !empty($d) )
298
-		return $n / $d;
303
+	if ( !empty($d) ) {
304
+			return $n / $d;
305
+	}
299 306
 	return $str;
300 307
 }
301 308
 
@@ -331,8 +338,9 @@  discard block
 block discarded – undo
331 338
  * @return bool|array False on failure. Image metadata array on success.
332 339
  */
333 340
 function wp_read_image_metadata( $file ) {
334
-	if ( ! file_exists( $file ) )
335
-		return false;
341
+	if ( ! file_exists( $file ) ) {
342
+			return false;
343
+	}
336 344
 
337 345
 	list( , , $sourceImageType ) = getimagesize( $file );
338 346
 
@@ -394,16 +402,23 @@  discard block
 block discarded – undo
394 402
 				$meta['caption'] = $caption;
395 403
 			}
396 404
 
397
-			if ( ! empty( $iptc['2#110'][0] ) ) // credit
405
+			if ( ! empty( $iptc['2#110'][0] ) ) {
406
+				// credit
398 407
 				$meta['credit'] = trim( $iptc['2#110'][0] );
399
-			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
408
+			} elseif ( ! empty( $iptc['2#080'][0] ) ) {
409
+				// creator / legacy byline
400 410
 				$meta['credit'] = trim( $iptc['2#080'][0] );
411
+			}
401 412
 
402
-			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time
413
+			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) {
414
+				// created date and time
403 415
 				$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
416
+			}
404 417
 
405
-			if ( ! empty( $iptc['2#116'][0] ) ) // copyright
418
+			if ( ! empty( $iptc['2#116'][0] ) ) {
419
+				// copyright
406 420
 				$meta['copyright'] = trim( $iptc['2#116'][0] );
421
+			}
407 422
 
408 423
 			if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
409 424
 				$meta['keywords'] = array_values( $iptc['2#025'] );
@@ -562,8 +577,9 @@  discard block
 block discarded – undo
562 577
  */
563 578
 function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
564 579
 	$filepath = _load_image_to_edit_path( $attachment_id, $size );
565
-	if ( empty( $filepath ) )
566
-		return false;
580
+	if ( empty( $filepath ) ) {
581
+			return false;
582
+	}
567 583
 
568 584
 	switch ( $mime_type ) {
569 585
 		case 'image/jpeg':
@@ -667,8 +683,9 @@  discard block
 block discarded – undo
667 683
  */
668 684
 function _copy_image_file( $attachment_id ) {
669 685
 	$dst_file = $src_file = get_attached_file( $attachment_id );
670
-	if ( ! file_exists( $src_file ) )
671
-		$src_file = _load_image_to_edit_path( $attachment_id );
686
+	if ( ! file_exists( $src_file ) ) {
687
+			$src_file = _load_image_to_edit_path( $attachment_id );
688
+	}
672 689
 
673 690
 	if ( $src_file ) {
674 691
 		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
@@ -680,8 +697,9 @@  discard block
 block discarded – undo
680 697
 		 */
681 698
 		wp_mkdir_p( dirname( $dst_file ) );
682 699
 
683
-		if ( ! @copy( $src_file, $dst_file ) )
684
-			$dst_file = false;
700
+		if ( ! @copy( $src_file, $dst_file ) ) {
701
+					$dst_file = false;
702
+		}
685 703
 	} else {
686 704
 		$dst_file = false;
687 705
 	}
Please login to merge, or discard this patch.
src/wp-admin/includes/revision.php 2 patches
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,26 +19,31 @@  discard block
 block discarded – undo
19 19
  *                    Or, false on failure.
20 20
  */
21 21
 function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
22
-	if ( ! $post = get_post( $post ) )
23
-		return false;
22
+	if ( ! $post = get_post( $post ) ) {
23
+			return false;
24
+	}
24 25
 
25 26
 	if ( $compare_from ) {
26
-		if ( ! $compare_from = get_post( $compare_from ) )
27
-			return false;
27
+		if ( ! $compare_from = get_post( $compare_from ) ) {
28
+					return false;
29
+		}
28 30
 	} else {
29 31
 		// If we're dealing with the first revision...
30 32
 		$compare_from = false;
31 33
 	}
32 34
 
33
-	if ( ! $compare_to = get_post( $compare_to ) )
34
-		return false;
35
+	if ( ! $compare_to = get_post( $compare_to ) ) {
36
+			return false;
37
+	}
35 38
 
36 39
 	// If comparing revisions, make sure we're dealing with the right post parent.
37 40
 	// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
38
-	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
39
-		return false;
40
-	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
41
-		return false;
41
+	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) {
42
+			return false;
43
+	}
44
+	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) {
45
+			return false;
46
+	}
42 47
 
43 48
 	if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
44 49
 		$temp = $compare_from;
@@ -47,10 +52,12 @@  discard block
 block discarded – undo
47 52
 	}
48 53
 
49 54
 	// Add default title if title field is empty
50
-	if ( $compare_from && empty( $compare_from->post_title ) )
51
-		$compare_from->post_title = __( '(no title)' );
52
-	if ( empty( $compare_to->post_title ) )
53
-		$compare_to->post_title = __( '(no title)' );
55
+	if ( $compare_from && empty( $compare_from->post_title ) ) {
56
+			$compare_from->post_title = __( '(no title)' );
57
+	}
58
+	if ( empty( $compare_to->post_title ) ) {
59
+			$compare_to->post_title = __( '(no title)' );
60
+	}
54 61
 
55 62
 	$return = array();
56 63
 
@@ -150,8 +157,9 @@  discard block
 block discarded – undo
150 157
 	// If revisions are disabled, we only want autosaves and the current post.
151 158
 	if ( ! wp_revisions_enabled( $post ) ) {
152 159
 		foreach ( $revisions as $revision_id => $revision ) {
153
-			if ( ! wp_is_post_autosave( $revision ) )
154
-				unset( $revisions[ $revision_id ] );
160
+			if ( ! wp_is_post_autosave( $revision ) ) {
161
+							unset( $revisions[ $revision_id ] );
162
+			}
155 163
 		}
156 164
 		$revisions = array( $post->ID => $post ) + $revisions;
157 165
 	}
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -19,43 +19,43 @@  discard block
 block discarded – undo
19 19
  * @return array|bool Associative array of a post's revisioned fields and their diffs.
20 20
  *                    Or, false on failure.
21 21
  */
22
-function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
23
-	if ( ! $post = get_post( $post ) )
22
+function wp_get_revision_ui_diff($post, $compare_from, $compare_to) {
23
+	if ( ! $post = get_post($post))
24 24
 		return false;
25 25
 
26
-	if ( $compare_from ) {
27
-		if ( ! $compare_from = get_post( $compare_from ) )
26
+	if ($compare_from) {
27
+		if ( ! $compare_from = get_post($compare_from))
28 28
 			return false;
29 29
 	} else {
30 30
 		// If we're dealing with the first revision...
31 31
 		$compare_from = false;
32 32
 	}
33 33
 
34
-	if ( ! $compare_to = get_post( $compare_to ) )
34
+	if ( ! $compare_to = get_post($compare_to))
35 35
 		return false;
36 36
 
37 37
 	// If comparing revisions, make sure we're dealing with the right post parent.
38 38
 	// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
39
-	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
39
+	if ($compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID)
40 40
 		return false;
41
-	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
41
+	if ($compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID)
42 42
 		return false;
43 43
 
44
-	if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
44
+	if ($compare_from && strtotime($compare_from->post_date_gmt) > strtotime($compare_to->post_date_gmt)) {
45 45
 		$temp = $compare_from;
46 46
 		$compare_from = $compare_to;
47 47
 		$compare_to = $temp;
48 48
 	}
49 49
 
50 50
 	// Add default title if title field is empty
51
-	if ( $compare_from && empty( $compare_from->post_title ) )
52
-		$compare_from->post_title = __( '(no title)' );
53
-	if ( empty( $compare_to->post_title ) )
54
-		$compare_to->post_title = __( '(no title)' );
51
+	if ($compare_from && empty($compare_from->post_title))
52
+		$compare_from->post_title = __('(no title)');
53
+	if (empty($compare_to->post_title))
54
+		$compare_to->post_title = __('(no title)');
55 55
 
56 56
 	$return = array();
57 57
 
58
-	foreach ( _wp_post_revision_fields( $post ) as $field => $name ) {
58
+	foreach (_wp_post_revision_fields($post) as $field => $name) {
59 59
 		/**
60 60
 		 * Contextually filter a post revision field.
61 61
 		 *
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 		 * @param string  null                  The context of whether the current revision is the old
71 71
 		 *                                      or the new one. Values are 'to' or 'from'.
72 72
 		 */
73
-		$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
73
+		$content_from = $compare_from ? apply_filters("_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from') : '';
74 74
 
75 75
 		/** This filter is documented in wp-admin/includes/revision.php */
76
-		$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );
76
+		$content_to = apply_filters("_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to');
77 77
 
78 78
 		$args = array(
79 79
 			'show_split_view' => true
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 		 * @param WP_Post $compare_from The revision post to compare from.
97 97
 		 * @param WP_Post $compare_to   The revision post to compare to.
98 98
 		 */
99
-		$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
99
+		$args = apply_filters('revision_text_diff_options', $args, $field, $compare_from, $compare_to);
100 100
 
101
-		$diff = wp_text_diff( $content_from, $content_to, $args );
101
+		$diff = wp_text_diff($content_from, $content_to, $args);
102 102
 
103
-		if ( ! $diff && 'post_title' === $field ) {
103
+		if ( ! $diff && 'post_title' === $field) {
104 104
 			// It's a better user experience to still show the Title, even if it didn't change.
105 105
 			// No, you didn't see this.
106 106
 			$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
107
-			$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
107
+			$diff .= '<td>'.esc_html($compare_from->post_title).'</td><td></td><td>'.esc_html($compare_to->post_title).'</td>';
108 108
 			$diff .= '</tr></tbody>';
109 109
 			$diff .= '</table>';
110 110
 		}
111 111
 
112
-		if ( $diff ) {
112
+		if ($diff) {
113 113
 			$return[] = array(
114 114
 				'id' => $field,
115 115
 				'name' => $name,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param WP_Post $compare_from The revision post to compare from.
128 128
 	 * @param WP_Post $compare_to   The revision post to compare to.
129 129
 	 */
130
-	return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to );
130
+	return apply_filters('wp_get_revision_ui_diff', $return, $compare_from, $compare_to);
131 131
 
132 132
 }
133 133
 
@@ -142,71 +142,71 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @return array An associative array of revision data and related settings.
144 144
  */
145
-function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) {
146
-	$post = get_post( $post );
145
+function wp_prepare_revisions_for_js($post, $selected_revision_id, $from = null) {
146
+	$post = get_post($post);
147 147
 	$authors = array();
148 148
 	$now_gmt = time();
149 149
 
150
-	$revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false ) );
150
+	$revisions = wp_get_post_revisions($post->ID, array('order' => 'ASC', 'check_enabled' => false));
151 151
 	// If revisions are disabled, we only want autosaves and the current post.
152
-	if ( ! wp_revisions_enabled( $post ) ) {
153
-		foreach ( $revisions as $revision_id => $revision ) {
154
-			if ( ! wp_is_post_autosave( $revision ) )
155
-				unset( $revisions[ $revision_id ] );
152
+	if ( ! wp_revisions_enabled($post)) {
153
+		foreach ($revisions as $revision_id => $revision) {
154
+			if ( ! wp_is_post_autosave($revision))
155
+				unset($revisions[$revision_id]);
156 156
 		}
157
-		$revisions = array( $post->ID => $post ) + $revisions;
157
+		$revisions = array($post->ID => $post) + $revisions;
158 158
 	}
159 159
 
160
-	$show_avatars = get_option( 'show_avatars' );
160
+	$show_avatars = get_option('show_avatars');
161 161
 
162
-	cache_users( wp_list_pluck( $revisions, 'post_author' ) );
162
+	cache_users(wp_list_pluck($revisions, 'post_author'));
163 163
 
164
-	$can_restore = current_user_can( 'edit_post', $post->ID );
164
+	$can_restore = current_user_can('edit_post', $post->ID);
165 165
 	$current_id = false;
166 166
 
167
-	foreach ( $revisions as $revision ) {
168
-		$modified = strtotime( $revision->post_modified );
169
-		$modified_gmt = strtotime( $revision->post_modified_gmt );
170
-		if ( $can_restore ) {
171
-			$restore_link = str_replace( '&amp;', '&', wp_nonce_url(
167
+	foreach ($revisions as $revision) {
168
+		$modified = strtotime($revision->post_modified);
169
+		$modified_gmt = strtotime($revision->post_modified_gmt);
170
+		if ($can_restore) {
171
+			$restore_link = str_replace('&amp;', '&', wp_nonce_url(
172 172
 				add_query_arg(
173
-					array( 'revision' => $revision->ID,
174
-						'action' => 'restore' ),
175
-						admin_url( 'revision.php' )
173
+					array('revision' => $revision->ID,
174
+						'action' => 'restore'),
175
+						admin_url('revision.php')
176 176
 				),
177 177
 				"restore-post_{$revision->ID}"
178
-			) );
178
+			));
179 179
 		}
180 180
 
181
-		if ( ! isset( $authors[ $revision->post_author ] ) ) {
182
-			$authors[ $revision->post_author ] = array(
181
+		if ( ! isset($authors[$revision->post_author])) {
182
+			$authors[$revision->post_author] = array(
183 183
 				'id' => (int) $revision->post_author,
184
-				'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
185
-				'name' => get_the_author_meta( 'display_name', $revision->post_author ),
184
+				'avatar' => $show_avatars ? get_avatar($revision->post_author, 32) : '',
185
+				'name' => get_the_author_meta('display_name', $revision->post_author),
186 186
 			);
187 187
 		}
188 188
 
189
-		$autosave = (bool) wp_is_post_autosave( $revision );
189
+		$autosave = (bool) wp_is_post_autosave($revision);
190 190
 		$current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
191
-		if ( $current && ! empty( $current_id ) ) {
191
+		if ($current && ! empty($current_id)) {
192 192
 			// If multiple revisions have the same post_modified_gmt, highest ID is current.
193
-			if ( $current_id < $revision->ID ) {
194
-				$revisions[ $current_id ]['current'] = false;
193
+			if ($current_id < $revision->ID) {
194
+				$revisions[$current_id]['current'] = false;
195 195
 				$current_id = $revision->ID;
196 196
 			} else {
197 197
 				$current = false;
198 198
 			}
199
-		} elseif ( $current ) {
199
+		} elseif ($current) {
200 200
 			$current_id = $revision->ID;
201 201
 		}
202 202
 
203 203
 		$revisions_data = array(
204 204
 			'id'         => $revision->ID,
205
-			'title'      => get_the_title( $post->ID ),
206
-			'author'     => $authors[ $revision->post_author ],
207
-			'date'       => date_i18n( __( 'M j, Y @ H:i' ), $modified ),
208
-			'dateShort'  => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ),
209
-			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
205
+			'title'      => get_the_title($post->ID),
206
+			'author'     => $authors[$revision->post_author],
207
+			'date'       => date_i18n(__('M j, Y @ H:i'), $modified),
208
+			'dateShort'  => date_i18n(_x('j M @ H:i', 'revision date short format'), $modified),
209
+			'timeAgo'    => sprintf(__('%s ago'), human_time_diff($modified_gmt, $now_gmt)),
210 210
 			'autosave'   => $autosave,
211 211
 			'current'    => $current,
212 212
 			'restoreUrl' => $can_restore ? $restore_link : false,
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 		 * @param WP_Post $revision       The revision's WP_Post object.
235 235
 		 * @param WP_Post $post           The revision's parent WP_Post object.
236 236
 		 */
237
-		$revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
237
+		$revisions[$revision->ID] = apply_filters('wp_prepare_revision_for_js', $revisions_data, $revision, $post);
238 238
 	}
239 239
 
240 240
 	/**
241 241
 	 * If we only have one revision, the initial revision is missing; This happens
242 242
 	 * when we have an autsosave and the user has clicked 'View the Autosave'
243 243
 	 */
244
-	if ( 1 === sizeof( $revisions ) ) {
245
-		$revisions[ $post->ID ] = array(
244
+	if (1 === sizeof($revisions)) {
245
+		$revisions[$post->ID] = array(
246 246
 			'id'         => $post->ID,
247
-			'title'      => get_the_title( $post->ID ),
248
-			'author'     => $authors[ $post->post_author ],
249
-			'date'       => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ),
250
-			'dateShort'  => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ),
251
-			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ),
247
+			'title'      => get_the_title($post->ID),
248
+			'author'     => $authors[$post->post_author],
249
+			'date'       => date_i18n(__('M j, Y @ H:i'), strtotime($post->post_modified)),
250
+			'dateShort'  => date_i18n(_x('j M @ H:i', 'revision date short format'), strtotime($post->post_modified)),
251
+			'timeAgo'    => sprintf(__('%s ago'), human_time_diff(strtotime($post->post_modified_gmt), $now_gmt)),
252 252
 			'autosave'   => false,
253 253
 			'current'    => true,
254 254
 			'restoreUrl' => false,
@@ -261,48 +261,48 @@  discard block
 block discarded – undo
261 261
 	 * were changed), we may not have a "current" revision. Mark the latest
262 262
 	 * revision as "current".
263 263
 	 */
264
-	if ( empty( $current_id ) ) {
265
-		if ( $revisions[ $revision->ID ]['autosave'] ) {
266
-			$revision = end( $revisions );
267
-			while ( $revision['autosave'] ) {
268
-				$revision = prev( $revisions );
264
+	if (empty($current_id)) {
265
+		if ($revisions[$revision->ID]['autosave']) {
266
+			$revision = end($revisions);
267
+			while ($revision['autosave']) {
268
+				$revision = prev($revisions);
269 269
 			}
270 270
 			$current_id = $revision['id'];
271 271
 		} else {
272 272
 			$current_id = $revision->ID;
273 273
 		}
274
-		$revisions[ $current_id ]['current'] = true;
274
+		$revisions[$current_id]['current'] = true;
275 275
 	}
276 276
 
277 277
 	// Now, grab the initial diff.
278
-	$compare_two_mode = is_numeric( $from );
279
-	if ( ! $compare_two_mode ) {
280
-		$found = array_search( $selected_revision_id, array_keys( $revisions ) );
281
-		if ( $found ) {
282
-			$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
283
-			$from = reset( $from );
278
+	$compare_two_mode = is_numeric($from);
279
+	if ( ! $compare_two_mode) {
280
+		$found = array_search($selected_revision_id, array_keys($revisions));
281
+		if ($found) {
282
+			$from = array_keys(array_slice($revisions, $found - 1, 1, true));
283
+			$from = reset($from);
284 284
 		} else {
285 285
 			$from = 0;
286 286
 		}
287 287
 	}
288 288
 
289
-	$from = absint( $from );
289
+	$from = absint($from);
290 290
 
291
-	$diffs = array( array(
292
-		'id' => $from . ':' . $selected_revision_id,
293
-		'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ),
291
+	$diffs = array(array(
292
+		'id' => $from.':'.$selected_revision_id,
293
+		'fields' => wp_get_revision_ui_diff($post->ID, $from, $selected_revision_id),
294 294
 	));
295 295
 
296 296
 	return array(
297 297
 		'postId'           => $post->ID,
298
-		'nonce'            => wp_create_nonce( 'revisions-ajax-nonce' ),
299
-		'revisionData'     => array_values( $revisions ),
298
+		'nonce'            => wp_create_nonce('revisions-ajax-nonce'),
299
+		'revisionData'     => array_values($revisions),
300 300
 		'to'               => $selected_revision_id,
301 301
 		'from'             => $from,
302 302
 		'diffData'         => $diffs,
303
-		'baseUrl'          => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
304
-		'compareTwoMode'   => absint( $compare_two_mode ), // Apparently booleans are not allowed
305
-		'revisionIds'      => array_keys( $revisions ),
303
+		'baseUrl'          => parse_url(admin_url('revision.php'), PHP_URL_PATH),
304
+		'compareTwoMode'   => absint($compare_two_mode), // Apparently booleans are not allowed
305
+		'revisionIds'      => array_keys($revisions),
306 306
 	);
307 307
 }
308 308
 
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
 	<script id="tmpl-revisions-buttons" type="text/html">
324 324
 		<div class="revisions-previous">
325
-			<input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
325
+			<input class="button" type="button" value="<?php echo esc_attr_x('Previous', 'Button label for a previous revision'); ?>" />
326 326
 		</div>
327 327
 
328 328
 		<div class="revisions-next">
329
-			<input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
329
+			<input class="button" type="button" value="<?php echo esc_attr_x('Next', 'Button label for a next revision'); ?>" />
330 330
 		</div>
331 331
 	</script>
332 332
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				}
341 341
 				#>
342 342
 				/>
343
-				<?php esc_html_e( 'Compare any two revisions' ); ?>
343
+				<?php esc_html_e('Compare any two revisions'); ?>
344 344
 			</label>
345 345
 		</div>
346 346
 	</script>
@@ -349,28 +349,28 @@  discard block
 block discarded – undo
349 349
 		<# if ( ! _.isUndefined( data.attributes ) ) { #>
350 350
 			<div class="diff-title">
351 351
 				<# if ( 'from' === data.type ) { #>
352
-					<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
352
+					<strong><?php _ex('From:', 'Followed by post revision info'); ?></strong>
353 353
 				<# } else if ( 'to' === data.type ) { #>
354
-					<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
354
+					<strong><?php _ex('To:', 'Followed by post revision info'); ?></strong>
355 355
 				<# } #>
356 356
 				<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
357 357
 					{{{ data.attributes.author.avatar }}}
358 358
 					<div class="author-info">
359 359
 					<# if ( data.attributes.autosave ) { #>
360
-						<span class="byline"><?php printf( __( 'Autosave by %s' ),
361
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
360
+						<span class="byline"><?php printf(__('Autosave by %s'),
361
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
362 362
 					<# } else if ( data.attributes.current ) { #>
363
-						<span class="byline"><?php printf( __( 'Current Revision by %s' ),
364
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
363
+						<span class="byline"><?php printf(__('Current Revision by %s'),
364
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
365 365
 					<# } else { #>
366
-						<span class="byline"><?php printf( __( 'Revision by %s' ),
367
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
366
+						<span class="byline"><?php printf(__('Revision by %s'),
367
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
368 368
 					<# } #>
369 369
 						<span class="time-ago">{{ data.attributes.timeAgo }}</span>
370 370
 						<span class="date">({{ data.attributes.dateShort }})</span>
371 371
 					</div>
372 372
 				<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
373
-					<input  <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
373
+					<input  <?php if (wp_check_post_lock($post->ID)) { ?>
374 374
 						disabled="disabled"
375 375
 					<?php } else { ?>
376 376
 						<# if ( data.attributes.current ) { #>
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 						<# } #>
379 379
 					<?php } ?>
380 380
 					<# if ( data.attributes.autosave ) { #>
381
-						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
381
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Autosave'); ?>" />
382 382
 					<# } else { #>
383
-						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
383
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Revision'); ?>" />
384 384
 					<# } #>
385 385
 				<# } #>
386 386
 			</div>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 	<script id="tmpl-revisions-diff" type="text/html">
394 394
 		<div class="loading-indicator"><span class="spinner"></span></div>
395
-		<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
395
+		<div class="diff-error"><?php _e('Sorry, something went wrong. The requested comparison could not be loaded.'); ?></div>
396 396
 		<div class="diff">
397 397
 		<# _.each( data.fields, function( field ) { #>
398 398
 			<h3>{{ field.name }}</h3>
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-users-list-table.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 	/**
55 55
 	 * Check the current user's permissions.
56 56
 	 *
57
- 	 * @since 3.1.0
57
+	 * @since 3.1.0
58 58
 	 * @access public
59 59
 	 *
60 60
 	 * @return bool
Please login to merge, or discard this patch.
Braces   +49 added lines, -34 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->is_site_users = 'site-users-network' === $this->screen->id;
56 56
 
57
-		if ( $this->is_site_users )
58
-			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
57
+		if ( $this->is_site_users ) {
58
+					$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
59
+		}
59 60
 	}
60 61
 
61 62
 	/**
@@ -67,10 +68,11 @@  discard block
 block discarded – undo
67 68
 	 * @return bool
68 69
 	 */
69 70
 	public function ajax_user_can() {
70
-		if ( $this->is_site_users )
71
-			return current_user_can( 'manage_sites' );
72
-		else
73
-			return current_user_can( 'list_users' );
71
+		if ( $this->is_site_users ) {
72
+					return current_user_can( 'manage_sites' );
73
+		} else {
74
+					return current_user_can( 'list_users' );
75
+		}
74 76
 	}
75 77
 
76 78
 	/**
@@ -112,17 +114,21 @@  discard block
 block discarded – undo
112 114
 			);
113 115
 		}
114 116
 
115
-		if ( '' !== $args['search'] )
116
-			$args['search'] = '*' . $args['search'] . '*';
117
+		if ( '' !== $args['search'] ) {
118
+					$args['search'] = '*' . $args['search'] . '*';
119
+		}
117 120
 
118
-		if ( $this->is_site_users )
119
-			$args['blog_id'] = $this->site_id;
121
+		if ( $this->is_site_users ) {
122
+					$args['blog_id'] = $this->site_id;
123
+		}
120 124
 
121
-		if ( isset( $_REQUEST['orderby'] ) )
122
-			$args['orderby'] = $_REQUEST['orderby'];
125
+		if ( isset( $_REQUEST['orderby'] ) ) {
126
+					$args['orderby'] = $_REQUEST['orderby'];
127
+		}
123 128
 
124
-		if ( isset( $_REQUEST['order'] ) )
125
-			$args['order'] = $_REQUEST['order'];
129
+		if ( isset( $_REQUEST['order'] ) ) {
130
+					$args['order'] = $_REQUEST['order'];
131
+		}
126 132
 
127 133
 		/**
128 134
 		 * Filter the query arguments used to retrieve users for the current users list table.
@@ -192,8 +198,9 @@  discard block
 block discarded – undo
192 198
 		$role_links = array();
193 199
 		$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
194 200
 		foreach ( $wp_roles->get_names() as $this_role => $name ) {
195
-			if ( !isset($avail_roles[$this_role]) )
196
-				continue;
201
+			if ( !isset($avail_roles[$this_role]) ) {
202
+							continue;
203
+			}
197 204
 
198 205
 			$class = '';
199 206
 
@@ -237,11 +244,13 @@  discard block
 block discarded – undo
237 244
 		$actions = array();
238 245
 
239 246
 		if ( is_multisite() ) {
240
-			if ( current_user_can( 'remove_users' ) )
241
-				$actions['remove'] = __( 'Remove' );
247
+			if ( current_user_can( 'remove_users' ) ) {
248
+							$actions['remove'] = __( 'Remove' );
249
+			}
242 250
 		} else {
243
-			if ( current_user_can( 'delete_users' ) )
244
-				$actions['delete'] = __( 'Delete' );
251
+			if ( current_user_can( 'delete_users' ) ) {
252
+							$actions['delete'] = __( 'Delete' );
253
+			}
245 254
 		}
246 255
 
247 256
 		return $actions;
@@ -319,8 +328,9 @@  discard block
 block discarded – undo
319 328
 			'posts'    => __( 'Posts' )
320 329
 		);
321 330
 
322
-		if ( $this->is_site_users )
323
-			unset( $c['posts'] );
331
+		if ( $this->is_site_users ) {
332
+					unset( $c['posts'] );
333
+		}
324 334
 
325 335
 		return $c;
326 336
 	}
@@ -351,12 +361,14 @@  discard block
 block discarded – undo
351 361
 	 */
352 362
 	public function display_rows() {
353 363
 		// Query the post counts for this page
354
-		if ( ! $this->is_site_users )
355
-			$post_counts = count_many_users_posts( array_keys( $this->items ) );
364
+		if ( ! $this->is_site_users ) {
365
+					$post_counts = count_many_users_posts( array_keys( $this->items ) );
366
+		}
356 367
 
357 368
 		foreach ( $this->items as $userid => $user_object ) {
358
-			if ( is_multisite() && empty( $user_object->allcaps ) )
359
-				continue;
369
+			if ( is_multisite() && empty( $user_object->allcaps ) ) {
370
+							continue;
371
+			}
360 372
 
361 373
 			echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
362 374
 		}
@@ -384,10 +396,11 @@  discard block
 block discarded – undo
384 396
 		$user_object->filter = 'display';
385 397
 		$email = $user_object->user_email;
386 398
 
387
-		if ( $this->is_site_users )
388
-			$url = "site-users.php?id={$this->site_id}&amp;";
389
-		else
390
-			$url = 'users.php?';
399
+		if ( $this->is_site_users ) {
400
+					$url = "site-users.php?id={$this->site_id}&amp;";
401
+		} else {
402
+					$url = 'users.php?';
403
+		}
391 404
 
392 405
 		$user_roles = $this->get_role_list( $user_object );
393 406
 
@@ -406,10 +419,12 @@  discard block
 block discarded – undo
406 419
 				$edit = "<strong>$user_object->user_login</strong><br />";
407 420
 			}
408 421
 
409
-			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
410
-				$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
411
-			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
412
-				$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
422
+			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) {
423
+							$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
424
+			}
425
+			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) {
426
+							$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
427
+			}
413 428
 
414 429
 			/**
415 430
 			 * Filter the action links displayed under each user in the Users list table.
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param array $args An associative array of arguments.
47 47
 	 */
48
-	public function __construct( $args = array() ) {
49
-		parent::__construct( array(
48
+	public function __construct($args = array()) {
49
+		parent::__construct(array(
50 50
 			'singular' => 'user',
51 51
 			'plural'   => 'users',
52
-			'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
53
-		) );
52
+			'screen'   => isset($args['screen']) ? $args['screen'] : null,
53
+		));
54 54
 
55 55
 		$this->is_site_users = 'site-users-network' === $this->screen->id;
56 56
 
57
-		if ( $this->is_site_users )
58
-			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
57
+		if ($this->is_site_users)
58
+			$this->site_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
59 59
 	}
60 60
 
61 61
 	/**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 * @return bool
68 68
 	 */
69 69
 	public function ajax_user_can() {
70
-		if ( $this->is_site_users )
71
-			return current_user_can( 'manage_sites' );
70
+		if ($this->is_site_users)
71
+			return current_user_can('manage_sites');
72 72
 		else
73
-			return current_user_can( 'list_users' );
73
+			return current_user_can('list_users');
74 74
 	}
75 75
 
76 76
 	/**
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	public function prepare_items() {
86 86
 		global $role, $usersearch;
87 87
 
88
-		$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
88
+		$usersearch = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : '';
89 89
 
90
-		$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
90
+		$role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
91 91
 
92
-		$per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page';
93
-		$users_per_page = $this->get_items_per_page( $per_page );
92
+		$per_page = ($this->is_site_users) ? 'site_users_network_per_page' : 'users_per_page';
93
+		$users_per_page = $this->get_items_per_page($per_page);
94 94
 
95 95
 		$paged = $this->get_pagenum();
96 96
 
97
-		if ( 'none' === $role ) {
97
+		if ('none' === $role) {
98 98
 			$args = array(
99 99
 				'number' => $users_per_page,
100
-				'offset' => ( $paged-1 ) * $users_per_page,
100
+				'offset' => ($paged - 1) * $users_per_page,
101 101
 				'include' => wp_get_users_with_no_role(),
102 102
 				'search' => $usersearch,
103 103
 				'fields' => 'all_with_meta'
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 		} else {
106 106
 			$args = array(
107 107
 				'number' => $users_per_page,
108
-				'offset' => ( $paged-1 ) * $users_per_page,
108
+				'offset' => ($paged - 1) * $users_per_page,
109 109
 				'role' => $role,
110 110
 				'search' => $usersearch,
111 111
 				'fields' => 'all_with_meta'
112 112
 			);
113 113
 		}
114 114
 
115
-		if ( '' !== $args['search'] )
116
-			$args['search'] = '*' . $args['search'] . '*';
115
+		if ('' !== $args['search'])
116
+			$args['search'] = '*'.$args['search'].'*';
117 117
 
118
-		if ( $this->is_site_users )
118
+		if ($this->is_site_users)
119 119
 			$args['blog_id'] = $this->site_id;
120 120
 
121
-		if ( isset( $_REQUEST['orderby'] ) )
121
+		if (isset($_REQUEST['orderby']))
122 122
 			$args['orderby'] = $_REQUEST['orderby'];
123 123
 
124
-		if ( isset( $_REQUEST['order'] ) )
124
+		if (isset($_REQUEST['order']))
125 125
 			$args['order'] = $_REQUEST['order'];
126 126
 
127 127
 		/**
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 		 * @param array $args Arguments passed to WP_User_Query to retrieve items for the current
133 133
 		 *                    users list table.
134 134
 		 */
135
-		$args = apply_filters( 'users_list_table_query_args', $args );
135
+		$args = apply_filters('users_list_table_query_args', $args);
136 136
 
137 137
 		// Query the user IDs for this page
138
-		$wp_user_search = new WP_User_Query( $args );
138
+		$wp_user_search = new WP_User_Query($args);
139 139
 
140 140
 		$this->items = $wp_user_search->get_results();
141 141
 
142
-		$this->set_pagination_args( array(
142
+		$this->set_pagination_args(array(
143 143
 			'total_items' => $wp_user_search->get_total(),
144 144
 			'per_page' => $users_per_page,
145
-		) );
145
+		));
146 146
 	}
147 147
 
148 148
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @access public
153 153
 	 */
154 154
 	public function no_items() {
155
-		_e( 'No users found.' );
155
+		_e('No users found.');
156 156
 	}
157 157
 
158 158
 	/**
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 
175 175
 		$wp_roles = wp_roles();
176 176
 
177
-		if ( $this->is_site_users ) {
178
-			$url = 'site-users.php?id=' . $this->site_id;
179
-			switch_to_blog( $this->site_id );
177
+		if ($this->is_site_users) {
178
+			$url = 'site-users.php?id='.$this->site_id;
179
+			switch_to_blog($this->site_id);
180 180
 			$users_of_blog = count_users();
181 181
 			restore_current_blog();
182 182
 		} else {
@@ -185,40 +185,40 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		$total_users = $users_of_blog['total_users'];
188
-		$avail_roles =& $users_of_blog['avail_roles'];
188
+		$avail_roles = & $users_of_blog['avail_roles'];
189 189
 		unset($users_of_blog);
190 190
 
191 191
 		$class = empty($role) ? ' class="current"' : '';
192 192
 		$role_links = array();
193
-		$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
194
-		foreach ( $wp_roles->get_names() as $this_role => $name ) {
195
-			if ( !isset($avail_roles[$this_role]) )
193
+		$role_links['all'] = "<a href='$url'$class>".sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)).'</a>';
194
+		foreach ($wp_roles->get_names() as $this_role => $name) {
195
+			if ( ! isset($avail_roles[$this_role]))
196 196
 				continue;
197 197
 
198 198
 			$class = '';
199 199
 
200
-			if ( $this_role === $role ) {
200
+			if ($this_role === $role) {
201 201
 				$class = ' class="current"';
202 202
 			}
203 203
 
204
-			$name = translate_user_role( $name );
204
+			$name = translate_user_role($name);
205 205
 			/* translators: User role name with count */
206
-			$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
207
-			$role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>";
206
+			$name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles[$this_role]));
207
+			$role_links[$this_role] = "<a href='".esc_url(add_query_arg('role', $this_role, $url))."'$class>$name</a>";
208 208
 		}
209 209
 
210
-		if ( ! empty( $avail_roles['none' ] ) ) {
210
+		if ( ! empty($avail_roles['none'])) {
211 211
 
212 212
 			$class = '';
213 213
 
214
-			if ( 'none' === $role ) {
214
+			if ('none' === $role) {
215 215
 				$class = ' class="current"';
216 216
 			}
217 217
 
218
-			$name = __( 'No role' );
218
+			$name = __('No role');
219 219
 			/* translators: User role name with count */
220
-			$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) );
221
-			$role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$class>$name</a>";
220
+			$name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles['none']));
221
+			$role_links['none'] = "<a href='".esc_url(add_query_arg('role', 'none', $url))."'$class>$name</a>";
222 222
 
223 223
 		}
224 224
 
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	protected function get_bulk_actions() {
237 237
 		$actions = array();
238 238
 
239
-		if ( is_multisite() ) {
240
-			if ( current_user_can( 'remove_users' ) )
241
-				$actions['remove'] = __( 'Remove' );
239
+		if (is_multisite()) {
240
+			if (current_user_can('remove_users'))
241
+				$actions['remove'] = __('Remove');
242 242
 		} else {
243
-			if ( current_user_can( 'delete_users' ) )
244
-				$actions['delete'] = __( 'Delete' );
243
+			if (current_user_can('delete_users'))
244
+				$actions['delete'] = __('Delete');
245 245
 		}
246 246
 
247 247
 		return $actions;
@@ -256,18 +256,18 @@  discard block
 block discarded – undo
256 256
 	 * @param string $which Whether this is being invoked above ("top")
257 257
 	 *                      or below the table ("bottom").
258 258
 	 */
259
-	protected function extra_tablenav( $which ) {
259
+	protected function extra_tablenav($which) {
260 260
 		$id = 'bottom' === $which ? 'new_role2' : 'new_role';
261 261
 	?>
262 262
 	<div class="alignleft actions">
263
-		<?php if ( current_user_can( 'promote_users' ) && $this->has_items() ) : ?>
264
-		<label class="screen-reader-text" for="<?php echo $id ?>"><?php _e( 'Change role to&hellip;' ) ?></label>
263
+		<?php if (current_user_can('promote_users') && $this->has_items()) : ?>
264
+		<label class="screen-reader-text" for="<?php echo $id ?>"><?php _e('Change role to&hellip;') ?></label>
265 265
 		<select name="<?php echo $id ?>" id="<?php echo $id ?>">
266
-			<option value=""><?php _e( 'Change role to&hellip;' ) ?></option>
266
+			<option value=""><?php _e('Change role to&hellip;') ?></option>
267 267
 			<?php wp_dropdown_roles(); ?>
268 268
 		</select>
269 269
 	<?php
270
-			submit_button( __( 'Change' ), '', 'changeit', false );
270
+			submit_button(__('Change'), '', 'changeit', false);
271 271
 		endif;
272 272
 
273 273
 		/**
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		 *
280 280
 		 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
281 281
 		 */
282
-		do_action( 'restrict_manage_users', $which );
282
+		do_action('restrict_manage_users', $which);
283 283
 		echo '</div>';
284 284
 	}
285 285
 
@@ -295,8 +295,8 @@  discard block
 block discarded – undo
295 295
 	 * @return string The bulk action required.
296 296
 	 */
297 297
 	public function current_action() {
298
-		if ( isset( $_REQUEST['changeit'] ) &&
299
-			( ! empty( $_REQUEST['new_role'] ) || ! empty( $_REQUEST['new_role2'] ) ) ) {
298
+		if (isset($_REQUEST['changeit']) &&
299
+			( ! empty($_REQUEST['new_role']) || ! empty($_REQUEST['new_role2']))) {
300 300
 			return 'promote';
301 301
 		}
302 302
 
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 	public function get_columns() {
316 316
 		$c = array(
317 317
 			'cb'       => '<input type="checkbox" />',
318
-			'username' => __( 'Username' ),
319
-			'name'     => __( 'Name' ),
320
-			'email'    => __( 'Email' ),
321
-			'role'     => __( 'Role' ),
322
-			'posts'    => __( 'Posts' )
318
+			'username' => __('Username'),
319
+			'name'     => __('Name'),
320
+			'email'    => __('Email'),
321
+			'role'     => __('Role'),
322
+			'posts'    => __('Posts')
323 323
 		);
324 324
 
325
-		if ( $this->is_site_users )
326
-			unset( $c['posts'] );
325
+		if ($this->is_site_users)
326
+			unset($c['posts']);
327 327
 
328 328
 		return $c;
329 329
 	}
@@ -353,14 +353,14 @@  discard block
 block discarded – undo
353 353
 	 */
354 354
 	public function display_rows() {
355 355
 		// Query the post counts for this page
356
-		if ( ! $this->is_site_users )
357
-			$post_counts = count_many_users_posts( array_keys( $this->items ) );
356
+		if ( ! $this->is_site_users)
357
+			$post_counts = count_many_users_posts(array_keys($this->items));
358 358
 
359
-		foreach ( $this->items as $userid => $user_object ) {
360
-			if ( is_multisite() && empty( $user_object->allcaps ) )
359
+		foreach ($this->items as $userid => $user_object) {
360
+			if (is_multisite() && empty($user_object->allcaps))
361 361
 				continue;
362 362
 
363
-			echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
363
+			echo "\n\t".$this->single_row($user_object, '', '', isset($post_counts) ? $post_counts[$userid] : 0);
364 364
 		}
365 365
 	}
366 366
 
@@ -379,39 +379,39 @@  discard block
 block discarded – undo
379 379
 	 *                            to zero, as in, a new user has made zero posts.
380 380
 	 * @return string Output for a single row.
381 381
 	 */
382
-	public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
383
-		if ( ! ( $user_object instanceof WP_User ) ) {
384
-			$user_object = get_userdata( (int) $user_object );
382
+	public function single_row($user_object, $style = '', $role = '', $numposts = 0) {
383
+		if ( ! ($user_object instanceof WP_User)) {
384
+			$user_object = get_userdata((int) $user_object);
385 385
 		}
386 386
 		$user_object->filter = 'display';
387 387
 		$email = $user_object->user_email;
388 388
 
389
-		if ( $this->is_site_users )
389
+		if ($this->is_site_users)
390 390
 			$url = "site-users.php?id={$this->site_id}&amp;";
391 391
 		else
392 392
 			$url = 'users.php?';
393 393
 
394
-		$user_roles = $this->get_role_list( $user_object );
394
+		$user_roles = $this->get_role_list($user_object);
395 395
 
396 396
 		// Set up the hover actions for this user
397 397
 		$actions = array();
398 398
 		$checkbox = '';
399 399
 		// Check if the user for this row is editable
400
-		if ( current_user_can( 'list_users' ) ) {
400
+		if (current_user_can('list_users')) {
401 401
 			// Set up the user editing link
402
-			$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
402
+			$edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_object->ID)));
403 403
 
404
-			if ( current_user_can( 'edit_user',  $user_object->ID ) ) {
404
+			if (current_user_can('edit_user', $user_object->ID)) {
405 405
 				$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
406
-				$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
406
+				$actions['edit'] = '<a href="'.$edit_link.'">'.__('Edit').'</a>';
407 407
 			} else {
408 408
 				$edit = "<strong>$user_object->user_login</strong><br />";
409 409
 			}
410 410
 
411
-			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
412
-				$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
413
-			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
414
-				$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
411
+			if ( ! is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID))
412
+				$actions['delete'] = "<a class='submitdelete' href='".wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users')."'>".__('Delete')."</a>";
413
+			if (is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID))
414
+				$actions['remove'] = "<a class='submitdelete' href='".wp_nonce_url($url."action=remove&amp;user=$user_object->ID", 'bulk-users')."'>".__('Remove')."</a>";
415 415
 
416 416
 			/**
417 417
 			 * Filters the action links displayed under each user in the Users list table.
@@ -423,49 +423,49 @@  discard block
 block discarded – undo
423 423
 			 *                             'Edit', 'Remove' for Multisite.
424 424
 			 * @param WP_User $user_object WP_User object for the currently-listed user.
425 425
 			 */
426
-			$actions = apply_filters( 'user_row_actions', $actions, $user_object );
426
+			$actions = apply_filters('user_row_actions', $actions, $user_object);
427 427
 
428 428
 			// Role classes.
429
-			$role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) );
429
+			$role_classes = esc_attr(implode(' ', array_keys($user_roles)));
430 430
 
431 431
 			// Set up the checkbox ( because the user is editable, otherwise it's empty )
432
-			$checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
432
+			$checkbox = '<label class="screen-reader-text" for="user_'.$user_object->ID.'">'.sprintf(__('Select %s'), $user_object->user_login).'</label>'
433 433
 						. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />";
434 434
 
435 435
 		} else {
436
-			$edit = '<strong>' . $user_object->user_login . '</strong>';
436
+			$edit = '<strong>'.$user_object->user_login.'</strong>';
437 437
 		}
438
-		$avatar = get_avatar( $user_object->ID, 32 );
438
+		$avatar = get_avatar($user_object->ID, 32);
439 439
 
440 440
 		// Comma-separated list of user roles.
441
-		$roles_list = implode( ', ', $user_roles );
441
+		$roles_list = implode(', ', $user_roles);
442 442
 
443 443
 		$r = "<tr id='user-$user_object->ID'>";
444 444
 
445
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
445
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
446 446
 
447
-		foreach ( $columns as $column_name => $column_display_name ) {
447
+		foreach ($columns as $column_name => $column_display_name) {
448 448
 			$classes = "$column_name column-$column_name";
449
-			if ( $primary === $column_name ) {
449
+			if ($primary === $column_name) {
450 450
 				$classes .= ' has-row-actions column-primary';
451 451
 			}
452
-			if ( 'posts' === $column_name ) {
452
+			if ('posts' === $column_name) {
453 453
 				$classes .= ' num'; // Special case for that column
454 454
 			}
455 455
 
456
-			if ( in_array( $column_name, $hidden ) ) {
456
+			if (in_array($column_name, $hidden)) {
457 457
 				$classes .= ' hidden';
458 458
 			}
459 459
 
460
-			$data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
460
+			$data = 'data-colname="'.wp_strip_all_tags($column_display_name).'"';
461 461
 
462 462
 			$attributes = "class='$classes' $data";
463 463
 
464
-			if ( 'cb' === $column_name ) {
464
+			if ('cb' === $column_name) {
465 465
 				$r .= "<th scope='row' class='check-column'>$checkbox</th>";
466 466
 			} else {
467 467
 				$r .= "<td $attributes>";
468
-				switch ( $column_name ) {
468
+				switch ($column_name) {
469 469
 					case 'username':
470 470
 						$r .= "$avatar $edit";
471 471
 						break;
@@ -473,16 +473,16 @@  discard block
 block discarded – undo
473 473
 						$r .= "$user_object->first_name $user_object->last_name";
474 474
 						break;
475 475
 					case 'email':
476
-						$r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>";
476
+						$r .= "<a href='".esc_url("mailto:$email")."'>$email</a>";
477 477
 						break;
478 478
 					case 'role':
479
-						$r .= esc_html( $roles_list );
479
+						$r .= esc_html($roles_list);
480 480
 						break;
481 481
 					case 'posts':
482
-						if ( $numposts > 0 ) {
482
+						if ($numposts > 0) {
483 483
 							$r .= "<a href='edit.php?author=$user_object->ID' class='edit'>";
484
-							$r .= '<span aria-hidden="true">' . $numposts . '</span>';
485
-							$r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>';
484
+							$r .= '<span aria-hidden="true">'.$numposts.'</span>';
485
+							$r .= '<span class="screen-reader-text">'.sprintf(_n('%s post by this author', '%s posts by this author', $numposts), number_format_i18n($numposts)).'</span>';
486 486
 							$r .= '</a>';
487 487
 						} else {
488 488
 							$r .= 0;
@@ -498,11 +498,11 @@  discard block
 block discarded – undo
498 498
 						 * @param string $column_name Column name.
499 499
 						 * @param int    $user_id     ID of the currently-listed user.
500 500
 						 */
501
-						$r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
501
+						$r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
502 502
 				}
503 503
 
504
-				if ( $primary === $column_name ) {
505
-					$r .= $this->row_actions( $actions );
504
+				if ($primary === $column_name) {
505
+					$r .= $this->row_actions($actions);
506 506
 				}
507 507
 				$r .= "</td>";
508 508
 			}
@@ -533,19 +533,19 @@  discard block
 block discarded – undo
533 533
 	 * @param WP_User $user_object The WP_User object.
534 534
 	 * @return array An array of user roles.
535 535
 	 */
536
-	protected function get_role_list( $user_object ) {
536
+	protected function get_role_list($user_object) {
537 537
 		$wp_roles = wp_roles();
538 538
 
539 539
 		$role_list = array();
540 540
 
541
-		foreach ( $user_object->roles as $role ) {
542
-			if ( isset( $wp_roles->role_names[ $role ] ) ) {
543
-				$role_list[ $role ] = translate_user_role( $wp_roles->role_names[ $role ] );
541
+		foreach ($user_object->roles as $role) {
542
+			if (isset($wp_roles->role_names[$role])) {
543
+				$role_list[$role] = translate_user_role($wp_roles->role_names[$role]);
544 544
 			}
545 545
 		}
546 546
 
547
-		if ( empty( $role_list ) ) {
548
-			$role_list['none'] = _x( 'None', 'no user roles' );
547
+		if (empty($role_list)) {
548
+			$role_list['none'] = _x('None', 'no user roles');
549 549
 		}
550 550
 
551 551
 		/**
@@ -556,7 +556,7 @@  discard block
 block discarded – undo
556 556
 		 * @param array   $role_list   An array of user roles.
557 557
 		 * @param WP_User $user_object A WP_User object.
558 558
 		 */
559
-		return apply_filters( 'get_role_list', $role_list, $user_object );
559
+		return apply_filters('get_role_list', $role_list, $user_object);
560 560
 	}
561 561
 
562 562
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/theme-install.php 2 patches
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -31,15 +31,18 @@  discard block
 block discarded – undo
31 31
 function install_themes_feature_list() {
32 32
 	_deprecated_function( __FUNCTION__, '3.1', 'get_theme_feature_list()' );
33 33
 
34
-	if ( !$cache = get_transient( 'wporg_theme_feature_list' ) )
35
-		set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
34
+	if ( !$cache = get_transient( 'wporg_theme_feature_list' ) ) {
35
+			set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
36
+	}
36 37
 
37
-	if ( $cache )
38
-		return $cache;
38
+	if ( $cache ) {
39
+			return $cache;
40
+	}
39 41
 
40 42
 	$feature_list = themes_api( 'feature_list', array() );
41
-	if ( is_wp_error( $feature_list ) )
42
-		return array();
43
+	if ( is_wp_error( $feature_list ) ) {
44
+			return array();
45
+	}
43 46
 
44 47
 	set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS );
45 48
 
@@ -56,8 +59,9 @@  discard block
 block discarded – undo
56 59
 function install_theme_search_form( $type_selector = true ) {
57 60
 	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
58 61
 	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
59
-	if ( ! $type_selector )
60
-		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
62
+	if ( ! $type_selector ) {
63
+			echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
64
+	}
61 65
 	?>
62 66
 <form id="search-themes" method="get">
63 67
 	<input type="hidden" name="tab" value="search" />
@@ -81,8 +85,11 @@  discard block
 block discarded – undo
81 85
 			break;
82 86
 	}
83 87
 	?></label>
84
-	<?php else : ?>
85
-	<label class="screen-reader-text" for="s"><?php _e('Search by keyword'); ?></label>
88
+	<?php else {
89
+	: ?>
90
+	<label class="screen-reader-text" for="s"><?php _e('Search by keyword');
91
+}
92
+?></label>
86 93
 	<?php endif; ?>
87 94
 	<input type="search" name="s" id="s" size="30" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" />
88 95
 	<?php submit_button( __( 'Search' ), 'button', 'search', false ); ?>
@@ -198,8 +205,9 @@  discard block
 block discarded – undo
198 205
 
199 206
 	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
200 207
 
201
-	if ( is_wp_error( $theme ) )
202
-		wp_die( $theme );
208
+	if ( is_wp_error( $theme ) ) {
209
+			wp_die( $theme );
210
+	}
203 211
 
204 212
 	iframe_header( __('Theme Install') );
205 213
 	if ( ! isset( $wp_list_table ) ) {
Please login to merge, or discard this patch.
Spacing   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
 	'img' => array('src' => array(), 'class' => array(), 'alt' => array())
15 15
 );
16 16
 
17
-$theme_field_defaults = array( 'description' => true, 'sections' => false, 'tested' => true, 'requires' => true,
17
+$theme_field_defaults = array('description' => true, 'sections' => false, 'tested' => true, 'requires' => true,
18 18
 	'rating' => true, 'downloaded' => true, 'downloadlink' => true, 'last_updated' => true, 'homepage' => true,
19 19
 	'tags' => true, 'num_ratings' => true
20 20
 );
@@ -29,19 +29,19 @@  discard block
 block discarded – undo
29 29
  * @return array
30 30
  */
31 31
 function install_themes_feature_list() {
32
-	_deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' );
32
+	_deprecated_function(__FUNCTION__, '3.1.0', 'get_theme_feature_list()');
33 33
 
34
-	if ( !$cache = get_transient( 'wporg_theme_feature_list' ) )
35
-		set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS );
34
+	if ( ! $cache = get_transient('wporg_theme_feature_list'))
35
+		set_transient('wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS);
36 36
 
37
-	if ( $cache )
37
+	if ($cache)
38 38
 		return $cache;
39 39
 
40
-	$feature_list = themes_api( 'feature_list', array() );
41
-	if ( is_wp_error( $feature_list ) )
40
+	$feature_list = themes_api('feature_list', array());
41
+	if (is_wp_error($feature_list))
42 42
 		return array();
43 43
 
44
-	set_transient( 'wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS );
44
+	set_transient('wporg_theme_feature_list', $feature_list, 3 * HOUR_IN_SECONDS);
45 45
 
46 46
 	return $feature_list;
47 47
 }
@@ -53,15 +53,15 @@  discard block
 block discarded – undo
53 53
  *
54 54
  * @param bool $type_selector
55 55
  */
56
-function install_theme_search_form( $type_selector = true ) {
57
-	$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
58
-	$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
59
-	if ( ! $type_selector )
60
-		echo '<p class="install-help">' . __( 'Search for themes by keyword.' ) . '</p>';
56
+function install_theme_search_form($type_selector = true) {
57
+	$type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term';
58
+	$term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : '';
59
+	if ( ! $type_selector)
60
+		echo '<p class="install-help">'.__('Search for themes by keyword.').'</p>';
61 61
 	?>
62 62
 <form id="search-themes" method="get">
63 63
 	<input type="hidden" name="tab" value="search" />
64
-	<?php if ( $type_selector ) : ?>
64
+	<?php if ($type_selector) : ?>
65 65
 	<label class="screen-reader-text" for="typeselector"><?php _e('Type of search'); ?></label>
66 66
 	<select	name="type" id="typeselector">
67 67
 	<option value="term" <?php selected('term', $type) ?>><?php _e('Keyword'); ?></option>
@@ -69,15 +69,15 @@  discard block
 block discarded – undo
69 69
 	<option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option>
70 70
 	</select>
71 71
 	<label class="screen-reader-text" for="s"><?php
72
-	switch ( $type ) {
72
+	switch ($type) {
73 73
 		case 'term':
74
-			_e( 'Search by keyword' );
74
+			_e('Search by keyword');
75 75
 			break;
76 76
 		case 'author':
77
-			_e( 'Search by author' );
77
+			_e('Search by author');
78 78
 			break;
79 79
 		case 'tag':
80
-			_e( 'Search by tag' );
80
+			_e('Search by tag');
81 81
 			break;
82 82
 	}
83 83
 	?></label>
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	<label class="screen-reader-text" for="s"><?php _e('Search by keyword'); ?></label>
86 86
 	<?php endif; ?>
87 87
 	<input type="search" name="s" id="s" size="30" value="<?php echo esc_attr($term) ?>" autofocus="autofocus" />
88
-	<?php submit_button( __( 'Search' ), '', 'search', false ); ?>
88
+	<?php submit_button(__('Search'), '', 'search', false); ?>
89 89
 </form>
90 90
 <?php
91 91
 }
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
  * @since 2.8.0
97 97
  */
98 98
 function install_themes_dashboard() {
99
-	install_theme_search_form( false );
99
+	install_theme_search_form(false);
100 100
 ?>
101 101
 <h4><?php _e('Feature Filter') ?></h4>
102
-<p class="install-help"><?php _e( 'Find a theme based on specific features.' ); ?></p>
102
+<p class="install-help"><?php _e('Find a theme based on specific features.'); ?></p>
103 103
 
104 104
 <form method="get">
105 105
 	<input type="hidden" name="tab" value="search" />
@@ -107,13 +107,13 @@  discard block
 block discarded – undo
107 107
 	$feature_list = get_theme_feature_list();
108 108
 	echo '<div class="feature-filter">';
109 109
 
110
-	foreach ( (array) $feature_list as $feature_name => $features ) {
111
-		$feature_name = esc_html( $feature_name );
112
-		echo '<div class="feature-name">' . $feature_name . '</div>';
110
+	foreach ((array) $feature_list as $feature_name => $features) {
111
+		$feature_name = esc_html($feature_name);
112
+		echo '<div class="feature-name">'.$feature_name.'</div>';
113 113
 
114 114
 		echo '<ol class="feature-group">';
115
-		foreach ( $features as $feature => $feature_name ) {
116
-			$feature_name = esc_html( $feature_name );
115
+		foreach ($features as $feature => $feature_name) {
116
+			$feature_name = esc_html($feature_name);
117 117
 			$feature = esc_attr($feature);
118 118
 ?>
119 119
 
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
 
131 131
 </div>
132 132
 <br class="clear" />
133
-<?php submit_button( __( 'Find Themes' ), '', 'search' ); ?>
133
+<?php submit_button(__('Find Themes'), '', 'search'); ?>
134 134
 </form>
135 135
 <?php
136 136
 }
@@ -142,10 +142,10 @@  discard block
 block discarded – undo
142 142
 ?>
143 143
 <p class="install-help"><?php _e('If you have a theme in a .zip format, you may install it by uploading it here.'); ?></p>
144 144
 <form method="post" enctype="multipart/form-data" class="wp-upload-form" action="<?php echo self_admin_url('update.php?action=upload-theme'); ?>">
145
-	<?php wp_nonce_field( 'theme-upload' ); ?>
146
-	<label class="screen-reader-text" for="themezip"><?php _e( 'Theme zip file' ); ?></label>
145
+	<?php wp_nonce_field('theme-upload'); ?>
146
+	<label class="screen-reader-text" for="themezip"><?php _e('Theme zip file'); ?></label>
147 147
 	<input type="file" id="themezip" name="themezip" />
148
-	<?php submit_button( __( 'Install Now' ), '', 'install-theme-submit', false ); ?>
148
+	<?php submit_button(__('Install Now'), '', 'install-theme-submit', false); ?>
149 149
 </form>
150 150
 	<?php
151 151
 }
@@ -159,14 +159,14 @@  discard block
 block discarded – undo
159 159
  *
160 160
  * @param object $theme
161 161
  */
162
-function display_theme( $theme ) {
163
-	_deprecated_function( __FUNCTION__, '3.4.0' );
162
+function display_theme($theme) {
163
+	_deprecated_function(__FUNCTION__, '3.4.0');
164 164
 	global $wp_list_table;
165
-	if ( ! isset( $wp_list_table ) ) {
165
+	if ( ! isset($wp_list_table)) {
166 166
 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
167 167
 	}
168 168
 	$wp_list_table->prepare_items();
169
-	$wp_list_table->single_row( $theme );
169
+	$wp_list_table->single_row($theme);
170 170
 }
171 171
 
172 172
 /**
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 function display_themes() {
180 180
 	global $wp_list_table;
181 181
 
182
-	if ( ! isset( $wp_list_table ) ) {
182
+	if ( ! isset($wp_list_table)) {
183 183
 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
184 184
 	}
185 185
 	$wp_list_table->prepare_items();
@@ -197,16 +197,16 @@  discard block
 block discarded – undo
197 197
 function install_theme_information() {
198 198
 	global $wp_list_table;
199 199
 
200
-	$theme = themes_api( 'theme_information', array( 'slug' => wp_unslash( $_REQUEST['theme'] ) ) );
200
+	$theme = themes_api('theme_information', array('slug' => wp_unslash($_REQUEST['theme'])));
201 201
 
202
-	if ( is_wp_error( $theme ) )
203
-		wp_die( $theme );
202
+	if (is_wp_error($theme))
203
+		wp_die($theme);
204 204
 
205
-	iframe_header( __('Theme Install') );
206
-	if ( ! isset( $wp_list_table ) ) {
205
+	iframe_header(__('Theme Install'));
206
+	if ( ! isset($wp_list_table)) {
207 207
 		$wp_list_table = _get_list_table('WP_Theme_Install_List_Table');
208 208
 	}
209
-	$wp_list_table->theme_installer_single( $theme );
209
+	$wp_list_table->theme_installer_single($theme);
210 210
 	iframe_footer();
211 211
 	exit;
212 212
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-filesystem-direct.php 2 patches
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 	 *                         Default false.
56 56
 	 * @return bool False upon failure, true otherwise.
57 57
 	 */
58
-	public function put_contents( $file, $contents, $mode = false ) {
59
-		$fp = @fopen( $file, 'wb' );
60
-		if ( ! $fp )
58
+	public function put_contents($file, $contents, $mode = false) {
59
+		$fp = @fopen($file, 'wb');
60
+		if ( ! $fp)
61 61
 			return false;
62 62
 
63 63
 		mbstring_binary_safe_encoding();
64 64
 
65
-		$data_length = strlen( $contents );
65
+		$data_length = strlen($contents);
66 66
 
67
-		$bytes_written = fwrite( $fp, $contents );
67
+		$bytes_written = fwrite($fp, $contents);
68 68
 
69 69
 		reset_mbstring_encoding();
70 70
 
71
-		fclose( $fp );
71
+		fclose($fp);
72 72
 
73
-		if ( $data_length !== $bytes_written )
73
+		if ($data_length !== $bytes_written)
74 74
 			return false;
75 75
 
76
-		$this->chmod( $file, $mode );
76
+		$this->chmod($file, $mode);
77 77
 
78 78
 		return true;
79 79
 	}
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 	 * @return bool Returns true on success or false on failure.
107 107
 	 */
108 108
 	public function chgrp($file, $group, $recursive = false) {
109
-		if ( ! $this->exists($file) )
109
+		if ( ! $this->exists($file))
110 110
 			return false;
111
-		if ( ! $recursive )
111
+		if ( ! $recursive)
112 112
 			return @chgrp($file, $group);
113
-		if ( ! $this->is_dir($file) )
113
+		if ( ! $this->is_dir($file))
114 114
 			return @chgrp($file, $group);
115 115
 		// Is a directory, and we want recursive
116 116
 		$file = trailingslashit($file);
117 117
 		$filelist = $this->dirlist($file);
118 118
 		foreach ($filelist as $filename)
119
-			$this->chgrp($file . $filename, $group, $recursive);
119
+			$this->chgrp($file.$filename, $group, $recursive);
120 120
 
121 121
 		return true;
122 122
 	}
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
 	 * @return bool Returns true on success or false on failure.
132 132
 	 */
133 133
 	public function chmod($file, $mode = false, $recursive = false) {
134
-		if ( ! $mode ) {
135
-			if ( $this->is_file($file) )
134
+		if ( ! $mode) {
135
+			if ($this->is_file($file))
136 136
 				$mode = FS_CHMOD_FILE;
137
-			elseif ( $this->is_dir($file) )
137
+			elseif ($this->is_dir($file))
138 138
 				$mode = FS_CHMOD_DIR;
139 139
 			else
140 140
 				return false;
141 141
 		}
142 142
 
143
-		if ( ! $recursive || ! $this->is_dir($file) )
143
+		if ( ! $recursive || ! $this->is_dir($file))
144 144
 			return @chmod($file, $mode);
145 145
 		// Is a directory, and we want recursive
146 146
 		$file = trailingslashit($file);
147 147
 		$filelist = $this->dirlist($file);
148
-		foreach ( (array)$filelist as $filename => $filemeta)
149
-			$this->chmod($file . $filename, $mode, $recursive);
148
+		foreach ((array) $filelist as $filename => $filemeta)
149
+			$this->chmod($file.$filename, $mode, $recursive);
150 150
 
151 151
 		return true;
152 152
 	}
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 	 * @return bool Returns true on success or false on failure.
162 162
 	 */
163 163
 	public function chown($file, $owner, $recursive = false) {
164
-		if ( ! $this->exists($file) )
164
+		if ( ! $this->exists($file))
165 165
 			return false;
166
-		if ( ! $recursive )
166
+		if ( ! $recursive)
167 167
 			return @chown($file, $owner);
168
-		if ( ! $this->is_dir($file) )
168
+		if ( ! $this->is_dir($file))
169 169
 			return @chown($file, $owner);
170 170
 		// Is a directory, and we want recursive
171 171
 		$filelist = $this->dirlist($file);
172 172
 		foreach ($filelist as $filename) {
173
-			$this->chown($file . '/' . $filename, $owner, $recursive);
173
+			$this->chown($file.'/'.$filename, $owner, $recursive);
174 174
 		}
175 175
 		return true;
176 176
 	}
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function owner($file) {
185 185
 		$owneruid = @fileowner($file);
186
-		if ( ! $owneruid )
186
+		if ( ! $owneruid)
187 187
 			return false;
188
-		if ( ! function_exists('posix_getpwuid') )
188
+		if ( ! function_exists('posix_getpwuid'))
189 189
 			return $owneruid;
190 190
 		$ownerarray = posix_getpwuid($owneruid);
191 191
 		return $ownerarray['name'];
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return string Mode of the file (last 3 digits).
201 201
 	 */
202 202
 	public function getchmod($file) {
203
-		return substr( decoct( @fileperms( $file ) ), -3 );
203
+		return substr(decoct(@fileperms($file)), -3);
204 204
 	}
205 205
 
206 206
 	/**
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function group($file) {
211 211
 		$gid = @filegroup($file);
212
-		if ( ! $gid )
212
+		if ( ! $gid)
213 213
 			return false;
214
-		if ( ! function_exists('posix_getgrgid') )
214
+		if ( ! function_exists('posix_getgrgid'))
215 215
 			return $gid;
216 216
 		$grouparray = posix_getgrgid($gid);
217 217
 		return $grouparray['name'];
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 * @return bool
226 226
 	 */
227 227
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
228
-		if ( ! $overwrite && $this->exists($destination) )
228
+		if ( ! $overwrite && $this->exists($destination))
229 229
 			return false;
230 230
 
231 231
 		$rtval = copy($source, $destination);
232
-		if ( $mode )
232
+		if ($mode)
233 233
 			$this->chmod($destination, $mode);
234 234
 		return $rtval;
235 235
 	}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	 * @return bool
242 242
 	 */
243 243
 	public function move($source, $destination, $overwrite = false) {
244
-		if ( ! $overwrite && $this->exists($destination) )
244
+		if ( ! $overwrite && $this->exists($destination))
245 245
 			return false;
246 246
 
247 247
 		// Try using rename first. if that fails (for example, source is read only) try copy.
248
-		if ( @rename($source, $destination) )
248
+		if (@rename($source, $destination))
249 249
 			return true;
250 250
 
251
-		if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
251
+		if ($this->copy($source, $destination, $overwrite) && $this->exists($destination)) {
252 252
 			$this->delete($source);
253 253
 			return true;
254 254
 		} else {
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 	 * @return bool
264 264
 	 */
265 265
 	public function delete($file, $recursive = false, $type = false) {
266
-		if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
266
+		if (empty($file)) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
267 267
 			return false;
268
-		$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
268
+		$file = str_replace('\\', '/', $file); // for win32, occasional problems deleting files otherwise
269 269
 
270
-		if ( 'f' == $type || $this->is_file($file) )
270
+		if ('f' == $type || $this->is_file($file))
271 271
 			return @unlink($file);
272
-		if ( ! $recursive && $this->is_dir($file) )
272
+		if ( ! $recursive && $this->is_dir($file))
273 273
 			return @rmdir($file);
274 274
 
275 275
 		// At this point it's a folder, and we're in recursive mode
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
 		$filelist = $this->dirlist($file, true);
278 278
 
279 279
 		$retval = true;
280
-		if ( is_array( $filelist ) ) {
281
-			foreach ( $filelist as $filename => $fileinfo ) {
282
-				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
280
+		if (is_array($filelist)) {
281
+			foreach ($filelist as $filename => $fileinfo) {
282
+				if ( ! $this->delete($file.$filename, $recursive, $fileinfo['type']))
283 283
 					$retval = false;
284 284
 			}
285 285
 		}
286 286
 
287
-		if ( file_exists($file) && ! @rmdir($file) )
287
+		if (file_exists($file) && ! @rmdir($file))
288 288
 			$retval = false;
289 289
 
290 290
 		return $retval;
@@ -375,18 +375,18 @@  discard block
 block discarded – undo
375 375
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
376 376
 		// Safe mode fails with a trailing slash under certain PHP versions.
377 377
 		$path = untrailingslashit($path);
378
-		if ( empty($path) )
378
+		if (empty($path))
379 379
 			return false;
380 380
 
381
-		if ( ! $chmod )
381
+		if ( ! $chmod)
382 382
 			$chmod = FS_CHMOD_DIR;
383 383
 
384
-		if ( ! @mkdir($path) )
384
+		if ( ! @mkdir($path))
385 385
 			return false;
386 386
 		$this->chmod($path, $chmod);
387
-		if ( $chown )
387
+		if ($chown)
388 388
 			$this->chown($path, $chown);
389
-		if ( $chgrp )
389
+		if ($chgrp)
390 390
 			$this->chgrp($path, $chgrp);
391 391
 		return true;
392 392
 	}
@@ -407,54 +407,54 @@  discard block
 block discarded – undo
407 407
 	 * @return bool|array
408 408
 	 */
409 409
 	public function dirlist($path, $include_hidden = true, $recursive = false) {
410
-		if ( $this->is_file($path) ) {
410
+		if ($this->is_file($path)) {
411 411
 			$limit_file = basename($path);
412 412
 			$path = dirname($path);
413 413
 		} else {
414 414
 			$limit_file = false;
415 415
 		}
416 416
 
417
-		if ( ! $this->is_dir($path) )
417
+		if ( ! $this->is_dir($path))
418 418
 			return false;
419 419
 
420 420
 		$dir = @dir($path);
421
-		if ( ! $dir )
421
+		if ( ! $dir)
422 422
 			return false;
423 423
 
424 424
 		$ret = array();
425 425
 
426
-		while (false !== ($entry = $dir->read()) ) {
426
+		while (false !== ($entry = $dir->read())) {
427 427
 			$struc = array();
428 428
 			$struc['name'] = $entry;
429 429
 
430
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
430
+			if ('.' == $struc['name'] || '..' == $struc['name'])
431 431
 				continue;
432 432
 
433
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
433
+			if ( ! $include_hidden && '.' == $struc['name'][0])
434 434
 				continue;
435 435
 
436
-			if ( $limit_file && $struc['name'] != $limit_file)
436
+			if ($limit_file && $struc['name'] != $limit_file)
437 437
 				continue;
438 438
 
439 439
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
440 440
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
441
-			$struc['number'] 	= false;
441
+			$struc['number'] = false;
442 442
 			$struc['owner']    	= $this->owner($path.'/'.$entry);
443 443
 			$struc['group']    	= $this->group($path.'/'.$entry);
444 444
 			$struc['size']    	= $this->size($path.'/'.$entry);
445
-			$struc['lastmodunix']= $this->mtime($path.'/'.$entry);
446
-			$struc['lastmod']   = date('M j',$struc['lastmodunix']);
447
-			$struc['time']    	= date('h:i:s',$struc['lastmodunix']);
448
-			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449
-
450
-			if ( 'd' == $struc['type'] ) {
451
-				if ( $recursive )
452
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
445
+			$struc['lastmodunix'] = $this->mtime($path.'/'.$entry);
446
+			$struc['lastmod']   = date('M j', $struc['lastmodunix']);
447
+			$struc['time']    	= date('h:i:s', $struc['lastmodunix']);
448
+			$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449
+
450
+			if ('d' == $struc['type']) {
451
+				if ($recursive)
452
+					$struc['files'] = $this->dirlist($path.'/'.$struc['name'], $include_hidden, $recursive);
453 453
 				else
454 454
 					$struc['files'] = array();
455 455
 			}
456 456
 
457
-			$ret[ $struc['name'] ] = $struc;
457
+			$ret[$struc['name']] = $struc;
458 458
 		}
459 459
 		$dir->close();
460 460
 		unset($dir);
Please login to merge, or discard this patch.
Braces   +120 added lines, -81 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function put_contents( $file, $contents, $mode = false ) {
59 59
 		$fp = @fopen( $file, 'wb' );
60
-		if ( ! $fp )
61
-			return false;
60
+		if ( ! $fp ) {
61
+					return false;
62
+		}
62 63
 
63 64
 		mbstring_binary_safe_encoding();
64 65
 
@@ -70,8 +71,9 @@  discard block
 block discarded – undo
70 71
 
71 72
 		fclose( $fp );
72 73
 
73
-		if ( $data_length !== $bytes_written )
74
-			return false;
74
+		if ( $data_length !== $bytes_written ) {
75
+					return false;
76
+		}
75 77
 
76 78
 		$this->chmod( $file, $mode );
77 79
 
@@ -106,17 +108,21 @@  discard block
 block discarded – undo
106 108
 	 * @return bool Returns true on success or false on failure.
107 109
 	 */
108 110
 	public function chgrp($file, $group, $recursive = false) {
109
-		if ( ! $this->exists($file) )
110
-			return false;
111
-		if ( ! $recursive )
112
-			return @chgrp($file, $group);
113
-		if ( ! $this->is_dir($file) )
114
-			return @chgrp($file, $group);
111
+		if ( ! $this->exists($file) ) {
112
+					return false;
113
+		}
114
+		if ( ! $recursive ) {
115
+					return @chgrp($file, $group);
116
+		}
117
+		if ( ! $this->is_dir($file) ) {
118
+					return @chgrp($file, $group);
119
+		}
115 120
 		// Is a directory, and we want recursive
116 121
 		$file = trailingslashit($file);
117 122
 		$filelist = $this->dirlist($file);
118
-		foreach ($filelist as $filename)
119
-			$this->chgrp($file . $filename, $group, $recursive);
123
+		foreach ($filelist as $filename) {
124
+					$this->chgrp($file . $filename, $group, $recursive);
125
+		}
120 126
 
121 127
 		return true;
122 128
 	}
@@ -132,21 +138,24 @@  discard block
 block discarded – undo
132 138
 	 */
133 139
 	public function chmod($file, $mode = false, $recursive = false) {
134 140
 		if ( ! $mode ) {
135
-			if ( $this->is_file($file) )
136
-				$mode = FS_CHMOD_FILE;
137
-			elseif ( $this->is_dir($file) )
138
-				$mode = FS_CHMOD_DIR;
139
-			else
140
-				return false;
141
+			if ( $this->is_file($file) ) {
142
+							$mode = FS_CHMOD_FILE;
143
+			} elseif ( $this->is_dir($file) ) {
144
+							$mode = FS_CHMOD_DIR;
145
+			} else {
146
+							return false;
147
+			}
141 148
 		}
142 149
 
143
-		if ( ! $recursive || ! $this->is_dir($file) )
144
-			return @chmod($file, $mode);
150
+		if ( ! $recursive || ! $this->is_dir($file) ) {
151
+					return @chmod($file, $mode);
152
+		}
145 153
 		// Is a directory, and we want recursive
146 154
 		$file = trailingslashit($file);
147 155
 		$filelist = $this->dirlist($file);
148
-		foreach ( (array)$filelist as $filename => $filemeta)
149
-			$this->chmod($file . $filename, $mode, $recursive);
156
+		foreach ( (array)$filelist as $filename => $filemeta) {
157
+					$this->chmod($file . $filename, $mode, $recursive);
158
+		}
150 159
 
151 160
 		return true;
152 161
 	}
@@ -161,12 +170,15 @@  discard block
 block discarded – undo
161 170
 	 * @return bool Returns true on success or false on failure.
162 171
 	 */
163 172
 	public function chown($file, $owner, $recursive = false) {
164
-		if ( ! $this->exists($file) )
165
-			return false;
166
-		if ( ! $recursive )
167
-			return @chown($file, $owner);
168
-		if ( ! $this->is_dir($file) )
169
-			return @chown($file, $owner);
173
+		if ( ! $this->exists($file) ) {
174
+					return false;
175
+		}
176
+		if ( ! $recursive ) {
177
+					return @chown($file, $owner);
178
+		}
179
+		if ( ! $this->is_dir($file) ) {
180
+					return @chown($file, $owner);
181
+		}
170 182
 		// Is a directory, and we want recursive
171 183
 		$filelist = $this->dirlist($file);
172 184
 		foreach ($filelist as $filename) {
@@ -183,10 +195,12 @@  discard block
 block discarded – undo
183 195
 	 */
184 196
 	public function owner($file) {
185 197
 		$owneruid = @fileowner($file);
186
-		if ( ! $owneruid )
187
-			return false;
188
-		if ( ! function_exists('posix_getpwuid') )
189
-			return $owneruid;
198
+		if ( ! $owneruid ) {
199
+					return false;
200
+		}
201
+		if ( ! function_exists('posix_getpwuid') ) {
202
+					return $owneruid;
203
+		}
190 204
 		$ownerarray = posix_getpwuid($owneruid);
191 205
 		return $ownerarray['name'];
192 206
 	}
@@ -209,10 +223,12 @@  discard block
 block discarded – undo
209 223
 	 */
210 224
 	public function group($file) {
211 225
 		$gid = @filegroup($file);
212
-		if ( ! $gid )
213
-			return false;
214
-		if ( ! function_exists('posix_getgrgid') )
215
-			return $gid;
226
+		if ( ! $gid ) {
227
+					return false;
228
+		}
229
+		if ( ! function_exists('posix_getgrgid') ) {
230
+					return $gid;
231
+		}
216 232
 		$grouparray = posix_getgrgid($gid);
217 233
 		return $grouparray['name'];
218 234
 	}
@@ -225,12 +241,14 @@  discard block
 block discarded – undo
225 241
 	 * @return bool
226 242
 	 */
227 243
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
228
-		if ( ! $overwrite && $this->exists($destination) )
229
-			return false;
244
+		if ( ! $overwrite && $this->exists($destination) ) {
245
+					return false;
246
+		}
230 247
 
231 248
 		$rtval = copy($source, $destination);
232
-		if ( $mode )
233
-			$this->chmod($destination, $mode);
249
+		if ( $mode ) {
250
+					$this->chmod($destination, $mode);
251
+		}
234 252
 		return $rtval;
235 253
 	}
236 254
 
@@ -241,12 +259,14 @@  discard block
 block discarded – undo
241 259
 	 * @return bool
242 260
 	 */
243 261
 	public function move($source, $destination, $overwrite = false) {
244
-		if ( ! $overwrite && $this->exists($destination) )
245
-			return false;
262
+		if ( ! $overwrite && $this->exists($destination) ) {
263
+					return false;
264
+		}
246 265
 
247 266
 		// Try using rename first. if that fails (for example, source is read only) try copy.
248
-		if ( @rename($source, $destination) )
249
-			return true;
267
+		if ( @rename($source, $destination) ) {
268
+					return true;
269
+		}
250 270
 
251 271
 		if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
252 272
 			$this->delete($source);
@@ -263,14 +283,18 @@  discard block
 block discarded – undo
263 283
 	 * @return bool
264 284
 	 */
265 285
 	public function delete($file, $recursive = false, $type = false) {
266
-		if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
286
+		if ( empty( $file ) ) {
287
+			// Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
267 288
 			return false;
289
+		}
268 290
 		$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
269 291
 
270
-		if ( 'f' == $type || $this->is_file($file) )
271
-			return @unlink($file);
272
-		if ( ! $recursive && $this->is_dir($file) )
273
-			return @rmdir($file);
292
+		if ( 'f' == $type || $this->is_file($file) ) {
293
+					return @unlink($file);
294
+		}
295
+		if ( ! $recursive && $this->is_dir($file) ) {
296
+					return @rmdir($file);
297
+		}
274 298
 
275 299
 		// At this point it's a folder, and we're in recursive mode
276 300
 		$file = trailingslashit($file);
@@ -279,13 +303,15 @@  discard block
 block discarded – undo
279 303
 		$retval = true;
280 304
 		if ( is_array( $filelist ) ) {
281 305
 			foreach ( $filelist as $filename => $fileinfo ) {
282
-				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
283
-					$retval = false;
306
+				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) ) {
307
+									$retval = false;
308
+				}
284 309
 			}
285 310
 		}
286 311
 
287
-		if ( file_exists($file) && ! @rmdir($file) )
288
-			$retval = false;
312
+		if ( file_exists($file) && ! @rmdir($file) ) {
313
+					$retval = false;
314
+		}
289 315
 
290 316
 		return $retval;
291 317
 	}
@@ -358,10 +384,12 @@  discard block
 block discarded – undo
358 384
 	 * @return bool
359 385
 	 */
360 386
 	public function touch($file, $time = 0, $atime = 0) {
361
-		if ($time == 0)
362
-			$time = time();
363
-		if ($atime == 0)
364
-			$atime = time();
387
+		if ($time == 0) {
388
+					$time = time();
389
+		}
390
+		if ($atime == 0) {
391
+					$atime = time();
392
+		}
365 393
 		return @touch($file, $time, $atime);
366 394
 	}
367 395
 
@@ -375,19 +403,24 @@  discard block
 block discarded – undo
375 403
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
376 404
 		// Safe mode fails with a trailing slash under certain PHP versions.
377 405
 		$path = untrailingslashit($path);
378
-		if ( empty($path) )
379
-			return false;
406
+		if ( empty($path) ) {
407
+					return false;
408
+		}
380 409
 
381
-		if ( ! $chmod )
382
-			$chmod = FS_CHMOD_DIR;
410
+		if ( ! $chmod ) {
411
+					$chmod = FS_CHMOD_DIR;
412
+		}
383 413
 
384
-		if ( ! @mkdir($path) )
385
-			return false;
414
+		if ( ! @mkdir($path) ) {
415
+					return false;
416
+		}
386 417
 		$this->chmod($path, $chmod);
387
-		if ( $chown )
388
-			$this->chown($path, $chown);
389
-		if ( $chgrp )
390
-			$this->chgrp($path, $chgrp);
418
+		if ( $chown ) {
419
+					$this->chown($path, $chown);
420
+		}
421
+		if ( $chgrp ) {
422
+					$this->chgrp($path, $chgrp);
423
+		}
391 424
 		return true;
392 425
 	}
393 426
 
@@ -414,12 +447,14 @@  discard block
 block discarded – undo
414 447
 			$limit_file = false;
415 448
 		}
416 449
 
417
-		if ( ! $this->is_dir($path) )
418
-			return false;
450
+		if ( ! $this->is_dir($path) ) {
451
+					return false;
452
+		}
419 453
 
420 454
 		$dir = @dir($path);
421
-		if ( ! $dir )
422
-			return false;
455
+		if ( ! $dir ) {
456
+					return false;
457
+		}
423 458
 
424 459
 		$ret = array();
425 460
 
@@ -427,14 +462,17 @@  discard block
 block discarded – undo
427 462
 			$struc = array();
428 463
 			$struc['name'] = $entry;
429 464
 
430
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
431
-				continue;
465
+			if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
466
+							continue;
467
+			}
432 468
 
433
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
434
-				continue;
469
+			if ( ! $include_hidden && '.' == $struc['name'][0] ) {
470
+							continue;
471
+			}
435 472
 
436
-			if ( $limit_file && $struc['name'] != $limit_file)
437
-				continue;
473
+			if ( $limit_file && $struc['name'] != $limit_file) {
474
+							continue;
475
+			}
438 476
 
439 477
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
440 478
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
@@ -448,10 +486,11 @@  discard block
 block discarded – undo
448 486
 			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449 487
 
450 488
 			if ( 'd' == $struc['type'] ) {
451
-				if ( $recursive )
452
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
453
-				else
454
-					$struc['files'] = array();
489
+				if ( $recursive ) {
490
+									$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
491
+				} else {
492
+									$struc['files'] = array();
493
+				}
455 494
 			}
456 495
 
457 496
 			$ret[ $struc['name'] ] = $struc;
Please login to merge, or discard this patch.
src/wp-admin/includes/menu.php 2 patches
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -49,20 +49,22 @@  discard block
 block discarded – undo
49 49
 		$hook_args = substr($menu_page[2], $pos + 1);
50 50
 		wp_parse_str($hook_args, $hook_args);
51 51
 		// Set the hook name to be the post type.
52
-		if ( isset($hook_args['post_type']) )
53
-			$hook_name = $hook_args['post_type'];
54
-		else
55
-			$hook_name = basename($hook_name, '.php');
52
+		if ( isset($hook_args['post_type']) ) {
53
+					$hook_name = $hook_args['post_type'];
54
+		} else {
55
+					$hook_name = basename($hook_name, '.php');
56
+		}
56 57
 		unset($hook_args);
57 58
 	} else {
58 59
 		$hook_name = basename($menu_page[2], '.php');
59 60
 	}
60 61
 	$hook_name = sanitize_title($hook_name);
61 62
 
62
-	if ( isset($compat[$hook_name]) )
63
-		$hook_name = $compat[$hook_name];
64
-	elseif ( !$hook_name )
65
-		continue;
63
+	if ( isset($compat[$hook_name]) ) {
64
+			$hook_name = $compat[$hook_name];
65
+	} elseif ( !$hook_name ) {
66
+			continue;
67
+	}
66 68
 
67 69
 	$admin_page_hooks[$menu_page[2]] = $hook_name;
68 70
 }
@@ -80,9 +82,10 @@  discard block
 block discarded – undo
80 82
 	}
81 83
 	unset($index, $data);
82 84
 
83
-	if ( empty($submenu[$parent]) )
84
-		unset($submenu[$parent]);
85
-}
85
+	if ( empty($submenu[$parent]) ) {
86
+			unset($submenu[$parent]);
87
+	}
88
+	}
86 89
 unset($sub, $parent);
87 90
 
88 91
 /*
@@ -91,8 +94,9 @@  discard block
 block discarded – undo
91 94
  * will have the next submenu in line be assigned as the new menu parent.
92 95
  */
93 96
 foreach ( $menu as $id => $data ) {
94
-	if ( empty($submenu[$data[2]]) )
95
-		continue;
97
+	if ( empty($submenu[$data[2]]) ) {
98
+			continue;
99
+	}
96 100
 	$subs = $submenu[$data[2]];
97 101
 	$first_sub = reset( $subs );
98 102
 	$old_parent = $data[2];
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 		}
112 116
 		unset($submenu[$old_parent], $index);
113 117
 
114
-		if ( isset($_wp_submenu_nopriv[$old_parent]) )
115
-			$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
118
+		if ( isset($_wp_submenu_nopriv[$old_parent]) ) {
119
+					$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
120
+		}
116 121
 	}
117 122
 }
118 123
 unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
@@ -154,8 +159,9 @@  discard block
 block discarded – undo
154 159
  * that the user does not have. Run re-parent loop again.
155 160
  */
156 161
 foreach ( $menu as $id => $data ) {
157
-	if ( ! current_user_can($data[1]) )
158
-		$_wp_menu_nopriv[$data[2]] = true;
162
+	if ( ! current_user_can($data[1]) ) {
163
+			$_wp_menu_nopriv[$data[2]] = true;
164
+	}
159 165
 
160 166
 	/*
161 167
 	 * If there is only one submenu and it is has same destination as the parent,
@@ -164,8 +170,9 @@  discard block
 block discarded – undo
164 170
 	if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
165 171
 		$subs = $submenu[$data[2]];
166 172
 		$first_sub = reset( $subs );
167
-		if ( $data[2] == $first_sub[2] )
168
-			unset( $submenu[$data[2]] );
173
+		if ( $data[2] == $first_sub[2] ) {
174
+					unset( $submenu[$data[2]] );
175
+		}
169 176
 	}
170 177
 
171 178
 	// If submenu is empty...
@@ -307,8 +314,9 @@  discard block
 block discarded – undo
307 314
 		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {
308 315
 			return 1;
309 316
 		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {
310
-			if ( $menu_order[$a] == $menu_order[$b] )
311
-				return 0;
317
+			if ( $menu_order[$a] == $menu_order[$b] ) {
318
+							return 0;
319
+			}
312 320
 			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;
313 321
 		} else {
314 322
 			return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1;
@@ -322,8 +330,9 @@  discard block
 block discarded – undo
322 330
 // Remove the last menu item if it is a separator.
323 331
 $last_menu_key = array_keys( $menu );
324 332
 $last_menu_key = array_pop( $last_menu_key );
325
-if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
333
+if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) {
326 334
 	unset( $menu[ $last_menu_key ] );
335
+}
327 336
 unset( $last_menu_key );
328 337
 
329 338
 if ( !user_can_access_admin_page() ) {
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( is_network_admin() ) {
9
+if (is_network_admin()) {
10 10
 
11 11
 	/**
12 12
 	 * Fires before the administration menu loads in the Network Admin.
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 * @private
17 17
 	 * @since 3.1.0
18 18
 	 */
19
-	do_action( '_network_admin_menu' );
20
-} elseif ( is_user_admin() ) {
19
+	do_action('_network_admin_menu');
20
+} elseif (is_user_admin()) {
21 21
 
22 22
 	/**
23 23
 	 * Fires before the administration menu loads in the User Admin.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @private
28 28
 	 * @since 3.1.0
29 29
 	 */
30
-	do_action( '_user_admin_menu' );
30
+	do_action('_user_admin_menu');
31 31
 } else {
32 32
 
33 33
 	/**
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 	 * @private
39 39
 	 * @since 2.2.0
40 40
 	 */
41
-	do_action( '_admin_menu' );
41
+	do_action('_admin_menu');
42 42
 }
43 43
 
44 44
 // Create list of page plugin hook names.
45 45
 foreach ($menu as $menu_page) {
46
-	if ( false !== $pos = strpos($menu_page[2], '?') ) {
46
+	if (false !== $pos = strpos($menu_page[2], '?')) {
47 47
 		// Handle post_type=post|page|foo pages.
48 48
 		$hook_name = substr($menu_page[2], 0, $pos);
49 49
 		$hook_args = substr($menu_page[2], $pos + 1);
50 50
 		wp_parse_str($hook_args, $hook_args);
51 51
 		// Set the hook name to be the post type.
52
-		if ( isset($hook_args['post_type']) )
52
+		if (isset($hook_args['post_type']))
53 53
 			$hook_name = $hook_args['post_type'];
54 54
 		else
55 55
 			$hook_name = basename($hook_name, '.php');
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 	$hook_name = sanitize_title($hook_name);
61 61
 
62
-	if ( isset($compat[$hook_name]) )
62
+	if (isset($compat[$hook_name]))
63 63
 		$hook_name = $compat[$hook_name];
64
-	elseif ( !$hook_name )
64
+	elseif ( ! $hook_name)
65 65
 		continue;
66 66
 
67 67
 	$admin_page_hooks[$menu_page[2]] = $hook_name;
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 // Loop over submenus and remove pages for which the user does not have privs.
74 74
 foreach ($submenu as $parent => $sub) {
75 75
 	foreach ($sub as $index => $data) {
76
-		if ( ! current_user_can($data[1]) ) {
76
+		if ( ! current_user_can($data[1])) {
77 77
 			unset($submenu[$parent][$index]);
78 78
 			$_wp_submenu_nopriv[$parent][$data[2]] = true;
79 79
 		}
80 80
 	}
81 81
 	unset($index, $data);
82 82
 
83
-	if ( empty($submenu[$parent]) )
83
+	if (empty($submenu[$parent]))
84 84
 		unset($submenu[$parent]);
85 85
 }
86 86
 unset($sub, $parent);
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
  * Menus for which the original parent is not accessible due to lack of privileges
91 91
  * will have the next submenu in line be assigned as the new menu parent.
92 92
  */
93
-foreach ( $menu as $id => $data ) {
94
-	if ( empty($submenu[$data[2]]) )
93
+foreach ($menu as $id => $data) {
94
+	if (empty($submenu[$data[2]]))
95 95
 		continue;
96 96
 	$subs = $submenu[$data[2]];
97
-	$first_sub = reset( $subs );
97
+	$first_sub = reset($subs);
98 98
 	$old_parent = $data[2];
99 99
 	$new_parent = $first_sub[2];
100 100
 	/*
101 101
 	 * If the first submenu is not the same as the assigned parent,
102 102
 	 * make the first submenu the new parent.
103 103
 	 */
104
-	if ( $new_parent != $old_parent ) {
104
+	if ($new_parent != $old_parent) {
105 105
 		$_wp_real_parent_file[$old_parent] = $new_parent;
106 106
 		$menu[$id][2] = $new_parent;
107 107
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 		unset($submenu[$old_parent], $index);
113 113
 
114
-		if ( isset($_wp_submenu_nopriv[$old_parent]) )
114
+		if (isset($_wp_submenu_nopriv[$old_parent]))
115 115
 			$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
116 116
 	}
117 117
 }
118 118
 unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
119 119
 
120
-if ( is_network_admin() ) {
120
+if (is_network_admin()) {
121 121
 
122 122
 	/**
123 123
 	 * Fires before the administration menu loads in the Network Admin.
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param string $context Empty context.
128 128
 	 */
129
-	do_action( 'network_admin_menu', '' );
130
-} elseif ( is_user_admin() ) {
129
+	do_action('network_admin_menu', '');
130
+} elseif (is_user_admin()) {
131 131
 
132 132
 	/**
133 133
 	 * Fires before the administration menu loads in the User Admin.
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param string $context Empty context.
138 138
 	 */
139
-	do_action( 'user_admin_menu', '' );
139
+	do_action('user_admin_menu', '');
140 140
 } else {
141 141
 
142 142
 	/**
@@ -146,32 +146,32 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param string $context Empty context.
148 148
 	 */
149
-	do_action( 'admin_menu', '' );
149
+	do_action('admin_menu', '');
150 150
 }
151 151
 
152 152
 /*
153 153
  * Remove menus that have no accessible submenus and require privileges
154 154
  * that the user does not have. Run re-parent loop again.
155 155
  */
156
-foreach ( $menu as $id => $data ) {
157
-	if ( ! current_user_can($data[1]) )
156
+foreach ($menu as $id => $data) {
157
+	if ( ! current_user_can($data[1]))
158 158
 		$_wp_menu_nopriv[$data[2]] = true;
159 159
 
160 160
 	/*
161 161
 	 * If there is only one submenu and it is has same destination as the parent,
162 162
 	 * remove the submenu.
163 163
 	 */
164
-	if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
164
+	if ( ! empty($submenu[$data[2]]) && 1 == count($submenu[$data[2]])) {
165 165
 		$subs = $submenu[$data[2]];
166
-		$first_sub = reset( $subs );
167
-		if ( $data[2] == $first_sub[2] )
168
-			unset( $submenu[$data[2]] );
166
+		$first_sub = reset($subs);
167
+		if ($data[2] == $first_sub[2])
168
+			unset($submenu[$data[2]]);
169 169
 	}
170 170
 
171 171
 	// If submenu is empty...
172
-	if ( empty($submenu[$data[2]]) ) {
172
+	if (empty($submenu[$data[2]])) {
173 173
 		// And user doesn't have privs, remove menu.
174
-		if ( isset( $_wp_menu_nopriv[$data[2]] ) ) {
174
+		if (isset($_wp_menu_nopriv[$data[2]])) {
175 175
 			unset($menu[$id]);
176 176
 		}
177 177
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string
186 186
  */
187 187
 function add_cssclass($add, $class) {
188
-	$class = empty($class) ? $add : $class .= ' ' . $add;
188
+	$class = empty($class) ? $add : $class .= ' '.$add;
189 189
 	return $class;
190 190
 }
191 191
 
@@ -198,29 +198,29 @@  discard block
 block discarded – undo
198 198
 	$first = $lastorder = false;
199 199
 	$i = 0;
200 200
 	$mc = count($menu);
201
-	foreach ( $menu as $order => $top ) {
201
+	foreach ($menu as $order => $top) {
202 202
 		$i++;
203 203
 
204
-		if ( 0 == $order ) { // dashboard is always shown/single
204
+		if (0 == $order) { // dashboard is always shown/single
205 205
 			$menu[0][4] = add_cssclass('menu-top-first', $top[4]);
206 206
 			$lastorder = 0;
207 207
 			continue;
208 208
 		}
209 209
 
210
-		if ( 0 === strpos($top[2], 'separator') && false !== $lastorder ) { // if separator
210
+		if (0 === strpos($top[2], 'separator') && false !== $lastorder) { // if separator
211 211
 			$first = true;
212 212
 			$c = $menu[$lastorder][4];
213 213
 			$menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
214 214
 			continue;
215 215
 		}
216 216
 
217
-		if ( $first ) {
217
+		if ($first) {
218 218
 			$c = $menu[$order][4];
219 219
 			$menu[$order][4] = add_cssclass('menu-top-first', $c);
220 220
 			$first = false;
221 221
 		}
222 222
 
223
-		if ( $mc == $i ) { // last item
223
+		if ($mc == $i) { // last item
224 224
 			$c = $menu[$order][4];
225 225
 			$menu[$order][4] = add_cssclass('menu-top-last', $c);
226 226
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param array $menu Associative array of administration menu items.
237 237
 	 */
238
-	return apply_filters( 'add_menu_classes', $menu );
238
+	return apply_filters('add_menu_classes', $menu);
239 239
 }
240 240
 
241 241
 uksort($menu, "strnatcasecmp"); // make it all pretty
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @param bool $custom Whether custom ordering is enabled. Default false.
251 251
  */
252
-if ( apply_filters( 'custom_menu_order', false ) ) {
252
+if (apply_filters('custom_menu_order', false)) {
253 253
 	$menu_order = array();
254
-	foreach ( $menu as $menu_item ) {
254
+	foreach ($menu as $menu_item) {
255 255
 		$menu_order[] = $menu_item[2];
256 256
 	}
257 257
 	unset($menu_item);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @param array $menu_order An ordered array of menu items.
271 271
 	 */
272
-	$menu_order = apply_filters( 'menu_order', $menu_order );
272
+	$menu_order = apply_filters('menu_order', $menu_order);
273 273
 	$menu_order = array_flip($menu_order);
274 274
 	$default_menu_order = array_flip($default_menu_order);
275 275
 
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 		global $menu_order, $default_menu_order;
287 287
 		$a = $a[2];
288 288
 		$b = $b[2];
289
-		if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) {
289
+		if (isset($menu_order[$a]) && ! isset($menu_order[$b])) {
290 290
 			return -1;
291
-		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {
291
+		} elseif ( ! isset($menu_order[$a]) && isset($menu_order[$b])) {
292 292
 			return 1;
293
-		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {
294
-			if ( $menu_order[$a] == $menu_order[$b] )
293
+		} elseif (isset($menu_order[$a]) && isset($menu_order[$b])) {
294
+			if ($menu_order[$a] == $menu_order[$b])
295 295
 				return 0;
296 296
 			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;
297 297
 		} else {
@@ -305,41 +305,41 @@  discard block
 block discarded – undo
305 305
 
306 306
 // Prevent adjacent separators
307 307
 $prev_menu_was_separator = false;
308
-foreach ( $menu as $id => $data ) {
309
-	if ( false === stristr( $data[4], 'wp-menu-separator' ) ) {
308
+foreach ($menu as $id => $data) {
309
+	if (false === stristr($data[4], 'wp-menu-separator')) {
310 310
 
311 311
 		// This item is not a separator, so falsey the toggler and do nothing
312 312
 		$prev_menu_was_separator = false;
313 313
 	} else {
314 314
 
315 315
 		// The previous item was a separator, so unset this one
316
-		if ( true === $prev_menu_was_separator ) {
317
-			unset( $menu[ $id ] );
316
+		if (true === $prev_menu_was_separator) {
317
+			unset($menu[$id]);
318 318
 		}
319 319
 
320 320
 		// This item is a separator, so truthy the toggler and move on
321 321
 		$prev_menu_was_separator = true;
322 322
 	}
323 323
 }
324
-unset( $id, $data, $prev_menu_was_separator );
324
+unset($id, $data, $prev_menu_was_separator);
325 325
 
326 326
 // Remove the last menu item if it is a separator.
327
-$last_menu_key = array_keys( $menu );
328
-$last_menu_key = array_pop( $last_menu_key );
329
-if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
330
-	unset( $menu[ $last_menu_key ] );
331
-unset( $last_menu_key );
327
+$last_menu_key = array_keys($menu);
328
+$last_menu_key = array_pop($last_menu_key);
329
+if ( ! empty($menu) && 'wp-menu-separator' == $menu[$last_menu_key][4])
330
+	unset($menu[$last_menu_key]);
331
+unset($last_menu_key);
332 332
 
333
-if ( !user_can_access_admin_page() ) {
333
+if ( ! user_can_access_admin_page()) {
334 334
 
335 335
 	/**
336 336
 	 * Fires when access to an admin page is denied.
337 337
 	 *
338 338
 	 * @since 2.5.0
339 339
 	 */
340
-	do_action( 'admin_page_access_denied' );
340
+	do_action('admin_page_access_denied');
341 341
 
342
-	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
342
+	wp_die(__('Sorry, you are not allowed to access this page.'), 403);
343 343
 }
344 344
 
345 345
 $menu = add_menu_classes($menu);
Please login to merge, or discard this patch.