Completed
Push — master ( a7cd2a...eabd6c )
by Stephen
38:42
created
src/wp-content/themes/twentythirteen/footer.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -12,11 +12,11 @@
 block discarded – undo
12 12
 
13 13
 		</div><!-- #main -->
14 14
 		<footer id="colophon" class="site-footer" role="contentinfo">
15
-			<?php get_sidebar( 'main' ); ?>
15
+			<?php get_sidebar('main'); ?>
16 16
 
17 17
 			<div class="site-info">
18
-				<?php do_action( 'twentythirteen_credits' ); ?>
19
-				<a href="<?php echo esc_url( __( 'https://wordpress.org/', 'twentythirteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentythirteen' ), 'WordPress' ); ?></a>
18
+				<?php do_action('twentythirteen_credits'); ?>
19
+				<a href="<?php echo esc_url(__('https://wordpress.org/', 'twentythirteen')); ?>"><?php printf(__('Proudly powered by %s', 'twentythirteen'), 'WordPress'); ?></a>
20 20
 			</div><!-- .site-info -->
21 21
 		</footer><!-- #colophon -->
22 22
 	</div><!-- #page -->
Please login to merge, or discard this patch.
src/wp-content/themes/twentyfifteen/functions.php 1 patch
Spacing   +84 added lines, -84 removed lines patch added patch discarded remove patch
@@ -30,18 +30,18 @@  discard block
 block discarded – undo
30 30
  *
31 31
  * @since Twenty Fifteen 1.0
32 32
  */
33
-if ( ! isset( $content_width ) ) {
33
+if ( ! isset($content_width)) {
34 34
 	$content_width = 660;
35 35
 }
36 36
 
37 37
 /**
38 38
  * Twenty Fifteen only works in WordPress 4.1 or later.
39 39
  */
40
-if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) {
41
-	require get_template_directory() . '/inc/back-compat.php';
40
+if (version_compare($GLOBALS['wp_version'], '4.1-alpha', '<')) {
41
+	require get_template_directory().'/inc/back-compat.php';
42 42
 }
43 43
 
44
-if ( ! function_exists( 'twentyfifteen_setup' ) ) :
44
+if ( ! function_exists('twentyfifteen_setup')) :
45 45
 /**
46 46
  * Sets up theme defaults and registers support for various WordPress features.
47 47
  *
@@ -59,10 +59,10 @@  discard block
 block discarded – undo
59 59
 	 * If you're building a theme based on twentyfifteen, use a find and replace
60 60
 	 * to change 'twentyfifteen' to the name of your theme in all the template files
61 61
 	 */
62
-	load_theme_textdomain( 'twentyfifteen', get_template_directory() . '/languages' );
62
+	load_theme_textdomain('twentyfifteen', get_template_directory().'/languages');
63 63
 
64 64
 	// Add default posts and comments RSS feed links to head.
65
-	add_theme_support( 'automatic-feed-links' );
65
+	add_theme_support('automatic-feed-links');
66 66
 
67 67
 	/*
68 68
 	 * Let WordPress manage the document title.
@@ -70,64 +70,64 @@  discard block
 block discarded – undo
70 70
 	 * hard-coded <title> tag in the document head, and expect WordPress to
71 71
 	 * provide it for us.
72 72
 	 */
73
-	add_theme_support( 'title-tag' );
73
+	add_theme_support('title-tag');
74 74
 
75 75
 	/*
76 76
 	 * Enable support for Post Thumbnails on posts and pages.
77 77
 	 *
78 78
 	 * See: https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
79 79
 	 */
80
-	add_theme_support( 'post-thumbnails' );
81
-	set_post_thumbnail_size( 825, 510, true );
80
+	add_theme_support('post-thumbnails');
81
+	set_post_thumbnail_size(825, 510, true);
82 82
 
83 83
 	// This theme uses wp_nav_menu() in two locations.
84
-	register_nav_menus( array(
85
-		'primary' => __( 'Primary Menu',      'twentyfifteen' ),
86
-		'social'  => __( 'Social Links Menu', 'twentyfifteen' ),
87
-	) );
84
+	register_nav_menus(array(
85
+		'primary' => __('Primary Menu', 'twentyfifteen'),
86
+		'social'  => __('Social Links Menu', 'twentyfifteen'),
87
+	));
88 88
 
89 89
 	/*
90 90
 	 * Switch default core markup for search form, comment form, and comments
91 91
 	 * to output valid HTML5.
92 92
 	 */
93
-	add_theme_support( 'html5', array(
93
+	add_theme_support('html5', array(
94 94
 		'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
95
-	) );
95
+	));
96 96
 
97 97
 	/*
98 98
 	 * Enable support for Post Formats.
99 99
 	 *
100 100
 	 * See: https://codex.wordpress.org/Post_Formats
101 101
 	 */
102
-	add_theme_support( 'post-formats', array(
102
+	add_theme_support('post-formats', array(
103 103
 		'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
104
-	) );
104
+	));
105 105
 
106 106
 	/*
107 107
 	 * Enable support for custom logo.
108 108
 	 *
109 109
 	 * @since Twenty Fifteen 1.5
110 110
 	 */
111
-	add_image_size( 'twentyfifteen-logo', 248, 248 );
112
-	add_theme_support( 'custom-logo', array( 'size' => 'twentyfifteen-logo' ) );
111
+	add_image_size('twentyfifteen-logo', 248, 248);
112
+	add_theme_support('custom-logo', array('size' => 'twentyfifteen-logo'));
113 113
 
114 114
 	$color_scheme  = twentyfifteen_get_color_scheme();
115
-	$default_color = trim( $color_scheme[0], '#' );
115
+	$default_color = trim($color_scheme[0], '#');
116 116
 
117 117
 	// Setup the WordPress core custom background feature.
118
-	add_theme_support( 'custom-background', apply_filters( 'twentyfifteen_custom_background_args', array(
118
+	add_theme_support('custom-background', apply_filters('twentyfifteen_custom_background_args', array(
119 119
 		'default-color'      => $default_color,
120 120
 		'default-attachment' => 'fixed',
121
-	) ) );
121
+	)));
122 122
 
123 123
 	/*
124 124
 	 * This theme styles the visual editor to resemble the theme style,
125 125
 	 * specifically font, colors, icons, and column width.
126 126
 	 */
127
-	add_editor_style( array( 'css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url() ) );
127
+	add_editor_style(array('css/editor-style.css', 'genericons/genericons.css', twentyfifteen_fonts_url()));
128 128
 }
129 129
 endif; // twentyfifteen_setup
130
-add_action( 'after_setup_theme', 'twentyfifteen_setup' );
130
+add_action('after_setup_theme', 'twentyfifteen_setup');
131 131
 
132 132
 /**
133 133
  * Register widget area.
@@ -137,19 +137,19 @@  discard block
 block discarded – undo
137 137
  * @link https://codex.wordpress.org/Function_Reference/register_sidebar
138 138
  */
139 139
 function twentyfifteen_widgets_init() {
140
-	register_sidebar( array(
141
-		'name'          => __( 'Widget Area', 'twentyfifteen' ),
140
+	register_sidebar(array(
141
+		'name'          => __('Widget Area', 'twentyfifteen'),
142 142
 		'id'            => 'sidebar-1',
143
-		'description'   => __( 'Add widgets here to appear in your sidebar.', 'twentyfifteen' ),
143
+		'description'   => __('Add widgets here to appear in your sidebar.', 'twentyfifteen'),
144 144
 		'before_widget' => '<aside id="%1$s" class="widget %2$s">',
145 145
 		'after_widget'  => '</aside>',
146 146
 		'before_title'  => '<h2 class="widget-title">',
147 147
 		'after_title'   => '</h2>',
148
-	) );
148
+	));
149 149
 }
150
-add_action( 'widgets_init', 'twentyfifteen_widgets_init' );
150
+add_action('widgets_init', 'twentyfifteen_widgets_init');
151 151
 
152
-if ( ! function_exists( 'twentyfifteen_fonts_url' ) ) :
152
+if ( ! function_exists('twentyfifteen_fonts_url')) :
153 153
 /**
154 154
  * Register Google fonts for Twenty Fifteen.
155 155
  *
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * Translators: If there are characters in your language that are not supported
167 167
 	 * by Noto Sans, translate this to 'off'. Do not translate into your own language.
168 168
 	 */
169
-	if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) {
169
+	if ('off' !== _x('on', 'Noto Sans font: on or off', 'twentyfifteen')) {
170 170
 		$fonts[] = 'Noto Sans:400italic,700italic,400,700';
171 171
 	}
172 172
 
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * Translators: If there are characters in your language that are not supported
175 175
 	 * by Noto Serif, translate this to 'off'. Do not translate into your own language.
176 176
 	 */
177
-	if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) {
177
+	if ('off' !== _x('on', 'Noto Serif font: on or off', 'twentyfifteen')) {
178 178
 		$fonts[] = 'Noto Serif:400italic,700italic,400,700';
179 179
 	}
180 180
 
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 	 * Translators: If there are characters in your language that are not supported
183 183
 	 * by Inconsolata, translate this to 'off'. Do not translate into your own language.
184 184
 	 */
185
-	if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) {
185
+	if ('off' !== _x('on', 'Inconsolata font: on or off', 'twentyfifteen')) {
186 186
 		$fonts[] = 'Inconsolata:400,700';
187 187
 	}
188 188
 
@@ -190,23 +190,23 @@  discard block
 block discarded – undo
190 190
 	 * Translators: To add an additional character subset specific to your language,
191 191
 	 * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language.
192 192
 	 */
193
-	$subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' );
193
+	$subset = _x('no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen');
194 194
 
195
-	if ( 'cyrillic' == $subset ) {
195
+	if ('cyrillic' == $subset) {
196 196
 		$subsets .= ',cyrillic,cyrillic-ext';
197
-	} elseif ( 'greek' == $subset ) {
197
+	} elseif ('greek' == $subset) {
198 198
 		$subsets .= ',greek,greek-ext';
199
-	} elseif ( 'devanagari' == $subset ) {
199
+	} elseif ('devanagari' == $subset) {
200 200
 		$subsets .= ',devanagari';
201
-	} elseif ( 'vietnamese' == $subset ) {
201
+	} elseif ('vietnamese' == $subset) {
202 202
 		$subsets .= ',vietnamese';
203 203
 	}
204 204
 
205
-	if ( $fonts ) {
206
-		$fonts_url = add_query_arg( array(
207
-			'family' => urlencode( implode( '|', $fonts ) ),
208
-			'subset' => urlencode( $subsets ),
209
-		), 'https://fonts.googleapis.com/css' );
205
+	if ($fonts) {
206
+		$fonts_url = add_query_arg(array(
207
+			'family' => urlencode(implode('|', $fonts)),
208
+			'subset' => urlencode($subsets),
209
+		), 'https://fonts.googleapis.com/css');
210 210
 	}
211 211
 
212 212
 	return $fonts_url;
@@ -223,7 +223,7 @@  discard block
 block discarded – undo
223 223
 function twentyfifteen_javascript_detection() {
224 224
 	echo "<script>(function(html){html.className = html.className.replace(/\bno-js\b/,'js')})(document.documentElement);</script>\n";
225 225
 }
226
-add_action( 'wp_head', 'twentyfifteen_javascript_detection', 0 );
226
+add_action('wp_head', 'twentyfifteen_javascript_detection', 0);
227 227
 
228 228
 /**
229 229
  * Enqueue scripts and styles.
@@ -232,39 +232,39 @@  discard block
 block discarded – undo
232 232
  */
233 233
 function twentyfifteen_scripts() {
234 234
 	// Add custom fonts, used in the main stylesheet.
235
-	wp_enqueue_style( 'twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null );
235
+	wp_enqueue_style('twentyfifteen-fonts', twentyfifteen_fonts_url(), array(), null);
236 236
 
237 237
 	// Add Genericons, used in the main stylesheet.
238
-	wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.2' );
238
+	wp_enqueue_style('genericons', get_template_directory_uri().'/genericons/genericons.css', array(), '3.2');
239 239
 
240 240
 	// Load our main stylesheet.
241
-	wp_enqueue_style( 'twentyfifteen-style', get_stylesheet_uri() );
241
+	wp_enqueue_style('twentyfifteen-style', get_stylesheet_uri());
242 242
 
243 243
 	// Load the Internet Explorer specific stylesheet.
244
-	wp_enqueue_style( 'twentyfifteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfifteen-style' ), '20141010' );
245
-	wp_style_add_data( 'twentyfifteen-ie', 'conditional', 'lt IE 9' );
244
+	wp_enqueue_style('twentyfifteen-ie', get_template_directory_uri().'/css/ie.css', array('twentyfifteen-style'), '20141010');
245
+	wp_style_add_data('twentyfifteen-ie', 'conditional', 'lt IE 9');
246 246
 
247 247
 	// Load the Internet Explorer 7 specific stylesheet.
248
-	wp_enqueue_style( 'twentyfifteen-ie7', get_template_directory_uri() . '/css/ie7.css', array( 'twentyfifteen-style' ), '20141010' );
249
-	wp_style_add_data( 'twentyfifteen-ie7', 'conditional', 'lt IE 8' );
248
+	wp_enqueue_style('twentyfifteen-ie7', get_template_directory_uri().'/css/ie7.css', array('twentyfifteen-style'), '20141010');
249
+	wp_style_add_data('twentyfifteen-ie7', 'conditional', 'lt IE 8');
250 250
 
251
-	wp_enqueue_script( 'twentyfifteen-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20141010', true );
251
+	wp_enqueue_script('twentyfifteen-skip-link-focus-fix', get_template_directory_uri().'/js/skip-link-focus-fix.js', array(), '20141010', true);
252 252
 
253
-	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
254
-		wp_enqueue_script( 'comment-reply' );
253
+	if (is_singular() && comments_open() && get_option('thread_comments')) {
254
+		wp_enqueue_script('comment-reply');
255 255
 	}
256 256
 
257
-	if ( is_singular() && wp_attachment_is_image() ) {
258
-		wp_enqueue_script( 'twentyfifteen-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20141010' );
257
+	if (is_singular() && wp_attachment_is_image()) {
258
+		wp_enqueue_script('twentyfifteen-keyboard-image-navigation', get_template_directory_uri().'/js/keyboard-image-navigation.js', array('jquery'), '20141010');
259 259
 	}
260 260
 
261
-	wp_enqueue_script( 'twentyfifteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20150330', true );
262
-	wp_localize_script( 'twentyfifteen-script', 'screenReaderText', array(
263
-		'expand'   => '<span class="screen-reader-text">' . __( 'expand child menu', 'twentyfifteen' ) . '</span>',
264
-		'collapse' => '<span class="screen-reader-text">' . __( 'collapse child menu', 'twentyfifteen' ) . '</span>',
265
-	) );
261
+	wp_enqueue_script('twentyfifteen-script', get_template_directory_uri().'/js/functions.js', array('jquery'), '20150330', true);
262
+	wp_localize_script('twentyfifteen-script', 'screenReaderText', array(
263
+		'expand'   => '<span class="screen-reader-text">'.__('expand child menu', 'twentyfifteen').'</span>',
264
+		'collapse' => '<span class="screen-reader-text">'.__('collapse child menu', 'twentyfifteen').'</span>',
265
+	));
266 266
 }
267
-add_action( 'wp_enqueue_scripts', 'twentyfifteen_scripts' );
267
+add_action('wp_enqueue_scripts', 'twentyfifteen_scripts');
268 268
 
269 269
 /**
270 270
  * Add featured image as background image to post navigation elements.
@@ -274,39 +274,39 @@  discard block
 block discarded – undo
274 274
  * @see wp_add_inline_style()
275 275
  */
276 276
 function twentyfifteen_post_nav_background() {
277
-	if ( ! is_single() ) {
277
+	if ( ! is_single()) {
278 278
 		return;
279 279
 	}
280 280
 
281
-	$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
282
-	$next     = get_adjacent_post( false, '', false );
281
+	$previous = (is_attachment()) ? get_post(get_post()->post_parent) : get_adjacent_post(false, '', true);
282
+	$next     = get_adjacent_post(false, '', false);
283 283
 	$css      = '';
284 284
 
285
-	if ( is_attachment() && 'attachment' == $previous->post_type ) {
285
+	if (is_attachment() && 'attachment' == $previous->post_type) {
286 286
 		return;
287 287
 	}
288 288
 
289
-	if ( $previous &&  has_post_thumbnail( $previous->ID ) ) {
290
-		$prevthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $previous->ID ), 'post-thumbnail' );
289
+	if ($previous && has_post_thumbnail($previous->ID)) {
290
+		$prevthumb = wp_get_attachment_image_src(get_post_thumbnail_id($previous->ID), 'post-thumbnail');
291 291
 		$css .= '
292
-			.post-navigation .nav-previous { background-image: url(' . esc_url( $prevthumb[0] ) . '); }
292
+			.post-navigation .nav-previous { background-image: url(' . esc_url($prevthumb[0]).'); }
293 293
 			.post-navigation .nav-previous .post-title, .post-navigation .nav-previous a:hover .post-title, .post-navigation .nav-previous .meta-nav { color: #fff; }
294 294
 			.post-navigation .nav-previous a:before { background-color: rgba(0, 0, 0, 0.4); }
295 295
 		';
296 296
 	}
297 297
 
298
-	if ( $next && has_post_thumbnail( $next->ID ) ) {
299
-		$nextthumb = wp_get_attachment_image_src( get_post_thumbnail_id( $next->ID ), 'post-thumbnail' );
298
+	if ($next && has_post_thumbnail($next->ID)) {
299
+		$nextthumb = wp_get_attachment_image_src(get_post_thumbnail_id($next->ID), 'post-thumbnail');
300 300
 		$css .= '
301
-			.post-navigation .nav-next { background-image: url(' . esc_url( $nextthumb[0] ) . '); border-top: 0; }
301
+			.post-navigation .nav-next { background-image: url(' . esc_url($nextthumb[0]).'); border-top: 0; }
302 302
 			.post-navigation .nav-next .post-title, .post-navigation .nav-next a:hover .post-title, .post-navigation .nav-next .meta-nav { color: #fff; }
303 303
 			.post-navigation .nav-next a:before { background-color: rgba(0, 0, 0, 0.4); }
304 304
 		';
305 305
 	}
306 306
 
307
-	wp_add_inline_style( 'twentyfifteen-style', $css );
307
+	wp_add_inline_style('twentyfifteen-style', $css);
308 308
 }
309
-add_action( 'wp_enqueue_scripts', 'twentyfifteen_post_nav_background' );
309
+add_action('wp_enqueue_scripts', 'twentyfifteen_post_nav_background');
310 310
 
311 311
 /**
312 312
  * Display descriptions in main navigation.
@@ -319,14 +319,14 @@  discard block
 block discarded – undo
319 319
  * @param array   $args        wp_nav_menu() arguments.
320 320
  * @return string Menu item with possible description.
321 321
  */
322
-function twentyfifteen_nav_description( $item_output, $item, $depth, $args ) {
323
-	if ( 'primary' == $args->theme_location && $item->description ) {
324
-		$item_output = str_replace( $args->link_after . '</a>', '<div class="menu-item-description">' . $item->description . '</div>' . $args->link_after . '</a>', $item_output );
322
+function twentyfifteen_nav_description($item_output, $item, $depth, $args) {
323
+	if ('primary' == $args->theme_location && $item->description) {
324
+		$item_output = str_replace($args->link_after.'</a>', '<div class="menu-item-description">'.$item->description.'</div>'.$args->link_after.'</a>', $item_output);
325 325
 	}
326 326
 
327 327
 	return $item_output;
328 328
 }
329
-add_filter( 'walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4 );
329
+add_filter('walker_nav_menu_start_el', 'twentyfifteen_nav_description', 10, 4);
330 330
 
331 331
 /**
332 332
  * Add a `screen-reader-text` class to the search form's submit button.
@@ -336,28 +336,28 @@  discard block
 block discarded – undo
336 336
  * @param string $html Search form HTML.
337 337
  * @return string Modified search form HTML.
338 338
  */
339
-function twentyfifteen_search_form_modify( $html ) {
340
-	return str_replace( 'class="search-submit"', 'class="search-submit screen-reader-text"', $html );
339
+function twentyfifteen_search_form_modify($html) {
340
+	return str_replace('class="search-submit"', 'class="search-submit screen-reader-text"', $html);
341 341
 }
342
-add_filter( 'get_search_form', 'twentyfifteen_search_form_modify' );
342
+add_filter('get_search_form', 'twentyfifteen_search_form_modify');
343 343
 
344 344
 /**
345 345
  * Implement the Custom Header feature.
346 346
  *
347 347
  * @since Twenty Fifteen 1.0
348 348
  */
349
-require get_template_directory() . '/inc/custom-header.php';
349
+require get_template_directory().'/inc/custom-header.php';
350 350
 
351 351
 /**
352 352
  * Custom template tags for this theme.
353 353
  *
354 354
  * @since Twenty Fifteen 1.0
355 355
  */
356
-require get_template_directory() . '/inc/template-tags.php';
356
+require get_template_directory().'/inc/template-tags.php';
357 357
 
358 358
 /**
359 359
  * Customizer additions.
360 360
  *
361 361
  * @since Twenty Fifteen 1.0
362 362
  */
363
-require get_template_directory() . '/inc/customizer.php';
363
+require get_template_directory().'/inc/customizer.php';
Please login to merge, or discard this patch.
src/wp-content/themes/twentyfifteen/inc/template-tags.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * @since Twenty Fifteen 1.0
10 10
  */
11 11
 
12
-if ( ! function_exists( 'twentyfifteen_comment_nav' ) ) :
12
+if ( ! function_exists('twentyfifteen_comment_nav')) :
13 13
 /**
14 14
  * Display navigation to next/previous comments when applicable.
15 15
  *
@@ -17,18 +17,18 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function twentyfifteen_comment_nav() {
19 19
 	// Are there comments to navigate through?
20
-	if ( get_comment_pages_count() > 1 && get_option( 'page_comments' ) ) :
20
+	if (get_comment_pages_count() > 1 && get_option('page_comments')) :
21 21
 	?>
22 22
 	<nav class="navigation comment-navigation" role="navigation">
23
-		<h2 class="screen-reader-text"><?php _e( 'Comment navigation', 'twentyfifteen' ); ?></h2>
23
+		<h2 class="screen-reader-text"><?php _e('Comment navigation', 'twentyfifteen'); ?></h2>
24 24
 		<div class="nav-links">
25 25
 			<?php
26
-				if ( $prev_link = get_previous_comments_link( __( 'Older Comments', 'twentyfifteen' ) ) ) :
27
-					printf( '<div class="nav-previous">%s</div>', $prev_link );
26
+				if ($prev_link = get_previous_comments_link(__('Older Comments', 'twentyfifteen'))) :
27
+					printf('<div class="nav-previous">%s</div>', $prev_link);
28 28
 				endif;
29 29
 
30
-				if ( $next_link = get_next_comments_link( __( 'Newer Comments', 'twentyfifteen' ) ) ) :
31
-					printf( '<div class="nav-next">%s</div>', $next_link );
30
+				if ($next_link = get_next_comments_link(__('Newer Comments', 'twentyfifteen'))) :
31
+					printf('<div class="nav-next">%s</div>', $next_link);
32 32
 				endif;
33 33
 			?>
34 34
 		</div><!-- .nav-links -->
@@ -38,89 +38,89 @@  discard block
 block discarded – undo
38 38
 }
39 39
 endif;
40 40
 
41
-if ( ! function_exists( 'twentyfifteen_entry_meta' ) ) :
41
+if ( ! function_exists('twentyfifteen_entry_meta')) :
42 42
 /**
43 43
  * Prints HTML with meta information for the categories, tags.
44 44
  *
45 45
  * @since Twenty Fifteen 1.0
46 46
  */
47 47
 function twentyfifteen_entry_meta() {
48
-	if ( is_sticky() && is_home() && ! is_paged() ) {
49
-		printf( '<span class="sticky-post">%s</span>', __( 'Featured', 'twentyfifteen' ) );
48
+	if (is_sticky() && is_home() && ! is_paged()) {
49
+		printf('<span class="sticky-post">%s</span>', __('Featured', 'twentyfifteen'));
50 50
 	}
51 51
 
52 52
 	$format = get_post_format();
53
-	if ( current_theme_supports( 'post-formats', $format ) ) {
54
-		printf( '<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',
55
-			sprintf( '<span class="screen-reader-text">%s </span>', _x( 'Format', 'Used before post format.', 'twentyfifteen' ) ),
56
-			esc_url( get_post_format_link( $format ) ),
57
-			get_post_format_string( $format )
53
+	if (current_theme_supports('post-formats', $format)) {
54
+		printf('<span class="entry-format">%1$s<a href="%2$s">%3$s</a></span>',
55
+			sprintf('<span class="screen-reader-text">%s </span>', _x('Format', 'Used before post format.', 'twentyfifteen')),
56
+			esc_url(get_post_format_link($format)),
57
+			get_post_format_string($format)
58 58
 		);
59 59
 	}
60 60
 
61
-	if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
61
+	if (in_array(get_post_type(), array('post', 'attachment'))) {
62 62
 		$time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>';
63 63
 
64
-		if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
64
+		if (get_the_time('U') !== get_the_modified_time('U')) {
65 65
 			$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>';
66 66
 		}
67 67
 
68
-		$time_string = sprintf( $time_string,
69
-			esc_attr( get_the_date( 'c' ) ),
68
+		$time_string = sprintf($time_string,
69
+			esc_attr(get_the_date('c')),
70 70
 			get_the_date(),
71
-			esc_attr( get_the_modified_date( 'c' ) ),
71
+			esc_attr(get_the_modified_date('c')),
72 72
 			get_the_modified_date()
73 73
 		);
74 74
 
75
-		printf( '<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
76
-			_x( 'Posted on', 'Used before publish date.', 'twentyfifteen' ),
77
-			esc_url( get_permalink() ),
75
+		printf('<span class="posted-on"><span class="screen-reader-text">%1$s </span><a href="%2$s" rel="bookmark">%3$s</a></span>',
76
+			_x('Posted on', 'Used before publish date.', 'twentyfifteen'),
77
+			esc_url(get_permalink()),
78 78
 			$time_string
79 79
 		);
80 80
 	}
81 81
 
82
-	if ( 'post' == get_post_type() ) {
83
-		if ( is_singular() || is_multi_author() ) {
84
-			printf( '<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
85
-				_x( 'Author', 'Used before post author name.', 'twentyfifteen' ),
86
-				esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
82
+	if ('post' == get_post_type()) {
83
+		if (is_singular() || is_multi_author()) {
84
+			printf('<span class="byline"><span class="author vcard"><span class="screen-reader-text">%1$s </span><a class="url fn n" href="%2$s">%3$s</a></span></span>',
85
+				_x('Author', 'Used before post author name.', 'twentyfifteen'),
86
+				esc_url(get_author_posts_url(get_the_author_meta('ID'))),
87 87
 				get_the_author()
88 88
 			);
89 89
 		}
90 90
 
91
-		$categories_list = get_the_category_list( _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
92
-		if ( $categories_list && twentyfifteen_categorized_blog() ) {
93
-			printf( '<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
94
-				_x( 'Categories', 'Used before category names.', 'twentyfifteen' ),
91
+		$categories_list = get_the_category_list(_x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen'));
92
+		if ($categories_list && twentyfifteen_categorized_blog()) {
93
+			printf('<span class="cat-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
94
+				_x('Categories', 'Used before category names.', 'twentyfifteen'),
95 95
 				$categories_list
96 96
 			);
97 97
 		}
98 98
 
99
-		$tags_list = get_the_tag_list( '', _x( ', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen' ) );
100
-		if ( $tags_list ) {
101
-			printf( '<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
102
-				_x( 'Tags', 'Used before tag names.', 'twentyfifteen' ),
99
+		$tags_list = get_the_tag_list('', _x(', ', 'Used between list items, there is a space after the comma.', 'twentyfifteen'));
100
+		if ($tags_list) {
101
+			printf('<span class="tags-links"><span class="screen-reader-text">%1$s </span>%2$s</span>',
102
+				_x('Tags', 'Used before tag names.', 'twentyfifteen'),
103 103
 				$tags_list
104 104
 			);
105 105
 		}
106 106
 	}
107 107
 
108
-	if ( is_attachment() && wp_attachment_is_image() ) {
108
+	if (is_attachment() && wp_attachment_is_image()) {
109 109
 		// Retrieve attachment metadata.
110 110
 		$metadata = wp_get_attachment_metadata();
111 111
 
112
-		printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
113
-			_x( 'Full size', 'Used before full size attachment link.', 'twentyfifteen' ),
114
-			esc_url( wp_get_attachment_url() ),
112
+		printf('<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
113
+			_x('Full size', 'Used before full size attachment link.', 'twentyfifteen'),
114
+			esc_url(wp_get_attachment_url()),
115 115
 			$metadata['width'],
116 116
 			$metadata['height']
117 117
 		);
118 118
 	}
119 119
 
120
-	if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
120
+	if ( ! is_single() && ! post_password_required() && (comments_open() || get_comments_number())) {
121 121
 		echo '<span class="comments-link">';
122 122
 		/* translators: %s: post title */
123
-		comments_popup_link( sprintf( __( 'Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen' ), get_the_title() ) );
123
+		comments_popup_link(sprintf(__('Leave a comment<span class="screen-reader-text"> on %s</span>', 'twentyfifteen'), get_the_title()));
124 124
 		echo '</span>';
125 125
 	}
126 126
 }
@@ -134,23 +134,23 @@  discard block
 block discarded – undo
134 134
  * @return bool True of there is more than one category, false otherwise.
135 135
  */
136 136
 function twentyfifteen_categorized_blog() {
137
-	if ( false === ( $all_the_cool_cats = get_transient( 'twentyfifteen_categories' ) ) ) {
137
+	if (false === ($all_the_cool_cats = get_transient('twentyfifteen_categories'))) {
138 138
 		// Create an array of all the categories that are attached to posts.
139
-		$all_the_cool_cats = get_categories( array(
139
+		$all_the_cool_cats = get_categories(array(
140 140
 			'fields'     => 'ids',
141 141
 			'hide_empty' => 1,
142 142
 
143 143
 			// We only need to know if there is more than one category.
144 144
 			'number'     => 2,
145
-		) );
145
+		));
146 146
 
147 147
 		// Count the number of categories that are attached to the posts.
148
-		$all_the_cool_cats = count( $all_the_cool_cats );
148
+		$all_the_cool_cats = count($all_the_cool_cats);
149 149
 
150
-		set_transient( 'twentyfifteen_categories', $all_the_cool_cats );
150
+		set_transient('twentyfifteen_categories', $all_the_cool_cats);
151 151
 	}
152 152
 
153
-	if ( $all_the_cool_cats > 1 ) {
153
+	if ($all_the_cool_cats > 1) {
154 154
 		// This blog has more than 1 category so twentyfifteen_categorized_blog should return true.
155 155
 		return true;
156 156
 	} else {
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
  */
167 167
 function twentyfifteen_category_transient_flusher() {
168 168
 	// Like, beat it. Dig?
169
-	delete_transient( 'twentyfifteen_categories' );
169
+	delete_transient('twentyfifteen_categories');
170 170
 }
171
-add_action( 'edit_category', 'twentyfifteen_category_transient_flusher' );
172
-add_action( 'save_post',     'twentyfifteen_category_transient_flusher' );
171
+add_action('edit_category', 'twentyfifteen_category_transient_flusher');
172
+add_action('save_post', 'twentyfifteen_category_transient_flusher');
173 173
 
174
-if ( ! function_exists( 'twentyfifteen_post_thumbnail' ) ) :
174
+if ( ! function_exists('twentyfifteen_post_thumbnail')) :
175 175
 /**
176 176
  * Display an optional post thumbnail.
177 177
  *
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
  * @since Twenty Fifteen 1.0
182 182
  */
183 183
 function twentyfifteen_post_thumbnail() {
184
-	if ( post_password_required() || is_attachment() || ! has_post_thumbnail() ) {
184
+	if (post_password_required() || is_attachment() || ! has_post_thumbnail()) {
185 185
 		return;
186 186
 	}
187 187
 
188
-	if ( is_singular() ) :
188
+	if (is_singular()) :
189 189
 	?>
190 190
 
191 191
 	<div class="post-thumbnail">
@@ -196,7 +196,7 @@  discard block
 block discarded – undo
196 196
 
197 197
 	<a class="post-thumbnail" href="<?php the_permalink(); ?>" aria-hidden="true">
198 198
 		<?php
199
-			the_post_thumbnail( 'post-thumbnail', array( 'alt' => get_the_title() ) );
199
+			the_post_thumbnail('post-thumbnail', array('alt' => get_the_title()));
200 200
 		?>
201 201
 	</a>
202 202
 
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 }
205 205
 endif;
206 206
 
207
-if ( ! function_exists( 'twentyfifteen_get_link_url' ) ) :
207
+if ( ! function_exists('twentyfifteen_get_link_url')) :
208 208
 /**
209 209
  * Return the post URL.
210 210
  *
@@ -217,13 +217,13 @@  discard block
 block discarded – undo
217 217
  * @return string The Link format URL.
218 218
  */
219 219
 function twentyfifteen_get_link_url() {
220
-	$has_url = get_url_in_content( get_the_content() );
220
+	$has_url = get_url_in_content(get_the_content());
221 221
 
222
-	return $has_url ? $has_url : apply_filters( 'the_permalink', get_permalink() );
222
+	return $has_url ? $has_url : apply_filters('the_permalink', get_permalink());
223 223
 }
224 224
 endif;
225 225
 
226
-if ( ! function_exists( 'twentyfifteen_excerpt_more' ) && ! is_admin() ) :
226
+if ( ! function_exists('twentyfifteen_excerpt_more') && ! is_admin()) :
227 227
 /**
228 228
  * Replaces "[...]" (appended to automatically generated excerpts) with ... and a 'Continue reading' link.
229 229
  *
@@ -231,18 +231,18 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @return string 'Continue reading' link prepended with an ellipsis.
233 233
  */
234
-function twentyfifteen_excerpt_more( $more ) {
235
-	$link = sprintf( '<a href="%1$s" class="more-link">%2$s</a>',
236
-		esc_url( get_permalink( get_the_ID() ) ),
234
+function twentyfifteen_excerpt_more($more) {
235
+	$link = sprintf('<a href="%1$s" class="more-link">%2$s</a>',
236
+		esc_url(get_permalink(get_the_ID())),
237 237
 		/* translators: %s: Name of current post */
238
-		sprintf( __( 'Continue reading %s', 'twentyfifteen' ), '<span class="screen-reader-text">' . get_the_title( get_the_ID() ) . '</span>' )
238
+		sprintf(__('Continue reading %s', 'twentyfifteen'), '<span class="screen-reader-text">'.get_the_title(get_the_ID()).'</span>')
239 239
 		);
240
-	return ' &hellip; ' . $link;
240
+	return ' &hellip; '.$link;
241 241
 }
242
-add_filter( 'excerpt_more', 'twentyfifteen_excerpt_more' );
242
+add_filter('excerpt_more', 'twentyfifteen_excerpt_more');
243 243
 endif;
244 244
 
245
-if ( ! function_exists( 'twentyfifteen_the_custom_logo' ) ) :
245
+if ( ! function_exists('twentyfifteen_the_custom_logo')) :
246 246
 /**
247 247
  * Displays the optional custom logo.
248 248
  *
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
  * @since Twenty Fifteen 1.5
252 252
  */
253 253
 function twentyfifteen_the_custom_logo() {
254
-	if ( function_exists( 'the_custom_logo' ) ) {
254
+	if (function_exists('the_custom_logo')) {
255 255
 		the_custom_logo();
256 256
 	}
257 257
 }
Please login to merge, or discard this patch.
src/wp-admin/upload.php 1 patch
Spacing   +143 added lines, -143 removed lines patch added patch discarded remove patch
@@ -7,90 +7,90 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( !current_user_can('upload_files') )
13
-	wp_die( __( 'You do not have permission to upload files.' ) );
12
+if ( ! current_user_can('upload_files'))
13
+	wp_die(__('You do not have permission to upload files.'));
14 14
 
15
-$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
16
-$modes = array( 'grid', 'list' );
15
+$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
16
+$modes = array('grid', 'list');
17 17
 
18
-if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
18
+if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
19 19
 	$mode = $_GET['mode'];
20
-	update_user_option( get_current_user_id(), 'media_library_mode', $mode );
20
+	update_user_option(get_current_user_id(), 'media_library_mode', $mode);
21 21
 }
22 22
 
23
-if ( 'grid' === $mode ) {
23
+if ('grid' === $mode) {
24 24
 	wp_enqueue_media();
25
-	wp_enqueue_script( 'media-grid' );
26
-	wp_enqueue_script( 'media' );
25
+	wp_enqueue_script('media-grid');
26
+	wp_enqueue_script('media');
27 27
 
28
-	remove_action( 'admin_head', 'wp_admin_canonical_url' );
28
+	remove_action('admin_head', 'wp_admin_canonical_url');
29 29
 
30 30
 	$q = $_GET;
31 31
 	// let JS handle this
32
-	unset( $q['s'] );
33
-	$vars = wp_edit_attachments_query_vars( $q );
34
-	$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
35
-	foreach ( $vars as $key => $value ) {
36
-		if ( ! $value || in_array( $key, $ignore ) ) {
37
-			unset( $vars[ $key ] );
32
+	unset($q['s']);
33
+	$vars = wp_edit_attachments_query_vars($q);
34
+	$ignore = array('mode', 'post_type', 'post_status', 'posts_per_page');
35
+	foreach ($vars as $key => $value) {
36
+		if ( ! $value || in_array($key, $ignore)) {
37
+			unset($vars[$key]);
38 38
 		}
39 39
 	}
40 40
 
41
-	wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
42
-		'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
41
+	wp_localize_script('media-grid', '_wpMediaGridSettings', array(
42
+		'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH),
43 43
 		'queryVars' => (object) $vars
44
-	) );
44
+	));
45 45
 
46
-	get_current_screen()->add_help_tab( array(
46
+	get_current_screen()->add_help_tab(array(
47 47
 		'id'		=> 'overview',
48
-		'title'		=> __( 'Overview' ),
48
+		'title'		=> __('Overview'),
49 49
 		'content'	=>
50
-			'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
51
-			'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' .
52
-			'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>'
53
-	) );
50
+			'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.').'</p>'.
51
+			'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'.
52
+			'<p>'.__('To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.').'</p>'
53
+	));
54 54
 
55
-	get_current_screen()->add_help_tab( array(
55
+	get_current_screen()->add_help_tab(array(
56 56
 		'id'		=> 'attachment-details',
57
-		'title'		=> __( 'Attachment Details' ),
57
+		'title'		=> __('Attachment Details'),
58 58
 		'content'	=>
59
-			'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' .
60
-			'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' .
61
-			'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
62
-	) );
59
+			'<p>'.__('Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.').'</p>'.
60
+			'<p>'.__('Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.').'</p>'.
61
+			'<p>'.__('You can also delete individual items and access the extended edit screen from the details dialog.').'</p>'
62
+	));
63 63
 
64 64
 	get_current_screen()->set_help_sidebar(
65
-		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
66
-		'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
67
-		'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
65
+		'<p><strong>'.__('For more information:').'</strong></p>'.
66
+		'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
67
+		'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
68 68
 	);
69 69
 
70 70
 	$title = __('Media Library');
71 71
 	$parent_file = 'upload.php';
72 72
 
73
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
73
+	require_once(ABSPATH.'wp-admin/admin-header.php');
74 74
 	?>
75 75
 	<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
76 76
 		<h1>
77 77
 		<?php
78
-		echo esc_html( $title );
79
-		if ( current_user_can( 'upload_files' ) ) { ?>
80
-			<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
78
+		echo esc_html($title);
79
+		if (current_user_can('upload_files')) { ?>
80
+			<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
81 81
 		}
82 82
 		?>
83 83
 		</h1>
84 84
 		<div class="error hide-if-js">
85 85
 			<p><?php printf(
86 86
 				/* translators: %s: list view URL */
87
-				__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
87
+				__('The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.'),
88 88
 				'upload.php?mode=list'
89 89
 			); ?></p>
90 90
 		</div>
91 91
 	</div>
92 92
 	<?php
93
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
93
+	include(ABSPATH.'wp-admin/admin-footer.php');
94 94
 	exit;
95 95
 }
96 96
 
@@ -100,75 +100,75 @@  discard block
 block discarded – undo
100 100
 // Handle bulk actions
101 101
 $doaction = $wp_list_table->current_action();
102 102
 
103
-if ( $doaction ) {
103
+if ($doaction) {
104 104
 	check_admin_referer('bulk-media');
105 105
 
106
-	if ( 'delete_all' == $doaction ) {
107
-		$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
106
+	if ('delete_all' == $doaction) {
107
+		$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'");
108 108
 		$doaction = 'delete';
109
-	} elseif ( isset( $_REQUEST['media'] ) ) {
109
+	} elseif (isset($_REQUEST['media'])) {
110 110
 		$post_ids = $_REQUEST['media'];
111
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
112
-		$post_ids = explode( ',', $_REQUEST['ids'] );
111
+	} elseif (isset($_REQUEST['ids'])) {
112
+		$post_ids = explode(',', $_REQUEST['ids']);
113 113
 	}
114 114
 
115 115
 	$location = 'upload.php';
116
-	if ( $referer = wp_get_referer() ) {
117
-		if ( false !== strpos( $referer, 'upload.php' ) )
118
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
116
+	if ($referer = wp_get_referer()) {
117
+		if (false !== strpos($referer, 'upload.php'))
118
+			$location = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer);
119 119
 	}
120 120
 
121
-	switch ( $doaction ) {
121
+	switch ($doaction) {
122 122
 		case 'detach':
123
-			wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' );
123
+			wp_media_attach_action($_REQUEST['parent_post_id'], 'detach');
124 124
 			break;
125 125
 
126 126
 		case 'attach':
127
-			wp_media_attach_action( $_REQUEST['found_post_id'] );
127
+			wp_media_attach_action($_REQUEST['found_post_id']);
128 128
 			break;
129 129
 
130 130
 		case 'trash':
131
-			if ( !isset( $post_ids ) )
131
+			if ( ! isset($post_ids))
132 132
 				break;
133
-			foreach ( (array) $post_ids as $post_id ) {
134
-				if ( !current_user_can( 'delete_post', $post_id ) )
135
-					wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
133
+			foreach ((array) $post_ids as $post_id) {
134
+				if ( ! current_user_can('delete_post', $post_id))
135
+					wp_die(__('You are not allowed to move this item to the Trash.'));
136 136
 
137
-				if ( !wp_trash_post( $post_id ) )
138
-					wp_die( __( 'Error in moving to Trash.' ) );
137
+				if ( ! wp_trash_post($post_id))
138
+					wp_die(__('Error in moving to Trash.'));
139 139
 			}
140
-			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
140
+			$location = add_query_arg(array('trashed' => count($post_ids), 'ids' => join(',', $post_ids)), $location);
141 141
 			break;
142 142
 		case 'untrash':
143
-			if ( !isset( $post_ids ) )
143
+			if ( ! isset($post_ids))
144 144
 				break;
145
-			foreach ( (array) $post_ids as $post_id ) {
146
-				if ( !current_user_can( 'delete_post', $post_id ) )
147
-					wp_die( __( 'You are not allowed to move this item out of the Trash.' ) );
145
+			foreach ((array) $post_ids as $post_id) {
146
+				if ( ! current_user_can('delete_post', $post_id))
147
+					wp_die(__('You are not allowed to move this item out of the Trash.'));
148 148
 
149
-				if ( !wp_untrash_post( $post_id ) )
150
-					wp_die( __( 'Error in restoring from Trash.' ) );
149
+				if ( ! wp_untrash_post($post_id))
150
+					wp_die(__('Error in restoring from Trash.'));
151 151
 			}
152
-			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
152
+			$location = add_query_arg('untrashed', count($post_ids), $location);
153 153
 			break;
154 154
 		case 'delete':
155
-			if ( !isset( $post_ids ) )
155
+			if ( ! isset($post_ids))
156 156
 				break;
157
-			foreach ( (array) $post_ids as $post_id_del ) {
158
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
159
-					wp_die( __( 'You are not allowed to delete this item.' ) );
157
+			foreach ((array) $post_ids as $post_id_del) {
158
+				if ( ! current_user_can('delete_post', $post_id_del))
159
+					wp_die(__('You are not allowed to delete this item.'));
160 160
 
161
-				if ( !wp_delete_attachment( $post_id_del ) )
162
-					wp_die( __( 'Error in deleting.' ) );
161
+				if ( ! wp_delete_attachment($post_id_del))
162
+					wp_die(__('Error in deleting.'));
163 163
 			}
164
-			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
164
+			$location = add_query_arg('deleted', count($post_ids), $location);
165 165
 			break;
166 166
 	}
167 167
 
168
-	wp_redirect( $location );
168
+	wp_redirect($location);
169 169
 	exit;
170
-} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
171
-	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
170
+} elseif ( ! empty($_GET['_wp_http_referer'])) {
171
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
172 172
 	 exit;
173 173
 }
174 174
 
@@ -177,135 +177,135 @@  discard block
 block discarded – undo
177 177
 $title = __('Media Library');
178 178
 $parent_file = 'upload.php';
179 179
 
180
-wp_enqueue_script( 'media' );
180
+wp_enqueue_script('media');
181 181
 
182
-add_screen_option( 'per_page' );
182
+add_screen_option('per_page');
183 183
 
184
-get_current_screen()->add_help_tab( array(
184
+get_current_screen()->add_help_tab(array(
185 185
 'id'		=> 'overview',
186 186
 'title'		=> __('Overview'),
187 187
 'content'	=>
188
-	'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' .
189
-	'<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' .
190
-	'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>'
191
-) );
192
-get_current_screen()->add_help_tab( array(
188
+	'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.').'</p>'.
189
+	'<p>'.__('You can narrow the list by file type/status or by date using the dropdown menus above the media table.').'</p>'.
190
+	'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'
191
+));
192
+get_current_screen()->add_help_tab(array(
193 193
 'id'		=> 'actions-links',
194 194
 'title'		=> __('Available Actions'),
195 195
 'content'	=>
196
-	'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>'
197
-) );
198
-get_current_screen()->add_help_tab( array(
196
+	'<p>'.__('Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.').'</p>'
197
+));
198
+get_current_screen()->add_help_tab(array(
199 199
 'id'		=> 'attaching-files',
200 200
 'title'		=> __('Attaching Files'),
201 201
 'content'	=>
202
-	'<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>'
203
-) );
202
+	'<p>'.__('If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.').'</p>'
203
+));
204 204
 
205 205
 get_current_screen()->set_help_sidebar(
206
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
207
-	'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>' ) . '</p>' .
208
-	'<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>'
206
+	'<p><strong>'.__('For more information:').'</strong></p>'.
207
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen" target="_blank">Documentation on Media Library</a>').'</p>'.
208
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
209 209
 );
210 210
 
211
-get_current_screen()->set_screen_reader_content( array(
212
-	'heading_views'      => __( 'Filter media items list' ),
213
-	'heading_pagination' => __( 'Media items list navigation' ),
214
-	'heading_list'       => __( 'Media items list' ),
215
-) );
211
+get_current_screen()->set_screen_reader_content(array(
212
+	'heading_views'      => __('Filter media items list'),
213
+	'heading_pagination' => __('Media items list navigation'),
214
+	'heading_list'       => __('Media items list'),
215
+));
216 216
 
217
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
217
+require_once(ABSPATH.'wp-admin/admin-header.php');
218 218
 ?>
219 219
 
220 220
 <div class="wrap">
221 221
 <h1>
222 222
 <?php
223
-echo esc_html( $title );
224
-if ( current_user_can( 'upload_files' ) ) { ?>
225
-	<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
223
+echo esc_html($title);
224
+if (current_user_can('upload_files')) { ?>
225
+	<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
226 226
 }
227
-if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
227
+if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) {
228 228
 	/* translators: %s: search keywords */
229
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
229
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query());
230 230
 }
231 231
 ?>
232 232
 </h1>
233 233
 
234 234
 <?php
235 235
 $message = '';
236
-if ( ! empty( $_GET['posted'] ) ) {
237
-	$message = __( 'Media file updated.' );
236
+if ( ! empty($_GET['posted'])) {
237
+	$message = __('Media file updated.');
238 238
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
239 239
 }
240 240
 
241
-if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
242
-	if ( 1 == $attached ) {
243
-		$message = __( 'Media file attached.' );
241
+if ( ! empty($_GET['attached']) && $attached = absint($_GET['attached'])) {
242
+	if (1 == $attached) {
243
+		$message = __('Media file attached.');
244 244
 	} else {
245 245
 		/* translators: %s: number of media files */
246
-		$message = _n( '%s media file attached.', '%s media files attached.', $attached );
246
+		$message = _n('%s media file attached.', '%s media files attached.', $attached);
247 247
 	}
248
-	$message = sprintf( $message, number_format_i18n( $attached ) );
249
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
248
+	$message = sprintf($message, number_format_i18n($attached));
249
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
250 250
 }
251 251
 
252
-if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
253
-	if ( 1 == $detached ) {
254
-		$message = __( 'Media file detached.' );
252
+if ( ! empty($_GET['detach']) && $detached = absint($_GET['detach'])) {
253
+	if (1 == $detached) {
254
+		$message = __('Media file detached.');
255 255
 	} else {
256 256
 		/* translators: %s: number of media files */
257
-		$message = _n( '%s media file detached.', '%s media files detached.', $detached );
257
+		$message = _n('%s media file detached.', '%s media files detached.', $detached);
258 258
 	}
259
-	$message = sprintf( $message, number_format_i18n( $detached ) );
260
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
259
+	$message = sprintf($message, number_format_i18n($detached));
260
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
261 261
 }
262 262
 
263
-if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
264
-	if ( 1 == $deleted ) {
265
-		$message = __( 'Media file permanently deleted.' );
263
+if ( ! empty($_GET['deleted']) && $deleted = absint($_GET['deleted'])) {
264
+	if (1 == $deleted) {
265
+		$message = __('Media file permanently deleted.');
266 266
 	} else {
267 267
 		/* translators: %s: number of media files */
268
-		$message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
268
+		$message = _n('%s media file permanently deleted.', '%s media files permanently deleted.', $deleted);
269 269
 	}
270
-	$message = sprintf( $message, number_format_i18n( $deleted ) );
270
+	$message = sprintf($message, number_format_i18n($deleted));
271 271
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
272 272
 }
273 273
 
274
-if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
275
-	if ( 1 == $trashed ) {
276
-		$message = __( 'Media file moved to the trash.' );
274
+if ( ! empty($_GET['trashed']) && $trashed = absint($_GET['trashed'])) {
275
+	if (1 == $trashed) {
276
+		$message = __('Media file moved to the trash.');
277 277
 	} else {
278 278
 		/* translators: %s: number of media files */
279
-		$message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed );
279
+		$message = _n('%s media file moved to the trash.', '%s media files moved to the trash.', $trashed);
280 280
 	}
281
-	$message = sprintf( $message, number_format_i18n( $trashed ) );
282
-	$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
281
+	$message = sprintf($message, number_format_i18n($trashed));
282
+	$message .= ' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
283 283
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
284 284
 }
285 285
 
286
-if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
287
-	if ( 1 == $untrashed ) {
288
-		$message = __( 'Media file restored from the trash.' );
286
+if ( ! empty($_GET['untrashed']) && $untrashed = absint($_GET['untrashed'])) {
287
+	if (1 == $untrashed) {
288
+		$message = __('Media file restored from the trash.');
289 289
 	} else {
290 290
 		/* translators: %s: number of media files */
291
-		$message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed );
291
+		$message = _n('%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed);
292 292
 	}
293
-	$message = sprintf( $message, number_format_i18n( $untrashed ) );
293
+	$message = sprintf($message, number_format_i18n($untrashed));
294 294
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
295 295
 }
296 296
 
297
-$messages[1] = __( 'Media file updated.' );
298
-$messages[2] = __( 'Media file permanently deleted.' );
299
-$messages[3] = __( 'Error saving media file.' );
300
-$messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>';
301
-$messages[5] = __( 'Media file restored from the trash.' );
297
+$messages[1] = __('Media file updated.');
298
+$messages[2] = __('Media file permanently deleted.');
299
+$messages[3] = __('Error saving media file.');
300
+$messages[4] = __('Media file moved to the trash.').' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
301
+$messages[5] = __('Media file restored from the trash.');
302 302
 
303
-if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
304
-	$message = $messages[ $_GET['message'] ];
303
+if ( ! empty($_GET['message']) && isset($messages[$_GET['message']])) {
304
+	$message = $messages[$_GET['message']];
305 305
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
306 306
 }
307 307
 
308
-if ( !empty($message) ) { ?>
308
+if ( ! empty($message)) { ?>
309 309
 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
310 310
 <?php } ?>
311 311
 
@@ -321,4 +321,4 @@  discard block
 block discarded – undo
321 321
 </div>
322 322
 
323 323
 <?php
324
-include( ABSPATH . 'wp-admin/admin-footer.php' );
324
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/includes/upgrade.php 1 patch
Spacing   +558 added lines, -558 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 /** Include user install customize script. */
12
-if ( file_exists(WP_CONTENT_DIR . '/install.php') )
13
-	require (WP_CONTENT_DIR . '/install.php');
12
+if (file_exists(WP_CONTENT_DIR.'/install.php'))
13
+	require (WP_CONTENT_DIR.'/install.php');
14 14
 
15 15
 /** WordPress Administration API */
16
-require_once(ABSPATH . 'wp-admin/includes/admin.php');
16
+require_once(ABSPATH.'wp-admin/includes/admin.php');
17 17
 
18 18
 /** WordPress Schema API */
19
-require_once(ABSPATH . 'wp-admin/includes/schema.php');
19
+require_once(ABSPATH.'wp-admin/includes/schema.php');
20 20
 
21
-if ( !function_exists('wp_install') ) :
21
+if ( ! function_exists('wp_install')) :
22 22
 /**
23 23
  * Installs the site.
24 24
  *
@@ -36,9 +36,9 @@  discard block
 block discarded – undo
36 36
  * @param string $language      Optional. Language chosen. Default empty.
37 37
  * @return array Array keys 'url', 'user_id', 'password', and 'password_message'.
38 38
  */
39
-function wp_install( $blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '' ) {
40
-	if ( !empty( $deprecated ) )
41
-		_deprecated_argument( __FUNCTION__, '2.6' );
39
+function wp_install($blog_title, $user_name, $user_email, $public, $deprecated = '', $user_password = '', $language = '') {
40
+	if ( ! empty($deprecated))
41
+		_deprecated_argument(__FUNCTION__, '2.6');
42 42
 
43 43
 	wp_check_mysql_version();
44 44
 	wp_cache_flush();
@@ -50,8 +50,8 @@  discard block
 block discarded – undo
50 50
 	update_option('admin_email', $user_email);
51 51
 	update_option('blog_public', $public);
52 52
 
53
-	if ( $language ) {
54
-		update_option( 'WPLANG', $language );
53
+	if ($language) {
54
+		update_option('WPLANG', $language);
55 55
 	}
56 56
 
57 57
 	$guessurl = wp_guess_url();
@@ -59,7 +59,7 @@  discard block
 block discarded – undo
59 59
 	update_option('siteurl', $guessurl);
60 60
 
61 61
 	// If not a public blog, don't ping.
62
-	if ( ! $public )
62
+	if ( ! $public)
63 63
 		update_option('default_pingback_flag', 0);
64 64
 
65 65
 	/*
@@ -69,13 +69,13 @@  discard block
 block discarded – undo
69 69
 	$user_id = username_exists($user_name);
70 70
 	$user_password = trim($user_password);
71 71
 	$email_password = false;
72
-	if ( !$user_id && empty($user_password) ) {
73
-		$user_password = wp_generate_password( 12, false );
72
+	if ( ! $user_id && empty($user_password)) {
73
+		$user_password = wp_generate_password(12, false);
74 74
 		$message = __('<strong><em>Note that password</em></strong> carefully! It is a <em>random</em> password that was generated just for you.');
75 75
 		$user_id = wp_create_user($user_name, $user_password, $user_email);
76 76
 		update_user_option($user_id, 'default_password_nag', true, true);
77 77
 		$email_password = true;
78
-	} elseif ( ! $user_id ) {
78
+	} elseif ( ! $user_id) {
79 79
 		// Password has been provided
80 80
 		$message = '<em>'.__('Your chosen password.').'</em>';
81 81
 		$user_id = wp_create_user($user_name, $user_password, $user_email);
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
 	flush_rewrite_rules();
94 94
 
95
-	wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.') ) );
95
+	wp_new_blog_notification($blog_title, $guessurl, $user_id, ($email_password ? $user_password : __('The password you chose during the install.')));
96 96
 
97 97
 	wp_cache_flush();
98 98
 
@@ -103,13 +103,13 @@  discard block
 block discarded – undo
103 103
 	 *
104 104
 	 * @param WP_User $user The site owner.
105 105
 	 */
106
-	do_action( 'wp_install', $user );
106
+	do_action('wp_install', $user);
107 107
 
108 108
 	return array('url' => $guessurl, 'user_id' => $user_id, 'password' => $user_password, 'password_message' => $message);
109 109
 }
110 110
 endif;
111 111
 
112
-if ( !function_exists('wp_install_defaults') ) :
112
+if ( ! function_exists('wp_install_defaults')) :
113 113
 /**
114 114
  * Creates the initial content for a newly-installed site.
115 115
  *
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
  *
125 125
  * @param int $user_id User ID.
126 126
  */
127
-function wp_install_defaults( $user_id ) {
127
+function wp_install_defaults($user_id) {
128 128
 	global $wpdb, $wp_rewrite, $table_prefix;
129 129
 
130 130
 	// Default category
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
 	/* translators: Default category slug */
133 133
 	$cat_slug = sanitize_title(_x('Uncategorized', 'Default category slug'));
134 134
 
135
-	if ( global_terms_enabled() ) {
136
-		$cat_id = $wpdb->get_var( $wpdb->prepare( "SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug ) );
137
-		if ( $cat_id == null ) {
138
-			$wpdb->insert( $wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)) );
135
+	if (global_terms_enabled()) {
136
+		$cat_id = $wpdb->get_var($wpdb->prepare("SELECT cat_ID FROM {$wpdb->sitecategories} WHERE category_nicename = %s", $cat_slug));
137
+		if ($cat_id == null) {
138
+			$wpdb->insert($wpdb->sitecategories, array('cat_ID' => 0, 'cat_name' => $cat_name, 'category_nicename' => $cat_slug, 'last_updated' => current_time('mysql', true)));
139 139
 			$cat_id = $wpdb->insert_id;
140 140
 		}
141 141
 		update_option('default_category', $cat_id);
@@ -143,35 +143,35 @@  discard block
 block discarded – undo
143 143
 		$cat_id = 1;
144 144
 	}
145 145
 
146
-	$wpdb->insert( $wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) );
147
-	$wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
146
+	$wpdb->insert($wpdb->terms, array('term_id' => $cat_id, 'name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0));
147
+	$wpdb->insert($wpdb->term_taxonomy, array('term_id' => $cat_id, 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1));
148 148
 	$cat_tt_id = $wpdb->insert_id;
149 149
 
150 150
 	// First post
151
-	$now = current_time( 'mysql' );
152
-	$now_gmt = current_time( 'mysql', 1 );
153
-	$first_post_guid = get_option( 'home' ) . '/?p=1';
151
+	$now = current_time('mysql');
152
+	$now_gmt = current_time('mysql', 1);
153
+	$first_post_guid = get_option('home').'/?p=1';
154 154
 
155
-	if ( is_multisite() ) {
156
-		$first_post = get_site_option( 'first_post' );
155
+	if (is_multisite()) {
156
+		$first_post = get_site_option('first_post');
157 157
 
158
-		if ( ! $first_post ) {
158
+		if ( ! $first_post) {
159 159
 			/* translators: %s: site link */
160
-			$first_post = __( 'Welcome to %s. This is your first post. Edit or delete it, then start blogging!' );
160
+			$first_post = __('Welcome to %s. This is your first post. Edit or delete it, then start blogging!');
161 161
 		}
162 162
 
163
-		$first_post = sprintf( $first_post,
164
-			sprintf( '<a href="%s">%s</a>', esc_url( network_home_url() ), get_current_site()->site_name )
163
+		$first_post = sprintf($first_post,
164
+			sprintf('<a href="%s">%s</a>', esc_url(network_home_url()), get_current_site()->site_name)
165 165
 		);
166 166
 
167 167
 		// Back-compat for pre-4.4
168
-		$first_post = str_replace( 'SITE_URL', esc_url( network_home_url() ), $first_post );
169
-		$first_post = str_replace( 'SITE_NAME', get_current_site()->site_name, $first_post );
168
+		$first_post = str_replace('SITE_URL', esc_url(network_home_url()), $first_post);
169
+		$first_post = str_replace('SITE_NAME', get_current_site()->site_name, $first_post);
170 170
 	} else {
171
-		$first_post = __( 'Welcome to WordPress. This is your first post. Edit or delete it, then start writing!' );
171
+		$first_post = __('Welcome to WordPress. This is your first post. Edit or delete it, then start writing!');
172 172
 	}
173 173
 
174
-	$wpdb->insert( $wpdb->posts, array(
174
+	$wpdb->insert($wpdb->posts, array(
175 175
 		'post_author' => $user_id,
176 176
 		'post_date' => $now,
177 177
 		'post_date_gmt' => $now_gmt,
@@ -179,7 +179,7 @@  discard block
 block discarded – undo
179 179
 		'post_excerpt' => '',
180 180
 		'post_title' => __('Hello world!'),
181 181
 		/* translators: Default post slug */
182
-		'post_name' => sanitize_title( _x('hello-world', 'Default post slug') ),
182
+		'post_name' => sanitize_title(_x('hello-world', 'Default post slug')),
183 183
 		'post_modified' => $now,
184 184
 		'post_modified_gmt' => $now_gmt,
185 185
 		'guid' => $first_post_guid,
@@ -188,19 +188,19 @@  discard block
 block discarded – undo
188 188
 		'pinged' => '',
189 189
 		'post_content_filtered' => ''
190 190
 	));
191
-	$wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1) );
191
+	$wpdb->insert($wpdb->term_relationships, array('term_taxonomy_id' => $cat_tt_id, 'object_id' => 1));
192 192
 
193 193
 	// Default comment
194 194
 	$first_comment_author = __('Mr WordPress');
195 195
 	$first_comment_url = 'https://wordpress.org/';
196 196
 	$first_comment = __('Hi, this is a comment.
197 197
 To delete a comment, just log in and view the post&#039;s comments. There you will have the option to edit or delete them.');
198
-	if ( is_multisite() ) {
199
-		$first_comment_author = get_site_option( 'first_comment_author', $first_comment_author );
200
-		$first_comment_url = get_site_option( 'first_comment_url', network_home_url() );
201
-		$first_comment = get_site_option( 'first_comment', $first_comment );
198
+	if (is_multisite()) {
199
+		$first_comment_author = get_site_option('first_comment_author', $first_comment_author);
200
+		$first_comment_url = get_site_option('first_comment_url', network_home_url());
201
+		$first_comment = get_site_option('first_comment', $first_comment);
202 202
 	}
203
-	$wpdb->insert( $wpdb->comments, array(
203
+	$wpdb->insert($wpdb->comments, array(
204 204
 		'comment_post_ID' => 1,
205 205
 		'comment_author' => $first_comment_author,
206 206
 		'comment_author_email' => '',
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
 	));
212 212
 
213 213
 	// First Page
214
-	$first_page = sprintf( __( "This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
214
+	$first_page = sprintf(__("This is an example page. It's different from a blog post because it will stay in one place and will show up in your site navigation (in most themes). Most people start with an About page that introduces them to potential site visitors. It might say something like this:
215 215
 
216 216
 <blockquote>Hi there! I'm a bike messenger by day, aspiring actor by night, and this is my website. I live in Los Angeles, have a great dog named Jack, and I like pi&#241;a coladas. (And gettin' caught in the rain.)</blockquote>
217 217
 
@@ -219,20 +219,20 @@  discard block
 block discarded – undo
219 219
 
220 220
 <blockquote>The XYZ Doohickey Company was founded in 1971, and has been providing quality doohickeys to the public ever since. Located in Gotham City, XYZ employs over 2,000 people and does all kinds of awesome things for the Gotham community.</blockquote>
221 221
 
222
-As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to delete this page and create new pages for your content. Have fun!" ), admin_url() );
223
-	if ( is_multisite() )
224
-		$first_page = get_site_option( 'first_page', $first_page );
225
-	$first_post_guid = get_option('home') . '/?page_id=2';
226
-	$wpdb->insert( $wpdb->posts, array(
222
+As a new WordPress user, you should go to <a href=\"%s\">your dashboard</a> to delete this page and create new pages for your content. Have fun!" ), admin_url());
223
+	if (is_multisite())
224
+		$first_page = get_site_option('first_page', $first_page);
225
+	$first_post_guid = get_option('home').'/?page_id=2';
226
+	$wpdb->insert($wpdb->posts, array(
227 227
 		'post_author' => $user_id,
228 228
 		'post_date' => $now,
229 229
 		'post_date_gmt' => $now_gmt,
230 230
 		'post_content' => $first_page,
231 231
 		'post_excerpt' => '',
232 232
 		'comment_status' => 'closed',
233
-		'post_title' => __( 'Sample Page' ),
233
+		'post_title' => __('Sample Page'),
234 234
 		/* translators: Default page slug */
235
-		'post_name' => __( 'sample-page' ),
235
+		'post_name' => __('sample-page'),
236 236
 		'post_modified' => $now,
237 237
 		'post_modified_gmt' => $now_gmt,
238 238
 		'guid' => $first_post_guid,
@@ -241,37 +241,37 @@  discard block
 block discarded – undo
241 241
 		'pinged' => '',
242 242
 		'post_content_filtered' => ''
243 243
 	));
244
-	$wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) );
244
+	$wpdb->insert($wpdb->postmeta, array('post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default'));
245 245
 
246 246
 	// Set up default widgets for default theme.
247
-	update_option( 'widget_search', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) );
248
-	update_option( 'widget_recent-posts', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
249
-	update_option( 'widget_recent-comments', array ( 2 => array ( 'title' => '', 'number' => 5 ), '_multiwidget' => 1 ) );
250
-	update_option( 'widget_archives', array ( 2 => array ( 'title' => '', 'count' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) );
251
-	update_option( 'widget_categories', array ( 2 => array ( 'title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0 ), '_multiwidget' => 1 ) );
252
-	update_option( 'widget_meta', array ( 2 => array ( 'title' => '' ), '_multiwidget' => 1 ) );
253
-	update_option( 'sidebars_widgets', array ( 'wp_inactive_widgets' => array (), 'sidebar-1' => array ( 0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2', ), 'array_version' => 3 ) );
254
-
255
-	if ( ! is_multisite() )
256
-		update_user_meta( $user_id, 'show_welcome_panel', 1 );
257
-	elseif ( ! is_super_admin( $user_id ) && ! metadata_exists( 'user', $user_id, 'show_welcome_panel' ) )
258
-		update_user_meta( $user_id, 'show_welcome_panel', 2 );
259
-
260
-	if ( is_multisite() ) {
247
+	update_option('widget_search', array(2 => array('title' => ''), '_multiwidget' => 1));
248
+	update_option('widget_recent-posts', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
249
+	update_option('widget_recent-comments', array(2 => array('title' => '', 'number' => 5), '_multiwidget' => 1));
250
+	update_option('widget_archives', array(2 => array('title' => '', 'count' => 0, 'dropdown' => 0), '_multiwidget' => 1));
251
+	update_option('widget_categories', array(2 => array('title' => '', 'count' => 0, 'hierarchical' => 0, 'dropdown' => 0), '_multiwidget' => 1));
252
+	update_option('widget_meta', array(2 => array('title' => ''), '_multiwidget' => 1));
253
+	update_option('sidebars_widgets', array('wp_inactive_widgets' => array(), 'sidebar-1' => array(0 => 'search-2', 1 => 'recent-posts-2', 2 => 'recent-comments-2', 3 => 'archives-2', 4 => 'categories-2', 5 => 'meta-2',), 'array_version' => 3));
254
+
255
+	if ( ! is_multisite())
256
+		update_user_meta($user_id, 'show_welcome_panel', 1);
257
+	elseif ( ! is_super_admin($user_id) && ! metadata_exists('user', $user_id, 'show_welcome_panel'))
258
+		update_user_meta($user_id, 'show_welcome_panel', 2);
259
+
260
+	if (is_multisite()) {
261 261
 		// Flush rules to pick up the new page.
262 262
 		$wp_rewrite->init();
263 263
 		$wp_rewrite->flush_rules();
264 264
 
265 265
 		$user = new WP_User($user_id);
266
-		$wpdb->update( $wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email') );
266
+		$wpdb->update($wpdb->options, array('option_value' => $user->user_email), array('option_name' => 'admin_email'));
267 267
 
268 268
 		// Remove all perms except for the login user.
269
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level') );
270
-		$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities') );
269
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'user_level'));
270
+		$wpdb->query($wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id != %d AND meta_key = %s", $user_id, $table_prefix.'capabilities'));
271 271
 
272 272
 		// Delete any caps that snuck into the previously active blog. (Hardcoded to blog 1 for now.) TODO: Get previous_blog_id.
273
-		if ( !is_super_admin( $user_id ) && $user_id != 1 )
274
-			$wpdb->delete( $wpdb->usermeta, array( 'user_id' => $user_id , 'meta_key' => $wpdb->base_prefix.'1_capabilities' ) );
273
+		if ( ! is_super_admin($user_id) && $user_id != 1)
274
+			$wpdb->delete($wpdb->usermeta, array('user_id' => $user_id, 'meta_key' => $wpdb->base_prefix.'1_capabilities'));
275 275
 	}
276 276
 }
277 277
 endif;
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	global $wp_rewrite;
292 292
 
293 293
 	// Bail if a permalink structure is already enabled.
294
-	if ( get_option( 'permalink_structure' ) ) {
294
+	if (get_option('permalink_structure')) {
295 295
 		return true;
296 296
 	}
297 297
 
@@ -308,20 +308,20 @@  discard block
 block discarded – undo
308 308
 		'/index.php/%year%/%monthnum%/%day%/%postname%/'
309 309
 	);
310 310
 
311
-	foreach ( (array) $permalink_structures as $permalink_structure ) {
312
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
311
+	foreach ((array) $permalink_structures as $permalink_structure) {
312
+		$wp_rewrite->set_permalink_structure($permalink_structure);
313 313
 
314 314
 		/*
315 315
 	 	 * Flush rules with the hard option to force refresh of the web-server's
316 316
 	 	 * rewrite config file (e.g. .htaccess or web.config).
317 317
 	 	 */
318
-		$wp_rewrite->flush_rules( true );
318
+		$wp_rewrite->flush_rules(true);
319 319
 
320 320
 		// Test against a real WordPress Post, or if none were created, a random 404 page.
321
-		$test_url = get_permalink( 1 );
321
+		$test_url = get_permalink(1);
322 322
 
323
-		if ( ! $test_url ) {
324
-			$test_url = home_url( '/wordpress-check-for-rewrites/' );
323
+		if ( ! $test_url) {
324
+			$test_url = home_url('/wordpress-check-for-rewrites/');
325 325
 		}
326 326
 
327 327
 		/*
@@ -331,11 +331,11 @@  discard block
 block discarded – undo
331 331
 	 	 * Uses wp_remote_get() instead of wp_remote_head() because web servers
332 332
 	 	 * can block head requests.
333 333
 	 	 */
334
-		$response          = wp_remote_get( $test_url, array( 'timeout' => 5 ) );
335
-		$x_pingback_header = wp_remote_retrieve_header( $response, 'x-pingback' );
336
-		$pretty_permalinks = $x_pingback_header && $x_pingback_header === get_bloginfo( 'pingback_url' );
334
+		$response          = wp_remote_get($test_url, array('timeout' => 5));
335
+		$x_pingback_header = wp_remote_retrieve_header($response, 'x-pingback');
336
+		$pretty_permalinks = $x_pingback_header && $x_pingback_header === get_bloginfo('pingback_url');
337 337
 
338
-		if ( $pretty_permalinks ) {
338
+		if ($pretty_permalinks) {
339 339
 			return true;
340 340
 		}
341 341
 	}
@@ -344,13 +344,13 @@  discard block
 block discarded – undo
344 344
 	 * If it makes it this far, pretty permalinks failed.
345 345
 	 * Fallback to query-string permalinks.
346 346
 	 */
347
-	$wp_rewrite->set_permalink_structure( '' );
348
-	$wp_rewrite->flush_rules( true );
347
+	$wp_rewrite->set_permalink_structure('');
348
+	$wp_rewrite->flush_rules(true);
349 349
 
350 350
 	return false;
351 351
 }
352 352
 
353
-if ( !function_exists('wp_new_blog_notification') ) :
353
+if ( ! function_exists('wp_new_blog_notification')) :
354 354
 /**
355 355
  * Notifies the site admin that the setup is complete.
356 356
  *
@@ -365,11 +365,11 @@  discard block
 block discarded – undo
365 365
  * @param string $password   User's Password.
366 366
  */
367 367
 function wp_new_blog_notification($blog_title, $blog_url, $user_id, $password) {
368
-	$user = new WP_User( $user_id );
368
+	$user = new WP_User($user_id);
369 369
 	$email = $user->user_email;
370 370
 	$name = $user->user_login;
371 371
 	$login_url = wp_login_url();
372
-	$message = sprintf( __( "Your new WordPress site has been successfully set up at:
372
+	$message = sprintf(__("Your new WordPress site has been successfully set up at:
373 373
 
374 374
 %1\$s
375 375
 
@@ -383,13 +383,13 @@  discard block
 block discarded – undo
383 383
 
384 384
 --The WordPress Team
385 385
 https://wordpress.org/
386
-"), $blog_url, $name, $password, $login_url );
386
+"), $blog_url, $name, $password, $login_url);
387 387
 
388 388
 	@wp_mail($email, __('New WordPress Site'), $message);
389 389
 }
390 390
 endif;
391 391
 
392
-if ( !function_exists('wp_upgrade') ) :
392
+if ( ! function_exists('wp_upgrade')) :
393 393
 /**
394 394
  * Runs WordPress Upgrade functions.
395 395
  *
@@ -407,10 +407,10 @@  discard block
 block discarded – undo
407 407
 	$wp_current_db_version = __get_option('db_version');
408 408
 
409 409
 	// We are up-to-date. Nothing to do.
410
-	if ( $wp_db_version == $wp_current_db_version )
410
+	if ($wp_db_version == $wp_current_db_version)
411 411
 		return;
412 412
 
413
-	if ( ! is_blog_installed() )
413
+	if ( ! is_blog_installed())
414 414
 		return;
415 415
 
416 416
 	wp_check_mysql_version();
@@ -418,15 +418,15 @@  discard block
 block discarded – undo
418 418
 	pre_schema_upgrade();
419 419
 	make_db_current_silent();
420 420
 	upgrade_all();
421
-	if ( is_multisite() && is_main_site() )
421
+	if (is_multisite() && is_main_site())
422 422
 		upgrade_network();
423 423
 	wp_cache_flush();
424 424
 
425
-	if ( is_multisite() ) {
426
-		if ( $wpdb->get_row( "SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'" ) )
427
-			$wpdb->query( "UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'" );
425
+	if (is_multisite()) {
426
+		if ($wpdb->get_row("SELECT blog_id FROM {$wpdb->blog_versions} WHERE blog_id = '{$wpdb->blogid}'"))
427
+			$wpdb->query("UPDATE {$wpdb->blog_versions} SET db_version = '{$wp_db_version}' WHERE blog_id = '{$wpdb->blogid}'");
428 428
 		else
429
-			$wpdb->query( "INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());" );
429
+			$wpdb->query("INSERT INTO {$wpdb->blog_versions} ( `blog_id` , `db_version` , `last_updated` ) VALUES ( '{$wpdb->blogid}', '{$wp_db_version}', NOW());");
430 430
 	}
431 431
 
432 432
 	/**
@@ -437,7 +437,7 @@  discard block
 block discarded – undo
437 437
 	 * @param int $wp_db_version         The new $wp_db_version.
438 438
 	 * @param int $wp_current_db_version The old (current) $wp_db_version.
439 439
 	 */
440
-	do_action( 'wp_upgrade', $wp_db_version, $wp_current_db_version );
440
+	do_action('wp_upgrade', $wp_db_version, $wp_current_db_version);
441 441
 }
442 442
 endif;
443 443
 
@@ -458,106 +458,106 @@  discard block
 block discarded – undo
458 458
 	$wp_current_db_version = __get_option('db_version');
459 459
 
460 460
 	// We are up-to-date. Nothing to do.
461
-	if ( $wp_db_version == $wp_current_db_version )
461
+	if ($wp_db_version == $wp_current_db_version)
462 462
 		return;
463 463
 
464 464
 	// If the version is not set in the DB, try to guess the version.
465
-	if ( empty($wp_current_db_version) ) {
465
+	if (empty($wp_current_db_version)) {
466 466
 		$wp_current_db_version = 0;
467 467
 
468 468
 		// If the template option exists, we have 1.5.
469 469
 		$template = __get_option('template');
470
-		if ( !empty($template) )
470
+		if ( ! empty($template))
471 471
 			$wp_current_db_version = 2541;
472 472
 	}
473 473
 
474
-	if ( $wp_current_db_version < 6039 )
474
+	if ($wp_current_db_version < 6039)
475 475
 		upgrade_230_options_table();
476 476
 
477 477
 	populate_options();
478 478
 
479
-	if ( $wp_current_db_version < 2541 ) {
479
+	if ($wp_current_db_version < 2541) {
480 480
 		upgrade_100();
481 481
 		upgrade_101();
482 482
 		upgrade_110();
483 483
 		upgrade_130();
484 484
 	}
485 485
 
486
-	if ( $wp_current_db_version < 3308 )
486
+	if ($wp_current_db_version < 3308)
487 487
 		upgrade_160();
488 488
 
489
-	if ( $wp_current_db_version < 4772 )
489
+	if ($wp_current_db_version < 4772)
490 490
 		upgrade_210();
491 491
 
492
-	if ( $wp_current_db_version < 4351 )
492
+	if ($wp_current_db_version < 4351)
493 493
 		upgrade_old_slugs();
494 494
 
495
-	if ( $wp_current_db_version < 5539 )
495
+	if ($wp_current_db_version < 5539)
496 496
 		upgrade_230();
497 497
 
498
-	if ( $wp_current_db_version < 6124 )
498
+	if ($wp_current_db_version < 6124)
499 499
 		upgrade_230_old_tables();
500 500
 
501
-	if ( $wp_current_db_version < 7499 )
501
+	if ($wp_current_db_version < 7499)
502 502
 		upgrade_250();
503 503
 
504
-	if ( $wp_current_db_version < 7935 )
504
+	if ($wp_current_db_version < 7935)
505 505
 		upgrade_252();
506 506
 
507
-	if ( $wp_current_db_version < 8201 )
507
+	if ($wp_current_db_version < 8201)
508 508
 		upgrade_260();
509 509
 
510
-	if ( $wp_current_db_version < 8989 )
510
+	if ($wp_current_db_version < 8989)
511 511
 		upgrade_270();
512 512
 
513
-	if ( $wp_current_db_version < 10360 )
513
+	if ($wp_current_db_version < 10360)
514 514
 		upgrade_280();
515 515
 
516
-	if ( $wp_current_db_version < 11958 )
516
+	if ($wp_current_db_version < 11958)
517 517
 		upgrade_290();
518 518
 
519
-	if ( $wp_current_db_version < 15260 )
519
+	if ($wp_current_db_version < 15260)
520 520
 		upgrade_300();
521 521
 
522
-	if ( $wp_current_db_version < 19389 )
522
+	if ($wp_current_db_version < 19389)
523 523
 		upgrade_330();
524 524
 
525
-	if ( $wp_current_db_version < 20080 )
525
+	if ($wp_current_db_version < 20080)
526 526
 		upgrade_340();
527 527
 
528
-	if ( $wp_current_db_version < 22422 )
528
+	if ($wp_current_db_version < 22422)
529 529
 		upgrade_350();
530 530
 
531
-	if ( $wp_current_db_version < 25824 )
531
+	if ($wp_current_db_version < 25824)
532 532
 		upgrade_370();
533 533
 
534
-	if ( $wp_current_db_version < 26148 )
534
+	if ($wp_current_db_version < 26148)
535 535
 		upgrade_372();
536 536
 
537
-	if ( $wp_current_db_version < 26691 )
537
+	if ($wp_current_db_version < 26691)
538 538
 		upgrade_380();
539 539
 
540
-	if ( $wp_current_db_version < 29630 )
540
+	if ($wp_current_db_version < 29630)
541 541
 		upgrade_400();
542 542
 
543
-	if ( $wp_current_db_version < 33055 )
543
+	if ($wp_current_db_version < 33055)
544 544
 		upgrade_430();
545 545
 
546
-	if ( $wp_current_db_version < 33056 )
546
+	if ($wp_current_db_version < 33056)
547 547
 		upgrade_431();
548 548
 
549
-	if ( $wp_current_db_version < 35700 )
549
+	if ($wp_current_db_version < 35700)
550 550
 		upgrade_440();
551 551
 
552
-	if ( $wp_current_db_version < 36686 )
552
+	if ($wp_current_db_version < 36686)
553 553
 		upgrade_450();
554 554
 
555 555
 	maybe_disable_link_manager();
556 556
 
557 557
 	maybe_disable_automattic_widgets();
558 558
 
559
-	update_option( 'db_version', $wp_db_version );
560
-	update_option( 'db_upgraded', true );
559
+	update_option('db_version', $wp_db_version);
560
+	update_option('db_upgraded', true);
561 561
 }
562 562
 
563 563
 /**
@@ -577,7 +577,7 @@  discard block
 block discarded – undo
577 577
 		foreach ($posts as $post) {
578 578
 			if ('' == $post->post_name) {
579 579
 				$newtitle = sanitize_title($post->post_title);
580
-				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
580
+				$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID));
581 581
 			}
582 582
 		}
583 583
 	}
@@ -586,7 +586,7 @@  discard block
 block discarded – undo
586 586
 	foreach ($categories as $category) {
587 587
 		if ('' == $category->category_nicename) {
588 588
 			$newtitle = sanitize_title($category->cat_name);
589
-			$wpdb->update( $wpdb->categories, array('category_nicename' => $newtitle), array('cat_ID' => $category->cat_ID) );
589
+			$wpdb->update($wpdb->categories, array('category_nicename' => $newtitle), array('cat_ID' => $category->cat_ID));
590 590
 		}
591 591
 	}
592 592
 
@@ -594,7 +594,7 @@  discard block
 block discarded – undo
594 594
 		SET option_value = REPLACE(option_value, 'wp-links/links-images/', 'wp-images/links/')
595 595
 		WHERE option_name LIKE %s
596 596
 		AND option_value LIKE %s";
597
-	$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( 'links_rating_image' ) . '%', $wpdb->esc_like( 'wp-links/links-images/' ) . '%' ) );
597
+	$wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('links_rating_image').'%', $wpdb->esc_like('wp-links/links-images/').'%'));
598 598
 
599 599
 	$done_ids = $wpdb->get_results("SELECT DISTINCT post_id FROM $wpdb->post2cat");
600 600
 	if ($done_ids) :
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 		foreach ($done_ids as $done_id) :
603 603
 			$done_posts[] = $done_id->post_id;
604 604
 		endforeach;
605
-		$catwhere = ' AND ID NOT IN (' . implode(',', $done_posts) . ')';
605
+		$catwhere = ' AND ID NOT IN ('.implode(',', $done_posts).')';
606 606
 	else:
607 607
 		$catwhere = '';
608 608
 	endif;
@@ -611,9 +611,9 @@  discard block
 block discarded – undo
611 611
 	if ($allposts) :
612 612
 		foreach ($allposts as $post) {
613 613
 			// Check to see if it's already been imported
614
-			$cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
615
-			if (!$cat && 0 != $post->post_category) { // If there's no result
616
-				$wpdb->insert( $wpdb->post2cat, array('post_id' => $post->ID, 'category_id' => $post->post_category) );
614
+			$cat = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category));
615
+			if ( ! $cat && 0 != $post->post_category) { // If there's no result
616
+				$wpdb->insert($wpdb->post2cat, array('post_id' => $post->ID, 'category_id' => $post->post_category));
617 617
 			}
618 618
 		}
619 619
 	endif;
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 	add_clean_index($wpdb->categories, 'category_nicename');
637 637
 	add_clean_index($wpdb->comments, 'comment_approved');
638 638
 	add_clean_index($wpdb->comments, 'comment_post_ID');
639
-	add_clean_index($wpdb->links , 'link_category');
640
-	add_clean_index($wpdb->links , 'link_visible');
639
+	add_clean_index($wpdb->links, 'link_category');
640
+	add_clean_index($wpdb->links, 'link_visible');
641 641
 }
642 642
 
643 643
 /**
@@ -656,14 +656,14 @@  discard block
 block discarded – undo
656 656
 	foreach ($users as $user) {
657 657
 		if ('' == $user->user_nicename) {
658 658
 			$newname = sanitize_title($user->user_nickname);
659
-			$wpdb->update( $wpdb->users, array('user_nicename' => $newname), array('ID' => $user->ID) );
659
+			$wpdb->update($wpdb->users, array('user_nicename' => $newname), array('ID' => $user->ID));
660 660
 		}
661 661
 	}
662 662
 
663 663
 	$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
664 664
 	foreach ($users as $row) {
665
-		if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
666
-			$wpdb->update( $wpdb->users, array('user_pass' => md5($row->user_pass)), array('ID' => $row->ID) );
665
+		if ( ! preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
666
+			$wpdb->update($wpdb->users, array('user_pass' => md5($row->user_pass)), array('ID' => $row->ID));
667 667
 		}
668 668
 	}
669 669
 
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 
673 673
 	$time_difference = $all_options->time_difference;
674 674
 
675
-		$server_time = time()+date('Z');
675
+		$server_time = time() + date('Z');
676 676
 	$weblogger_time = $server_time + $time_difference * HOUR_IN_SECONDS;
677 677
 	$gmt_time = time();
678 678
 
@@ -689,7 +689,7 @@  discard block
 block discarded – undo
689 689
 	// <michel_v> I just slapped myself silly for not thinking about it earlier
690 690
 	$got_gmt_fields = ! ($wpdb->get_var("SELECT MAX(post_date_gmt) FROM $wpdb->posts") == '0000-00-00 00:00:00');
691 691
 
692
-	if (!$got_gmt_fields) {
692
+	if ( ! $got_gmt_fields) {
693 693
 
694 694
 		// Add or subtract time to all dates, to get GMT dates
695 695
 		$add_hours = intval($diff_gmt_weblogger);
@@ -721,12 +721,12 @@  discard block
 block discarded – undo
721 721
 			$post_content = addslashes(deslash($post->post_content));
722 722
 			$post_title = addslashes(deslash($post->post_title));
723 723
 			$post_excerpt = addslashes(deslash($post->post_excerpt));
724
-			if ( empty($post->guid) )
724
+			if (empty($post->guid))
725 725
 				$guid = get_permalink($post->ID);
726 726
 			else
727 727
 				$guid = $post->guid;
728 728
 
729
-			$wpdb->update( $wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID) );
729
+			$wpdb->update($wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID));
730 730
 
731 731
 		}
732 732
 	}
@@ -738,7 +738,7 @@  discard block
 block discarded – undo
738 738
 			$comment_content = deslash($comment->comment_content);
739 739
 			$comment_author = deslash($comment->comment_author);
740 740
 
741
-			$wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) );
741
+			$wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID));
742 742
 		}
743 743
 	}
744 744
 
@@ -749,7 +749,7 @@  discard block
 block discarded – undo
749 749
 			$link_name = deslash($link->link_name);
750 750
 			$link_description = deslash($link->link_description);
751 751
 
752
-			$wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) );
752
+			$wpdb->update($wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id));
753 753
 		}
754 754
 	}
755 755
 
@@ -759,16 +759,16 @@  discard block
 block discarded – undo
759 759
 	 * If plugins are not stored in an array, they're stored in the old
760 760
 	 * newline separated format. Convert to new format.
761 761
 	 */
762
-	if ( !is_array( $active_plugins ) ) {
762
+	if ( ! is_array($active_plugins)) {
763 763
 		$active_plugins = explode("\n", trim($active_plugins));
764 764
 		update_option('active_plugins', $active_plugins);
765 765
 	}
766 766
 
767 767
 	// Obsolete tables
768
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
769
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiontypes');
770
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroups');
771
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optiongroup_options');
768
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'optionvalues');
769
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'optiontypes');
770
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'optiongroups');
771
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'optiongroup_options');
772 772
 
773 773
 	// Update comments table to use comment_type
774 774
 	$wpdb->query("UPDATE $wpdb->comments SET comment_type='trackback', comment_content = REPLACE(comment_content, '<trackback />', '') WHERE comment_content LIKE '<trackback />%'");
@@ -776,11 +776,11 @@  discard block
 block discarded – undo
776 776
 
777 777
 	// Some versions have multiple duplicate option_name rows with the same values
778 778
 	$options = $wpdb->get_results("SELECT option_name, COUNT(option_name) AS dupes FROM `$wpdb->options` GROUP BY option_name");
779
-	foreach ( $options as $option ) {
780
-		if ( 1 != $option->dupes ) { // Could this be done in the query?
779
+	foreach ($options as $option) {
780
+		if (1 != $option->dupes) { // Could this be done in the query?
781 781
 			$limit = $option->dupes - 1;
782
-			$dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) );
783
-			if ( $dupe_ids ) {
782
+			$dupe_ids = $wpdb->get_col($wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit));
783
+			if ($dupe_ids) {
784 784
 				$dupe_ids = join($dupe_ids, ',');
785 785
 				$wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
786 786
 			}
@@ -805,27 +805,27 @@  discard block
 block discarded – undo
805 805
 	populate_roles_160();
806 806
 
807 807
 	$users = $wpdb->get_results("SELECT * FROM $wpdb->users");
808
-	foreach ( $users as $user ) :
809
-		if ( !empty( $user->user_firstname ) )
810
-			update_user_meta( $user->ID, 'first_name', wp_slash($user->user_firstname) );
811
-		if ( !empty( $user->user_lastname ) )
812
-			update_user_meta( $user->ID, 'last_name', wp_slash($user->user_lastname) );
813
-		if ( !empty( $user->user_nickname ) )
814
-			update_user_meta( $user->ID, 'nickname', wp_slash($user->user_nickname) );
815
-		if ( !empty( $user->user_level ) )
816
-			update_user_meta( $user->ID, $wpdb->prefix . 'user_level', $user->user_level );
817
-		if ( !empty( $user->user_icq ) )
818
-			update_user_meta( $user->ID, 'icq', wp_slash($user->user_icq) );
819
-		if ( !empty( $user->user_aim ) )
820
-			update_user_meta( $user->ID, 'aim', wp_slash($user->user_aim) );
821
-		if ( !empty( $user->user_msn ) )
822
-			update_user_meta( $user->ID, 'msn', wp_slash($user->user_msn) );
823
-		if ( !empty( $user->user_yim ) )
824
-			update_user_meta( $user->ID, 'yim', wp_slash($user->user_icq) );
825
-		if ( !empty( $user->user_description ) )
826
-			update_user_meta( $user->ID, 'description', wp_slash($user->user_description) );
827
-
828
-		if ( isset( $user->user_idmode ) ):
808
+	foreach ($users as $user) :
809
+		if ( ! empty($user->user_firstname))
810
+			update_user_meta($user->ID, 'first_name', wp_slash($user->user_firstname));
811
+		if ( ! empty($user->user_lastname))
812
+			update_user_meta($user->ID, 'last_name', wp_slash($user->user_lastname));
813
+		if ( ! empty($user->user_nickname))
814
+			update_user_meta($user->ID, 'nickname', wp_slash($user->user_nickname));
815
+		if ( ! empty($user->user_level))
816
+			update_user_meta($user->ID, $wpdb->prefix.'user_level', $user->user_level);
817
+		if ( ! empty($user->user_icq))
818
+			update_user_meta($user->ID, 'icq', wp_slash($user->user_icq));
819
+		if ( ! empty($user->user_aim))
820
+			update_user_meta($user->ID, 'aim', wp_slash($user->user_aim));
821
+		if ( ! empty($user->user_msn))
822
+			update_user_meta($user->ID, 'msn', wp_slash($user->user_msn));
823
+		if ( ! empty($user->user_yim))
824
+			update_user_meta($user->ID, 'yim', wp_slash($user->user_icq));
825
+		if ( ! empty($user->user_description))
826
+			update_user_meta($user->ID, 'description', wp_slash($user->user_description));
827
+
828
+		if (isset($user->user_idmode)):
829 829
 			$idmode = $user->user_idmode;
830 830
 			if ($idmode == 'nickname') $id = $user->user_nickname;
831 831
 			if ($idmode == 'login') $id = $user->user_login;
@@ -833,46 +833,46 @@  discard block
 block discarded – undo
833 833
 			if ($idmode == 'lastname') $id = $user->user_lastname;
834 834
 			if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
835 835
 			if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
836
-			if (!$idmode) $id = $user->user_nickname;
837
-			$wpdb->update( $wpdb->users, array('display_name' => $id), array('ID' => $user->ID) );
836
+			if ( ! $idmode) $id = $user->user_nickname;
837
+			$wpdb->update($wpdb->users, array('display_name' => $id), array('ID' => $user->ID));
838 838
 		endif;
839 839
 
840 840
 		// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
841
-		$caps = get_user_meta( $user->ID, $wpdb->prefix . 'capabilities');
842
-		if ( empty($caps) || defined('RESET_CAPS') ) {
843
-			$level = get_user_meta($user->ID, $wpdb->prefix . 'user_level', true);
841
+		$caps = get_user_meta($user->ID, $wpdb->prefix.'capabilities');
842
+		if (empty($caps) || defined('RESET_CAPS')) {
843
+			$level = get_user_meta($user->ID, $wpdb->prefix.'user_level', true);
844 844
 			$role = translate_level_to_role($level);
845
-			update_user_meta( $user->ID, $wpdb->prefix . 'capabilities', array($role => true) );
845
+			update_user_meta($user->ID, $wpdb->prefix.'capabilities', array($role => true));
846 846
 		}
847 847
 
848 848
 	endforeach;
849
-	$old_user_fields = array( 'user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level' );
849
+	$old_user_fields = array('user_firstname', 'user_lastname', 'user_icq', 'user_aim', 'user_msn', 'user_yim', 'user_idmode', 'user_ip', 'user_domain', 'user_browser', 'user_description', 'user_nickname', 'user_level');
850 850
 	$wpdb->hide_errors();
851
-	foreach ( $old_user_fields as $old )
851
+	foreach ($old_user_fields as $old)
852 852
 		$wpdb->query("ALTER TABLE $wpdb->users DROP $old");
853 853
 	$wpdb->show_errors();
854 854
 
855 855
 	// Populate comment_count field of posts table.
856
-	$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
857
-	if ( is_array( $comments ) )
856
+	$comments = $wpdb->get_results("SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID");
857
+	if (is_array($comments))
858 858
 		foreach ($comments as $comment)
859
-			$wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) );
859
+			$wpdb->update($wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID));
860 860
 
861 861
 	/*
862 862
 	 * Some alpha versions used a post status of object instead of attachment
863 863
 	 * and put the mime type in post_type instead of post_mime_type.
864 864
 	 */
865
-	if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
865
+	if ($wp_current_db_version > 2541 && $wp_current_db_version <= 3091) {
866 866
 		$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
867 867
 		foreach ($objects as $object) {
868
-			$wpdb->update( $wpdb->posts, array(	'post_status' => 'attachment',
868
+			$wpdb->update($wpdb->posts, array('post_status' => 'attachment',
869 869
 												'post_mime_type' => $object->post_type,
870 870
 												'post_type' => ''),
871
-										 array( 'ID' => $object->ID ) );
871
+										 array('ID' => $object->ID));
872 872
 
873 873
 			$meta = get_post_meta($object->ID, 'imagedata', true);
874
-			if ( ! empty($meta['file']) )
875
-				update_attached_file( $object->ID, $meta['file'] );
874
+			if ( ! empty($meta['file']))
875
+				update_attached_file($object->ID, $meta['file']);
876 876
 		}
877 877
 	}
878 878
 }
@@ -889,38 +889,38 @@  discard block
 block discarded – undo
889 889
 function upgrade_210() {
890 890
 	global $wpdb, $wp_current_db_version;
891 891
 
892
-	if ( $wp_current_db_version < 3506 ) {
892
+	if ($wp_current_db_version < 3506) {
893 893
 		// Update status and type.
894 894
 		$posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts");
895 895
 
896
-		if ( ! empty($posts) ) foreach ($posts as $post) {
896
+		if ( ! empty($posts)) foreach ($posts as $post) {
897 897
 			$status = $post->post_status;
898 898
 			$type = 'post';
899 899
 
900
-			if ( 'static' == $status ) {
900
+			if ('static' == $status) {
901 901
 				$status = 'publish';
902 902
 				$type = 'page';
903
-			} elseif ( 'attachment' == $status ) {
903
+			} elseif ('attachment' == $status) {
904 904
 				$status = 'inherit';
905 905
 				$type = 'attachment';
906 906
 			}
907 907
 
908
-			$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
908
+			$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID));
909 909
 		}
910 910
 	}
911 911
 
912
-	if ( $wp_current_db_version < 3845 ) {
912
+	if ($wp_current_db_version < 3845) {
913 913
 		populate_roles_210();
914 914
 	}
915 915
 
916
-	if ( $wp_current_db_version < 3531 ) {
916
+	if ($wp_current_db_version < 3531) {
917 917
 		// Give future posts a post_status of future.
918 918
 		$now = gmdate('Y-m-d H:i:59');
919
-		$wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
919
+		$wpdb->query("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
920 920
 
921 921
 		$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
922
-		if ( !empty($posts) )
923
-			foreach ( $posts as $post )
922
+		if ( ! empty($posts))
923
+			foreach ($posts as $post)
924 924
 				wp_schedule_single_event(mysql2date('U', $post->post_date, false), 'publish_future_post', array($post->ID));
925 925
 	}
926 926
 }
@@ -937,7 +937,7 @@  discard block
 block discarded – undo
937 937
 function upgrade_230() {
938 938
 	global $wp_current_db_version, $wpdb;
939 939
 
940
-	if ( $wp_current_db_version < 5200 ) {
940
+	if ($wp_current_db_version < 5200) {
941 941
 		populate_roles_230();
942 942
 	}
943 943
 
@@ -954,78 +954,78 @@  discard block
 block discarded – undo
954 954
 		$term_group = 0;
955 955
 
956 956
 		// Associate terms with the same slug in a term group and make slugs unique.
957
-		if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
957
+		if ($exists = $wpdb->get_results($wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug))) {
958 958
 			$term_group = $exists[0]->term_group;
959 959
 			$id = $exists[0]->term_id;
960 960
 			$num = 2;
961 961
 			do {
962
-				$alt_slug = $slug . "-$num";
962
+				$alt_slug = $slug."-$num";
963 963
 				$num++;
964
-				$slug_check = $wpdb->get_var( $wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug) );
965
-			} while ( $slug_check );
964
+				$slug_check = $wpdb->get_var($wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug));
965
+			} while ($slug_check);
966 966
 
967 967
 			$slug = $alt_slug;
968 968
 
969
-			if ( empty( $term_group ) ) {
969
+			if (empty($term_group)) {
970 970
 				$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
971
-				$wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) );
971
+				$wpdb->query($wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id));
972 972
 			}
973 973
 		}
974 974
 
975
-		$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
976
-		(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
975
+		$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
976
+		(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group));
977 977
 
978 978
 		$count = 0;
979
-		if ( !empty($category->category_count) ) {
979
+		if ( ! empty($category->category_count)) {
980 980
 			$count = (int) $category->category_count;
981 981
 			$taxonomy = 'category';
982
-			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
982
+			$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count));
983 983
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
984 984
 		}
985 985
 
986
-		if ( !empty($category->link_count) ) {
986
+		if ( ! empty($category->link_count)) {
987 987
 			$count = (int) $category->link_count;
988 988
 			$taxonomy = 'link_category';
989
-			$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
989
+			$wpdb->query($wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count));
990 990
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
991 991
 		}
992 992
 
993
-		if ( !empty($category->tag_count) ) {
993
+		if ( ! empty($category->tag_count)) {
994 994
 			$have_tags = true;
995 995
 			$count = (int) $category->tag_count;
996 996
 			$taxonomy = 'post_tag';
997
-			$wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') );
997
+			$wpdb->insert($wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count'));
998 998
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
999 999
 		}
1000 1000
 
1001
-		if ( empty($count) ) {
1001
+		if (empty($count)) {
1002 1002
 			$count = 0;
1003 1003
 			$taxonomy = 'category';
1004
-			$wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') );
1004
+			$wpdb->insert($wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count'));
1005 1005
 			$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
1006 1006
 		}
1007 1007
 	}
1008 1008
 
1009 1009
 	$select = 'post_id, category_id';
1010
-	if ( $have_tags )
1010
+	if ($have_tags)
1011 1011
 		$select .= ', rel_type';
1012 1012
 
1013 1013
 	$posts = $wpdb->get_results("SELECT $select FROM $wpdb->post2cat GROUP BY post_id, category_id");
1014
-	foreach ( $posts as $post ) {
1014
+	foreach ($posts as $post) {
1015 1015
 		$post_id = (int) $post->post_id;
1016 1016
 		$term_id = (int) $post->category_id;
1017 1017
 		$taxonomy = 'category';
1018
-		if ( !empty($post->rel_type) && 'tag' == $post->rel_type)
1018
+		if ( ! empty($post->rel_type) && 'tag' == $post->rel_type)
1019 1019
 			$taxonomy = 'tag';
1020 1020
 		$tt_id = $tt_ids[$term_id][$taxonomy];
1021
-		if ( empty($tt_id) )
1021
+		if (empty($tt_id))
1022 1022
 			continue;
1023 1023
 
1024
-		$wpdb->insert( $wpdb->term_relationships, array('object_id' => $post_id, 'term_taxonomy_id' => $tt_id) );
1024
+		$wpdb->insert($wpdb->term_relationships, array('object_id' => $post_id, 'term_taxonomy_id' => $tt_id));
1025 1025
 	}
1026 1026
 
1027 1027
 	// < 3570 we used linkcategories. >= 3570 we used categories and link2cat.
1028
-	if ( $wp_current_db_version < 3570 ) {
1028
+	if ($wp_current_db_version < 3570) {
1029 1029
 		/*
1030 1030
 		 * Create link_category terms for link categories. Create a map of link
1031 1031
 		 * cat IDs to link_category terms.
@@ -1033,8 +1033,8 @@  discard block
 block discarded – undo
1033 1033
 		$link_cat_id_map = array();
1034 1034
 		$default_link_cat = 0;
1035 1035
 		$tt_ids = array();
1036
-		$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM " . $wpdb->prefix . 'linkcategories');
1037
-		foreach ( $link_cats as $category) {
1036
+		$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM ".$wpdb->prefix.'linkcategories');
1037
+		foreach ($link_cats as $category) {
1038 1038
 			$cat_id = (int) $category->cat_id;
1039 1039
 			$term_id = 0;
1040 1040
 			$name = wp_slash($category->cat_name);
@@ -1042,66 +1042,66 @@  discard block
 block discarded – undo
1042 1042
 			$term_group = 0;
1043 1043
 
1044 1044
 			// Associate terms with the same slug in a term group and make slugs unique.
1045
-			if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
1045
+			if ($exists = $wpdb->get_results($wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug))) {
1046 1046
 				$term_group = $exists[0]->term_group;
1047 1047
 				$term_id = $exists[0]->term_id;
1048 1048
 			}
1049 1049
 
1050
-			if ( empty($term_id) ) {
1051
-				$wpdb->insert( $wpdb->terms, compact('name', 'slug', 'term_group') );
1050
+			if (empty($term_id)) {
1051
+				$wpdb->insert($wpdb->terms, compact('name', 'slug', 'term_group'));
1052 1052
 				$term_id = (int) $wpdb->insert_id;
1053 1053
 			}
1054 1054
 
1055 1055
 			$link_cat_id_map[$cat_id] = $term_id;
1056 1056
 			$default_link_cat = $term_id;
1057 1057
 
1058
-			$wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0) );
1058
+			$wpdb->insert($wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0));
1059 1059
 			$tt_ids[$term_id] = (int) $wpdb->insert_id;
1060 1060
 		}
1061 1061
 
1062 1062
 		// Associate links to cats.
1063 1063
 		$links = $wpdb->get_results("SELECT link_id, link_category FROM $wpdb->links");
1064
-		if ( !empty($links) ) foreach ( $links as $link ) {
1065
-			if ( 0 == $link->link_category )
1064
+		if ( ! empty($links)) foreach ($links as $link) {
1065
+			if (0 == $link->link_category)
1066 1066
 				continue;
1067
-			if ( ! isset($link_cat_id_map[$link->link_category]) )
1067
+			if ( ! isset($link_cat_id_map[$link->link_category]))
1068 1068
 				continue;
1069 1069
 			$term_id = $link_cat_id_map[$link->link_category];
1070 1070
 			$tt_id = $tt_ids[$term_id];
1071
-			if ( empty($tt_id) )
1071
+			if (empty($tt_id))
1072 1072
 				continue;
1073 1073
 
1074
-			$wpdb->insert( $wpdb->term_relationships, array('object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id) );
1074
+			$wpdb->insert($wpdb->term_relationships, array('object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id));
1075 1075
 		}
1076 1076
 
1077 1077
 		// Set default to the last category we grabbed during the upgrade loop.
1078 1078
 		update_option('default_link_category', $default_link_cat);
1079 1079
 	} else {
1080 1080
 		$links = $wpdb->get_results("SELECT link_id, category_id FROM $wpdb->link2cat GROUP BY link_id, category_id");
1081
-		foreach ( $links as $link ) {
1081
+		foreach ($links as $link) {
1082 1082
 			$link_id = (int) $link->link_id;
1083 1083
 			$term_id = (int) $link->category_id;
1084 1084
 			$taxonomy = 'link_category';
1085 1085
 			$tt_id = $tt_ids[$term_id][$taxonomy];
1086
-			if ( empty($tt_id) )
1086
+			if (empty($tt_id))
1087 1087
 				continue;
1088
-			$wpdb->insert( $wpdb->term_relationships, array('object_id' => $link_id, 'term_taxonomy_id' => $tt_id) );
1088
+			$wpdb->insert($wpdb->term_relationships, array('object_id' => $link_id, 'term_taxonomy_id' => $tt_id));
1089 1089
 		}
1090 1090
 	}
1091 1091
 
1092
-	if ( $wp_current_db_version < 4772 ) {
1092
+	if ($wp_current_db_version < 4772) {
1093 1093
 		// Obsolete linkcategories table
1094
-		$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'linkcategories');
1094
+		$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'linkcategories');
1095 1095
 	}
1096 1096
 
1097 1097
 	// Recalculate all counts
1098 1098
 	$terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy");
1099
-	foreach ( (array) $terms as $term ) {
1100
-		if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) )
1101
-			$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
1099
+	foreach ((array) $terms as $term) {
1100
+		if (('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy))
1101
+			$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id));
1102 1102
 		else
1103
-			$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
1104
-		$wpdb->update( $wpdb->term_taxonomy, array('count' => $count), array('term_taxonomy_id' => $term->term_taxonomy_id) );
1103
+			$count = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id));
1104
+		$wpdb->update($wpdb->term_taxonomy, array('count' => $count), array('term_taxonomy_id' => $term->term_taxonomy_id));
1105 1105
 	}
1106 1106
 }
1107 1107
 
@@ -1115,9 +1115,9 @@  discard block
 block discarded – undo
1115 1115
  */
1116 1116
 function upgrade_230_options_table() {
1117 1117
 	global $wpdb;
1118
-	$old_options_fields = array( 'option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level' );
1118
+	$old_options_fields = array('option_can_override', 'option_type', 'option_width', 'option_height', 'option_description', 'option_admin_level');
1119 1119
 	$wpdb->hide_errors();
1120
-	foreach ( $old_options_fields as $old )
1120
+	foreach ($old_options_fields as $old)
1121 1121
 		$wpdb->query("ALTER TABLE $wpdb->options DROP $old");
1122 1122
 	$wpdb->show_errors();
1123 1123
 }
@@ -1132,9 +1132,9 @@  discard block
 block discarded – undo
1132 1132
  */
1133 1133
 function upgrade_230_old_tables() {
1134 1134
 	global $wpdb;
1135
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'categories');
1136
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'link2cat');
1137
-	$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'post2cat');
1135
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'categories');
1136
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'link2cat');
1137
+	$wpdb->query('DROP TABLE IF EXISTS '.$wpdb->prefix.'post2cat');
1138 1138
 }
1139 1139
 
1140 1140
 /**
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 function upgrade_250() {
1163 1163
 	global $wp_current_db_version;
1164 1164
 
1165
-	if ( $wp_current_db_version < 6689 ) {
1165
+	if ($wp_current_db_version < 6689) {
1166 1166
 		populate_roles_250();
1167 1167
 	}
1168 1168
 
@@ -1193,7 +1193,7 @@  discard block
 block discarded – undo
1193 1193
 function upgrade_260() {
1194 1194
 	global $wp_current_db_version;
1195 1195
 
1196
-	if ( $wp_current_db_version < 8000 )
1196
+	if ($wp_current_db_version < 8000)
1197 1197
 		populate_roles_260();
1198 1198
 }
1199 1199
 
@@ -1209,12 +1209,12 @@  discard block
 block discarded – undo
1209 1209
 function upgrade_270() {
1210 1210
 	global $wpdb, $wp_current_db_version;
1211 1211
 
1212
-	if ( $wp_current_db_version < 8980 )
1212
+	if ($wp_current_db_version < 8980)
1213 1213
 		populate_roles_270();
1214 1214
 
1215 1215
 	// Update post_date for unpublished posts with empty timestamp
1216
-	if ( $wp_current_db_version < 8921 )
1217
-		$wpdb->query( "UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'" );
1216
+	if ($wp_current_db_version < 8921)
1217
+		$wpdb->query("UPDATE $wpdb->posts SET post_date = post_modified WHERE post_date = '0000-00-00 00:00:00'");
1218 1218
 }
1219 1219
 
1220 1220
 /**
@@ -1229,22 +1229,22 @@  discard block
 block discarded – undo
1229 1229
 function upgrade_280() {
1230 1230
 	global $wp_current_db_version, $wpdb;
1231 1231
 
1232
-	if ( $wp_current_db_version < 10360 )
1232
+	if ($wp_current_db_version < 10360)
1233 1233
 		populate_roles_280();
1234
-	if ( is_multisite() ) {
1234
+	if (is_multisite()) {
1235 1235
 		$start = 0;
1236
-		while( $rows = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20" ) ) {
1237
-			foreach ( $rows as $row ) {
1236
+		while ($rows = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options ORDER BY option_id LIMIT $start, 20")) {
1237
+			foreach ($rows as $row) {
1238 1238
 				$value = $row->option_value;
1239
-				if ( !@unserialize( $value ) )
1240
-					$value = stripslashes( $value );
1241
-				if ( $value !== $row->option_value ) {
1242
-					update_option( $row->option_name, $value );
1239
+				if ( ! @unserialize($value))
1240
+					$value = stripslashes($value);
1241
+				if ($value !== $row->option_value) {
1242
+					update_option($row->option_name, $value);
1243 1243
 				}
1244 1244
 			}
1245 1245
 			$start += 20;
1246 1246
 		}
1247
-		refresh_blog_details( $wpdb->blogid );
1247
+		refresh_blog_details($wpdb->blogid);
1248 1248
 	}
1249 1249
 }
1250 1250
 
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
 function upgrade_290() {
1260 1260
 	global $wp_current_db_version;
1261 1261
 
1262
-	if ( $wp_current_db_version < 11958 ) {
1262
+	if ($wp_current_db_version < 11958) {
1263 1263
 		// Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion
1264
-		if ( get_option( 'thread_comments_depth' ) == '1' ) {
1265
-			update_option( 'thread_comments_depth', 2 );
1266
-			update_option( 'thread_comments', 0 );
1264
+		if (get_option('thread_comments_depth') == '1') {
1265
+			update_option('thread_comments_depth', 2);
1266
+			update_option('thread_comments', 0);
1267 1267
 		}
1268 1268
 	}
1269 1269
 }
@@ -1280,14 +1280,14 @@  discard block
 block discarded – undo
1280 1280
 function upgrade_300() {
1281 1281
 	global $wp_current_db_version, $wpdb;
1282 1282
 
1283
-	if ( $wp_current_db_version < 15093 )
1283
+	if ($wp_current_db_version < 15093)
1284 1284
 		populate_roles_300();
1285 1285
 
1286
-	if ( $wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined( 'MULTISITE' ) && get_site_option( 'siteurl' ) === false )
1287
-		add_site_option( 'siteurl', '' );
1286
+	if ($wp_current_db_version < 14139 && is_multisite() && is_main_site() && ! defined('MULTISITE') && get_site_option('siteurl') === false)
1287
+		add_site_option('siteurl', '');
1288 1288
 
1289 1289
 	// 3.0 screen options key name changes.
1290
-	if ( wp_should_upgrade_global_tables() ) {
1290
+	if (wp_should_upgrade_global_tables()) {
1291 1291
 		$sql = "DELETE FROM $wpdb->usermeta
1292 1292
 			WHERE meta_key LIKE %s
1293 1293
 			OR meta_key LIKE %s
@@ -1301,15 +1301,15 @@  discard block
 block discarded – undo
1301 1301
 			OR meta_key = 'manageeditcolumnshidden'
1302 1302
 			OR meta_key = 'categories_per_page'
1303 1303
 			OR meta_key = 'edit_tags_per_page'";
1304
-		$prefix = $wpdb->esc_like( $wpdb->base_prefix );
1305
-		$wpdb->query( $wpdb->prepare( $sql,
1306
-			$prefix . '%' . $wpdb->esc_like( 'meta-box-hidden' ) . '%',
1307
-			$prefix . '%' . $wpdb->esc_like( 'closedpostboxes' ) . '%',
1308
-			$prefix . '%' . $wpdb->esc_like( 'manage-'	   ) . '%' . $wpdb->esc_like( '-columns-hidden' ) . '%',
1309
-			$prefix . '%' . $wpdb->esc_like( 'meta-box-order'  ) . '%',
1310
-			$prefix . '%' . $wpdb->esc_like( 'metaboxorder'    ) . '%',
1311
-			$prefix . '%' . $wpdb->esc_like( 'screen_layout'   ) . '%'
1312
-		) );
1304
+		$prefix = $wpdb->esc_like($wpdb->base_prefix);
1305
+		$wpdb->query($wpdb->prepare($sql,
1306
+			$prefix.'%'.$wpdb->esc_like('meta-box-hidden').'%',
1307
+			$prefix.'%'.$wpdb->esc_like('closedpostboxes').'%',
1308
+			$prefix.'%'.$wpdb->esc_like('manage-').'%'.$wpdb->esc_like('-columns-hidden').'%',
1309
+			$prefix.'%'.$wpdb->esc_like('meta-box-order').'%',
1310
+			$prefix.'%'.$wpdb->esc_like('metaboxorder').'%',
1311
+			$prefix.'%'.$wpdb->esc_like('screen_layout').'%'
1312
+		));
1313 1313
 	}
1314 1314
 
1315 1315
 }
@@ -1328,52 +1328,52 @@  discard block
 block discarded – undo
1328 1328
 function upgrade_330() {
1329 1329
 	global $wp_current_db_version, $wpdb, $wp_registered_widgets, $sidebars_widgets;
1330 1330
 
1331
-	if ( $wp_current_db_version < 19061 && wp_should_upgrade_global_tables() ) {
1332
-		$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')" );
1331
+	if ($wp_current_db_version < 19061 && wp_should_upgrade_global_tables()) {
1332
+		$wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key IN ('show_admin_bar_admin', 'plugins_last_view')");
1333 1333
 	}
1334 1334
 
1335
-	if ( $wp_current_db_version >= 11548 )
1335
+	if ($wp_current_db_version >= 11548)
1336 1336
 		return;
1337 1337
 
1338
-	$sidebars_widgets = get_option( 'sidebars_widgets', array() );
1338
+	$sidebars_widgets = get_option('sidebars_widgets', array());
1339 1339
 	$_sidebars_widgets = array();
1340 1340
 
1341
-	if ( isset($sidebars_widgets['wp_inactive_widgets']) || empty($sidebars_widgets) )
1341
+	if (isset($sidebars_widgets['wp_inactive_widgets']) || empty($sidebars_widgets))
1342 1342
 		$sidebars_widgets['array_version'] = 3;
1343
-	elseif ( !isset($sidebars_widgets['array_version']) )
1343
+	elseif ( ! isset($sidebars_widgets['array_version']))
1344 1344
 		$sidebars_widgets['array_version'] = 1;
1345 1345
 
1346
-	switch ( $sidebars_widgets['array_version'] ) {
1346
+	switch ($sidebars_widgets['array_version']) {
1347 1347
 		case 1 :
1348
-			foreach ( (array) $sidebars_widgets as $index => $sidebar )
1349
-			if ( is_array($sidebar) )
1350
-			foreach ( (array) $sidebar as $i => $name ) {
1348
+			foreach ((array) $sidebars_widgets as $index => $sidebar)
1349
+			if (is_array($sidebar))
1350
+			foreach ((array) $sidebar as $i => $name) {
1351 1351
 				$id = strtolower($name);
1352
-				if ( isset($wp_registered_widgets[$id]) ) {
1352
+				if (isset($wp_registered_widgets[$id])) {
1353 1353
 					$_sidebars_widgets[$index][$i] = $id;
1354 1354
 					continue;
1355 1355
 				}
1356 1356
 				$id = sanitize_title($name);
1357
-				if ( isset($wp_registered_widgets[$id]) ) {
1357
+				if (isset($wp_registered_widgets[$id])) {
1358 1358
 					$_sidebars_widgets[$index][$i] = $id;
1359 1359
 					continue;
1360 1360
 				}
1361 1361
 
1362 1362
 				$found = false;
1363 1363
 
1364
-				foreach ( $wp_registered_widgets as $widget_id => $widget ) {
1365
-					if ( strtolower($widget['name']) == strtolower($name) ) {
1364
+				foreach ($wp_registered_widgets as $widget_id => $widget) {
1365
+					if (strtolower($widget['name']) == strtolower($name)) {
1366 1366
 						$_sidebars_widgets[$index][$i] = $widget['id'];
1367 1367
 						$found = true;
1368 1368
 						break;
1369
-					} elseif ( sanitize_title($widget['name']) == sanitize_title($name) ) {
1369
+					} elseif (sanitize_title($widget['name']) == sanitize_title($name)) {
1370 1370
 						$_sidebars_widgets[$index][$i] = $widget['id'];
1371 1371
 						$found = true;
1372 1372
 						break;
1373 1373
 					}
1374 1374
 				}
1375 1375
 
1376
-				if ( $found )
1376
+				if ($found)
1377 1377
 					continue;
1378 1378
 
1379 1379
 				unset($_sidebars_widgets[$index][$i]);
@@ -1385,7 +1385,7 @@  discard block
 block discarded – undo
1385 1385
 		case 2 :
1386 1386
 			$sidebars_widgets = retrieve_widgets();
1387 1387
 			$sidebars_widgets['array_version'] = 3;
1388
-			update_option( 'sidebars_widgets', $sidebars_widgets );
1388
+			update_option('sidebars_widgets', $sidebars_widgets);
1389 1389
 	}
1390 1390
 }
1391 1391
 
@@ -1401,27 +1401,27 @@  discard block
 block discarded – undo
1401 1401
 function upgrade_340() {
1402 1402
 	global $wp_current_db_version, $wpdb;
1403 1403
 
1404
-	if ( $wp_current_db_version < 19798 ) {
1404
+	if ($wp_current_db_version < 19798) {
1405 1405
 		$wpdb->hide_errors();
1406
-		$wpdb->query( "ALTER TABLE $wpdb->options DROP COLUMN blog_id" );
1406
+		$wpdb->query("ALTER TABLE $wpdb->options DROP COLUMN blog_id");
1407 1407
 		$wpdb->show_errors();
1408 1408
 	}
1409 1409
 
1410
-	if ( $wp_current_db_version < 19799 ) {
1410
+	if ($wp_current_db_version < 19799) {
1411 1411
 		$wpdb->hide_errors();
1412 1412
 		$wpdb->query("ALTER TABLE $wpdb->comments DROP INDEX comment_approved");
1413 1413
 		$wpdb->show_errors();
1414 1414
 	}
1415 1415
 
1416
-	if ( $wp_current_db_version < 20022 && wp_should_upgrade_global_tables() ) {
1417
-		$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'" );
1416
+	if ($wp_current_db_version < 20022 && wp_should_upgrade_global_tables()) {
1417
+		$wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key = 'themes_last_view'");
1418 1418
 	}
1419 1419
 
1420
-	if ( $wp_current_db_version < 20080 ) {
1421
-		if ( 'yes' == $wpdb->get_var( "SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'" ) ) {
1422
-			$uninstall_plugins = get_option( 'uninstall_plugins' );
1423
-			delete_option( 'uninstall_plugins' );
1424
-			add_option( 'uninstall_plugins', $uninstall_plugins, null, 'no' );
1420
+	if ($wp_current_db_version < 20080) {
1421
+		if ('yes' == $wpdb->get_var("SELECT autoload FROM $wpdb->options WHERE option_name = 'uninstall_plugins'")) {
1422
+			$uninstall_plugins = get_option('uninstall_plugins');
1423
+			delete_option('uninstall_plugins');
1424
+			add_option('uninstall_plugins', $uninstall_plugins, null, 'no');
1425 1425
 		}
1426 1426
 	}
1427 1427
 }
@@ -1438,23 +1438,23 @@  discard block
 block discarded – undo
1438 1438
 function upgrade_350() {
1439 1439
 	global $wp_current_db_version, $wpdb;
1440 1440
 
1441
-	if ( $wp_current_db_version < 22006 && $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
1442
-		update_option( 'link_manager_enabled', 1 ); // Previously set to 0 by populate_options()
1441
+	if ($wp_current_db_version < 22006 && $wpdb->get_var("SELECT link_id FROM $wpdb->links LIMIT 1"))
1442
+		update_option('link_manager_enabled', 1); // Previously set to 0 by populate_options()
1443 1443
 
1444
-	if ( $wp_current_db_version < 21811 && wp_should_upgrade_global_tables() ) {
1444
+	if ($wp_current_db_version < 21811 && wp_should_upgrade_global_tables()) {
1445 1445
 		$meta_keys = array();
1446
-		foreach ( array_merge( get_post_types(), get_taxonomies() ) as $name ) {
1447
-			if ( false !== strpos( $name, '-' ) )
1448
-			$meta_keys[] = 'edit_' . str_replace( '-', '_', $name ) . '_per_page';
1446
+		foreach (array_merge(get_post_types(), get_taxonomies()) as $name) {
1447
+			if (false !== strpos($name, '-'))
1448
+			$meta_keys[] = 'edit_'.str_replace('-', '_', $name).'_per_page';
1449 1449
 		}
1450
-		if ( $meta_keys ) {
1451
-			$meta_keys = implode( "', '", $meta_keys );
1452
-			$wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')" );
1450
+		if ($meta_keys) {
1451
+			$meta_keys = implode("', '", $meta_keys);
1452
+			$wpdb->query("DELETE FROM $wpdb->usermeta WHERE meta_key IN ('$meta_keys')");
1453 1453
 		}
1454 1454
 	}
1455 1455
 
1456
-	if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) )
1457
-		wp_delete_term( $term->term_id, 'post_format' );
1456
+	if ($wp_current_db_version < 22422 && $term = get_term_by('slug', 'post-format-standard', 'post_format'))
1457
+		wp_delete_term($term->term_id, 'post_format');
1458 1458
 }
1459 1459
 
1460 1460
 /**
@@ -1467,8 +1467,8 @@  discard block
 block discarded – undo
1467 1467
  */
1468 1468
 function upgrade_370() {
1469 1469
 	global $wp_current_db_version;
1470
-	if ( $wp_current_db_version < 25824 )
1471
-		wp_clear_scheduled_hook( 'wp_auto_updates_maybe_update' );
1470
+	if ($wp_current_db_version < 25824)
1471
+		wp_clear_scheduled_hook('wp_auto_updates_maybe_update');
1472 1472
 }
1473 1473
 
1474 1474
 /**
@@ -1482,8 +1482,8 @@  discard block
 block discarded – undo
1482 1482
  */
1483 1483
 function upgrade_372() {
1484 1484
 	global $wp_current_db_version;
1485
-	if ( $wp_current_db_version < 26148 )
1486
-		wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
1485
+	if ($wp_current_db_version < 26148)
1486
+		wp_clear_scheduled_hook('wp_maybe_auto_update');
1487 1487
 }
1488 1488
 
1489 1489
 /**
@@ -1496,8 +1496,8 @@  discard block
 block discarded – undo
1496 1496
  */
1497 1497
 function upgrade_380() {
1498 1498
 	global $wp_current_db_version;
1499
-	if ( $wp_current_db_version < 26691 ) {
1500
-		deactivate_plugins( array( 'mp6/mp6.php' ), true );
1499
+	if ($wp_current_db_version < 26691) {
1500
+		deactivate_plugins(array('mp6/mp6.php'), true);
1501 1501
 	}
1502 1502
 }
1503 1503
 
@@ -1511,12 +1511,12 @@  discard block
 block discarded – undo
1511 1511
  */
1512 1512
 function upgrade_400() {
1513 1513
 	global $wp_current_db_version;
1514
-	if ( $wp_current_db_version < 29630 ) {
1515
-		if ( ! is_multisite() && false === get_option( 'WPLANG' ) ) {
1516
-			if ( defined( 'WPLANG' ) && ( '' !== WPLANG ) && in_array( WPLANG, get_available_languages() ) ) {
1517
-				update_option( 'WPLANG', WPLANG );
1514
+	if ($wp_current_db_version < 29630) {
1515
+		if ( ! is_multisite() && false === get_option('WPLANG')) {
1516
+			if (defined('WPLANG') && ('' !== WPLANG) && in_array(WPLANG, get_available_languages())) {
1517
+				update_option('WPLANG', WPLANG);
1518 1518
 			} else {
1519
-				update_option( 'WPLANG', '' );
1519
+				update_option('WPLANG', '');
1520 1520
 			}
1521 1521
 		}
1522 1522
 	}
@@ -1545,29 +1545,29 @@  discard block
 block discarded – undo
1545 1545
 function upgrade_430() {
1546 1546
 	global $wp_current_db_version, $wpdb;
1547 1547
 
1548
-	if ( $wp_current_db_version < 32364 ) {
1548
+	if ($wp_current_db_version < 32364) {
1549 1549
 		upgrade_430_fix_comments();
1550 1550
 	}
1551 1551
 
1552 1552
 	// Shared terms are split in a separate process.
1553
-	if ( $wp_current_db_version < 32814 ) {
1554
-		update_option( 'finished_splitting_shared_terms', 0 );
1555
-		wp_schedule_single_event( time() + ( 1 * MINUTE_IN_SECONDS ), 'wp_split_shared_term_batch' );
1553
+	if ($wp_current_db_version < 32814) {
1554
+		update_option('finished_splitting_shared_terms', 0);
1555
+		wp_schedule_single_event(time() + (1 * MINUTE_IN_SECONDS), 'wp_split_shared_term_batch');
1556 1556
 	}
1557 1557
 
1558
-	if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) {
1559
-		if ( is_multisite() ) {
1560
-			$tables = $wpdb->tables( 'blog' );
1558
+	if ($wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset) {
1559
+		if (is_multisite()) {
1560
+			$tables = $wpdb->tables('blog');
1561 1561
 		} else {
1562
-			$tables = $wpdb->tables( 'all' );
1563
-			if ( ! wp_should_upgrade_global_tables() ) {
1564
-				$global_tables = $wpdb->tables( 'global' );
1565
-				$tables = array_diff_assoc( $tables, $global_tables );
1562
+			$tables = $wpdb->tables('all');
1563
+			if ( ! wp_should_upgrade_global_tables()) {
1564
+				$global_tables = $wpdb->tables('global');
1565
+				$tables = array_diff_assoc($tables, $global_tables);
1566 1566
 			}
1567 1567
 		}
1568 1568
 
1569
-		foreach ( $tables as $table ) {
1570
-			maybe_convert_table_to_utf8mb4( $table );
1569
+		foreach ($tables as $table) {
1570
+			maybe_convert_table_to_utf8mb4($table);
1571 1571
 		}
1572 1572
 	}
1573 1573
 }
@@ -1584,18 +1584,18 @@  discard block
 block discarded – undo
1584 1584
 function upgrade_430_fix_comments() {
1585 1585
 	global $wp_current_db_version, $wpdb;
1586 1586
 
1587
-	$content_length = $wpdb->get_col_length( $wpdb->comments, 'comment_content' );
1587
+	$content_length = $wpdb->get_col_length($wpdb->comments, 'comment_content');
1588 1588
 
1589
-	if ( is_wp_error( $content_length ) ) {
1589
+	if (is_wp_error($content_length)) {
1590 1590
 		return;
1591 1591
 	}
1592 1592
 
1593
-	if ( false === $content_length ) {
1593
+	if (false === $content_length) {
1594 1594
 		$content_length = array(
1595 1595
 			'type'   => 'byte',
1596 1596
 			'length' => 65535,
1597 1597
 		);
1598
-	} elseif ( ! is_array( $content_length ) ) {
1598
+	} elseif ( ! is_array($content_length)) {
1599 1599
 		$length = (int) $content_length > 0 ? (int) $content_length : 65535;
1600 1600
 		$content_length = array(
1601 1601
 			'type'	 => 'byte',
@@ -1603,12 +1603,12 @@  discard block
 block discarded – undo
1603 1603
 		);
1604 1604
 	}
1605 1605
 
1606
-	if ( 'byte' !== $content_length['type'] || 0 === $content_length['length'] ) {
1606
+	if ('byte' !== $content_length['type'] || 0 === $content_length['length']) {
1607 1607
 		// Sites with malformed DB schemas are on their own.
1608 1608
 		return;
1609 1609
 	}
1610 1610
 
1611
-	$allowed_length = intval( $content_length['length'] ) - 10;
1611
+	$allowed_length = intval($content_length['length']) - 10;
1612 1612
 
1613 1613
 	$comments = $wpdb->get_results(
1614 1614
 		"SELECT `comment_ID` FROM `{$wpdb->comments}`
@@ -1617,8 +1617,8 @@  discard block
 block discarded – undo
1617 1617
 			AND ( `comment_content` LIKE '%<%' OR `comment_content` LIKE '%>%' )"
1618 1618
 	);
1619 1619
 
1620
-	foreach ( $comments as $comment ) {
1621
-		wp_delete_comment( $comment->comment_ID, true );
1620
+	foreach ($comments as $comment) {
1621
+		wp_delete_comment($comment->comment_ID, true);
1622 1622
 	}
1623 1623
 }
1624 1624
 
@@ -1631,9 +1631,9 @@  discard block
 block discarded – undo
1631 1631
 function upgrade_431() {
1632 1632
 	// Fix incorrect cron entries for term splitting
1633 1633
 	$cron_array = _get_cron_array();
1634
-	if ( isset( $cron_array['wp_batch_split_terms'] ) ) {
1635
-		unset( $cron_array['wp_batch_split_terms'] );
1636
-		_set_cron_array( $cron_array );
1634
+	if (isset($cron_array['wp_batch_split_terms'])) {
1635
+		unset($cron_array['wp_batch_split_terms']);
1636
+		_set_cron_array($cron_array);
1637 1637
 	}
1638 1638
 }
1639 1639
 
@@ -1649,15 +1649,15 @@  discard block
 block discarded – undo
1649 1649
 function upgrade_440() {
1650 1650
 	global $wp_current_db_version, $wpdb;
1651 1651
 
1652
-	if ( $wp_current_db_version < 34030 ) {
1653
-		$wpdb->query( "ALTER TABLE {$wpdb->options} MODIFY option_name VARCHAR(191)" );
1652
+	if ($wp_current_db_version < 34030) {
1653
+		$wpdb->query("ALTER TABLE {$wpdb->options} MODIFY option_name VARCHAR(191)");
1654 1654
 	}
1655 1655
 
1656 1656
 	// Remove the unused 'add_users' role.
1657 1657
 	$roles = wp_roles();
1658
-	foreach ( $roles->role_objects as $role ) {
1659
-		if ( $role->has_cap( 'add_users' ) ) {
1660
-			$role->remove_cap( 'add_users' );
1658
+	foreach ($roles->role_objects as $role) {
1659
+		if ($role->has_cap('add_users')) {
1660
+			$role->remove_cap('add_users');
1661 1661
 		}
1662 1662
 	}
1663 1663
 }
@@ -1674,17 +1674,17 @@  discard block
 block discarded – undo
1674 1674
 function upgrade_450() {
1675 1675
 	global $wp_current_db_version, $wpdb;
1676 1676
 
1677
-	if ( $wp_current_db_version < 36180 ) {
1678
-		wp_clear_scheduled_hook( 'wp_maybe_auto_update' );
1677
+	if ($wp_current_db_version < 36180) {
1678
+		wp_clear_scheduled_hook('wp_maybe_auto_update');
1679 1679
 	}
1680 1680
 
1681 1681
 	// Remove unused email confirmation options, moved to usermeta.
1682
-	if ( $wp_current_db_version < 36679 && is_multisite() ) {
1683
-		$wpdb->query( "DELETE FROM $wpdb->options WHERE option_name REGEXP '^[0-9]+_new_email$'" );
1682
+	if ($wp_current_db_version < 36679 && is_multisite()) {
1683
+		$wpdb->query("DELETE FROM $wpdb->options WHERE option_name REGEXP '^[0-9]+_new_email$'");
1684 1684
 	}
1685 1685
 
1686 1686
 	// Remove unused user setting for wpLink.
1687
-	delete_user_setting( 'wplink' );
1687
+	delete_user_setting('wplink');
1688 1688
 }
1689 1689
 
1690 1690
 /**
@@ -1699,7 +1699,7 @@  discard block
 block discarded – undo
1699 1699
 	global $wp_current_db_version, $wpdb;
1700 1700
 
1701 1701
 	// Always.
1702
-	if ( is_main_network() ) {
1702
+	if (is_main_network()) {
1703 1703
 		/*
1704 1704
 		 * Deletes all expired transients. The multi-table delete syntax is used
1705 1705
 		 * to delete the transient record from table a, and the corresponding
@@ -1711,32 +1711,32 @@  discard block
 block discarded – undo
1711 1711
 			AND a.meta_key NOT LIKE %s
1712 1712
 			AND b.meta_key = CONCAT( '_site_transient_timeout_', SUBSTRING( a.meta_key, 17 ) )
1713 1713
 			AND b.meta_value < %d";
1714
-		$wpdb->query( $wpdb->prepare( $sql, $wpdb->esc_like( '_site_transient_' ) . '%', $wpdb->esc_like ( '_site_transient_timeout_' ) . '%', $time ) );
1714
+		$wpdb->query($wpdb->prepare($sql, $wpdb->esc_like('_site_transient_').'%', $wpdb->esc_like('_site_transient_timeout_').'%', $time));
1715 1715
 	}
1716 1716
 
1717 1717
 	// 2.8.
1718
-	if ( $wp_current_db_version < 11549 ) {
1719
-		$wpmu_sitewide_plugins = get_site_option( 'wpmu_sitewide_plugins' );
1720
-		$active_sitewide_plugins = get_site_option( 'active_sitewide_plugins' );
1721
-		if ( $wpmu_sitewide_plugins ) {
1722
-			if ( !$active_sitewide_plugins )
1718
+	if ($wp_current_db_version < 11549) {
1719
+		$wpmu_sitewide_plugins = get_site_option('wpmu_sitewide_plugins');
1720
+		$active_sitewide_plugins = get_site_option('active_sitewide_plugins');
1721
+		if ($wpmu_sitewide_plugins) {
1722
+			if ( ! $active_sitewide_plugins)
1723 1723
 				$sitewide_plugins = (array) $wpmu_sitewide_plugins;
1724 1724
 			else
1725
-				$sitewide_plugins = array_merge( (array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins );
1725
+				$sitewide_plugins = array_merge((array) $active_sitewide_plugins, (array) $wpmu_sitewide_plugins);
1726 1726
 
1727
-			update_site_option( 'active_sitewide_plugins', $sitewide_plugins );
1727
+			update_site_option('active_sitewide_plugins', $sitewide_plugins);
1728 1728
 		}
1729
-		delete_site_option( 'wpmu_sitewide_plugins' );
1730
-		delete_site_option( 'deactivated_sitewide_plugins' );
1729
+		delete_site_option('wpmu_sitewide_plugins');
1730
+		delete_site_option('deactivated_sitewide_plugins');
1731 1731
 
1732 1732
 		$start = 0;
1733
-		while( $rows = $wpdb->get_results( "SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20" ) ) {
1734
-			foreach ( $rows as $row ) {
1733
+		while ($rows = $wpdb->get_results("SELECT meta_key, meta_value FROM {$wpdb->sitemeta} ORDER BY meta_id LIMIT $start, 20")) {
1734
+			foreach ($rows as $row) {
1735 1735
 				$value = $row->meta_value;
1736
-				if ( !@unserialize( $value ) )
1737
-					$value = stripslashes( $value );
1738
-				if ( $value !== $row->meta_value ) {
1739
-					update_site_option( $row->meta_key, $value );
1736
+				if ( ! @unserialize($value))
1737
+					$value = stripslashes($value);
1738
+				if ($value !== $row->meta_value) {
1739
+					update_site_option($row->meta_key, $value);
1740 1740
 				}
1741 1741
 			}
1742 1742
 			$start += 20;
@@ -1744,95 +1744,95 @@  discard block
 block discarded – undo
1744 1744
 	}
1745 1745
 
1746 1746
 	// 3.0
1747
-	if ( $wp_current_db_version < 13576 )
1748
-		update_site_option( 'global_terms_enabled', '1' );
1747
+	if ($wp_current_db_version < 13576)
1748
+		update_site_option('global_terms_enabled', '1');
1749 1749
 
1750 1750
 	// 3.3
1751
-	if ( $wp_current_db_version < 19390 )
1752
-		update_site_option( 'initial_db_version', $wp_current_db_version );
1751
+	if ($wp_current_db_version < 19390)
1752
+		update_site_option('initial_db_version', $wp_current_db_version);
1753 1753
 
1754
-	if ( $wp_current_db_version < 19470 ) {
1755
-		if ( false === get_site_option( 'active_sitewide_plugins' ) )
1756
-			update_site_option( 'active_sitewide_plugins', array() );
1754
+	if ($wp_current_db_version < 19470) {
1755
+		if (false === get_site_option('active_sitewide_plugins'))
1756
+			update_site_option('active_sitewide_plugins', array());
1757 1757
 	}
1758 1758
 
1759 1759
 	// 3.4
1760
-	if ( $wp_current_db_version < 20148 ) {
1760
+	if ($wp_current_db_version < 20148) {
1761 1761
 		// 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
1762
-		$allowedthemes  = get_site_option( 'allowedthemes'  );
1763
-		$allowed_themes = get_site_option( 'allowed_themes' );
1764
-		if ( false === $allowedthemes && is_array( $allowed_themes ) && $allowed_themes ) {
1762
+		$allowedthemes  = get_site_option('allowedthemes');
1763
+		$allowed_themes = get_site_option('allowed_themes');
1764
+		if (false === $allowedthemes && is_array($allowed_themes) && $allowed_themes) {
1765 1765
 			$converted = array();
1766 1766
 			$themes = wp_get_themes();
1767
-			foreach ( $themes as $stylesheet => $theme_data ) {
1768
-				if ( isset( $allowed_themes[ $theme_data->get('Name') ] ) )
1769
-					$converted[ $stylesheet ] = true;
1767
+			foreach ($themes as $stylesheet => $theme_data) {
1768
+				if (isset($allowed_themes[$theme_data->get('Name')]))
1769
+					$converted[$stylesheet] = true;
1770 1770
 			}
1771
-			update_site_option( 'allowedthemes', $converted );
1772
-			delete_site_option( 'allowed_themes' );
1771
+			update_site_option('allowedthemes', $converted);
1772
+			delete_site_option('allowed_themes');
1773 1773
 		}
1774 1774
 	}
1775 1775
 
1776 1776
 	// 3.5
1777
-	if ( $wp_current_db_version < 21823 )
1778
-		update_site_option( 'ms_files_rewriting', '1' );
1777
+	if ($wp_current_db_version < 21823)
1778
+		update_site_option('ms_files_rewriting', '1');
1779 1779
 
1780 1780
 	// 3.5.2
1781
-	if ( $wp_current_db_version < 24448 ) {
1782
-		$illegal_names = get_site_option( 'illegal_names' );
1783
-		if ( is_array( $illegal_names ) && count( $illegal_names ) === 1 ) {
1784
-			$illegal_name = reset( $illegal_names );
1785
-			$illegal_names = explode( ' ', $illegal_name );
1786
-			update_site_option( 'illegal_names', $illegal_names );
1781
+	if ($wp_current_db_version < 24448) {
1782
+		$illegal_names = get_site_option('illegal_names');
1783
+		if (is_array($illegal_names) && count($illegal_names) === 1) {
1784
+			$illegal_name = reset($illegal_names);
1785
+			$illegal_names = explode(' ', $illegal_name);
1786
+			update_site_option('illegal_names', $illegal_names);
1787 1787
 		}
1788 1788
 	}
1789 1789
 
1790 1790
 	// 4.2
1791
-	if ( $wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4' ) {
1792
-		if ( wp_should_upgrade_global_tables() ) {
1793
-			$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
1794
-			$wpdb->query( "ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))" );
1795
-			$wpdb->query( "ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
1796
-			$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
1791
+	if ($wp_current_db_version < 31351 && $wpdb->charset === 'utf8mb4') {
1792
+		if (wp_should_upgrade_global_tables()) {
1793
+			$wpdb->query("ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
1794
+			$wpdb->query("ALTER TABLE $wpdb->site DROP INDEX domain, ADD INDEX domain(domain(140),path(51))");
1795
+			$wpdb->query("ALTER TABLE $wpdb->sitemeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
1796
+			$wpdb->query("ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))");
1797 1797
 
1798
-			$tables = $wpdb->tables( 'global' );
1798
+			$tables = $wpdb->tables('global');
1799 1799
 
1800 1800
 			// sitecategories may not exist.
1801
-			if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) {
1802
-				unset( $tables['sitecategories'] );
1801
+			if ( ! $wpdb->get_var("SHOW TABLES LIKE '{$tables['sitecategories']}'")) {
1802
+				unset($tables['sitecategories']);
1803 1803
 			}
1804 1804
 
1805
-			foreach ( $tables as $table ) {
1806
-				maybe_convert_table_to_utf8mb4( $table );
1805
+			foreach ($tables as $table) {
1806
+				maybe_convert_table_to_utf8mb4($table);
1807 1807
 			}
1808 1808
 		}
1809 1809
 	}
1810 1810
 
1811 1811
 	// 4.3
1812
-	if ( $wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset ) {
1813
-		if ( wp_should_upgrade_global_tables() ) {
1812
+	if ($wp_current_db_version < 33055 && 'utf8mb4' === $wpdb->charset) {
1813
+		if (wp_should_upgrade_global_tables()) {
1814 1814
 			$upgrade = false;
1815
-			$indexes = $wpdb->get_results( "SHOW INDEXES FROM $wpdb->signups" );
1816
-			foreach ( $indexes as $index ) {
1817
-				if ( 'domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part ) {
1815
+			$indexes = $wpdb->get_results("SHOW INDEXES FROM $wpdb->signups");
1816
+			foreach ($indexes as $index) {
1817
+				if ('domain_path' == $index->Key_name && 'domain' == $index->Column_name && 140 != $index->Sub_part) {
1818 1818
 					$upgrade = true;
1819 1819
 					break;
1820 1820
 				}
1821 1821
 			}
1822 1822
 
1823
-			if ( $upgrade ) {
1824
-				$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))" );
1823
+			if ($upgrade) {
1824
+				$wpdb->query("ALTER TABLE $wpdb->signups DROP INDEX domain_path, ADD INDEX domain_path(domain(140),path(51))");
1825 1825
 			}
1826 1826
 
1827
-			$tables = $wpdb->tables( 'global' );
1827
+			$tables = $wpdb->tables('global');
1828 1828
 
1829 1829
 			// sitecategories may not exist.
1830
-			if ( ! $wpdb->get_var( "SHOW TABLES LIKE '{$tables['sitecategories']}'" ) ) {
1831
-				unset( $tables['sitecategories'] );
1830
+			if ( ! $wpdb->get_var("SHOW TABLES LIKE '{$tables['sitecategories']}'")) {
1831
+				unset($tables['sitecategories']);
1832 1832
 			}
1833 1833
 
1834
-			foreach ( $tables as $table ) {
1835
-				maybe_convert_table_to_utf8mb4( $table );
1834
+			foreach ($tables as $table) {
1835
+				maybe_convert_table_to_utf8mb4($table);
1836 1836
 			}
1837 1837
 		}
1838 1838
 	}
@@ -1860,9 +1860,9 @@  discard block
 block discarded – undo
1860 1860
 function maybe_create_table($table_name, $create_ddl) {
1861 1861
 	global $wpdb;
1862 1862
 
1863
-	$query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) );
1863
+	$query = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($table_name));
1864 1864
 
1865
-	if ( $wpdb->get_var( $query ) == $table_name ) {
1865
+	if ($wpdb->get_var($query) == $table_name) {
1866 1866
 		return true;
1867 1867
 	}
1868 1868
 
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 	$wpdb->query($create_ddl);
1871 1871
 
1872 1872
 	// We cannot directly tell that whether this succeeded!
1873
-	if ( $wpdb->get_var( $query ) == $table_name ) {
1873
+	if ($wpdb->get_var($query) == $table_name) {
1874 1874
 		return true;
1875 1875
 	}
1876 1876
 	return false;
@@ -1931,7 +1931,7 @@  discard block
 block discarded – undo
1931 1931
  */
1932 1932
 function maybe_add_column($table_name, $column_name, $create_ddl) {
1933 1933
 	global $wpdb;
1934
-	foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
1934
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
1935 1935
 		if ($column == $column_name) {
1936 1936
 			return true;
1937 1937
 		}
@@ -1941,7 +1941,7 @@  discard block
 block discarded – undo
1941 1941
 	$wpdb->query($create_ddl);
1942 1942
 
1943 1943
 	// We cannot directly tell that whether this succeeded!
1944
-	foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
1944
+	foreach ($wpdb->get_col("DESC $table_name", 0) as $column) {
1945 1945
 		if ($column == $column_name) {
1946 1946
 			return true;
1947 1947
 		}
@@ -1959,37 +1959,37 @@  discard block
 block discarded – undo
1959 1959
  * @param string $table The table to convert.
1960 1960
  * @return bool true if the table was converted, false if it wasn't.
1961 1961
  */
1962
-function maybe_convert_table_to_utf8mb4( $table ) {
1962
+function maybe_convert_table_to_utf8mb4($table) {
1963 1963
 	global $wpdb;
1964 1964
 
1965
-	$results = $wpdb->get_results( "SHOW FULL COLUMNS FROM `$table`" );
1966
-	if ( ! $results ) {
1965
+	$results = $wpdb->get_results("SHOW FULL COLUMNS FROM `$table`");
1966
+	if ( ! $results) {
1967 1967
 		return false;
1968 1968
 	}
1969 1969
 
1970
-	foreach ( $results as $column ) {
1971
-		if ( $column->Collation ) {
1972
-			list( $charset ) = explode( '_', $column->Collation );
1973
-			$charset = strtolower( $charset );
1974
-			if ( 'utf8' !== $charset && 'utf8mb4' !== $charset ) {
1970
+	foreach ($results as $column) {
1971
+		if ($column->Collation) {
1972
+			list($charset) = explode('_', $column->Collation);
1973
+			$charset = strtolower($charset);
1974
+			if ('utf8' !== $charset && 'utf8mb4' !== $charset) {
1975 1975
 				// Don't upgrade tables that have non-utf8 columns.
1976 1976
 				return false;
1977 1977
 			}
1978 1978
 		}
1979 1979
 	}
1980 1980
 
1981
-	$table_details = $wpdb->get_row( "SHOW TABLE STATUS LIKE '$table'" );
1982
-	if ( ! $table_details ) {
1981
+	$table_details = $wpdb->get_row("SHOW TABLE STATUS LIKE '$table'");
1982
+	if ( ! $table_details) {
1983 1983
 		return false;
1984 1984
 	}
1985 1985
 
1986
-	list( $table_charset ) = explode( '_', $table_details->Collation );
1987
-	$table_charset = strtolower( $table_charset );
1988
-	if ( 'utf8mb4' === $table_charset ) {
1986
+	list($table_charset) = explode('_', $table_details->Collation);
1987
+	$table_charset = strtolower($table_charset);
1988
+	if ('utf8mb4' === $table_charset) {
1989 1989
 		return true;
1990 1990
 	}
1991 1991
 
1992
-	return $wpdb->query( "ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci" );
1992
+	return $wpdb->query("ALTER TABLE $table CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci");
1993 1993
 }
1994 1994
 
1995 1995
 /**
@@ -2004,11 +2004,11 @@  discard block
 block discarded – undo
2004 2004
 function get_alloptions_110() {
2005 2005
 	global $wpdb;
2006 2006
 	$all_options = new stdClass;
2007
-	if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) {
2008
-		foreach ( $options as $option ) {
2009
-			if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name )
2010
-				$option->option_value = untrailingslashit( $option->option_value );
2011
-			$all_options->{$option->option_name} = stripslashes( $option->option_value );
2007
+	if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
2008
+		foreach ($options as $option) {
2009
+			if ('siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name)
2010
+				$option->option_value = untrailingslashit($option->option_value);
2011
+			$all_options->{$option->option_name} = stripslashes($option->option_value);
2012 2012
 		}
2013 2013
 	}
2014 2014
 	return $all_options;
@@ -2029,21 +2029,21 @@  discard block
 block discarded – undo
2029 2029
 function __get_option($setting) {
2030 2030
 	global $wpdb;
2031 2031
 
2032
-	if ( $setting == 'home' && defined( 'WP_HOME' ) )
2033
-		return untrailingslashit( WP_HOME );
2032
+	if ($setting == 'home' && defined('WP_HOME'))
2033
+		return untrailingslashit(WP_HOME);
2034 2034
 
2035
-	if ( $setting == 'siteurl' && defined( 'WP_SITEURL' ) )
2036
-		return untrailingslashit( WP_SITEURL );
2035
+	if ($setting == 'siteurl' && defined('WP_SITEURL'))
2036
+		return untrailingslashit(WP_SITEURL);
2037 2037
 
2038
-	$option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting ) );
2038
+	$option = $wpdb->get_var($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting));
2039 2039
 
2040
-	if ( 'home' == $setting && '' == $option )
2041
-		return __get_option( 'siteurl' );
2040
+	if ('home' == $setting && '' == $option)
2041
+		return __get_option('siteurl');
2042 2042
 
2043
-	if ( 'siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting )
2044
-		$option = untrailingslashit( $option );
2043
+	if ('siteurl' == $setting || 'home' == $setting || 'category_base' == $setting || 'tag_base' == $setting)
2044
+		$option = untrailingslashit($option);
2045 2045
 
2046
-	return maybe_unserialize( $option );
2046
+	return maybe_unserialize($option);
2047 2047
 }
2048 2048
 
2049 2049
 /**
@@ -2091,16 +2091,16 @@  discard block
 block discarded – undo
2091 2091
  *                              Default true.
2092 2092
  * @return array Strings containing the results of the various update queries.
2093 2093
  */
2094
-function dbDelta( $queries = '', $execute = true ) {
2094
+function dbDelta($queries = '', $execute = true) {
2095 2095
 	global $wpdb;
2096 2096
 
2097
-	if ( in_array( $queries, array( '', 'all', 'blog', 'global', 'ms_global' ), true ) )
2098
-	    $queries = wp_get_db_schema( $queries );
2097
+	if (in_array($queries, array('', 'all', 'blog', 'global', 'ms_global'), true))
2098
+	    $queries = wp_get_db_schema($queries);
2099 2099
 
2100 2100
 	// Separate individual queries into an array
2101
-	if ( !is_array($queries) ) {
2102
-		$queries = explode( ';', $queries );
2103
-		$queries = array_filter( $queries );
2101
+	if ( ! is_array($queries)) {
2102
+		$queries = explode(';', $queries);
2103
+		$queries = array_filter($queries);
2104 2104
 	}
2105 2105
 
2106 2106
 	/**
@@ -2110,7 +2110,7 @@  discard block
 block discarded – undo
2110 2110
 	 *
2111 2111
 	 * @param array $queries An array of dbDelta SQL queries.
2112 2112
 	 */
2113
-	$queries = apply_filters( 'dbdelta_queries', $queries );
2113
+	$queries = apply_filters('dbdelta_queries', $queries);
2114 2114
 
2115 2115
 	$cqueries = array(); // Creation Queries
2116 2116
 	$iqueries = array(); // Insertion Queries
@@ -2118,14 +2118,14 @@  discard block
 block discarded – undo
2118 2118
 
2119 2119
 	// Create a tablename index for an array ($cqueries) of queries
2120 2120
 	foreach ($queries as $qry) {
2121
-		if ( preg_match( "|CREATE TABLE ([^ ]*)|", $qry, $matches ) ) {
2122
-			$cqueries[ trim( $matches[1], '`' ) ] = $qry;
2121
+		if (preg_match("|CREATE TABLE ([^ ]*)|", $qry, $matches)) {
2122
+			$cqueries[trim($matches[1], '`')] = $qry;
2123 2123
 			$for_update[$matches[1]] = 'Created table '.$matches[1];
2124
-		} elseif ( preg_match( "|CREATE DATABASE ([^ ]*)|", $qry, $matches ) ) {
2125
-			array_unshift( $cqueries, $qry );
2126
-		} elseif ( preg_match( "|INSERT INTO ([^ ]*)|", $qry, $matches ) ) {
2124
+		} elseif (preg_match("|CREATE DATABASE ([^ ]*)|", $qry, $matches)) {
2125
+			array_unshift($cqueries, $qry);
2126
+		} elseif (preg_match("|INSERT INTO ([^ ]*)|", $qry, $matches)) {
2127 2127
 			$iqueries[] = $qry;
2128
-		} elseif ( preg_match( "|UPDATE ([^ ]*)|", $qry, $matches ) ) {
2128
+		} elseif (preg_match("|UPDATE ([^ ]*)|", $qry, $matches)) {
2129 2129
 			$iqueries[] = $qry;
2130 2130
 		} else {
2131 2131
 			// Unrecognized query type
@@ -2141,7 +2141,7 @@  discard block
 block discarded – undo
2141 2141
 	 *
2142 2142
 	 * @param array $cqueries An array of dbDelta create SQL queries.
2143 2143
 	 */
2144
-	$cqueries = apply_filters( 'dbdelta_create_queries', $cqueries );
2144
+	$cqueries = apply_filters('dbdelta_create_queries', $cqueries);
2145 2145
 
2146 2146
 	/**
2147 2147
 	 * Filter the dbDelta SQL queries for inserting or updating.
@@ -2152,22 +2152,22 @@  discard block
 block discarded – undo
2152 2152
 	 *
2153 2153
 	 * @param array $iqueries An array of dbDelta insert or update SQL queries.
2154 2154
 	 */
2155
-	$iqueries = apply_filters( 'dbdelta_insert_queries', $iqueries );
2155
+	$iqueries = apply_filters('dbdelta_insert_queries', $iqueries);
2156 2156
 
2157
-	$global_tables = $wpdb->tables( 'global' );
2158
-	foreach ( $cqueries as $table => $qry ) {
2157
+	$global_tables = $wpdb->tables('global');
2158
+	foreach ($cqueries as $table => $qry) {
2159 2159
 		// Upgrade global tables only for the main site. Don't upgrade at all if conditions are not optimal.
2160
-		if ( in_array( $table, $global_tables ) && ! wp_should_upgrade_global_tables() ) {
2161
-			unset( $cqueries[ $table ], $for_update[ $table ] );
2160
+		if (in_array($table, $global_tables) && ! wp_should_upgrade_global_tables()) {
2161
+			unset($cqueries[$table], $for_update[$table]);
2162 2162
 			continue;
2163 2163
 		}
2164 2164
 
2165 2165
 		// Fetch the table column structure from the database
2166 2166
 		$suppress = $wpdb->suppress_errors();
2167 2167
 		$tablefields = $wpdb->get_results("DESCRIBE {$table};");
2168
-		$wpdb->suppress_errors( $suppress );
2168
+		$wpdb->suppress_errors($suppress);
2169 2169
 
2170
-		if ( ! $tablefields )
2170
+		if ( ! $tablefields)
2171 2171
 			continue;
2172 2172
 
2173 2173
 		// Clear the field and index arrays.
@@ -2188,7 +2188,7 @@  discard block
 block discarded – undo
2188 2188
 
2189 2189
 			// Extract the field name.
2190 2190
 			preg_match("|^([^ ]*)|", trim($fld), $fvals);
2191
-			$fieldname = trim( $fvals[1], '`' );
2191
+			$fieldname = trim($fvals[1], '`');
2192 2192
 
2193 2193
 			// Verify the found field name.
2194 2194
 			$validfield = true;
@@ -2224,7 +2224,7 @@  discard block
 block discarded – undo
2224 2224
 				// Is actual field type different from the field type in query?
2225 2225
 				if ($tablefield->Type != $fieldtype) {
2226 2226
 					// Add a query to change the column type
2227
-					$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} " . $cfields[strtolower($tablefield->Field)];
2227
+					$cqueries[] = "ALTER TABLE {$table} CHANGE COLUMN {$tablefield->Field} ".$cfields[strtolower($tablefield->Field)];
2228 2228
 					$for_update[$table.'.'.$tablefield->Field] = "Changed type of {$table}.{$tablefield->Field} from {$tablefield->Type} to {$fieldtype}";
2229 2229
 				}
2230 2230
 
@@ -2267,7 +2267,7 @@  discard block
 block discarded – undo
2267 2267
 				// Add the index to the index data array.
2268 2268
 				$keyname = $tableindex->Key_name;
2269 2269
 				$index_ary[$keyname]['columns'][] = array('fieldname' => $tableindex->Column_name, 'subpart' => $tableindex->Sub_part);
2270
-				$index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0)?true:false;
2270
+				$index_ary[$keyname]['unique'] = ($tableindex->Non_unique == 0) ? true : false;
2271 2271
 				$index_ary[$keyname]['index_type'] = $tableindex->Index_type;
2272 2272
 			}
2273 2273
 
@@ -2278,10 +2278,10 @@  discard block
 block discarded – undo
2278 2278
 				$index_string = '';
2279 2279
 				if ($index_name == 'PRIMARY') {
2280 2280
 					$index_string .= 'PRIMARY ';
2281
-				} elseif ( $index_data['unique'] ) {
2281
+				} elseif ($index_data['unique']) {
2282 2282
 					$index_string .= 'UNIQUE ';
2283 2283
 				}
2284
-				if ( 'FULLTEXT' === strtoupper( $index_data['index_type'] ) ) {
2284
+				if ('FULLTEXT' === strtoupper($index_data['index_type'])) {
2285 2285
 					$index_string .= 'FULLTEXT ';
2286 2286
 				}
2287 2287
 				$index_string .= 'KEY ';
@@ -2302,7 +2302,7 @@  discard block
 block discarded – undo
2302 2302
 				}
2303 2303
 
2304 2304
 				// The alternative index string doesn't care about subparts
2305
-				$alt_index_columns = preg_replace( '/\([^)]*\)/', '', $index_columns );
2305
+				$alt_index_columns = preg_replace('/\([^)]*\)/', '', $index_columns);
2306 2306
 
2307 2307
 				// Add the column list to the index create string.
2308 2308
 				$index_strings = array(
@@ -2310,9 +2310,9 @@  discard block
 block discarded – undo
2310 2310
 					"$index_string ($alt_index_columns)",
2311 2311
 				);
2312 2312
 
2313
-				foreach ( $index_strings as $index_string ) {
2314
-					if ( ! ( ( $aindex = array_search( $index_string, $indices ) ) === false ) ) {
2315
-						unset( $indices[ $aindex ] );
2313
+				foreach ($index_strings as $index_string) {
2314
+					if ( ! (($aindex = array_search($index_string, $indices)) === false)) {
2315
+						unset($indices[$aindex]);
2316 2316
 						break;
2317 2317
 						// todo: Remove this?
2318 2318
 						//echo "<pre style=\"border:1px solid #ccc;margin-top:5px;\">{$table}:<br />Found index:".$index_string."</pre>\n";
@@ -2324,14 +2324,14 @@  discard block
 block discarded – undo
2324 2324
 		}
2325 2325
 
2326 2326
 		// For every remaining index specified for the table.
2327
-		foreach ( (array) $indices as $index ) {
2327
+		foreach ((array) $indices as $index) {
2328 2328
 			// Push a query line into $cqueries that adds the index to that table.
2329 2329
 			$cqueries[] = "ALTER TABLE {$table} ADD $index";
2330
-			$for_update[] = 'Added index ' . $table . ' ' . $index;
2330
+			$for_update[] = 'Added index '.$table.' '.$index;
2331 2331
 		}
2332 2332
 
2333 2333
 		// Remove the original table creation query from processing.
2334
-		unset( $cqueries[ $table ], $for_update[ $table ] );
2334
+		unset($cqueries[$table], $for_update[$table]);
2335 2335
 	}
2336 2336
 
2337 2337
 	$allqueries = array_merge($cqueries, $iqueries);
@@ -2358,8 +2358,8 @@  discard block
 block discarded – undo
2358 2358
  *
2359 2359
  * @param string $tables Optional. Which set of tables to update. Default is 'all'.
2360 2360
  */
2361
-function make_db_current( $tables = 'all' ) {
2362
-	$alterations = dbDelta( $tables );
2361
+function make_db_current($tables = 'all') {
2362
+	$alterations = dbDelta($tables);
2363 2363
 	echo "<ol>\n";
2364 2364
 	foreach ($alterations as $alteration) echo "<li>$alteration</li>\n";
2365 2365
 	echo "</ol>\n";
@@ -2377,8 +2377,8 @@  discard block
 block discarded – undo
2377 2377
  *
2378 2378
  * @param string $tables Optional. Which set of tables to update. Default is 'all'.
2379 2379
  */
2380
-function make_db_current_silent( $tables = 'all' ) {
2381
-	dbDelta( $tables );
2380
+function make_db_current_silent($tables = 'all') {
2381
+	dbDelta($tables);
2382 2382
 }
2383 2383
 
2384 2384
 /**
@@ -2394,9 +2394,9 @@  discard block
 block discarded – undo
2394 2394
  */
2395 2395
 function make_site_theme_from_oldschool($theme_name, $template) {
2396 2396
 	$home_path = get_home_path();
2397
-	$site_dir = WP_CONTENT_DIR . "/themes/$template";
2397
+	$site_dir = WP_CONTENT_DIR."/themes/$template";
2398 2398
 
2399
-	if (! file_exists("$home_path/index.php"))
2399
+	if ( ! file_exists("$home_path/index.php"))
2400 2400
 		return false;
2401 2401
 
2402 2402
 	/*
@@ -2415,7 +2415,7 @@  discard block
 block discarded – undo
2415 2415
 		if ($oldfile == 'index.php') {
2416 2416
 			$index = implode('', file("$oldpath/$oldfile"));
2417 2417
 			if (strpos($index, 'WP_USE_THEMES') !== false) {
2418
-				if (! @copy(WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME . '/index.php', "$site_dir/$newfile"))
2418
+				if ( ! @copy(WP_CONTENT_DIR.'/themes/'.WP_DEFAULT_THEME.'/index.php', "$site_dir/$newfile"))
2419 2419
 					return false;
2420 2420
 
2421 2421
 				// Don't copy anything.
@@ -2423,7 +2423,7 @@  discard block
 block discarded – undo
2423 2423
 			}
2424 2424
 		}
2425 2425
 
2426
-		if (! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))
2426
+		if ( ! @copy("$oldpath/$oldfile", "$site_dir/$newfile"))
2427 2427
 			return false;
2428 2428
 
2429 2429
 		chmod("$site_dir/$newfile", 0777);
@@ -2435,7 +2435,7 @@  discard block
 block discarded – undo
2435 2435
 
2436 2436
 			foreach ($lines as $line) {
2437 2437
 				if (preg_match('/require.*wp-blog-header/', $line))
2438
-					$line = '//' . $line;
2438
+					$line = '//'.$line;
2439 2439
 
2440 2440
 				// Update stylesheet references.
2441 2441
 				$line = str_replace("<?php echo __get_option('siteurl'); ?>/wp-layout.css", "<?php bloginfo('stylesheet_url'); ?>", $line);
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
 	}
2451 2451
 
2452 2452
 	// Add a theme header.
2453
-	$header = "/*\nTheme Name: $theme_name\nTheme URI: " . __get_option('siteurl') . "\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n";
2453
+	$header = "/*\nTheme Name: $theme_name\nTheme URI: ".__get_option('siteurl')."\nDescription: A theme automatically created by the update.\nVersion: 1.0\nAuthor: Moi\n*/\n";
2454 2454
 
2455 2455
 	$stylelines = file_get_contents("$site_dir/style.css");
2456 2456
 	if ($stylelines) {
@@ -2476,18 +2476,18 @@  discard block
 block discarded – undo
2476 2476
  * @return false|void
2477 2477
  */
2478 2478
 function make_site_theme_from_default($theme_name, $template) {
2479
-	$site_dir = WP_CONTENT_DIR . "/themes/$template";
2480
-	$default_dir = WP_CONTENT_DIR . '/themes/' . WP_DEFAULT_THEME;
2479
+	$site_dir = WP_CONTENT_DIR."/themes/$template";
2480
+	$default_dir = WP_CONTENT_DIR.'/themes/'.WP_DEFAULT_THEME;
2481 2481
 
2482 2482
 	// Copy files from the default theme to the site theme.
2483 2483
 	//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
2484 2484
 
2485 2485
 	$theme_dir = @ opendir($default_dir);
2486 2486
 	if ($theme_dir) {
2487
-		while(($theme_file = readdir( $theme_dir )) !== false) {
2487
+		while (($theme_file = readdir($theme_dir)) !== false) {
2488 2488
 			if (is_dir("$default_dir/$theme_file"))
2489 2489
 				continue;
2490
-			if (! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
2490
+			if ( ! @copy("$default_dir/$theme_file", "$site_dir/$theme_file"))
2491 2491
 				return;
2492 2492
 			chmod("$site_dir/$theme_file", 0777);
2493 2493
 		}
@@ -2500,28 +2500,28 @@  discard block
 block discarded – undo
2500 2500
 		$f = fopen("$site_dir/style.css", 'w');
2501 2501
 
2502 2502
 		foreach ($stylelines as $line) {
2503
-			if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name;
2504
-			elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url');
2503
+			if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: '.$theme_name;
2504
+			elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: '.__get_option('url');
2505 2505
 			elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.';
2506 2506
 			elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1';
2507 2507
 			elseif (strpos($line, 'Author:') !== false) $line = 'Author: You';
2508
-			fwrite($f, $line . "\n");
2508
+			fwrite($f, $line."\n");
2509 2509
 		}
2510 2510
 		fclose($f);
2511 2511
 	}
2512 2512
 
2513 2513
 	// Copy the images.
2514 2514
 	umask(0);
2515
-	if (! mkdir("$site_dir/images", 0777)) {
2515
+	if ( ! mkdir("$site_dir/images", 0777)) {
2516 2516
 		return false;
2517 2517
 	}
2518 2518
 
2519 2519
 	$images_dir = @ opendir("$default_dir/images");
2520 2520
 	if ($images_dir) {
2521
-		while(($image = readdir($images_dir)) !== false) {
2521
+		while (($image = readdir($images_dir)) !== false) {
2522 2522
 			if (is_dir("$default_dir/images/$image"))
2523 2523
 				continue;
2524
-			if (! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
2524
+			if ( ! @copy("$default_dir/images/$image", "$site_dir/images/$image"))
2525 2525
 				return;
2526 2526
 			chmod("$site_dir/images/$image", 0777);
2527 2527
 		}
@@ -2542,30 +2542,30 @@  discard block
 block discarded – undo
2542 2542
 	// Name the theme after the blog.
2543 2543
 	$theme_name = __get_option('blogname');
2544 2544
 	$template = sanitize_title($theme_name);
2545
-	$site_dir = WP_CONTENT_DIR . "/themes/$template";
2545
+	$site_dir = WP_CONTENT_DIR."/themes/$template";
2546 2546
 
2547 2547
 	// If the theme already exists, nothing to do.
2548
-	if ( is_dir($site_dir)) {
2548
+	if (is_dir($site_dir)) {
2549 2549
 		return false;
2550 2550
 	}
2551 2551
 
2552 2552
 	// We must be able to write to the themes dir.
2553
-	if (! is_writable(WP_CONTENT_DIR . "/themes")) {
2553
+	if ( ! is_writable(WP_CONTENT_DIR."/themes")) {
2554 2554
 		return false;
2555 2555
 	}
2556 2556
 
2557 2557
 	umask(0);
2558
-	if (! mkdir($site_dir, 0777)) {
2558
+	if ( ! mkdir($site_dir, 0777)) {
2559 2559
 		return false;
2560 2560
 	}
2561 2561
 
2562
-	if (file_exists(ABSPATH . 'wp-layout.css')) {
2563
-		if (! make_site_theme_from_oldschool($theme_name, $template)) {
2562
+	if (file_exists(ABSPATH.'wp-layout.css')) {
2563
+		if ( ! make_site_theme_from_oldschool($theme_name, $template)) {
2564 2564
 			// TODO: rm -rf the site theme directory.
2565 2565
 			return false;
2566 2566
 		}
2567 2567
 	} else {
2568
-		if (! make_site_theme_from_default($theme_name, $template))
2568
+		if ( ! make_site_theme_from_default($theme_name, $template))
2569 2569
 			// TODO: rm -rf the site theme directory.
2570 2570
 			return false;
2571 2571
 	}
@@ -2618,8 +2618,8 @@  discard block
 block discarded – undo
2618 2618
 function wp_check_mysql_version() {
2619 2619
 	global $wpdb;
2620 2620
 	$result = $wpdb->check_database_version();
2621
-	if ( is_wp_error( $result ) )
2622
-		die( $result->get_error_message() );
2621
+	if (is_wp_error($result))
2622
+		die($result->get_error_message());
2623 2623
 }
2624 2624
 
2625 2625
 /**
@@ -2628,12 +2628,12 @@  discard block
 block discarded – undo
2628 2628
  * @since 2.2.0
2629 2629
  */
2630 2630
 function maybe_disable_automattic_widgets() {
2631
-	$plugins = __get_option( 'active_plugins' );
2631
+	$plugins = __get_option('active_plugins');
2632 2632
 
2633
-	foreach ( (array) $plugins as $plugin ) {
2634
-		if ( basename( $plugin ) == 'widgets.php' ) {
2635
-			array_splice( $plugins, array_search( $plugin, $plugins ), 1 );
2636
-			update_option( 'active_plugins', $plugins );
2633
+	foreach ((array) $plugins as $plugin) {
2634
+		if (basename($plugin) == 'widgets.php') {
2635
+			array_splice($plugins, array_search($plugin, $plugins), 1);
2636
+			update_option('active_plugins', $plugins);
2637 2637
 			break;
2638 2638
 		}
2639 2639
 	}
@@ -2650,8 +2650,8 @@  discard block
 block discarded – undo
2650 2650
 function maybe_disable_link_manager() {
2651 2651
 	global $wp_current_db_version, $wpdb;
2652 2652
 
2653
-	if ( $wp_current_db_version >= 22006 && get_option( 'link_manager_enabled' ) && ! $wpdb->get_var( "SELECT link_id FROM $wpdb->links LIMIT 1" ) )
2654
-		update_option( 'link_manager_enabled', 0 );
2653
+	if ($wp_current_db_version >= 22006 && get_option('link_manager_enabled') && ! $wpdb->get_var("SELECT link_id FROM $wpdb->links LIMIT 1"))
2654
+		update_option('link_manager_enabled', 0);
2655 2655
 }
2656 2656
 
2657 2657
 /**
@@ -2666,7 +2666,7 @@  discard block
 block discarded – undo
2666 2666
 	global $wp_current_db_version, $wpdb;
2667 2667
 
2668 2668
 	// Upgrade versions prior to 2.9
2669
-	if ( $wp_current_db_version < 11557 ) {
2669
+	if ($wp_current_db_version < 11557) {
2670 2670
 		// Delete duplicate options. Keep the option with the highest option_id.
2671 2671
 		$wpdb->query("DELETE o1 FROM $wpdb->options AS o1 JOIN $wpdb->options AS o2 USING (`option_name`) WHERE o2.option_id > o1.option_id");
2672 2672
 
@@ -2678,40 +2678,40 @@  discard block
 block discarded – undo
2678 2678
 	}
2679 2679
 
2680 2680
 	// Multisite schema upgrades.
2681
-	if ( $wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables() ) {
2681
+	if ($wp_current_db_version < 25448 && is_multisite() && wp_should_upgrade_global_tables()) {
2682 2682
 
2683 2683
 		// Upgrade verions prior to 3.7
2684
-		if ( $wp_current_db_version < 25179 ) {
2684
+		if ($wp_current_db_version < 25179) {
2685 2685
 			// New primary key for signups.
2686
-			$wpdb->query( "ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST" );
2687
-			$wpdb->query( "ALTER TABLE $wpdb->signups DROP INDEX domain" );
2686
+			$wpdb->query("ALTER TABLE $wpdb->signups ADD signup_id BIGINT(20) NOT NULL AUTO_INCREMENT PRIMARY KEY FIRST");
2687
+			$wpdb->query("ALTER TABLE $wpdb->signups DROP INDEX domain");
2688 2688
 		}
2689 2689
 
2690
-		if ( $wp_current_db_version < 25448 ) {
2690
+		if ($wp_current_db_version < 25448) {
2691 2691
 			// Convert archived from enum to tinyint.
2692
-			$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'" );
2693
-			$wpdb->query( "ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0" );
2692
+			$wpdb->query("ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived varchar(1) NOT NULL default '0'");
2693
+			$wpdb->query("ALTER TABLE $wpdb->blogs CHANGE COLUMN archived archived tinyint(2) NOT NULL default 0");
2694 2694
 		}
2695 2695
 	}
2696 2696
 
2697 2697
 	// Upgrade versions prior to 4.2.
2698
-	if ( $wp_current_db_version < 31351 ) {
2699
-		if ( ! is_multisite() && wp_should_upgrade_global_tables() ) {
2700
-			$wpdb->query( "ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
2698
+	if ($wp_current_db_version < 31351) {
2699
+		if ( ! is_multisite() && wp_should_upgrade_global_tables()) {
2700
+			$wpdb->query("ALTER TABLE $wpdb->usermeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
2701 2701
 		}
2702
-		$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))" );
2703
-		$wpdb->query( "ALTER TABLE $wpdb->terms DROP INDEX name, ADD INDEX name(name(191))" );
2704
-		$wpdb->query( "ALTER TABLE $wpdb->commentmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
2705
-		$wpdb->query( "ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
2706
-		$wpdb->query( "ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))" );
2702
+		$wpdb->query("ALTER TABLE $wpdb->terms DROP INDEX slug, ADD INDEX slug(slug(191))");
2703
+		$wpdb->query("ALTER TABLE $wpdb->terms DROP INDEX name, ADD INDEX name(name(191))");
2704
+		$wpdb->query("ALTER TABLE $wpdb->commentmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
2705
+		$wpdb->query("ALTER TABLE $wpdb->postmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
2706
+		$wpdb->query("ALTER TABLE $wpdb->posts DROP INDEX post_name, ADD INDEX post_name(post_name(191))");
2707 2707
 	}
2708 2708
 
2709 2709
 	// Upgrade versions prior to 4.4.
2710
-	if ( $wp_current_db_version < 34978 ) {
2710
+	if ($wp_current_db_version < 34978) {
2711 2711
 		// If compatible termmeta table is found, use it, but enforce a proper index and update collation.
2712
-		if ( $wpdb->get_var( "SHOW TABLES LIKE '{$wpdb->termmeta}'" ) && $wpdb->get_results( "SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'" ) ) {
2713
-			$wpdb->query( "ALTER TABLE $wpdb->termmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))" );
2714
-			maybe_convert_table_to_utf8mb4( $wpdb->termmeta );
2712
+		if ($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->termmeta}'") && $wpdb->get_results("SHOW INDEX FROM {$wpdb->termmeta} WHERE Column_name = 'meta_key'")) {
2713
+			$wpdb->query("ALTER TABLE $wpdb->termmeta DROP INDEX meta_key, ADD INDEX meta_key(meta_key(191))");
2714
+			maybe_convert_table_to_utf8mb4($wpdb->termmeta);
2715 2715
 		}
2716 2716
 	}
2717 2717
 }
@@ -2724,7 +2724,7 @@  discard block
 block discarded – undo
2724 2724
  * @global wpdb   $wpdb
2725 2725
  * @global string $charset_collate
2726 2726
  */
2727
-if ( !function_exists( 'install_global_terms' ) ) :
2727
+if ( ! function_exists('install_global_terms')) :
2728 2728
 function install_global_terms() {
2729 2729
 	global $wpdb, $charset_collate;
2730 2730
 	$ms_queries = "
@@ -2739,7 +2739,7 @@  discard block
 block discarded – undo
2739 2739
 ) $charset_collate;
2740 2740
 ";
2741 2741
 // now create tables
2742
-	dbDelta( $ms_queries );
2742
+	dbDelta($ms_queries);
2743 2743
 }
2744 2744
 endif;
2745 2745
 
@@ -2764,7 +2764,7 @@  discard block
 block discarded – undo
2764 2764
 function wp_should_upgrade_global_tables() {
2765 2765
 
2766 2766
 	// Return false early if explicitly not upgrading
2767
-	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
2767
+	if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) {
2768 2768
 		return false;
2769 2769
 	}
2770 2770
 
@@ -2772,12 +2772,12 @@  discard block
 block discarded – undo
2772 2772
 	$should_upgrade = true;
2773 2773
 
2774 2774
 	// Set to false if not on main network (does not matter if not multi-network)
2775
-	if ( ! is_main_network() ) {
2775
+	if ( ! is_main_network()) {
2776 2776
 		$should_upgrade = false;
2777 2777
 	}
2778 2778
 
2779 2779
 	// Set to false if not on main site of current network (does not matter if not multi-site)
2780
-	if ( ! is_main_site() ) {
2780
+	if ( ! is_main_site()) {
2781 2781
 		$should_upgrade = false;
2782 2782
 	}
2783 2783
 
@@ -2786,5 +2786,5 @@  discard block
 block discarded – undo
2786 2786
 	 *
2787 2787
 	 * @param bool $should_upgrade Whether to run the upgrade routines on global tables.
2788 2788
 	 */
2789
-	return apply_filters( 'wp_should_upgrade_global_tables', $should_upgrade );
2789
+	return apply_filters('wp_should_upgrade_global_tables', $should_upgrade);
2790 2790
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/update.php 1 patch
Spacing   +151 added lines, -151 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
  */
14 14
 function get_preferred_from_update_core() {
15 15
 	$updates = get_core_updates();
16
-	if ( ! is_array( $updates ) )
16
+	if ( ! is_array($updates))
17 17
 		return false;
18
-	if ( empty( $updates ) )
19
-		return (object) array( 'response' => 'latest' );
18
+	if (empty($updates))
19
+		return (object) array('response' => 'latest');
20 20
 	return $updates[0];
21 21
 }
22 22
 
@@ -27,31 +27,31 @@  discard block
 block discarded – undo
27 27
  * 	                     set $options['available'] to false to skip not-dismissed updates.
28 28
  * @return array|false Array of the update objects on success, false on failure.
29 29
  */
30
-function get_core_updates( $options = array() ) {
31
-	$options = array_merge( array( 'available' => true, 'dismissed' => false ), $options );
32
-	$dismissed = get_site_option( 'dismissed_update_core' );
30
+function get_core_updates($options = array()) {
31
+	$options = array_merge(array('available' => true, 'dismissed' => false), $options);
32
+	$dismissed = get_site_option('dismissed_update_core');
33 33
 
34
-	if ( ! is_array( $dismissed ) )
34
+	if ( ! is_array($dismissed))
35 35
 		$dismissed = array();
36 36
 
37
-	$from_api = get_site_transient( 'update_core' );
37
+	$from_api = get_site_transient('update_core');
38 38
 
39
-	if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) )
39
+	if ( ! isset($from_api->updates) || ! is_array($from_api->updates))
40 40
 		return false;
41 41
 
42 42
 	$updates = $from_api->updates;
43 43
 	$result = array();
44
-	foreach ( $updates as $update ) {
45
-		if ( $update->response == 'autoupdate' )
44
+	foreach ($updates as $update) {
45
+		if ($update->response == 'autoupdate')
46 46
 			continue;
47 47
 
48
-		if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) {
49
-			if ( $options['dismissed'] ) {
48
+		if (array_key_exists($update->current.'|'.$update->locale, $dismissed)) {
49
+			if ($options['dismissed']) {
50 50
 				$update->dismissed = true;
51 51
 				$result[] = $update;
52 52
 			}
53 53
 		} else {
54
-			if ( $options['available'] ) {
54
+			if ($options['available']) {
55 55
 				$update->dismissed = false;
56 56
 				$result[] = $update;
57 57
 			}
@@ -70,22 +70,22 @@  discard block
 block discarded – undo
70 70
  * @return array|false False on failure, otherwise the core update offering.
71 71
  */
72 72
 function find_core_auto_update() {
73
-	$updates = get_site_transient( 'update_core' );
74
-	if ( ! $updates || empty( $updates->updates ) )
73
+	$updates = get_site_transient('update_core');
74
+	if ( ! $updates || empty($updates->updates))
75 75
 		return false;
76 76
 
77
-	include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
77
+	include_once(ABSPATH.'wp-admin/includes/class-wp-upgrader.php');
78 78
 
79 79
 	$auto_update = false;
80 80
 	$upgrader = new WP_Automatic_Updater;
81
-	foreach ( $updates->updates as $update ) {
82
-		if ( 'autoupdate' != $update->response )
81
+	foreach ($updates->updates as $update) {
82
+		if ('autoupdate' != $update->response)
83 83
 			continue;
84 84
 
85
-		if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) )
85
+		if ( ! $upgrader->should_update('core', $update, ABSPATH))
86 86
 			continue;
87 87
 
88
-		if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) )
88
+		if ( ! $auto_update || version_compare($update->current, $auto_update->current, '>'))
89 89
 			$auto_update = $update;
90 90
 	}
91 91
 	return $auto_update;
@@ -100,29 +100,29 @@  discard block
 block discarded – undo
100 100
  * @param string $locale  Locale to query.
101 101
  * @return bool|array False on failure. An array of checksums on success.
102 102
  */
103
-function get_core_checksums( $version, $locale ) {
104
-	$url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' );
103
+function get_core_checksums($version, $locale) {
104
+	$url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?'.http_build_query(compact('version', 'locale'), null, '&');
105 105
 
106
-	if ( $ssl = wp_http_supports( array( 'ssl' ) ) )
107
-		$url = set_url_scheme( $url, 'https' );
106
+	if ($ssl = wp_http_supports(array('ssl')))
107
+		$url = set_url_scheme($url, 'https');
108 108
 
109 109
 	$options = array(
110
-		'timeout' => ( ( defined('DOING_CRON') && DOING_CRON ) ? 30 : 3 ),
110
+		'timeout' => ((defined('DOING_CRON') && DOING_CRON) ? 30 : 3),
111 111
 	);
112 112
 
113
-	$response = wp_remote_get( $url, $options );
114
-	if ( $ssl && is_wp_error( $response ) ) {
115
-		trigger_error( __( '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="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
116
-		$response = wp_remote_get( $http_url, $options );
113
+	$response = wp_remote_get($url, $options);
114
+	if ($ssl && is_wp_error($response)) {
115
+		trigger_error(__('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="https://wordpress.org/support/">support forums</a>.').' '.__('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE);
116
+		$response = wp_remote_get($http_url, $options);
117 117
 	}
118 118
 
119
-	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) )
119
+	if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response))
120 120
 		return false;
121 121
 
122
-	$body = trim( wp_remote_retrieve_body( $response ) );
123
-	$body = json_decode( $body, true );
122
+	$body = trim(wp_remote_retrieve_body($response));
123
+	$body = json_decode($body, true);
124 124
 
125
-	if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) )
125
+	if ( ! is_array($body) || ! isset($body['checksums']) || ! is_array($body['checksums']))
126 126
 		return false;
127 127
 
128 128
 	return $body['checksums'];
@@ -133,10 +133,10 @@  discard block
 block discarded – undo
133 133
  * @param object $update
134 134
  * @return bool
135 135
  */
136
-function dismiss_core_update( $update ) {
137
-	$dismissed = get_site_option( 'dismissed_update_core' );
138
-	$dismissed[ $update->current . '|' . $update->locale ] = true;
139
-	return update_site_option( 'dismissed_update_core', $dismissed );
136
+function dismiss_core_update($update) {
137
+	$dismissed = get_site_option('dismissed_update_core');
138
+	$dismissed[$update->current.'|'.$update->locale] = true;
139
+	return update_site_option('dismissed_update_core', $dismissed);
140 140
 }
141 141
 
142 142
 /**
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
  * @param string $locale
146 146
  * @return bool
147 147
  */
148
-function undismiss_core_update( $version, $locale ) {
149
-	$dismissed = get_site_option( 'dismissed_update_core' );
150
-	$key = $version . '|' . $locale;
148
+function undismiss_core_update($version, $locale) {
149
+	$dismissed = get_site_option('dismissed_update_core');
150
+	$key = $version.'|'.$locale;
151 151
 
152
-	if ( ! isset( $dismissed[$key] ) )
152
+	if ( ! isset($dismissed[$key]))
153 153
 		return false;
154 154
 
155
-	unset( $dismissed[$key] );
156
-	return update_site_option( 'dismissed_update_core', $dismissed );
155
+	unset($dismissed[$key]);
156
+	return update_site_option('dismissed_update_core', $dismissed);
157 157
 }
158 158
 
159 159
 /**
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
  * @param string $locale
163 163
  * @return object|false
164 164
  */
165
-function find_core_update( $version, $locale ) {
166
-	$from_api = get_site_transient( 'update_core' );
165
+function find_core_update($version, $locale) {
166
+	$from_api = get_site_transient('update_core');
167 167
 
168
-	if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) )
168
+	if ( ! isset($from_api->updates) || ! is_array($from_api->updates))
169 169
 		return false;
170 170
 
171 171
 	$updates = $from_api->updates;
172
-	foreach ( $updates as $update ) {
173
-		if ( $update->current == $version && $update->locale == $locale )
172
+	foreach ($updates as $update) {
173
+		if ($update->current == $version && $update->locale == $locale)
174 174
 			return $update;
175 175
 	}
176 176
 	return false;
@@ -181,33 +181,33 @@  discard block
 block discarded – undo
181 181
  * @param string $msg
182 182
  * @return string
183 183
  */
184
-function core_update_footer( $msg = '' ) {
185
-	if ( !current_user_can('update_core') )
186
-		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
184
+function core_update_footer($msg = '') {
185
+	if ( ! current_user_can('update_core'))
186
+		return sprintf(__('Version %s'), get_bloginfo('version', 'display'));
187 187
 
188 188
 	$cur = get_preferred_from_update_core();
189
-	if ( ! is_object( $cur ) )
189
+	if ( ! is_object($cur))
190 190
 		$cur = new stdClass;
191 191
 
192
-	if ( ! isset( $cur->current ) )
192
+	if ( ! isset($cur->current))
193 193
 		$cur->current = '';
194 194
 
195
-	if ( ! isset( $cur->url ) )
195
+	if ( ! isset($cur->url))
196 196
 		$cur->url = '';
197 197
 
198
-	if ( ! isset( $cur->response ) )
198
+	if ( ! isset($cur->response))
199 199
 		$cur->response = '';
200 200
 
201
-	switch ( $cur->response ) {
201
+	switch ($cur->response) {
202 202
 	case 'development' :
203
-		return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) );
203
+		return sprintf(__('You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.'), get_bloginfo('version', 'display'), network_admin_url('update-core.php'));
204 204
 
205 205
 	case 'upgrade' :
206
-		return '<strong><a href="' . network_admin_url( 'update-core.php' ) . '">' . sprintf( __( 'Get Version %s' ), $cur->current ) . '</a></strong>';
206
+		return '<strong><a href="'.network_admin_url('update-core.php').'">'.sprintf(__('Get Version %s'), $cur->current).'</a></strong>';
207 207
 
208 208
 	case 'latest' :
209 209
 	default :
210
-		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
210
+		return sprintf(__('Version %s'), get_bloginfo('version', 'display'));
211 211
 	}
212 212
 }
213 213
 
@@ -217,23 +217,23 @@  discard block
 block discarded – undo
217 217
  * @return false|void
218 218
  */
219 219
 function update_nag() {
220
-	if ( is_multisite() && !current_user_can('update_core') )
220
+	if (is_multisite() && ! current_user_can('update_core'))
221 221
 		return false;
222 222
 
223 223
 	global $pagenow;
224 224
 
225
-	if ( 'update-core.php' == $pagenow )
225
+	if ('update-core.php' == $pagenow)
226 226
 		return;
227 227
 
228 228
 	$cur = get_preferred_from_update_core();
229 229
 
230
-	if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
230
+	if ( ! isset($cur->response) || $cur->response != 'upgrade')
231 231
 		return false;
232 232
 
233
-	if ( current_user_can('update_core') ) {
234
-		$msg = sprintf( __( '<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s" aria-label="Please update WordPress now">Please update now</a>.' ), $cur->current, network_admin_url( 'update-core.php' ) );
233
+	if (current_user_can('update_core')) {
234
+		$msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s" aria-label="Please update WordPress now">Please update now</a>.'), $cur->current, network_admin_url('update-core.php'));
235 235
 	} else {
236
-		$msg = sprintf( __('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current );
236
+		$msg = sprintf(__('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current);
237 237
 	}
238 238
 	echo "<div class='update-nag'>$msg</div>";
239 239
 }
@@ -241,21 +241,21 @@  discard block
 block discarded – undo
241 241
 // Called directly from dashboard
242 242
 function update_right_now_message() {
243 243
 	$theme_name = wp_get_theme();
244
-	if ( current_user_can( 'switch_themes' ) ) {
245
-		$theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name );
244
+	if (current_user_can('switch_themes')) {
245
+		$theme_name = sprintf('<a href="themes.php">%1$s</a>', $theme_name);
246 246
 	}
247 247
 
248 248
 	$msg = '';
249 249
 
250
-	if ( current_user_can('update_core') ) {
250
+	if (current_user_can('update_core')) {
251 251
 		$cur = get_preferred_from_update_core();
252 252
 
253
-		if ( isset( $cur->response ) && $cur->response == 'upgrade' )
254
-			$msg .= '<a href="' . network_admin_url( 'update-core.php' ) . '" class="button" aria-describedby="wp-version">' . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a> ';
253
+		if (isset($cur->response) && $cur->response == 'upgrade')
254
+			$msg .= '<a href="'.network_admin_url('update-core.php').'" class="button" aria-describedby="wp-version">'.sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')).'</a> ';
255 255
 	}
256 256
 
257 257
 	/* translators: 1: version number, 2: theme name */
258
-	$content = __( 'WordPress %1$s running %2$s theme.' );
258
+	$content = __('WordPress %1$s running %2$s theme.');
259 259
 
260 260
 	/**
261 261
 	 * Filter the text displayed in the 'At a Glance' dashboard widget.
@@ -266,9 +266,9 @@  discard block
 block discarded – undo
266 266
 	 *
267 267
 	 * @param string $content Default text.
268 268
 	 */
269
-	$content = apply_filters( 'update_right_now_text', $content );
269
+	$content = apply_filters('update_right_now_text', $content);
270 270
 
271
-	$msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
271
+	$msg .= sprintf('<span id="wp-version">'.$content.'</span>', get_bloginfo('version', 'display'), $theme_name);
272 272
 
273 273
 	echo "<p id='wp-version-message'>$msg</p>";
274 274
 }
@@ -281,11 +281,11 @@  discard block
 block discarded – undo
281 281
 function get_plugin_updates() {
282 282
 	$all_plugins = get_plugins();
283 283
 	$upgrade_plugins = array();
284
-	$current = get_site_transient( 'update_plugins' );
285
-	foreach ( (array)$all_plugins as $plugin_file => $plugin_data) {
286
-		if ( isset( $current->response[ $plugin_file ] ) ) {
287
-			$upgrade_plugins[ $plugin_file ] = (object) $plugin_data;
288
-			$upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ];
284
+	$current = get_site_transient('update_plugins');
285
+	foreach ((array) $all_plugins as $plugin_file => $plugin_data) {
286
+		if (isset($current->response[$plugin_file])) {
287
+			$upgrade_plugins[$plugin_file] = (object) $plugin_data;
288
+			$upgrade_plugins[$plugin_file]->update = $current->response[$plugin_file];
289 289
 		}
290 290
 	}
291 291
 
@@ -296,14 +296,14 @@  discard block
 block discarded – undo
296 296
  * @since 2.9.0
297 297
  */
298 298
 function wp_plugin_update_rows() {
299
-	if ( !current_user_can('update_plugins' ) )
299
+	if ( ! current_user_can('update_plugins'))
300 300
 		return;
301 301
 
302
-	$plugins = get_site_transient( 'update_plugins' );
303
-	if ( isset($plugins->response) && is_array($plugins->response) ) {
304
-		$plugins = array_keys( $plugins->response );
305
-		foreach ( $plugins as $plugin_file ) {
306
-			add_action( "after_plugin_row_$plugin_file", 'wp_plugin_update_row', 10, 2 );
302
+	$plugins = get_site_transient('update_plugins');
303
+	if (isset($plugins->response) && is_array($plugins->response)) {
304
+		$plugins = array_keys($plugins->response);
305
+		foreach ($plugins as $plugin_file) {
306
+			add_action("after_plugin_row_$plugin_file", 'wp_plugin_update_row', 10, 2);
307 307
 		}
308 308
 	}
309 309
 }
@@ -314,58 +314,58 @@  discard block
 block discarded – undo
314 314
  * @param array  $plugin_data
315 315
  * @return false|void
316 316
  */
317
-function wp_plugin_update_row( $file, $plugin_data ) {
318
-	$current = get_site_transient( 'update_plugins' );
319
-	if ( !isset( $current->response[ $file ] ) )
317
+function wp_plugin_update_row($file, $plugin_data) {
318
+	$current = get_site_transient('update_plugins');
319
+	if ( ! isset($current->response[$file]))
320 320
 		return false;
321 321
 
322
-	$r = $current->response[ $file ];
322
+	$r = $current->response[$file];
323 323
 
324
-	$plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array());
325
-	$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
324
+	$plugins_allowedtags = array('a' => array('href' => array(), 'title' => array()), 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), 'code' => array(), 'em' => array(), 'strong' => array());
325
+	$plugin_name = wp_kses($plugin_data['Name'], $plugins_allowedtags);
326 326
 
327
-	$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&section=changelog&TB_iframe=true&width=600&height=800');
327
+	$details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin='.$r->slug.'&section=changelog&TB_iframe=true&width=600&height=800');
328 328
 
329 329
 	$wp_list_table = _get_list_table('WP_Plugins_List_Table');
330 330
 
331
-	if ( is_network_admin() || !is_multisite() ) {
332
-		if ( is_network_admin() ) {
333
-			$active_class = is_plugin_active_for_network( $file ) ? ' active': '';
331
+	if (is_network_admin() || ! is_multisite()) {
332
+		if (is_network_admin()) {
333
+			$active_class = is_plugin_active_for_network($file) ? ' active' : '';
334 334
 		} else {
335
-			$active_class = is_plugin_active( $file ) ? ' active' : '';
335
+			$active_class = is_plugin_active($file) ? ' active' : '';
336 336
 		}
337 337
 
338
-		echo '<tr class="plugin-update-tr' . $active_class . '" id="' . esc_attr( $r->slug . '-update' ) . '" data-slug="' . esc_attr( $r->slug ) . '" data-plugin="' . esc_attr( $file ) . '"><td colspan="' . esc_attr( $wp_list_table->get_column_count() ) . '" class="plugin-update colspanchange"><div class="update-message">';
338
+		echo '<tr class="plugin-update-tr'.$active_class.'" id="'.esc_attr($r->slug.'-update').'" data-slug="'.esc_attr($r->slug).'" data-plugin="'.esc_attr($file).'"><td colspan="'.esc_attr($wp_list_table->get_column_count()).'" class="plugin-update colspanchange"><div class="update-message">';
339 339
 
340
-		if ( ! current_user_can( 'update_plugins' ) ) {
340
+		if ( ! current_user_can('update_plugins')) {
341 341
 			/* translators: 1: plugin name, 2: details URL, 3: accessibility text, 4: version number */
342
-			printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>.' ),
342
+			printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>.'),
343 343
 				$plugin_name,
344
-				esc_url( $details_url ),
344
+				esc_url($details_url),
345 345
 				/* translators: 1: plugin name, 2: version number */
346
-				esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $r->new_version ) ),
346
+				esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $r->new_version)),
347 347
 				$r->new_version
348 348
 			);
349
-		} elseif ( empty( $r->package ) ) {
349
+		} elseif (empty($r->package)) {
350 350
 			/* translators: 1: plugin name, 2: details URL, 3: accessibility text, 4: version number */
351
-			printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>' ),
351
+			printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'),
352 352
 				$plugin_name,
353
-				esc_url( $details_url ),
353
+				esc_url($details_url),
354 354
 				/* translators: 1: plugin name, 2: version number */
355
-				esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $r->new_version ) ),
355
+				esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $r->new_version)),
356 356
 				$r->new_version
357 357
 			);
358 358
 		} else {
359 359
 			/* translators: 1: plugin name, 2: details URL, 3: accessibility text, 4: version number, 5: update URL, 6: accessibility text */
360
-			printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" class="update-link" aria-label="%6$s">update now</a>.' ),
360
+			printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" class="update-link" aria-label="%6$s">update now</a>.'),
361 361
 				$plugin_name,
362
-				esc_url( $details_url ),
362
+				esc_url($details_url),
363 363
 				/* translators: 1: plugin name, 2: version number */
364
-				esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $r->new_version ) ),
364
+				esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $r->new_version)),
365 365
 				$r->new_version,
366
-				wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ),
366
+				wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$file, 'upgrade-plugin_'.$file),
367 367
 				/* translators: %s: plugin name */
368
-				esc_attr( sprintf( __( 'Update %s now' ), $plugin_name ) )
368
+				esc_attr(sprintf(__('Update %s now'), $plugin_name))
369 369
 			);
370 370
 		}
371 371
 		/**
@@ -403,7 +403,7 @@  discard block
 block discarded – undo
403 403
 	 	 *     @type string $package      Plugin update package URL.
404 404
 	 	 * }
405 405
 		 */
406
-		do_action( "in_plugin_update_message-{$file}", $plugin_data, $r );
406
+		do_action("in_plugin_update_message-{$file}", $plugin_data, $r);
407 407
 
408 408
 		echo '</div></td></tr>';
409 409
 	}
@@ -416,13 +416,13 @@  discard block
 block discarded – undo
416 416
 function get_theme_updates() {
417 417
 	$current = get_site_transient('update_themes');
418 418
 
419
-	if ( ! isset( $current->response ) )
419
+	if ( ! isset($current->response))
420 420
 		return array();
421 421
 
422 422
 	$update_themes = array();
423
-	foreach ( $current->response as $stylesheet => $data ) {
424
-		$update_themes[ $stylesheet ] = wp_get_theme( $stylesheet );
425
-		$update_themes[ $stylesheet ]->update = $data;
423
+	foreach ($current->response as $stylesheet => $data) {
424
+		$update_themes[$stylesheet] = wp_get_theme($stylesheet);
425
+		$update_themes[$stylesheet]->update = $data;
426 426
 	}
427 427
 
428 428
 	return $update_themes;
@@ -432,15 +432,15 @@  discard block
 block discarded – undo
432 432
  * @since 3.1.0
433 433
  */
434 434
 function wp_theme_update_rows() {
435
-	if ( !current_user_can('update_themes' ) )
435
+	if ( ! current_user_can('update_themes'))
436 436
 		return;
437 437
 
438
-	$themes = get_site_transient( 'update_themes' );
439
-	if ( isset($themes->response) && is_array($themes->response) ) {
440
-		$themes = array_keys( $themes->response );
438
+	$themes = get_site_transient('update_themes');
439
+	if (isset($themes->response) && is_array($themes->response)) {
440
+		$themes = array_keys($themes->response);
441 441
 
442
-		foreach ( $themes as $theme ) {
443
-			add_action( "after_theme_row_$theme", 'wp_theme_update_row', 10, 2 );
442
+		foreach ($themes as $theme) {
443
+			add_action("after_theme_row_$theme", 'wp_theme_update_row', 10, 2);
444 444
 		}
445 445
 	}
446 446
 }
@@ -451,51 +451,51 @@  discard block
 block discarded – undo
451 451
  * @param WP_Theme $theme
452 452
  * @return false|void
453 453
  */
454
-function wp_theme_update_row( $theme_key, $theme ) {
455
-	$current = get_site_transient( 'update_themes' );
456
-	if ( !isset( $current->response[ $theme_key ] ) )
454
+function wp_theme_update_row($theme_key, $theme) {
455
+	$current = get_site_transient('update_themes');
456
+	if ( ! isset($current->response[$theme_key]))
457 457
 		return false;
458 458
 
459
-	$r = $current->response[ $theme_key ];
459
+	$r = $current->response[$theme_key];
460 460
 
461 461
 	$theme_name = $theme['Name'];
462 462
 
463
-	$details_url = add_query_arg( array( 'TB_iframe' => 'true', 'width' => 1024, 'height' => 800 ), $current->response[ $theme_key ]['url'] );
463
+	$details_url = add_query_arg(array('TB_iframe' => 'true', 'width' => 1024, 'height' => 800), $current->response[$theme_key]['url']);
464 464
 
465 465
 	$wp_list_table = _get_list_table('WP_MS_Themes_List_Table');
466 466
 
467
-	$active = $theme->is_allowed( 'network' ) ? ' active': '';
467
+	$active = $theme->is_allowed('network') ? ' active' : '';
468 468
 
469
-	echo '<tr class="plugin-update-tr' . $active . '" id="' . esc_attr( $theme->get_stylesheet() . '-update' ) . '" data-slug="' . esc_attr( $theme->get_stylesheet() ) . '"><td colspan="' . $wp_list_table->get_column_count() . '" class="plugin-update colspanchange"><div class="update-message">';
470
-	if ( ! current_user_can('update_themes') ) {
469
+	echo '<tr class="plugin-update-tr'.$active.'" id="'.esc_attr($theme->get_stylesheet().'-update').'" data-slug="'.esc_attr($theme->get_stylesheet()).'"><td colspan="'.$wp_list_table->get_column_count().'" class="plugin-update colspanchange"><div class="update-message">';
470
+	if ( ! current_user_can('update_themes')) {
471 471
 		/* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number */
472
-		printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>.'),
472
+		printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>.'),
473 473
 			$theme_name,
474
-			esc_url( $details_url ),
474
+			esc_url($details_url),
475 475
 			/* translators: 1: theme name, 2: version number */
476
-			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $r['new_version'] ) ),
476
+			esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])),
477 477
 			$r['new_version']
478 478
 		);
479
-	} elseif ( empty( $r['package'] ) ) {
479
+	} elseif (empty($r['package'])) {
480 480
 		/* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number */
481
-		printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ),
481
+		printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>'),
482 482
 			$theme_name,
483
-			esc_url( $details_url ),
483
+			esc_url($details_url),
484 484
 			/* translators: 1: theme name, 2: version number */
485
-			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $r['new_version'] ) ),
485
+			esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])),
486 486
 			$r['new_version']
487 487
 		);
488 488
 	} else {
489 489
 		/* translators: 1: theme name, 2: details URL, 3: accessibility text, 4: version number, 5: update URL, 6: accessibility text */
490
-		printf( __( 'There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" class="update-link" aria-label="%6$s">update now</a>.' ),
490
+		printf(__('There is a new version of %1$s available. <a href="%2$s" class="thickbox open-plugin-details-modal" aria-label="%3$s">View version %4$s details</a> or <a href="%5$s" class="update-link" aria-label="%6$s">update now</a>.'),
491 491
 			$theme_name,
492
-			esc_url( $details_url ),
492
+			esc_url($details_url),
493 493
 			/* translators: 1: theme name, 2: version number */
494
-			esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme_name, $r['new_version'] ) ),
494
+			esc_attr(sprintf(__('View %1$s version %2$s details'), $theme_name, $r['new_version'])),
495 495
 			$r['new_version'],
496
-			wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ),
496
+			wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=').$theme_key, 'upgrade-theme_'.$theme_key),
497 497
 			/* translators: %s: theme name */
498
-			esc_attr( sprintf( __( 'Update %s now' ), $theme_name ) )
498
+			esc_attr(sprintf(__('Update %s now'), $theme_name))
499 499
 		);
500 500
 	}
501 501
 	/**
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 	 *     @type string $package     Theme update package URL.
517 517
 	 * }
518 518
 	 */
519
-	do_action( "in_theme_update_message-{$theme_key}", $theme, $r );
519
+	do_action("in_theme_update_message-{$theme_key}", $theme, $r);
520 520
 
521 521
 	echo '</div></td></tr>';
522 522
 }
@@ -527,11 +527,11 @@  discard block
 block discarded – undo
527 527
  * @return false|void
528 528
  */
529 529
 function maintenance_nag() {
530
-	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
530
+	include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version
531 531
 	global $upgrading;
532
-	$nag = isset( $upgrading );
533
-	if ( ! $nag ) {
534
-		$failed = get_site_option( 'auto_core_update_failed' );
532
+	$nag = isset($upgrading);
533
+	if ( ! $nag) {
534
+		$failed = get_site_option('auto_core_update_failed');
535 535
 		/*
536 536
 		 * If an update failed critically, we may have copied over version.php but not other files.
537 537
 		 * In that case, if the install claims we're running the version we attempted, nag.
@@ -542,16 +542,16 @@  discard block
 block discarded – undo
542 542
 		 *
543 543
 		 * This flag is cleared whenever a successful update occurs using Core_Upgrader.
544 544
 		 */
545
-		$comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
546
-		if ( version_compare( $failed['attempted'], $wp_version, $comparison ) )
545
+		$comparison = ! empty($failed['critical']) ? '>=' : '>';
546
+		if (version_compare($failed['attempted'], $wp_version, $comparison))
547 547
 			$nag = true;
548 548
 	}
549 549
 
550
-	if ( ! $nag )
550
+	if ( ! $nag)
551 551
 		return false;
552 552
 
553
-	if ( current_user_can('update_core') )
554
-		$msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' );
553
+	if (current_user_can('update_core'))
554
+		$msg = sprintf(__('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php');
555 555
 	else
556 556
 		$msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.');
557 557
 
Please login to merge, or discard this patch.
src/wp-admin/includes/meta-boxes.php 1 patch
Spacing   +207 added lines, -207 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *     @type array    $args     Extra meta box arguments.
20 20
  * }
21 21
  */
22
-function post_submit_meta_box( $post, $args = array() ) {
22
+function post_submit_meta_box($post, $args = array()) {
23 23
 	global $action;
24 24
 
25 25
 	$post_type = $post->post_type;
@@ -32,27 +32,27 @@  discard block
 block discarded – undo
32 32
 
33 33
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
34 34
 <div style="display:none;">
35
-<?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
35
+<?php submit_button(__('Save'), 'button', 'save'); ?>
36 36
 </div>
37 37
 
38 38
 <div id="minor-publishing-actions">
39 39
 <div id="save-action">
40
-<?php if ( 'publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status ) { ?>
41
-<input <?php if ( 'private' == $post->post_status ) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
40
+<?php if ('publish' != $post->post_status && 'future' != $post->post_status && 'pending' != $post->post_status) { ?>
41
+<input <?php if ('private' == $post->post_status) { ?>style="display:none"<?php } ?> type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save Draft'); ?>" class="button" />
42 42
 <span class="spinner"></span>
43
-<?php } elseif ( 'pending' == $post->post_status && $can_publish ) { ?>
43
+<?php } elseif ('pending' == $post->post_status && $can_publish) { ?>
44 44
 <input type="submit" name="save" id="save-post" value="<?php esc_attr_e('Save as Pending'); ?>" class="button" />
45 45
 <span class="spinner"></span>
46 46
 <?php } ?>
47 47
 </div>
48
-<?php if ( is_post_type_viewable( $post_type_object ) ) : ?>
48
+<?php if (is_post_type_viewable($post_type_object)) : ?>
49 49
 <div id="preview-action">
50 50
 <?php
51
-$preview_link = esc_url( get_preview_post_link( $post ) );
52
-if ( 'publish' == $post->post_status ) {
53
-	$preview_button = __( 'Preview Changes' );
51
+$preview_link = esc_url(get_preview_post_link($post));
52
+if ('publish' == $post->post_status) {
53
+	$preview_button = __('Preview Changes');
54 54
 } else {
55
-	$preview_button = __( 'Preview' );
55
+	$preview_button = __('Preview');
56 56
 }
57 57
 ?>
58 58
 <a class="preview button" href="<?php echo $preview_link; ?>" target="wp-preview-<?php echo (int) $post->ID; ?>" id="post-preview"><?php echo $preview_button; ?></a>
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
  *
68 68
  * @param WP_Post $post WP_Post object for the current post.
69 69
  */
70
-do_action( 'post_submitbox_minor_actions', $post );
70
+do_action('post_submitbox_minor_actions', $post);
71 71
 ?>
72 72
 <div class="clear"></div>
73 73
 </div><!-- #minor-publishing-actions -->
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
 <div class="misc-pub-section misc-pub-post-status"><label for="post_status"><?php _e('Status:') ?></label>
78 78
 <span id="post-status-display">
79 79
 <?php
80
-switch ( $post->post_status ) {
80
+switch ($post->post_status) {
81 81
 	case 'private':
82 82
 		_e('Privately Published');
83 83
 		break;
@@ -97,24 +97,24 @@  discard block
 block discarded – undo
97 97
 }
98 98
 ?>
99 99
 </span>
100
-<?php if ( 'publish' == $post->post_status || 'private' == $post->post_status || $can_publish ) { ?>
101
-<a href="#post_status" <?php if ( 'private' == $post->post_status ) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit status' ); ?></span></a>
100
+<?php if ('publish' == $post->post_status || 'private' == $post->post_status || $can_publish) { ?>
101
+<a href="#post_status" <?php if ('private' == $post->post_status) { ?>style="display:none;" <?php } ?>class="edit-post-status hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit status'); ?></span></a>
102 102
 
103 103
 <div id="post-status-select" class="hide-if-js">
104
-<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr( ('auto-draft' == $post->post_status ) ? 'draft' : $post->post_status); ?>" />
104
+<input type="hidden" name="hidden_post_status" id="hidden_post_status" value="<?php echo esc_attr(('auto-draft' == $post->post_status) ? 'draft' : $post->post_status); ?>" />
105 105
 <select name='post_status' id='post_status'>
106
-<?php if ( 'publish' == $post->post_status ) : ?>
107
-<option<?php selected( $post->post_status, 'publish' ); ?> value='publish'><?php _e('Published') ?></option>
108
-<?php elseif ( 'private' == $post->post_status ) : ?>
109
-<option<?php selected( $post->post_status, 'private' ); ?> value='publish'><?php _e('Privately Published') ?></option>
110
-<?php elseif ( 'future' == $post->post_status ) : ?>
111
-<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
106
+<?php if ('publish' == $post->post_status) : ?>
107
+<option<?php selected($post->post_status, 'publish'); ?> value='publish'><?php _e('Published') ?></option>
108
+<?php elseif ('private' == $post->post_status) : ?>
109
+<option<?php selected($post->post_status, 'private'); ?> value='publish'><?php _e('Privately Published') ?></option>
110
+<?php elseif ('future' == $post->post_status) : ?>
111
+<option<?php selected($post->post_status, 'future'); ?> value='future'><?php _e('Scheduled') ?></option>
112 112
 <?php endif; ?>
113
-<option<?php selected( $post->post_status, 'pending' ); ?> value='pending'><?php _e('Pending Review') ?></option>
114
-<?php if ( 'auto-draft' == $post->post_status ) : ?>
115
-<option<?php selected( $post->post_status, 'auto-draft' ); ?> value='draft'><?php _e('Draft') ?></option>
113
+<option<?php selected($post->post_status, 'pending'); ?> value='pending'><?php _e('Pending Review') ?></option>
114
+<?php if ('auto-draft' == $post->post_status) : ?>
115
+<option<?php selected($post->post_status, 'auto-draft'); ?> value='draft'><?php _e('Draft') ?></option>
116 116
 <?php else : ?>
117
-<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Draft') ?></option>
117
+<option<?php selected($post->post_status, 'draft'); ?> value='draft'><?php _e('Draft') ?></option>
118 118
 <?php endif; ?>
119 119
 </select>
120 120
  <a href="#post_status" class="save-post-status hide-if-no-js button"><?php _e('OK'); ?></a>
@@ -127,14 +127,14 @@  discard block
 block discarded – undo
127 127
 <div class="misc-pub-section misc-pub-visibility" id="visibility">
128 128
 <?php _e('Visibility:'); ?> <span id="post-visibility-display"><?php
129 129
 
130
-if ( 'private' == $post->post_status ) {
130
+if ('private' == $post->post_status) {
131 131
 	$post->post_password = '';
132 132
 	$visibility = 'private';
133 133
 	$visibility_trans = __('Private');
134
-} elseif ( !empty( $post->post_password ) ) {
134
+} elseif ( ! empty($post->post_password)) {
135 135
 	$visibility = 'password';
136 136
 	$visibility_trans = __('Password protected');
137
-} elseif ( $post_type == 'post' && is_sticky( $post->ID ) ) {
137
+} elseif ($post_type == 'post' && is_sticky($post->ID)) {
138 138
 	$visibility = 'public';
139 139
 	$visibility_trans = __('Public, Sticky');
140 140
 } else {
@@ -142,23 +142,23 @@  discard block
 block discarded – undo
142 142
 	$visibility_trans = __('Public');
143 143
 }
144 144
 
145
-echo esc_html( $visibility_trans ); ?></span>
146
-<?php if ( $can_publish ) { ?>
147
-<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit visibility' ); ?></span></a>
145
+echo esc_html($visibility_trans); ?></span>
146
+<?php if ($can_publish) { ?>
147
+<a href="#visibility" class="edit-visibility hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit visibility'); ?></span></a>
148 148
 
149 149
 <div id="post-visibility-select" class="hide-if-js">
150 150
 <input type="hidden" name="hidden_post_password" id="hidden-post-password" value="<?php echo esc_attr($post->post_password); ?>" />
151 151
 <?php if ($post_type == 'post'): ?>
152 152
 <input type="checkbox" style="display:none" name="hidden_post_sticky" id="hidden-post-sticky" value="sticky" <?php checked(is_sticky($post->ID)); ?> />
153 153
 <?php endif; ?>
154
-<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr( $visibility ); ?>" />
155
-<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked( $visibility, 'public' ); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
156
-<?php if ( $post_type == 'post' && current_user_can( 'edit_others_posts' ) ) : ?>
157
-<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked( is_sticky( $post->ID ) ); ?> /> <label for="sticky" class="selectit"><?php _e( 'Stick this post to the front page' ); ?></label><br /></span>
154
+<input type="hidden" name="hidden_post_visibility" id="hidden-post-visibility" value="<?php echo esc_attr($visibility); ?>" />
155
+<input type="radio" name="visibility" id="visibility-radio-public" value="public" <?php checked($visibility, 'public'); ?> /> <label for="visibility-radio-public" class="selectit"><?php _e('Public'); ?></label><br />
156
+<?php if ($post_type == 'post' && current_user_can('edit_others_posts')) : ?>
157
+<span id="sticky-span"><input id="sticky" name="sticky" type="checkbox" value="sticky" <?php checked(is_sticky($post->ID)); ?> /> <label for="sticky" class="selectit"><?php _e('Stick this post to the front page'); ?></label><br /></span>
158 158
 <?php endif; ?>
159
-<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked( $visibility, 'password' ); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
159
+<input type="radio" name="visibility" id="visibility-radio-password" value="password" <?php checked($visibility, 'password'); ?> /> <label for="visibility-radio-password" class="selectit"><?php _e('Password protected'); ?></label><br />
160 160
 <span id="password-span"><label for="post_password"><?php _e('Password:'); ?></label> <input type="text" name="post_password" id="post_password" value="<?php echo esc_attr($post->post_password); ?>"  maxlength="20" /><br /></span>
161
-<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked( $visibility, 'private' ); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
161
+<input type="radio" name="visibility" id="visibility-radio-private" value="private" <?php checked($visibility, 'private'); ?> /> <label for="visibility-radio-private" class="selectit"><?php _e('Private'); ?></label><br />
162 162
 
163 163
 <p>
164 164
  <a href="#visibility" class="save-post-visibility hide-if-no-js button"><?php _e('OK'); ?></a>
@@ -171,40 +171,40 @@  discard block
 block discarded – undo
171 171
 
172 172
 <?php
173 173
 /* translators: Publish box date format, see http://php.net/date */
174
-$datef = __( 'M j, Y @ H:i' );
175
-if ( 0 != $post->ID ) {
176
-	if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
174
+$datef = __('M j, Y @ H:i');
175
+if (0 != $post->ID) {
176
+	if ('future' == $post->post_status) { // scheduled for publishing at a future date
177 177
 		$stamp = __('Scheduled for: <b>%1$s</b>');
178
-	} elseif ( 'publish' == $post->post_status || 'private' == $post->post_status ) { // already published
178
+	} elseif ('publish' == $post->post_status || 'private' == $post->post_status) { // already published
179 179
 		$stamp = __('Published on: <b>%1$s</b>');
180
-	} elseif ( '0000-00-00 00:00:00' == $post->post_date_gmt ) { // draft, 1 or more saves, no date specified
180
+	} elseif ('0000-00-00 00:00:00' == $post->post_date_gmt) { // draft, 1 or more saves, no date specified
181 181
 		$stamp = __('Publish <b>immediately</b>');
182
-	} elseif ( time() < strtotime( $post->post_date_gmt . ' +0000' ) ) { // draft, 1 or more saves, future date specified
182
+	} elseif (time() < strtotime($post->post_date_gmt.' +0000')) { // draft, 1 or more saves, future date specified
183 183
 		$stamp = __('Schedule for: <b>%1$s</b>');
184 184
 	} else { // draft, 1 or more saves, date specified
185 185
 		$stamp = __('Publish on: <b>%1$s</b>');
186 186
 	}
187
-	$date = date_i18n( $datef, strtotime( $post->post_date ) );
187
+	$date = date_i18n($datef, strtotime($post->post_date));
188 188
 } else { // draft (no saves, and thus no date specified)
189 189
 	$stamp = __('Publish <b>immediately</b>');
190
-	$date = date_i18n( $datef, strtotime( current_time('mysql') ) );
190
+	$date = date_i18n($datef, strtotime(current_time('mysql')));
191 191
 }
192 192
 
193
-if ( ! empty( $args['args']['revisions_count'] ) ) : ?>
193
+if ( ! empty($args['args']['revisions_count'])) : ?>
194 194
 <div class="misc-pub-section misc-pub-revisions">
195
-	<?php printf( __( 'Revisions: %s' ), '<b>' . number_format_i18n( $args['args']['revisions_count'] ) . '</b>' ); ?>
196
-	<a class="hide-if-no-js" href="<?php echo esc_url( get_edit_post_link( $args['args']['revision_id'] ) ); ?>"><span aria-hidden="true"><?php _ex( 'Browse', 'revisions' ); ?></span> <span class="screen-reader-text"><?php _e( 'Browse revisions' ); ?></span></a>
195
+	<?php printf(__('Revisions: %s'), '<b>'.number_format_i18n($args['args']['revisions_count']).'</b>'); ?>
196
+	<a class="hide-if-no-js" href="<?php echo esc_url(get_edit_post_link($args['args']['revision_id'])); ?>"><span aria-hidden="true"><?php _ex('Browse', 'revisions'); ?></span> <span class="screen-reader-text"><?php _e('Browse revisions'); ?></span></a>
197 197
 </div>
198 198
 <?php endif;
199 199
 
200
-if ( $can_publish ) : // Contributors don't get to choose the date of publish ?>
200
+if ($can_publish) : // Contributors don't get to choose the date of publish ?>
201 201
 <div class="misc-pub-section curtime misc-pub-curtime">
202 202
 	<span id="timestamp">
203 203
 	<?php printf($stamp, $date); ?></span>
204
-	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e( 'Edit' ); ?></span> <span class="screen-reader-text"><?php _e( 'Edit date and time' ); ?></span></a>
204
+	<a href="#edit_timestamp" class="edit-timestamp hide-if-no-js"><span aria-hidden="true"><?php _e('Edit'); ?></span> <span class="screen-reader-text"><?php _e('Edit date and time'); ?></span></a>
205 205
 	<fieldset id="timestampdiv" class="hide-if-js">
206
-	<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
207
-	<?php touch_time( ( $action === 'edit' ), 1 ); ?>
206
+	<legend class="screen-reader-text"><?php _e('Date and time'); ?></legend>
207
+	<?php touch_time(($action === 'edit'), 1); ?>
208 208
 	</fieldset>
209 209
 </div><?php // /misc-pub-section ?>
210 210
 <?php endif; ?>
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
  *
219 219
  * @param WP_Post $post WP_Post object for the current post.
220 220
  */
221
-do_action( 'post_submitbox_misc_actions', $post );
221
+do_action('post_submitbox_misc_actions', $post);
222 222
 ?>
223 223
 </div>
224 224
 <div class="clear"></div>
@@ -231,12 +231,12 @@  discard block
 block discarded – undo
231 231
  *
232 232
  * @since 2.7.0
233 233
  */
234
-do_action( 'post_submitbox_start' );
234
+do_action('post_submitbox_start');
235 235
 ?>
236 236
 <div id="delete-action">
237 237
 <?php
238
-if ( current_user_can( "delete_post", $post->ID ) ) {
239
-	if ( !EMPTY_TRASH_DAYS )
238
+if (current_user_can("delete_post", $post->ID)) {
239
+	if ( ! EMPTY_TRASH_DAYS)
240 240
 		$delete_text = __('Delete Permanently');
241 241
 	else
242 242
 		$delete_text = __('Move to Trash');
@@ -248,23 +248,23 @@  discard block
 block discarded – undo
248 248
 <div id="publishing-action">
249 249
 <span class="spinner"></span>
250 250
 <?php
251
-if ( !in_array( $post->post_status, array('publish', 'future', 'private') ) || 0 == $post->ID ) {
252
-	if ( $can_publish ) :
253
-		if ( !empty($post->post_date_gmt) && time() < strtotime( $post->post_date_gmt . ' +0000' ) ) : ?>
251
+if ( ! in_array($post->post_status, array('publish', 'future', 'private')) || 0 == $post->ID) {
252
+	if ($can_publish) :
253
+		if ( ! empty($post->post_date_gmt) && time() < strtotime($post->post_date_gmt.' +0000')) : ?>
254 254
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Schedule') ?>" />
255
-		<?php submit_button( __( 'Schedule' ), 'primary button-large', 'publish', false ); ?>
255
+		<?php submit_button(__('Schedule'), 'primary button-large', 'publish', false); ?>
256 256
 <?php	else : ?>
257 257
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Publish') ?>" />
258
-		<?php submit_button( __( 'Publish' ), 'primary button-large', 'publish', false ); ?>
258
+		<?php submit_button(__('Publish'), 'primary button-large', 'publish', false); ?>
259 259
 <?php	endif;
260 260
 	else : ?>
261 261
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Submit for Review') ?>" />
262
-		<?php submit_button( __( 'Submit for Review' ), 'primary button-large', 'publish', false ); ?>
262
+		<?php submit_button(__('Submit for Review'), 'primary button-large', 'publish', false); ?>
263 263
 <?php
264 264
 	endif;
265 265
 } else { ?>
266 266
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
267
-		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
267
+		<input name="save" type="submit" class="button button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" />
268 268
 <?php
269 269
 } ?>
270 270
 </div>
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param object $post
284 284
  */
285
-function attachment_submit_meta_box( $post ) {
285
+function attachment_submit_meta_box($post) {
286 286
 ?>
287 287
 <div class="submitbox" id="submitpost">
288 288
 
@@ -290,16 +290,16 @@  discard block
 block discarded – undo
290 290
 
291 291
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
292 292
 <div style="display:none;">
293
-<?php submit_button( __( 'Save' ), 'button', 'save' ); ?>
293
+<?php submit_button(__('Save'), 'button', 'save'); ?>
294 294
 </div>
295 295
 
296 296
 
297 297
 <div id="misc-publishing-actions">
298 298
 	<?php
299 299
 	/* translators: Publish box date format, see http://php.net/date */
300
-	$datef = __( 'M j, Y @ H:i' );
300
+	$datef = __('M j, Y @ H:i');
301 301
 	$stamp = __('Uploaded on: <b>%1$s</b>');
302
-	$date = date_i18n( $datef, strtotime( $post->post_date ) );
302
+	$date = date_i18n($datef, strtotime($post->post_date));
303 303
 	?>
304 304
 	<div class="misc-pub-section curtime misc-pub-curtime">
305 305
 		<span id="timestamp"><?php printf($stamp, $date); ?></span>
@@ -312,7 +312,7 @@  discard block
 block discarded – undo
312 312
 	 *
313 313
 	 * @since 3.5.0
314 314
 	 */
315
-	do_action( 'attachment_submitbox_misc_actions' );
315
+	do_action('attachment_submitbox_misc_actions');
316 316
 	?>
317 317
 </div><!-- #misc-publishing-actions -->
318 318
 <div class="clear"></div>
@@ -321,12 +321,12 @@  discard block
 block discarded – undo
321 321
 <div id="major-publishing-actions">
322 322
 	<div id="delete-action">
323 323
 	<?php
324
-	if ( current_user_can( 'delete_post', $post->ID ) )
325
-		if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
326
-			echo "<a class='submitdelete deletion' href='" . get_delete_post_link( $post->ID ) . "'>" . _x( 'Trash', 'verb' ) . "</a>";
324
+	if (current_user_can('delete_post', $post->ID))
325
+		if (EMPTY_TRASH_DAYS && MEDIA_TRASH) {
326
+			echo "<a class='submitdelete deletion' href='".get_delete_post_link($post->ID)."'>"._x('Trash', 'verb')."</a>";
327 327
 		} else {
328 328
 			$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
329
-			echo  "<a class='submitdelete deletion'$delete_ays href='" . get_delete_post_link( $post->ID, null, true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
329
+			echo  "<a class='submitdelete deletion'$delete_ays href='".get_delete_post_link($post->ID, null, true)."'>".__('Delete Permanently')."</a>";
330 330
 		}
331 331
 	?>
332 332
 	</div>
@@ -334,7 +334,7 @@  discard block
 block discarded – undo
334 334
 	<div id="publishing-action">
335 335
 		<span class="spinner"></span>
336 336
 		<input name="original_publish" type="hidden" id="original_publish" value="<?php esc_attr_e('Update') ?>" />
337
-		<input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e( 'Update' ) ?>" />
337
+		<input name="save" type="submit" class="button-primary button-large" id="publish" value="<?php esc_attr_e('Update') ?>" />
338 338
 	</div>
339 339
 	<div class="clear"></div>
340 340
 </div><!-- #major-publishing-actions -->
@@ -359,24 +359,24 @@  discard block
 block discarded – undo
359 359
  *     @type array    $args     Extra meta box arguments.
360 360
  * }
361 361
  */
362
-function post_format_meta_box( $post, $box ) {
363
-	if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) :
364
-	$post_formats = get_theme_support( 'post-formats' );
362
+function post_format_meta_box($post, $box) {
363
+	if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) :
364
+	$post_formats = get_theme_support('post-formats');
365 365
 
366
-	if ( is_array( $post_formats[0] ) ) :
367
-		$post_format = get_post_format( $post->ID );
368
-		if ( !$post_format )
366
+	if (is_array($post_formats[0])) :
367
+		$post_format = get_post_format($post->ID);
368
+		if ( ! $post_format)
369 369
 			$post_format = '0';
370 370
 		// Add in the current one if it isn't there yet, in case the current theme doesn't support it
371
-		if ( $post_format && !in_array( $post_format, $post_formats[0] ) )
371
+		if ($post_format && ! in_array($post_format, $post_formats[0]))
372 372
 			$post_formats[0][] = $post_format;
373 373
 	?>
374 374
 	<div id="post-formats-select">
375 375
 		<fieldset>
376
-			<legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
377
-			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
378
-			<?php foreach ( $post_formats[0] as $format ) : ?>
379
-			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr( $format ); ?>" value="<?php echo esc_attr( $format ); ?>" <?php checked( $post_format, $format ); ?> /> <label for="post-format-<?php echo esc_attr( $format ); ?>" class="post-format-icon post-format-<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
376
+			<legend class="screen-reader-text"><?php _e('Post Formats'); ?></legend>
377
+			<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked($post_format, '0'); ?> /> <label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string('standard'); ?></label>
378
+			<?php foreach ($post_formats[0] as $format) : ?>
379
+			<br /><input type="radio" name="post_format" class="post-format" id="post-format-<?php echo esc_attr($format); ?>" value="<?php echo esc_attr($format); ?>" <?php checked($post_format, $format); ?> /> <label for="post-format-<?php echo esc_attr($format); ?>" class="post-format-icon post-format-<?php echo esc_attr($format); ?>"><?php echo esc_html(get_post_format_string($format)); ?></label>
380 380
 			<?php endforeach; ?>
381 381
 		</fieldset>
382 382
 	</div>
@@ -404,20 +404,20 @@  discard block
 block discarded – undo
404 404
  *     }
405 405
  * }
406 406
  */
407
-function post_tags_meta_box( $post, $box ) {
408
-	$defaults = array( 'taxonomy' => 'post_tag' );
409
-	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
407
+function post_tags_meta_box($post, $box) {
408
+	$defaults = array('taxonomy' => 'post_tag');
409
+	if ( ! isset($box['args']) || ! is_array($box['args'])) {
410 410
 		$args = array();
411 411
 	} else {
412 412
 		$args = $box['args'];
413 413
 	}
414
-	$r = wp_parse_args( $args, $defaults );
415
-	$tax_name = esc_attr( $r['taxonomy'] );
416
-	$taxonomy = get_taxonomy( $r['taxonomy'] );
417
-	$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
418
-	$comma = _x( ',', 'tag delimiter' );
419
-	$terms_to_edit = get_terms_to_edit( $post->ID, $tax_name );
420
-	if ( ! is_string( $terms_to_edit ) ) {
414
+	$r = wp_parse_args($args, $defaults);
415
+	$tax_name = esc_attr($r['taxonomy']);
416
+	$taxonomy = get_taxonomy($r['taxonomy']);
417
+	$user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms);
418
+	$comma = _x(',', 'tag delimiter');
419
+	$terms_to_edit = get_terms_to_edit($post->ID, $tax_name);
420
+	if ( ! is_string($terms_to_edit)) {
421 421
 		$terms_to_edit = '';
422 422
 	}
423 423
 ?>
@@ -425,9 +425,9 @@  discard block
 block discarded – undo
425 425
 	<div class="jaxtag">
426 426
 	<div class="nojs-tags hide-if-js">
427 427
 		<label for="tax-input-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_or_remove_items; ?></label>
428
-		<p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></p>
428
+		<p><textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms); ?> aria-describedby="new-tag-<?php echo $tax_name; ?>-desc"><?php echo str_replace(',', $comma.' ', $terms_to_edit); // textarea_escaped by esc_attr() ?></textarea></p>
429 429
 	</div>
430
- 	<?php if ( $user_can_assign_terms ) : ?>
430
+ 	<?php if ($user_can_assign_terms) : ?>
431 431
 	<div class="ajaxtag hide-if-no-js">
432 432
 		<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
433 433
 		<p><input type="text" id="new-tag-<?php echo $tax_name; ?>" name="newtag[<?php echo $tax_name; ?>]" class="newtag form-input-tip" size="16" autocomplete="off" aria-describedby="new-tag-<?php echo $tax_name; ?>-desc" value="" />
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	</div>
439 439
 	<div class="tagchecklist"></div>
440 440
 </div>
441
-<?php if ( $user_can_assign_terms ) : ?>
441
+<?php if ($user_can_assign_terms) : ?>
442 442
 <p class="hide-if-no-js"><a href="#titlediv" class="tagcloud-link" id="link-<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->choose_from_most_used; ?></a></p>
443 443
 <?php endif; ?>
444 444
 <?php
@@ -465,49 +465,49 @@  discard block
 block discarded – undo
465 465
  *     }
466 466
  * }
467 467
  */
468
-function post_categories_meta_box( $post, $box ) {
469
-	$defaults = array( 'taxonomy' => 'category' );
470
-	if ( ! isset( $box['args'] ) || ! is_array( $box['args'] ) ) {
468
+function post_categories_meta_box($post, $box) {
469
+	$defaults = array('taxonomy' => 'category');
470
+	if ( ! isset($box['args']) || ! is_array($box['args'])) {
471 471
 		$args = array();
472 472
 	} else {
473 473
 		$args = $box['args'];
474 474
 	}
475
-	$r = wp_parse_args( $args, $defaults );
476
-	$tax_name = esc_attr( $r['taxonomy'] );
477
-	$taxonomy = get_taxonomy( $r['taxonomy'] );
475
+	$r = wp_parse_args($args, $defaults);
476
+	$tax_name = esc_attr($r['taxonomy']);
477
+	$taxonomy = get_taxonomy($r['taxonomy']);
478 478
 	?>
479 479
 	<div id="taxonomy-<?php echo $tax_name; ?>" class="categorydiv">
480 480
 		<ul id="<?php echo $tax_name; ?>-tabs" class="category-tabs">
481 481
 			<li class="tabs"><a href="#<?php echo $tax_name; ?>-all"><?php echo $taxonomy->labels->all_items; ?></a></li>
482
-			<li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e( 'Most Used' ); ?></a></li>
482
+			<li class="hide-if-no-js"><a href="#<?php echo $tax_name; ?>-pop"><?php _e('Most Used'); ?></a></li>
483 483
 		</ul>
484 484
 
485 485
 		<div id="<?php echo $tax_name; ?>-pop" class="tabs-panel" style="display: none;">
486 486
 			<ul id="<?php echo $tax_name; ?>checklist-pop" class="categorychecklist form-no-clear" >
487
-				<?php $popular_ids = wp_popular_terms_checklist( $tax_name ); ?>
487
+				<?php $popular_ids = wp_popular_terms_checklist($tax_name); ?>
488 488
 			</ul>
489 489
 		</div>
490 490
 
491 491
 		<div id="<?php echo $tax_name; ?>-all" class="tabs-panel">
492 492
 			<?php
493
-			$name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
493
+			$name = ($tax_name == 'category') ? 'post_category' : 'tax_input['.$tax_name.']';
494 494
 			echo "<input type='hidden' name='{$name}[]' value='0' />"; // Allows for an empty term set to be sent. 0 is an invalid Term ID and will be ignored by empty() checks.
495 495
 			?>
496 496
 			<ul id="<?php echo $tax_name; ?>checklist" data-wp-lists="list:<?php echo $tax_name; ?>" class="categorychecklist form-no-clear">
497
-				<?php wp_terms_checklist( $post->ID, array( 'taxonomy' => $tax_name, 'popular_cats' => $popular_ids ) ); ?>
497
+				<?php wp_terms_checklist($post->ID, array('taxonomy' => $tax_name, 'popular_cats' => $popular_ids)); ?>
498 498
 			</ul>
499 499
 		</div>
500
-	<?php if ( current_user_can( $taxonomy->cap->edit_terms ) ) : ?>
500
+	<?php if (current_user_can($taxonomy->cap->edit_terms)) : ?>
501 501
 			<div id="<?php echo $tax_name; ?>-adder" class="wp-hidden-children">
502 502
 				<a id="<?php echo $tax_name; ?>-add-toggle" href="#<?php echo $tax_name; ?>-add" class="hide-if-no-js taxonomy-add-new">
503 503
 					<?php
504 504
 						/* translators: %s: add new taxonomy label */
505
-						printf( __( '+ %s' ), $taxonomy->labels->add_new_item );
505
+						printf(__('+ %s'), $taxonomy->labels->add_new_item);
506 506
 					?>
507 507
 				</a>
508 508
 				<p id="<?php echo $tax_name; ?>-add" class="category-add wp-hidden-child">
509 509
 					<label class="screen-reader-text" for="new<?php echo $tax_name; ?>"><?php echo $taxonomy->labels->add_new_item; ?></label>
510
-					<input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" aria-required="true"/>
510
+					<input type="text" name="new<?php echo $tax_name; ?>" id="new<?php echo $tax_name; ?>" class="form-required form-input-tip" value="<?php echo esc_attr($taxonomy->labels->new_item_name); ?>" aria-required="true"/>
511 511
 					<label class="screen-reader-text" for="new<?php echo $tax_name; ?>_parent">
512 512
 						<?php echo $taxonomy->labels->parent_item_colon; ?>
513 513
 					</label>
@@ -515,10 +515,10 @@  discard block
 block discarded – undo
515 515
 					$parent_dropdown_args = array(
516 516
 						'taxonomy'         => $tax_name,
517 517
 						'hide_empty'       => 0,
518
-						'name'             => 'new' . $tax_name . '_parent',
518
+						'name'             => 'new'.$tax_name.'_parent',
519 519
 						'orderby'          => 'name',
520 520
 						'hierarchical'     => 1,
521
-						'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;',
521
+						'show_option_none' => '&mdash; '.$taxonomy->labels->parent_item.' &mdash;',
522 522
 					);
523 523
 
524 524
 					/**
@@ -545,12 +545,12 @@  discard block
 block discarded – undo
545 545
 					 *                                      taxonomy label.
546 546
 					 * }
547 547
 					 */
548
-					$parent_dropdown_args = apply_filters( 'post_edit_category_parent_dropdown_args', $parent_dropdown_args );
548
+					$parent_dropdown_args = apply_filters('post_edit_category_parent_dropdown_args', $parent_dropdown_args);
549 549
 
550
-					wp_dropdown_categories( $parent_dropdown_args );
550
+					wp_dropdown_categories($parent_dropdown_args);
551 551
 					?>
552
-					<input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr( $taxonomy->labels->add_new_item ); ?>" />
553
-					<?php wp_nonce_field( 'add-' . $tax_name, '_ajax_nonce-add-' . $tax_name, false ); ?>
552
+					<input type="button" id="<?php echo $tax_name; ?>-add-submit" data-wp-lists="add:<?php echo $tax_name; ?>checklist:<?php echo $tax_name; ?>-add" class="button category-add-submit" value="<?php echo esc_attr($taxonomy->labels->add_new_item); ?>" />
553
+					<?php wp_nonce_field('add-'.$tax_name, '_ajax_nonce-add-'.$tax_name, false); ?>
554 554
 					<span id="<?php echo $tax_name; ?>-ajax-response"></span>
555 555
 				</p>
556 556
 			</div>
@@ -572,8 +572,8 @@  discard block
 block discarded – undo
572 572
 <p><?php
573 573
 	printf(
574 574
 		/* translators: %s: Codex URL */
575
-		__( 'Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.' ),
576
-		__( 'https://codex.wordpress.org/Excerpt' )
575
+		__('Excerpts are optional hand-crafted summaries of your content that can be used in your theme. <a href="%s">Learn more about manual excerpts</a>.'),
576
+		__('https://codex.wordpress.org/Excerpt')
577 577
 	);
578 578
 ?></p>
579 579
 <?php
@@ -587,32 +587,32 @@  discard block
 block discarded – undo
587 587
  * @param object $post
588 588
  */
589 589
 function post_trackback_meta_box($post) {
590
-	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="' .
591
-		esc_attr( str_replace( "\n", ' ', $post->to_ping ) ) . '" aria-describedby="trackback-url-desc" />';
590
+	$form_trackback = '<input type="text" name="trackback_url" id="trackback_url" class="code" value="'.
591
+		esc_attr(str_replace("\n", ' ', $post->to_ping)).'" aria-describedby="trackback-url-desc" />';
592 592
 	if ('' != $post->pinged) {
593
-		$pings = '<p>'. __('Already pinged:') . '</p><ul>';
593
+		$pings = '<p>'.__('Already pinged:').'</p><ul>';
594 594
 		$already_pinged = explode("\n", trim($post->pinged));
595 595
 		foreach ($already_pinged as $pinged_url) {
596
-			$pings .= "\n\t<li>" . esc_html($pinged_url) . "</li>";
596
+			$pings .= "\n\t<li>".esc_html($pinged_url)."</li>";
597 597
 		}
598 598
 		$pings .= '</ul>';
599 599
 	}
600 600
 
601 601
 ?>
602 602
 <p>
603
-	<label for="trackback_url"><?php _e( 'Send trackbacks to:' ); ?></label>
603
+	<label for="trackback_url"><?php _e('Send trackbacks to:'); ?></label>
604 604
 	<?php echo $form_trackback; ?>
605 605
 </p>
606
-<p id="trackback-url-desc" class="howto"><?php _e( 'Separate multiple URLs with spaces' ); ?></p>
606
+<p id="trackback-url-desc" class="howto"><?php _e('Separate multiple URLs with spaces'); ?></p>
607 607
 <p><?php
608 608
 	printf(
609 609
 		/* translators: %s: Codex URL */
610
-		__( 'Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites, they&#8217;ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.' ),
611
-		__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' )
610
+		__('Trackbacks are a way to notify legacy blog systems that you&#8217;ve linked to them. If you link other WordPress sites, they&#8217;ll be notified automatically using <a href="%s">pingbacks</a>, no other action necessary.'),
611
+		__('https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments')
612 612
 	);
613 613
 ?></p>
614 614
 <?php
615
-if ( ! empty($pings) )
615
+if ( ! empty($pings))
616 616
 	echo $pings;
617 617
 }
618 618
 
@@ -629,18 +629,18 @@  discard block
 block discarded – undo
629 629
 <div id="ajax-response"></div>
630 630
 <?php
631 631
 $metadata = has_meta($post->ID);
632
-foreach ( $metadata as $key => $value ) {
633
-	if ( is_protected_meta( $metadata[ $key ][ 'meta_key' ], 'post' ) || ! current_user_can( 'edit_post_meta', $post->ID, $metadata[ $key ][ 'meta_key' ] ) )
634
-		unset( $metadata[ $key ] );
632
+foreach ($metadata as $key => $value) {
633
+	if (is_protected_meta($metadata[$key]['meta_key'], 'post') || ! current_user_can('edit_post_meta', $post->ID, $metadata[$key]['meta_key']))
634
+		unset($metadata[$key]);
635 635
 }
636
-list_meta( $metadata );
637
-meta_form( $post ); ?>
636
+list_meta($metadata);
637
+meta_form($post); ?>
638 638
 </div>
639 639
 <p><?php
640 640
 	printf(
641 641
 		/* translators: %s: Codex URL */
642
-		__( 'Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.' ),
643
-		__( 'https://codex.wordpress.org/Using_Custom_Fields' )
642
+		__('Custom fields can be used to add extra metadata to a post that you can <a href="%s">use in your theme</a>.'),
643
+		__('https://codex.wordpress.org/Using_Custom_Fields')
644 644
 	);
645 645
 ?></p>
646 646
 <?php
@@ -657,12 +657,12 @@  discard block
 block discarded – undo
657 657
 ?>
658 658
 <input name="advanced_view" type="hidden" value="1" />
659 659
 <p class="meta-options">
660
-	<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e( 'Allow comments.' ) ?></label><br />
660
+	<label for="comment_status" class="selectit"><input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments.') ?></label><br />
661 661
 	<label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php
662 662
 		printf(
663 663
 			/* translators: %s: Codex URL */
664
-			__( 'Allow <a href="%s">trackbacks and pingbacks</a> on this page.' ),
665
-			__( 'https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments' ) );
664
+			__('Allow <a href="%s">trackbacks and pingbacks</a> on this page.'),
665
+			__('https://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments') );
666 666
 		?></label>
667 667
 	<?php
668 668
 	/**
@@ -672,7 +672,7 @@  discard block
 block discarded – undo
672 672
 	 *
673 673
 	 * @param WP_Post $post WP_Post object of the current post.
674 674
 	 */
675
-	do_action( 'post_comment_status_meta_box-options', $post );
675
+	do_action('post_comment_status_meta_box-options', $post);
676 676
 	?>
677 677
 </p>
678 678
 <?php
@@ -698,21 +698,21 @@  discard block
 block discarded – undo
698 698
  *
699 699
  * @param object $post
700 700
  */
701
-function post_comment_meta_box( $post ) {
702
-	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
701
+function post_comment_meta_box($post) {
702
+	wp_nonce_field('get-comments', 'add_comment_nonce', false);
703 703
 	?>
704 704
 	<p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p>
705 705
 	<?php
706 706
 
707
-	$total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) );
707
+	$total = get_comments(array('post_id' => $post->ID, 'number' => 1, 'count' => true));
708 708
 	$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');
709
-	$wp_list_table->display( true );
709
+	$wp_list_table->display(true);
710 710
 
711
-	if ( 1 > $total ) {
712
-		echo '<p id="no-comments">' . __('No comments yet.') . '</p>';
711
+	if (1 > $total) {
712
+		echo '<p id="no-comments">'.__('No comments yet.').'</p>';
713 713
 	} else {
714
-		$hidden = get_hidden_meta_boxes( get_current_screen() );
715
-		if ( ! in_array('commentsdiv', $hidden) ) {
714
+		$hidden = get_hidden_meta_boxes(get_current_screen());
715
+		if ( ! in_array('commentsdiv', $hidden)) {
716 716
 			?>
717 717
 			<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
718 718
 			<?php
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
735 735
  */
736 736
 function post_slug_meta_box($post) {
737 737
 /** This filter is documented in wp-admin/edit-tag-form.php */
738
-$editable_slug = apply_filters( 'editable_slug', $post->post_name, $post );
738
+$editable_slug = apply_filters('editable_slug', $post->post_name, $post);
739 739
 ?>
740
-<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr( $editable_slug ); ?>" />
740
+<label class="screen-reader-text" for="post_name"><?php _e('Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo esc_attr($editable_slug); ?>" />
741 741
 <?php
742 742
 }
743 743
 
@@ -755,13 +755,13 @@  discard block
 block discarded – undo
755 755
 ?>
756 756
 <label class="screen-reader-text" for="post_author_override"><?php _e('Author'); ?></label>
757 757
 <?php
758
-	wp_dropdown_users( array(
758
+	wp_dropdown_users(array(
759 759
 		'who' => 'authors',
760 760
 		'name' => 'post_author_override',
761 761
 		'selected' => empty($post->ID) ? $user_ID : $post->post_author,
762 762
 		'include_selected' => true,
763 763
 		'show' => 'display_name_with_login',
764
-	) );
764
+	));
765 765
 }
766 766
 
767 767
 /**
@@ -771,8 +771,8 @@  discard block
 block discarded – undo
771 771
  *
772 772
  * @param object $post
773 773
  */
774
-function post_revisions_meta_box( $post ) {
775
-	wp_list_post_revisions( $post );
774
+function post_revisions_meta_box($post) {
775
+	wp_list_post_revisions($post);
776 776
 }
777 777
 
778 778
 // -- Page related Meta Boxes
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
786 786
  */
787 787
 function page_attributes_meta_box($post) {
788 788
 	$post_type_object = get_post_type_object($post->post_type);
789
-	if ( $post_type_object->hierarchical ) {
789
+	if ($post_type_object->hierarchical) {
790 790
 		$dropdown_args = array(
791 791
 			'post_type'        => $post->post_type,
792 792
 			'exclude_tree'     => $post->ID,
@@ -807,9 +807,9 @@  discard block
 block discarded – undo
807 807
 		 * @param array   $dropdown_args Array of arguments used to generate the pages drop-down.
808 808
 		 * @param WP_Post $post          The current WP_Post object.
809 809
 		 */
810
-		$dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args, $post );
811
-		$pages = wp_dropdown_pages( $dropdown_args );
812
-		if ( ! empty($pages) ) {
810
+		$dropdown_args = apply_filters('page_attributes_dropdown_pages_args', $dropdown_args, $post);
811
+		$pages = wp_dropdown_pages($dropdown_args);
812
+		if ( ! empty($pages)) {
813 813
 ?>
814 814
 <p><strong><?php _e('Parent') ?></strong></p>
815 815
 <label class="screen-reader-text" for="parent_id"><?php _e('Parent') ?></label>
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 <?php
818 818
 		} // end empty pages check
819 819
 	} // end hierarchical check.
820
-	if ( 'page' == $post->post_type && 0 != count( get_page_templates( $post ) ) && get_option( 'page_for_posts' ) != $post->ID ) {
821
-		$template = !empty($post->page_template) ? $post->page_template : false;
820
+	if ('page' == $post->post_type && 0 != count(get_page_templates($post)) && get_option('page_for_posts') != $post->ID) {
821
+		$template = ! empty($post->page_template) ? $post->page_template : false;
822 822
 		?>
823 823
 <p><strong><?php _e('Template') ?></strong><?php
824 824
 	/**
@@ -830,7 +830,7 @@  discard block
 block discarded – undo
830 830
 	 * @param string  $template The template used for the current post.
831 831
 	 * @param WP_Post $post     The current post.
832 832
 	 */
833
-	do_action( 'page_attributes_meta_box_template', $template, $post );
833
+	do_action('page_attributes_meta_box_template', $template, $post);
834 834
 ?></p>
835 835
 <label class="screen-reader-text" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
836 836
 <?php
@@ -843,17 +843,17 @@  discard block
 block discarded – undo
843 843
  * @param string $context Where the option label is displayed. Possible values
844 844
  *                        include 'meta-box' or 'quick-edit'.
845 845
  */
846
-$default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'meta-box' );
846
+$default_title = apply_filters('default_page_template_title', __('Default Template'), 'meta-box');
847 847
 ?>
848
-<option value="default"><?php echo esc_html( $default_title ); ?></option>
848
+<option value="default"><?php echo esc_html($default_title); ?></option>
849 849
 <?php page_template_dropdown($template); ?>
850 850
 </select>
851 851
 <?php
852 852
 	} ?>
853 853
 <p><strong><?php _e('Order') ?></strong></p>
854 854
 <p><label class="screen-reader-text" for="menu_order"><?php _e('Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo esc_attr($post->menu_order) ?>" /></p>
855
-<?php if ( 'page' == $post->post_type && get_current_screen()->get_help_tabs() ) { ?>
856
-<p><?php _e( 'Need help? Use the Help tab in the upper right of your screen.' ); ?></p>
855
+<?php if ('page' == $post->post_type && get_current_screen()->get_help_tabs()) { ?>
856
+<p><?php _e('Need help? Use the Help tab in the upper right of your screen.'); ?></p>
857 857
 <?php
858 858
 	}
859 859
 }
@@ -875,12 +875,12 @@  discard block
 block discarded – undo
875 875
 
876 876
 <?php // Hidden submit button early on so that the browser chooses the right button when form is submitted with Return key ?>
877 877
 <div style="display:none;">
878
-<?php submit_button( __( 'Save' ), 'button', 'save', false ); ?>
878
+<?php submit_button(__('Save'), 'button', 'save', false); ?>
879 879
 </div>
880 880
 
881 881
 <div id="minor-publishing-actions">
882 882
 <div id="preview-action">
883
-<?php if ( !empty($link->link_id) ) { ?>
883
+<?php if ( ! empty($link->link_id)) { ?>
884 884
 	<a class="preview button" href="<?php echo $link->link_url; ?>" target="_blank"><?php _e('Visit Link'); ?></a>
885 885
 <?php } ?>
886 886
 </div>
@@ -898,20 +898,20 @@  discard block
 block discarded – undo
898 898
 <div id="major-publishing-actions">
899 899
 <?php
900 900
 /** This action is documented in wp-admin/includes/meta-boxes.php */
901
-do_action( 'post_submitbox_start' );
901
+do_action('post_submitbox_start');
902 902
 ?>
903 903
 <div id="delete-action">
904 904
 <?php
905
-if ( !empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links') ) { ?>
906
-	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_' . $link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name )); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
905
+if ( ! empty($_GET['action']) && 'edit' == $_GET['action'] && current_user_can('manage_links')) { ?>
906
+	<a class="submitdelete deletion" href="<?php echo wp_nonce_url("link.php?action=delete&amp;link_id=$link->link_id", 'delete-bookmark_'.$link->link_id); ?>" onclick="if ( confirm('<?php echo esc_js(sprintf(__("You are about to delete this link '%s'\n  'Cancel' to stop, 'OK' to delete."), $link->link_name)); ?>') ) {return true;}return false;"><?php _e('Delete'); ?></a>
907 907
 <?php } ?>
908 908
 </div>
909 909
 
910 910
 <div id="publishing-action">
911
-<?php if ( !empty($link->link_id) ) { ?>
912
-	<input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Update Link' ) ?>" />
911
+<?php if ( ! empty($link->link_id)) { ?>
912
+	<input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Update Link') ?>" />
913 913
 <?php } else { ?>
914
-	<input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e( 'Add Link' ) ?>" />
914
+	<input name="save" type="submit" class="button-large button-primary" id="publish" value="<?php esc_attr_e('Add Link') ?>" />
915 915
 <?php } ?>
916 916
 </div>
917 917
 <div class="clear"></div>
@@ -922,7 +922,7 @@  discard block
 block discarded – undo
922 922
  *
923 923
  * @since 2.5.0
924 924
  */
925
-do_action( 'submitlink_box' );
925
+do_action('submitlink_box');
926 926
 ?>
927 927
 <div class="clear"></div>
928 928
 </div>
@@ -940,14 +940,14 @@  discard block
 block discarded – undo
940 940
 ?>
941 941
 <div id="taxonomy-linkcategory" class="categorydiv">
942 942
 	<ul id="category-tabs" class="category-tabs">
943
-		<li class="tabs"><a href="#categories-all"><?php _e( 'All Categories' ); ?></a></li>
944
-		<li class="hide-if-no-js"><a href="#categories-pop"><?php _e( 'Most Used' ); ?></a></li>
943
+		<li class="tabs"><a href="#categories-all"><?php _e('All Categories'); ?></a></li>
944
+		<li class="hide-if-no-js"><a href="#categories-pop"><?php _e('Most Used'); ?></a></li>
945 945
 	</ul>
946 946
 
947 947
 	<div id="categories-all" class="tabs-panel">
948 948
 		<ul id="categorychecklist" data-wp-lists="list:category" class="categorychecklist form-no-clear">
949 949
 			<?php
950
-			if ( isset($link->link_id) )
950
+			if (isset($link->link_id))
951 951
 				wp_link_category_checklist($link->link_id);
952 952
 			else
953 953
 				wp_link_category_checklist();
@@ -962,12 +962,12 @@  discard block
 block discarded – undo
962 962
 	</div>
963 963
 
964 964
 	<div id="category-adder" class="wp-hidden-children">
965
-		<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e( '+ Add New Category' ); ?></a>
965
+		<a id="category-add-toggle" href="#category-add" class="taxonomy-add-new"><?php _e('+ Add New Category'); ?></a>
966 966
 		<p id="link-category-add" class="wp-hidden-child">
967
-			<label class="screen-reader-text" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
968
-			<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e( 'New category name' ); ?>" aria-required="true" />
969
-			<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e( 'Add' ); ?>" />
970
-			<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
967
+			<label class="screen-reader-text" for="newcat"><?php _e('+ Add New Category'); ?></label>
968
+			<input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php esc_attr_e('New category name'); ?>" aria-required="true" />
969
+			<input type="button" id="link-category-add-submit" data-wp-lists="add:categorychecklist:link-category-add" class="button" value="<?php esc_attr_e('Add'); ?>" />
970
+			<?php wp_nonce_field('add-link-category', '_ajax_nonce', false); ?>
971 971
 			<span id="category-ajax-response"></span>
972 972
 		</p>
973 973
 	</div>
@@ -985,13 +985,13 @@  discard block
 block discarded – undo
985 985
 function link_target_meta_box($link) { ?>
986 986
 <fieldset><legend class="screen-reader-text"><span><?php _e('Target') ?></span></legend>
987 987
 <p><label for="link_target_blank" class="selectit">
988
-<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
988
+<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo (isset($link->link_target) && ($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
989 989
 <?php _e('<code>_blank</code> &mdash; new window or tab.'); ?></label></p>
990 990
 <p><label for="link_target_top" class="selectit">
991
-<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo ( isset( $link->link_target ) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
991
+<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo (isset($link->link_target) && ($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
992 992
 <?php _e('<code>_top</code> &mdash; current window or tab, with no frames.'); ?></label></p>
993 993
 <p><label for="link_target_none" class="selectit">
994
-<input id="link_target_none" type="radio" name="link_target" value="" <?php echo ( isset( $link->link_target ) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
994
+<input id="link_target_none" type="radio" name="link_target" value="" <?php echo (isset($link->link_target) && ($link->link_target == '') ? 'checked="checked"' : ''); ?> />
995 995
 <?php _e('<code>_none</code> &mdash; same window or tab.'); ?></label></p>
996 996
 </fieldset>
997 997
 <p><?php _e('Choose the target frame for your link.'); ?></p>
@@ -1009,16 +1009,16 @@  discard block
 block discarded – undo
1009 1009
  * @param string $value
1010 1010
  * @param mixed $deprecated Never used.
1011 1011
  */
1012
-function xfn_check( $class, $value = '', $deprecated = '' ) {
1012
+function xfn_check($class, $value = '', $deprecated = '') {
1013 1013
 	global $link;
1014 1014
 
1015
-	if ( !empty( $deprecated ) )
1016
-		_deprecated_argument( __FUNCTION__, '0.0' ); // Never implemented
1015
+	if ( ! empty($deprecated))
1016
+		_deprecated_argument(__FUNCTION__, '0.0'); // Never implemented
1017 1017
 
1018
-	$link_rel = isset( $link->link_rel ) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
1018
+	$link_rel = isset($link->link_rel) ? $link->link_rel : ''; // In PHP 5.3: $link_rel = $link->link_rel ?: '';
1019 1019
 	$rels = preg_split('/\s+/', $link_rel);
1020 1020
 
1021
-	if ('' != $value && in_array($value, $rels) ) {
1021
+	if ('' != $value && in_array($value, $rels)) {
1022 1022
 		echo ' checked="checked"';
1023 1023
 	}
1024 1024
 
@@ -1026,7 +1026,7 @@  discard block
 block discarded – undo
1026 1026
 		if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
1027 1027
 		if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
1028 1028
 		if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
1029
-		if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
1029
+		if ('identity' == $class && in_array('me', $rels)) echo ' checked="checked"';
1030 1030
 	}
1031 1031
 }
1032 1032
 
@@ -1042,7 +1042,7 @@  discard block
 block discarded – undo
1042 1042
 <table class="links-table">
1043 1043
 	<tr>
1044 1044
 		<th scope="row"><label for="link_rel"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('rel:') ?></label></th>
1045
-		<td><input type="text" name="link_rel" id="link_rel" value="<?php echo ( isset( $link->link_rel ) ? esc_attr($link->link_rel) : ''); ?>" /></td>
1045
+		<td><input type="text" name="link_rel" id="link_rel" value="<?php echo (isset($link->link_rel) ? esc_attr($link->link_rel) : ''); ?>" /></td>
1046 1046
 	</tr>
1047 1047
 	<tr>
1048 1048
 		<th scope="row"><?php /* translators: xfn: http://gmpg.org/xfn/ */ _e('identity') ?></th>
@@ -1160,25 +1160,25 @@  discard block
 block discarded – undo
1160 1160
 <table class="links-table" cellpadding="0">
1161 1161
 	<tr>
1162 1162
 		<th scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
1163
-		<td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo ( isset( $link->link_image ) ? esc_attr($link->link_image) : ''); ?>" /></td>
1163
+		<td><input type="text" name="link_image" class="code" id="link_image" maxlength="255" value="<?php echo (isset($link->link_image) ? esc_attr($link->link_image) : ''); ?>" /></td>
1164 1164
 	</tr>
1165 1165
 	<tr>
1166 1166
 		<th scope="row"><label for="rss_uri"><?php _e('RSS Address') ?></label></th>
1167
-		<td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo ( isset( $link->link_rss ) ? esc_attr($link->link_rss) : ''); ?>" /></td>
1167
+		<td><input name="link_rss" class="code" type="text" id="rss_uri" maxlength="255" value="<?php echo (isset($link->link_rss) ? esc_attr($link->link_rss) : ''); ?>" /></td>
1168 1168
 	</tr>
1169 1169
 	<tr>
1170 1170
 		<th scope="row"><label for="link_notes"><?php _e('Notes') ?></label></th>
1171
-		<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo ( isset( $link->link_notes ) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
1171
+		<td><textarea name="link_notes" id="link_notes" rows="10"><?php echo (isset($link->link_notes) ? $link->link_notes : ''); // textarea_escaped ?></textarea></td>
1172 1172
 	</tr>
1173 1173
 	<tr>
1174 1174
 		<th scope="row"><label for="link_rating"><?php _e('Rating') ?></label></th>
1175 1175
 		<td><select name="link_rating" id="link_rating" size="1">
1176 1176
 		<?php
1177
-			for ( $r = 0; $r <= 10; $r++ ) {
1178
-				echo '<option value="' . $r . '"';
1179
-				if ( isset($link->link_rating) && $link->link_rating == $r )
1177
+			for ($r = 0; $r <= 10; $r++) {
1178
+				echo '<option value="'.$r.'"';
1179
+				if (isset($link->link_rating) && $link->link_rating == $r)
1180 1180
 					echo ' selected="selected"';
1181
-				echo('>' . $r . '</option>');
1181
+				echo('>'.$r.'</option>');
1182 1182
 			}
1183 1183
 		?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?>
1184 1184
 		</td>
@@ -1194,9 +1194,9 @@  discard block
 block discarded – undo
1194 1194
  *
1195 1195
  * @param WP_Post $post A post object.
1196 1196
  */
1197
-function post_thumbnail_meta_box( $post ) {
1198
-	$thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true );
1199
-	echo _wp_post_thumbnail_html( $thumbnail_id, $post->ID );
1197
+function post_thumbnail_meta_box($post) {
1198
+	$thumbnail_id = get_post_meta($post->ID, '_thumbnail_id', true);
1199
+	echo _wp_post_thumbnail_html($thumbnail_id, $post->ID);
1200 1200
 }
1201 1201
 
1202 1202
 /**
@@ -1206,18 +1206,18 @@  discard block
 block discarded – undo
1206 1206
  *
1207 1207
  * @param WP_Post $post A post object.
1208 1208
  */
1209
-function attachment_id3_data_meta_box( $post ) {
1209
+function attachment_id3_data_meta_box($post) {
1210 1210
 	$meta = array();
1211
-	if ( ! empty( $post->ID ) ) {
1212
-		$meta = wp_get_attachment_metadata( $post->ID );
1211
+	if ( ! empty($post->ID)) {
1212
+		$meta = wp_get_attachment_metadata($post->ID);
1213 1213
 	}
1214 1214
 
1215
-	foreach ( wp_get_attachment_id3_keys( $post, 'edit' ) as $key => $label ) : ?>
1215
+	foreach (wp_get_attachment_id3_keys($post, 'edit') as $key => $label) : ?>
1216 1216
 	<p>
1217 1217
 		<label for="title"><?php echo $label ?></label><br />
1218
-		<input type="text" name="id3_<?php echo esc_attr( $key ) ?>" id="id3_<?php echo esc_attr( $key ) ?>" class="large-text" value="<?php
1219
-			if ( ! empty( $meta[ $key ] ) ) {
1220
-				echo esc_attr( $meta[ $key ] );
1218
+		<input type="text" name="id3_<?php echo esc_attr($key) ?>" id="id3_<?php echo esc_attr($key) ?>" class="large-text" value="<?php
1219
+			if ( ! empty($meta[$key])) {
1220
+				echo esc_attr($meta[$key]);
1221 1221
 			}
1222 1222
 		?>" />
1223 1223
 	</p>
Please login to merge, or discard this patch.
src/wp-admin/includes/image.php 1 patch
Spacing   +163 added lines, -163 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;
@@ -73,13 +73,13 @@  discard block
 block discarded – undo
73 73
  * @param string $file Filepath of the Attached image.
74 74
  * @return mixed Metadata for attachment.
75 75
  */
76
-function wp_generate_attachment_metadata( $attachment_id, $file ) {
77
-	$attachment = get_post( $attachment_id );
76
+function wp_generate_attachment_metadata($attachment_id, $file) {
77
+	$attachment = get_post($attachment_id);
78 78
 
79 79
 	$metadata = array();
80 80
 	$support = false;
81
-	if ( preg_match('!^image/!', get_post_mime_type( $attachment )) && file_is_displayable_image($file) ) {
82
-		$imagesize = getimagesize( $file );
81
+	if (preg_match('!^image/!', get_post_mime_type($attachment)) && file_is_displayable_image($file)) {
82
+		$imagesize = getimagesize($file);
83 83
 		$metadata['width'] = $imagesize[0];
84 84
 		$metadata['height'] = $imagesize[1];
85 85
 
@@ -90,20 +90,20 @@  discard block
 block discarded – undo
90 90
 		global $_wp_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'] ) )
96
-				$sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] ); // For theme-added sizes
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
+				$sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']); // For theme-added sizes
97 97
 			else
98
-				$sizes[$s]['width'] = get_option( "{$s}_size_w" ); // For default sizes set in options
99
-			if ( isset( $_wp_additional_image_sizes[$s]['height'] ) )
100
-				$sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] ); // For theme-added sizes
98
+				$sizes[$s]['width'] = get_option("{$s}_size_w"); // For default sizes set in options
99
+			if (isset($_wp_additional_image_sizes[$s]['height']))
100
+				$sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']); // For theme-added sizes
101 101
 			else
102
-				$sizes[$s]['height'] = get_option( "{$s}_size_h" ); // For default sizes set in options
103
-			if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) )
102
+				$sizes[$s]['height'] = get_option("{$s}_size_h"); // For default sizes set in options
103
+			if (isset($_wp_additional_image_sizes[$s]['crop']))
104 104
 				$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop']; // For theme-added sizes
105 105
 			else
106
-				$sizes[$s]['crop'] = get_option( "{$s}_crop" ); // For default sizes set in options
106
+				$sizes[$s]['crop'] = get_option("{$s}_crop"); // For default sizes set in options
107 107
 		}
108 108
 
109 109
 		/**
@@ -115,34 +115,34 @@  discard block
 block discarded – undo
115 115
 		 * @param array $sizes    An associative array of image sizes.
116 116
 		 * @param array $metadata An associative array of image metadata: width, height, file.
117 117
 		 */
118
-		$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata );
118
+		$sizes = apply_filters('intermediate_image_sizes_advanced', $sizes, $metadata);
119 119
 
120
-		if ( $sizes ) {
121
-			$editor = wp_get_image_editor( $file );
120
+		if ($sizes) {
121
+			$editor = wp_get_image_editor($file);
122 122
 
123
-			if ( ! is_wp_error( $editor ) )
124
-				$metadata['sizes'] = $editor->multi_resize( $sizes );
123
+			if ( ! is_wp_error($editor))
124
+				$metadata['sizes'] = $editor->multi_resize($sizes);
125 125
 		} else {
126 126
 			$metadata['sizes'] = array();
127 127
 		}
128 128
 
129 129
 		// Fetch additional metadata from EXIF/IPTC.
130
-		$image_meta = wp_read_image_metadata( $file );
131
-		if ( $image_meta )
130
+		$image_meta = wp_read_image_metadata($file);
131
+		if ($image_meta)
132 132
 			$metadata['image_meta'] = $image_meta;
133 133
 
134
-	} elseif ( wp_attachment_is( 'video', $attachment ) ) {
135
-		$metadata = wp_read_video_metadata( $file );
136
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' );
137
-	} elseif ( wp_attachment_is( 'audio', $attachment ) ) {
138
-		$metadata = wp_read_audio_metadata( $file );
139
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' );
134
+	} elseif (wp_attachment_is('video', $attachment)) {
135
+		$metadata = wp_read_video_metadata($file);
136
+		$support = current_theme_supports('post-thumbnails', 'attachment:video') || post_type_supports('attachment:video', 'thumbnail');
137
+	} elseif (wp_attachment_is('audio', $attachment)) {
138
+		$metadata = wp_read_audio_metadata($file);
139
+		$support = current_theme_supports('post-thumbnails', 'attachment:audio') || post_type_supports('attachment:audio', 'thumbnail');
140 140
 	}
141 141
 
142
-	if ( $support && ! empty( $metadata['image']['data'] ) ) {
142
+	if ($support && ! empty($metadata['image']['data'])) {
143 143
 		// Check for existing cover.
144
-		$hash = md5( $metadata['image']['data'] );
145
-		$posts = get_posts( array(
144
+		$hash = md5($metadata['image']['data']);
145
+		$posts = get_posts(array(
146 146
 			'fields' => 'ids',
147 147
 			'post_type' => 'attachment',
148 148
 			'post_mime_type' => $metadata['image']['mime'],
@@ -150,14 +150,14 @@  discard block
 block discarded – undo
150 150
 			'posts_per_page' => 1,
151 151
 			'meta_key' => '_cover_hash',
152 152
 			'meta_value' => $hash
153
-		) );
154
-		$exists = reset( $posts );
153
+		));
154
+		$exists = reset($posts);
155 155
 
156
-		if ( ! empty( $exists ) ) {
157
-			update_post_meta( $attachment_id, '_thumbnail_id', $exists );
156
+		if ( ! empty($exists)) {
157
+			update_post_meta($attachment_id, '_thumbnail_id', $exists);
158 158
 		} else {
159 159
 			$ext = '.jpg';
160
-			switch ( $metadata['image']['mime'] ) {
160
+			switch ($metadata['image']['mime']) {
161 161
 			case 'image/gif':
162 162
 				$ext = '.gif';
163 163
 				break;
@@ -165,9 +165,9 @@  discard block
 block discarded – undo
165 165
 				$ext = '.png';
166 166
 				break;
167 167
 			}
168
-			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
169
-			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
170
-			if ( false === $uploaded['error'] ) {
168
+			$basename = str_replace('.', '-', basename($file)).'-image'.$ext;
169
+			$uploaded = wp_upload_bits($basename, '', $metadata['image']['data']);
170
+			if (false === $uploaded['error']) {
171 171
 				$image_attachment = array(
172 172
 					'post_mime_type' => $metadata['image']['mime'],
173 173
 					'post_type' => 'attachment',
@@ -182,20 +182,20 @@  discard block
 block discarded – undo
182 182
 				 * @param array $metadata         Current attachment metadata.
183 183
 				 * @param array $uploaded         An array containing the thumbnail path and url.
184 184
 				 */
185
-				$image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded );
185
+				$image_attachment = apply_filters('attachment_thumbnail_args', $image_attachment, $metadata, $uploaded);
186 186
 
187
-				$sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] );
188
-				add_post_meta( $sub_attachment_id, '_cover_hash', $hash );
189
-				$attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] );
190
-				wp_update_attachment_metadata( $sub_attachment_id, $attach_data );
191
-				update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id );
187
+				$sub_attachment_id = wp_insert_attachment($image_attachment, $uploaded['file']);
188
+				add_post_meta($sub_attachment_id, '_cover_hash', $hash);
189
+				$attach_data = wp_generate_attachment_metadata($sub_attachment_id, $uploaded['file']);
190
+				wp_update_attachment_metadata($sub_attachment_id, $attach_data);
191
+				update_post_meta($attachment_id, '_thumbnail_id', $sub_attachment_id);
192 192
 			}
193 193
 		}
194 194
 	}
195 195
 
196 196
 	// Remove the blob of binary data from the array.
197
-	if ( $metadata ) {
198
-		unset( $metadata['image']['data'] );
197
+	if ($metadata) {
198
+		unset($metadata['image']['data']);
199 199
 	}
200 200
 
201 201
 	/**
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	 * @param array $metadata      An array of attachment meta data.
207 207
 	 * @param int   $attachment_id Current attachment ID.
208 208
 	 */
209
-	return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
209
+	return apply_filters('wp_generate_attachment_metadata', $metadata, $attachment_id);
210 210
 }
211 211
 
212 212
 /**
@@ -218,8 +218,8 @@  discard block
 block discarded – undo
218 218
  * @return int|float
219 219
  */
220 220
 function wp_exif_frac2dec($str) {
221
-	@list( $n, $d ) = explode( '/', $str );
222
-	if ( !empty($d) )
221
+	@list($n, $d) = explode('/', $str);
222
+	if ( ! empty($d))
223 223
 		return $n / $d;
224 224
 	return $str;
225 225
 }
@@ -233,10 +233,10 @@  discard block
 block discarded – undo
233 233
  * @return int
234 234
  */
235 235
 function wp_exif_date2ts($str) {
236
-	@list( $date, $time ) = explode( ' ', trim($str) );
237
-	@list( $y, $m, $d ) = explode( ':', $date );
236
+	@list($date, $time) = explode(' ', trim($str));
237
+	@list($y, $m, $d) = explode(':', $date);
238 238
 
239
-	return strtotime( "{$y}-{$m}-{$d} {$time}" );
239
+	return strtotime("{$y}-{$m}-{$d} {$time}");
240 240
 }
241 241
 
242 242
 /**
@@ -255,11 +255,11 @@  discard block
 block discarded – undo
255 255
  * @param string $file
256 256
  * @return bool|array False on failure. Image metadata array on success.
257 257
  */
258
-function wp_read_image_metadata( $file ) {
259
-	if ( ! file_exists( $file ) )
258
+function wp_read_image_metadata($file) {
259
+	if ( ! file_exists($file))
260 260
 		return false;
261 261
 
262
-	list( , , $sourceImageType ) = getimagesize( $file );
262
+	list(,, $sourceImageType) = getimagesize($file);
263 263
 
264 264
 	/*
265 265
 	 * EXIF contains a bunch of data we'll probably never need formatted in ways
@@ -287,31 +287,31 @@  discard block
 block discarded – undo
287 287
 	 * Read IPTC first, since it might contain data not available in exif such
288 288
 	 * as caption, description etc.
289 289
 	 */
290
-	if ( is_callable( 'iptcparse' ) ) {
291
-		getimagesize( $file, $info );
290
+	if (is_callable('iptcparse')) {
291
+		getimagesize($file, $info);
292 292
 
293
-		if ( ! empty( $info['APP13'] ) ) {
294
-			$iptc = iptcparse( $info['APP13'] );
293
+		if ( ! empty($info['APP13'])) {
294
+			$iptc = iptcparse($info['APP13']);
295 295
 
296 296
 			// Headline, "A brief synopsis of the caption."
297
-			if ( ! empty( $iptc['2#105'][0] ) ) {
298
-				$meta['title'] = trim( $iptc['2#105'][0] );
297
+			if ( ! empty($iptc['2#105'][0])) {
298
+				$meta['title'] = trim($iptc['2#105'][0]);
299 299
 			/*
300 300
 			 * Title, "Many use the Title field to store the filename of the image,
301 301
 			 * though the field may be used in many ways."
302 302
 			 */
303
-			} elseif ( ! empty( $iptc['2#005'][0] ) ) {
304
-				$meta['title'] = trim( $iptc['2#005'][0] );
303
+			} elseif ( ! empty($iptc['2#005'][0])) {
304
+				$meta['title'] = trim($iptc['2#005'][0]);
305 305
 			}
306 306
 
307
-			if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
308
-				$caption = trim( $iptc['2#120'][0] );
307
+			if ( ! empty($iptc['2#120'][0])) { // description / legacy caption
308
+				$caption = trim($iptc['2#120'][0]);
309 309
 
310 310
 				mbstring_binary_safe_encoding();
311
-				$caption_length = strlen( $caption );
311
+				$caption_length = strlen($caption);
312 312
 				reset_mbstring_encoding();
313 313
 
314
-				if ( empty( $meta['title'] ) && $caption_length < 80 ) {
314
+				if (empty($meta['title']) && $caption_length < 80) {
315 315
 					// Assume the title is stored in 2:120 if it's short.
316 316
 					$meta['title'] = $caption;
317 317
 				}
@@ -319,19 +319,19 @@  discard block
 block discarded – undo
319 319
 				$meta['caption'] = $caption;
320 320
 			}
321 321
 
322
-			if ( ! empty( $iptc['2#110'][0] ) ) // credit
323
-				$meta['credit'] = trim( $iptc['2#110'][0] );
324
-			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
325
-				$meta['credit'] = trim( $iptc['2#080'][0] );
322
+			if ( ! empty($iptc['2#110'][0])) // credit
323
+				$meta['credit'] = trim($iptc['2#110'][0]);
324
+			elseif ( ! empty($iptc['2#080'][0])) // creator / legacy byline
325
+				$meta['credit'] = trim($iptc['2#080'][0]);
326 326
 
327
-			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time
328
-				$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
327
+			if ( ! empty($iptc['2#055'][0]) && ! empty($iptc['2#060'][0])) // created date and time
328
+				$meta['created_timestamp'] = strtotime($iptc['2#055'][0].' '.$iptc['2#060'][0]);
329 329
 
330
-			if ( ! empty( $iptc['2#116'][0] ) ) // copyright
331
-				$meta['copyright'] = trim( $iptc['2#116'][0] );
330
+			if ( ! empty($iptc['2#116'][0])) // copyright
331
+				$meta['copyright'] = trim($iptc['2#116'][0]);
332 332
 
333
-			if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
334
-				$meta['keywords'] = array_values( $iptc['2#025'] );
333
+			if ( ! empty($iptc['2#025'][0])) { // keywords array
334
+				$meta['keywords'] = array_values($iptc['2#025']);
335 335
 			}
336 336
 		 }
337 337
 	}
@@ -343,78 +343,78 @@  discard block
 block discarded – undo
343 343
 	 *
344 344
 	 * @param array $image_types Image types to check for exif data.
345 345
 	 */
346
-	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 ) ) ) ) {
347
-		$exif = @exif_read_data( $file );
346
+	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)))) {
347
+		$exif = @exif_read_data($file);
348 348
 
349
-		if ( ! empty( $exif['ImageDescription'] ) ) {
349
+		if ( ! empty($exif['ImageDescription'])) {
350 350
 			mbstring_binary_safe_encoding();
351
-			$description_length = strlen( $exif['ImageDescription'] );
351
+			$description_length = strlen($exif['ImageDescription']);
352 352
 			reset_mbstring_encoding();
353 353
 
354
-			if ( empty( $meta['title'] ) && $description_length < 80 ) {
354
+			if (empty($meta['title']) && $description_length < 80) {
355 355
 				// Assume the title is stored in ImageDescription
356
-				$meta['title'] = trim( $exif['ImageDescription'] );
356
+				$meta['title'] = trim($exif['ImageDescription']);
357 357
 			}
358 358
 
359
-			if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) {
360
-				$meta['caption'] = trim( $exif['COMPUTED']['UserComment'] );
359
+			if (empty($meta['caption']) && ! empty($exif['COMPUTED']['UserComment'])) {
360
+				$meta['caption'] = trim($exif['COMPUTED']['UserComment']);
361 361
 			}
362 362
 
363
-			if ( empty( $meta['caption'] ) ) {
364
-				$meta['caption'] = trim( $exif['ImageDescription'] );
363
+			if (empty($meta['caption'])) {
364
+				$meta['caption'] = trim($exif['ImageDescription']);
365 365
 			}
366
-		} elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) {
367
-			$meta['caption'] = trim( $exif['Comments'] );
366
+		} elseif (empty($meta['caption']) && ! empty($exif['Comments'])) {
367
+			$meta['caption'] = trim($exif['Comments']);
368 368
 		}
369 369
 
370
-		if ( empty( $meta['credit'] ) ) {
371
-			if ( ! empty( $exif['Artist'] ) ) {
372
-				$meta['credit'] = trim( $exif['Artist'] );
373
-			} elseif ( ! empty($exif['Author'] ) ) {
374
-				$meta['credit'] = trim( $exif['Author'] );
370
+		if (empty($meta['credit'])) {
371
+			if ( ! empty($exif['Artist'])) {
372
+				$meta['credit'] = trim($exif['Artist']);
373
+			} elseif ( ! empty($exif['Author'])) {
374
+				$meta['credit'] = trim($exif['Author']);
375 375
 			}
376 376
 		}
377 377
 
378
-		if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
379
-			$meta['copyright'] = trim( $exif['Copyright'] );
378
+		if (empty($meta['copyright']) && ! empty($exif['Copyright'])) {
379
+			$meta['copyright'] = trim($exif['Copyright']);
380 380
 		}
381
-		if ( ! empty( $exif['FNumber'] ) ) {
382
-			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
381
+		if ( ! empty($exif['FNumber'])) {
382
+			$meta['aperture'] = round(wp_exif_frac2dec($exif['FNumber']), 2);
383 383
 		}
384
-		if ( ! empty( $exif['Model'] ) ) {
385
-			$meta['camera'] = trim( $exif['Model'] );
384
+		if ( ! empty($exif['Model'])) {
385
+			$meta['camera'] = trim($exif['Model']);
386 386
 		}
387
-		if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
388
-			$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
387
+		if (empty($meta['created_timestamp']) && ! empty($exif['DateTimeDigitized'])) {
388
+			$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
389 389
 		}
390
-		if ( ! empty( $exif['FocalLength'] ) ) {
391
-			$meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
390
+		if ( ! empty($exif['FocalLength'])) {
391
+			$meta['focal_length'] = (string) wp_exif_frac2dec($exif['FocalLength']);
392 392
 		}
393
-		if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
394
-			$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
395
-			$meta['iso'] = trim( $meta['iso'] );
393
+		if ( ! empty($exif['ISOSpeedRatings'])) {
394
+			$meta['iso'] = is_array($exif['ISOSpeedRatings']) ? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings'];
395
+			$meta['iso'] = trim($meta['iso']);
396 396
 		}
397
-		if ( ! empty( $exif['ExposureTime'] ) ) {
398
-			$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
397
+		if ( ! empty($exif['ExposureTime'])) {
398
+			$meta['shutter_speed'] = (string) wp_exif_frac2dec($exif['ExposureTime']);
399 399
 		}
400
-		if ( ! empty( $exif['Orientation'] ) ) {
400
+		if ( ! empty($exif['Orientation'])) {
401 401
 			$meta['orientation'] = $exif['Orientation'];
402 402
 		}
403 403
 	}
404 404
 
405
-	foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
406
-		if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
407
-			$meta[ $key ] = utf8_encode( $meta[ $key ] );
405
+	foreach (array('title', 'caption', 'credit', 'copyright', 'camera', 'iso') as $key) {
406
+		if ($meta[$key] && ! seems_utf8($meta[$key])) {
407
+			$meta[$key] = utf8_encode($meta[$key]);
408 408
 		}
409 409
 	}
410 410
 
411
-	foreach ( $meta['keywords'] as $key => $keyword ) {
412
-		if ( ! seems_utf8( $keyword ) ) {
413
-			$meta['keywords'][ $key ] = utf8_encode( $keyword );
411
+	foreach ($meta['keywords'] as $key => $keyword) {
412
+		if ( ! seems_utf8($keyword)) {
413
+			$meta['keywords'][$key] = utf8_encode($keyword);
414 414
 		}
415 415
 	}
416 416
 
417
-	$meta = wp_kses_post_deep( $meta );
417
+	$meta = wp_kses_post_deep($meta);
418 418
 
419 419
 	/**
420 420
 	 * Filter the array of meta data read from an image's exif data.
@@ -427,7 +427,7 @@  discard block
 block discarded – undo
427 427
 	 * @param int    $sourceImageType Type of image.
428 428
 	 * @param array  $iptc            IPTC data.
429 429
 	 */
430
-	return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc );
430
+	return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc);
431 431
 
432 432
 }
433 433
 
@@ -441,7 +441,7 @@  discard block
 block discarded – undo
441 441
  */
442 442
 function file_is_valid_image($path) {
443 443
 	$size = @getimagesize($path);
444
-	return !empty($size);
444
+	return ! empty($size);
445 445
 }
446 446
 
447 447
 /**
@@ -453,12 +453,12 @@  discard block
 block discarded – undo
453 453
  * @return bool True if suitable, false if not suitable.
454 454
  */
455 455
 function file_is_displayable_image($path) {
456
-	$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
456
+	$displayable_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP);
457 457
 
458
-	$info = @getimagesize( $path );
459
-	if ( empty( $info ) ) {
458
+	$info = @getimagesize($path);
459
+	if (empty($info)) {
460 460
 		$result = false;
461
-	} elseif ( ! in_array( $info[2], $displayable_image_types ) ) {
461
+	} elseif ( ! in_array($info[2], $displayable_image_types)) {
462 462
 		$result = false;
463 463
 	} else {
464 464
 		$result = true;
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
 	 * @param bool   $result Whether the image can be displayed. Default true.
473 473
 	 * @param string $path   Path to the image.
474 474
 	 */
475
-	return apply_filters( 'file_is_displayable_image', $result, $path );
475
+	return apply_filters('file_is_displayable_image', $result, $path);
476 476
 }
477 477
 
478 478
 /**
@@ -485,12 +485,12 @@  discard block
 block discarded – undo
485 485
  * @param string $size Optional. Image size, defaults to 'full'.
486 486
  * @return resource|false The resulting image resource on success, false on failure.
487 487
  */
488
-function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
489
-	$filepath = _load_image_to_edit_path( $attachment_id, $size );
490
-	if ( empty( $filepath ) )
488
+function load_image_to_edit($attachment_id, $mime_type, $size = 'full') {
489
+	$filepath = _load_image_to_edit_path($attachment_id, $size);
490
+	if (empty($filepath))
491 491
 		return false;
492 492
 
493
-	switch ( $mime_type ) {
493
+	switch ($mime_type) {
494 494
 		case 'image/jpeg':
495 495
 			$image = imagecreatefromjpeg($filepath);
496 496
 			break;
@@ -504,7 +504,7 @@  discard block
 block discarded – undo
504 504
 			$image = false;
505 505
 			break;
506 506
 	}
507
-	if ( is_resource($image) ) {
507
+	if (is_resource($image)) {
508 508
 		/**
509 509
 		 * Filter the current image being loaded for editing.
510 510
 		 *
@@ -514,8 +514,8 @@  discard block
 block discarded – undo
514 514
 		 * @param string   $attachment_id Attachment ID.
515 515
 		 * @param string   $size          Image size.
516 516
 		 */
517
-		$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
518
-		if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
517
+		$image = apply_filters('load_image_to_edit', $image, $attachment_id, $size);
518
+		if (function_exists('imagealphablending') && function_exists('imagesavealpha')) {
519 519
 			imagealphablending($image, false);
520 520
 			imagesavealpha($image, true);
521 521
 		}
@@ -536,11 +536,11 @@  discard block
 block discarded – undo
536 536
  * @param string $size Optional. Image size, defaults to 'full'.
537 537
  * @return string|false File path or url on success, false on failure.
538 538
  */
539
-function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
540
-	$filepath = get_attached_file( $attachment_id );
539
+function _load_image_to_edit_path($attachment_id, $size = 'full') {
540
+	$filepath = get_attached_file($attachment_id);
541 541
 
542
-	if ( $filepath && file_exists( $filepath ) ) {
543
-		if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) {
542
+	if ($filepath && file_exists($filepath)) {
543
+		if ('full' != $size && ($data = image_get_intermediate_size($attachment_id, $size))) {
544 544
 			/**
545 545
 			 * Filter the path to the current image.
546 546
 			 *
@@ -552,9 +552,9 @@  discard block
 block discarded – undo
552 552
 			 * @param string $attachment_id Attachment ID.
553 553
 			 * @param string $size          Size of the image.
554 554
 			 */
555
-			$filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size );
555
+			$filepath = apply_filters('load_image_to_edit_filesystempath', path_join(dirname($filepath), $data['file']), $attachment_id, $size);
556 556
 		}
557
-	} elseif ( function_exists( 'fopen' ) && function_exists( 'ini_get' ) && true == ini_get( 'allow_url_fopen' ) ) {
557
+	} elseif (function_exists('fopen') && function_exists('ini_get') && true == ini_get('allow_url_fopen')) {
558 558
 		/**
559 559
 		 * Filter the image URL if not in the local filesystem.
560 560
 		 *
@@ -566,7 +566,7 @@  discard block
 block discarded – undo
566 566
 		 * @param string $attachment_id Attachment ID.
567 567
 		 * @param string $size          Size of the image.
568 568
 		 */
569
-		$filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
569
+		$filepath = apply_filters('load_image_to_edit_attachmenturl', wp_get_attachment_url($attachment_id), $attachment_id, $size);
570 570
 	}
571 571
 
572 572
 	/**
@@ -578,7 +578,7 @@  discard block
 block discarded – undo
578 578
 	 * @param string      $attachment_id Attachment ID.
579 579
 	 * @param string      $size          Size of the image.
580 580
 	 */
581
-	return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
581
+	return apply_filters('load_image_to_edit_path', $filepath, $attachment_id, $size);
582 582
 }
583 583
 
584 584
 /**
@@ -590,22 +590,22 @@  discard block
 block discarded – undo
590 590
  * @param string $attachment_id Attachment ID.
591 591
  * @return string|false New file path on success, false on failure.
592 592
  */
593
-function _copy_image_file( $attachment_id ) {
594
-	$dst_file = $src_file = get_attached_file( $attachment_id );
595
-	if ( ! file_exists( $src_file ) )
596
-		$src_file = _load_image_to_edit_path( $attachment_id );
593
+function _copy_image_file($attachment_id) {
594
+	$dst_file = $src_file = get_attached_file($attachment_id);
595
+	if ( ! file_exists($src_file))
596
+		$src_file = _load_image_to_edit_path($attachment_id);
597 597
 
598
-	if ( $src_file ) {
599
-		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
600
-		$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
598
+	if ($src_file) {
599
+		$dst_file = str_replace(basename($dst_file), 'copy-'.basename($dst_file), $dst_file);
600
+		$dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file));
601 601
 
602 602
 		/*
603 603
 		 * The directory containing the original file may no longer
604 604
 		 * exist when using a replication plugin.
605 605
 		 */
606
-		wp_mkdir_p( dirname( $dst_file ) );
606
+		wp_mkdir_p(dirname($dst_file));
607 607
 
608
-		if ( ! @copy( $src_file, $dst_file ) )
608
+		if ( ! @copy($src_file, $dst_file))
609 609
 			$dst_file = false;
610 610
 	} else {
611 611
 		$dst_file = false;
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-plugin-install-list-table.php 1 patch
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -46,15 +46,15 @@  discard block
 block discarded – undo
46 46
 	protected function get_installed_plugin_slugs() {
47 47
 		$slugs = array();
48 48
 
49
-		$plugin_info = get_site_transient( 'update_plugins' );
50
-		if ( isset( $plugin_info->no_update ) ) {
51
-			foreach ( $plugin_info->no_update as $plugin ) {
49
+		$plugin_info = get_site_transient('update_plugins');
50
+		if (isset($plugin_info->no_update)) {
51
+			foreach ($plugin_info->no_update as $plugin) {
52 52
 				$slugs[] = $plugin->slug;
53 53
 			}
54 54
 		}
55 55
 
56
-		if ( isset( $plugin_info->response ) ) {
57
-			foreach ( $plugin_info->response as $plugin ) {
56
+		if (isset($plugin_info->response)) {
57
+			foreach ($plugin_info->response as $plugin) {
58 58
 				$slugs[] = $plugin->slug;
59 59
 			}
60 60
 		}
@@ -72,11 +72,11 @@  discard block
 block discarded – undo
72 72
 	 * @global string $wp_version
73 73
 	 */
74 74
 	public function prepare_items() {
75
-		include( ABSPATH . 'wp-admin/includes/plugin-install.php' );
75
+		include(ABSPATH.'wp-admin/includes/plugin-install.php');
76 76
 
77 77
 		global $tabs, $tab, $paged, $type, $term;
78 78
 
79
-		wp_reset_vars( array( 'tab' ) );
79
+		wp_reset_vars(array('tab'));
80 80
 
81 81
 		$paged = $this->get_pagenum();
82 82
 
@@ -85,23 +85,23 @@  discard block
 block discarded – undo
85 85
 		// These are the tabs which are shown on the page
86 86
 		$tabs = array();
87 87
 
88
-		if ( 'search' === $tab ) {
89
-			$tabs['search'] = __( 'Search Results' );
88
+		if ('search' === $tab) {
89
+			$tabs['search'] = __('Search Results');
90 90
 		}
91
-		if ( $tab === 'beta' || false !== strpos( $GLOBALS['wp_version'], '-' ) ) {
92
-			$tabs['beta'] = _x( 'Beta Testing', 'Plugin Installer' );
91
+		if ($tab === 'beta' || false !== strpos($GLOBALS['wp_version'], '-')) {
92
+			$tabs['beta'] = _x('Beta Testing', 'Plugin Installer');
93 93
 		}
94
-		$tabs['featured']    = _x( 'Featured', 'Plugin Installer' );
95
-		$tabs['popular']     = _x( 'Popular', 'Plugin Installer' );
96
-		$tabs['recommended'] = _x( 'Recommended', 'Plugin Installer' );
97
-		$tabs['favorites']   = _x( 'Favorites', 'Plugin Installer' );
98
-		if ( current_user_can( 'upload_plugins' ) ) {
94
+		$tabs['featured']    = _x('Featured', 'Plugin Installer');
95
+		$tabs['popular']     = _x('Popular', 'Plugin Installer');
96
+		$tabs['recommended'] = _x('Recommended', 'Plugin Installer');
97
+		$tabs['favorites']   = _x('Favorites', 'Plugin Installer');
98
+		if (current_user_can('upload_plugins')) {
99 99
 			// No longer a real tab. Here for filter compatibility.
100 100
 			// Gets skipped in get_views().
101
-			$tabs['upload'] = __( 'Upload Plugin' );
101
+			$tabs['upload'] = __('Upload Plugin');
102 102
 		}
103 103
 
104
-		$nonmenu_tabs = array( 'plugin-information' ); // Valid actions to perform which do not have a Menu item.
104
+		$nonmenu_tabs = array('plugin-information'); // Valid actions to perform which do not have a Menu item.
105 105
 
106 106
 		/**
107 107
 		 * Filter the tabs shown on the Plugin Install screen.
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		 * @param array $tabs The tabs shown on the Plugin Install screen. Defaults include 'featured', 'popular',
112 112
 		 *                    'recommended', 'favorites', and 'upload'.
113 113
 		 */
114
-		$tabs = apply_filters( 'install_plugins_tabs', $tabs );
114
+		$tabs = apply_filters('install_plugins_tabs', $tabs);
115 115
 
116 116
 		/**
117 117
 		 * Filter tabs not associated with a menu item on the Plugin Install screen.
@@ -120,11 +120,11 @@  discard block
 block discarded – undo
120 120
 		 *
121 121
 		 * @param array $nonmenu_tabs The tabs that don't have a Menu item on the Plugin Install screen.
122 122
 		 */
123
-		$nonmenu_tabs = apply_filters( 'install_plugins_nonmenu_tabs', $nonmenu_tabs );
123
+		$nonmenu_tabs = apply_filters('install_plugins_nonmenu_tabs', $nonmenu_tabs);
124 124
 
125 125
 		// If a non-valid menu tab has been selected, And it's not a non-menu action.
126
-		if ( empty( $tab ) || ( !isset( $tabs[ $tab ] ) && !in_array( $tab, (array) $nonmenu_tabs ) ) )
127
-			$tab = key( $tabs );
126
+		if (empty($tab) || ( ! isset($tabs[$tab]) && ! in_array($tab, (array) $nonmenu_tabs)))
127
+			$tab = key($tabs);
128 128
 
129 129
 		$args = array(
130 130
 			'page' => $paged,
@@ -139,14 +139,14 @@  discard block
 block discarded – undo
139 139
 			'installed_plugins' => $this->get_installed_plugin_slugs(),
140 140
 		);
141 141
 
142
-		switch ( $tab ) {
142
+		switch ($tab) {
143 143
 			case 'search':
144
-				$type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term';
145
-				$term = isset( $_REQUEST['s'] ) ? wp_unslash( $_REQUEST['s'] ) : '';
144
+				$type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term';
145
+				$term = isset($_REQUEST['s']) ? wp_unslash($_REQUEST['s']) : '';
146 146
 
147
-				switch ( $type ) {
147
+				switch ($type) {
148 148
 					case 'tag':
149
-						$args['tag'] = sanitize_title_with_dashes( $term );
149
+						$args['tag'] = sanitize_title_with_dashes($term);
150 150
 						break;
151 151
 					case 'term':
152 152
 						$args['search'] = $term;
@@ -170,14 +170,14 @@  discard block
 block discarded – undo
170 170
 				break;
171 171
 
172 172
 			case 'favorites':
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
-				if ( $user )
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
+				if ($user)
176 176
 					$args['user'] = $user;
177 177
 				else
178 178
 					$args = false;
179 179
 
180
-				add_action( 'install_plugins_favorites', 'install_plugins_favorites_form', 9, 0 );
180
+				add_action('install_plugins_favorites', 'install_plugins_favorites_form', 9, 0);
181 181
 				break;
182 182
 
183 183
 			default:
@@ -195,30 +195,30 @@  discard block
 block discarded – undo
195 195
 		 *
196 196
 		 * @param array|bool $args Plugin Install API arguments.
197 197
 		 */
198
-		$args = apply_filters( "install_plugins_table_api_args_$tab", $args );
198
+		$args = apply_filters("install_plugins_table_api_args_$tab", $args);
199 199
 
200
-		if ( !$args )
200
+		if ( ! $args)
201 201
 			return;
202 202
 
203
-		$api = plugins_api( 'query_plugins', $args );
203
+		$api = plugins_api('query_plugins', $args);
204 204
 
205
-		if ( is_wp_error( $api ) ) {
205
+		if (is_wp_error($api)) {
206 206
 			$this->error = $api;
207 207
 			return;
208 208
 		}
209 209
 
210 210
 		$this->items = $api->plugins;
211 211
 
212
-		if ( $this->orderby ) {
213
-			uasort( $this->items, array( $this, 'order_callback' ) );
212
+		if ($this->orderby) {
213
+			uasort($this->items, array($this, 'order_callback'));
214 214
 		}
215 215
 
216
-		$this->set_pagination_args( array(
216
+		$this->set_pagination_args(array(
217 217
 			'total_items' => $api->info['results'],
218 218
 			'per_page' => $args['per_page'],
219
-		) );
219
+		));
220 220
 
221
-		if ( isset( $api->info['groups'] ) ) {
221
+		if (isset($api->info['groups'])) {
222 222
 			$this->groups = $api->info['groups'];
223 223
 		}
224 224
 	}
@@ -227,12 +227,12 @@  discard block
 block discarded – undo
227 227
 	 * @access public
228 228
 	 */
229 229
 	public function no_items() {
230
-		if ( isset( $this->error ) ) {
231
-			$message = $this->error->get_error_message() . '<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a></p>';
230
+		if (isset($this->error)) {
231
+			$message = $this->error->get_error_message().'<p class="hide-if-no-js"><a href="#" class="button" onclick="document.location.reload(); return false;">'.__('Try again').'</a></p>';
232 232
 		} else {
233
-			$message = __( 'No plugins match your request.' );
233
+			$message = __('No plugins match your request.');
234 234
 		}
235
-		echo '<div class="no-plugin-results">' . $message . '</div>';
235
+		echo '<div class="no-plugin-results">'.$message.'</div>';
236 236
 	}
237 237
 
238 238
 	/**
@@ -246,13 +246,13 @@  discard block
 block discarded – undo
246 246
 		global $tabs, $tab;
247 247
 
248 248
 		$display_tabs = array();
249
-		foreach ( (array) $tabs as $action => $text ) {
250
-			$class = ( $action === $tab ) ? ' current' : '';
251
-			$href = self_admin_url('plugin-install.php?tab=' . $action);
249
+		foreach ((array) $tabs as $action => $text) {
250
+			$class = ($action === $tab) ? ' current' : '';
251
+			$href = self_admin_url('plugin-install.php?tab='.$action);
252 252
 			$display_tabs['plugin-install-'.$action] = "<a href='$href' class='$class'>$text</a>";
253 253
 		}
254 254
 		// No longer a real tab.
255
-		unset( $display_tabs['plugin-install-upload'] );
255
+		unset($display_tabs['plugin-install-upload']);
256 256
 
257 257
 		return $display_tabs;
258 258
 	}
@@ -264,23 +264,23 @@  discard block
 block discarded – undo
264 264
 		$views = $this->get_views();
265 265
 
266 266
 		/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
267
-		$views = apply_filters( "views_{$this->screen->id}", $views );
267
+		$views = apply_filters("views_{$this->screen->id}", $views);
268 268
 
269
-		$this->screen->render_screen_reader_content( 'heading_views' );
269
+		$this->screen->render_screen_reader_content('heading_views');
270 270
 ?>
271 271
 <div class="wp-filter">
272 272
 	<ul class="filter-links">
273 273
 		<?php
274
-		if ( ! empty( $views ) ) {
275
-			foreach ( $views as $class => $view ) {
276
-				$views[ $class ] = "\t<li class='$class'>$view";
274
+		if ( ! empty($views)) {
275
+			foreach ($views as $class => $view) {
276
+				$views[$class] = "\t<li class='$class'>$view";
277 277
 			}
278
-			echo implode( " </li>\n", $views ) . "</li>\n";
278
+			echo implode(" </li>\n", $views)."</li>\n";
279 279
 		}
280 280
 		?>
281 281
 	</ul>
282 282
 
283
-	<?php install_search_form( isset( $views['plugin-install-search'] ) ); ?>
283
+	<?php install_search_form(isset($views['plugin-install-search'])); ?>
284 284
 </div>
285 285
 <?php
286 286
 	}
@@ -293,23 +293,23 @@  discard block
 block discarded – undo
293 293
 
294 294
 		$data_attr = '';
295 295
 
296
-		if ( $singular ) {
296
+		if ($singular) {
297 297
 			$data_attr = " data-wp-lists='list:$singular'";
298 298
 		}
299 299
 
300
-		$this->display_tablenav( 'top' );
300
+		$this->display_tablenav('top');
301 301
 
302 302
 ?>
303
-<div class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>">
303
+<div class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>">
304 304
 <?php
305
-	$this->screen->render_screen_reader_content( 'heading_list' );
305
+	$this->screen->render_screen_reader_content('heading_list');
306 306
 ?>
307 307
 	<div id="the-list"<?php echo $data_attr; ?>>
308 308
 		<?php $this->display_rows_or_placeholder(); ?>
309 309
 	</div>
310 310
 </div>
311 311
 <?php
312
-		$this->display_tablenav( 'bottom' );
312
+		$this->display_tablenav('bottom');
313 313
 	}
314 314
 
315 315
 	/**
@@ -317,12 +317,12 @@  discard block
 block discarded – undo
317 317
 	 *
318 318
 	 * @param string $which
319 319
 	 */
320
-	protected function display_tablenav( $which ) {
321
-		if ( $GLOBALS['tab'] === 'featured' ) {
320
+	protected function display_tablenav($which) {
321
+		if ($GLOBALS['tab'] === 'featured') {
322 322
 			return;
323 323
 		}
324 324
 
325
-		if ( 'top' === $which ) {
325
+		if ('top' === $which) {
326 326
 			wp_referer_field();
327 327
 		?>
328 328
 			<div class="tablenav top">
@@ -333,14 +333,14 @@  discard block
 block discarded – undo
333 333
 					 *
334 334
 					 * @since 2.7.0
335 335
 					 */
336
-					do_action( 'install_plugins_table_header' ); ?>
336
+					do_action('install_plugins_table_header'); ?>
337 337
 				</div>
338
-				<?php $this->pagination( $which ); ?>
338
+				<?php $this->pagination($which); ?>
339 339
 				<br class="clear" />
340 340
 			</div>
341 341
 		<?php } else { ?>
342 342
 			<div class="tablenav bottom">
343
-				<?php $this->pagination( $which ); ?>
343
+				<?php $this->pagination($which); ?>
344 344
 				<br class="clear" />
345 345
 			</div>
346 346
 		<?php
@@ -351,7 +351,7 @@  discard block
 block discarded – undo
351 351
 	 * @return array
352 352
 	 */
353 353
 	protected function get_table_classes() {
354
-		return array( 'widefat', $this->_args['plural'] );
354
+		return array('widefat', $this->_args['plural']);
355 355
 	}
356 356
 
357 357
 	/**
@@ -366,23 +366,23 @@  discard block
 block discarded – undo
366 366
 	 * @param object $plugin_b
367 367
 	 * @return int
368 368
 	 */
369
-	private function order_callback( $plugin_a, $plugin_b ) {
369
+	private function order_callback($plugin_a, $plugin_b) {
370 370
 		$orderby = $this->orderby;
371
-		if ( ! isset( $plugin_a->$orderby, $plugin_b->$orderby ) ) {
371
+		if ( ! isset($plugin_a->$orderby, $plugin_b->$orderby)) {
372 372
 			return 0;
373 373
 		}
374 374
 
375 375
 		$a = $plugin_a->$orderby;
376 376
 		$b = $plugin_b->$orderby;
377 377
 
378
-		if ( $a == $b ) {
378
+		if ($a == $b) {
379 379
 			return 0;
380 380
 		}
381 381
 
382
-		if ( 'DESC' === $this->order ) {
383
-			return ( $a < $b ) ? 1 : -1;
382
+		if ('DESC' === $this->order) {
383
+			return ($a < $b) ? 1 : -1;
384 384
 		} else {
385
-			return ( $a < $b ) ? -1 : 1;
385
+			return ($a < $b) ? -1 : 1;
386 386
 		}
387 387
 	}
388 388
 
@@ -391,98 +391,98 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function display_rows() {
393 393
 		$plugins_allowedtags = array(
394
-			'a' => array( 'href' => array(),'title' => array(), 'target' => array() ),
395
-			'abbr' => array( 'title' => array() ),'acronym' => array( 'title' => array() ),
396
-			'code' => array(), 'pre' => array(), 'em' => array(),'strong' => array(),
394
+			'a' => array('href' => array(), 'title' => array(), 'target' => array()),
395
+			'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
396
+			'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
397 397
 			'ul' => array(), 'ol' => array(), 'li' => array(), 'p' => array(), 'br' => array()
398 398
 		);
399 399
 
400 400
 		$plugins_group_titles = array(
401
-			'Performance' => _x( 'Performance', 'Plugin installer group title' ),
402
-			'Social'      => _x( 'Social',      'Plugin installer group title' ),
403
-			'Tools'       => _x( 'Tools',       'Plugin installer group title' ),
401
+			'Performance' => _x('Performance', 'Plugin installer group title'),
402
+			'Social'      => _x('Social', 'Plugin installer group title'),
403
+			'Tools'       => _x('Tools', 'Plugin installer group title'),
404 404
 		);
405 405
 
406 406
 		$group = null;
407 407
 
408
-		foreach ( (array) $this->items as $plugin ) {
409
-			if ( is_object( $plugin ) ) {
408
+		foreach ((array) $this->items as $plugin) {
409
+			if (is_object($plugin)) {
410 410
 				$plugin = (array) $plugin;
411 411
 			}
412 412
 
413 413
 			// Display the group heading if there is one
414
-			if ( isset( $plugin['group'] ) && $plugin['group'] != $group ) {
415
-				if ( isset( $this->groups[ $plugin['group'] ] ) ) {
416
-					$group_name = $this->groups[ $plugin['group'] ];
417
-					if ( isset( $plugins_group_titles[ $group_name ] ) ) {
418
-						$group_name = $plugins_group_titles[ $group_name ];
414
+			if (isset($plugin['group']) && $plugin['group'] != $group) {
415
+				if (isset($this->groups[$plugin['group']])) {
416
+					$group_name = $this->groups[$plugin['group']];
417
+					if (isset($plugins_group_titles[$group_name])) {
418
+						$group_name = $plugins_group_titles[$group_name];
419 419
 					}
420 420
 				} else {
421 421
 					$group_name = $plugin['group'];
422 422
 				}
423 423
 
424 424
 				// Starting a new group, close off the divs of the last one
425
-				if ( ! empty( $group ) ) {
425
+				if ( ! empty($group)) {
426 426
 					echo '</div></div>';
427 427
 				}
428 428
 
429
-				echo '<div class="plugin-group"><h3>' . esc_html( $group_name ) . '</h3>';
429
+				echo '<div class="plugin-group"><h3>'.esc_html($group_name).'</h3>';
430 430
 				// needs an extra wrapping div for nth-child selectors to work
431 431
 				echo '<div class="plugin-items">';
432 432
 
433 433
 				$group = $plugin['group'];
434 434
 			}
435
-			$title = wp_kses( $plugin['name'], $plugins_allowedtags );
435
+			$title = wp_kses($plugin['name'], $plugins_allowedtags);
436 436
 
437 437
 			// Remove any HTML from the description.
438
-			$description = strip_tags( $plugin['short_description'] );
439
-			$version = wp_kses( $plugin['version'], $plugins_allowedtags );
438
+			$description = strip_tags($plugin['short_description']);
439
+			$version = wp_kses($plugin['version'], $plugins_allowedtags);
440 440
 
441
-			$name = strip_tags( $title . ' ' . $version );
441
+			$name = strip_tags($title.' '.$version);
442 442
 
443
-			$author = wp_kses( $plugin['author'], $plugins_allowedtags );
444
-			if ( ! empty( $author ) ) {
445
-				$author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '</cite>';
443
+			$author = wp_kses($plugin['author'], $plugins_allowedtags);
444
+			if ( ! empty($author)) {
445
+				$author = ' <cite>'.sprintf(__('By %s'), $author).'</cite>';
446 446
 			}
447 447
 
448 448
 			$action_links = array();
449 449
 
450
-			if ( current_user_can( 'install_plugins' ) || current_user_can( 'update_plugins' ) ) {
451
-				$status = install_plugin_install_status( $plugin );
450
+			if (current_user_can('install_plugins') || current_user_can('update_plugins')) {
451
+				$status = install_plugin_install_status($plugin);
452 452
 
453
-				switch ( $status['status'] ) {
453
+				switch ($status['status']) {
454 454
 					case 'install':
455
-						if ( $status['url'] ) {
455
+						if ($status['url']) {
456 456
 							/* translators: 1: Plugin name and version. */
457
-							$action_links[] = '<a class="install-now button" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Install %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Install Now' ) . '</a>';
457
+							$action_links[] = '<a class="install-now button" data-slug="'.esc_attr($plugin['slug']).'" href="'.esc_url($status['url']).'" aria-label="'.esc_attr(sprintf(__('Install %s now'), $name)).'" data-name="'.esc_attr($name).'">'.__('Install Now').'</a>';
458 458
 						}
459 459
 
460 460
 						break;
461 461
 					case 'update_available':
462
-						if ( $status['url'] ) {
462
+						if ($status['url']) {
463 463
 							/* translators: 1: Plugin name and version */
464
-							$action_links[] = '<a class="update-now button aria-button-if-js" data-plugin="' . esc_attr( $status['file'] ) . '" data-slug="' . esc_attr( $plugin['slug'] ) . '" href="' . esc_url( $status['url'] ) . '" aria-label="' . esc_attr( sprintf( __( 'Update %s now' ), $name ) ) . '" data-name="' . esc_attr( $name ) . '">' . __( 'Update Now' ) . '</a>';
464
+							$action_links[] = '<a class="update-now button aria-button-if-js" data-plugin="'.esc_attr($status['file']).'" data-slug="'.esc_attr($plugin['slug']).'" href="'.esc_url($status['url']).'" aria-label="'.esc_attr(sprintf(__('Update %s now'), $name)).'" data-name="'.esc_attr($name).'">'.__('Update Now').'</a>';
465 465
 						}
466 466
 
467 467
 						break;
468 468
 					case 'latest_installed':
469 469
 					case 'newer_installed':
470
-						$action_links[] = '<span class="button button-disabled">' . _x( 'Installed', 'plugin' ) . '</span>';
470
+						$action_links[] = '<span class="button button-disabled">'._x('Installed', 'plugin').'</span>';
471 471
 						break;
472 472
 				}
473 473
 			}
474 474
 
475
-			$details_link   = self_admin_url( 'plugin-install.php?tab=plugin-information&amp;plugin=' . $plugin['slug'] .
476
-								'&amp;TB_iframe=true&amp;width=600&amp;height=550' );
475
+			$details_link = self_admin_url('plugin-install.php?tab=plugin-information&amp;plugin='.$plugin['slug'].
476
+								'&amp;TB_iframe=true&amp;width=600&amp;height=550');
477 477
 
478 478
 			/* translators: 1: Plugin name and version. */
479
-			$action_links[] = '<a href="' . esc_url( $details_link ) . '" class="thickbox open-plugin-details-modal" aria-label="' . esc_attr( sprintf( __( 'More information about %s' ), $name ) ) . '" data-title="' . esc_attr( $name ) . '">' . __( 'More Details' ) . '</a>';
479
+			$action_links[] = '<a href="'.esc_url($details_link).'" class="thickbox open-plugin-details-modal" aria-label="'.esc_attr(sprintf(__('More information about %s'), $name)).'" data-title="'.esc_attr($name).'">'.__('More Details').'</a>';
480 480
 
481
-			if ( !empty( $plugin['icons']['svg'] ) ) {
481
+			if ( ! empty($plugin['icons']['svg'])) {
482 482
 				$plugin_icon_url = $plugin['icons']['svg'];
483
-			} elseif ( !empty( $plugin['icons']['2x'] ) ) {
483
+			} elseif ( ! empty($plugin['icons']['2x'])) {
484 484
 				$plugin_icon_url = $plugin['icons']['2x'];
485
-			} elseif ( !empty( $plugin['icons']['1x'] ) ) {
485
+			} elseif ( ! empty($plugin['icons']['1x'])) {
486 486
 				$plugin_icon_url = $plugin['icons']['1x'];
487 487
 			} else {
488 488
 				$plugin_icon_url = $plugin['icons']['default'];
@@ -496,24 +496,24 @@  discard block
 block discarded – undo
496 496
 			 * @param array $action_links An array of plugin action hyperlinks. Defaults are links to Details and Install Now.
497 497
 			 * @param array $plugin       The plugin currently being listed.
498 498
 			 */
499
-			$action_links = apply_filters( 'plugin_install_action_links', $action_links, $plugin );
499
+			$action_links = apply_filters('plugin_install_action_links', $action_links, $plugin);
500 500
 
501
-			$last_updated_timestamp = strtotime( $plugin['last_updated'] );
501
+			$last_updated_timestamp = strtotime($plugin['last_updated']);
502 502
 		?>
503
-		<div class="plugin-card plugin-card-<?php echo sanitize_html_class( $plugin['slug'] ); ?>">
503
+		<div class="plugin-card plugin-card-<?php echo sanitize_html_class($plugin['slug']); ?>">
504 504
 			<div class="plugin-card-top">
505 505
 				<div class="name column-name">
506 506
 					<h3>
507
-						<a href="<?php echo esc_url( $details_link ); ?>" class="thickbox open-plugin-details-modal">
507
+						<a href="<?php echo esc_url($details_link); ?>" class="thickbox open-plugin-details-modal">
508 508
 						<?php echo $title; ?>
509
-						<img src="<?php echo esc_attr( $plugin_icon_url ) ?>" class="plugin-icon" alt="">
509
+						<img src="<?php echo esc_attr($plugin_icon_url) ?>" class="plugin-icon" alt="">
510 510
 						</a>
511 511
 					</h3>
512 512
 				</div>
513 513
 				<div class="action-links">
514 514
 					<?php
515
-						if ( $action_links ) {
516
-							echo '<ul class="plugin-action-buttons"><li>' . implode( '</li><li>', $action_links ) . '</li></ul>';
515
+						if ($action_links) {
516
+							echo '<ul class="plugin-action-buttons"><li>'.implode('</li><li>', $action_links).'</li></ul>';
517 517
 						}
518 518
 					?>
519 519
 				</div>
@@ -524,30 +524,30 @@  discard block
 block discarded – undo
524 524
 			</div>
525 525
 			<div class="plugin-card-bottom">
526 526
 				<div class="vers column-rating">
527
-					<?php wp_star_rating( array( 'rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'] ) ); ?>
528
-					<span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n( $plugin['num_ratings'] ); ?>)</span>
527
+					<?php wp_star_rating(array('rating' => $plugin['rating'], 'type' => 'percent', 'number' => $plugin['num_ratings'])); ?>
528
+					<span class="num-ratings" aria-hidden="true">(<?php echo number_format_i18n($plugin['num_ratings']); ?>)</span>
529 529
 				</div>
530 530
 				<div class="column-updated">
531
-					<strong><?php _e( 'Last Updated:' ); ?></strong> <?php printf( __( '%s ago' ), human_time_diff( $last_updated_timestamp ) ); ?>
531
+					<strong><?php _e('Last Updated:'); ?></strong> <?php printf(__('%s ago'), human_time_diff($last_updated_timestamp)); ?>
532 532
 				</div>
533 533
 				<div class="column-downloaded">
534 534
 					<?php
535
-					if ( $plugin['active_installs'] >= 1000000 ) {
536
-						$active_installs_text = _x( '1+ Million', 'Active plugin installs' );
535
+					if ($plugin['active_installs'] >= 1000000) {
536
+						$active_installs_text = _x('1+ Million', 'Active plugin installs');
537 537
 					} else {
538
-						$active_installs_text = number_format_i18n( $plugin['active_installs'] ) . '+';
538
+						$active_installs_text = number_format_i18n($plugin['active_installs']).'+';
539 539
 					}
540
-					printf( __( '%s Active Installs' ), $active_installs_text );
540
+					printf(__('%s Active Installs'), $active_installs_text);
541 541
 					?>
542 542
 				</div>
543 543
 				<div class="column-compatibility">
544 544
 					<?php
545
-					if ( ! empty( $plugin['tested'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['tested'] ) ), $plugin['tested'], '>' ) ) {
546
-						echo '<span class="compatibility-untested">' . __( 'Untested with your version of WordPress' ) . '</span>';
547
-					} elseif ( ! empty( $plugin['requires'] ) && version_compare( substr( $GLOBALS['wp_version'], 0, strlen( $plugin['requires'] ) ), $plugin['requires'], '<' ) ) {
548
-						echo '<span class="compatibility-incompatible">' . __( '<strong>Incompatible</strong> with your version of WordPress' ) . '</span>';
545
+					if ( ! empty($plugin['tested']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['tested'])), $plugin['tested'], '>')) {
546
+						echo '<span class="compatibility-untested">'.__('Untested with your version of WordPress').'</span>';
547
+					} elseif ( ! empty($plugin['requires']) && version_compare(substr($GLOBALS['wp_version'], 0, strlen($plugin['requires'])), $plugin['requires'], '<')) {
548
+						echo '<span class="compatibility-incompatible">'.__('<strong>Incompatible</strong> with your version of WordPress').'</span>';
549 549
 					} else {
550
-						echo '<span class="compatibility-compatible">' . __( '<strong>Compatible</strong> with your version of WordPress' ) . '</span>';
550
+						echo '<span class="compatibility-compatible">'.__('<strong>Compatible</strong> with your version of WordPress').'</span>';
551 551
 					}
552 552
 					?>
553 553
 				</div>
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		}
558 558
 
559 559
 		// Close off the group divs of the last one
560
-		if ( ! empty( $group ) ) {
560
+		if ( ! empty($group)) {
561 561
 			echo '</div></div>';
562 562
 		}
563 563
 	}
Please login to merge, or discard this patch.