Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/theme-compat/embed-content.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -10,29 +10,29 @@  discard block
 block discarded – undo
10 10
  * @since 4.5.0
11 11
  */
12 12
 ?>
13
-	<div <?php post_class( 'wp-embed' ); ?>>
13
+	<div <?php post_class('wp-embed'); ?>>
14 14
 		<?php
15 15
 		$thumbnail_id = 0;
16 16
 
17
-		if ( has_post_thumbnail() ) {
17
+		if (has_post_thumbnail()) {
18 18
 			$thumbnail_id = get_post_thumbnail_id();
19 19
 		}
20 20
 
21
-		if ( 'attachment' === get_post_type() && wp_attachment_is_image() ) {
21
+		if ('attachment' === get_post_type() && wp_attachment_is_image()) {
22 22
 			$thumbnail_id = get_the_ID();
23 23
 		}
24 24
 
25
-		if ( $thumbnail_id ) {
25
+		if ($thumbnail_id) {
26 26
 			$aspect_ratio = 1;
27
-			$measurements = array( 1, 1 );
27
+			$measurements = array(1, 1);
28 28
 			$image_size   = 'full'; // Fallback.
29 29
 
30
-			$meta = wp_get_attachment_metadata( $thumbnail_id );
31
-			if ( ! empty( $meta['sizes'] ) ) {
32
-				foreach ( $meta['sizes'] as $size => $data ) {
33
-					if ( $data['width'] / $data['height'] > $aspect_ratio ) {
30
+			$meta = wp_get_attachment_metadata($thumbnail_id);
31
+			if ( ! empty($meta['sizes'])) {
32
+				foreach ($meta['sizes'] as $size => $data) {
33
+					if ($data['width'] / $data['height'] > $aspect_ratio) {
34 34
 						$aspect_ratio = $data['width'] / $data['height'];
35
-						$measurements = array( $data['width'], $data['height'] );
35
+						$measurements = array($data['width'], $data['height']);
36 36
 						$image_size   = $size;
37 37
 					}
38 38
 				}
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
 			 * @param string $image_size   Thumbnail image size.
48 48
 			 * @param int    $thumbnail_id Attachment ID.
49 49
 			 */
50
-			$image_size = apply_filters( 'embed_thumbnail_image_size', $image_size, $thumbnail_id );
50
+			$image_size = apply_filters('embed_thumbnail_image_size', $image_size, $thumbnail_id);
51 51
 
52 52
 			$shape = $measurements[0] / $measurements[1] >= 1.75 ? 'rectangular' : 'square';
53 53
 
@@ -63,13 +63,13 @@  discard block
 block discarded – undo
63 63
 			 * @param string $shape        Thumbnail image shape. Either 'rectangular' or 'square'.
64 64
 			 * @param int    $thumbnail_id Attachment ID.
65 65
 			 */
66
-			$shape = apply_filters( 'embed_thumbnail_image_shape', $shape, $thumbnail_id );
66
+			$shape = apply_filters('embed_thumbnail_image_shape', $shape, $thumbnail_id);
67 67
 		}
68 68
 
69
-		if ( $thumbnail_id && 'rectangular' === $shape ) : ?>
69
+		if ($thumbnail_id && 'rectangular' === $shape) : ?>
70 70
 			<div class="wp-embed-featured-image rectangular">
71 71
 				<a href="<?php the_permalink(); ?>" target="_top">
72
-					<?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
72
+					<?php echo wp_get_attachment_image($thumbnail_id, $image_size); ?>
73 73
 				</a>
74 74
 			</div>
75 75
 		<?php endif; ?>
@@ -80,10 +80,10 @@  discard block
 block discarded – undo
80 80
 			</a>
81 81
 		</p>
82 82
 
83
-		<?php if ( $thumbnail_id && 'square' === $shape ) : ?>
83
+		<?php if ($thumbnail_id && 'square' === $shape) : ?>
84 84
 			<div class="wp-embed-featured-image square">
85 85
 				<a href="<?php the_permalink(); ?>" target="_top">
86
-					<?php echo wp_get_attachment_image( $thumbnail_id, $image_size ); ?>
86
+					<?php echo wp_get_attachment_image($thumbnail_id, $image_size); ?>
87 87
 				</a>
88 88
 			</div>
89 89
 		<?php endif; ?>
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 		 *
97 97
 		 * @since 4.4.0
98 98
 		 */
99
-		do_action( 'embed_content' );
99
+		do_action('embed_content');
100 100
 		?>
101 101
 
102 102
 		<div class="wp-embed-footer">
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 				 *
110 110
 				 * @since 4.4.0
111 111
 				 */
112
-				do_action( 'embed_content_meta');
112
+				do_action('embed_content_meta');
113 113
 				?>
114 114
 			</div>
115 115
 		</div>
Please login to merge, or discard this patch.
src/wp-includes/category-template.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -723,7 +723,7 @@
 block discarded – undo
723 723
  * @since 2.9.0
724 724
  *
725 725
  * @param int $count Number of posts with that tag.
726
- * @return int Scaled count.
726
+ * @return double Scaled count.
727 727
  */
728 728
 function default_topic_count_scale( $count ) {
729 729
 	return round(log10($count + 1) * 100);
Please login to merge, or discard this patch.
Spacing   +265 added lines, -265 removed lines patch added patch discarded remove patch
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
  * @param int|object $category Category ID or object.
17 17
  * @return string Link on success, empty string if category does not exist.
18 18
  */
19
-function get_category_link( $category ) {
20
-	if ( ! is_object( $category ) )
19
+function get_category_link($category) {
20
+	if ( ! is_object($category))
21 21
 		$category = (int) $category;
22 22
 
23
-	$category = get_term_link( $category, 'category' );
23
+	$category = get_term_link($category, 'category');
24 24
 
25
-	if ( is_wp_error( $category ) )
25
+	if (is_wp_error($category))
26 26
 		return '';
27 27
 
28 28
 	return $category;
@@ -41,10 +41,10 @@  discard block
 block discarded – undo
41 41
  * @param array $deprecated Not used.
42 42
  * @return string|WP_Error A list of category parents on success, WP_Error on failure.
43 43
  */
44
-function get_category_parents( $id, $link = false, $separator = '/', $nicename = false, $deprecated = array() ) {
44
+function get_category_parents($id, $link = false, $separator = '/', $nicename = false, $deprecated = array()) {
45 45
 
46
-	if ( ! empty( $deprecated ) ) {
47
-		_deprecated_argument( __FUNCTION__, '4.8.0' );
46
+	if ( ! empty($deprecated)) {
47
+		_deprecated_argument(__FUNCTION__, '4.8.0');
48 48
 	}
49 49
 
50 50
 	$format = $nicename ? 'slug' : 'name';
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 		'format'    => $format,
56 56
 	);
57 57
 
58
-	return get_term_parents_list( $id, 'category', $args );
58
+	return get_term_parents_list($id, 'category', $args);
59 59
 }
60 60
 
61 61
 /**
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
  * @param int $id Optional, default to current post ID. The post ID.
72 72
  * @return array Array of WP_Term objects, one for each category assigned to the post.
73 73
  */
74
-function get_the_category( $id = false ) {
75
-	$categories = get_the_terms( $id, 'category' );
76
-	if ( ! $categories || is_wp_error( $categories ) )
74
+function get_the_category($id = false) {
75
+	$categories = get_the_terms($id, 'category');
76
+	if ( ! $categories || is_wp_error($categories))
77 77
 		$categories = array();
78 78
 
79
-	$categories = array_values( $categories );
79
+	$categories = array_values($categories);
80 80
 
81
-	foreach ( array_keys( $categories ) as $key ) {
82
-		_make_cat_compat( $categories[$key] );
81
+	foreach (array_keys($categories) as $key) {
82
+		_make_cat_compat($categories[$key]);
83 83
 	}
84 84
 
85 85
 	/**
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param array $categories An array of categories to return for the post.
92 92
 	 * @param int   $id         ID of the post.
93 93
 	 */
94
-	return apply_filters( 'get_the_categories', $categories, $id );
94
+	return apply_filters('get_the_categories', $categories, $id);
95 95
 }
96 96
 
97 97
 /**
@@ -102,14 +102,14 @@  discard block
 block discarded – undo
102 102
  * @param int $cat_ID Category ID.
103 103
  * @return string|WP_Error Category name on success, WP_Error on failure.
104 104
  */
105
-function get_the_category_by_ID( $cat_ID ) {
105
+function get_the_category_by_ID($cat_ID) {
106 106
 	$cat_ID = (int) $cat_ID;
107
-	$category = get_term( $cat_ID, 'category' );
107
+	$category = get_term($cat_ID, 'category');
108 108
 
109
-	if ( is_wp_error( $category ) )
109
+	if (is_wp_error($category))
110 110
 		return $category;
111 111
 
112
-	return ( $category ) ? $category->name : '';
112
+	return ($category) ? $category->name : '';
113 113
 }
114 114
 
115 115
 /**
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
  * @param int $post_id Optional. Post ID to retrieve categories.
125 125
  * @return string
126 126
  */
127
-function get_the_category_list( $separator = '', $parents='', $post_id = false ) {
127
+function get_the_category_list($separator = '', $parents = '', $post_id = false) {
128 128
 	global $wp_rewrite;
129
-	if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) {
129
+	if ( ! is_object_in_taxonomy(get_post_type($post_id), 'category')) {
130 130
 		/** This filter is documented in wp-includes/category-template.php */
131
-		return apply_filters( 'the_category', '', $separator, $parents );
131
+		return apply_filters('the_category', '', $separator, $parents);
132 132
 	}
133 133
 
134 134
 	/**
@@ -140,58 +140,58 @@  discard block
 block discarded – undo
140 140
 	 * @param int|bool $post_id    ID of the post we're retrieving categories for. When `false`, we assume the
141 141
 	 *                             current post in the loop.
142 142
 	 */
143
-	$categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );
143
+	$categories = apply_filters('the_category_list', get_the_category($post_id), $post_id);
144 144
 
145
-	if ( empty( $categories ) ) {
145
+	if (empty($categories)) {
146 146
 		/** This filter is documented in wp-includes/category-template.php */
147
-		return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
147
+		return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
148 148
 	}
149 149
 
150
-	$rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
150
+	$rel = (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) ? 'rel="category tag"' : 'rel="category"';
151 151
 
152 152
 	$thelist = '';
153
-	if ( '' == $separator ) {
153
+	if ('' == $separator) {
154 154
 		$thelist .= '<ul class="post-categories">';
155
-		foreach ( $categories as $category ) {
155
+		foreach ($categories as $category) {
156 156
 			$thelist .= "\n\t<li>";
157
-			switch ( strtolower( $parents ) ) {
157
+			switch (strtolower($parents)) {
158 158
 				case 'multiple':
159
-					if ( $category->parent )
160
-						$thelist .= get_category_parents( $category->parent, true, $separator );
161
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
159
+					if ($category->parent)
160
+						$thelist .= get_category_parents($category->parent, true, $separator);
161
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a></li>';
162 162
 					break;
163 163
 				case 'single':
164
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"  ' . $rel . '>';
165
-					if ( $category->parent )
166
-						$thelist .= get_category_parents( $category->parent, false, $separator );
164
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'"  '.$rel.'>';
165
+					if ($category->parent)
166
+						$thelist .= get_category_parents($category->parent, false, $separator);
167 167
 					$thelist .= $category->name.'</a></li>';
168 168
 					break;
169 169
 				case '':
170 170
 				default:
171
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
171
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a></li>';
172 172
 			}
173 173
 		}
174 174
 		$thelist .= '</ul>';
175 175
 	} else {
176 176
 		$i = 0;
177
-		foreach ( $categories as $category ) {
178
-			if ( 0 < $i )
177
+		foreach ($categories as $category) {
178
+			if (0 < $i)
179 179
 				$thelist .= $separator;
180
-			switch ( strtolower( $parents ) ) {
180
+			switch (strtolower($parents)) {
181 181
 				case 'multiple':
182
-					if ( $category->parent )
183
-						$thelist .= get_category_parents( $category->parent, true, $separator );
184
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
182
+					if ($category->parent)
183
+						$thelist .= get_category_parents($category->parent, true, $separator);
184
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a>';
185 185
 					break;
186 186
 				case 'single':
187
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
188
-					if ( $category->parent )
189
-						$thelist .= get_category_parents( $category->parent, false, $separator );
187
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>';
188
+					if ($category->parent)
189
+						$thelist .= get_category_parents($category->parent, false, $separator);
190 190
 					$thelist .= "$category->name</a>";
191 191
 					break;
192 192
 				case '':
193 193
 				default:
194
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
194
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a>';
195 195
 			}
196 196
 			++$i;
197 197
 		}
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 	 * @param string $parents   How to display the category parents. Accepts 'multiple',
208 208
 	 *                          'single', or empty.
209 209
 	 */
210
-	return apply_filters( 'the_category', $thelist, $separator, $parents );
210
+	return apply_filters('the_category', $thelist, $separator, $parents);
211 211
 }
212 212
 
213 213
 /**
@@ -228,11 +228,11 @@  discard block
 block discarded – undo
228 228
  * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
229 229
  * @return bool True if the current post is in any of the given categories.
230 230
  */
231
-function in_category( $category, $post = null ) {
232
-	if ( empty( $category ) )
231
+function in_category($category, $post = null) {
232
+	if (empty($category))
233 233
 		return false;
234 234
 
235
-	return has_category( $category, $post );
235
+	return has_category($category, $post);
236 236
 }
237 237
 
238 238
 /**
@@ -244,8 +244,8 @@  discard block
 block discarded – undo
244 244
  * @param string $parents Optional. How to display the parents.
245 245
  * @param int $post_id Optional. Post ID to retrieve categories.
246 246
  */
247
-function the_category( $separator = '', $parents='', $post_id = false ) {
248
-	echo get_the_category_list( $separator, $parents, $post_id );
247
+function the_category($separator = '', $parents = '', $post_id = false) {
248
+	echo get_the_category_list($separator, $parents, $post_id);
249 249
 }
250 250
 
251 251
 /**
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
  * @param int $category Optional. Category ID. Will use global category ID by default.
257 257
  * @return string Category description, available.
258 258
  */
259
-function category_description( $category = 0 ) {
260
-	return term_description( $category, 'category' );
259
+function category_description($category = 0) {
260
+	return term_description($category, 'category');
261 261
 }
262 262
 
263 263
 /**
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
  * }
314 314
  * @return string HTML content only if 'echo' argument is 0.
315 315
  */
316
-function wp_dropdown_categories( $args = '' ) {
316
+function wp_dropdown_categories($args = '') {
317 317
 	$defaults = array(
318 318
 		'show_option_all'   => '',
319 319
 		'show_option_none'  => '',
@@ -338,13 +338,13 @@  discard block
 block discarded – undo
338 338
 		'required'          => false,
339 339
 	);
340 340
 
341
-	$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
341
+	$defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
342 342
 
343 343
 	// Back compat.
344
-	if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
344
+	if (isset($args['type']) && 'link' == $args['type']) {
345 345
 		/* translators: 1: "type => link", 2: "taxonomy => link_category" alternative */
346
-		_deprecated_argument( __FUNCTION__, '3.0.0',
347
-			sprintf( __( '%1$s is deprecated. Use %2$s instead.' ),
346
+		_deprecated_argument(__FUNCTION__, '3.0.0',
347
+			sprintf(__('%1$s is deprecated. Use %2$s instead.'),
348 348
 				'<code>type => link</code>',
349 349
 				'<code>taxonomy => link_category</code>'
350 350
 			)
@@ -352,36 +352,36 @@  discard block
 block discarded – undo
352 352
 		$args['taxonomy'] = 'link_category';
353 353
 	}
354 354
 
355
-	$r = wp_parse_args( $args, $defaults );
355
+	$r = wp_parse_args($args, $defaults);
356 356
 	$option_none_value = $r['option_none_value'];
357 357
 
358
-	if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
358
+	if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
359 359
 		$r['pad_counts'] = true;
360 360
 	}
361 361
 
362 362
 	$tab_index = $r['tab_index'];
363 363
 
364 364
 	$tab_index_attribute = '';
365
-	if ( (int) $tab_index > 0 ) {
365
+	if ((int) $tab_index > 0) {
366 366
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
367 367
 	}
368 368
 
369 369
 	// Avoid clashes with the 'name' param of get_terms().
370 370
 	$get_terms_args = $r;
371
-	unset( $get_terms_args['name'] );
372
-	$categories = get_terms( $r['taxonomy'], $get_terms_args );
371
+	unset($get_terms_args['name']);
372
+	$categories = get_terms($r['taxonomy'], $get_terms_args);
373 373
 
374
-	$name = esc_attr( $r['name'] );
375
-	$class = esc_attr( $r['class'] );
376
-	$id = $r['id'] ? esc_attr( $r['id'] ) : $name;
374
+	$name = esc_attr($r['name']);
375
+	$class = esc_attr($r['class']);
376
+	$id = $r['id'] ? esc_attr($r['id']) : $name;
377 377
 	$required = $r['required'] ? 'required' : '';
378 378
 
379
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
379
+	if ( ! $r['hide_if_empty'] || ! empty($categories)) {
380 380
 		$output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n";
381 381
 	} else {
382 382
 		$output = '';
383 383
 	}
384
-	if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) {
384
+	if (empty($categories) && ! $r['hide_if_empty'] && ! empty($r['show_option_none'])) {
385 385
 
386 386
 		/**
387 387
 		 * Filters a taxonomy drop-down display element.
@@ -397,37 +397,37 @@  discard block
 block discarded – undo
397 397
 		 *
398 398
 		 * @param string $element Taxonomy element to list.
399 399
 		 */
400
-		$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
401
-		$output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
400
+		$show_option_none = apply_filters('list_cats', $r['show_option_none']);
401
+		$output .= "\t<option value='".esc_attr($option_none_value)."' selected='selected'>$show_option_none</option>\n";
402 402
 	}
403 403
 
404
-	if ( ! empty( $categories ) ) {
404
+	if ( ! empty($categories)) {
405 405
 
406
-		if ( $r['show_option_all'] ) {
406
+		if ($r['show_option_all']) {
407 407
 
408 408
 			/** This filter is documented in wp-includes/category-template.php */
409
-			$show_option_all = apply_filters( 'list_cats', $r['show_option_all'] );
410
-			$selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
409
+			$show_option_all = apply_filters('list_cats', $r['show_option_all']);
410
+			$selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
411 411
 			$output .= "\t<option value='0'$selected>$show_option_all</option>\n";
412 412
 		}
413 413
 
414
-		if ( $r['show_option_none'] ) {
414
+		if ($r['show_option_none']) {
415 415
 
416 416
 			/** This filter is documented in wp-includes/category-template.php */
417
-			$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
418
-			$selected = selected( $option_none_value, $r['selected'], false );
419
-			$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
417
+			$show_option_none = apply_filters('list_cats', $r['show_option_none']);
418
+			$selected = selected($option_none_value, $r['selected'], false);
419
+			$output .= "\t<option value='".esc_attr($option_none_value)."'$selected>$show_option_none</option>\n";
420 420
 		}
421 421
 
422
-		if ( $r['hierarchical'] ) {
423
-			$depth = $r['depth'];  // Walk the full depth.
422
+		if ($r['hierarchical']) {
423
+			$depth = $r['depth']; // Walk the full depth.
424 424
 		} else {
425 425
 			$depth = -1; // Flat.
426 426
 		}
427
-		$output .= walk_category_dropdown_tree( $categories, $depth, $r );
427
+		$output .= walk_category_dropdown_tree($categories, $depth, $r);
428 428
 	}
429 429
 
430
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
430
+	if ( ! $r['hide_if_empty'] || ! empty($categories)) {
431 431
 		$output .= "</select>\n";
432 432
 	}
433 433
 	/**
@@ -438,9 +438,9 @@  discard block
 block discarded – undo
438 438
 	 * @param string $output HTML output.
439 439
 	 * @param array  $r      Arguments used to build the drop-down.
440 440
 	 */
441
-	$output = apply_filters( 'wp_dropdown_cats', $output, $r );
441
+	$output = apply_filters('wp_dropdown_cats', $output, $r);
442 442
 
443
-	if ( $r['echo'] ) {
443
+	if ($r['echo']) {
444 444
 		echo $output;
445 445
 	}
446 446
 	return $output;
@@ -497,7 +497,7 @@  discard block
 block discarded – undo
497 497
  * }
498 498
  * @return false|string HTML content only if 'echo' argument is 0.
499 499
  */
500
-function wp_list_categories( $args = '' ) {
500
+function wp_list_categories($args = '') {
501 501
 	$defaults = array(
502 502
 		'child_of'            => 0,
503 503
 		'current_category'    => 0,
@@ -516,110 +516,110 @@  discard block
 block discarded – undo
516 516
 		'separator'           => '<br />',
517 517
 		'show_count'          => 0,
518 518
 		'show_option_all'     => '',
519
-		'show_option_none'    => __( 'No categories' ),
519
+		'show_option_none'    => __('No categories'),
520 520
 		'style'               => 'list',
521 521
 		'taxonomy'            => 'category',
522
-		'title_li'            => __( 'Categories' ),
522
+		'title_li'            => __('Categories'),
523 523
 		'use_desc_for_title'  => 1,
524 524
 	);
525 525
 
526
-	$r = wp_parse_args( $args, $defaults );
526
+	$r = wp_parse_args($args, $defaults);
527 527
 
528
-	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] )
528
+	if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical'])
529 529
 		$r['pad_counts'] = true;
530 530
 
531 531
 	// Descendants of exclusions should be excluded too.
532
-	if ( true == $r['hierarchical'] ) {
532
+	if (true == $r['hierarchical']) {
533 533
 		$exclude_tree = array();
534 534
 
535
-		if ( $r['exclude_tree'] ) {
536
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude_tree'] ) );
535
+		if ($r['exclude_tree']) {
536
+			$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree']));
537 537
 		}
538 538
 
539
-		if ( $r['exclude'] ) {
540
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude'] ) );
539
+		if ($r['exclude']) {
540
+			$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude']));
541 541
 		}
542 542
 
543 543
 		$r['exclude_tree'] = $exclude_tree;
544 544
 		$r['exclude'] = '';
545 545
 	}
546 546
 
547
-	if ( ! isset( $r['class'] ) )
548
-		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
547
+	if ( ! isset($r['class']))
548
+		$r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy'];
549 549
 
550
-	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
550
+	if ( ! taxonomy_exists($r['taxonomy'])) {
551 551
 		return false;
552 552
 	}
553 553
 
554 554
 	$show_option_all = $r['show_option_all'];
555 555
 	$show_option_none = $r['show_option_none'];
556 556
 
557
-	$categories = get_categories( $r );
557
+	$categories = get_categories($r);
558 558
 
559 559
 	$output = '';
560
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
561
-		$output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
560
+	if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
561
+		$output = '<li class="'.esc_attr($r['class']).'">'.$r['title_li'].'<ul>';
562 562
 	}
563
-	if ( empty( $categories ) ) {
564
-		if ( ! empty( $show_option_none ) ) {
565
-			if ( 'list' == $r['style'] ) {
566
-				$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
563
+	if (empty($categories)) {
564
+		if ( ! empty($show_option_none)) {
565
+			if ('list' == $r['style']) {
566
+				$output .= '<li class="cat-item-none">'.$show_option_none.'</li>';
567 567
 			} else {
568 568
 				$output .= $show_option_none;
569 569
 			}
570 570
 		}
571 571
 	} else {
572
-		if ( ! empty( $show_option_all ) ) {
572
+		if ( ! empty($show_option_all)) {
573 573
 
574 574
 			$posts_page = '';
575 575
 
576 576
 			// For taxonomies that belong only to custom post types, point to a valid archive.
577
-			$taxonomy_object = get_taxonomy( $r['taxonomy'] );
578
-			if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) {
579
-				foreach ( $taxonomy_object->object_type as $object_type ) {
580
-					$_object_type = get_post_type_object( $object_type );
577
+			$taxonomy_object = get_taxonomy($r['taxonomy']);
578
+			if ( ! in_array('post', $taxonomy_object->object_type) && ! in_array('page', $taxonomy_object->object_type)) {
579
+				foreach ($taxonomy_object->object_type as $object_type) {
580
+					$_object_type = get_post_type_object($object_type);
581 581
 
582 582
 					// Grab the first one.
583
-					if ( ! empty( $_object_type->has_archive ) ) {
584
-						$posts_page = get_post_type_archive_link( $object_type );
583
+					if ( ! empty($_object_type->has_archive)) {
584
+						$posts_page = get_post_type_archive_link($object_type);
585 585
 						break;
586 586
 					}
587 587
 				}
588 588
 			}
589 589
 
590 590
 			// Fallback for the 'All' link is the posts page.
591
-			if ( ! $posts_page ) {
592
-				if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) {
593
-					$posts_page = get_permalink( get_option( 'page_for_posts' ) );
591
+			if ( ! $posts_page) {
592
+				if ('page' == get_option('show_on_front') && get_option('page_for_posts')) {
593
+					$posts_page = get_permalink(get_option('page_for_posts'));
594 594
 				} else {
595
-					$posts_page = home_url( '/' );
595
+					$posts_page = home_url('/');
596 596
 				}
597 597
 			}
598 598
 
599
-			$posts_page = esc_url( $posts_page );
600
-			if ( 'list' == $r['style'] ) {
599
+			$posts_page = esc_url($posts_page);
600
+			if ('list' == $r['style']) {
601 601
 				$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
602 602
 			} else {
603 603
 				$output .= "<a href='$posts_page'>$show_option_all</a>";
604 604
 			}
605 605
 		}
606 606
 
607
-		if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
607
+		if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
608 608
 			$current_term_object = get_queried_object();
609
-			if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) {
609
+			if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
610 610
 				$r['current_category'] = get_queried_object_id();
611 611
 			}
612 612
 		}
613 613
 
614
-		if ( $r['hierarchical'] ) {
614
+		if ($r['hierarchical']) {
615 615
 			$depth = $r['depth'];
616 616
 		} else {
617 617
 			$depth = -1; // Flat.
618 618
 		}
619
-		$output .= walk_category_tree( $categories, $depth, $r );
619
+		$output .= walk_category_tree($categories, $depth, $r);
620 620
 	}
621 621
 
622
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
622
+	if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
623 623
 		$output .= '</ul></li>';
624 624
 	}
625 625
 
@@ -631,9 +631,9 @@  discard block
 block discarded – undo
631 631
 	 * @param string $output HTML output.
632 632
 	 * @param array  $args   An array of taxonomy-listing arguments.
633 633
 	 */
634
-	$html = apply_filters( 'wp_list_categories', $output, $args );
634
+	$html = apply_filters('wp_list_categories', $output, $args);
635 635
 
636
-	if ( $r['echo'] ) {
636
+	if ($r['echo']) {
637 637
 		echo $html;
638 638
 	} else {
639 639
 		return $html;
@@ -674,32 +674,32 @@  discard block
 block discarded – undo
674 674
  * @return void|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
675 675
  *                    Otherwise, this function outputs the tag cloud.
676 676
  */
677
-function wp_tag_cloud( $args = '' ) {
677
+function wp_tag_cloud($args = '') {
678 678
 	$defaults = array(
679 679
 		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
680 680
 		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
681 681
 		'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true
682 682
 	);
683
-	$args = wp_parse_args( $args, $defaults );
683
+	$args = wp_parse_args($args, $defaults);
684 684
 
685
-	$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
685
+	$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC'))); // Always query top tags
686 686
 
687
-	if ( empty( $tags ) || is_wp_error( $tags ) )
687
+	if (empty($tags) || is_wp_error($tags))
688 688
 		return;
689 689
 
690
-	foreach ( $tags as $key => $tag ) {
691
-		if ( 'edit' == $args['link'] )
692
-			$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
690
+	foreach ($tags as $key => $tag) {
691
+		if ('edit' == $args['link'])
692
+			$link = get_edit_term_link($tag->term_id, $tag->taxonomy, $args['post_type']);
693 693
 		else
694
-			$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
695
-		if ( is_wp_error( $link ) )
694
+			$link = get_term_link(intval($tag->term_id), $tag->taxonomy);
695
+		if (is_wp_error($link))
696 696
 			return;
697 697
 
698
-		$tags[ $key ]->link = $link;
699
-		$tags[ $key ]->id = $tag->term_id;
698
+		$tags[$key]->link = $link;
699
+		$tags[$key]->id = $tag->term_id;
700 700
 	}
701 701
 
702
-	$return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
702
+	$return = wp_generate_tag_cloud($tags, $args); // Here's where those top tags get sorted according to $args
703 703
 
704 704
 	/**
705 705
 	 * Filters the tag cloud output.
@@ -709,9 +709,9 @@  discard block
 block discarded – undo
709 709
 	 * @param string $return HTML output of the tag cloud.
710 710
 	 * @param array  $args   An array of tag cloud arguments.
711 711
 	 */
712
-	$return = apply_filters( 'wp_tag_cloud', $return, $args );
712
+	$return = apply_filters('wp_tag_cloud', $return, $args);
713 713
 
714
-	if ( 'array' == $args['format'] || empty($args['echo']) )
714
+	if ('array' == $args['format'] || empty($args['echo']))
715 715
 		return $return;
716 716
 
717 717
 	echo $return;
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
  * @param int $count Number of posts with that tag.
726 726
  * @return int Scaled count.
727 727
  */
728
-function default_topic_count_scale( $count ) {
728
+function default_topic_count_scale($count) {
729 729
 	return round(log10($count + 1) * 100);
730 730
 }
731 731
 
@@ -772,7 +772,7 @@  discard block
 block discarded – undo
772 772
  * }
773 773
  * @return string|array Tag cloud as a string or an array, depending on 'format' argument.
774 774
  */
775
-function wp_generate_tag_cloud( $tags, $args = '' ) {
775
+function wp_generate_tag_cloud($tags, $args = '') {
776 776
 	$defaults = array(
777 777
 		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
778 778
 		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
@@ -780,31 +780,31 @@  discard block
 block discarded – undo
780 780
 		'topic_count_scale_callback' => 'default_topic_count_scale', 'filter' => 1,
781 781
 	);
782 782
 
783
-	$args = wp_parse_args( $args, $defaults );
783
+	$args = wp_parse_args($args, $defaults);
784 784
 
785
-	$return = ( 'array' === $args['format'] ) ? array() : '';
785
+	$return = ('array' === $args['format']) ? array() : '';
786 786
 
787
-	if ( empty( $tags ) ) {
787
+	if (empty($tags)) {
788 788
 		return $return;
789 789
 	}
790 790
 
791 791
 	// Juggle topic count tooltips:
792
-	if ( isset( $args['topic_count_text'] ) ) {
792
+	if (isset($args['topic_count_text'])) {
793 793
 		// First look for nooped plural support via topic_count_text.
794 794
 		$translate_nooped_plural = $args['topic_count_text'];
795
-	} elseif ( ! empty( $args['topic_count_text_callback'] ) ) {
795
+	} elseif ( ! empty($args['topic_count_text_callback'])) {
796 796
 		// Look for the alternative callback style. Ignore the previous default.
797
-		if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) {
798
-			$translate_nooped_plural = _n_noop( '%s topic', '%s topics' );
797
+		if ($args['topic_count_text_callback'] === 'default_topic_count_text') {
798
+			$translate_nooped_plural = _n_noop('%s topic', '%s topics');
799 799
 		} else {
800 800
 			$translate_nooped_plural = false;
801 801
 		}
802
-	} elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
802
+	} elseif (isset($args['single_text']) && isset($args['multiple_text'])) {
803 803
 		// If no callback exists, look for the old-style single_text and multiple_text arguments.
804
-		$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
804
+		$translate_nooped_plural = _n_noop($args['single_text'], $args['multiple_text']);
805 805
 	} else {
806 806
 		// This is the default for when no callback, plural, or argument is passed in.
807
-		$translate_nooped_plural = _n_noop( '%s topic', '%s topics' );
807
+		$translate_nooped_plural = _n_noop('%s topic', '%s topics');
808 808
 	}
809 809
 
810 810
 	/**
@@ -815,62 +815,62 @@  discard block
 block discarded – undo
815 815
 	 * @param array $tags Ordered array of terms.
816 816
 	 * @param array $args An array of tag cloud arguments.
817 817
 	 */
818
-	$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
819
-	if ( empty( $tags_sorted ) ) {
818
+	$tags_sorted = apply_filters('tag_cloud_sort', $tags, $args);
819
+	if (empty($tags_sorted)) {
820 820
 		return $return;
821 821
 	}
822 822
 
823
-	if ( $tags_sorted !== $tags ) {
823
+	if ($tags_sorted !== $tags) {
824 824
 		$tags = $tags_sorted;
825
-		unset( $tags_sorted );
825
+		unset($tags_sorted);
826 826
 	} else {
827
-		if ( 'RAND' === $args['order'] ) {
828
-			shuffle( $tags );
827
+		if ('RAND' === $args['order']) {
828
+			shuffle($tags);
829 829
 		} else {
830 830
 			// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
831
-			if ( 'name' === $args['orderby'] ) {
832
-				uasort( $tags, '_wp_object_name_sort_cb' );
831
+			if ('name' === $args['orderby']) {
832
+				uasort($tags, '_wp_object_name_sort_cb');
833 833
 			} else {
834
-				uasort( $tags, '_wp_object_count_sort_cb' );
834
+				uasort($tags, '_wp_object_count_sort_cb');
835 835
 			}
836 836
 
837
-			if ( 'DESC' === $args['order'] ) {
838
-				$tags = array_reverse( $tags, true );
837
+			if ('DESC' === $args['order']) {
838
+				$tags = array_reverse($tags, true);
839 839
 			}
840 840
 		}
841 841
 	}
842 842
 
843
-	if ( $args['number'] > 0 )
844
-		$tags = array_slice( $tags, 0, $args['number'] );
843
+	if ($args['number'] > 0)
844
+		$tags = array_slice($tags, 0, $args['number']);
845 845
 
846 846
 	$counts = array();
847 847
 	$real_counts = array(); // For the alt tag
848
-	foreach ( (array) $tags as $key => $tag ) {
849
-		$real_counts[ $key ] = $tag->count;
850
-		$counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count );
848
+	foreach ((array) $tags as $key => $tag) {
849
+		$real_counts[$key] = $tag->count;
850
+		$counts[$key] = call_user_func($args['topic_count_scale_callback'], $tag->count);
851 851
 	}
852 852
 
853
-	$min_count = min( $counts );
854
-	$spread = max( $counts ) - $min_count;
855
-	if ( $spread <= 0 )
853
+	$min_count = min($counts);
854
+	$spread = max($counts) - $min_count;
855
+	if ($spread <= 0)
856 856
 		$spread = 1;
857 857
 	$font_spread = $args['largest'] - $args['smallest'];
858
-	if ( $font_spread < 0 )
858
+	if ($font_spread < 0)
859 859
 		$font_spread = 1;
860 860
 	$font_step = $font_spread / $spread;
861 861
 
862 862
 	// Assemble the data that will be used to generate the tag cloud markup.
863 863
 	$tags_data = array();
864
-	foreach ( $tags as $key => $tag ) {
865
-		$tag_id = isset( $tag->id ) ? $tag->id : $key;
864
+	foreach ($tags as $key => $tag) {
865
+		$tag_id = isset($tag->id) ? $tag->id : $key;
866 866
 
867
-		$count = $counts[ $key ];
868
-		$real_count = $real_counts[ $key ];
867
+		$count = $counts[$key];
868
+		$real_count = $real_counts[$key];
869 869
 
870
-		if ( $translate_nooped_plural ) {
871
-			$title = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
870
+		if ($translate_nooped_plural) {
871
+			$title = sprintf(translate_nooped_plural($translate_nooped_plural, $real_count), number_format_i18n($real_count));
872 872
 		} else {
873
-			$title = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
873
+			$title = call_user_func($args['topic_count_text_callback'], $real_count, $tag, $args);
874 874
 		}
875 875
 
876 876
 		$tags_data[] = array(
@@ -881,8 +881,8 @@  discard block
 block discarded – undo
881 881
 			'title'      => $title,
882 882
 			'slug'       => $tag->slug,
883 883
 			'real_count' => $real_count,
884
-			'class'	     => 'tag-link-' . $tag_id,
885
-			'font_size'  => $args['smallest'] + ( $count - $min_count ) * $font_step,
884
+			'class'	     => 'tag-link-'.$tag_id,
885
+			'font_size'  => $args['smallest'] + ($count - $min_count) * $font_step,
886 886
 		);
887 887
 	}
888 888
 
@@ -893,31 +893,31 @@  discard block
 block discarded – undo
893 893
 	 *
894 894
 	 * @param array $tags_data An array of term data for term used to generate the tag cloud.
895 895
 	 */
896
-	$tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data );
896
+	$tags_data = apply_filters('wp_generate_tag_cloud_data', $tags_data);
897 897
 
898 898
 	$a = array();
899 899
 
900 900
 	// generate the output links array
901
-	foreach ( $tags_data as $key => $tag_data ) {
902
-		$class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 );
903
-		$a[] = "<a href='" . esc_url( $tag_data['url'] ) . "'" . $tag_data['role'] . " class='" . esc_attr( $class ) . "' title='" . esc_attr( $tag_data['title'] ) . "' style='font-size: " . esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ) . ";'>" . esc_html( $tag_data['name'] ) . "</a>";
901
+	foreach ($tags_data as $key => $tag_data) {
902
+		$class = $tag_data['class'].' tag-link-position-'.($key + 1);
903
+		$a[] = "<a href='".esc_url($tag_data['url'])."'".$tag_data['role']." class='".esc_attr($class)."' title='".esc_attr($tag_data['title'])."' style='font-size: ".esc_attr(str_replace(',', '.', $tag_data['font_size']).$args['unit']).";'>".esc_html($tag_data['name'])."</a>";
904 904
 	}
905 905
 
906
-	switch ( $args['format'] ) {
906
+	switch ($args['format']) {
907 907
 		case 'array' :
908
-			$return =& $a;
908
+			$return = & $a;
909 909
 			break;
910 910
 		case 'list' :
911 911
 			$return = "<ul class='wp-tag-cloud'>\n\t<li>";
912
-			$return .= join( "</li>\n\t<li>", $a );
912
+			$return .= join("</li>\n\t<li>", $a);
913 913
 			$return .= "</li>\n</ul>\n";
914 914
 			break;
915 915
 		default :
916
-			$return = join( $args['separator'], $a );
916
+			$return = join($args['separator'], $a);
917 917
 			break;
918 918
 	}
919 919
 
920
-	if ( $args['filter'] ) {
920
+	if ($args['filter']) {
921 921
 		/**
922 922
 		 * Filters the generated output of a tag cloud.
923 923
 		 *
@@ -934,7 +934,7 @@  discard block
 block discarded – undo
934 934
 		 * @param array        $tags   An array of terms used in the tag cloud.
935 935
 		 * @param array        $args   An array of wp_generate_tag_cloud() arguments.
936 936
 		 */
937
-		return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
937
+		return apply_filters('wp_generate_tag_cloud', $return, $tags, $args);
938 938
 	}
939 939
 
940 940
 	else
@@ -954,8 +954,8 @@  discard block
 block discarded – undo
954 954
  * @return int Negative number if `$a->name` is less than `$b->name`, zero if they are equal,
955 955
  *             or greater than zero if `$a->name` is greater than `$b->name`.
956 956
  */
957
-function _wp_object_name_sort_cb( $a, $b ) {
958
-	return strnatcasecmp( $a->name, $b->name );
957
+function _wp_object_name_sort_cb($a, $b) {
958
+	return strnatcasecmp($a->name, $b->name);
959 959
 }
960 960
 
961 961
 /**
@@ -970,8 +970,8 @@  discard block
 block discarded – undo
970 970
  * @param object $b The second object to compare.
971 971
  * @return bool Whether the count value for `$a` is greater than the count value for `$b`.
972 972
  */
973
-function _wp_object_count_sort_cb( $a, $b ) {
974
-	return ( $a->count > $b->count );
973
+function _wp_object_count_sort_cb($a, $b) {
974
+	return ($a->count > $b->count);
975 975
 }
976 976
 
977 977
 //
@@ -989,12 +989,12 @@  discard block
 block discarded – undo
989 989
 function walk_category_tree() {
990 990
 	$args = func_get_args();
991 991
 	// the user's options are the third parameter
992
-	if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
992
+	if (empty($args[2]['walker']) || ! ($args[2]['walker'] instanceof Walker)) {
993 993
 		$walker = new Walker_Category;
994 994
 	} else {
995 995
 		$walker = $args[2]['walker'];
996 996
 	}
997
-	return call_user_func_array( array( $walker, 'walk' ), $args );
997
+	return call_user_func_array(array($walker, 'walk'), $args);
998 998
 }
999 999
 
1000 1000
 /**
@@ -1008,12 +1008,12 @@  discard block
 block discarded – undo
1008 1008
 function walk_category_dropdown_tree() {
1009 1009
 	$args = func_get_args();
1010 1010
 	// the user's options are the third parameter
1011
-	if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
1011
+	if (empty($args[2]['walker']) || ! ($args[2]['walker'] instanceof Walker)) {
1012 1012
 		$walker = new Walker_CategoryDropdown;
1013 1013
 	} else {
1014 1014
 		$walker = $args[2]['walker'];
1015 1015
 	}
1016
-	return call_user_func_array( array( $walker, 'walk' ), $args );
1016
+	return call_user_func_array(array($walker, 'walk'), $args);
1017 1017
 }
1018 1018
 
1019 1019
 //
@@ -1029,13 +1029,13 @@  discard block
 block discarded – undo
1029 1029
  * @param int|object $tag Tag ID or object.
1030 1030
  * @return string Link on success, empty string if tag does not exist.
1031 1031
  */
1032
-function get_tag_link( $tag ) {
1033
-	if ( ! is_object( $tag ) )
1032
+function get_tag_link($tag) {
1033
+	if ( ! is_object($tag))
1034 1034
 		$tag = (int) $tag;
1035 1035
 
1036
-	$tag = get_term_link( $tag, 'post_tag' );
1036
+	$tag = get_term_link($tag, 'post_tag');
1037 1037
 
1038
-	if ( is_wp_error( $tag ) )
1038
+	if (is_wp_error($tag))
1039 1039
 		return '';
1040 1040
 
1041 1041
 	return $tag;
@@ -1049,7 +1049,7 @@  discard block
 block discarded – undo
1049 1049
  * @param int $id Post ID.
1050 1050
  * @return array|false|WP_Error Array of tag objects on success, false on failure.
1051 1051
  */
1052
-function get_the_tags( $id = 0 ) {
1052
+function get_the_tags($id = 0) {
1053 1053
 
1054 1054
 	/**
1055 1055
 	 * Filters the array of tags for the given post.
@@ -1060,7 +1060,7 @@  discard block
 block discarded – undo
1060 1060
 	 *
1061 1061
 	 * @param array $terms An array of tags for the given post.
1062 1062
 	 */
1063
-	return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
1063
+	return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
1064 1064
 }
1065 1065
 
1066 1066
 /**
@@ -1074,7 +1074,7 @@  discard block
 block discarded – undo
1074 1074
  * @param int $id Optional. Post ID. Defaults to the current post.
1075 1075
  * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
1076 1076
  */
1077
-function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
1077
+function get_the_tag_list($before = '', $sep = '', $after = '', $id = 0) {
1078 1078
 
1079 1079
 	/**
1080 1080
 	 * Filters the tags list for a given post.
@@ -1087,7 +1087,7 @@  discard block
 block discarded – undo
1087 1087
 	 * @param string $after    String to use after tags.
1088 1088
 	 * @param int    $id       Post ID.
1089 1089
 	 */
1090
-	return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
1090
+	return apply_filters('the_tags', get_the_term_list($id, 'post_tag', $before, $sep, $after), $before, $sep, $after, $id);
1091 1091
 }
1092 1092
 
1093 1093
 /**
@@ -1099,13 +1099,13 @@  discard block
 block discarded – undo
1099 1099
  * @param string $sep Optional. Separate items using this.
1100 1100
  * @param string $after Optional. After list.
1101 1101
  */
1102
-function the_tags( $before = null, $sep = ', ', $after = '' ) {
1103
-	if ( null === $before )
1102
+function the_tags($before = null, $sep = ', ', $after = '') {
1103
+	if (null === $before)
1104 1104
 		$before = __('Tags: ');
1105 1105
 
1106
-	$the_tags = get_the_tag_list( $before, $sep, $after );
1106
+	$the_tags = get_the_tag_list($before, $sep, $after);
1107 1107
 
1108
-	if ( ! is_wp_error( $the_tags ) ) {
1108
+	if ( ! is_wp_error($the_tags)) {
1109 1109
 		echo $the_tags;
1110 1110
 	}
1111 1111
 }
@@ -1118,8 +1118,8 @@  discard block
 block discarded – undo
1118 1118
  * @param int $tag Optional. Tag ID. Will use global tag ID by default.
1119 1119
  * @return string Tag description, available.
1120 1120
  */
1121
-function tag_description( $tag = 0 ) {
1122
-	return term_description( $tag );
1121
+function tag_description($tag = 0) {
1122
+	return term_description($tag);
1123 1123
 }
1124 1124
 
1125 1125
 /**
@@ -1131,16 +1131,16 @@  discard block
 block discarded – undo
1131 1131
  * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
1132 1132
  * @return string Term description, available.
1133 1133
  */
1134
-function term_description( $term = 0, $taxonomy = 'post_tag' ) {
1135
-	if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
1134
+function term_description($term = 0, $taxonomy = 'post_tag') {
1135
+	if ( ! $term && (is_tax() || is_tag() || is_category())) {
1136 1136
 		$term = get_queried_object();
1137
-		if ( $term ) {
1137
+		if ($term) {
1138 1138
 			$taxonomy = $term->taxonomy;
1139 1139
 			$term = $term->term_id;
1140 1140
 		}
1141 1141
 	}
1142
-	$description = get_term_field( 'description', $term, $taxonomy );
1143
-	return is_wp_error( $description ) ? '' : $description;
1142
+	$description = get_term_field('description', $term, $taxonomy);
1143
+	return is_wp_error($description) ? '' : $description;
1144 1144
 }
1145 1145
 
1146 1146
 /**
@@ -1153,16 +1153,16 @@  discard block
 block discarded – undo
1153 1153
  * @return array|false|WP_Error Array of WP_Term objects on success, false if there are no terms
1154 1154
  *                              or the post does not exist, WP_Error on failure.
1155 1155
  */
1156
-function get_the_terms( $post, $taxonomy ) {
1157
-	if ( ! $post = get_post( $post ) )
1156
+function get_the_terms($post, $taxonomy) {
1157
+	if ( ! $post = get_post($post))
1158 1158
 		return false;
1159 1159
 
1160
-	$terms = get_object_term_cache( $post->ID, $taxonomy );
1161
-	if ( false === $terms ) {
1162
-		$terms = wp_get_object_terms( $post->ID, $taxonomy );
1163
-		if ( ! is_wp_error( $terms ) ) {
1164
-			$term_ids = wp_list_pluck( $terms, 'term_id' );
1165
-			wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' );
1160
+	$terms = get_object_term_cache($post->ID, $taxonomy);
1161
+	if (false === $terms) {
1162
+		$terms = wp_get_object_terms($post->ID, $taxonomy);
1163
+		if ( ! is_wp_error($terms)) {
1164
+			$term_ids = wp_list_pluck($terms, 'term_id');
1165
+			wp_cache_add($post->ID, $term_ids, $taxonomy.'_relationships');
1166 1166
 		}
1167 1167
 	}
1168 1168
 
@@ -1175,9 +1175,9 @@  discard block
 block discarded – undo
1175 1175
 	 * @param int            $post_id  Post ID.
1176 1176
 	 * @param string         $taxonomy Name of the taxonomy.
1177 1177
 	 */
1178
-	$terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
1178
+	$terms = apply_filters('get_the_terms', $terms, $post->ID, $taxonomy);
1179 1179
 
1180
-	if ( empty( $terms ) )
1180
+	if (empty($terms))
1181 1181
 		return false;
1182 1182
 
1183 1183
 	return $terms;
@@ -1195,23 +1195,23 @@  discard block
 block discarded – undo
1195 1195
  * @param string $after Optional. After list.
1196 1196
  * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
1197 1197
  */
1198
-function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
1199
-	$terms = get_the_terms( $id, $taxonomy );
1198
+function get_the_term_list($id, $taxonomy, $before = '', $sep = '', $after = '') {
1199
+	$terms = get_the_terms($id, $taxonomy);
1200 1200
 
1201
-	if ( is_wp_error( $terms ) )
1201
+	if (is_wp_error($terms))
1202 1202
 		return $terms;
1203 1203
 
1204
-	if ( empty( $terms ) )
1204
+	if (empty($terms))
1205 1205
 		return false;
1206 1206
 
1207 1207
 	$links = array();
1208 1208
 
1209
-	foreach ( $terms as $term ) {
1210
-		$link = get_term_link( $term, $taxonomy );
1211
-		if ( is_wp_error( $link ) ) {
1209
+	foreach ($terms as $term) {
1210
+		$link = get_term_link($term, $taxonomy);
1211
+		if (is_wp_error($link)) {
1212 1212
 			return $link;
1213 1213
 		}
1214
-		$links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
1214
+		$links[] = '<a href="'.esc_url($link).'" rel="tag">'.$term->name.'</a>';
1215 1215
 	}
1216 1216
 
1217 1217
 	/**
@@ -1224,9 +1224,9 @@  discard block
 block discarded – undo
1224 1224
 	 *
1225 1225
 	 * @param array $links An array of term links.
1226 1226
 	 */
1227
-	$term_links = apply_filters( "term_links-{$taxonomy}", $links );
1227
+	$term_links = apply_filters("term_links-{$taxonomy}", $links);
1228 1228
 
1229
-	return $before . join( $sep, $term_links ) . $after;
1229
+	return $before.join($sep, $term_links).$after;
1230 1230
 }
1231 1231
 
1232 1232
 /**
@@ -1247,15 +1247,15 @@  discard block
 block discarded – undo
1247 1247
  * }
1248 1248
  * @return string|WP_Error A list of term parents on success, WP_Error or empty string on failure.
1249 1249
  */
1250
-function get_term_parents_list( $term_id, $taxonomy, $args = array() ) {
1250
+function get_term_parents_list($term_id, $taxonomy, $args = array()) {
1251 1251
 	$list = '';
1252
-	$term = get_term( $term_id, $taxonomy );
1252
+	$term = get_term($term_id, $taxonomy);
1253 1253
 
1254
-	if ( is_wp_error( $term ) ) {
1254
+	if (is_wp_error($term)) {
1255 1255
 		return $term;
1256 1256
 	}
1257 1257
 
1258
-	if ( ! $term ) {
1258
+	if ( ! $term) {
1259 1259
 		return $list;
1260 1260
 	}
1261 1261
 
@@ -1268,26 +1268,26 @@  discard block
 block discarded – undo
1268 1268
 		'inclusive' => true,
1269 1269
 	);
1270 1270
 
1271
-	$args = wp_parse_args( $args, $defaults );
1271
+	$args = wp_parse_args($args, $defaults);
1272 1272
 
1273
-	foreach ( array( 'link', 'inclusive' ) as $bool ) {
1274
-		$args[ $bool ] = wp_validate_boolean( $args[ $bool ] );
1273
+	foreach (array('link', 'inclusive') as $bool) {
1274
+		$args[$bool] = wp_validate_boolean($args[$bool]);
1275 1275
 	}
1276 1276
 
1277
-	$parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' );
1277
+	$parents = get_ancestors($term_id, $taxonomy, 'taxonomy');
1278 1278
 
1279
-	if ( $args['inclusive'] ) {
1280
-		array_unshift( $parents, $term_id );
1279
+	if ($args['inclusive']) {
1280
+		array_unshift($parents, $term_id);
1281 1281
 	}
1282 1282
 
1283
-	foreach ( array_reverse( $parents ) as $term_id ) {
1284
-		$parent = get_term( $term_id, $taxonomy );
1285
-		$name   = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name;
1283
+	foreach (array_reverse($parents) as $term_id) {
1284
+		$parent = get_term($term_id, $taxonomy);
1285
+		$name   = ('slug' === $args['format']) ? $parent->slug : $parent->name;
1286 1286
 
1287
-		if ( $args['link'] ) {
1288
-			$list .= '<a href="' . esc_url( get_term_link( $parent->term_id, $taxonomy ) ) . '">' . $name . '</a>' . $args['separator'];
1287
+		if ($args['link']) {
1288
+			$list .= '<a href="'.esc_url(get_term_link($parent->term_id, $taxonomy)).'">'.$name.'</a>'.$args['separator'];
1289 1289
 		} else {
1290
-			$list .= $name . $args['separator'];
1290
+			$list .= $name.$args['separator'];
1291 1291
 		}
1292 1292
 	}
1293 1293
 
@@ -1306,10 +1306,10 @@  discard block
 block discarded – undo
1306 1306
  * @param string $after Optional. After list.
1307 1307
  * @return false|void False on WordPress error.
1308 1308
  */
1309
-function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
1310
-	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
1309
+function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '') {
1310
+	$term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
1311 1311
 
1312
-	if ( is_wp_error( $term_list ) )
1312
+	if (is_wp_error($term_list))
1313 1313
 		return false;
1314 1314
 
1315 1315
 	/**
@@ -1323,7 +1323,7 @@  discard block
 block discarded – undo
1323 1323
 	 * @param string $sep       String to use between the terms.
1324 1324
 	 * @param string $after     String to use after the terms.
1325 1325
 	 */
1326
-	echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after );
1326
+	echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
1327 1327
 }
1328 1328
 
1329 1329
 /**
@@ -1335,8 +1335,8 @@  discard block
 block discarded – undo
1335 1335
  * @param int|object $post Optional. Post to check instead of the current post.
1336 1336
  * @return bool True if the current post has any of the given categories (or any category, if no category specified).
1337 1337
  */
1338
-function has_category( $category = '', $post = null ) {
1339
-	return has_term( $category, 'category', $post );
1338
+function has_category($category = '', $post = null) {
1339
+	return has_term($category, 'category', $post);
1340 1340
 }
1341 1341
 
1342 1342
 /**
@@ -1356,8 +1356,8 @@  discard block
 block discarded – undo
1356 1356
  * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
1357 1357
  * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
1358 1358
  */
1359
-function has_tag( $tag = '', $post = null ) {
1360
-	return has_term( $tag, 'post_tag', $post );
1359
+function has_tag($tag = '', $post = null) {
1360
+	return has_term($tag, 'post_tag', $post);
1361 1361
 }
1362 1362
 
1363 1363
 /**
@@ -1374,14 +1374,14 @@  discard block
 block discarded – undo
1374 1374
  * @param int|object $post Optional. Post to check instead of the current post.
1375 1375
  * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
1376 1376
  */
1377
-function has_term( $term = '', $taxonomy = '', $post = null ) {
1377
+function has_term($term = '', $taxonomy = '', $post = null) {
1378 1378
 	$post = get_post($post);
1379 1379
 
1380
-	if ( !$post )
1380
+	if ( ! $post)
1381 1381
 		return false;
1382 1382
 
1383
-	$r = is_object_in_term( $post->ID, $taxonomy, $term );
1384
-	if ( is_wp_error( $r ) )
1383
+	$r = is_object_in_term($post->ID, $taxonomy, $term);
1384
+	if (is_wp_error($r))
1385 1385
 		return false;
1386 1386
 
1387 1387
 	return $r;
Please login to merge, or discard this patch.
Braces   +92 added lines, -64 removed lines patch added patch discarded remove patch
@@ -17,13 +17,15 @@  discard block
 block discarded – undo
17 17
  * @return string Link on success, empty string if category does not exist.
18 18
  */
19 19
 function get_category_link( $category ) {
20
-	if ( ! is_object( $category ) )
21
-		$category = (int) $category;
20
+	if ( ! is_object( $category ) ) {
21
+			$category = (int) $category;
22
+	}
22 23
 
23 24
 	$category = get_term_link( $category, 'category' );
24 25
 
25
-	if ( is_wp_error( $category ) )
26
-		return '';
26
+	if ( is_wp_error( $category ) ) {
27
+			return '';
28
+	}
27 29
 
28 30
 	return $category;
29 31
 }
@@ -73,8 +75,9 @@  discard block
 block discarded – undo
73 75
  */
74 76
 function get_the_category( $id = false ) {
75 77
 	$categories = get_the_terms( $id, 'category' );
76
-	if ( ! $categories || is_wp_error( $categories ) )
77
-		$categories = array();
78
+	if ( ! $categories || is_wp_error( $categories ) ) {
79
+			$categories = array();
80
+	}
78 81
 
79 82
 	$categories = array_values( $categories );
80 83
 
@@ -106,8 +109,9 @@  discard block
 block discarded – undo
106 109
 	$cat_ID = (int) $cat_ID;
107 110
 	$category = get_term( $cat_ID, 'category' );
108 111
 
109
-	if ( is_wp_error( $category ) )
110
-		return $category;
112
+	if ( is_wp_error( $category ) ) {
113
+			return $category;
114
+	}
111 115
 
112 116
 	return ( $category ) ? $category->name : '';
113 117
 }
@@ -156,14 +160,16 @@  discard block
 block discarded – undo
156 160
 			$thelist .= "\n\t<li>";
157 161
 			switch ( strtolower( $parents ) ) {
158 162
 				case 'multiple':
159
-					if ( $category->parent )
160
-						$thelist .= get_category_parents( $category->parent, true, $separator );
163
+					if ( $category->parent ) {
164
+											$thelist .= get_category_parents( $category->parent, true, $separator );
165
+					}
161 166
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
162 167
 					break;
163 168
 				case 'single':
164 169
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"  ' . $rel . '>';
165
-					if ( $category->parent )
166
-						$thelist .= get_category_parents( $category->parent, false, $separator );
170
+					if ( $category->parent ) {
171
+											$thelist .= get_category_parents( $category->parent, false, $separator );
172
+					}
167 173
 					$thelist .= $category->name.'</a></li>';
168 174
 					break;
169 175
 				case '':
@@ -175,18 +181,21 @@  discard block
 block discarded – undo
175 181
 	} else {
176 182
 		$i = 0;
177 183
 		foreach ( $categories as $category ) {
178
-			if ( 0 < $i )
179
-				$thelist .= $separator;
184
+			if ( 0 < $i ) {
185
+							$thelist .= $separator;
186
+			}
180 187
 			switch ( strtolower( $parents ) ) {
181 188
 				case 'multiple':
182
-					if ( $category->parent )
183
-						$thelist .= get_category_parents( $category->parent, true, $separator );
189
+					if ( $category->parent ) {
190
+											$thelist .= get_category_parents( $category->parent, true, $separator );
191
+					}
184 192
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
185 193
 					break;
186 194
 				case 'single':
187 195
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
188
-					if ( $category->parent )
189
-						$thelist .= get_category_parents( $category->parent, false, $separator );
196
+					if ( $category->parent ) {
197
+											$thelist .= get_category_parents( $category->parent, false, $separator );
198
+					}
190 199
 					$thelist .= "$category->name</a>";
191 200
 					break;
192 201
 				case '':
@@ -229,8 +238,9 @@  discard block
 block discarded – undo
229 238
  * @return bool True if the current post is in any of the given categories.
230 239
  */
231 240
 function in_category( $category, $post = null ) {
232
-	if ( empty( $category ) )
233
-		return false;
241
+	if ( empty( $category ) ) {
242
+			return false;
243
+	}
234 244
 
235 245
 	return has_category( $category, $post );
236 246
 }
@@ -525,8 +535,9 @@  discard block
 block discarded – undo
525 535
 
526 536
 	$r = wp_parse_args( $args, $defaults );
527 537
 
528
-	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] )
529
-		$r['pad_counts'] = true;
538
+	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
539
+			$r['pad_counts'] = true;
540
+	}
530 541
 
531 542
 	// Descendants of exclusions should be excluded too.
532 543
 	if ( true == $r['hierarchical'] ) {
@@ -544,8 +555,9 @@  discard block
 block discarded – undo
544 555
 		$r['exclude'] = '';
545 556
 	}
546 557
 
547
-	if ( ! isset( $r['class'] ) )
548
-		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
558
+	if ( ! isset( $r['class'] ) ) {
559
+			$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
560
+	}
549 561
 
550 562
 	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
551 563
 		return false;
@@ -684,16 +696,19 @@  discard block
 block discarded – undo
684 696
 
685 697
 	$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
686 698
 
687
-	if ( empty( $tags ) || is_wp_error( $tags ) )
688
-		return;
699
+	if ( empty( $tags ) || is_wp_error( $tags ) ) {
700
+			return;
701
+	}
689 702
 
690 703
 	foreach ( $tags as $key => $tag ) {
691
-		if ( 'edit' == $args['link'] )
692
-			$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
693
-		else
694
-			$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
695
-		if ( is_wp_error( $link ) )
696
-			return;
704
+		if ( 'edit' == $args['link'] ) {
705
+					$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
706
+		} else {
707
+					$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
708
+		}
709
+		if ( is_wp_error( $link ) ) {
710
+					return;
711
+		}
697 712
 
698 713
 		$tags[ $key ]->link = $link;
699 714
 		$tags[ $key ]->id = $tag->term_id;
@@ -711,8 +726,9 @@  discard block
 block discarded – undo
711 726
 	 */
712 727
 	$return = apply_filters( 'wp_tag_cloud', $return, $args );
713 728
 
714
-	if ( 'array' == $args['format'] || empty($args['echo']) )
715
-		return $return;
729
+	if ( 'array' == $args['format'] || empty($args['echo']) ) {
730
+			return $return;
731
+	}
716 732
 
717 733
 	echo $return;
718 734
 }
@@ -840,8 +856,9 @@  discard block
 block discarded – undo
840 856
 		}
841 857
 	}
842 858
 
843
-	if ( $args['number'] > 0 )
844
-		$tags = array_slice( $tags, 0, $args['number'] );
859
+	if ( $args['number'] > 0 ) {
860
+			$tags = array_slice( $tags, 0, $args['number'] );
861
+	}
845 862
 
846 863
 	$counts = array();
847 864
 	$real_counts = array(); // For the alt tag
@@ -852,11 +869,13 @@  discard block
 block discarded – undo
852 869
 
853 870
 	$min_count = min( $counts );
854 871
 	$spread = max( $counts ) - $min_count;
855
-	if ( $spread <= 0 )
856
-		$spread = 1;
872
+	if ( $spread <= 0 ) {
873
+			$spread = 1;
874
+	}
857 875
 	$font_spread = $args['largest'] - $args['smallest'];
858
-	if ( $font_spread < 0 )
859
-		$font_spread = 1;
876
+	if ( $font_spread < 0 ) {
877
+			$font_spread = 1;
878
+	}
860 879
 	$font_step = $font_spread / $spread;
861 880
 
862 881
 	// Assemble the data that will be used to generate the tag cloud markup.
@@ -935,11 +954,10 @@  discard block
 block discarded – undo
935 954
 		 * @param array        $args   An array of wp_generate_tag_cloud() arguments.
936 955
 		 */
937 956
 		return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
957
+	} else {
958
+			return $return;
959
+	}
938 960
 	}
939
-
940
-	else
941
-		return $return;
942
-}
943 961
 
944 962
 /**
945 963
  * Serves as a callback for comparing objects based on name.
@@ -1030,13 +1048,15 @@  discard block
 block discarded – undo
1030 1048
  * @return string Link on success, empty string if tag does not exist.
1031 1049
  */
1032 1050
 function get_tag_link( $tag ) {
1033
-	if ( ! is_object( $tag ) )
1034
-		$tag = (int) $tag;
1051
+	if ( ! is_object( $tag ) ) {
1052
+			$tag = (int) $tag;
1053
+	}
1035 1054
 
1036 1055
 	$tag = get_term_link( $tag, 'post_tag' );
1037 1056
 
1038
-	if ( is_wp_error( $tag ) )
1039
-		return '';
1057
+	if ( is_wp_error( $tag ) ) {
1058
+			return '';
1059
+	}
1040 1060
 
1041 1061
 	return $tag;
1042 1062
 }
@@ -1100,8 +1120,9 @@  discard block
 block discarded – undo
1100 1120
  * @param string $after Optional. After list.
1101 1121
  */
1102 1122
 function the_tags( $before = null, $sep = ', ', $after = '' ) {
1103
-	if ( null === $before )
1104
-		$before = __('Tags: ');
1123
+	if ( null === $before ) {
1124
+			$before = __('Tags: ');
1125
+	}
1105 1126
 
1106 1127
 	$the_tags = get_the_tag_list( $before, $sep, $after );
1107 1128
 
@@ -1154,8 +1175,9 @@  discard block
 block discarded – undo
1154 1175
  *                              or the post does not exist, WP_Error on failure.
1155 1176
  */
1156 1177
 function get_the_terms( $post, $taxonomy ) {
1157
-	if ( ! $post = get_post( $post ) )
1158
-		return false;
1178
+	if ( ! $post = get_post( $post ) ) {
1179
+			return false;
1180
+	}
1159 1181
 
1160 1182
 	$terms = get_object_term_cache( $post->ID, $taxonomy );
1161 1183
 	if ( false === $terms ) {
@@ -1177,8 +1199,9 @@  discard block
 block discarded – undo
1177 1199
 	 */
1178 1200
 	$terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
1179 1201
 
1180
-	if ( empty( $terms ) )
1181
-		return false;
1202
+	if ( empty( $terms ) ) {
1203
+			return false;
1204
+	}
1182 1205
 
1183 1206
 	return $terms;
1184 1207
 }
@@ -1198,11 +1221,13 @@  discard block
 block discarded – undo
1198 1221
 function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
1199 1222
 	$terms = get_the_terms( $id, $taxonomy );
1200 1223
 
1201
-	if ( is_wp_error( $terms ) )
1202
-		return $terms;
1224
+	if ( is_wp_error( $terms ) ) {
1225
+			return $terms;
1226
+	}
1203 1227
 
1204
-	if ( empty( $terms ) )
1205
-		return false;
1228
+	if ( empty( $terms ) ) {
1229
+			return false;
1230
+	}
1206 1231
 
1207 1232
 	$links = array();
1208 1233
 
@@ -1309,8 +1334,9 @@  discard block
 block discarded – undo
1309 1334
 function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
1310 1335
 	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
1311 1336
 
1312
-	if ( is_wp_error( $term_list ) )
1313
-		return false;
1337
+	if ( is_wp_error( $term_list ) ) {
1338
+			return false;
1339
+	}
1314 1340
 
1315 1341
 	/**
1316 1342
 	 * Filters the list of terms to display.
@@ -1377,12 +1403,14 @@  discard block
 block discarded – undo
1377 1403
 function has_term( $term = '', $taxonomy = '', $post = null ) {
1378 1404
 	$post = get_post($post);
1379 1405
 
1380
-	if ( !$post )
1381
-		return false;
1406
+	if ( !$post ) {
1407
+			return false;
1408
+	}
1382 1409
 
1383 1410
 	$r = is_object_in_term( $post->ID, $taxonomy, $term );
1384
-	if ( is_wp_error( $r ) )
1385
-		return false;
1411
+	if ( is_wp_error( $r ) ) {
1412
+			return false;
1413
+	}
1386 1414
 
1387 1415
 	return $r;
1388 1416
 }
Please login to merge, or discard this patch.
src/wp-includes/class-wp-customize-manager.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -400,8 +400,8 @@  discard block
 block discarded – undo
400 400
 	 *
401 401
 	 * @since 3.4.0
402 402
 	 *
403
-	 * @param mixed $ajax_message Ajax return
404
-	 * @param mixed $message UI message
403
+	 * @param integer $ajax_message Ajax return
404
+	 * @param string $message UI message
405 405
 	 */
406 406
 	protected function wp_die( $ajax_message, $message = null ) {
407 407
 		if ( $this->doing_ajax() ) {
@@ -444,7 +444,7 @@  discard block
 block discarded – undo
444 444
 	 * @since 3.4.0
445 445
 	 * @deprecated 4.7.0
446 446
 	 *
447
-	 * @return callable Die handler.
447
+	 * @return string Die handler.
448 448
 	 */
449 449
 	public function wp_die_handler() {
450 450
 		_deprecated_function( __METHOD__, '4.7.0' );
@@ -4275,7 +4275,7 @@  discard block
 block discarded – undo
4275 4275
 	 *
4276 4276
 	 * @param WP_Error $validity
4277 4277
 	 * @param mixed $value
4278
-	 * @return mixed
4278
+	 * @return WP_Error
4279 4279
 	 */
4280 4280
 	public function _validate_header_video( $validity, $value ) {
4281 4281
 		$video = get_attached_file( absint( $value ) );
@@ -4307,7 +4307,7 @@  discard block
 block discarded – undo
4307 4307
 	 *
4308 4308
 	 * @param WP_Error $validity
4309 4309
 	 * @param mixed $value
4310
-	 * @return mixed
4310
+	 * @return WP_Error
4311 4311
 	 */
4312 4312
 	public function _validate_external_header_video( $validity, $value ) {
4313 4313
 		$video = esc_url_raw( $value );
Please login to merge, or discard this patch.
Spacing   +1132 added lines, -1132 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * @access protected
110 110
 	 * @var array
111 111
 	 */
112
-	protected $components = array( 'widgets', 'nav_menus' );
112
+	protected $components = array('widgets', 'nav_menus');
113 113
 
114 114
 	/**
115 115
 	 * Registered instances of WP_Customize_Section.
@@ -240,72 +240,72 @@  discard block
 block discarded – undo
240 240
 	 *     @type string $messenger_channel Messenger channel. Defaults to customize_messenger_channel query param.
241 241
 	 * }
242 242
 	 */
243
-	public function __construct( $args = array() ) {
243
+	public function __construct($args = array()) {
244 244
 
245 245
 		$args = array_merge(
246
-			array_fill_keys( array( 'changeset_uuid', 'theme', 'messenger_channel' ), null ),
246
+			array_fill_keys(array('changeset_uuid', 'theme', 'messenger_channel'), null),
247 247
 			$args
248 248
 		);
249 249
 
250 250
 		// Note that the UUID format will be validated in the setup_theme() method.
251
-		if ( ! isset( $args['changeset_uuid'] ) ) {
251
+		if ( ! isset($args['changeset_uuid'])) {
252 252
 			$args['changeset_uuid'] = wp_generate_uuid4();
253 253
 		}
254 254
 
255 255
 		// The theme and messenger_channel should be supplied via $args, but they are also looked at in the $_REQUEST global here for back-compat.
256
-		if ( ! isset( $args['theme'] ) ) {
257
-			if ( isset( $_REQUEST['customize_theme'] ) ) {
258
-				$args['theme'] = wp_unslash( $_REQUEST['customize_theme'] );
259
-			} elseif ( isset( $_REQUEST['theme'] ) ) { // Deprecated.
260
-				$args['theme'] = wp_unslash( $_REQUEST['theme'] );
256
+		if ( ! isset($args['theme'])) {
257
+			if (isset($_REQUEST['customize_theme'])) {
258
+				$args['theme'] = wp_unslash($_REQUEST['customize_theme']);
259
+			} elseif (isset($_REQUEST['theme'])) { // Deprecated.
260
+				$args['theme'] = wp_unslash($_REQUEST['theme']);
261 261
 			}
262 262
 		}
263
-		if ( ! isset( $args['messenger_channel'] ) && isset( $_REQUEST['customize_messenger_channel'] ) ) {
264
-			$args['messenger_channel'] = sanitize_key( wp_unslash( $_REQUEST['customize_messenger_channel'] ) );
263
+		if ( ! isset($args['messenger_channel']) && isset($_REQUEST['customize_messenger_channel'])) {
264
+			$args['messenger_channel'] = sanitize_key(wp_unslash($_REQUEST['customize_messenger_channel']));
265 265
 		}
266 266
 
267 267
 		$this->original_stylesheet = get_stylesheet();
268
-		$this->theme = wp_get_theme( $args['theme'] );
268
+		$this->theme = wp_get_theme($args['theme']);
269 269
 		$this->messenger_channel = $args['messenger_channel'];
270 270
 		$this->_changeset_uuid = $args['changeset_uuid'];
271 271
 
272
-		require_once( ABSPATH . WPINC . '/class-wp-customize-setting.php' );
273
-		require_once( ABSPATH . WPINC . '/class-wp-customize-panel.php' );
274
-		require_once( ABSPATH . WPINC . '/class-wp-customize-section.php' );
275
-		require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' );
276
-
277
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' );
278
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' );
279
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' );
280
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' );
281
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' );
282
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php' );
283
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' );
284
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' );
285
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' );
286
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' );
287
-		require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' );
288
-		require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' );
289
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' );
290
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' );
291
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' );
292
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' );
293
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' );
294
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' );
295
-
296
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menus-panel.php' );
297
-
298
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-themes-section.php' );
299
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-sidebar-section.php' );
300
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-section.php' );
301
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-section.php' );
302
-
303
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-custom-css-setting.php' );
304
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-filter-setting.php' );
305
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-setting.php' );
306
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-setting.php' );
307
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-setting.php' );
308
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-setting.php' );
272
+		require_once(ABSPATH.WPINC.'/class-wp-customize-setting.php');
273
+		require_once(ABSPATH.WPINC.'/class-wp-customize-panel.php');
274
+		require_once(ABSPATH.WPINC.'/class-wp-customize-section.php');
275
+		require_once(ABSPATH.WPINC.'/class-wp-customize-control.php');
276
+
277
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-color-control.php');
278
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-media-control.php');
279
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-upload-control.php');
280
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-image-control.php');
281
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-control.php');
282
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-position-control.php');
283
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-cropped-image-control.php');
284
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-site-icon-control.php');
285
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-control.php');
286
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-theme-control.php');
287
+		require_once(ABSPATH.WPINC.'/customize/class-wp-widget-area-customize-control.php');
288
+		require_once(ABSPATH.WPINC.'/customize/class-wp-widget-form-customize-control.php');
289
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-control.php');
290
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-control.php');
291
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-location-control.php');
292
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-name-control.php');
293
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-auto-add-control.php');
294
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-new-menu-control.php');
295
+
296
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menus-panel.php');
297
+
298
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-themes-section.php');
299
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-sidebar-section.php');
300
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-section.php');
301
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-new-menu-section.php');
302
+
303
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-custom-css-setting.php');
304
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-filter-setting.php');
305
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-setting.php');
306
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-setting.php');
307
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-setting.php');
308
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-setting.php');
309 309
 
310 310
 		/**
311 311
 		 * Filters the core Customizer components to load.
@@ -322,50 +322,50 @@  discard block
 block discarded – undo
322 322
 		 * @param array                $components List of core components to load.
323 323
 		 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
324 324
 		 */
325
-		$components = apply_filters( 'customize_loaded_components', $this->components, $this );
325
+		$components = apply_filters('customize_loaded_components', $this->components, $this);
326 326
 
327
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-selective-refresh.php' );
328
-		$this->selective_refresh = new WP_Customize_Selective_Refresh( $this );
327
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-selective-refresh.php');
328
+		$this->selective_refresh = new WP_Customize_Selective_Refresh($this);
329 329
 
330
-		if ( in_array( 'widgets', $components, true ) ) {
331
-			require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' );
332
-			$this->widgets = new WP_Customize_Widgets( $this );
330
+		if (in_array('widgets', $components, true)) {
331
+			require_once(ABSPATH.WPINC.'/class-wp-customize-widgets.php');
332
+			$this->widgets = new WP_Customize_Widgets($this);
333 333
 		}
334 334
 
335
-		if ( in_array( 'nav_menus', $components, true ) ) {
336
-			require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' );
337
-			$this->nav_menus = new WP_Customize_Nav_Menus( $this );
335
+		if (in_array('nav_menus', $components, true)) {
336
+			require_once(ABSPATH.WPINC.'/class-wp-customize-nav-menus.php');
337
+			$this->nav_menus = new WP_Customize_Nav_Menus($this);
338 338
 		}
339 339
 
340
-		add_action( 'setup_theme', array( $this, 'setup_theme' ) );
341
-		add_action( 'wp_loaded',   array( $this, 'wp_loaded' ) );
340
+		add_action('setup_theme', array($this, 'setup_theme'));
341
+		add_action('wp_loaded', array($this, 'wp_loaded'));
342 342
 
343 343
 		// Do not spawn cron (especially the alternate cron) while running the Customizer.
344
-		remove_action( 'init', 'wp_cron' );
344
+		remove_action('init', 'wp_cron');
345 345
 
346 346
 		// Do not run update checks when rendering the controls.
347
-		remove_action( 'admin_init', '_maybe_update_core' );
348
-		remove_action( 'admin_init', '_maybe_update_plugins' );
349
-		remove_action( 'admin_init', '_maybe_update_themes' );
347
+		remove_action('admin_init', '_maybe_update_core');
348
+		remove_action('admin_init', '_maybe_update_plugins');
349
+		remove_action('admin_init', '_maybe_update_themes');
350 350
 
351
-		add_action( 'wp_ajax_customize_save',           array( $this, 'save' ) );
352
-		add_action( 'wp_ajax_customize_refresh_nonces', array( $this, 'refresh_nonces' ) );
351
+		add_action('wp_ajax_customize_save', array($this, 'save'));
352
+		add_action('wp_ajax_customize_refresh_nonces', array($this, 'refresh_nonces'));
353 353
 
354
-		add_action( 'customize_register',                 array( $this, 'register_controls' ) );
355
-		add_action( 'customize_register',                 array( $this, 'register_dynamic_settings' ), 11 ); // allow code to create settings first
356
-		add_action( 'customize_controls_init',            array( $this, 'prepare_controls' ) );
357
-		add_action( 'customize_controls_enqueue_scripts', array( $this, 'enqueue_control_scripts' ) );
354
+		add_action('customize_register', array($this, 'register_controls'));
355
+		add_action('customize_register', array($this, 'register_dynamic_settings'), 11); // allow code to create settings first
356
+		add_action('customize_controls_init', array($this, 'prepare_controls'));
357
+		add_action('customize_controls_enqueue_scripts', array($this, 'enqueue_control_scripts'));
358 358
 
359 359
 		// Render Panel, Section, and Control templates.
360
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_panel_templates' ), 1 );
361
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_section_templates' ), 1 );
362
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'render_control_templates' ), 1 );
360
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_panel_templates'), 1);
361
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_section_templates'), 1);
362
+		add_action('customize_controls_print_footer_scripts', array($this, 'render_control_templates'), 1);
363 363
 
364 364
 		// Export header video settings with the partial response.
365
-		add_filter( 'customize_render_partials_response', array( $this, 'export_header_video_settings' ), 10, 3 );
365
+		add_filter('customize_render_partials_response', array($this, 'export_header_video_settings'), 10, 3);
366 366
 
367 367
 		// Export the settings to JS via the _wpCustomizeSettings variable.
368
-		add_action( 'customize_controls_print_footer_scripts', array( $this, 'customize_pane_settings' ), 1000 );
368
+		add_action('customize_controls_print_footer_scripts', array($this, 'customize_pane_settings'), 1000);
369 369
 	}
370 370
 
371 371
 	/**
@@ -378,19 +378,19 @@  discard block
 block discarded – undo
378 378
 	 * @param string|null $action Whether the supplied Ajax action is being run.
379 379
 	 * @return bool True if it's an Ajax request, false otherwise.
380 380
 	 */
381
-	public function doing_ajax( $action = null ) {
382
-		if ( ! wp_doing_ajax() ) {
381
+	public function doing_ajax($action = null) {
382
+		if ( ! wp_doing_ajax()) {
383 383
 			return false;
384 384
 		}
385 385
 
386
-		if ( ! $action ) {
386
+		if ( ! $action) {
387 387
 			return true;
388 388
 		} else {
389 389
 			/*
390 390
 			 * Note: we can't just use doing_action( "wp_ajax_{$action}" ) because we need
391 391
 			 * to check before admin-ajax.php gets to that point.
392 392
 			 */
393
-			return isset( $_REQUEST['action'] ) && wp_unslash( $_REQUEST['action'] ) === $action;
393
+			return isset($_REQUEST['action']) && wp_unslash($_REQUEST['action']) === $action;
394 394
 		}
395 395
 	}
396 396
 
@@ -403,19 +403,19 @@  discard block
 block discarded – undo
403 403
 	 * @param mixed $ajax_message Ajax return
404 404
 	 * @param mixed $message UI message
405 405
 	 */
406
-	protected function wp_die( $ajax_message, $message = null ) {
407
-		if ( $this->doing_ajax() ) {
408
-			wp_die( $ajax_message );
406
+	protected function wp_die($ajax_message, $message = null) {
407
+		if ($this->doing_ajax()) {
408
+			wp_die($ajax_message);
409 409
 		}
410 410
 
411
-		if ( ! $message ) {
412
-			$message = __( 'Cheatin&#8217; uh?' );
411
+		if ( ! $message) {
412
+			$message = __('Cheatin&#8217; uh?');
413 413
 		}
414 414
 
415
-		if ( $this->messenger_channel ) {
415
+		if ($this->messenger_channel) {
416 416
 			ob_start();
417 417
 			wp_enqueue_scripts();
418
-			wp_print_scripts( array( 'customize-base' ) );
418
+			wp_print_scripts(array('customize-base'));
419 419
 
420 420
 			$settings = array(
421 421
 				'messengerArgs' => array(
@@ -429,13 +429,13 @@  discard block
 block discarded – undo
429 429
 			( function( api, settings ) {
430 430
 				var preview = new api.Messenger( settings.messengerArgs );
431 431
 				preview.send( 'iframe-loading-error', settings.error );
432
-			} )( wp.customize, <?php echo wp_json_encode( $settings ) ?> );
432
+			} )( wp.customize, <?php echo wp_json_encode($settings) ?> );
433 433
 			</script>
434 434
 			<?php
435 435
 			$message .= ob_get_clean();
436 436
 		}
437 437
 
438
-		wp_die( $message );
438
+		wp_die($message);
439 439
 	}
440 440
 
441 441
 	/**
@@ -447,9 +447,9 @@  discard block
 block discarded – undo
447 447
 	 * @return callable Die handler.
448 448
 	 */
449 449
 	public function wp_die_handler() {
450
-		_deprecated_function( __METHOD__, '4.7.0' );
450
+		_deprecated_function(__METHOD__, '4.7.0');
451 451
 
452
-		if ( $this->doing_ajax() || isset( $_POST['customized'] ) ) {
452
+		if ($this->doing_ajax() || isset($_POST['customized'])) {
453 453
 			return '_ajax_wp_die_handler';
454 454
 		}
455 455
 
@@ -467,21 +467,21 @@  discard block
 block discarded – undo
467 467
 		global $pagenow;
468 468
 
469 469
 		// Check permissions for customize.php access since this method is called before customize.php can run any code,
470
-		if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) {
471
-			if ( ! is_user_logged_in() ) {
470
+		if ('customize.php' === $pagenow && ! current_user_can('customize')) {
471
+			if ( ! is_user_logged_in()) {
472 472
 				auth_redirect();
473 473
 			} else {
474 474
 				wp_die(
475
-					'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
476
-					'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
475
+					'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
476
+					'<p>'.__('Sorry, you are not allowed to customize this site.').'</p>',
477 477
 					403
478 478
 				);
479 479
 			}
480 480
 			return;
481 481
 		}
482 482
 
483
-		if ( ! preg_match( '/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $this->_changeset_uuid ) ) {
484
-			$this->wp_die( -1, __( 'Invalid changeset UUID' ) );
483
+		if ( ! preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/', $this->_changeset_uuid)) {
484
+			$this->wp_die( -1, __('Invalid changeset UUID') );
485 485
 		}
486 486
 
487 487
 		/*
@@ -489,37 +489,37 @@  discard block
 block discarded – undo
489 489
 		 * In this way, the UUID serves as a secret key. If the messenger channel is present,
490 490
 		 * then send unauthenticated code to prompt re-auth.
491 491
 		 */
492
-		if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) {
493
-			$this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) );
492
+		if ( ! current_user_can('customize') && ! $this->changeset_post_id()) {
493
+			$this->wp_die($this->messenger_channel ? 0 : -1, __('Non-existent changeset UUID.'));
494 494
 		}
495 495
 
496
-		if ( ! headers_sent() ) {
496
+		if ( ! headers_sent()) {
497 497
 			send_origin_headers();
498 498
 		}
499 499
 
500 500
 		// Hide the admin bar if we're embedded in the customizer iframe.
501
-		if ( $this->messenger_channel ) {
502
-			show_admin_bar( false );
501
+		if ($this->messenger_channel) {
502
+			show_admin_bar(false);
503 503
 		}
504 504
 
505
-		if ( $this->is_theme_active() ) {
505
+		if ($this->is_theme_active()) {
506 506
 			// Once the theme is loaded, we'll validate it.
507
-			add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
507
+			add_action('after_setup_theme', array($this, 'after_setup_theme'));
508 508
 		} else {
509 509
 			// If the requested theme is not the active theme and the user doesn't have the
510 510
 			// switch_themes cap, bail.
511
-			if ( ! current_user_can( 'switch_themes' ) ) {
512
-				$this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) );
511
+			if ( ! current_user_can('switch_themes')) {
512
+				$this->wp_die( -1, __('Sorry, you are not allowed to edit theme options on this site.') );
513 513
 			}
514 514
 
515 515
 			// If the theme has errors while loading, bail.
516
-			if ( $this->theme()->errors() ) {
516
+			if ($this->theme()->errors()) {
517 517
 				$this->wp_die( -1, $this->theme()->errors()->get_error_message() );
518 518
 			}
519 519
 
520 520
 			// If the theme isn't allowed per multisite settings, bail.
521
-			if ( ! $this->theme()->is_allowed() ) {
522
-				$this->wp_die( -1, __( 'The requested theme does not exist.' ) );
521
+			if ( ! $this->theme()->is_allowed()) {
522
+				$this->wp_die( -1, __('The requested theme does not exist.') );
523 523
 			}
524 524
 		}
525 525
 
@@ -528,8 +528,8 @@  discard block
 block discarded – undo
528 528
 		 * Import starter content at after_setup_theme:100 so that any
529 529
 		 * add_theme_support( 'starter-content' ) calls will have been made.
530 530
 		 */
531
-		if ( get_option( 'fresh_site' ) && 'customize.php' === $pagenow ) {
532
-			add_action( 'after_setup_theme', array( $this, 'import_theme_starter_content' ), 100 );
531
+		if (get_option('fresh_site') && 'customize.php' === $pagenow) {
532
+			add_action('after_setup_theme', array($this, 'import_theme_starter_content'), 100);
533 533
 		}
534 534
 
535 535
 		$this->start_previewing_theme();
@@ -541,9 +541,9 @@  discard block
 block discarded – undo
541 541
 	 * @since 3.4.0
542 542
 	 */
543 543
 	public function after_setup_theme() {
544
-		$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
545
-		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
546
-			wp_redirect( 'themes.php?broken=true' );
544
+		$doing_ajax_or_is_customized = ($this->doing_ajax() || isset($_POST['customized']));
545
+		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme()) {
546
+			wp_redirect('themes.php?broken=true');
547 547
 			exit;
548 548
 		}
549 549
 	}
@@ -556,24 +556,24 @@  discard block
 block discarded – undo
556 556
 	 */
557 557
 	public function start_previewing_theme() {
558 558
 		// Bail if we're already previewing.
559
-		if ( $this->is_preview() ) {
559
+		if ($this->is_preview()) {
560 560
 			return;
561 561
 		}
562 562
 
563 563
 		$this->previewing = true;
564 564
 
565
-		if ( ! $this->is_theme_active() ) {
566
-			add_filter( 'template', array( $this, 'get_template' ) );
567
-			add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
568
-			add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
565
+		if ( ! $this->is_theme_active()) {
566
+			add_filter('template', array($this, 'get_template'));
567
+			add_filter('stylesheet', array($this, 'get_stylesheet'));
568
+			add_filter('pre_option_current_theme', array($this, 'current_theme'));
569 569
 
570 570
 			// @link: https://core.trac.wordpress.org/ticket/20027
571
-			add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
572
-			add_filter( 'pre_option_template', array( $this, 'get_template' ) );
571
+			add_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
572
+			add_filter('pre_option_template', array($this, 'get_template'));
573 573
 
574 574
 			// Handle custom theme roots.
575
-			add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
576
-			add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
575
+			add_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
576
+			add_filter('pre_option_template_root', array($this, 'get_template_root'));
577 577
 		}
578 578
 
579 579
 		/**
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
 		 *
584 584
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
585 585
 		 */
586
-		do_action( 'start_previewing_theme', $this );
586
+		do_action('start_previewing_theme', $this);
587 587
 	}
588 588
 
589 589
 	/**
@@ -594,24 +594,24 @@  discard block
 block discarded – undo
594 594
 	 * @since 3.4.0
595 595
 	 */
596 596
 	public function stop_previewing_theme() {
597
-		if ( ! $this->is_preview() ) {
597
+		if ( ! $this->is_preview()) {
598 598
 			return;
599 599
 		}
600 600
 
601 601
 		$this->previewing = false;
602 602
 
603
-		if ( ! $this->is_theme_active() ) {
604
-			remove_filter( 'template', array( $this, 'get_template' ) );
605
-			remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
606
-			remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
603
+		if ( ! $this->is_theme_active()) {
604
+			remove_filter('template', array($this, 'get_template'));
605
+			remove_filter('stylesheet', array($this, 'get_stylesheet'));
606
+			remove_filter('pre_option_current_theme', array($this, 'current_theme'));
607 607
 
608 608
 			// @link: https://core.trac.wordpress.org/ticket/20027
609
-			remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
610
-			remove_filter( 'pre_option_template', array( $this, 'get_template' ) );
609
+			remove_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
610
+			remove_filter('pre_option_template', array($this, 'get_template'));
611 611
 
612 612
 			// Handle custom theme roots.
613
-			remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
614
-			remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
613
+			remove_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
614
+			remove_filter('pre_option_template_root', array($this, 'get_template_root'));
615 615
 		}
616 616
 
617 617
 		/**
@@ -621,7 +621,7 @@  discard block
 block discarded – undo
621 621
 		 *
622 622
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
623 623
 		 */
624
-		do_action( 'stop_previewing_theme', $this );
624
+		do_action('stop_previewing_theme', $this);
625 625
 	}
626 626
 
627 627
 	/**
@@ -644,7 +644,7 @@  discard block
 block discarded – undo
644 644
 	 * @return WP_Theme
645 645
 	 */
646 646
 	public function theme() {
647
-		if ( ! $this->theme ) {
647
+		if ( ! $this->theme) {
648 648
 			$this->theme = wp_get_theme();
649 649
 		}
650 650
 		return $this->theme;
@@ -731,7 +731,7 @@  discard block
 block discarded – undo
731 731
 		 *
732 732
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
733 733
 		 */
734
-		do_action( 'customize_register', $this );
734
+		do_action('customize_register', $this);
735 735
 
736 736
 		/*
737 737
 		 * Note that settings must be previewed here even outside the customizer preview
@@ -741,13 +741,13 @@  discard block
 block discarded – undo
741 741
 		 * may short-circuit because it will detect that there are no changes to
742 742
 		 * make.
743 743
 		 */
744
-		if ( ! $this->doing_ajax( 'customize_save' ) ) {
745
-			foreach ( $this->settings as $setting ) {
744
+		if ( ! $this->doing_ajax('customize_save')) {
745
+			foreach ($this->settings as $setting) {
746 746
 				$setting->preview();
747 747
 			}
748 748
 		}
749 749
 
750
-		if ( $this->is_preview() && ! is_admin() ) {
750
+		if ($this->is_preview() && ! is_admin()) {
751 751
 			$this->customize_preview_init();
752 752
 		}
753 753
 	}
@@ -764,10 +764,10 @@  discard block
 block discarded – undo
764 764
 	 * @param int $status Status.
765 765
 	 * @return int
766 766
 	 */
767
-	public function wp_redirect_status( $status ) {
768
-		_deprecated_function( __FUNCTION__, '4.7.0' );
767
+	public function wp_redirect_status($status) {
768
+		_deprecated_function(__FUNCTION__, '4.7.0');
769 769
 
770
-		if ( $this->is_preview() && ! is_admin() ) {
770
+		if ($this->is_preview() && ! is_admin()) {
771 771
 			return 200;
772 772
 		}
773 773
 
@@ -783,14 +783,14 @@  discard block
 block discarded – undo
783 783
 	 * @param string $uuid Changeset UUID.
784 784
 	 * @return int|null Returns post ID on success and null on failure.
785 785
 	 */
786
-	public function find_changeset_post_id( $uuid ) {
786
+	public function find_changeset_post_id($uuid) {
787 787
 		$cache_group = 'customize_changeset_post';
788
-		$changeset_post_id = wp_cache_get( $uuid, $cache_group );
789
-		if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) {
788
+		$changeset_post_id = wp_cache_get($uuid, $cache_group);
789
+		if ($changeset_post_id && 'customize_changeset' === get_post_type($changeset_post_id)) {
790 790
 			return $changeset_post_id;
791 791
 		}
792 792
 
793
-		$changeset_post_query = new WP_Query( array(
793
+		$changeset_post_query = new WP_Query(array(
794 794
 			'post_type' => 'customize_changeset',
795 795
 			'post_status' => get_post_stati(),
796 796
 			'name' => $uuid,
@@ -800,11 +800,11 @@  discard block
 block discarded – undo
800 800
 			'update_post_meta_cache' => false,
801 801
 			'update_post_term_cache' => false,
802 802
 			'lazy_load_term_meta' => false,
803
-		) );
804
-		if ( ! empty( $changeset_post_query->posts ) ) {
803
+		));
804
+		if ( ! empty($changeset_post_query->posts)) {
805 805
 			// Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed.
806 806
 			$changeset_post_id = $changeset_post_query->posts[0]->ID;
807
-			wp_cache_set( $this->_changeset_uuid, $changeset_post_id, $cache_group );
807
+			wp_cache_set($this->_changeset_uuid, $changeset_post_id, $cache_group);
808 808
 			return $changeset_post_id;
809 809
 		}
810 810
 
@@ -820,14 +820,14 @@  discard block
 block discarded – undo
820 820
 	 * @return int|null Post ID on success or null if there is no post yet saved.
821 821
 	 */
822 822
 	public function changeset_post_id() {
823
-		if ( ! isset( $this->_changeset_post_id ) ) {
824
-			$post_id = $this->find_changeset_post_id( $this->_changeset_uuid );
825
-			if ( ! $post_id ) {
823
+		if ( ! isset($this->_changeset_post_id)) {
824
+			$post_id = $this->find_changeset_post_id($this->_changeset_uuid);
825
+			if ( ! $post_id) {
826 826
 				$post_id = false;
827 827
 			}
828 828
 			$this->_changeset_post_id = $post_id;
829 829
 		}
830
-		if ( false === $this->_changeset_post_id ) {
830
+		if (false === $this->_changeset_post_id) {
831 831
 			return null;
832 832
 		}
833 833
 		return $this->_changeset_post_id;
@@ -842,23 +842,23 @@  discard block
 block discarded – undo
842 842
 	 * @param int $post_id Changeset post ID.
843 843
 	 * @return array|WP_Error Changeset data or WP_Error on error.
844 844
 	 */
845
-	protected function get_changeset_post_data( $post_id ) {
846
-		if ( ! $post_id ) {
847
-			return new WP_Error( 'empty_post_id' );
845
+	protected function get_changeset_post_data($post_id) {
846
+		if ( ! $post_id) {
847
+			return new WP_Error('empty_post_id');
848 848
 		}
849
-		$changeset_post = get_post( $post_id );
850
-		if ( ! $changeset_post ) {
851
-			return new WP_Error( 'missing_post' );
849
+		$changeset_post = get_post($post_id);
850
+		if ( ! $changeset_post) {
851
+			return new WP_Error('missing_post');
852 852
 		}
853
-		if ( 'customize_changeset' !== $changeset_post->post_type ) {
854
-			return new WP_Error( 'wrong_post_type' );
853
+		if ('customize_changeset' !== $changeset_post->post_type) {
854
+			return new WP_Error('wrong_post_type');
855 855
 		}
856
-		$changeset_data = json_decode( $changeset_post->post_content, true );
857
-		if ( function_exists( 'json_last_error' ) && json_last_error() ) {
858
-			return new WP_Error( 'json_parse_error', '', json_last_error() );
856
+		$changeset_data = json_decode($changeset_post->post_content, true);
857
+		if (function_exists('json_last_error') && json_last_error()) {
858
+			return new WP_Error('json_parse_error', '', json_last_error());
859 859
 		}
860
-		if ( ! is_array( $changeset_data ) ) {
861
-			return new WP_Error( 'expected_array' );
860
+		if ( ! is_array($changeset_data)) {
861
+			return new WP_Error('expected_array');
862 862
 		}
863 863
 		return $changeset_data;
864 864
 	}
@@ -872,15 +872,15 @@  discard block
 block discarded – undo
872 872
 	 * @return array Changeset data.
873 873
 	 */
874 874
 	public function changeset_data() {
875
-		if ( isset( $this->_changeset_data ) ) {
875
+		if (isset($this->_changeset_data)) {
876 876
 			return $this->_changeset_data;
877 877
 		}
878 878
 		$changeset_post_id = $this->changeset_post_id();
879
-		if ( ! $changeset_post_id ) {
879
+		if ( ! $changeset_post_id) {
880 880
 			$this->_changeset_data = array();
881 881
 		} else {
882
-			$data = $this->get_changeset_post_data( $changeset_post_id );
883
-			if ( ! is_wp_error( $data ) ) {
882
+			$data = $this->get_changeset_post_data($changeset_post_id);
883
+			if ( ! is_wp_error($data)) {
884 884
 				$this->_changeset_data = $data;
885 885
 			} else {
886 886
 				$this->_changeset_data = array();
@@ -906,173 +906,173 @@  discard block
 block discarded – undo
906 906
 	 *
907 907
 	 * @param array $starter_content Starter content. Defaults to `get_theme_starter_content()`.
908 908
 	 */
909
-	function import_theme_starter_content( $starter_content = array() ) {
910
-		if ( empty( $starter_content ) ) {
909
+	function import_theme_starter_content($starter_content = array()) {
910
+		if (empty($starter_content)) {
911 911
 			$starter_content = get_theme_starter_content();
912 912
 		}
913 913
 
914 914
 		$changeset_data = array();
915
-		if ( $this->changeset_post_id() ) {
916
-			$changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() );
915
+		if ($this->changeset_post_id()) {
916
+			$changeset_data = $this->get_changeset_post_data($this->changeset_post_id());
917 917
 		}
918 918
 
919
-		$sidebars_widgets = isset( $starter_content['widgets'] ) && ! empty( $this->widgets ) ? $starter_content['widgets'] : array();
920
-		$attachments = isset( $starter_content['attachments'] ) && ! empty( $this->nav_menus ) ? $starter_content['attachments'] : array();
921
-		$posts = isset( $starter_content['posts'] ) && ! empty( $this->nav_menus ) ? $starter_content['posts'] : array();
922
-		$options = isset( $starter_content['options'] ) ? $starter_content['options'] : array();
923
-		$nav_menus = isset( $starter_content['nav_menus'] ) && ! empty( $this->nav_menus ) ? $starter_content['nav_menus'] : array();
924
-		$theme_mods = isset( $starter_content['theme_mods'] ) ? $starter_content['theme_mods'] : array();
919
+		$sidebars_widgets = isset($starter_content['widgets']) && ! empty($this->widgets) ? $starter_content['widgets'] : array();
920
+		$attachments = isset($starter_content['attachments']) && ! empty($this->nav_menus) ? $starter_content['attachments'] : array();
921
+		$posts = isset($starter_content['posts']) && ! empty($this->nav_menus) ? $starter_content['posts'] : array();
922
+		$options = isset($starter_content['options']) ? $starter_content['options'] : array();
923
+		$nav_menus = isset($starter_content['nav_menus']) && ! empty($this->nav_menus) ? $starter_content['nav_menus'] : array();
924
+		$theme_mods = isset($starter_content['theme_mods']) ? $starter_content['theme_mods'] : array();
925 925
 
926 926
 		// Widgets.
927 927
 		$max_widget_numbers = array();
928
-		foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
928
+		foreach ($sidebars_widgets as $sidebar_id => $widgets) {
929 929
 			$sidebar_widget_ids = array();
930
-			foreach ( $widgets as $widget ) {
931
-				list( $id_base, $instance ) = $widget;
930
+			foreach ($widgets as $widget) {
931
+				list($id_base, $instance) = $widget;
932 932
 
933
-				if ( ! isset( $max_widget_numbers[ $id_base ] ) ) {
933
+				if ( ! isset($max_widget_numbers[$id_base])) {
934 934
 
935 935
 					// When $settings is an array-like object, get an intrinsic array for use with array_keys().
936
-					$settings = get_option( "widget_{$id_base}", array() );
937
-					if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) {
936
+					$settings = get_option("widget_{$id_base}", array());
937
+					if ($settings instanceof ArrayObject || $settings instanceof ArrayIterator) {
938 938
 						$settings = $settings->getArrayCopy();
939 939
 					}
940 940
 
941 941
 					// Find the max widget number for this type.
942
-					$widget_numbers = array_keys( $settings );
943
-					if ( count( $widget_numbers ) > 0 ) {
942
+					$widget_numbers = array_keys($settings);
943
+					if (count($widget_numbers) > 0) {
944 944
 						$widget_numbers[] = 1;
945
-						$max_widget_numbers[ $id_base ] = call_user_func_array( 'max', $widget_numbers );
945
+						$max_widget_numbers[$id_base] = call_user_func_array('max', $widget_numbers);
946 946
 					} else {
947
-						$max_widget_numbers[ $id_base ] = 1;
947
+						$max_widget_numbers[$id_base] = 1;
948 948
 					}
949 949
 				}
950
-				$max_widget_numbers[ $id_base ] += 1;
950
+				$max_widget_numbers[$id_base] += 1;
951 951
 
952
-				$widget_id = sprintf( '%s-%d', $id_base, $max_widget_numbers[ $id_base ] );
953
-				$setting_id = sprintf( 'widget_%s[%d]', $id_base, $max_widget_numbers[ $id_base ] );
952
+				$widget_id = sprintf('%s-%d', $id_base, $max_widget_numbers[$id_base]);
953
+				$setting_id = sprintf('widget_%s[%d]', $id_base, $max_widget_numbers[$id_base]);
954 954
 
955
-				$setting_value = $this->widgets->sanitize_widget_js_instance( $instance );
956
-				if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
957
-					$this->set_post_value( $setting_id, $setting_value );
955
+				$setting_value = $this->widgets->sanitize_widget_js_instance($instance);
956
+				if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
957
+					$this->set_post_value($setting_id, $setting_value);
958 958
 					$this->pending_starter_content_settings_ids[] = $setting_id;
959 959
 				}
960 960
 				$sidebar_widget_ids[] = $widget_id;
961 961
 			}
962 962
 
963
-			$setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id );
964
-			if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
965
-				$this->set_post_value( $setting_id, $sidebar_widget_ids );
963
+			$setting_id = sprintf('sidebars_widgets[%s]', $sidebar_id);
964
+			if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
965
+				$this->set_post_value($setting_id, $sidebar_widget_ids);
966 966
 				$this->pending_starter_content_settings_ids[] = $setting_id;
967 967
 			}
968 968
 		}
969 969
 
970 970
 		$starter_content_auto_draft_post_ids = array();
971
-		if ( ! empty( $changeset_data['nav_menus_created_posts']['value'] ) ) {
972
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value'] );
971
+		if ( ! empty($changeset_data['nav_menus_created_posts']['value'])) {
972
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value']);
973 973
 		}
974 974
 
975 975
 		// Make an index of all the posts needed and what their slugs are.
976 976
 		$needed_posts = array();
977
-		$attachments = $this->prepare_starter_content_attachments( $attachments );
978
-		foreach ( $attachments as $attachment ) {
979
-			$key = 'attachment:' . $attachment['post_name'];
980
-			$needed_posts[ $key ] = true;
981
-		}
982
-		foreach ( array_keys( $posts ) as $post_symbol ) {
983
-			if ( empty( $posts[ $post_symbol ]['post_name'] ) && empty( $posts[ $post_symbol ]['post_title'] ) ) {
984
-				unset( $posts[ $post_symbol ] );
977
+		$attachments = $this->prepare_starter_content_attachments($attachments);
978
+		foreach ($attachments as $attachment) {
979
+			$key = 'attachment:'.$attachment['post_name'];
980
+			$needed_posts[$key] = true;
981
+		}
982
+		foreach (array_keys($posts) as $post_symbol) {
983
+			if (empty($posts[$post_symbol]['post_name']) && empty($posts[$post_symbol]['post_title'])) {
984
+				unset($posts[$post_symbol]);
985 985
 				continue;
986 986
 			}
987
-			if ( empty( $posts[ $post_symbol ]['post_name'] ) ) {
988
-				$posts[ $post_symbol ]['post_name'] = sanitize_title( $posts[ $post_symbol ]['post_title'] );
987
+			if (empty($posts[$post_symbol]['post_name'])) {
988
+				$posts[$post_symbol]['post_name'] = sanitize_title($posts[$post_symbol]['post_title']);
989 989
 			}
990
-			if ( empty( $posts[ $post_symbol ]['post_type'] ) ) {
991
-				$posts[ $post_symbol ]['post_type'] = 'post';
990
+			if (empty($posts[$post_symbol]['post_type'])) {
991
+				$posts[$post_symbol]['post_type'] = 'post';
992 992
 			}
993
-			$needed_posts[ $posts[ $post_symbol ]['post_type'] . ':' . $posts[ $post_symbol ]['post_name'] ] = true;
993
+			$needed_posts[$posts[$post_symbol]['post_type'].':'.$posts[$post_symbol]['post_name']] = true;
994 994
 		}
995 995
 		$all_post_slugs = array_merge(
996
-			wp_list_pluck( $attachments, 'post_name' ),
997
-			wp_list_pluck( $posts, 'post_name' )
996
+			wp_list_pluck($attachments, 'post_name'),
997
+			wp_list_pluck($posts, 'post_name')
998 998
 		);
999 999
 
1000 1000
 		// Re-use auto-draft starter content posts referenced in the current customized state.
1001 1001
 		$existing_starter_content_posts = array();
1002
-		if ( ! empty( $starter_content_auto_draft_post_ids ) ) {
1003
-			$existing_posts_query = new WP_Query( array(
1002
+		if ( ! empty($starter_content_auto_draft_post_ids)) {
1003
+			$existing_posts_query = new WP_Query(array(
1004 1004
 				'post__in' => $starter_content_auto_draft_post_ids,
1005 1005
 				'post_status' => 'auto-draft',
1006 1006
 				'post_type' => 'any',
1007 1007
 				'posts_per_page' => -1,
1008
-			) );
1009
-			foreach ( $existing_posts_query->posts as $existing_post ) {
1008
+			));
1009
+			foreach ($existing_posts_query->posts as $existing_post) {
1010 1010
 				$post_name = $existing_post->post_name;
1011
-				if ( empty( $post_name ) ) {
1012
-					$post_name = get_post_meta( $existing_post->ID, '_customize_draft_post_name', true );
1011
+				if (empty($post_name)) {
1012
+					$post_name = get_post_meta($existing_post->ID, '_customize_draft_post_name', true);
1013 1013
 				}
1014
-				$existing_starter_content_posts[ $existing_post->post_type . ':' . $post_name ] = $existing_post;
1014
+				$existing_starter_content_posts[$existing_post->post_type.':'.$post_name] = $existing_post;
1015 1015
 			}
1016 1016
 		}
1017 1017
 
1018 1018
 		// Re-use non-auto-draft posts.
1019
-		if ( ! empty( $all_post_slugs ) ) {
1020
-			$existing_posts_query = new WP_Query( array(
1019
+		if ( ! empty($all_post_slugs)) {
1020
+			$existing_posts_query = new WP_Query(array(
1021 1021
 				'post_name__in' => $all_post_slugs,
1022
-				'post_status' => array_diff( get_post_stati(), array( 'auto-draft' ) ),
1022
+				'post_status' => array_diff(get_post_stati(), array('auto-draft')),
1023 1023
 				'post_type' => 'any',
1024 1024
 				'posts_per_page' => -1,
1025
-			) );
1026
-			foreach ( $existing_posts_query->posts as $existing_post ) {
1027
-				$key = $existing_post->post_type . ':' . $existing_post->post_name;
1028
-				if ( isset( $needed_posts[ $key ] ) && ! isset( $existing_starter_content_posts[ $key ] ) ) {
1029
-					$existing_starter_content_posts[ $key ] = $existing_post;
1025
+			));
1026
+			foreach ($existing_posts_query->posts as $existing_post) {
1027
+				$key = $existing_post->post_type.':'.$existing_post->post_name;
1028
+				if (isset($needed_posts[$key]) && ! isset($existing_starter_content_posts[$key])) {
1029
+					$existing_starter_content_posts[$key] = $existing_post;
1030 1030
 				}
1031 1031
 			}
1032 1032
 		}
1033 1033
 
1034 1034
 		// Attachments are technically posts but handled differently.
1035
-		if ( ! empty( $attachments ) ) {
1035
+		if ( ! empty($attachments)) {
1036 1036
 
1037 1037
 			$attachment_ids = array();
1038 1038
 
1039
-			foreach ( $attachments as $symbol => $attachment ) {
1039
+			foreach ($attachments as $symbol => $attachment) {
1040 1040
 				$file_array = array(
1041 1041
 					'name' => $attachment['file_name'],
1042 1042
 				);
1043 1043
 				$file_path = $attachment['file_path'];
1044 1044
 				$attachment_id = null;
1045 1045
 				$attached_file = null;
1046
-				if ( isset( $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ] ) ) {
1047
-					$attachment_post = $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ];
1046
+				if (isset($existing_starter_content_posts['attachment:'.$attachment['post_name']])) {
1047
+					$attachment_post = $existing_starter_content_posts['attachment:'.$attachment['post_name']];
1048 1048
 					$attachment_id = $attachment_post->ID;
1049
-					$attached_file = get_attached_file( $attachment_id );
1050
-					if ( empty( $attached_file ) || ! file_exists( $attached_file ) ) {
1049
+					$attached_file = get_attached_file($attachment_id);
1050
+					if (empty($attached_file) || ! file_exists($attached_file)) {
1051 1051
 						$attachment_id = null;
1052 1052
 						$attached_file = null;
1053
-					} elseif ( $this->get_stylesheet() !== get_post_meta( $attachment_post->ID, '_starter_content_theme', true ) ) {
1053
+					} elseif ($this->get_stylesheet() !== get_post_meta($attachment_post->ID, '_starter_content_theme', true)) {
1054 1054
 
1055 1055
 						// Re-generate attachment metadata since it was previously generated for a different theme.
1056
-						$metadata = wp_generate_attachment_metadata( $attachment_post->ID, $attached_file );
1057
-						wp_update_attachment_metadata( $attachment_id, $metadata );
1058
-						update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() );
1056
+						$metadata = wp_generate_attachment_metadata($attachment_post->ID, $attached_file);
1057
+						wp_update_attachment_metadata($attachment_id, $metadata);
1058
+						update_post_meta($attachment_id, '_starter_content_theme', $this->get_stylesheet());
1059 1059
 					}
1060 1060
 				}
1061 1061
 
1062 1062
 				// Insert the attachment auto-draft because it doesn't yet exist or the attached file is gone.
1063
-				if ( ! $attachment_id ) {
1063
+				if ( ! $attachment_id) {
1064 1064
 
1065 1065
 					// Copy file to temp location so that original file won't get deleted from theme after sideloading.
1066
-					$temp_file_name = wp_tempnam( basename( $file_path ) );
1067
-					if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) {
1066
+					$temp_file_name = wp_tempnam(basename($file_path));
1067
+					if ($temp_file_name && copy($file_path, $temp_file_name)) {
1068 1068
 						$file_array['tmp_name'] = $temp_file_name;
1069 1069
 					}
1070
-					if ( empty( $file_array['tmp_name'] ) ) {
1070
+					if (empty($file_array['tmp_name'])) {
1071 1071
 						continue;
1072 1072
 					}
1073 1073
 
1074 1074
 					$attachment_post_data = array_merge(
1075
-						wp_array_slice_assoc( $attachment, array( 'post_title', 'post_content', 'post_excerpt' ) ),
1075
+						wp_array_slice_assoc($attachment, array('post_title', 'post_content', 'post_excerpt')),
1076 1076
 						array(
1077 1077
 							'post_status' => 'auto-draft', // So attachment will be garbage collected in a week if changeset is never published.
1078 1078
 						)
@@ -1081,124 +1081,124 @@  discard block
 block discarded – undo
1081 1081
 					// In PHP < 5.6 filesize() returns 0 for the temp files unless we clear the file status cache.
1082 1082
 					// Technically, PHP < 5.6.0 || < 5.5.13 || < 5.4.29 but no need to be so targeted.
1083 1083
 					// See https://bugs.php.net/bug.php?id=65701
1084
-					if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
1084
+					if (version_compare(PHP_VERSION, '5.6', '<')) {
1085 1085
 						clearstatcache();
1086 1086
 					}
1087 1087
 
1088
-					$attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data );
1089
-					if ( is_wp_error( $attachment_id ) ) {
1088
+					$attachment_id = media_handle_sideload($file_array, 0, null, $attachment_post_data);
1089
+					if (is_wp_error($attachment_id)) {
1090 1090
 						continue;
1091 1091
 					}
1092
-					update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() );
1093
-					update_post_meta( $attachment_id, '_customize_draft_post_name', $attachment['post_name'] );
1092
+					update_post_meta($attachment_id, '_starter_content_theme', $this->get_stylesheet());
1093
+					update_post_meta($attachment_id, '_customize_draft_post_name', $attachment['post_name']);
1094 1094
 				}
1095 1095
 
1096
-				$attachment_ids[ $symbol ] = $attachment_id;
1096
+				$attachment_ids[$symbol] = $attachment_id;
1097 1097
 			}
1098
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, array_values( $attachment_ids ) );
1098
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, array_values($attachment_ids));
1099 1099
 		}
1100 1100
 
1101 1101
 		// Posts & pages.
1102
-		if ( ! empty( $posts ) ) {
1103
-			foreach ( array_keys( $posts ) as $post_symbol ) {
1104
-				if ( empty( $posts[ $post_symbol ]['post_type'] ) || empty( $posts[ $post_symbol ]['post_name'] ) ) {
1102
+		if ( ! empty($posts)) {
1103
+			foreach (array_keys($posts) as $post_symbol) {
1104
+				if (empty($posts[$post_symbol]['post_type']) || empty($posts[$post_symbol]['post_name'])) {
1105 1105
 					continue;
1106 1106
 				}
1107
-				$post_type = $posts[ $post_symbol ]['post_type'];
1108
-				if ( ! empty( $posts[ $post_symbol ]['post_name'] ) ) {
1109
-					$post_name = $posts[ $post_symbol ]['post_name'];
1110
-				} elseif ( ! empty( $posts[ $post_symbol ]['post_title'] ) ) {
1111
-					$post_name = sanitize_title( $posts[ $post_symbol ]['post_title'] );
1107
+				$post_type = $posts[$post_symbol]['post_type'];
1108
+				if ( ! empty($posts[$post_symbol]['post_name'])) {
1109
+					$post_name = $posts[$post_symbol]['post_name'];
1110
+				} elseif ( ! empty($posts[$post_symbol]['post_title'])) {
1111
+					$post_name = sanitize_title($posts[$post_symbol]['post_title']);
1112 1112
 				} else {
1113 1113
 					continue;
1114 1114
 				}
1115 1115
 
1116 1116
 				// Use existing auto-draft post if one already exists with the same type and name.
1117
-				if ( isset( $existing_starter_content_posts[ $post_type . ':' . $post_name ] ) ) {
1118
-					$posts[ $post_symbol ]['ID'] = $existing_starter_content_posts[ $post_type . ':' . $post_name ]->ID;
1117
+				if (isset($existing_starter_content_posts[$post_type.':'.$post_name])) {
1118
+					$posts[$post_symbol]['ID'] = $existing_starter_content_posts[$post_type.':'.$post_name]->ID;
1119 1119
 					continue;
1120 1120
 				}
1121 1121
 
1122 1122
 				// Translate the featured image symbol.
1123
-				if ( ! empty( $posts[ $post_symbol ]['thumbnail'] )
1124
-					&& preg_match( '/^{{(?P<symbol>.+)}}$/', $posts[ $post_symbol ]['thumbnail'], $matches )
1125
-					&& isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1126
-					$posts[ $post_symbol ]['meta_input']['_thumbnail_id'] = $attachment_ids[ $matches['symbol'] ];
1123
+				if ( ! empty($posts[$post_symbol]['thumbnail'])
1124
+					&& preg_match('/^{{(?P<symbol>.+)}}$/', $posts[$post_symbol]['thumbnail'], $matches)
1125
+					&& isset($attachment_ids[$matches['symbol']])) {
1126
+					$posts[$post_symbol]['meta_input']['_thumbnail_id'] = $attachment_ids[$matches['symbol']];
1127 1127
 				}
1128 1128
 
1129
-				if ( ! empty( $posts[ $post_symbol ]['template'] ) ) {
1130
-					$posts[ $post_symbol ]['meta_input']['_wp_page_template'] = $posts[ $post_symbol ]['template'];
1129
+				if ( ! empty($posts[$post_symbol]['template'])) {
1130
+					$posts[$post_symbol]['meta_input']['_wp_page_template'] = $posts[$post_symbol]['template'];
1131 1131
 				}
1132 1132
 
1133
-				$r = $this->nav_menus->insert_auto_draft_post( $posts[ $post_symbol ] );
1134
-				if ( $r instanceof WP_Post ) {
1135
-					$posts[ $post_symbol ]['ID'] = $r->ID;
1133
+				$r = $this->nav_menus->insert_auto_draft_post($posts[$post_symbol]);
1134
+				if ($r instanceof WP_Post) {
1135
+					$posts[$post_symbol]['ID'] = $r->ID;
1136 1136
 				}
1137 1137
 			}
1138 1138
 
1139
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, wp_list_pluck( $posts, 'ID' ) );
1139
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, wp_list_pluck($posts, 'ID'));
1140 1140
 		}
1141 1141
 
1142 1142
 		// The nav_menus_created_posts setting is why nav_menus component is dependency for adding posts.
1143
-		if ( ! empty( $this->nav_menus ) && ! empty( $starter_content_auto_draft_post_ids ) ) {
1143
+		if ( ! empty($this->nav_menus) && ! empty($starter_content_auto_draft_post_ids)) {
1144 1144
 			$setting_id = 'nav_menus_created_posts';
1145
-			$this->set_post_value( $setting_id, array_unique( array_values( $starter_content_auto_draft_post_ids ) ) );
1145
+			$this->set_post_value($setting_id, array_unique(array_values($starter_content_auto_draft_post_ids)));
1146 1146
 			$this->pending_starter_content_settings_ids[] = $setting_id;
1147 1147
 		}
1148 1148
 
1149 1149
 		// Nav menus.
1150 1150
 		$placeholder_id = -1;
1151 1151
 		$reused_nav_menu_setting_ids = array();
1152
-		foreach ( $nav_menus as $nav_menu_location => $nav_menu ) {
1152
+		foreach ($nav_menus as $nav_menu_location => $nav_menu) {
1153 1153
 
1154 1154
 			$nav_menu_term_id = null;
1155 1155
 			$nav_menu_setting_id = null;
1156 1156
 			$matches = array();
1157 1157
 
1158 1158
 			// Look for an existing placeholder menu with starter content to re-use.
1159
-			foreach ( $changeset_data as $setting_id => $setting_params ) {
1159
+			foreach ($changeset_data as $setting_id => $setting_params) {
1160 1160
 				$can_reuse = (
1161
-					! empty( $setting_params['starter_content'] )
1161
+					! empty($setting_params['starter_content'])
1162 1162
 					&&
1163
-					! in_array( $setting_id, $reused_nav_menu_setting_ids, true )
1163
+					! in_array($setting_id, $reused_nav_menu_setting_ids, true)
1164 1164
 					&&
1165
-					preg_match( '#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches )
1165
+					preg_match('#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches)
1166 1166
 				);
1167
-				if ( $can_reuse ) {
1168
-					$nav_menu_term_id = intval( $matches['nav_menu_id'] );
1167
+				if ($can_reuse) {
1168
+					$nav_menu_term_id = intval($matches['nav_menu_id']);
1169 1169
 					$nav_menu_setting_id = $setting_id;
1170 1170
 					$reused_nav_menu_setting_ids[] = $setting_id;
1171 1171
 					break;
1172 1172
 				}
1173 1173
 			}
1174 1174
 
1175
-			if ( ! $nav_menu_term_id ) {
1176
-				while ( isset( $changeset_data[ sprintf( 'nav_menu[%d]', $placeholder_id ) ] ) ) {
1175
+			if ( ! $nav_menu_term_id) {
1176
+				while (isset($changeset_data[sprintf('nav_menu[%d]', $placeholder_id)])) {
1177 1177
 					$placeholder_id--;
1178 1178
 				}
1179 1179
 				$nav_menu_term_id = $placeholder_id;
1180
-				$nav_menu_setting_id = sprintf( 'nav_menu[%d]', $placeholder_id );
1180
+				$nav_menu_setting_id = sprintf('nav_menu[%d]', $placeholder_id);
1181 1181
 			}
1182 1182
 
1183
-			$this->set_post_value( $nav_menu_setting_id, array(
1184
-				'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location,
1185
-			) );
1183
+			$this->set_post_value($nav_menu_setting_id, array(
1184
+				'name' => isset($nav_menu['name']) ? $nav_menu['name'] : $nav_menu_location,
1185
+			));
1186 1186
 			$this->pending_starter_content_settings_ids[] = $nav_menu_setting_id;
1187 1187
 
1188 1188
 			// @todo Add support for menu_item_parent.
1189 1189
 			$position = 0;
1190
-			foreach ( $nav_menu['items'] as $nav_menu_item ) {
1191
-				$nav_menu_item_setting_id = sprintf( 'nav_menu_item[%d]', $placeholder_id-- );
1192
-				if ( ! isset( $nav_menu_item['position'] ) ) {
1190
+			foreach ($nav_menu['items'] as $nav_menu_item) {
1191
+				$nav_menu_item_setting_id = sprintf('nav_menu_item[%d]', $placeholder_id--);
1192
+				if ( ! isset($nav_menu_item['position'])) {
1193 1193
 					$nav_menu_item['position'] = $position++;
1194 1194
 				}
1195 1195
 				$nav_menu_item['nav_menu_term_id'] = $nav_menu_term_id;
1196 1196
 
1197
-				if ( isset( $nav_menu_item['object_id'] ) ) {
1198
-					if ( 'post_type' === $nav_menu_item['type'] && preg_match( '/^{{(?P<symbol>.+)}}$/', $nav_menu_item['object_id'], $matches ) && isset( $posts[ $matches['symbol'] ] ) ) {
1199
-						$nav_menu_item['object_id'] = $posts[ $matches['symbol'] ]['ID'];
1200
-						if ( empty( $nav_menu_item['title'] ) ) {
1201
-							$original_object = get_post( $nav_menu_item['object_id'] );
1197
+				if (isset($nav_menu_item['object_id'])) {
1198
+					if ('post_type' === $nav_menu_item['type'] && preg_match('/^{{(?P<symbol>.+)}}$/', $nav_menu_item['object_id'], $matches) && isset($posts[$matches['symbol']])) {
1199
+						$nav_menu_item['object_id'] = $posts[$matches['symbol']]['ID'];
1200
+						if (empty($nav_menu_item['title'])) {
1201
+							$original_object = get_post($nav_menu_item['object_id']);
1202 1202
 							$nav_menu_item['title'] = $original_object->post_title;
1203 1203
 						}
1204 1204
 					} else {
@@ -1208,77 +1208,77 @@  discard block
 block discarded – undo
1208 1208
 					$nav_menu_item['object_id'] = 0;
1209 1209
 				}
1210 1210
 
1211
-				if ( empty( $changeset_data[ $nav_menu_item_setting_id ] ) || ! empty( $changeset_data[ $nav_menu_item_setting_id ]['starter_content'] ) ) {
1212
-					$this->set_post_value( $nav_menu_item_setting_id, $nav_menu_item );
1211
+				if (empty($changeset_data[$nav_menu_item_setting_id]) || ! empty($changeset_data[$nav_menu_item_setting_id]['starter_content'])) {
1212
+					$this->set_post_value($nav_menu_item_setting_id, $nav_menu_item);
1213 1213
 					$this->pending_starter_content_settings_ids[] = $nav_menu_item_setting_id;
1214 1214
 				}
1215 1215
 			}
1216 1216
 
1217
-			$setting_id = sprintf( 'nav_menu_locations[%s]', $nav_menu_location );
1218
-			if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
1219
-				$this->set_post_value( $setting_id, $nav_menu_term_id );
1217
+			$setting_id = sprintf('nav_menu_locations[%s]', $nav_menu_location);
1218
+			if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
1219
+				$this->set_post_value($setting_id, $nav_menu_term_id);
1220 1220
 				$this->pending_starter_content_settings_ids[] = $setting_id;
1221 1221
 			}
1222 1222
 		}
1223 1223
 
1224 1224
 		// Options.
1225
-		foreach ( $options as $name => $value ) {
1226
-			if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) {
1227
-				if ( isset( $posts[ $matches['symbol'] ] ) ) {
1228
-					$value = $posts[ $matches['symbol'] ]['ID'];
1229
-				} elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1230
-					$value = $attachment_ids[ $matches['symbol'] ];
1225
+		foreach ($options as $name => $value) {
1226
+			if (preg_match('/^{{(?P<symbol>.+)}}$/', $value, $matches)) {
1227
+				if (isset($posts[$matches['symbol']])) {
1228
+					$value = $posts[$matches['symbol']]['ID'];
1229
+				} elseif (isset($attachment_ids[$matches['symbol']])) {
1230
+					$value = $attachment_ids[$matches['symbol']];
1231 1231
 				} else {
1232 1232
 					continue;
1233 1233
 				}
1234 1234
 			}
1235 1235
 
1236
-			if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) {
1237
-				$this->set_post_value( $name, $value );
1236
+			if (empty($changeset_data[$name]) || ! empty($changeset_data[$name]['starter_content'])) {
1237
+				$this->set_post_value($name, $value);
1238 1238
 				$this->pending_starter_content_settings_ids[] = $name;
1239 1239
 			}
1240 1240
 		}
1241 1241
 
1242 1242
 		// Theme mods.
1243
-		foreach ( $theme_mods as $name => $value ) {
1244
-			if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) {
1245
-				if ( isset( $posts[ $matches['symbol'] ] ) ) {
1246
-					$value = $posts[ $matches['symbol'] ]['ID'];
1247
-				} elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1248
-					$value = $attachment_ids[ $matches['symbol'] ];
1243
+		foreach ($theme_mods as $name => $value) {
1244
+			if (preg_match('/^{{(?P<symbol>.+)}}$/', $value, $matches)) {
1245
+				if (isset($posts[$matches['symbol']])) {
1246
+					$value = $posts[$matches['symbol']]['ID'];
1247
+				} elseif (isset($attachment_ids[$matches['symbol']])) {
1248
+					$value = $attachment_ids[$matches['symbol']];
1249 1249
 				} else {
1250 1250
 					continue;
1251 1251
 				}
1252 1252
 			}
1253 1253
 
1254 1254
 			// Handle header image as special case since setting has a legacy format.
1255
-			if ( 'header_image' === $name ) {
1255
+			if ('header_image' === $name) {
1256 1256
 				$name = 'header_image_data';
1257
-				$metadata = wp_get_attachment_metadata( $value );
1258
-				if ( empty( $metadata ) ) {
1257
+				$metadata = wp_get_attachment_metadata($value);
1258
+				if (empty($metadata)) {
1259 1259
 					continue;
1260 1260
 				}
1261 1261
 				$value = array(
1262 1262
 					'attachment_id' => $value,
1263
-					'url' => wp_get_attachment_url( $value ),
1263
+					'url' => wp_get_attachment_url($value),
1264 1264
 					'height' => $metadata['height'],
1265 1265
 					'width' => $metadata['width'],
1266 1266
 				);
1267
-			} elseif ( 'background_image' === $name ) {
1268
-				$value = wp_get_attachment_url( $value );
1267
+			} elseif ('background_image' === $name) {
1268
+				$value = wp_get_attachment_url($value);
1269 1269
 			}
1270 1270
 
1271
-			if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) {
1272
-				$this->set_post_value( $name, $value );
1271
+			if (empty($changeset_data[$name]) || ! empty($changeset_data[$name]['starter_content'])) {
1272
+				$this->set_post_value($name, $value);
1273 1273
 				$this->pending_starter_content_settings_ids[] = $name;
1274 1274
 			}
1275 1275
 		}
1276 1276
 
1277
-		if ( ! empty( $this->pending_starter_content_settings_ids ) ) {
1278
-			if ( did_action( 'customize_register' ) ) {
1277
+		if ( ! empty($this->pending_starter_content_settings_ids)) {
1278
+			if (did_action('customize_register')) {
1279 1279
 				$this->_save_starter_content_changeset();
1280 1280
 			} else {
1281
-				add_action( 'customize_register', array( $this, '_save_starter_content_changeset' ), 1000 );
1281
+				add_action('customize_register', array($this, '_save_starter_content_changeset'), 1000);
1282 1282
 			}
1283 1283
 		}
1284 1284
 	}
@@ -1294,54 +1294,54 @@  discard block
 block discarded – undo
1294 1294
 	 * @param array $attachments Attachments.
1295 1295
 	 * @return array Prepared attachments.
1296 1296
 	 */
1297
-	protected function prepare_starter_content_attachments( $attachments ) {
1297
+	protected function prepare_starter_content_attachments($attachments) {
1298 1298
 		$prepared_attachments = array();
1299
-		if ( empty( $attachments ) ) {
1299
+		if (empty($attachments)) {
1300 1300
 			return $prepared_attachments;
1301 1301
 		}
1302 1302
 
1303 1303
 		// Such is The WordPress Way.
1304
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
1305
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
1306
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
1304
+		require_once(ABSPATH.'wp-admin/includes/file.php');
1305
+		require_once(ABSPATH.'wp-admin/includes/media.php');
1306
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1307 1307
 
1308
-		foreach ( $attachments as $symbol => $attachment ) {
1308
+		foreach ($attachments as $symbol => $attachment) {
1309 1309
 
1310 1310
 			// A file is required and URLs to files are not currently allowed.
1311
-			if ( empty( $attachment['file'] ) || preg_match( '#^https?://$#', $attachment['file'] ) ) {
1311
+			if (empty($attachment['file']) || preg_match('#^https?://$#', $attachment['file'])) {
1312 1312
 				continue;
1313 1313
 			}
1314 1314
 
1315 1315
 			$file_path = null;
1316
-			if ( file_exists( $attachment['file'] ) ) {
1316
+			if (file_exists($attachment['file'])) {
1317 1317
 				$file_path = $attachment['file']; // Could be absolute path to file in plugin.
1318
-			} elseif ( is_child_theme() && file_exists( get_stylesheet_directory() . '/' . $attachment['file'] ) ) {
1319
-				$file_path = get_stylesheet_directory() . '/' . $attachment['file'];
1320
-			} elseif ( file_exists( get_template_directory() . '/' . $attachment['file'] ) ) {
1321
-				$file_path = get_template_directory() . '/' . $attachment['file'];
1318
+			} elseif (is_child_theme() && file_exists(get_stylesheet_directory().'/'.$attachment['file'])) {
1319
+				$file_path = get_stylesheet_directory().'/'.$attachment['file'];
1320
+			} elseif (file_exists(get_template_directory().'/'.$attachment['file'])) {
1321
+				$file_path = get_template_directory().'/'.$attachment['file'];
1322 1322
 			} else {
1323 1323
 				continue;
1324 1324
 			}
1325
-			$file_name = basename( $attachment['file'] );
1325
+			$file_name = basename($attachment['file']);
1326 1326
 
1327 1327
 			// Skip file types that are not recognized.
1328
-			$checked_filetype = wp_check_filetype( $file_name );
1329
-			if ( empty( $checked_filetype['type'] ) ) {
1328
+			$checked_filetype = wp_check_filetype($file_name);
1329
+			if (empty($checked_filetype['type'])) {
1330 1330
 				continue;
1331 1331
 			}
1332 1332
 
1333 1333
 			// Ensure post_name is set since not automatically derived from post_title for new auto-draft posts.
1334
-			if ( empty( $attachment['post_name'] ) ) {
1335
-				if ( ! empty( $attachment['post_title'] ) ) {
1336
-					$attachment['post_name'] = sanitize_title( $attachment['post_title'] );
1334
+			if (empty($attachment['post_name'])) {
1335
+				if ( ! empty($attachment['post_title'])) {
1336
+					$attachment['post_name'] = sanitize_title($attachment['post_title']);
1337 1337
 				} else {
1338
-					$attachment['post_name'] = sanitize_title( preg_replace( '/\.\w+$/', '', $file_name ) );
1338
+					$attachment['post_name'] = sanitize_title(preg_replace('/\.\w+$/', '', $file_name));
1339 1339
 				}
1340 1340
 			}
1341 1341
 
1342 1342
 			$attachment['file_name'] = $file_name;
1343 1343
 			$attachment['file_path'] = $file_path;
1344
-			$prepared_attachments[ $symbol ] = $attachment;
1344
+			$prepared_attachments[$symbol] = $attachment;
1345 1345
 		}
1346 1346
 		return $prepared_attachments;
1347 1347
 	}
@@ -1354,14 +1354,14 @@  discard block
 block discarded – undo
1354 1354
 	 */
1355 1355
 	public function _save_starter_content_changeset() {
1356 1356
 
1357
-		if ( empty( $this->pending_starter_content_settings_ids ) ) {
1357
+		if (empty($this->pending_starter_content_settings_ids)) {
1358 1358
 			return;
1359 1359
 		}
1360 1360
 
1361
-		$this->save_changeset_post( array(
1362
-			'data' => array_fill_keys( $this->pending_starter_content_settings_ids, array( 'starter_content' => true ) ),
1361
+		$this->save_changeset_post(array(
1362
+			'data' => array_fill_keys($this->pending_starter_content_settings_ids, array('starter_content' => true)),
1363 1363
 			'starter_content' => true,
1364
-		) );
1364
+		));
1365 1365
 
1366 1366
 		$this->pending_starter_content_settings_ids = array();
1367 1367
 	}
@@ -1393,11 +1393,11 @@  discard block
 block discarded – undo
1393 1393
 	 * }
1394 1394
 	 * @return array
1395 1395
 	 */
1396
-	public function unsanitized_post_values( $args = array() ) {
1396
+	public function unsanitized_post_values($args = array()) {
1397 1397
 		$args = array_merge(
1398 1398
 			array(
1399 1399
 				'exclude_changeset' => false,
1400
-				'exclude_post_data' => ! current_user_can( 'customize' ),
1400
+				'exclude_post_data' => ! current_user_can('customize'),
1401 1401
 			),
1402 1402
 			$args
1403 1403
 		);
@@ -1405,46 +1405,46 @@  discard block
 block discarded – undo
1405 1405
 		$values = array();
1406 1406
 
1407 1407
 		// Let default values be from the stashed theme mods if doing a theme switch and if no changeset is present.
1408
-		if ( ! $this->is_theme_active() ) {
1409
-			$stashed_theme_mods = get_option( 'customize_stashed_theme_mods' );
1408
+		if ( ! $this->is_theme_active()) {
1409
+			$stashed_theme_mods = get_option('customize_stashed_theme_mods');
1410 1410
 			$stylesheet = $this->get_stylesheet();
1411
-			if ( isset( $stashed_theme_mods[ $stylesheet ] ) ) {
1412
-				$values = array_merge( $values, wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' ) );
1411
+			if (isset($stashed_theme_mods[$stylesheet])) {
1412
+				$values = array_merge($values, wp_list_pluck($stashed_theme_mods[$stylesheet], 'value'));
1413 1413
 			}
1414 1414
 		}
1415 1415
 
1416
-		if ( ! $args['exclude_changeset'] ) {
1417
-			foreach ( $this->changeset_data() as $setting_id => $setting_params ) {
1418
-				if ( ! array_key_exists( 'value', $setting_params ) ) {
1416
+		if ( ! $args['exclude_changeset']) {
1417
+			foreach ($this->changeset_data() as $setting_id => $setting_params) {
1418
+				if ( ! array_key_exists('value', $setting_params)) {
1419 1419
 					continue;
1420 1420
 				}
1421
-				if ( isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] ) {
1421
+				if (isset($setting_params['type']) && 'theme_mod' === $setting_params['type']) {
1422 1422
 
1423 1423
 					// Ensure that theme mods values are only used if they were saved under the current theme.
1424 1424
 					$namespace_pattern = '/^(?P<stylesheet>.+?)::(?P<setting_id>.+)$/';
1425
-					if ( preg_match( $namespace_pattern, $setting_id, $matches ) && $this->get_stylesheet() === $matches['stylesheet'] ) {
1426
-						$values[ $matches['setting_id'] ] = $setting_params['value'];
1425
+					if (preg_match($namespace_pattern, $setting_id, $matches) && $this->get_stylesheet() === $matches['stylesheet']) {
1426
+						$values[$matches['setting_id']] = $setting_params['value'];
1427 1427
 					}
1428 1428
 				} else {
1429
-					$values[ $setting_id ] = $setting_params['value'];
1429
+					$values[$setting_id] = $setting_params['value'];
1430 1430
 				}
1431 1431
 			}
1432 1432
 		}
1433 1433
 
1434
-		if ( ! $args['exclude_post_data'] ) {
1435
-			if ( ! isset( $this->_post_values ) ) {
1436
-				if ( isset( $_POST['customized'] ) ) {
1437
-					$post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
1434
+		if ( ! $args['exclude_post_data']) {
1435
+			if ( ! isset($this->_post_values)) {
1436
+				if (isset($_POST['customized'])) {
1437
+					$post_values = json_decode(wp_unslash($_POST['customized']), true);
1438 1438
 				} else {
1439 1439
 					$post_values = array();
1440 1440
 				}
1441
-				if ( is_array( $post_values ) ) {
1441
+				if (is_array($post_values)) {
1442 1442
 					$this->_post_values = $post_values;
1443 1443
 				} else {
1444 1444
 					$this->_post_values = array();
1445 1445
 				}
1446 1446
 			}
1447
-			$values = array_merge( $values, $this->_post_values );
1447
+			$values = array_merge($values, $this->_post_values);
1448 1448
 		}
1449 1449
 		return $values;
1450 1450
 	}
@@ -1470,18 +1470,18 @@  discard block
 block discarded – undo
1470 1470
 	 *                                      or the post value is invalid (added in 4.6.0).
1471 1471
 	 * @return string|mixed $post_value Sanitized value or the $default provided.
1472 1472
 	 */
1473
-	public function post_value( $setting, $default = null ) {
1473
+	public function post_value($setting, $default = null) {
1474 1474
 		$post_values = $this->unsanitized_post_values();
1475
-		if ( ! array_key_exists( $setting->id, $post_values ) ) {
1475
+		if ( ! array_key_exists($setting->id, $post_values)) {
1476 1476
 			return $default;
1477 1477
 		}
1478
-		$value = $post_values[ $setting->id ];
1479
-		$valid = $setting->validate( $value );
1480
-		if ( is_wp_error( $valid ) ) {
1478
+		$value = $post_values[$setting->id];
1479
+		$valid = $setting->validate($value);
1480
+		if (is_wp_error($valid)) {
1481 1481
 			return $default;
1482 1482
 		}
1483
-		$value = $setting->sanitize( $value );
1484
-		if ( is_null( $value ) || is_wp_error( $value ) ) {
1483
+		$value = $setting->sanitize($value);
1484
+		if (is_null($value) || is_wp_error($value)) {
1485 1485
 			return $default;
1486 1486
 		}
1487 1487
 		return $value;
@@ -1499,9 +1499,9 @@  discard block
 block discarded – undo
1499 1499
 	 * @param string $setting_id ID for the WP_Customize_Setting instance.
1500 1500
 	 * @param mixed  $value      Post value.
1501 1501
 	 */
1502
-	public function set_post_value( $setting_id, $value ) {
1502
+	public function set_post_value($setting_id, $value) {
1503 1503
 		$this->unsanitized_post_values(); // Populate _post_values from $_POST['customized'].
1504
-		$this->_post_values[ $setting_id ] = $value;
1504
+		$this->_post_values[$setting_id] = $value;
1505 1505
 
1506 1506
 		/**
1507 1507
 		 * Announce when a specific setting's unsanitized post value has been set.
@@ -1515,7 +1515,7 @@  discard block
 block discarded – undo
1515 1515
 		 * @param mixed                $value Unsanitized setting post value.
1516 1516
 		 * @param WP_Customize_Manager $this  WP_Customize_Manager instance.
1517 1517
 		 */
1518
-		do_action( "customize_post_value_set_{$setting_id}", $value, $this );
1518
+		do_action("customize_post_value_set_{$setting_id}", $value, $this);
1519 1519
 
1520 1520
 		/**
1521 1521
 		 * Announce when any setting's unsanitized post value has been set.
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
 		 * @param mixed                $value      Unsanitized setting post value.
1532 1532
 		 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
1533 1533
 		 */
1534
-		do_action( 'customize_post_value_set', $setting_id, $value, $this );
1534
+		do_action('customize_post_value_set', $setting_id, $value, $this);
1535 1535
 	}
1536 1536
 
1537 1537
 	/**
@@ -1549,32 +1549,32 @@  discard block
 block discarded – undo
1549 1549
 		 * allowed then the auth cookies would not be sent and WordPress would
1550 1550
 		 * not send no-cache headers by default.
1551 1551
 		 */
1552
-		if ( ! headers_sent() ) {
1552
+		if ( ! headers_sent()) {
1553 1553
 			nocache_headers();
1554
-			header( 'X-Robots: noindex, nofollow, noarchive' );
1554
+			header('X-Robots: noindex, nofollow, noarchive');
1555 1555
 		}
1556
-		add_action( 'wp_head', 'wp_no_robots' );
1557
-		add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' ) );
1556
+		add_action('wp_head', 'wp_no_robots');
1557
+		add_filter('wp_headers', array($this, 'filter_iframe_security_headers'));
1558 1558
 
1559 1559
 		/*
1560 1560
 		 * If preview is being served inside the customizer preview iframe, and
1561 1561
 		 * if the user doesn't have customize capability, then it is assumed
1562 1562
 		 * that the user's session has expired and they need to re-authenticate.
1563 1563
 		 */
1564
-		if ( $this->messenger_channel && ! current_user_can( 'customize' ) ) {
1565
-			$this->wp_die( -1, __( 'Unauthorized. You may remove the customize_messenger_channel param to preview as frontend.' ) );
1564
+		if ($this->messenger_channel && ! current_user_can('customize')) {
1565
+			$this->wp_die( -1, __('Unauthorized. You may remove the customize_messenger_channel param to preview as frontend.') );
1566 1566
 			return;
1567 1567
 		}
1568 1568
 
1569 1569
 		$this->prepare_controls();
1570 1570
 
1571
-		add_filter( 'wp_redirect', array( $this, 'add_state_query_params' ) );
1571
+		add_filter('wp_redirect', array($this, 'add_state_query_params'));
1572 1572
 
1573
-		wp_enqueue_script( 'customize-preview' );
1574
-		add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) );
1575
-		add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) );
1576
-		add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
1577
-		add_filter( 'get_edit_post_link', '__return_empty_string' );
1573
+		wp_enqueue_script('customize-preview');
1574
+		add_action('wp_head', array($this, 'customize_preview_loading_style'));
1575
+		add_action('wp_head', array($this, 'remove_frameless_preview_messenger_channel'));
1576
+		add_action('wp_footer', array($this, 'customize_preview_settings'), 20);
1577
+		add_filter('get_edit_post_link', '__return_empty_string');
1578 1578
 
1579 1579
 		/**
1580 1580
 		 * Fires once the Customizer preview has initialized and JavaScript
@@ -1584,7 +1584,7 @@  discard block
 block discarded – undo
1584 1584
 		 *
1585 1585
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1586 1586
 		 */
1587
-		do_action( 'customize_preview_init', $this );
1587
+		do_action('customize_preview_init', $this);
1588 1588
 	}
1589 1589
 
1590 1590
 	/**
@@ -1596,10 +1596,10 @@  discard block
 block discarded – undo
1596 1596
 	 * @param array $headers Headers.
1597 1597
 	 * @return array Headers.
1598 1598
 	 */
1599
-	public function filter_iframe_security_headers( $headers ) {
1600
-		$customize_url = admin_url( 'customize.php' );
1601
-		$headers['X-Frame-Options'] = 'ALLOW-FROM ' . $customize_url;
1602
-		$headers['Content-Security-Policy'] = 'frame-ancestors ' . preg_replace( '#^(\w+://[^/]+).+?$#', '$1', $customize_url );
1599
+	public function filter_iframe_security_headers($headers) {
1600
+		$customize_url = admin_url('customize.php');
1601
+		$headers['X-Frame-Options'] = 'ALLOW-FROM '.$customize_url;
1602
+		$headers['Content-Security-Policy'] = 'frame-ancestors '.preg_replace('#^(\w+://[^/]+).+?$#', '$1', $customize_url);
1603 1603
 		return $headers;
1604 1604
 	}
1605 1605
 
@@ -1614,34 +1614,34 @@  discard block
 block discarded – undo
1614 1614
 	 * @param string $url URL.
1615 1615
 	 * @return string URL.
1616 1616
 	 */
1617
-	public function add_state_query_params( $url ) {
1618
-		$parsed_original_url = wp_parse_url( $url );
1617
+	public function add_state_query_params($url) {
1618
+		$parsed_original_url = wp_parse_url($url);
1619 1619
 		$is_allowed = false;
1620
-		foreach ( $this->get_allowed_urls() as $allowed_url ) {
1621
-			$parsed_allowed_url = wp_parse_url( $allowed_url );
1620
+		foreach ($this->get_allowed_urls() as $allowed_url) {
1621
+			$parsed_allowed_url = wp_parse_url($allowed_url);
1622 1622
 			$is_allowed = (
1623 1623
 				$parsed_allowed_url['scheme'] === $parsed_original_url['scheme']
1624 1624
 				&&
1625 1625
 				$parsed_allowed_url['host'] === $parsed_original_url['host']
1626 1626
 				&&
1627
-				0 === strpos( $parsed_original_url['path'], $parsed_allowed_url['path'] )
1627
+				0 === strpos($parsed_original_url['path'], $parsed_allowed_url['path'])
1628 1628
 			);
1629
-			if ( $is_allowed ) {
1629
+			if ($is_allowed) {
1630 1630
 				break;
1631 1631
 			}
1632 1632
 		}
1633 1633
 
1634
-		if ( $is_allowed ) {
1634
+		if ($is_allowed) {
1635 1635
 			$query_params = array(
1636 1636
 				'customize_changeset_uuid' => $this->changeset_uuid(),
1637 1637
 			);
1638
-			if ( ! $this->is_theme_active() ) {
1638
+			if ( ! $this->is_theme_active()) {
1639 1639
 				$query_params['customize_theme'] = $this->get_stylesheet();
1640 1640
 			}
1641
-			if ( $this->messenger_channel ) {
1641
+			if ($this->messenger_channel) {
1642 1642
 				$query_params['customize_messenger_channel'] = $this->messenger_channel;
1643 1643
 			}
1644
-			$url = add_query_arg( $query_params, $url );
1644
+			$url = add_query_arg($query_params, $url);
1645 1645
 		}
1646 1646
 
1647 1647
 		return $url;
@@ -1656,7 +1656,7 @@  discard block
 block discarded – undo
1656 1656
 	 * @access public
1657 1657
 	 */
1658 1658
 	public function customize_preview_override_404_status() {
1659
-		_deprecated_function( __METHOD__, '4.7.0' );
1659
+		_deprecated_function(__METHOD__, '4.7.0');
1660 1660
 	}
1661 1661
 
1662 1662
 	/**
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 	 * @deprecated 4.7.0
1667 1667
 	 */
1668 1668
 	public function customize_preview_base() {
1669
-		_deprecated_function( __METHOD__, '4.7.0' );
1669
+		_deprecated_function(__METHOD__, '4.7.0');
1670 1670
 	}
1671 1671
 
1672 1672
 	/**
@@ -1676,7 +1676,7 @@  discard block
 block discarded – undo
1676 1676
 	 * @deprecated 4.7.0 Customizer no longer supports IE8, so all supported browsers recognize HTML5.
1677 1677
 	 */
1678 1678
 	public function customize_preview_html5() {
1679
-		_deprecated_function( __FUNCTION__, '4.7.0' );
1679
+		_deprecated_function(__FUNCTION__, '4.7.0');
1680 1680
 	}
1681 1681
 
1682 1682
 	/**
@@ -1717,7 +1717,7 @@  discard block
 block discarded – undo
1717 1717
 	 * @access public
1718 1718
 	 */
1719 1719
 	public function remove_frameless_preview_messenger_channel() {
1720
-		if ( ! $this->messenger_channel ) {
1720
+		if ( ! $this->messenger_channel) {
1721 1721
 			return;
1722 1722
 		}
1723 1723
 		?>
@@ -1751,40 +1751,40 @@  discard block
 block discarded – undo
1751 1751
 	 * @since 3.4.0
1752 1752
 	 */
1753 1753
 	public function customize_preview_settings() {
1754
-		$post_values = $this->unsanitized_post_values( array( 'exclude_changeset' => true ) );
1755
-		$setting_validities = $this->validate_setting_values( $post_values );
1756
-		$exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
1754
+		$post_values = $this->unsanitized_post_values(array('exclude_changeset' => true));
1755
+		$setting_validities = $this->validate_setting_values($post_values);
1756
+		$exported_setting_validities = array_map(array($this, 'prepare_setting_validity_for_js'), $setting_validities);
1757 1757
 
1758 1758
 		// Note that the REQUEST_URI is not passed into home_url() since this breaks subdirectory installs.
1759
-		$self_url = empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
1759
+		$self_url = empty($_SERVER['REQUEST_URI']) ? home_url('/') : esc_url_raw(wp_unslash($_SERVER['REQUEST_URI']));
1760 1760
 		$state_query_params = array(
1761 1761
 			'customize_theme',
1762 1762
 			'customize_changeset_uuid',
1763 1763
 			'customize_messenger_channel',
1764 1764
 		);
1765
-		$self_url = remove_query_arg( $state_query_params, $self_url );
1765
+		$self_url = remove_query_arg($state_query_params, $self_url);
1766 1766
 
1767 1767
 		$allowed_urls = $this->get_allowed_urls();
1768 1768
 		$allowed_hosts = array();
1769
-		foreach ( $allowed_urls as $allowed_url ) {
1770
-			$parsed = wp_parse_url( $allowed_url );
1771
-			if ( empty( $parsed['host'] ) ) {
1769
+		foreach ($allowed_urls as $allowed_url) {
1770
+			$parsed = wp_parse_url($allowed_url);
1771
+			if (empty($parsed['host'])) {
1772 1772
 				continue;
1773 1773
 			}
1774 1774
 			$host = $parsed['host'];
1775
-			if ( ! empty( $parsed['port'] ) ) {
1776
-				$host .= ':' . $parsed['port'];
1775
+			if ( ! empty($parsed['port'])) {
1776
+				$host .= ':'.$parsed['port'];
1777 1777
 			}
1778 1778
 			$allowed_hosts[] = $host;
1779 1779
 		}
1780 1780
 
1781
-		$switched_locale = switch_to_locale( get_user_locale() );
1781
+		$switched_locale = switch_to_locale(get_user_locale());
1782 1782
 		$l10n = array(
1783
-			'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
1784
-			'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
1785
-			'formUnpreviewable' => __( 'This form is not live-previewable.' ),
1783
+			'shiftClickToEdit' => __('Shift-click to edit this element.'),
1784
+			'linkUnpreviewable' => __('This link is not live-previewable.'),
1785
+			'formUnpreviewable' => __('This form is not live-previewable.'),
1786 1786
 		);
1787
-		if ( $switched_locale ) {
1787
+		if ($switched_locale) {
1788 1788
 			restore_previous_locale();
1789 1789
 		}
1790 1790
 
@@ -1802,8 +1802,8 @@  discard block
 block discarded – undo
1802 1802
 			),
1803 1803
 			'url' => array(
1804 1804
 				'self' => $self_url,
1805
-				'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ),
1806
-				'allowedHosts' => array_unique( $allowed_hosts ),
1805
+				'allowed' => array_map('esc_url_raw', $this->get_allowed_urls()),
1806
+				'allowedHosts' => array_unique($allowed_hosts),
1807 1807
 				'isCrossDomain' => $this->is_cross_domain(),
1808 1808
 			),
1809 1809
 			'channel' => $this->messenger_channel,
@@ -1811,35 +1811,35 @@  discard block
 block discarded – undo
1811 1811
 			'activeSections' => array(),
1812 1812
 			'activeControls' => array(),
1813 1813
 			'settingValidities' => $exported_setting_validities,
1814
-			'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
1814
+			'nonce' => current_user_can('customize') ? $this->get_nonces() : array(),
1815 1815
 			'l10n' => $l10n,
1816
-			'_dirty' => array_keys( $post_values ),
1816
+			'_dirty' => array_keys($post_values),
1817 1817
 		);
1818 1818
 
1819
-		foreach ( $this->panels as $panel_id => $panel ) {
1820
-			if ( $panel->check_capabilities() ) {
1821
-				$settings['activePanels'][ $panel_id ] = $panel->active();
1822
-				foreach ( $panel->sections as $section_id => $section ) {
1823
-					if ( $section->check_capabilities() ) {
1824
-						$settings['activeSections'][ $section_id ] = $section->active();
1819
+		foreach ($this->panels as $panel_id => $panel) {
1820
+			if ($panel->check_capabilities()) {
1821
+				$settings['activePanels'][$panel_id] = $panel->active();
1822
+				foreach ($panel->sections as $section_id => $section) {
1823
+					if ($section->check_capabilities()) {
1824
+						$settings['activeSections'][$section_id] = $section->active();
1825 1825
 					}
1826 1826
 				}
1827 1827
 			}
1828 1828
 		}
1829
-		foreach ( $this->sections as $id => $section ) {
1830
-			if ( $section->check_capabilities() ) {
1831
-				$settings['activeSections'][ $id ] = $section->active();
1829
+		foreach ($this->sections as $id => $section) {
1830
+			if ($section->check_capabilities()) {
1831
+				$settings['activeSections'][$id] = $section->active();
1832 1832
 			}
1833 1833
 		}
1834
-		foreach ( $this->controls as $id => $control ) {
1835
-			if ( $control->check_capabilities() ) {
1836
-				$settings['activeControls'][ $id ] = $control->active();
1834
+		foreach ($this->controls as $id => $control) {
1835
+			if ($control->check_capabilities()) {
1836
+				$settings['activeControls'][$id] = $control->active();
1837 1837
 			}
1838 1838
 		}
1839 1839
 
1840 1840
 		?>
1841 1841
 		<script type="text/javascript">
1842
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
1842
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
1843 1843
 			_wpCustomizeSettings.values = {};
1844 1844
 			(function( v ) {
1845 1845
 				<?php
@@ -1848,12 +1848,12 @@  discard block
 block discarded – undo
1848 1848
 				 * serialization in order to avoid a peak memory usage spike.
1849 1849
 				 * @todo We may not even need to export the values at all since the pane syncs them anyway.
1850 1850
 				 */
1851
-				foreach ( $this->settings as $id => $setting ) {
1852
-					if ( $setting->check_capabilities() ) {
1851
+				foreach ($this->settings as $id => $setting) {
1852
+					if ($setting->check_capabilities()) {
1853 1853
 						printf(
1854 1854
 							"v[%s] = %s;\n",
1855
-							wp_json_encode( $id ),
1856
-							wp_json_encode( $setting->js_value() )
1855
+							wp_json_encode($id),
1856
+							wp_json_encode($setting->js_value())
1857 1857
 						);
1858 1858
 					}
1859 1859
 				}
@@ -1870,7 +1870,7 @@  discard block
 block discarded – undo
1870 1870
 	 * @deprecated 4.7.0
1871 1871
 	 */
1872 1872
 	public function customize_preview_signature() {
1873
-		_deprecated_function( __METHOD__, '4.7.0' );
1873
+		_deprecated_function(__METHOD__, '4.7.0');
1874 1874
 	}
1875 1875
 
1876 1876
 	/**
@@ -1882,8 +1882,8 @@  discard block
 block discarded – undo
1882 1882
 	 * @param mixed $return Value passed through for {@see 'wp_die_handler'} filter.
1883 1883
 	 * @return mixed Value passed through for {@see 'wp_die_handler'} filter.
1884 1884
 	 */
1885
-	public function remove_preview_signature( $return = null ) {
1886
-		_deprecated_function( __METHOD__, '4.7.0' );
1885
+	public function remove_preview_signature($return = null) {
1886
+		_deprecated_function(__METHOD__, '4.7.0');
1887 1887
 
1888 1888
 		return $return;
1889 1889
 	}
@@ -1929,7 +1929,7 @@  discard block
 block discarded – undo
1929 1929
 	 * @return string Theme root.
1930 1930
 	 */
1931 1931
 	public function get_template_root() {
1932
-		return get_raw_theme_root( $this->get_template(), true );
1932
+		return get_raw_theme_root($this->get_template(), true);
1933 1933
 	}
1934 1934
 
1935 1935
 	/**
@@ -1940,7 +1940,7 @@  discard block
 block discarded – undo
1940 1940
 	 * @return string Theme root.
1941 1941
 	 */
1942 1942
 	public function get_stylesheet_root() {
1943
-		return get_raw_theme_root( $this->get_stylesheet(), true );
1943
+		return get_raw_theme_root($this->get_stylesheet(), true);
1944 1944
 	}
1945 1945
 
1946 1946
 	/**
@@ -1951,7 +1951,7 @@  discard block
 block discarded – undo
1951 1951
 	 * @param $current_theme {@internal Parameter is not used}
1952 1952
 	 * @return string Theme name.
1953 1953
 	 */
1954
-	public function current_theme( $current_theme ) {
1954
+	public function current_theme($current_theme) {
1955 1955
 		return $this->theme()->display('Name');
1956 1956
 	}
1957 1957
 
@@ -1978,48 +1978,48 @@  discard block
 block discarded – undo
1978 1978
 	 * }
1979 1979
 	 * @return array Mapping of setting IDs to return value of validate method calls, either `true` or `WP_Error`.
1980 1980
 	 */
1981
-	public function validate_setting_values( $setting_values, $options = array() ) {
1982
-		$options = wp_parse_args( $options, array(
1981
+	public function validate_setting_values($setting_values, $options = array()) {
1982
+		$options = wp_parse_args($options, array(
1983 1983
 			'validate_capability' => false,
1984 1984
 			'validate_existence' => false,
1985
-		) );
1985
+		));
1986 1986
 
1987 1987
 		$validities = array();
1988
-		foreach ( $setting_values as $setting_id => $unsanitized_value ) {
1989
-			$setting = $this->get_setting( $setting_id );
1990
-			if ( ! $setting ) {
1991
-				if ( $options['validate_existence'] ) {
1992
-					$validities[ $setting_id ] = new WP_Error( 'unrecognized', __( 'Setting does not exist or is unrecognized.' ) );
1988
+		foreach ($setting_values as $setting_id => $unsanitized_value) {
1989
+			$setting = $this->get_setting($setting_id);
1990
+			if ( ! $setting) {
1991
+				if ($options['validate_existence']) {
1992
+					$validities[$setting_id] = new WP_Error('unrecognized', __('Setting does not exist or is unrecognized.'));
1993 1993
 				}
1994 1994
 				continue;
1995 1995
 			}
1996
-			if ( $options['validate_capability'] && ! current_user_can( $setting->capability ) ) {
1997
-				$validity = new WP_Error( 'unauthorized', __( 'Unauthorized to modify setting due to capability.' ) );
1996
+			if ($options['validate_capability'] && ! current_user_can($setting->capability)) {
1997
+				$validity = new WP_Error('unauthorized', __('Unauthorized to modify setting due to capability.'));
1998 1998
 			} else {
1999
-				if ( is_null( $unsanitized_value ) ) {
1999
+				if (is_null($unsanitized_value)) {
2000 2000
 					continue;
2001 2001
 				}
2002
-				$validity = $setting->validate( $unsanitized_value );
2002
+				$validity = $setting->validate($unsanitized_value);
2003 2003
 			}
2004
-			if ( ! is_wp_error( $validity ) ) {
2004
+			if ( ! is_wp_error($validity)) {
2005 2005
 				/** This filter is documented in wp-includes/class-wp-customize-setting.php */
2006
-				$late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting );
2007
-				if ( ! empty( $late_validity->errors ) ) {
2006
+				$late_validity = apply_filters("customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting);
2007
+				if ( ! empty($late_validity->errors)) {
2008 2008
 					$validity = $late_validity;
2009 2009
 				}
2010 2010
 			}
2011
-			if ( ! is_wp_error( $validity ) ) {
2012
-				$value = $setting->sanitize( $unsanitized_value );
2013
-				if ( is_null( $value ) ) {
2011
+			if ( ! is_wp_error($validity)) {
2012
+				$value = $setting->sanitize($unsanitized_value);
2013
+				if (is_null($value)) {
2014 2014
 					$validity = false;
2015
-				} elseif ( is_wp_error( $value ) ) {
2015
+				} elseif (is_wp_error($value)) {
2016 2016
 					$validity = $value;
2017 2017
 				}
2018 2018
 			}
2019
-			if ( false === $validity ) {
2020
-				$validity = new WP_Error( 'invalid_value', __( 'Invalid value.' ) );
2019
+			if (false === $validity) {
2020
+				$validity = new WP_Error('invalid_value', __('Invalid value.'));
2021 2021
 			}
2022
-			$validities[ $setting_id ] = $validity;
2022
+			$validities[$setting_id] = $validity;
2023 2023
 		}
2024 2024
 		return $validities;
2025 2025
 	}
@@ -2038,13 +2038,13 @@  discard block
 block discarded – undo
2038 2038
 	 *                    to their respective `message` and `data` to pass into the
2039 2039
 	 *                    `wp.customize.Notification` JS model.
2040 2040
 	 */
2041
-	public function prepare_setting_validity_for_js( $validity ) {
2042
-		if ( is_wp_error( $validity ) ) {
2041
+	public function prepare_setting_validity_for_js($validity) {
2042
+		if (is_wp_error($validity)) {
2043 2043
 			$notification = array();
2044
-			foreach ( $validity->errors as $error_code => $error_messages ) {
2045
-				$notification[ $error_code ] = array(
2046
-					'message' => join( ' ', $error_messages ),
2047
-					'data' => $validity->get_error_data( $error_code ),
2044
+			foreach ($validity->errors as $error_code => $error_messages) {
2045
+				$notification[$error_code] = array(
2046
+					'message' => join(' ', $error_messages),
2047
+					'data' => $validity->get_error_data($error_code),
2048 2048
 				);
2049 2049
 			}
2050 2050
 			return $notification;
@@ -2060,34 +2060,34 @@  discard block
 block discarded – undo
2060 2060
 	 * @since 4.7.0 The semantics of this method have changed to update a changeset, optionally to also change the status and other attributes.
2061 2061
 	 */
2062 2062
 	public function save() {
2063
-		if ( ! is_user_logged_in() ) {
2064
-			wp_send_json_error( 'unauthenticated' );
2063
+		if ( ! is_user_logged_in()) {
2064
+			wp_send_json_error('unauthenticated');
2065 2065
 		}
2066 2066
 
2067
-		if ( ! $this->is_preview() ) {
2068
-			wp_send_json_error( 'not_preview' );
2067
+		if ( ! $this->is_preview()) {
2068
+			wp_send_json_error('not_preview');
2069 2069
 		}
2070 2070
 
2071
-		$action = 'save-customize_' . $this->get_stylesheet();
2072
-		if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
2073
-			wp_send_json_error( 'invalid_nonce' );
2071
+		$action = 'save-customize_'.$this->get_stylesheet();
2072
+		if ( ! check_ajax_referer($action, 'nonce', false)) {
2073
+			wp_send_json_error('invalid_nonce');
2074 2074
 		}
2075 2075
 
2076 2076
 		$changeset_post_id = $this->changeset_post_id();
2077
-		if ( empty( $changeset_post_id ) ) {
2078
-			if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->create_posts ) ) {
2079
-				wp_send_json_error( 'cannot_create_changeset_post' );
2077
+		if (empty($changeset_post_id)) {
2078
+			if ( ! current_user_can(get_post_type_object('customize_changeset')->cap->create_posts)) {
2079
+				wp_send_json_error('cannot_create_changeset_post');
2080 2080
 			}
2081 2081
 		} else {
2082
-			if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) {
2083
-				wp_send_json_error( 'cannot_edit_changeset_post' );
2082
+			if ( ! current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $changeset_post_id)) {
2083
+				wp_send_json_error('cannot_edit_changeset_post');
2084 2084
 			}
2085 2085
 		}
2086 2086
 
2087
-		if ( ! empty( $_POST['customize_changeset_data'] ) ) {
2088
-			$input_changeset_data = json_decode( wp_unslash( $_POST['customize_changeset_data'] ), true );
2089
-			if ( ! is_array( $input_changeset_data ) ) {
2090
-				wp_send_json_error( 'invalid_customize_changeset_data' );
2087
+		if ( ! empty($_POST['customize_changeset_data'])) {
2088
+			$input_changeset_data = json_decode(wp_unslash($_POST['customize_changeset_data']), true);
2089
+			if ( ! is_array($input_changeset_data)) {
2090
+				wp_send_json_error('invalid_customize_changeset_data');
2091 2091
 			}
2092 2092
 		} else {
2093 2093
 			$input_changeset_data = array();
@@ -2095,21 +2095,21 @@  discard block
 block discarded – undo
2095 2095
 
2096 2096
 		// Validate title.
2097 2097
 		$changeset_title = null;
2098
-		if ( isset( $_POST['customize_changeset_title'] ) ) {
2099
-			$changeset_title = sanitize_text_field( wp_unslash( $_POST['customize_changeset_title'] ) );
2098
+		if (isset($_POST['customize_changeset_title'])) {
2099
+			$changeset_title = sanitize_text_field(wp_unslash($_POST['customize_changeset_title']));
2100 2100
 		}
2101 2101
 
2102 2102
 		// Validate changeset status param.
2103 2103
 		$is_publish = null;
2104 2104
 		$changeset_status = null;
2105
-		if ( isset( $_POST['customize_changeset_status'] ) ) {
2106
-			$changeset_status = wp_unslash( $_POST['customize_changeset_status'] );
2107
-			if ( ! get_post_status_object( $changeset_status ) || ! in_array( $changeset_status, array( 'draft', 'pending', 'publish', 'future' ), true ) ) {
2108
-				wp_send_json_error( 'bad_customize_changeset_status', 400 );
2105
+		if (isset($_POST['customize_changeset_status'])) {
2106
+			$changeset_status = wp_unslash($_POST['customize_changeset_status']);
2107
+			if ( ! get_post_status_object($changeset_status) || ! in_array($changeset_status, array('draft', 'pending', 'publish', 'future'), true)) {
2108
+				wp_send_json_error('bad_customize_changeset_status', 400);
2109 2109
 			}
2110
-			$is_publish = ( 'publish' === $changeset_status || 'future' === $changeset_status );
2111
-			if ( $is_publish && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) {
2112
-				wp_send_json_error( 'changeset_publish_unauthorized', 403 );
2110
+			$is_publish = ('publish' === $changeset_status || 'future' === $changeset_status);
2111
+			if ($is_publish && ! current_user_can(get_post_type_object('customize_changeset')->cap->publish_posts)) {
2112
+				wp_send_json_error('changeset_publish_unauthorized', 403);
2113 2113
 			}
2114 2114
 		}
2115 2115
 
@@ -2120,39 +2120,39 @@  discard block
 block discarded – undo
2120 2120
 		 * or a string like "+10 minutes".
2121 2121
 		 */
2122 2122
 		$changeset_date_gmt = null;
2123
-		if ( isset( $_POST['customize_changeset_date'] ) ) {
2124
-			$changeset_date = wp_unslash( $_POST['customize_changeset_date'] );
2125
-			if ( preg_match( '/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date ) ) {
2126
-				$mm = substr( $changeset_date, 5, 2 );
2127
-				$jj = substr( $changeset_date, 8, 2 );
2128
-				$aa = substr( $changeset_date, 0, 4 );
2129
-				$valid_date = wp_checkdate( $mm, $jj, $aa, $changeset_date );
2130
-				if ( ! $valid_date ) {
2131
-					wp_send_json_error( 'bad_customize_changeset_date', 400 );
2123
+		if (isset($_POST['customize_changeset_date'])) {
2124
+			$changeset_date = wp_unslash($_POST['customize_changeset_date']);
2125
+			if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date)) {
2126
+				$mm = substr($changeset_date, 5, 2);
2127
+				$jj = substr($changeset_date, 8, 2);
2128
+				$aa = substr($changeset_date, 0, 4);
2129
+				$valid_date = wp_checkdate($mm, $jj, $aa, $changeset_date);
2130
+				if ( ! $valid_date) {
2131
+					wp_send_json_error('bad_customize_changeset_date', 400);
2132 2132
 				}
2133
-				$changeset_date_gmt = get_gmt_from_date( $changeset_date );
2133
+				$changeset_date_gmt = get_gmt_from_date($changeset_date);
2134 2134
 			} else {
2135
-				$timestamp = strtotime( $changeset_date );
2136
-				if ( ! $timestamp ) {
2137
-					wp_send_json_error( 'bad_customize_changeset_date', 400 );
2135
+				$timestamp = strtotime($changeset_date);
2136
+				if ( ! $timestamp) {
2137
+					wp_send_json_error('bad_customize_changeset_date', 400);
2138 2138
 				}
2139
-				$changeset_date_gmt = gmdate( 'Y-m-d H:i:s', $timestamp );
2139
+				$changeset_date_gmt = gmdate('Y-m-d H:i:s', $timestamp);
2140 2140
 			}
2141 2141
 		}
2142 2142
 
2143
-		$r = $this->save_changeset_post( array(
2143
+		$r = $this->save_changeset_post(array(
2144 2144
 			'status' => $changeset_status,
2145 2145
 			'title' => $changeset_title,
2146 2146
 			'date_gmt' => $changeset_date_gmt,
2147 2147
 			'data' => $input_changeset_data,
2148
-		) );
2149
-		if ( is_wp_error( $r ) ) {
2148
+		));
2149
+		if (is_wp_error($r)) {
2150 2150
 			$response = array(
2151 2151
 				'message' => $r->get_error_message(),
2152 2152
 				'code' => $r->get_error_code(),
2153 2153
 			);
2154
-			if ( is_array( $r->get_error_data() ) ) {
2155
-				$response = array_merge( $response, $r->get_error_data() );
2154
+			if (is_array($r->get_error_data())) {
2155
+				$response = array_merge($response, $r->get_error_data());
2156 2156
 			} else {
2157 2157
 				$response['data'] = $r->get_error_data();
2158 2158
 			}
@@ -2160,18 +2160,18 @@  discard block
 block discarded – undo
2160 2160
 			$response = $r;
2161 2161
 
2162 2162
 			// Note that if the changeset status was publish, then it will get set to trash if revisions are not supported.
2163
-			$response['changeset_status'] = get_post_status( $this->changeset_post_id() );
2164
-			if ( $is_publish && 'trash' === $response['changeset_status'] ) {
2163
+			$response['changeset_status'] = get_post_status($this->changeset_post_id());
2164
+			if ($is_publish && 'trash' === $response['changeset_status']) {
2165 2165
 				$response['changeset_status'] = 'publish';
2166 2166
 			}
2167 2167
 
2168
-			if ( 'publish' === $response['changeset_status'] ) {
2168
+			if ('publish' === $response['changeset_status']) {
2169 2169
 				$response['next_changeset_uuid'] = wp_generate_uuid4();
2170 2170
 			}
2171 2171
 		}
2172 2172
 
2173
-		if ( isset( $response['setting_validities'] ) ) {
2174
-			$response['setting_validities'] = array_map( array( $this, 'prepare_setting_validity_for_js' ), $response['setting_validities'] );
2173
+		if (isset($response['setting_validities'])) {
2174
+			$response['setting_validities'] = array_map(array($this, 'prepare_setting_validity_for_js'), $response['setting_validities']);
2175 2175
 		}
2176 2176
 
2177 2177
 		/**
@@ -2185,12 +2185,12 @@  discard block
 block discarded – undo
2185 2185
 		 *                                       event on `wp.customize`.
2186 2186
 		 * @param WP_Customize_Manager $this     WP_Customize_Manager instance.
2187 2187
 		 */
2188
-		$response = apply_filters( 'customize_save_response', $response, $this );
2188
+		$response = apply_filters('customize_save_response', $response, $this);
2189 2189
 
2190
-		if ( is_wp_error( $r ) ) {
2191
-			wp_send_json_error( $response );
2190
+		if (is_wp_error($r)) {
2191
+			wp_send_json_error($response);
2192 2192
 		} else {
2193
-			wp_send_json_success( $response );
2193
+			wp_send_json_success($response);
2194 2194
 		}
2195 2195
 	}
2196 2196
 
@@ -2213,7 +2213,7 @@  discard block
 block discarded – undo
2213 2213
 	 *
2214 2214
 	 * @return array|WP_Error Returns array on success and WP_Error with array data on error.
2215 2215
 	 */
2216
-	function save_changeset_post( $args = array() ) {
2216
+	function save_changeset_post($args = array()) {
2217 2217
 
2218 2218
 		$args = array_merge(
2219 2219
 			array(
@@ -2229,41 +2229,41 @@  discard block
 block discarded – undo
2229 2229
 
2230 2230
 		$changeset_post_id = $this->changeset_post_id();
2231 2231
 		$existing_changeset_data = array();
2232
-		if ( $changeset_post_id ) {
2233
-			$existing_status = get_post_status( $changeset_post_id );
2234
-			if ( 'publish' === $existing_status || 'trash' === $existing_status ) {
2235
-				return new WP_Error( 'changeset_already_published' );
2232
+		if ($changeset_post_id) {
2233
+			$existing_status = get_post_status($changeset_post_id);
2234
+			if ('publish' === $existing_status || 'trash' === $existing_status) {
2235
+				return new WP_Error('changeset_already_published');
2236 2236
 			}
2237 2237
 
2238
-			$existing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2238
+			$existing_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2239 2239
 		}
2240 2240
 
2241 2241
 		// Fail if attempting to publish but publish hook is missing.
2242
-		if ( 'publish' === $args['status'] && false === has_action( 'transition_post_status', '_wp_customize_publish_changeset' ) ) {
2243
-			return new WP_Error( 'missing_publish_callback' );
2242
+		if ('publish' === $args['status'] && false === has_action('transition_post_status', '_wp_customize_publish_changeset')) {
2243
+			return new WP_Error('missing_publish_callback');
2244 2244
 		}
2245 2245
 
2246 2246
 		// Validate date.
2247
-		$now = gmdate( 'Y-m-d H:i:59' );
2248
-		if ( $args['date_gmt'] ) {
2249
-			$is_future_dated = ( mysql2date( 'U', $args['date_gmt'], false ) > mysql2date( 'U', $now, false ) );
2250
-			if ( ! $is_future_dated ) {
2251
-				return new WP_Error( 'not_future_date' ); // Only future dates are allowed.
2247
+		$now = gmdate('Y-m-d H:i:59');
2248
+		if ($args['date_gmt']) {
2249
+			$is_future_dated = (mysql2date('U', $args['date_gmt'], false) > mysql2date('U', $now, false));
2250
+			if ( ! $is_future_dated) {
2251
+				return new WP_Error('not_future_date'); // Only future dates are allowed.
2252 2252
 			}
2253 2253
 
2254
-			if ( ! $this->is_theme_active() && ( 'future' === $args['status'] || $is_future_dated ) ) {
2255
-				return new WP_Error( 'cannot_schedule_theme_switches' ); // This should be allowed in the future, when theme is a regular setting.
2254
+			if ( ! $this->is_theme_active() && ('future' === $args['status'] || $is_future_dated)) {
2255
+				return new WP_Error('cannot_schedule_theme_switches'); // This should be allowed in the future, when theme is a regular setting.
2256 2256
 			}
2257
-			$will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status( $changeset_post_id ) ) );
2258
-			if ( $will_remain_auto_draft ) {
2259
-				return new WP_Error( 'cannot_supply_date_for_auto_draft_changeset' );
2257
+			$will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status($changeset_post_id)));
2258
+			if ($will_remain_auto_draft) {
2259
+				return new WP_Error('cannot_supply_date_for_auto_draft_changeset');
2260 2260
 			}
2261
-		} elseif ( $changeset_post_id && 'future' === $args['status'] ) {
2261
+		} elseif ($changeset_post_id && 'future' === $args['status']) {
2262 2262
 
2263 2263
 			// Fail if the new status is future but the existing post's date is not in the future.
2264
-			$changeset_post = get_post( $changeset_post_id );
2265
-			if ( mysql2date( 'U', $changeset_post->post_date_gmt, false ) <= mysql2date( 'U', $now, false ) ) {
2266
-				return new WP_Error( 'not_future_date' );
2264
+			$changeset_post = get_post($changeset_post_id);
2265
+			if (mysql2date('U', $changeset_post->post_date_gmt, false) <= mysql2date('U', $now, false)) {
2266
+				return new WP_Error('not_future_date');
2267 2267
 			}
2268 2268
 		}
2269 2269
 
@@ -2272,18 +2272,18 @@  discard block
 block discarded – undo
2272 2272
 		$allow_revision = (bool) $args['status'];
2273 2273
 
2274 2274
 		// Amend post values with any supplied data.
2275
-		foreach ( $args['data'] as $setting_id => $setting_params ) {
2276
-			if ( array_key_exists( 'value', $setting_params ) ) {
2277
-				$this->set_post_value( $setting_id, $setting_params['value'] ); // Add to post values so that they can be validated and sanitized.
2275
+		foreach ($args['data'] as $setting_id => $setting_params) {
2276
+			if (array_key_exists('value', $setting_params)) {
2277
+				$this->set_post_value($setting_id, $setting_params['value']); // Add to post values so that they can be validated and sanitized.
2278 2278
 			}
2279 2279
 		}
2280 2280
 
2281 2281
 		// Note that in addition to post data, this will include any stashed theme mods.
2282
-		$post_values = $this->unsanitized_post_values( array(
2282
+		$post_values = $this->unsanitized_post_values(array(
2283 2283
 			'exclude_changeset' => true,
2284 2284
 			'exclude_post_data' => false,
2285
-		) );
2286
-		$this->add_dynamic_settings( array_keys( $post_values ) ); // Ensure settings get created even if they lack an input value.
2285
+		));
2286
+		$this->add_dynamic_settings(array_keys($post_values)); // Ensure settings get created even if they lack an input value.
2287 2287
 
2288 2288
 		/*
2289 2289
 		 * Get list of IDs for settings that have values different from what is currently
@@ -2294,23 +2294,23 @@  discard block
 block discarded – undo
2294 2294
 		 * previous saved settings and overriding the associated user_id if they made no change.
2295 2295
 		 */
2296 2296
 		$changed_setting_ids = array();
2297
-		foreach ( $post_values as $setting_id => $setting_value ) {
2298
-			$setting = $this->get_setting( $setting_id );
2297
+		foreach ($post_values as $setting_id => $setting_value) {
2298
+			$setting = $this->get_setting($setting_id);
2299 2299
 
2300
-			if ( $setting && 'theme_mod' === $setting->type ) {
2301
-				$prefixed_setting_id = $this->get_stylesheet() . '::' . $setting->id;
2300
+			if ($setting && 'theme_mod' === $setting->type) {
2301
+				$prefixed_setting_id = $this->get_stylesheet().'::'.$setting->id;
2302 2302
 			} else {
2303 2303
 				$prefixed_setting_id = $setting_id;
2304 2304
 			}
2305 2305
 
2306 2306
 			$is_value_changed = (
2307
-				! isset( $existing_changeset_data[ $prefixed_setting_id ] )
2307
+				! isset($existing_changeset_data[$prefixed_setting_id])
2308 2308
 				||
2309
-				! array_key_exists( 'value', $existing_changeset_data[ $prefixed_setting_id ] )
2309
+				! array_key_exists('value', $existing_changeset_data[$prefixed_setting_id])
2310 2310
 				||
2311
-				$existing_changeset_data[ $prefixed_setting_id ]['value'] !== $setting_value
2311
+				$existing_changeset_data[$prefixed_setting_id]['value'] !== $setting_value
2312 2312
 			);
2313
-			if ( $is_value_changed ) {
2313
+			if ($is_value_changed) {
2314 2314
 				$changed_setting_ids[] = $setting_id;
2315 2315
 			}
2316 2316
 		}
@@ -2326,82 +2326,82 @@  discard block
 block discarded – undo
2326 2326
 		 *
2327 2327
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
2328 2328
 		 */
2329
-		do_action( 'customize_save_validation_before', $this );
2329
+		do_action('customize_save_validation_before', $this);
2330 2330
 
2331 2331
 		// Validate settings.
2332 2332
 		$validated_values = array_merge(
2333
-			array_fill_keys( array_keys( $args['data'] ), null ), // Make sure existence/capability checks are done on value-less setting updates.
2333
+			array_fill_keys(array_keys($args['data']), null), // Make sure existence/capability checks are done on value-less setting updates.
2334 2334
 			$post_values
2335 2335
 		);
2336
-		$setting_validities = $this->validate_setting_values( $validated_values, array(
2336
+		$setting_validities = $this->validate_setting_values($validated_values, array(
2337 2337
 			'validate_capability' => true,
2338 2338
 			'validate_existence' => true,
2339
-		) );
2340
-		$invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) );
2339
+		));
2340
+		$invalid_setting_count = count(array_filter($setting_validities, 'is_wp_error'));
2341 2341
 
2342 2342
 		/*
2343 2343
 		 * Short-circuit if there are invalid settings the update is transactional.
2344 2344
 		 * A changeset update is transactional when a status is supplied in the request.
2345 2345
 		 */
2346
-		if ( $update_transactionally && $invalid_setting_count > 0 ) {
2346
+		if ($update_transactionally && $invalid_setting_count > 0) {
2347 2347
 			$response = array(
2348 2348
 				'setting_validities' => $setting_validities,
2349
-				'message' => sprintf( _n( 'There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ),
2349
+				'message' => sprintf(_n('There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count), number_format_i18n($invalid_setting_count)),
2350 2350
 			);
2351
-			return new WP_Error( 'transaction_fail', '', $response );
2351
+			return new WP_Error('transaction_fail', '', $response);
2352 2352
 		}
2353 2353
 
2354 2354
 		// Obtain/merge data for changeset.
2355
-		$original_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2355
+		$original_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2356 2356
 		$data = $original_changeset_data;
2357
-		if ( is_wp_error( $data ) ) {
2357
+		if (is_wp_error($data)) {
2358 2358
 			$data = array();
2359 2359
 		}
2360 2360
 
2361 2361
 		// Ensure that all post values are included in the changeset data.
2362
-		foreach ( $post_values as $setting_id => $post_value ) {
2363
-			if ( ! isset( $args['data'][ $setting_id ] ) ) {
2364
-				$args['data'][ $setting_id ] = array();
2362
+		foreach ($post_values as $setting_id => $post_value) {
2363
+			if ( ! isset($args['data'][$setting_id])) {
2364
+				$args['data'][$setting_id] = array();
2365 2365
 			}
2366
-			if ( ! isset( $args['data'][ $setting_id ]['value'] ) ) {
2367
-				$args['data'][ $setting_id ]['value'] = $post_value;
2366
+			if ( ! isset($args['data'][$setting_id]['value'])) {
2367
+				$args['data'][$setting_id]['value'] = $post_value;
2368 2368
 			}
2369 2369
 		}
2370 2370
 
2371
-		foreach ( $args['data'] as $setting_id => $setting_params ) {
2372
-			$setting = $this->get_setting( $setting_id );
2373
-			if ( ! $setting || ! $setting->check_capabilities() ) {
2371
+		foreach ($args['data'] as $setting_id => $setting_params) {
2372
+			$setting = $this->get_setting($setting_id);
2373
+			if ( ! $setting || ! $setting->check_capabilities()) {
2374 2374
 				continue;
2375 2375
 			}
2376 2376
 
2377 2377
 			// Skip updating changeset for invalid setting values.
2378
-			if ( isset( $setting_validities[ $setting_id ] ) && is_wp_error( $setting_validities[ $setting_id ] ) ) {
2378
+			if (isset($setting_validities[$setting_id]) && is_wp_error($setting_validities[$setting_id])) {
2379 2379
 				continue;
2380 2380
 			}
2381 2381
 
2382 2382
 			$changeset_setting_id = $setting_id;
2383
-			if ( 'theme_mod' === $setting->type ) {
2384
-				$changeset_setting_id = sprintf( '%s::%s', $this->get_stylesheet(), $setting_id );
2383
+			if ('theme_mod' === $setting->type) {
2384
+				$changeset_setting_id = sprintf('%s::%s', $this->get_stylesheet(), $setting_id);
2385 2385
 			}
2386 2386
 
2387
-			if ( null === $setting_params ) {
2387
+			if (null === $setting_params) {
2388 2388
 				// Remove setting from changeset entirely.
2389
-				unset( $data[ $changeset_setting_id ] );
2389
+				unset($data[$changeset_setting_id]);
2390 2390
 			} else {
2391 2391
 
2392
-				if ( ! isset( $data[ $changeset_setting_id ] ) ) {
2393
-					$data[ $changeset_setting_id ] = array();
2392
+				if ( ! isset($data[$changeset_setting_id])) {
2393
+					$data[$changeset_setting_id] = array();
2394 2394
 				}
2395 2395
 
2396 2396
 				// Merge any additional setting params that have been supplied with the existing params.
2397
-				$merged_setting_params = array_merge( $data[ $changeset_setting_id ], $setting_params );
2397
+				$merged_setting_params = array_merge($data[$changeset_setting_id], $setting_params);
2398 2398
 
2399 2399
 				// Skip updating setting params if unchanged (ensuring the user_id is not overwritten).
2400
-				if ( $data[ $changeset_setting_id ] === $merged_setting_params ) {
2400
+				if ($data[$changeset_setting_id] === $merged_setting_params) {
2401 2401
 					continue;
2402 2402
 				}
2403 2403
 
2404
-				$data[ $changeset_setting_id ] = array_merge(
2404
+				$data[$changeset_setting_id] = array_merge(
2405 2405
 					$merged_setting_params,
2406 2406
 					array(
2407 2407
 						'type' => $setting->type,
@@ -2410,8 +2410,8 @@  discard block
 block discarded – undo
2410 2410
 				);
2411 2411
 
2412 2412
 				// Clear starter_content flag in data if changeset is not explicitly being updated for starter content.
2413
-				if ( empty( $args['starter_content'] ) ) {
2414
-					unset( $data[ $changeset_setting_id ]['starter_content'] );
2413
+				if (empty($args['starter_content'])) {
2414
+					unset($data[$changeset_setting_id]['starter_content']);
2415 2415
 				}
2416 2416
 			}
2417 2417
 		}
@@ -2422,7 +2422,7 @@  discard block
 block discarded – undo
2422 2422
 			'status' => $args['status'],
2423 2423
 			'date_gmt' => $args['date_gmt'],
2424 2424
 			'post_id' => $changeset_post_id,
2425
-			'previous_data' => is_wp_error( $original_changeset_data ) ? array() : $original_changeset_data,
2425
+			'previous_data' => is_wp_error($original_changeset_data) ? array() : $original_changeset_data,
2426 2426
 			'manager' => $this,
2427 2427
 		);
2428 2428
 
@@ -2446,82 +2446,82 @@  discard block
 block discarded – undo
2446 2446
 		 *     @type WP_Customize_Manager $manager       Manager instance.
2447 2447
 		 * }
2448 2448
 		 */
2449
-		$data = apply_filters( 'customize_changeset_save_data', $data, $filter_context );
2449
+		$data = apply_filters('customize_changeset_save_data', $data, $filter_context);
2450 2450
 
2451 2451
 		// Switch theme if publishing changes now.
2452
-		if ( 'publish' === $args['status'] && ! $this->is_theme_active() ) {
2452
+		if ('publish' === $args['status'] && ! $this->is_theme_active()) {
2453 2453
 			// Temporarily stop previewing the theme to allow switch_themes() to operate properly.
2454 2454
 			$this->stop_previewing_theme();
2455
-			switch_theme( $this->get_stylesheet() );
2456
-			update_option( 'theme_switched_via_customizer', true );
2455
+			switch_theme($this->get_stylesheet());
2456
+			update_option('theme_switched_via_customizer', true);
2457 2457
 			$this->start_previewing_theme();
2458 2458
 		}
2459 2459
 
2460 2460
 		// Gather the data for wp_insert_post()/wp_update_post().
2461 2461
 		$json_options = 0;
2462
-		if ( defined( 'JSON_UNESCAPED_SLASHES' ) ) {
2462
+		if (defined('JSON_UNESCAPED_SLASHES')) {
2463 2463
 			$json_options |= JSON_UNESCAPED_SLASHES; // Introduced in PHP 5.4. This is only to improve readability as slashes needn't be escaped in storage.
2464 2464
 		}
2465 2465
 		$json_options |= JSON_PRETTY_PRINT; // Also introduced in PHP 5.4, but WP defines constant for back compat. See WP Trac #30139.
2466 2466
 		$post_array = array(
2467
-			'post_content' => wp_json_encode( $data, $json_options ),
2467
+			'post_content' => wp_json_encode($data, $json_options),
2468 2468
 		);
2469
-		if ( $args['title'] ) {
2469
+		if ($args['title']) {
2470 2470
 			$post_array['post_title'] = $args['title'];
2471 2471
 		}
2472
-		if ( $changeset_post_id ) {
2472
+		if ($changeset_post_id) {
2473 2473
 			$post_array['ID'] = $changeset_post_id;
2474 2474
 		} else {
2475 2475
 			$post_array['post_type'] = 'customize_changeset';
2476 2476
 			$post_array['post_name'] = $this->changeset_uuid();
2477 2477
 			$post_array['post_status'] = 'auto-draft';
2478 2478
 		}
2479
-		if ( $args['status'] ) {
2479
+		if ($args['status']) {
2480 2480
 			$post_array['post_status'] = $args['status'];
2481 2481
 		}
2482 2482
 
2483 2483
 		// Reset post date to now if we are publishing, otherwise pass post_date_gmt and translate for post_date.
2484
-		if ( 'publish' === $args['status'] ) {
2484
+		if ('publish' === $args['status']) {
2485 2485
 			$post_array['post_date_gmt'] = '0000-00-00 00:00:00';
2486 2486
 			$post_array['post_date'] = '0000-00-00 00:00:00';
2487
-		} elseif ( $args['date_gmt'] ) {
2487
+		} elseif ($args['date_gmt']) {
2488 2488
 			$post_array['post_date_gmt'] = $args['date_gmt'];
2489
-			$post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] );
2489
+			$post_array['post_date'] = get_date_from_gmt($args['date_gmt']);
2490 2490
 		}
2491 2491
 
2492 2492
 		$this->store_changeset_revision = $allow_revision;
2493
-		add_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ), 5, 3 );
2493
+		add_filter('wp_save_post_revision_post_has_changed', array($this, '_filter_revision_post_has_changed'), 5, 3);
2494 2494
 
2495 2495
 		// Update the changeset post. The publish_customize_changeset action will cause the settings in the changeset to be saved via WP_Customize_Setting::save().
2496
-		$has_kses = ( false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ) );
2497
-		if ( $has_kses ) {
2496
+		$has_kses = (false !== has_filter('content_save_pre', 'wp_filter_post_kses'));
2497
+		if ($has_kses) {
2498 2498
 			kses_remove_filters(); // Prevent KSES from corrupting JSON in post_content.
2499 2499
 		}
2500 2500
 
2501 2501
 		// Note that updating a post with publish status will trigger WP_Customize_Manager::publish_changeset_values().
2502
-		if ( $changeset_post_id ) {
2502
+		if ($changeset_post_id) {
2503 2503
 			$post_array['edit_date'] = true; // Prevent date clearing.
2504
-			$r = wp_update_post( wp_slash( $post_array ), true );
2504
+			$r = wp_update_post(wp_slash($post_array), true);
2505 2505
 		} else {
2506
-			$r = wp_insert_post( wp_slash( $post_array ), true );
2507
-			if ( ! is_wp_error( $r ) ) {
2506
+			$r = wp_insert_post(wp_slash($post_array), true);
2507
+			if ( ! is_wp_error($r)) {
2508 2508
 				$this->_changeset_post_id = $r; // Update cached post ID for the loaded changeset.
2509 2509
 			}
2510 2510
 		}
2511
-		if ( $has_kses ) {
2511
+		if ($has_kses) {
2512 2512
 			kses_init_filters();
2513 2513
 		}
2514 2514
 		$this->_changeset_data = null; // Reset so WP_Customize_Manager::changeset_data() will re-populate with updated contents.
2515 2515
 
2516
-		remove_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ) );
2516
+		remove_filter('wp_save_post_revision_post_has_changed', array($this, '_filter_revision_post_has_changed'));
2517 2517
 
2518 2518
 		$response = array(
2519 2519
 			'setting_validities' => $setting_validities,
2520 2520
 		);
2521 2521
 
2522
-		if ( is_wp_error( $r ) ) {
2522
+		if (is_wp_error($r)) {
2523 2523
 			$response['changeset_post_save_failure'] = $r->get_error_code();
2524
-			return new WP_Error( 'changeset_post_save_failure', '', $response );
2524
+			return new WP_Error('changeset_post_save_failure', '', $response);
2525 2525
 		}
2526 2526
 
2527 2527
 		return $response;
@@ -2550,9 +2550,9 @@  discard block
 block discarded – undo
2550 2550
 	 *
2551 2551
 	 * @return bool Whether a revision should be made.
2552 2552
 	 */
2553
-	public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) {
2554
-		unset( $last_revision );
2555
-		if ( 'customize_changeset' === $post->post_type ) {
2553
+	public function _filter_revision_post_has_changed($post_has_changed, $last_revision, $post) {
2554
+		unset($last_revision);
2555
+		if ('customize_changeset' === $post->post_type) {
2556 2556
 			$post_has_changed = $this->store_changeset_revision;
2557 2557
 		}
2558 2558
 		return $post_has_changed;
@@ -2578,13 +2578,13 @@  discard block
 block discarded – undo
2578 2578
 	 * @param int $changeset_post_id ID for customize_changeset post. Defaults to the changeset for the current manager instance.
2579 2579
 	 * @return true|WP_Error True or error info.
2580 2580
 	 */
2581
-	public function _publish_changeset_values( $changeset_post_id ) {
2582
-		$publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2583
-		if ( is_wp_error( $publishing_changeset_data ) ) {
2581
+	public function _publish_changeset_values($changeset_post_id) {
2582
+		$publishing_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2583
+		if (is_wp_error($publishing_changeset_data)) {
2584 2584
 			return $publishing_changeset_data;
2585 2585
 		}
2586 2586
 
2587
-		$changeset_post = get_post( $changeset_post_id );
2587
+		$changeset_post = get_post($changeset_post_id);
2588 2588
 
2589 2589
 		/*
2590 2590
 		 * Temporarily override the changeset context so that it will be read
@@ -2603,24 +2603,24 @@  discard block
 block discarded – undo
2603 2603
 		$theme_mod_settings = array();
2604 2604
 		$namespace_pattern = '/^(?P<stylesheet>.+?)::(?P<setting_id>.+)$/';
2605 2605
 		$matches = array();
2606
-		foreach ( $this->_changeset_data as $raw_setting_id => $setting_params ) {
2606
+		foreach ($this->_changeset_data as $raw_setting_id => $setting_params) {
2607 2607
 			$actual_setting_id = null;
2608 2608
 			$is_theme_mod_setting = (
2609
-				isset( $setting_params['value'] )
2609
+				isset($setting_params['value'])
2610 2610
 				&&
2611
-				isset( $setting_params['type'] )
2611
+				isset($setting_params['type'])
2612 2612
 				&&
2613 2613
 				'theme_mod' === $setting_params['type']
2614 2614
 				&&
2615
-				preg_match( $namespace_pattern, $raw_setting_id, $matches )
2615
+				preg_match($namespace_pattern, $raw_setting_id, $matches)
2616 2616
 			);
2617
-			if ( $is_theme_mod_setting ) {
2618
-				if ( ! isset( $theme_mod_settings[ $matches['stylesheet'] ] ) ) {
2619
-					$theme_mod_settings[ $matches['stylesheet'] ] = array();
2617
+			if ($is_theme_mod_setting) {
2618
+				if ( ! isset($theme_mod_settings[$matches['stylesheet']])) {
2619
+					$theme_mod_settings[$matches['stylesheet']] = array();
2620 2620
 				}
2621
-				$theme_mod_settings[ $matches['stylesheet'] ][ $matches['setting_id'] ] = $setting_params;
2621
+				$theme_mod_settings[$matches['stylesheet']][$matches['setting_id']] = $setting_params;
2622 2622
 
2623
-				if ( $this->get_stylesheet() === $matches['stylesheet'] ) {
2623
+				if ($this->get_stylesheet() === $matches['stylesheet']) {
2624 2624
 					$actual_setting_id = $matches['setting_id'];
2625 2625
 				}
2626 2626
 			} else {
@@ -2628,17 +2628,17 @@  discard block
 block discarded – undo
2628 2628
 			}
2629 2629
 
2630 2630
 			// Keep track of the user IDs for settings actually for this theme.
2631
-			if ( $actual_setting_id && isset( $setting_params['user_id'] ) ) {
2632
-				$setting_user_ids[ $actual_setting_id ] = $setting_params['user_id'];
2631
+			if ($actual_setting_id && isset($setting_params['user_id'])) {
2632
+				$setting_user_ids[$actual_setting_id] = $setting_params['user_id'];
2633 2633
 			}
2634 2634
 		}
2635 2635
 
2636
-		$changeset_setting_values = $this->unsanitized_post_values( array(
2636
+		$changeset_setting_values = $this->unsanitized_post_values(array(
2637 2637
 			'exclude_post_data' => true,
2638 2638
 			'exclude_changeset' => false,
2639
-		) );
2640
-		$changeset_setting_ids = array_keys( $changeset_setting_values );
2641
-		$this->add_dynamic_settings( $changeset_setting_ids );
2639
+		));
2640
+		$changeset_setting_ids = array_keys($changeset_setting_values);
2641
+		$this->add_dynamic_settings($changeset_setting_ids);
2642 2642
 
2643 2643
 		/**
2644 2644
 		 * Fires once the theme has switched in the Customizer, but before settings
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
 		 *
2649 2649
 		 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
2650 2650
 		 */
2651
-		do_action( 'customize_save', $this );
2651
+		do_action('customize_save', $this);
2652 2652
 
2653 2653
 		/*
2654 2654
 		 * Ensure that all settings will allow themselves to be saved. Note that
@@ -2657,18 +2657,18 @@  discard block
 block discarded – undo
2657 2657
 		 * an additional capability check is not required here.
2658 2658
 		 */
2659 2659
 		$original_setting_capabilities = array();
2660
-		foreach ( $changeset_setting_ids as $setting_id ) {
2661
-			$setting = $this->get_setting( $setting_id );
2662
-			if ( $setting && ! isset( $setting_user_ids[ $setting_id ] ) ) {
2663
-				$original_setting_capabilities[ $setting->id ] = $setting->capability;
2660
+		foreach ($changeset_setting_ids as $setting_id) {
2661
+			$setting = $this->get_setting($setting_id);
2662
+			if ($setting && ! isset($setting_user_ids[$setting_id])) {
2663
+				$original_setting_capabilities[$setting->id] = $setting->capability;
2664 2664
 				$setting->capability = 'exist';
2665 2665
 			}
2666 2666
 		}
2667 2667
 
2668 2668
 		$original_user_id = get_current_user_id();
2669
-		foreach ( $changeset_setting_ids as $setting_id ) {
2670
-			$setting = $this->get_setting( $setting_id );
2671
-			if ( $setting ) {
2669
+		foreach ($changeset_setting_ids as $setting_id) {
2670
+			$setting = $this->get_setting($setting_id);
2671
+			if ($setting) {
2672 2672
 				/*
2673 2673
 				 * Set the current user to match the user who saved the value into
2674 2674
 				 * the changeset so that any filters that apply during the save
@@ -2676,22 +2676,22 @@  discard block
 block discarded – undo
2676 2676
 				 * will ensure, for example, that KSES won't strip unsafe HTML
2677 2677
 				 * when a scheduled changeset publishes via WP Cron.
2678 2678
 				 */
2679
-				if ( isset( $setting_user_ids[ $setting_id ] ) ) {
2680
-					wp_set_current_user( $setting_user_ids[ $setting_id ] );
2679
+				if (isset($setting_user_ids[$setting_id])) {
2680
+					wp_set_current_user($setting_user_ids[$setting_id]);
2681 2681
 				} else {
2682
-					wp_set_current_user( $original_user_id );
2682
+					wp_set_current_user($original_user_id);
2683 2683
 				}
2684 2684
 
2685 2685
 				$setting->save();
2686 2686
 			}
2687 2687
 		}
2688
-		wp_set_current_user( $original_user_id );
2688
+		wp_set_current_user($original_user_id);
2689 2689
 
2690 2690
 		// Update the stashed theme mod settings, removing the active theme's stashed settings, if activated.
2691
-		if ( did_action( 'switch_theme' ) ) {
2691
+		if (did_action('switch_theme')) {
2692 2692
 			$other_theme_mod_settings = $theme_mod_settings;
2693
-			unset( $other_theme_mod_settings[ $this->get_stylesheet() ] );
2694
-			$this->update_stashed_theme_mod_settings( $other_theme_mod_settings );
2693
+			unset($other_theme_mod_settings[$this->get_stylesheet()]);
2694
+			$this->update_stashed_theme_mod_settings($other_theme_mod_settings);
2695 2695
 		}
2696 2696
 
2697 2697
 		/**
@@ -2701,12 +2701,12 @@  discard block
 block discarded – undo
2701 2701
 		 *
2702 2702
 		 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
2703 2703
 		 */
2704
-		do_action( 'customize_save_after', $this );
2704
+		do_action('customize_save_after', $this);
2705 2705
 
2706 2706
 		// Restore original capabilities.
2707
-		foreach ( $original_setting_capabilities as $setting_id => $capability ) {
2708
-			$setting = $this->get_setting( $setting_id );
2709
-			if ( $setting ) {
2707
+		foreach ($original_setting_capabilities as $setting_id => $capability) {
2708
+			$setting = $this->get_setting($setting_id);
2709
+			if ($setting) {
2710 2710
 				$setting->capability = $capability;
2711 2711
 			}
2712 2712
 		}
@@ -2728,30 +2728,30 @@  discard block
 block discarded – undo
2728 2728
 	 * @param array $inactive_theme_mod_settings Mapping of stylesheet to arrays of theme mod settings.
2729 2729
 	 * @return array|false Returns array of updated stashed theme mods or false if the update failed or there were no changes.
2730 2730
 	 */
2731
-	protected function update_stashed_theme_mod_settings( $inactive_theme_mod_settings ) {
2732
-		$stashed_theme_mod_settings = get_option( 'customize_stashed_theme_mods' );
2733
-		if ( empty( $stashed_theme_mod_settings ) ) {
2731
+	protected function update_stashed_theme_mod_settings($inactive_theme_mod_settings) {
2732
+		$stashed_theme_mod_settings = get_option('customize_stashed_theme_mods');
2733
+		if (empty($stashed_theme_mod_settings)) {
2734 2734
 			$stashed_theme_mod_settings = array();
2735 2735
 		}
2736 2736
 
2737 2737
 		// Delete any stashed theme mods for the active theme since since they would have been loaded and saved upon activation.
2738
-		unset( $stashed_theme_mod_settings[ $this->get_stylesheet() ] );
2738
+		unset($stashed_theme_mod_settings[$this->get_stylesheet()]);
2739 2739
 
2740 2740
 		// Merge inactive theme mods with the stashed theme mod settings.
2741
-		foreach ( $inactive_theme_mod_settings as $stylesheet => $theme_mod_settings ) {
2742
-			if ( ! isset( $stashed_theme_mod_settings[ $stylesheet ] ) ) {
2743
-				$stashed_theme_mod_settings[ $stylesheet ] = array();
2741
+		foreach ($inactive_theme_mod_settings as $stylesheet => $theme_mod_settings) {
2742
+			if ( ! isset($stashed_theme_mod_settings[$stylesheet])) {
2743
+				$stashed_theme_mod_settings[$stylesheet] = array();
2744 2744
 			}
2745 2745
 
2746
-			$stashed_theme_mod_settings[ $stylesheet ] = array_merge(
2747
-				$stashed_theme_mod_settings[ $stylesheet ],
2746
+			$stashed_theme_mod_settings[$stylesheet] = array_merge(
2747
+				$stashed_theme_mod_settings[$stylesheet],
2748 2748
 				$theme_mod_settings
2749 2749
 			);
2750 2750
 		}
2751 2751
 
2752 2752
 		$autoload = false;
2753
-		$result = update_option( 'customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload );
2754
-		if ( ! $result ) {
2753
+		$result = update_option('customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload);
2754
+		if ( ! $result) {
2755 2755
 			return false;
2756 2756
 		}
2757 2757
 		return $stashed_theme_mod_settings;
@@ -2763,11 +2763,11 @@  discard block
 block discarded – undo
2763 2763
 	 * @since 4.2.0
2764 2764
 	 */
2765 2765
 	public function refresh_nonces() {
2766
-		if ( ! $this->is_preview() ) {
2767
-			wp_send_json_error( 'not_preview' );
2766
+		if ( ! $this->is_preview()) {
2767
+			wp_send_json_error('not_preview');
2768 2768
 		}
2769 2769
 
2770
-		wp_send_json_success( $this->get_nonces() );
2770
+		wp_send_json_success($this->get_nonces());
2771 2771
 	}
2772 2772
 
2773 2773
 	/**
@@ -2782,22 +2782,22 @@  discard block
 block discarded – undo
2782 2782
 	 *                                          constructor.
2783 2783
 	 * @return WP_Customize_Setting             The instance of the setting that was added.
2784 2784
 	 */
2785
-	public function add_setting( $id, $args = array() ) {
2786
-		if ( $id instanceof WP_Customize_Setting ) {
2785
+	public function add_setting($id, $args = array()) {
2786
+		if ($id instanceof WP_Customize_Setting) {
2787 2787
 			$setting = $id;
2788 2788
 		} else {
2789 2789
 			$class = 'WP_Customize_Setting';
2790 2790
 
2791 2791
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
2792
-			$args = apply_filters( 'customize_dynamic_setting_args', $args, $id );
2792
+			$args = apply_filters('customize_dynamic_setting_args', $args, $id);
2793 2793
 
2794 2794
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
2795
-			$class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args );
2795
+			$class = apply_filters('customize_dynamic_setting_class', $class, $id, $args);
2796 2796
 
2797
-			$setting = new $class( $this, $id, $args );
2797
+			$setting = new $class($this, $id, $args);
2798 2798
 		}
2799 2799
 
2800
-		$this->settings[ $setting->id ] = $setting;
2800
+		$this->settings[$setting->id] = $setting;
2801 2801
 		return $setting;
2802 2802
 	}
2803 2803
 
@@ -2816,11 +2816,11 @@  discard block
 block discarded – undo
2816 2816
 	 * @param array $setting_ids The setting IDs to add.
2817 2817
 	 * @return array The WP_Customize_Setting objects added.
2818 2818
 	 */
2819
-	public function add_dynamic_settings( $setting_ids ) {
2819
+	public function add_dynamic_settings($setting_ids) {
2820 2820
 		$new_settings = array();
2821
-		foreach ( $setting_ids as $setting_id ) {
2821
+		foreach ($setting_ids as $setting_id) {
2822 2822
 			// Skip settings already created
2823
-			if ( $this->get_setting( $setting_id ) ) {
2823
+			if ($this->get_setting($setting_id)) {
2824 2824
 				continue;
2825 2825
 			}
2826 2826
 
@@ -2839,8 +2839,8 @@  discard block
 block discarded – undo
2839 2839
 			 * @param false|array $setting_args The arguments to the WP_Customize_Setting constructor.
2840 2840
 			 * @param string      $setting_id   ID for dynamic setting, usually coming from `$_POST['customized']`.
2841 2841
 			 */
2842
-			$setting_args = apply_filters( 'customize_dynamic_setting_args', $setting_args, $setting_id );
2843
-			if ( false === $setting_args ) {
2842
+			$setting_args = apply_filters('customize_dynamic_setting_args', $setting_args, $setting_id);
2843
+			if (false === $setting_args) {
2844 2844
 				continue;
2845 2845
 			}
2846 2846
 
@@ -2853,11 +2853,11 @@  discard block
 block discarded – undo
2853 2853
 			 * @param string $setting_id    ID for dynamic setting, usually coming from `$_POST['customized']`.
2854 2854
 			 * @param array  $setting_args  WP_Customize_Setting or a subclass.
2855 2855
 			 */
2856
-			$setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args );
2856
+			$setting_class = apply_filters('customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args);
2857 2857
 
2858
-			$setting = new $setting_class( $this, $setting_id, $setting_args );
2858
+			$setting = new $setting_class($this, $setting_id, $setting_args);
2859 2859
 
2860
-			$this->add_setting( $setting );
2860
+			$this->add_setting($setting);
2861 2861
 			$new_settings[] = $setting;
2862 2862
 		}
2863 2863
 		return $new_settings;
@@ -2871,9 +2871,9 @@  discard block
 block discarded – undo
2871 2871
 	 * @param string $id Customize Setting ID.
2872 2872
 	 * @return WP_Customize_Setting|void The setting, if set.
2873 2873
 	 */
2874
-	public function get_setting( $id ) {
2875
-		if ( isset( $this->settings[ $id ] ) ) {
2876
-			return $this->settings[ $id ];
2874
+	public function get_setting($id) {
2875
+		if (isset($this->settings[$id])) {
2876
+			return $this->settings[$id];
2877 2877
 		}
2878 2878
 	}
2879 2879
 
@@ -2884,8 +2884,8 @@  discard block
 block discarded – undo
2884 2884
 	 *
2885 2885
 	 * @param string $id Customize Setting ID.
2886 2886
 	 */
2887
-	public function remove_setting( $id ) {
2888
-		unset( $this->settings[ $id ] );
2887
+	public function remove_setting($id) {
2888
+		unset($this->settings[$id]);
2889 2889
 	}
2890 2890
 
2891 2891
 	/**
@@ -2900,14 +2900,14 @@  discard block
 block discarded – undo
2900 2900
 	 *
2901 2901
 	 * @return WP_Customize_Panel             The instance of the panel that was added.
2902 2902
 	 */
2903
-	public function add_panel( $id, $args = array() ) {
2904
-		if ( $id instanceof WP_Customize_Panel ) {
2903
+	public function add_panel($id, $args = array()) {
2904
+		if ($id instanceof WP_Customize_Panel) {
2905 2905
 			$panel = $id;
2906 2906
 		} else {
2907
-			$panel = new WP_Customize_Panel( $this, $id, $args );
2907
+			$panel = new WP_Customize_Panel($this, $id, $args);
2908 2908
 		}
2909 2909
 
2910
-		$this->panels[ $panel->id ] = $panel;
2910
+		$this->panels[$panel->id] = $panel;
2911 2911
 		return $panel;
2912 2912
 	}
2913 2913
 
@@ -2920,9 +2920,9 @@  discard block
 block discarded – undo
2920 2920
 	 * @param string $id Panel ID to get.
2921 2921
 	 * @return WP_Customize_Panel|void Requested panel instance, if set.
2922 2922
 	 */
2923
-	public function get_panel( $id ) {
2924
-		if ( isset( $this->panels[ $id ] ) ) {
2925
-			return $this->panels[ $id ];
2923
+	public function get_panel($id) {
2924
+		if (isset($this->panels[$id])) {
2925
+			return $this->panels[$id];
2926 2926
 		}
2927 2927
 	}
2928 2928
 
@@ -2934,18 +2934,18 @@  discard block
 block discarded – undo
2934 2934
 	 *
2935 2935
 	 * @param string $id Panel ID to remove.
2936 2936
 	 */
2937
-	public function remove_panel( $id ) {
2937
+	public function remove_panel($id) {
2938 2938
 		// Removing core components this way is _doing_it_wrong().
2939
-		if ( in_array( $id, $this->components, true ) ) {
2939
+		if (in_array($id, $this->components, true)) {
2940 2940
 			/* translators: 1: panel id, 2: link to 'customize_loaded_components' filter reference */
2941
-			$message = sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ),
2941
+			$message = sprintf(__('Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.'),
2942 2942
 				$id,
2943
-				'<a href="' . esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ) . '"><code>customize_loaded_components</code></a>'
2943
+				'<a href="'.esc_url('https://developer.wordpress.org/reference/hooks/customize_loaded_components/').'"><code>customize_loaded_components</code></a>'
2944 2944
 			);
2945 2945
 
2946
-			_doing_it_wrong( __METHOD__, $message, '4.5.0' );
2946
+			_doing_it_wrong(__METHOD__, $message, '4.5.0');
2947 2947
 		}
2948
-		unset( $this->panels[ $id ] );
2948
+		unset($this->panels[$id]);
2949 2949
 	}
2950 2950
 
2951 2951
 	/**
@@ -2960,7 +2960,7 @@  discard block
 block discarded – undo
2960 2960
 	 *
2961 2961
 	 * @param string $panel Name of a custom panel which is a subclass of WP_Customize_Panel.
2962 2962
 	 */
2963
-	public function register_panel_type( $panel ) {
2963
+	public function register_panel_type($panel) {
2964 2964
 		$this->registered_panel_types[] = $panel;
2965 2965
 	}
2966 2966
 
@@ -2971,8 +2971,8 @@  discard block
 block discarded – undo
2971 2971
 	 * @access public
2972 2972
 	 */
2973 2973
 	public function render_panel_templates() {
2974
-		foreach ( $this->registered_panel_types as $panel_type ) {
2975
-			$panel = new $panel_type( $this, 'temp', array() );
2974
+		foreach ($this->registered_panel_types as $panel_type) {
2975
+			$panel = new $panel_type($this, 'temp', array());
2976 2976
 			$panel->print_template();
2977 2977
 		}
2978 2978
 	}
@@ -2989,14 +2989,14 @@  discard block
 block discarded – undo
2989 2989
 	 *
2990 2990
 	 * @return WP_Customize_Section             The instance of the section that was added.
2991 2991
 	 */
2992
-	public function add_section( $id, $args = array() ) {
2993
-		if ( $id instanceof WP_Customize_Section ) {
2992
+	public function add_section($id, $args = array()) {
2993
+		if ($id instanceof WP_Customize_Section) {
2994 2994
 			$section = $id;
2995 2995
 		} else {
2996
-			$section = new WP_Customize_Section( $this, $id, $args );
2996
+			$section = new WP_Customize_Section($this, $id, $args);
2997 2997
 		}
2998 2998
 
2999
-		$this->sections[ $section->id ] = $section;
2999
+		$this->sections[$section->id] = $section;
3000 3000
 		return $section;
3001 3001
 	}
3002 3002
 
@@ -3008,9 +3008,9 @@  discard block
 block discarded – undo
3008 3008
 	 * @param string $id Section ID.
3009 3009
 	 * @return WP_Customize_Section|void The section, if set.
3010 3010
 	 */
3011
-	public function get_section( $id ) {
3012
-		if ( isset( $this->sections[ $id ] ) )
3013
-			return $this->sections[ $id ];
3011
+	public function get_section($id) {
3012
+		if (isset($this->sections[$id]))
3013
+			return $this->sections[$id];
3014 3014
 	}
3015 3015
 
3016 3016
 	/**
@@ -3020,8 +3020,8 @@  discard block
 block discarded – undo
3020 3020
 	 *
3021 3021
 	 * @param string $id Section ID.
3022 3022
 	 */
3023
-	public function remove_section( $id ) {
3024
-		unset( $this->sections[ $id ] );
3023
+	public function remove_section($id) {
3024
+		unset($this->sections[$id]);
3025 3025
 	}
3026 3026
 
3027 3027
 	/**
@@ -3036,7 +3036,7 @@  discard block
 block discarded – undo
3036 3036
 	 *
3037 3037
 	 * @param string $section Name of a custom section which is a subclass of WP_Customize_Section.
3038 3038
 	 */
3039
-	public function register_section_type( $section ) {
3039
+	public function register_section_type($section) {
3040 3040
 		$this->registered_section_types[] = $section;
3041 3041
 	}
3042 3042
 
@@ -3047,8 +3047,8 @@  discard block
 block discarded – undo
3047 3047
 	 * @access public
3048 3048
 	 */
3049 3049
 	public function render_section_templates() {
3050
-		foreach ( $this->registered_section_types as $section_type ) {
3051
-			$section = new $section_type( $this, 'temp', array() );
3050
+		foreach ($this->registered_section_types as $section_type) {
3051
+			$section = new $section_type($this, 'temp', array());
3052 3052
 			$section->print_template();
3053 3053
 		}
3054 3054
 	}
@@ -3065,14 +3065,14 @@  discard block
 block discarded – undo
3065 3065
 	 *                                          constructor.
3066 3066
 	 * @return WP_Customize_Control             The instance of the control that was added.
3067 3067
 	 */
3068
-	public function add_control( $id, $args = array() ) {
3069
-		if ( $id instanceof WP_Customize_Control ) {
3068
+	public function add_control($id, $args = array()) {
3069
+		if ($id instanceof WP_Customize_Control) {
3070 3070
 			$control = $id;
3071 3071
 		} else {
3072
-			$control = new WP_Customize_Control( $this, $id, $args );
3072
+			$control = new WP_Customize_Control($this, $id, $args);
3073 3073
 		}
3074 3074
 
3075
-		$this->controls[ $control->id ] = $control;
3075
+		$this->controls[$control->id] = $control;
3076 3076
 		return $control;
3077 3077
 	}
3078 3078
 
@@ -3084,9 +3084,9 @@  discard block
 block discarded – undo
3084 3084
 	 * @param string $id ID of the control.
3085 3085
 	 * @return WP_Customize_Control|void The control object, if set.
3086 3086
 	 */
3087
-	public function get_control( $id ) {
3088
-		if ( isset( $this->controls[ $id ] ) )
3089
-			return $this->controls[ $id ];
3087
+	public function get_control($id) {
3088
+		if (isset($this->controls[$id]))
3089
+			return $this->controls[$id];
3090 3090
 	}
3091 3091
 
3092 3092
 	/**
@@ -3096,8 +3096,8 @@  discard block
 block discarded – undo
3096 3096
 	 *
3097 3097
 	 * @param string $id ID of the control.
3098 3098
 	 */
3099
-	public function remove_control( $id ) {
3100
-		unset( $this->controls[ $id ] );
3099
+	public function remove_control($id) {
3100
+		unset($this->controls[$id]);
3101 3101
 	}
3102 3102
 
3103 3103
 	/**
@@ -3111,7 +3111,7 @@  discard block
 block discarded – undo
3111 3111
 	 * @param string $control Name of a custom control which is a subclass of
3112 3112
 	 *                        WP_Customize_Control.
3113 3113
 	 */
3114
-	public function register_control_type( $control ) {
3114
+	public function register_control_type($control) {
3115 3115
 		$this->registered_control_types[] = $control;
3116 3116
 	}
3117 3117
 
@@ -3122,10 +3122,10 @@  discard block
 block discarded – undo
3122 3122
 	 * @access public
3123 3123
 	 */
3124 3124
 	public function render_control_templates() {
3125
-		foreach ( $this->registered_control_types as $control_type ) {
3126
-			$control = new $control_type( $this, 'temp', array(
3125
+		foreach ($this->registered_control_types as $control_type) {
3126
+			$control = new $control_type($this, 'temp', array(
3127 3127
 				'settings' => array(),
3128
-			) );
3128
+			));
3129 3129
 			$control->print_template();
3130 3130
 		}
3131 3131
 		?>
@@ -3149,10 +3149,10 @@  discard block
 block discarded – undo
3149 3149
 	 * @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b Object B.
3150 3150
 	 * @return int
3151 3151
 	 */
3152
-	protected function _cmp_priority( $a, $b ) {
3153
-		_deprecated_function( __METHOD__, '4.7.0', 'wp_list_sort' );
3152
+	protected function _cmp_priority($a, $b) {
3153
+		_deprecated_function(__METHOD__, '4.7.0', 'wp_list_sort');
3154 3154
 
3155
-		if ( $a->priority === $b->priority ) {
3155
+		if ($a->priority === $b->priority) {
3156 3156
 			return $a->instance_number - $b->instance_number;
3157 3157
 		} else {
3158 3158
 			return $a->priority - $b->priority;
@@ -3171,77 +3171,77 @@  discard block
 block discarded – undo
3171 3171
 	public function prepare_controls() {
3172 3172
 
3173 3173
 		$controls = array();
3174
-		$this->controls = wp_list_sort( $this->controls, array(
3174
+		$this->controls = wp_list_sort($this->controls, array(
3175 3175
 			'priority'        => 'ASC',
3176 3176
 			'instance_number' => 'ASC',
3177
-		), 'ASC', true );
3177
+		), 'ASC', true);
3178 3178
 
3179
-		foreach ( $this->controls as $id => $control ) {
3180
-			if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
3179
+		foreach ($this->controls as $id => $control) {
3180
+			if ( ! isset($this->sections[$control->section]) || ! $control->check_capabilities()) {
3181 3181
 				continue;
3182 3182
 			}
3183 3183
 
3184
-			$this->sections[ $control->section ]->controls[] = $control;
3185
-			$controls[ $id ] = $control;
3184
+			$this->sections[$control->section]->controls[] = $control;
3185
+			$controls[$id] = $control;
3186 3186
 		}
3187 3187
 		$this->controls = $controls;
3188 3188
 
3189 3189
 		// Prepare sections.
3190
-		$this->sections = wp_list_sort( $this->sections, array(
3190
+		$this->sections = wp_list_sort($this->sections, array(
3191 3191
 			'priority'        => 'ASC',
3192 3192
 			'instance_number' => 'ASC',
3193
-		), 'ASC', true );
3193
+		), 'ASC', true);
3194 3194
 		$sections = array();
3195 3195
 
3196
-		foreach ( $this->sections as $section ) {
3197
-			if ( ! $section->check_capabilities() ) {
3196
+		foreach ($this->sections as $section) {
3197
+			if ( ! $section->check_capabilities()) {
3198 3198
 				continue;
3199 3199
 			}
3200 3200
 
3201 3201
 
3202
-			$section->controls = wp_list_sort( $section->controls, array(
3202
+			$section->controls = wp_list_sort($section->controls, array(
3203 3203
 				'priority'        => 'ASC',
3204 3204
 				'instance_number' => 'ASC',
3205
-			) );
3205
+			));
3206 3206
 
3207
-			if ( ! $section->panel ) {
3207
+			if ( ! $section->panel) {
3208 3208
 				// Top-level section.
3209
-				$sections[ $section->id ] = $section;
3209
+				$sections[$section->id] = $section;
3210 3210
 			} else {
3211 3211
 				// This section belongs to a panel.
3212
-				if ( isset( $this->panels [ $section->panel ] ) ) {
3213
-					$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
3212
+				if (isset($this->panels [$section->panel])) {
3213
+					$this->panels[$section->panel]->sections[$section->id] = $section;
3214 3214
 				}
3215 3215
 			}
3216 3216
 		}
3217 3217
 		$this->sections = $sections;
3218 3218
 
3219 3219
 		// Prepare panels.
3220
-		$this->panels = wp_list_sort( $this->panels, array(
3220
+		$this->panels = wp_list_sort($this->panels, array(
3221 3221
 			'priority'        => 'ASC',
3222 3222
 			'instance_number' => 'ASC',
3223
-		), 'ASC', true );
3223
+		), 'ASC', true);
3224 3224
 		$panels = array();
3225 3225
 
3226
-		foreach ( $this->panels as $panel ) {
3227
-			if ( ! $panel->check_capabilities() ) {
3226
+		foreach ($this->panels as $panel) {
3227
+			if ( ! $panel->check_capabilities()) {
3228 3228
 				continue;
3229 3229
 			}
3230 3230
 
3231
-			$panel->sections = wp_list_sort( $panel->sections, array(
3231
+			$panel->sections = wp_list_sort($panel->sections, array(
3232 3232
 				'priority'        => 'ASC',
3233 3233
 				'instance_number' => 'ASC',
3234
-			), 'ASC', true );
3235
-			$panels[ $panel->id ] = $panel;
3234
+			), 'ASC', true);
3235
+			$panels[$panel->id] = $panel;
3236 3236
 		}
3237 3237
 		$this->panels = $panels;
3238 3238
 
3239 3239
 		// Sort panels and top-level sections together.
3240
-		$this->containers = array_merge( $this->panels, $this->sections );
3241
-		$this->containers = wp_list_sort( $this->containers, array(
3240
+		$this->containers = array_merge($this->panels, $this->sections);
3241
+		$this->containers = wp_list_sort($this->containers, array(
3242 3242
 			'priority'        => 'ASC',
3243 3243
 			'instance_number' => 'ASC',
3244
-		), 'ASC', true );
3244
+		), 'ASC', true);
3245 3245
 	}
3246 3246
 
3247 3247
 	/**
@@ -3250,7 +3250,7 @@  discard block
 block discarded – undo
3250 3250
 	 * @since 3.4.0
3251 3251
 	 */
3252 3252
 	public function enqueue_control_scripts() {
3253
-		foreach ( $this->controls as $control ) {
3253
+		foreach ($this->controls as $control) {
3254 3254
 			$control->enqueue();
3255 3255
 		}
3256 3256
 	}
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
 	 * @return bool Whether the user agent is iOS.
3265 3265
 	 */
3266 3266
 	public function is_ios() {
3267
-		return wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] );
3267
+		return wp_is_mobile() && preg_match('/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT']);
3268 3268
 	}
3269 3269
 
3270 3270
 	/**
@@ -3276,14 +3276,14 @@  discard block
 block discarded – undo
3276 3276
 	 * @return string The template string for the document title.
3277 3277
 	 */
3278 3278
 	public function get_document_title_template() {
3279
-		if ( $this->is_theme_active() ) {
3279
+		if ($this->is_theme_active()) {
3280 3280
 			/* translators: %s: document title from the preview */
3281
-			$document_title_tmpl = __( 'Customize: %s' );
3281
+			$document_title_tmpl = __('Customize: %s');
3282 3282
 		} else {
3283 3283
 			/* translators: %s: document title from the preview */
3284
-			$document_title_tmpl = __( 'Live Preview: %s' );
3284
+			$document_title_tmpl = __('Live Preview: %s');
3285 3285
 		}
3286
-		$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // Because exported to JS and assigned to document.title.
3286
+		$document_title_tmpl = html_entity_decode($document_title_tmpl, ENT_QUOTES, 'UTF-8'); // Because exported to JS and assigned to document.title.
3287 3287
 		return $document_title_tmpl;
3288 3288
 	}
3289 3289
 
@@ -3297,9 +3297,9 @@  discard block
 block discarded – undo
3297 3297
 	 *
3298 3298
 	 * @param string $preview_url URL to be previewed.
3299 3299
 	 */
3300
-	public function set_preview_url( $preview_url ) {
3301
-		$preview_url = esc_url_raw( $preview_url );
3302
-		$this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) );
3300
+	public function set_preview_url($preview_url) {
3301
+		$preview_url = esc_url_raw($preview_url);
3302
+		$this->preview_url = wp_validate_redirect($preview_url, home_url('/'));
3303 3303
 	}
3304 3304
 
3305 3305
 	/**
@@ -3311,8 +3311,8 @@  discard block
 block discarded – undo
3311 3311
 	 * @return string URL being previewed.
3312 3312
 	 */
3313 3313
 	public function get_preview_url() {
3314
-		if ( empty( $this->preview_url ) ) {
3315
-			$preview_url = home_url( '/' );
3314
+		if (empty($this->preview_url)) {
3315
+			$preview_url = home_url('/');
3316 3316
 		} else {
3317 3317
 			$preview_url = $this->preview_url;
3318 3318
 		}
@@ -3328,9 +3328,9 @@  discard block
 block discarded – undo
3328 3328
 	 * @return bool Whether cross-domain.
3329 3329
 	 */
3330 3330
 	public function is_cross_domain() {
3331
-		$admin_origin = wp_parse_url( admin_url() );
3332
-		$home_origin = wp_parse_url( home_url() );
3333
-		$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
3331
+		$admin_origin = wp_parse_url(admin_url());
3332
+		$home_origin = wp_parse_url(home_url());
3333
+		$cross_domain = (strtolower($admin_origin['host']) !== strtolower($home_origin['host']));
3334 3334
 		return $cross_domain;
3335 3335
 	}
3336 3336
 
@@ -3350,10 +3350,10 @@  discard block
 block discarded – undo
3350 3350
 	 * @returns array Allowed URLs.
3351 3351
 	 */
3352 3352
 	public function get_allowed_urls() {
3353
-		$allowed_urls = array( home_url( '/' ) );
3353
+		$allowed_urls = array(home_url('/'));
3354 3354
 
3355
-		if ( is_ssl() && ! $this->is_cross_domain() ) {
3356
-			$allowed_urls[] = home_url( '/', 'https' );
3355
+		if (is_ssl() && ! $this->is_cross_domain()) {
3356
+			$allowed_urls[] = home_url('/', 'https');
3357 3357
 		}
3358 3358
 
3359 3359
 		/**
@@ -3363,7 +3363,7 @@  discard block
 block discarded – undo
3363 3363
 		 *
3364 3364
 		 * @param array $allowed_urls An array of allowed URLs.
3365 3365
 		 */
3366
-		$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
3366
+		$allowed_urls = array_unique(apply_filters('customize_allowed_urls', $allowed_urls));
3367 3367
 
3368 3368
 		return $allowed_urls;
3369 3369
 	}
@@ -3390,10 +3390,10 @@  discard block
 block discarded – undo
3390 3390
 	 *
3391 3391
 	 * @param string $return_url URL for return link.
3392 3392
 	 */
3393
-	public function set_return_url( $return_url ) {
3394
-		$return_url = esc_url_raw( $return_url );
3395
-		$return_url = remove_query_arg( wp_removable_query_args(), $return_url );
3396
-		$return_url = wp_validate_redirect( $return_url );
3393
+	public function set_return_url($return_url) {
3394
+		$return_url = esc_url_raw($return_url);
3395
+		$return_url = remove_query_arg(wp_removable_query_args(), $return_url);
3396
+		$return_url = wp_validate_redirect($return_url);
3397 3397
 		$this->return_url = $return_url;
3398 3398
 	}
3399 3399
 
@@ -3407,16 +3407,16 @@  discard block
 block discarded – undo
3407 3407
 	 */
3408 3408
 	public function get_return_url() {
3409 3409
 		$referer = wp_get_referer();
3410
-		$excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
3410
+		$excluded_referer_basenames = array('customize.php', 'wp-login.php');
3411 3411
 
3412
-		if ( $this->return_url ) {
3412
+		if ($this->return_url) {
3413 3413
 			$return_url = $this->return_url;
3414
-		} else if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
3414
+		} else if ($referer && ! in_array(basename(parse_url($referer, PHP_URL_PATH)), $excluded_referer_basenames, true)) {
3415 3415
 			$return_url = $referer;
3416
-		} else if ( $this->preview_url ) {
3416
+		} else if ($this->preview_url) {
3417 3417
 			$return_url = $this->preview_url;
3418 3418
 		} else {
3419
-			$return_url = home_url( '/' );
3419
+			$return_url = home_url('/');
3420 3420
 		}
3421 3421
 		return $return_url;
3422 3422
 	}
@@ -3435,8 +3435,8 @@  discard block
 block discarded – undo
3435 3435
 	 *     @type string [$panel]    ID for panel to be autofocused.
3436 3436
 	 * }
3437 3437
 	 */
3438
-	public function set_autofocus( $autofocus ) {
3439
-		$this->autofocus = array_filter( wp_array_slice_assoc( $autofocus, array( 'panel', 'section', 'control' ) ), 'is_string' );
3438
+	public function set_autofocus($autofocus) {
3439
+		$this->autofocus = array_filter(wp_array_slice_assoc($autofocus, array('panel', 'section', 'control')), 'is_string');
3440 3440
 	}
3441 3441
 
3442 3442
 	/**
@@ -3465,8 +3465,8 @@  discard block
 block discarded – undo
3465 3465
 	 */
3466 3466
 	public function get_nonces() {
3467 3467
 		$nonces = array(
3468
-			'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
3469
-			'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
3468
+			'save' => wp_create_nonce('save-customize_'.$this->get_stylesheet()),
3469
+			'preview' => wp_create_nonce('preview-customize_'.$this->get_stylesheet()),
3470 3470
 		);
3471 3471
 
3472 3472
 		/**
@@ -3478,7 +3478,7 @@  discard block
 block discarded – undo
3478 3478
 		 *                                     preview actions.
3479 3479
 		 * @param WP_Customize_Manager $this   WP_Customize_Manager instance.
3480 3480
 		 */
3481
-		$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );
3481
+		$nonces = apply_filters('customize_refresh_nonces', $nonces, $this);
3482 3482
 
3483 3483
 		return $nonces;
3484 3484
 	}
@@ -3490,15 +3490,15 @@  discard block
 block discarded – undo
3490 3490
 	 */
3491 3491
 	public function customize_pane_settings() {
3492 3492
 
3493
-		$login_url = add_query_arg( array(
3493
+		$login_url = add_query_arg(array(
3494 3494
 			'interim-login' => 1,
3495 3495
 			'customize-login' => 1,
3496
-		), wp_login_url() );
3496
+		), wp_login_url());
3497 3497
 
3498 3498
 		// Ensure dirty flags are set for modified settings.
3499
-		foreach ( array_keys( $this->unsanitized_post_values() ) as $setting_id ) {
3500
-			$setting = $this->get_setting( $setting_id );
3501
-			if ( $setting ) {
3499
+		foreach (array_keys($this->unsanitized_post_values()) as $setting_id) {
3500
+			$setting = $this->get_setting($setting_id);
3501
+			if ($setting) {
3502 3502
 				$setting->dirty = true;
3503 3503
 			}
3504 3504
 		}
@@ -3507,7 +3507,7 @@  discard block
 block discarded – undo
3507 3507
 		$settings = array(
3508 3508
 			'changeset' => array(
3509 3509
 				'uuid' => $this->changeset_uuid(),
3510
-				'status' => $this->changeset_post_id() ? get_post_status( $this->changeset_post_id() ) : '',
3510
+				'status' => $this->changeset_post_id() ? get_post_status($this->changeset_post_id()) : '',
3511 3511
 			),
3512 3512
 			'timeouts' => array(
3513 3513
 				'windowRefresh' => 250,
@@ -3521,14 +3521,14 @@  discard block
 block discarded – undo
3521 3521
 				'active'     => $this->is_theme_active(),
3522 3522
 			),
3523 3523
 			'url'      => array(
3524
-				'preview'       => esc_url_raw( $this->get_preview_url() ),
3525
-				'parent'        => esc_url_raw( admin_url() ),
3526
-				'activated'     => esc_url_raw( home_url( '/' ) ),
3527
-				'ajax'          => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
3528
-				'allowed'       => array_map( 'esc_url_raw', $this->get_allowed_urls() ),
3524
+				'preview'       => esc_url_raw($this->get_preview_url()),
3525
+				'parent'        => esc_url_raw(admin_url()),
3526
+				'activated'     => esc_url_raw(home_url('/')),
3527
+				'ajax'          => esc_url_raw(admin_url('admin-ajax.php', 'relative')),
3528
+				'allowed'       => array_map('esc_url_raw', $this->get_allowed_urls()),
3529 3529
 				'isCrossDomain' => $this->is_cross_domain(),
3530
-				'home'          => esc_url_raw( home_url( '/' ) ),
3531
-				'login'         => esc_url_raw( $login_url ),
3530
+				'home'          => esc_url_raw(home_url('/')),
3531
+				'login'         => esc_url_raw($login_url),
3532 3532
 			),
3533 3533
 			'browser'  => array(
3534 3534
 				'mobile' => wp_is_mobile(),
@@ -3543,19 +3543,19 @@  discard block
 block discarded – undo
3543 3543
 		);
3544 3544
 
3545 3545
 		// Prepare Customize Section objects to pass to JavaScript.
3546
-		foreach ( $this->sections() as $id => $section ) {
3547
-			if ( $section->check_capabilities() ) {
3548
-				$settings['sections'][ $id ] = $section->json();
3546
+		foreach ($this->sections() as $id => $section) {
3547
+			if ($section->check_capabilities()) {
3548
+				$settings['sections'][$id] = $section->json();
3549 3549
 			}
3550 3550
 		}
3551 3551
 
3552 3552
 		// Prepare Customize Panel objects to pass to JavaScript.
3553
-		foreach ( $this->panels() as $panel_id => $panel ) {
3554
-			if ( $panel->check_capabilities() ) {
3555
-				$settings['panels'][ $panel_id ] = $panel->json();
3556
-				foreach ( $panel->sections as $section_id => $section ) {
3557
-					if ( $section->check_capabilities() ) {
3558
-						$settings['sections'][ $section_id ] = $section->json();
3553
+		foreach ($this->panels() as $panel_id => $panel) {
3554
+			if ($panel->check_capabilities()) {
3555
+				$settings['panels'][$panel_id] = $panel->json();
3556
+				foreach ($panel->sections as $section_id => $section) {
3557
+					if ($section->check_capabilities()) {
3558
+						$settings['sections'][$section_id] = $section->json();
3559 3559
 					}
3560 3560
 				}
3561 3561
 			}
@@ -3563,19 +3563,19 @@  discard block
 block discarded – undo
3563 3563
 
3564 3564
 		?>
3565 3565
 		<script type="text/javascript">
3566
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
3566
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
3567 3567
 			_wpCustomizeSettings.controls = {};
3568 3568
 			_wpCustomizeSettings.settings = {};
3569 3569
 			<?php
3570 3570
 
3571 3571
 			// Serialize settings one by one to improve memory usage.
3572 3572
 			echo "(function ( s ){\n";
3573
-			foreach ( $this->settings() as $setting ) {
3574
-				if ( $setting->check_capabilities() ) {
3573
+			foreach ($this->settings() as $setting) {
3574
+				if ($setting->check_capabilities()) {
3575 3575
 					printf(
3576 3576
 						"s[%s] = %s;\n",
3577
-						wp_json_encode( $setting->id ),
3578
-						wp_json_encode( $setting->json() )
3577
+						wp_json_encode($setting->id),
3578
+						wp_json_encode($setting->json())
3579 3579
 					);
3580 3580
 				}
3581 3581
 			}
@@ -3583,12 +3583,12 @@  discard block
 block discarded – undo
3583 3583
 
3584 3584
 			// Serialize controls one by one to improve memory usage.
3585 3585
 			echo "(function ( c ){\n";
3586
-			foreach ( $this->controls() as $control ) {
3587
-				if ( $control->check_capabilities() ) {
3586
+			foreach ($this->controls() as $control) {
3587
+				if ($control->check_capabilities()) {
3588 3588
 					printf(
3589 3589
 						"c[%s] = %s;\n",
3590
-						wp_json_encode( $control->id ),
3591
-						wp_json_encode( $control->json() )
3590
+						wp_json_encode($control->id),
3591
+						wp_json_encode($control->json())
3592 3592
 					);
3593 3593
 				}
3594 3594
 			}
@@ -3609,14 +3609,14 @@  discard block
 block discarded – undo
3609 3609
 	public function get_previewable_devices() {
3610 3610
 		$devices = array(
3611 3611
 			'desktop' => array(
3612
-				'label' => __( 'Enter desktop preview mode' ),
3612
+				'label' => __('Enter desktop preview mode'),
3613 3613
 				'default' => true,
3614 3614
 			),
3615 3615
 			'tablet' => array(
3616
-				'label' => __( 'Enter tablet preview mode' ),
3616
+				'label' => __('Enter tablet preview mode'),
3617 3617
 			),
3618 3618
 			'mobile' => array(
3619
-				'label' => __( 'Enter mobile preview mode' ),
3619
+				'label' => __('Enter mobile preview mode'),
3620 3620
 			),
3621 3621
 		);
3622 3622
 
@@ -3629,7 +3629,7 @@  discard block
 block discarded – undo
3629 3629
 		 *
3630 3630
 		 * @param array $devices List of devices with labels and default setting.
3631 3631
 		 */
3632
-		$devices = apply_filters( 'customize_previewable_devices', $devices );
3632
+		$devices = apply_filters('customize_previewable_devices', $devices);
3633 3633
 
3634 3634
 		return $devices;
3635 3635
 	}
@@ -3642,135 +3642,135 @@  discard block
 block discarded – undo
3642 3642
 	public function register_controls() {
3643 3643
 
3644 3644
 		/* Panel, Section, and Control Types */
3645
-		$this->register_panel_type( 'WP_Customize_Panel' );
3646
-		$this->register_section_type( 'WP_Customize_Section' );
3647
-		$this->register_section_type( 'WP_Customize_Sidebar_Section' );
3648
-		$this->register_control_type( 'WP_Customize_Color_Control' );
3649
-		$this->register_control_type( 'WP_Customize_Media_Control' );
3650
-		$this->register_control_type( 'WP_Customize_Upload_Control' );
3651
-		$this->register_control_type( 'WP_Customize_Image_Control' );
3652
-		$this->register_control_type( 'WP_Customize_Background_Image_Control' );
3653
-		$this->register_control_type( 'WP_Customize_Background_Position_Control' );
3654
-		$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
3655
-		$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
3656
-		$this->register_control_type( 'WP_Customize_Theme_Control' );
3645
+		$this->register_panel_type('WP_Customize_Panel');
3646
+		$this->register_section_type('WP_Customize_Section');
3647
+		$this->register_section_type('WP_Customize_Sidebar_Section');
3648
+		$this->register_control_type('WP_Customize_Color_Control');
3649
+		$this->register_control_type('WP_Customize_Media_Control');
3650
+		$this->register_control_type('WP_Customize_Upload_Control');
3651
+		$this->register_control_type('WP_Customize_Image_Control');
3652
+		$this->register_control_type('WP_Customize_Background_Image_Control');
3653
+		$this->register_control_type('WP_Customize_Background_Position_Control');
3654
+		$this->register_control_type('WP_Customize_Cropped_Image_Control');
3655
+		$this->register_control_type('WP_Customize_Site_Icon_Control');
3656
+		$this->register_control_type('WP_Customize_Theme_Control');
3657 3657
 
3658 3658
 		/* Themes */
3659 3659
 
3660
-		$this->add_section( new WP_Customize_Themes_Section( $this, 'themes', array(
3661
-			'title'      => $this->theme()->display( 'Name' ),
3660
+		$this->add_section(new WP_Customize_Themes_Section($this, 'themes', array(
3661
+			'title'      => $this->theme()->display('Name'),
3662 3662
 			'capability' => 'switch_themes',
3663 3663
 			'priority'   => 0,
3664
-		) ) );
3664
+		)));
3665 3665
 
3666 3666
 		// Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience).
3667
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array(
3667
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'active_theme', array(
3668 3668
 			'capability' => 'switch_themes',
3669
-		) ) );
3669
+		)));
3670 3670
 
3671
-		require_once( ABSPATH . 'wp-admin/includes/theme.php' );
3671
+		require_once(ABSPATH.'wp-admin/includes/theme.php');
3672 3672
 
3673 3673
 		// Theme Controls.
3674 3674
 
3675 3675
 		// Add a control for the active/original theme.
3676
-		if ( ! $this->is_theme_active() ) {
3677
-			$themes = wp_prepare_themes_for_js( array( wp_get_theme( $this->original_stylesheet ) ) );
3678
-			$active_theme = current( $themes );
3676
+		if ( ! $this->is_theme_active()) {
3677
+			$themes = wp_prepare_themes_for_js(array(wp_get_theme($this->original_stylesheet)));
3678
+			$active_theme = current($themes);
3679 3679
 			$active_theme['isActiveTheme'] = true;
3680
-			$this->add_control( new WP_Customize_Theme_Control( $this, $active_theme['id'], array(
3680
+			$this->add_control(new WP_Customize_Theme_Control($this, $active_theme['id'], array(
3681 3681
 				'theme'    => $active_theme,
3682 3682
 				'section'  => 'themes',
3683 3683
 				'settings' => 'active_theme',
3684
-			) ) );
3684
+			)));
3685 3685
 		}
3686 3686
 
3687 3687
 		$themes = wp_prepare_themes_for_js();
3688
-		foreach ( $themes as $theme ) {
3689
-			if ( $theme['active'] || $theme['id'] === $this->original_stylesheet ) {
3688
+		foreach ($themes as $theme) {
3689
+			if ($theme['active'] || $theme['id'] === $this->original_stylesheet) {
3690 3690
 				continue;
3691 3691
 			}
3692 3692
 
3693
-			$theme_id = 'theme_' . $theme['id'];
3693
+			$theme_id = 'theme_'.$theme['id'];
3694 3694
 			$theme['isActiveTheme'] = false;
3695
-			$this->add_control( new WP_Customize_Theme_Control( $this, $theme_id, array(
3695
+			$this->add_control(new WP_Customize_Theme_Control($this, $theme_id, array(
3696 3696
 				'theme'    => $theme,
3697 3697
 				'section'  => 'themes',
3698 3698
 				'settings' => 'active_theme',
3699
-			) ) );
3699
+			)));
3700 3700
 		}
3701 3701
 
3702 3702
 		/* Site Identity */
3703 3703
 
3704
-		$this->add_section( 'title_tagline', array(
3705
-			'title'    => __( 'Site Identity' ),
3704
+		$this->add_section('title_tagline', array(
3705
+			'title'    => __('Site Identity'),
3706 3706
 			'priority' => 20,
3707
-		) );
3707
+		));
3708 3708
 
3709
-		$this->add_setting( 'blogname', array(
3710
-			'default'    => get_option( 'blogname' ),
3709
+		$this->add_setting('blogname', array(
3710
+			'default'    => get_option('blogname'),
3711 3711
 			'type'       => 'option',
3712 3712
 			'capability' => 'manage_options',
3713
-		) );
3713
+		));
3714 3714
 
3715
-		$this->add_control( 'blogname', array(
3716
-			'label'      => __( 'Site Title' ),
3715
+		$this->add_control('blogname', array(
3716
+			'label'      => __('Site Title'),
3717 3717
 			'section'    => 'title_tagline',
3718
-		) );
3718
+		));
3719 3719
 
3720
-		$this->add_setting( 'blogdescription', array(
3721
-			'default'    => get_option( 'blogdescription' ),
3720
+		$this->add_setting('blogdescription', array(
3721
+			'default'    => get_option('blogdescription'),
3722 3722
 			'type'       => 'option',
3723 3723
 			'capability' => 'manage_options',
3724
-		) );
3724
+		));
3725 3725
 
3726
-		$this->add_control( 'blogdescription', array(
3727
-			'label'      => __( 'Tagline' ),
3726
+		$this->add_control('blogdescription', array(
3727
+			'label'      => __('Tagline'),
3728 3728
 			'section'    => 'title_tagline',
3729
-		) );
3729
+		));
3730 3730
 
3731 3731
 		// Add a setting to hide header text if the theme doesn't support custom headers.
3732
-		if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
3733
-			$this->add_setting( 'header_text', array(
3734
-				'theme_supports'    => array( 'custom-logo', 'header-text' ),
3732
+		if ( ! current_theme_supports('custom-header', 'header-text')) {
3733
+			$this->add_setting('header_text', array(
3734
+				'theme_supports'    => array('custom-logo', 'header-text'),
3735 3735
 				'default'           => 1,
3736 3736
 				'sanitize_callback' => 'absint',
3737
-			) );
3737
+			));
3738 3738
 
3739
-			$this->add_control( 'header_text', array(
3740
-				'label'    => __( 'Display Site Title and Tagline' ),
3739
+			$this->add_control('header_text', array(
3740
+				'label'    => __('Display Site Title and Tagline'),
3741 3741
 				'section'  => 'title_tagline',
3742 3742
 				'settings' => 'header_text',
3743 3743
 				'type'     => 'checkbox',
3744
-			) );
3744
+			));
3745 3745
 		}
3746 3746
 
3747
-		$this->add_setting( 'site_icon', array(
3747
+		$this->add_setting('site_icon', array(
3748 3748
 			'type'       => 'option',
3749 3749
 			'capability' => 'manage_options',
3750 3750
 			'transport'  => 'postMessage', // Previewed with JS in the Customizer controls window.
3751
-		) );
3751
+		));
3752 3752
 
3753
-		$this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array(
3754
-			'label'       => __( 'Site Icon' ),
3753
+		$this->add_control(new WP_Customize_Site_Icon_Control($this, 'site_icon', array(
3754
+			'label'       => __('Site Icon'),
3755 3755
 			'description' => sprintf(
3756 3756
 				/* translators: %s: site icon size in pixels */
3757
-				__( 'The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least %s pixels wide and tall.' ),
3757
+				__('The Site Icon is used as a browser and app icon for your site. Icons must be square, and at least %s pixels wide and tall.'),
3758 3758
 				'<strong>512</strong>'
3759 3759
 			),
3760 3760
 			'section'     => 'title_tagline',
3761 3761
 			'priority'    => 60,
3762 3762
 			'height'      => 512,
3763 3763
 			'width'       => 512,
3764
-		) ) );
3764
+		)));
3765 3765
 
3766
-		$this->add_setting( 'custom_logo', array(
3767
-			'theme_supports' => array( 'custom-logo' ),
3766
+		$this->add_setting('custom_logo', array(
3767
+			'theme_supports' => array('custom-logo'),
3768 3768
 			'transport'      => 'postMessage',
3769
-		) );
3769
+		));
3770 3770
 
3771
-		$custom_logo_args = get_theme_support( 'custom-logo' );
3772
-		$this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array(
3773
-			'label'         => __( 'Logo' ),
3771
+		$custom_logo_args = get_theme_support('custom-logo');
3772
+		$this->add_control(new WP_Customize_Cropped_Image_Control($this, 'custom_logo', array(
3773
+			'label'         => __('Logo'),
3774 3774
 			'section'       => 'title_tagline',
3775 3775
 			'priority'      => 8,
3776 3776
 			'height'        => $custom_logo_args[0]['height'],
@@ -3778,290 +3778,290 @@  discard block
 block discarded – undo
3778 3778
 			'flex_height'   => $custom_logo_args[0]['flex-height'],
3779 3779
 			'flex_width'    => $custom_logo_args[0]['flex-width'],
3780 3780
 			'button_labels' => array(
3781
-				'select'       => __( 'Select logo' ),
3782
-				'change'       => __( 'Change logo' ),
3783
-				'remove'       => __( 'Remove' ),
3784
-				'default'      => __( 'Default' ),
3785
-				'placeholder'  => __( 'No logo selected' ),
3786
-				'frame_title'  => __( 'Select logo' ),
3787
-				'frame_button' => __( 'Choose logo' ),
3781
+				'select'       => __('Select logo'),
3782
+				'change'       => __('Change logo'),
3783
+				'remove'       => __('Remove'),
3784
+				'default'      => __('Default'),
3785
+				'placeholder'  => __('No logo selected'),
3786
+				'frame_title'  => __('Select logo'),
3787
+				'frame_button' => __('Choose logo'),
3788 3788
 			),
3789
-		) ) );
3789
+		)));
3790 3790
 
3791
-		$this->selective_refresh->add_partial( 'custom_logo', array(
3792
-			'settings'            => array( 'custom_logo' ),
3791
+		$this->selective_refresh->add_partial('custom_logo', array(
3792
+			'settings'            => array('custom_logo'),
3793 3793
 			'selector'            => '.custom-logo-link',
3794
-			'render_callback'     => array( $this, '_render_custom_logo_partial' ),
3794
+			'render_callback'     => array($this, '_render_custom_logo_partial'),
3795 3795
 			'container_inclusive' => true,
3796
-		) );
3796
+		));
3797 3797
 
3798 3798
 		/* Colors */
3799 3799
 
3800
-		$this->add_section( 'colors', array(
3801
-			'title'          => __( 'Colors' ),
3800
+		$this->add_section('colors', array(
3801
+			'title'          => __('Colors'),
3802 3802
 			'priority'       => 40,
3803
-		) );
3803
+		));
3804 3804
 
3805
-		$this->add_setting( 'header_textcolor', array(
3806
-			'theme_supports' => array( 'custom-header', 'header-text' ),
3807
-			'default'        => get_theme_support( 'custom-header', 'default-text-color' ),
3805
+		$this->add_setting('header_textcolor', array(
3806
+			'theme_supports' => array('custom-header', 'header-text'),
3807
+			'default'        => get_theme_support('custom-header', 'default-text-color'),
3808 3808
 
3809
-			'sanitize_callback'    => array( $this, '_sanitize_header_textcolor' ),
3809
+			'sanitize_callback'    => array($this, '_sanitize_header_textcolor'),
3810 3810
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
3811
-		) );
3811
+		));
3812 3812
 
3813 3813
 		// Input type: checkbox
3814 3814
 		// With custom value
3815
-		$this->add_control( 'display_header_text', array(
3815
+		$this->add_control('display_header_text', array(
3816 3816
 			'settings' => 'header_textcolor',
3817
-			'label'    => __( 'Display Site Title and Tagline' ),
3817
+			'label'    => __('Display Site Title and Tagline'),
3818 3818
 			'section'  => 'title_tagline',
3819 3819
 			'type'     => 'checkbox',
3820 3820
 			'priority' => 40,
3821
-		) );
3821
+		));
3822 3822
 
3823
-		$this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array(
3824
-			'label'   => __( 'Header Text Color' ),
3823
+		$this->add_control(new WP_Customize_Color_Control($this, 'header_textcolor', array(
3824
+			'label'   => __('Header Text Color'),
3825 3825
 			'section' => 'colors',
3826
-		) ) );
3826
+		)));
3827 3827
 
3828 3828
 		// Input type: Color
3829 3829
 		// With sanitize_callback
3830
-		$this->add_setting( 'background_color', array(
3831
-			'default'        => get_theme_support( 'custom-background', 'default-color' ),
3830
+		$this->add_setting('background_color', array(
3831
+			'default'        => get_theme_support('custom-background', 'default-color'),
3832 3832
 			'theme_supports' => 'custom-background',
3833 3833
 
3834 3834
 			'sanitize_callback'    => 'sanitize_hex_color_no_hash',
3835 3835
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
3836
-		) );
3836
+		));
3837 3837
 
3838
-		$this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array(
3839
-			'label'   => __( 'Background Color' ),
3838
+		$this->add_control(new WP_Customize_Color_Control($this, 'background_color', array(
3839
+			'label'   => __('Background Color'),
3840 3840
 			'section' => 'colors',
3841
-		) ) );
3841
+		)));
3842 3842
 
3843 3843
 		/* Custom Header */
3844 3844
 
3845
-		if ( current_theme_supports( 'custom-header', 'video' ) ) {
3846
-			$title = __( 'Header Media' );
3847
-			$description = '<p>' . __( 'If you add a video, the image will be used as a fallback while the video loads.' ) . '</p>';
3845
+		if (current_theme_supports('custom-header', 'video')) {
3846
+			$title = __('Header Media');
3847
+			$description = '<p>'.__('If you add a video, the image will be used as a fallback while the video loads.').'</p>';
3848 3848
 
3849 3849
 			// @todo Customizer sections should support having notifications just like controls do. See <https://core.trac.wordpress.org/ticket/38794>.
3850 3850
 			$description .= '<div class="customize-control-notifications-container header-video-not-currently-previewable" style="display: none"><ul>';
3851
-			$description .= '<li class="notice notice-info">' . __( 'This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.' ) . '</li>';
3851
+			$description .= '<li class="notice notice-info">'.__('This theme doesn\'t support video headers on this page. Navigate to the front page or another page that supports video headers.').'</li>';
3852 3852
 			$description .= '</ul></div>';
3853
-			$width = absint( get_theme_support( 'custom-header', 'width' ) );
3854
-			$height = absint( get_theme_support( 'custom-header', 'height' ) );
3855
-			if ( $width && $height ) {
3853
+			$width = absint(get_theme_support('custom-header', 'width'));
3854
+			$height = absint(get_theme_support('custom-header', 'height'));
3855
+			if ($width && $height) {
3856 3856
 				$control_description = sprintf(
3857 3857
 					/* translators: 1: .mp4, 2: header size in pixels */
3858
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.' ),
3858
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.'),
3859 3859
 					'<code>.mp4</code>',
3860
-					sprintf( '<strong>%s &times; %s</strong>', $width, $height )
3860
+					sprintf('<strong>%s &times; %s</strong>', $width, $height)
3861 3861
 				);
3862
-			} elseif ( $width ) {
3862
+			} elseif ($width) {
3863 3863
 				$control_description = sprintf(
3864 3864
 					/* translators: 1: .mp4, 2: header width in pixels */
3865
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.' ),
3865
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.'),
3866 3866
 					'<code>.mp4</code>',
3867
-					sprintf( '<strong>%s</strong>', $width )
3867
+					sprintf('<strong>%s</strong>', $width)
3868 3868
 				);
3869 3869
 			} else {
3870 3870
 				$control_description = sprintf(
3871 3871
 					/* translators: 1: .mp4, 2: header height in pixels */
3872
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.' ),
3872
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.'),
3873 3873
 					'<code>.mp4</code>',
3874
-					sprintf( '<strong>%s</strong>', $height )
3874
+					sprintf('<strong>%s</strong>', $height)
3875 3875
 				);
3876 3876
 			}
3877 3877
 		} else {
3878
-			$title = __( 'Header Image' );
3878
+			$title = __('Header Image');
3879 3879
 			$description = '';
3880 3880
 			$control_description = '';
3881 3881
 		}
3882 3882
 
3883
-		$this->add_section( 'header_image', array(
3883
+		$this->add_section('header_image', array(
3884 3884
 			'title'          => $title,
3885 3885
 			'description'    => $description,
3886 3886
 			'theme_supports' => 'custom-header',
3887 3887
 			'priority'       => 60,
3888
-		) );
3888
+		));
3889 3889
 
3890
-		$this->add_setting( 'header_video', array(
3891
-			'theme_supports'    => array( 'custom-header', 'video' ),
3890
+		$this->add_setting('header_video', array(
3891
+			'theme_supports'    => array('custom-header', 'video'),
3892 3892
 			'transport'         => 'postMessage',
3893 3893
 			'sanitize_callback' => 'absint',
3894
-			'validate_callback' => array( $this, '_validate_header_video' ),
3895
-		) );
3894
+			'validate_callback' => array($this, '_validate_header_video'),
3895
+		));
3896 3896
 
3897
-		$this->add_setting( 'external_header_video', array(
3898
-			'theme_supports'    => array( 'custom-header', 'video' ),
3897
+		$this->add_setting('external_header_video', array(
3898
+			'theme_supports'    => array('custom-header', 'video'),
3899 3899
 			'transport'         => 'postMessage',
3900
-			'sanitize_callback' => array( $this, '_sanitize_external_header_video' ),
3901
-			'validate_callback' => array( $this, '_validate_external_header_video' ),
3902
-		) );
3900
+			'sanitize_callback' => array($this, '_sanitize_external_header_video'),
3901
+			'validate_callback' => array($this, '_validate_external_header_video'),
3902
+		));
3903 3903
 
3904
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
3905
-			'default'        => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ),
3904
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'header_image', array(
3905
+			'default'        => sprintf(get_theme_support('custom-header', 'default-image'), get_template_directory_uri(), get_stylesheet_directory_uri()),
3906 3906
 			'theme_supports' => 'custom-header',
3907
-		) ) );
3907
+		)));
3908 3908
 
3909
-		$this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
3909
+		$this->add_setting(new WP_Customize_Header_Image_Setting($this, 'header_image_data', array(
3910 3910
 			'theme_supports' => 'custom-header',
3911
-		) ) );
3911
+		)));
3912 3912
 
3913 3913
 		/*
3914 3914
 		 * Switch image settings to postMessage when video support is enabled since
3915 3915
 		 * it entails that the_custom_header_markup() will be used, and thus selective
3916 3916
 		 * refresh can be utilized.
3917 3917
 		 */
3918
-		if ( current_theme_supports( 'custom-header', 'video' ) ) {
3919
-			$this->get_setting( 'header_image' )->transport = 'postMessage';
3920
-			$this->get_setting( 'header_image_data' )->transport = 'postMessage';
3918
+		if (current_theme_supports('custom-header', 'video')) {
3919
+			$this->get_setting('header_image')->transport = 'postMessage';
3920
+			$this->get_setting('header_image_data')->transport = 'postMessage';
3921 3921
 		}
3922 3922
 
3923
-		$this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array(
3924
-			'theme_supports' => array( 'custom-header', 'video' ),
3925
-			'label'          => __( 'Header Video' ),
3923
+		$this->add_control(new WP_Customize_Media_Control($this, 'header_video', array(
3924
+			'theme_supports' => array('custom-header', 'video'),
3925
+			'label'          => __('Header Video'),
3926 3926
 			'description'    => $control_description,
3927 3927
 			'section'        => 'header_image',
3928 3928
 			'mime_type'      => 'video',
3929 3929
 			// @todo These button_labels can be removed once WP_Customize_Media_Control provides mime_type-specific labels automatically. See <https://core.trac.wordpress.org/ticket/38796>.
3930 3930
 			'button_labels'  => array(
3931
-				'select'       => __( 'Select Video' ),
3932
-				'change'       => __( 'Change Video' ),
3933
-				'placeholder'  => __( 'No video selected' ),
3934
-				'frame_title'  => __( 'Select Video' ),
3935
-				'frame_button' => __( 'Choose Video' ),
3931
+				'select'       => __('Select Video'),
3932
+				'change'       => __('Change Video'),
3933
+				'placeholder'  => __('No video selected'),
3934
+				'frame_title'  => __('Select Video'),
3935
+				'frame_button' => __('Choose Video'),
3936 3936
 			),
3937 3937
 			'active_callback' => 'is_header_video_active',
3938
-		) ) );
3938
+		)));
3939 3939
 
3940
-		$this->add_control( 'external_header_video', array(
3941
-			'theme_supports' => array( 'custom-header', 'video' ),
3940
+		$this->add_control('external_header_video', array(
3941
+			'theme_supports' => array('custom-header', 'video'),
3942 3942
 			'type'           => 'url',
3943
-			'description'    => __( 'Or, enter a YouTube URL:' ),
3943
+			'description'    => __('Or, enter a YouTube URL:'),
3944 3944
 			'section'        => 'header_image',
3945 3945
 			'active_callback'=> 'is_front_page',
3946
-		) );
3946
+		));
3947 3947
 
3948
-		$this->add_control( new WP_Customize_Header_Image_Control( $this ) );
3948
+		$this->add_control(new WP_Customize_Header_Image_Control($this));
3949 3949
 
3950
-		$this->selective_refresh->add_partial( 'custom_header', array(
3950
+		$this->selective_refresh->add_partial('custom_header', array(
3951 3951
 			'selector'            => '#wp-custom-header',
3952 3952
 			'render_callback'     => 'the_custom_header_markup',
3953
-			'settings'            => array( 'header_video', 'external_header_video', 'header_image' ), // The image is used as a video fallback here.
3953
+			'settings'            => array('header_video', 'external_header_video', 'header_image'), // The image is used as a video fallback here.
3954 3954
 			'container_inclusive' => true,
3955
-		) );
3955
+		));
3956 3956
 
3957 3957
 		/* Custom Background */
3958 3958
 
3959
-		$this->add_section( 'background_image', array(
3960
-			'title'          => __( 'Background Image' ),
3959
+		$this->add_section('background_image', array(
3960
+			'title'          => __('Background Image'),
3961 3961
 			'theme_supports' => 'custom-background',
3962 3962
 			'priority'       => 80,
3963
-		) );
3963
+		));
3964 3964
 
3965
-		$this->add_setting( 'background_image', array(
3966
-			'default'        => get_theme_support( 'custom-background', 'default-image' ),
3965
+		$this->add_setting('background_image', array(
3966
+			'default'        => get_theme_support('custom-background', 'default-image'),
3967 3967
 			'theme_supports' => 'custom-background',
3968
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
3969
-		) );
3968
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
3969
+		));
3970 3970
 
3971
-		$this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array(
3971
+		$this->add_setting(new WP_Customize_Background_Image_Setting($this, 'background_image_thumb', array(
3972 3972
 			'theme_supports' => 'custom-background',
3973
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
3974
-		) ) );
3973
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
3974
+		)));
3975 3975
 
3976
-		$this->add_control( new WP_Customize_Background_Image_Control( $this ) );
3976
+		$this->add_control(new WP_Customize_Background_Image_Control($this));
3977 3977
 
3978
-		$this->add_setting( 'background_preset', array(
3979
-			'default'        => get_theme_support( 'custom-background', 'default-preset' ),
3978
+		$this->add_setting('background_preset', array(
3979
+			'default'        => get_theme_support('custom-background', 'default-preset'),
3980 3980
 			'theme_supports' => 'custom-background',
3981
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
3982
-		) );
3981
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
3982
+		));
3983 3983
 
3984
-		$this->add_control( 'background_preset', array(
3985
-			'label'      => _x( 'Preset', 'Background Preset' ),
3984
+		$this->add_control('background_preset', array(
3985
+			'label'      => _x('Preset', 'Background Preset'),
3986 3986
 			'section'    => 'background_image',
3987 3987
 			'type'       => 'select',
3988 3988
 			'choices'    => array(
3989
-				'default' => _x( 'Default', 'Default Preset' ),
3990
-				'fill'    => __( 'Fill Screen' ),
3991
-				'fit'     => __( 'Fit to Screen' ),
3992
-				'repeat'  => _x( 'Repeat', 'Repeat Image' ),
3993
-				'custom'  => _x( 'Custom', 'Custom Preset' ),
3989
+				'default' => _x('Default', 'Default Preset'),
3990
+				'fill'    => __('Fill Screen'),
3991
+				'fit'     => __('Fit to Screen'),
3992
+				'repeat'  => _x('Repeat', 'Repeat Image'),
3993
+				'custom'  => _x('Custom', 'Custom Preset'),
3994 3994
 			),
3995
-		) );
3995
+		));
3996 3996
 
3997
-		$this->add_setting( 'background_position_x', array(
3998
-			'default'        => get_theme_support( 'custom-background', 'default-position-x' ),
3997
+		$this->add_setting('background_position_x', array(
3998
+			'default'        => get_theme_support('custom-background', 'default-position-x'),
3999 3999
 			'theme_supports' => 'custom-background',
4000
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4001
-		) );
4000
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4001
+		));
4002 4002
 
4003
-		$this->add_setting( 'background_position_y', array(
4004
-			'default'        => get_theme_support( 'custom-background', 'default-position-y' ),
4003
+		$this->add_setting('background_position_y', array(
4004
+			'default'        => get_theme_support('custom-background', 'default-position-y'),
4005 4005
 			'theme_supports' => 'custom-background',
4006
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4007
-		) );
4006
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4007
+		));
4008 4008
 
4009
-		$this->add_control( new WP_Customize_Background_Position_Control( $this, 'background_position', array(
4010
-			'label'    => __( 'Image Position' ),
4009
+		$this->add_control(new WP_Customize_Background_Position_Control($this, 'background_position', array(
4010
+			'label'    => __('Image Position'),
4011 4011
 			'section'  => 'background_image',
4012 4012
 			'settings' => array(
4013 4013
 				'x' => 'background_position_x',
4014 4014
 				'y' => 'background_position_y',
4015 4015
 			),
4016
-		) ) );
4016
+		)));
4017 4017
 
4018
-		$this->add_setting( 'background_size', array(
4019
-			'default'        => get_theme_support( 'custom-background', 'default-size' ),
4018
+		$this->add_setting('background_size', array(
4019
+			'default'        => get_theme_support('custom-background', 'default-size'),
4020 4020
 			'theme_supports' => 'custom-background',
4021
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4022
-		) );
4021
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4022
+		));
4023 4023
 
4024
-		$this->add_control( 'background_size', array(
4025
-			'label'      => __( 'Image Size' ),
4024
+		$this->add_control('background_size', array(
4025
+			'label'      => __('Image Size'),
4026 4026
 			'section'    => 'background_image',
4027 4027
 			'type'       => 'select',
4028 4028
 			'choices'    => array(
4029
-				'auto'    => __( 'Original' ),
4030
-				'contain' => __( 'Fit to Screen' ),
4031
-				'cover'   => __( 'Fill Screen' ),
4029
+				'auto'    => __('Original'),
4030
+				'contain' => __('Fit to Screen'),
4031
+				'cover'   => __('Fill Screen'),
4032 4032
 			),
4033
-		) );
4033
+		));
4034 4034
 
4035
-		$this->add_setting( 'background_repeat', array(
4036
-			'default'           => get_theme_support( 'custom-background', 'default-repeat' ),
4037
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4035
+		$this->add_setting('background_repeat', array(
4036
+			'default'           => get_theme_support('custom-background', 'default-repeat'),
4037
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4038 4038
 			'theme_supports'    => 'custom-background',
4039
-		) );
4039
+		));
4040 4040
 
4041
-		$this->add_control( 'background_repeat', array(
4042
-			'label'    => __( 'Repeat Background Image' ),
4041
+		$this->add_control('background_repeat', array(
4042
+			'label'    => __('Repeat Background Image'),
4043 4043
 			'section'  => 'background_image',
4044 4044
 			'type'     => 'checkbox',
4045
-		) );
4045
+		));
4046 4046
 
4047
-		$this->add_setting( 'background_attachment', array(
4048
-			'default'           => get_theme_support( 'custom-background', 'default-attachment' ),
4049
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4047
+		$this->add_setting('background_attachment', array(
4048
+			'default'           => get_theme_support('custom-background', 'default-attachment'),
4049
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4050 4050
 			'theme_supports'    => 'custom-background',
4051
-		) );
4051
+		));
4052 4052
 
4053
-		$this->add_control( 'background_attachment', array(
4054
-			'label'    => __( 'Scroll with Page' ),
4053
+		$this->add_control('background_attachment', array(
4054
+			'label'    => __('Scroll with Page'),
4055 4055
 			'section'  => 'background_image',
4056 4056
 			'type'     => 'checkbox',
4057
-		) );
4057
+		));
4058 4058
 
4059 4059
 
4060 4060
 		// If the theme is using the default background callback, we can update
4061 4061
 		// the background CSS using postMessage.
4062
-		if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) {
4063
-			foreach ( array( 'color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment' ) as $prop ) {
4064
-				$this->get_setting( 'background_' . $prop )->transport = 'postMessage';
4062
+		if (get_theme_support('custom-background', 'wp-head-callback') === '_custom_background_cb') {
4063
+			foreach (array('color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment') as $prop) {
4064
+				$this->get_setting('background_'.$prop)->transport = 'postMessage';
4065 4065
 			}
4066 4066
 		}
4067 4067
 
@@ -4071,80 +4071,80 @@  discard block
 block discarded – undo
4071 4071
 		 * The following replicates behavior from options-reading.php.
4072 4072
 		 */
4073 4073
 
4074
-		$this->add_section( 'static_front_page', array(
4075
-			'title' => __( 'Static Front Page' ),
4074
+		$this->add_section('static_front_page', array(
4075
+			'title' => __('Static Front Page'),
4076 4076
 			'priority' => 120,
4077
-			'description' => __( 'Your theme supports a static front page.' ),
4078
-			'active_callback' => array( $this, 'has_published_pages' ),
4079
-		) );
4077
+			'description' => __('Your theme supports a static front page.'),
4078
+			'active_callback' => array($this, 'has_published_pages'),
4079
+		));
4080 4080
 
4081
-		$this->add_setting( 'show_on_front', array(
4082
-			'default' => get_option( 'show_on_front' ),
4081
+		$this->add_setting('show_on_front', array(
4082
+			'default' => get_option('show_on_front'),
4083 4083
 			'capability' => 'manage_options',
4084 4084
 			'type' => 'option',
4085
-		) );
4085
+		));
4086 4086
 
4087
-		$this->add_control( 'show_on_front', array(
4088
-			'label' => __( 'Front page displays' ),
4087
+		$this->add_control('show_on_front', array(
4088
+			'label' => __('Front page displays'),
4089 4089
 			'section' => 'static_front_page',
4090 4090
 			'type' => 'radio',
4091 4091
 			'choices' => array(
4092
-				'posts' => __( 'Your latest posts' ),
4093
-				'page'  => __( 'A static page' ),
4092
+				'posts' => __('Your latest posts'),
4093
+				'page'  => __('A static page'),
4094 4094
 			),
4095
-		) );
4095
+		));
4096 4096
 
4097
-		$this->add_setting( 'page_on_front', array(
4097
+		$this->add_setting('page_on_front', array(
4098 4098
 			'type'       => 'option',
4099 4099
 			'capability' => 'manage_options',
4100
-		) );
4100
+		));
4101 4101
 
4102
-		$this->add_control( 'page_on_front', array(
4103
-			'label' => __( 'Front page' ),
4102
+		$this->add_control('page_on_front', array(
4103
+			'label' => __('Front page'),
4104 4104
 			'section' => 'static_front_page',
4105 4105
 			'type' => 'dropdown-pages',
4106 4106
 			'allow_addition' => true,
4107
-		) );
4107
+		));
4108 4108
 
4109
-		$this->add_setting( 'page_for_posts', array(
4109
+		$this->add_setting('page_for_posts', array(
4110 4110
 			'type' => 'option',
4111 4111
 			'capability' => 'manage_options',
4112
-		) );
4112
+		));
4113 4113
 
4114
-		$this->add_control( 'page_for_posts', array(
4115
-			'label' => __( 'Posts page' ),
4114
+		$this->add_control('page_for_posts', array(
4115
+			'label' => __('Posts page'),
4116 4116
 			'section' => 'static_front_page',
4117 4117
 			'type' => 'dropdown-pages',
4118 4118
 			'allow_addition' => true,
4119
-		) );
4119
+		));
4120 4120
 
4121 4121
 		/* Custom CSS */
4122
-		$this->add_section( 'custom_css', array(
4123
-			'title'              => __( 'Additional CSS' ),
4122
+		$this->add_section('custom_css', array(
4123
+			'title'              => __('Additional CSS'),
4124 4124
 			'priority'           => 200,
4125 4125
 			'description_hidden' => true,
4126
-			'description'        => sprintf( '%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>',
4127
-				__( 'CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.' ),
4128
-				esc_url( __( 'https://codex.wordpress.org/CSS' ) ),
4129
-				__( 'Learn more about CSS' ),
4130
-				__( '(link opens in a new window)' )
4126
+			'description'        => sprintf('%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>',
4127
+				__('CSS allows you to customize the appearance and layout of your site with code. Separate CSS is saved for each of your themes. In the editing area the Tab key enters a tab character. To move below this area by pressing Tab, press the Esc key followed by the Tab key.'),
4128
+				esc_url(__('https://codex.wordpress.org/CSS')),
4129
+				__('Learn more about CSS'),
4130
+				__('(link opens in a new window)')
4131 4131
 			),
4132
-		) );
4132
+		));
4133 4133
 
4134
-		$custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array(
4134
+		$custom_css_setting = new WP_Customize_Custom_CSS_Setting($this, sprintf('custom_css[%s]', get_stylesheet()), array(
4135 4135
 			'capability' => 'edit_css',
4136
-			'default' => sprintf( "/*\n%s\n*/", __( "You can add your own CSS here.\n\nClick the help icon above to learn more." ) ),
4137
-		) );
4138
-		$this->add_setting( $custom_css_setting );
4136
+			'default' => sprintf("/*\n%s\n*/", __("You can add your own CSS here.\n\nClick the help icon above to learn more.")),
4137
+		));
4138
+		$this->add_setting($custom_css_setting);
4139 4139
 
4140
-		$this->add_control( 'custom_css', array(
4140
+		$this->add_control('custom_css', array(
4141 4141
 			'type'     => 'textarea',
4142 4142
 			'section'  => 'custom_css',
4143
-			'settings' => array( 'default' => $custom_css_setting->id ),
4143
+			'settings' => array('default' => $custom_css_setting->id),
4144 4144
 			'input_attrs' => array(
4145 4145
 				'class' => 'code', // Ensures contents displayed as LTR instead of RTL.
4146 4146
 			),
4147
-		) );
4147
+		));
4148 4148
 	}
4149 4149
 
4150 4150
 	/**
@@ -4159,15 +4159,15 @@  discard block
 block discarded – undo
4159 4159
 	 */
4160 4160
 	public function has_published_pages() {
4161 4161
 
4162
-		$setting = $this->get_setting( 'nav_menus_created_posts' );
4163
-		if ( $setting ) {
4164
-			foreach ( $setting->value() as $post_id ) {
4165
-				if ( 'page' === get_post_type( $post_id ) ) {
4162
+		$setting = $this->get_setting('nav_menus_created_posts');
4163
+		if ($setting) {
4164
+			foreach ($setting->value() as $post_id) {
4165
+				if ('page' === get_post_type($post_id)) {
4166 4166
 					return true;
4167 4167
 				}
4168 4168
 			}
4169 4169
 		}
4170
-		return 0 !== count( get_pages() );
4170
+		return 0 !== count(get_pages());
4171 4171
 	}
4172 4172
 
4173 4173
 	/**
@@ -4179,8 +4179,8 @@  discard block
 block discarded – undo
4179 4179
 	 * @see add_dynamic_settings()
4180 4180
 	 */
4181 4181
 	public function register_dynamic_settings() {
4182
-		$setting_ids = array_keys( $this->unsanitized_post_values() );
4183
-		$this->add_dynamic_settings( $setting_ids );
4182
+		$setting_ids = array_keys($this->unsanitized_post_values());
4183
+		$this->add_dynamic_settings($setting_ids);
4184 4184
 	}
4185 4185
 
4186 4186
 	/**
@@ -4194,13 +4194,13 @@  discard block
 block discarded – undo
4194 4194
 	 * @param string $color
4195 4195
 	 * @return mixed
4196 4196
 	 */
4197
-	public function _sanitize_header_textcolor( $color ) {
4198
-		if ( 'blank' === $color )
4197
+	public function _sanitize_header_textcolor($color) {
4198
+		if ('blank' === $color)
4199 4199
 			return 'blank';
4200 4200
 
4201
-		$color = sanitize_hex_color_no_hash( $color );
4202
-		if ( empty( $color ) )
4203
-			$color = get_theme_support( 'custom-header', 'default-text-color' );
4201
+		$color = sanitize_hex_color_no_hash($color);
4202
+		if (empty($color))
4203
+			$color = get_theme_support('custom-header', 'default-text-color');
4204 4204
 
4205 4205
 		return $color;
4206 4206
 	}
@@ -4215,35 +4215,35 @@  discard block
 block discarded – undo
4215 4215
 	 * @param WP_Customize_Setting $setting Setting.
4216 4216
 	 * @return string|WP_Error Background value or validation error.
4217 4217
 	 */
4218
-	public function _sanitize_background_setting( $value, $setting ) {
4219
-		if ( 'background_repeat' === $setting->id ) {
4220
-			if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ) ) ) {
4221
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
4218
+	public function _sanitize_background_setting($value, $setting) {
4219
+		if ('background_repeat' === $setting->id) {
4220
+			if ( ! in_array($value, array('repeat-x', 'repeat-y', 'repeat', 'no-repeat'))) {
4221
+				return new WP_Error('invalid_value', __('Invalid value for background repeat.'));
4222 4222
 			}
4223
-		} elseif ( 'background_attachment' === $setting->id ) {
4224
-			if ( ! in_array( $value, array( 'fixed', 'scroll' ) ) ) {
4225
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
4223
+		} elseif ('background_attachment' === $setting->id) {
4224
+			if ( ! in_array($value, array('fixed', 'scroll'))) {
4225
+				return new WP_Error('invalid_value', __('Invalid value for background attachment.'));
4226 4226
 			}
4227
-		} elseif ( 'background_position_x' === $setting->id ) {
4228
-			if ( ! in_array( $value, array( 'left', 'center', 'right' ), true ) ) {
4229
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background position X.' ) );
4227
+		} elseif ('background_position_x' === $setting->id) {
4228
+			if ( ! in_array($value, array('left', 'center', 'right'), true)) {
4229
+				return new WP_Error('invalid_value', __('Invalid value for background position X.'));
4230 4230
 			}
4231
-		} elseif ( 'background_position_y' === $setting->id ) {
4232
-			if ( ! in_array( $value, array( 'top', 'center', 'bottom' ), true ) ) {
4233
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background position Y.' ) );
4231
+		} elseif ('background_position_y' === $setting->id) {
4232
+			if ( ! in_array($value, array('top', 'center', 'bottom'), true)) {
4233
+				return new WP_Error('invalid_value', __('Invalid value for background position Y.'));
4234 4234
 			}
4235
-		} elseif ( 'background_size' === $setting->id ) {
4236
-			if ( ! in_array( $value, array( 'auto', 'contain', 'cover' ), true ) ) {
4237
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
4235
+		} elseif ('background_size' === $setting->id) {
4236
+			if ( ! in_array($value, array('auto', 'contain', 'cover'), true)) {
4237
+				return new WP_Error('invalid_value', __('Invalid value for background size.'));
4238 4238
 			}
4239
-		} elseif ( 'background_preset' === $setting->id ) {
4240
-			if ( ! in_array( $value, array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) {
4241
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
4239
+		} elseif ('background_preset' === $setting->id) {
4240
+			if ( ! in_array($value, array('default', 'fill', 'fit', 'repeat', 'custom'), true)) {
4241
+				return new WP_Error('invalid_value', __('Invalid value for background size.'));
4242 4242
 			}
4243
-		} elseif ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) {
4244
-			$value = empty( $value ) ? '' : esc_url_raw( $value );
4243
+		} elseif ('background_image' === $setting->id || 'background_image_thumb' === $setting->id) {
4244
+			$value = empty($value) ? '' : esc_url_raw($value);
4245 4245
 		} else {
4246
-			return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) );
4246
+			return new WP_Error('unrecognized_setting', __('Unrecognized background setting.'));
4247 4247
 		}
4248 4248
 		return $value;
4249 4249
 	}
@@ -4258,8 +4258,8 @@  discard block
 block discarded – undo
4258 4258
 	 * @param array $partials Array of partials.
4259 4259
 	 * @return array
4260 4260
 	 */
4261
-	public function export_header_video_settings( $response, $selective_refresh, $partials ) {
4262
-		if ( isset( $partials['custom_header'] ) ) {
4261
+	public function export_header_video_settings($response, $selective_refresh, $partials) {
4262
+		if (isset($partials['custom_header'])) {
4263 4263
 			$response['custom_header_settings'] = get_header_video_settings();
4264 4264
 		}
4265 4265
 
@@ -4277,22 +4277,22 @@  discard block
 block discarded – undo
4277 4277
 	 * @param mixed $value
4278 4278
 	 * @return mixed
4279 4279
 	 */
4280
-	public function _validate_header_video( $validity, $value ) {
4281
-		$video = get_attached_file( absint( $value ) );
4282
-		if ( $video ) {
4283
-			$size = filesize( $video );
4284
-			if ( 8 < $size / pow( 1024, 2 ) ) { // Check whether the size is larger than 8MB.
4285
-				$validity->add( 'size_too_large',
4286
-					__( 'This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.' )
4280
+	public function _validate_header_video($validity, $value) {
4281
+		$video = get_attached_file(absint($value));
4282
+		if ($video) {
4283
+			$size = filesize($video);
4284
+			if (8 < $size / pow(1024, 2)) { // Check whether the size is larger than 8MB.
4285
+				$validity->add('size_too_large',
4286
+					__('This video file is too large to use as a header video. Try a shorter video or optimize the compression settings and re-upload a file that is less than 8MB. Or, upload your video to YouTube and link it with the option below.')
4287 4287
 				);
4288 4288
 			}
4289
-			if ( '.mp4' !== substr( $video, -4 ) && '.mov' !== substr( $video, -4 ) ) { // Check for .mp4 or .mov format, which (assuming h.264 encoding) are the only cross-browser-supported formats.
4290
-				$validity->add( 'invalid_file_type', sprintf(
4289
+			if ('.mp4' !== substr($video, -4) && '.mov' !== substr($video, -4)) { // Check for .mp4 or .mov format, which (assuming h.264 encoding) are the only cross-browser-supported formats.
4290
+				$validity->add('invalid_file_type', sprintf(
4291 4291
 					/* translators: 1: .mp4, 2: .mov */
4292
-					__( 'Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.' ),
4292
+					__('Only %1$s or %2$s files may be used for header video. Please convert your video file and try again, or, upload your video to YouTube and link it with the option below.'),
4293 4293
 					'<code>.mp4</code>',
4294 4294
 					'<code>.mov</code>'
4295
-				) );
4295
+				));
4296 4296
 			}
4297 4297
 		}
4298 4298
 		return $validity;
@@ -4309,11 +4309,11 @@  discard block
 block discarded – undo
4309 4309
 	 * @param mixed $value
4310 4310
 	 * @return mixed
4311 4311
 	 */
4312
-	public function _validate_external_header_video( $validity, $value ) {
4313
-		$video = esc_url_raw( $value );
4314
-		if ( $video ) {
4315
-			if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) {
4316
-				$validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) );
4312
+	public function _validate_external_header_video($validity, $value) {
4313
+		$video = esc_url_raw($value);
4314
+		if ($video) {
4315
+			if ( ! preg_match('#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video)) {
4316
+				$validity->add('invalid_url', __('Please enter a valid YouTube URL.'));
4317 4317
 			}
4318 4318
 		}
4319 4319
 		return $validity;
@@ -4327,8 +4327,8 @@  discard block
 block discarded – undo
4327 4327
 	 * @param string $value URL.
4328 4328
 	 * @return string Sanitized URL.
4329 4329
 	 */
4330
-	public function _sanitize_external_header_video( $value ) {
4331
-		return esc_url_raw( trim( $value ) );
4330
+	public function _sanitize_external_header_video($value) {
4331
+		return esc_url_raw(trim($value));
4332 4332
 	}
4333 4333
 
4334 4334
 	/**
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -3009,8 +3009,9 @@  discard block
 block discarded – undo
3009 3009
 	 * @return WP_Customize_Section|void The section, if set.
3010 3010
 	 */
3011 3011
 	public function get_section( $id ) {
3012
-		if ( isset( $this->sections[ $id ] ) )
3013
-			return $this->sections[ $id ];
3012
+		if ( isset( $this->sections[ $id ] ) ) {
3013
+					return $this->sections[ $id ];
3014
+		}
3014 3015
 	}
3015 3016
 
3016 3017
 	/**
@@ -3085,8 +3086,9 @@  discard block
 block discarded – undo
3085 3086
 	 * @return WP_Customize_Control|void The control object, if set.
3086 3087
 	 */
3087 3088
 	public function get_control( $id ) {
3088
-		if ( isset( $this->controls[ $id ] ) )
3089
-			return $this->controls[ $id ];
3089
+		if ( isset( $this->controls[ $id ] ) ) {
3090
+					return $this->controls[ $id ];
3091
+		}
3090 3092
 	}
3091 3093
 
3092 3094
 	/**
@@ -4195,12 +4197,14 @@  discard block
 block discarded – undo
4195 4197
 	 * @return mixed
4196 4198
 	 */
4197 4199
 	public function _sanitize_header_textcolor( $color ) {
4198
-		if ( 'blank' === $color )
4199
-			return 'blank';
4200
+		if ( 'blank' === $color ) {
4201
+					return 'blank';
4202
+		}
4200 4203
 
4201 4204
 		$color = sanitize_hex_color_no_hash( $color );
4202
-		if ( empty( $color ) )
4203
-			$color = get_theme_support( 'custom-header', 'default-text-color' );
4205
+		if ( empty( $color ) ) {
4206
+					$color = get_theme_support( 'custom-header', 'default-text-color' );
4207
+		}
4204 4208
 
4205 4209
 		return $color;
4206 4210
 	}
Please login to merge, or discard this patch.
src/wp-includes/class-wp-feed-cache-transient.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
 	 * @access public
99 99
 	 *
100 100
 	 * @param SimplePie $data Data to save.
101
-	 * @return true Always true.
101
+	 * @return boolean Always true.
102 102
 	 */
103 103
 	public function save($data) {
104 104
 		if ( $data instanceof SimplePie ) {
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @since 2.8.0
153 153
 	 * @access public
154 154
 	 *
155
-	 * @return true Always true.
155
+	 * @return boolean Always true.
156 156
 	 */
157 157
 	public function unlink() {
158 158
 		delete_transient($this->name);
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 	 * @param string $extension 'spi' or 'spc'.
56 56
 	 */
57 57
 	public function __construct($location, $filename, $extension) {
58
-		$this->name = 'feed_' . $filename;
59
-		$this->mod_name = 'feed_mod_' . $filename;
58
+		$this->name = 'feed_'.$filename;
59
+		$this->mod_name = 'feed_mod_'.$filename;
60 60
 
61 61
 		$lifetime = $this->lifetime;
62 62
 		/**
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		 * @param int    $lifetime Cache duration in seconds. Default is 43200 seconds (12 hours).
68 68
 		 * @param string $filename Unique identifier for the cache object.
69 69
 		 */
70
-		$this->lifetime = apply_filters( 'wp_feed_cache_transient_lifetime', $lifetime, $filename);
70
+		$this->lifetime = apply_filters('wp_feed_cache_transient_lifetime', $lifetime, $filename);
71 71
 	}
72 72
 
73 73
 	/**
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @return true Always true.
81 81
 	 */
82 82
 	public function save($data) {
83
-		if ( $data instanceof SimplePie ) {
83
+		if ($data instanceof SimplePie) {
84 84
 			$data = $data->data;
85 85
 		}
86 86
 
Please login to merge, or discard this patch.
src/wp-includes/class-wp-hook.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
 	 * @since 4.7.0
102 102
 	 * @access private
103 103
 	 *
104
-	 * @param bool|int $new_priority     Optional. The priority of the new filter being added. Default false,
104
+	 * @param integer $new_priority     Optional. The priority of the new filter being added. Default false,
105 105
 	 *                                   for no priority being added.
106 106
 	 * @param bool     $priority_existed Optional. Flag for whether the priority already existed before the new
107 107
 	 *                                   filter was added. Default false.
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 * @since 4.7.0
270 270
 	 * @access public
271 271
 	 *
272
-	 * @param mixed $value The value to filter.
272
+	 * @param string $value The value to filter.
273 273
 	 * @param array $args  Arguments to pass to callbacks.
274 274
 	 * @return mixed The filtered value after all hooked functions are applied to it.
275 275
 	 */
Please login to merge, or discard this patch.
Spacing   +103 added lines, -103 removed lines patch added patch discarded remove patch
@@ -76,22 +76,22 @@  discard block
 block discarded – undo
76 76
 	 *                                  in the order in which they were added to the action.
77 77
 	 * @param int      $accepted_args   The number of arguments the function accepts.
78 78
 	 */
79
-	public function add_filter( $tag, $function_to_add, $priority, $accepted_args ) {
80
-		$idx = _wp_filter_build_unique_id( $tag, $function_to_add, $priority );
81
-		$priority_existed = isset( $this->callbacks[ $priority ] );
79
+	public function add_filter($tag, $function_to_add, $priority, $accepted_args) {
80
+		$idx = _wp_filter_build_unique_id($tag, $function_to_add, $priority);
81
+		$priority_existed = isset($this->callbacks[$priority]);
82 82
 
83
-		$this->callbacks[ $priority ][ $idx ] = array(
83
+		$this->callbacks[$priority][$idx] = array(
84 84
 			'function' => $function_to_add,
85 85
 			'accepted_args' => $accepted_args
86 86
 		);
87 87
 
88 88
 		// if we're adding a new priority to the list, put them back in sorted order
89
-		if ( ! $priority_existed && count( $this->callbacks ) > 1 ) {
90
-			ksort( $this->callbacks, SORT_NUMERIC );
89
+		if ( ! $priority_existed && count($this->callbacks) > 1) {
90
+			ksort($this->callbacks, SORT_NUMERIC);
91 91
 		}
92 92
 
93
-		if ( $this->nesting_level > 0 ) {
94
-			$this->resort_active_iterations( $priority, $priority_existed );
93
+		if ($this->nesting_level > 0) {
94
+			$this->resort_active_iterations($priority, $priority_existed);
95 95
 		}
96 96
 	}
97 97
 
@@ -106,62 +106,62 @@  discard block
 block discarded – undo
106 106
 	 * @param bool     $priority_existed Optional. Flag for whether the priority already existed before the new
107 107
 	 *                                   filter was added. Default false.
108 108
 	 */
109
-	private function resort_active_iterations( $new_priority = false, $priority_existed = false ) {
110
-		$new_priorities = array_keys( $this->callbacks );
109
+	private function resort_active_iterations($new_priority = false, $priority_existed = false) {
110
+		$new_priorities = array_keys($this->callbacks);
111 111
 
112 112
 		// If there are no remaining hooks, clear out all running iterations.
113
-		if ( ! $new_priorities ) {
114
-			foreach ( $this->iterations as $index => $iteration ) {
115
-				$this->iterations[ $index ] = $new_priorities;
113
+		if ( ! $new_priorities) {
114
+			foreach ($this->iterations as $index => $iteration) {
115
+				$this->iterations[$index] = $new_priorities;
116 116
 			}
117 117
 			return;
118 118
 		}
119 119
 
120
-		$min = min( $new_priorities );
121
-		foreach ( $this->iterations as $index => &$iteration ) {
122
-			$current = current( $iteration );
120
+		$min = min($new_priorities);
121
+		foreach ($this->iterations as $index => &$iteration) {
122
+			$current = current($iteration);
123 123
 			// If we're already at the end of this iteration, just leave the array pointer where it is.
124
-			if ( false === $current ) {
124
+			if (false === $current) {
125 125
 				continue;
126 126
 			}
127 127
 
128 128
 			$iteration = $new_priorities;
129 129
 
130
-			if ( $current < $min ) {
131
-				array_unshift( $iteration, $current );
130
+			if ($current < $min) {
131
+				array_unshift($iteration, $current);
132 132
 				continue;
133 133
 			}
134 134
 
135
-			while ( current( $iteration ) < $current ) {
136
-				if ( false === next( $iteration ) ) {
135
+			while (current($iteration) < $current) {
136
+				if (false === next($iteration)) {
137 137
 					break;
138 138
 				}
139 139
 			}
140 140
 
141 141
 			// If we have a new priority that didn't exist, but ::apply_filters() or ::do_action() thinks it's the current priority...
142
-			if ( $new_priority === $this->current_priority[ $index ] && ! $priority_existed ) {
142
+			if ($new_priority === $this->current_priority[$index] && ! $priority_existed) {
143 143
 				/*
144 144
 				 * ... and the new priority is the same as what $this->iterations thinks is the previous
145 145
 				 * priority, we need to move back to it.
146 146
 				 */
147 147
 
148
-				if ( false === current( $iteration ) ) {
148
+				if (false === current($iteration)) {
149 149
 					// If we've already moved off the end of the array, go back to the last element.
150
-					$prev = end( $iteration );
150
+					$prev = end($iteration);
151 151
 				} else {
152 152
 					// Otherwise, just go back to the previous element.
153
-					$prev = prev( $iteration );
153
+					$prev = prev($iteration);
154 154
 				}
155
-				if ( false === $prev ) {
155
+				if (false === $prev) {
156 156
 					// Start of the array. Reset, and go about our day.
157
-					reset( $iteration );
158
-				} elseif ( $new_priority !== $prev ) {
157
+					reset($iteration);
158
+				} elseif ($new_priority !== $prev) {
159 159
 					// Previous wasn't the same. Move forward again.
160
-					next( $iteration );
160
+					next($iteration);
161 161
 				}
162 162
 			}
163 163
 		}
164
-		unset( $iteration );
164
+		unset($iteration);
165 165
 	}
166 166
 
167 167
 	/**
@@ -176,15 +176,15 @@  discard block
 block discarded – undo
176 176
 	 * @param int      $priority           The exact priority used when adding the original filter callback.
177 177
 	 * @return bool Whether the callback existed before it was removed.
178 178
 	 */
179
-	public function remove_filter( $tag, $function_to_remove, $priority ) {
180
-		$function_key = _wp_filter_build_unique_id( $tag, $function_to_remove, $priority );
181
-
182
-		$exists = isset( $this->callbacks[ $priority ][ $function_key ] );
183
-		if ( $exists ) {
184
-			unset( $this->callbacks[ $priority ][ $function_key ] );
185
-			if ( ! $this->callbacks[ $priority ] ) {
186
-				unset( $this->callbacks[ $priority ] );
187
-				if ( $this->nesting_level > 0 ) {
179
+	public function remove_filter($tag, $function_to_remove, $priority) {
180
+		$function_key = _wp_filter_build_unique_id($tag, $function_to_remove, $priority);
181
+
182
+		$exists = isset($this->callbacks[$priority][$function_key]);
183
+		if ($exists) {
184
+			unset($this->callbacks[$priority][$function_key]);
185
+			if ( ! $this->callbacks[$priority]) {
186
+				unset($this->callbacks[$priority]);
187
+				if ($this->nesting_level > 0) {
188 188
 					$this->resort_active_iterations();
189 189
 				}
190 190
 			}
@@ -203,18 +203,18 @@  discard block
 block discarded – undo
203 203
 	 *                                         the callback ID when SPL is not available. Default empty.
204 204
 	 * @return bool|int The priority of that hook is returned, or false if the function is not attached.
205 205
 	 */
206
-	public function has_filter( $tag = '', $function_to_check = false ) {
207
-		if ( false === $function_to_check ) {
206
+	public function has_filter($tag = '', $function_to_check = false) {
207
+		if (false === $function_to_check) {
208 208
 			return $this->has_filters();
209 209
 		}
210 210
 
211
-		$function_key = _wp_filter_build_unique_id( $tag, $function_to_check, false );
212
-		if ( ! $function_key ) {
211
+		$function_key = _wp_filter_build_unique_id($tag, $function_to_check, false);
212
+		if ( ! $function_key) {
213 213
 			return false;
214 214
 		}
215 215
 
216
-		foreach ( $this->callbacks as $priority => $callbacks ) {
217
-			if ( isset( $callbacks[ $function_key ] ) ) {
216
+		foreach ($this->callbacks as $priority => $callbacks) {
217
+			if (isset($callbacks[$function_key])) {
218 218
 				return $priority;
219 219
 			}
220 220
 		}
@@ -231,8 +231,8 @@  discard block
 block discarded – undo
231 231
 	 * @return bool True if callbacks have been registered for the current hook, otherwise false.
232 232
 	 */
233 233
 	public function has_filters() {
234
-		foreach ( $this->callbacks as $callbacks ) {
235
-			if ( $callbacks ) {
234
+		foreach ($this->callbacks as $callbacks) {
235
+			if ($callbacks) {
236 236
 				return true;
237 237
 			}
238 238
 		}
@@ -247,18 +247,18 @@  discard block
 block discarded – undo
247 247
 	 *
248 248
 	 * @param int|bool $priority Optional. The priority number to remove. Default false.
249 249
 	 */
250
-	public function remove_all_filters( $priority = false ) {
251
-		if ( ! $this->callbacks ) {
250
+	public function remove_all_filters($priority = false) {
251
+		if ( ! $this->callbacks) {
252 252
 			return;
253 253
 		}
254 254
 
255
-		if ( false === $priority ) {
255
+		if (false === $priority) {
256 256
 			$this->callbacks = array();
257
-		} else if ( isset( $this->callbacks[ $priority ] ) ) {
258
-			unset( $this->callbacks[ $priority ] );
257
+		} else if (isset($this->callbacks[$priority])) {
258
+			unset($this->callbacks[$priority]);
259 259
 		}
260 260
 
261
-		if ( $this->nesting_level > 0 ) {
261
+		if ($this->nesting_level > 0) {
262 262
 			$this->resort_active_iterations();
263 263
 		}
264 264
 	}
@@ -273,37 +273,37 @@  discard block
 block discarded – undo
273 273
 	 * @param array $args  Arguments to pass to callbacks.
274 274
 	 * @return mixed The filtered value after all hooked functions are applied to it.
275 275
 	 */
276
-	public function apply_filters( $value, $args ) {
277
-		if ( ! $this->callbacks ) {
276
+	public function apply_filters($value, $args) {
277
+		if ( ! $this->callbacks) {
278 278
 			return $value;
279 279
 		}
280 280
 
281 281
 		$nesting_level = $this->nesting_level++;
282 282
 
283
-		$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
284
-		$num_args = count( $args );
283
+		$this->iterations[$nesting_level] = array_keys($this->callbacks);
284
+		$num_args = count($args);
285 285
 
286 286
 		do {
287
-			$this->current_priority[ $nesting_level ] = $priority = current( $this->iterations[ $nesting_level ] );
287
+			$this->current_priority[$nesting_level] = $priority = current($this->iterations[$nesting_level]);
288 288
 
289
-			foreach ( $this->callbacks[ $priority ] as $the_ ) {
290
-				if( ! $this->doing_action ) {
291
-					$args[ 0 ] = $value;
289
+			foreach ($this->callbacks[$priority] as $the_) {
290
+				if ( ! $this->doing_action) {
291
+					$args[0] = $value;
292 292
 				}
293 293
 
294 294
 				// Avoid the array_slice if possible.
295
-				if ( $the_['accepted_args'] == 0 ) {
296
-					$value = call_user_func_array( $the_['function'], array() );
297
-				} elseif ( $the_['accepted_args'] >= $num_args ) {
298
-					$value = call_user_func_array( $the_['function'], $args );
295
+				if ($the_['accepted_args'] == 0) {
296
+					$value = call_user_func_array($the_['function'], array());
297
+				} elseif ($the_['accepted_args'] >= $num_args) {
298
+					$value = call_user_func_array($the_['function'], $args);
299 299
 				} else {
300
-					$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int)$the_['accepted_args'] ) );
300
+					$value = call_user_func_array($the_['function'], array_slice($args, 0, (int) $the_['accepted_args']));
301 301
 				}
302 302
 			}
303
-		} while ( false !== next( $this->iterations[ $nesting_level ] ) );
303
+		} while (false !== next($this->iterations[$nesting_level]));
304 304
 
305
-		unset( $this->iterations[ $nesting_level ] );
306
-		unset( $this->current_priority[ $nesting_level ] );
305
+		unset($this->iterations[$nesting_level]);
306
+		unset($this->current_priority[$nesting_level]);
307 307
 
308 308
 		$this->nesting_level--;
309 309
 
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
 	 *
319 319
 	 * @param mixed $args Arguments to pass to the hook callbacks.
320 320
 	 */
321
-	public function do_action( $args ) {
321
+	public function do_action($args) {
322 322
 		$this->doing_action = true;
323
-		$this->apply_filters( '', $args );
323
+		$this->apply_filters('', $args);
324 324
 
325 325
 		// If there are recursive calls to the current action, we haven't finished it until we get to the last one.
326
-		if ( ! $this->nesting_level ) {
326
+		if ( ! $this->nesting_level) {
327 327
 			$this->doing_action = false;
328 328
 		}
329 329
 	}
@@ -336,18 +336,18 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @param array $args Arguments to pass to the hook callbacks. Passed by reference.
338 338
 	 */
339
-	public function do_all_hook( &$args ) {
339
+	public function do_all_hook(&$args) {
340 340
 		$nesting_level = $this->nesting_level++;
341
-		$this->iterations[ $nesting_level ] = array_keys( $this->callbacks );
341
+		$this->iterations[$nesting_level] = array_keys($this->callbacks);
342 342
 
343 343
 		do {
344
-			$priority = current( $this->iterations[ $nesting_level ] );
345
-			foreach ( $this->callbacks[ $priority ] as $the_ ) {
346
-				call_user_func_array( $the_['function'], $args );
344
+			$priority = current($this->iterations[$nesting_level]);
345
+			foreach ($this->callbacks[$priority] as $the_) {
346
+				call_user_func_array($the_['function'], $args);
347 347
 			}
348
-		} while ( false !== next( $this->iterations[ $nesting_level ] ) );
348
+		} while (false !== next($this->iterations[$nesting_level]));
349 349
 
350
-		unset( $this->iterations[ $nesting_level ] );
350
+		unset($this->iterations[$nesting_level]);
351 351
 		$this->nesting_level--;
352 352
 	}
353 353
 
@@ -360,11 +360,11 @@  discard block
 block discarded – undo
360 360
 	 * @return int|false If the hook is running, return the current priority level. If it isn't running, return false.
361 361
 	 */
362 362
 	public function current_priority() {
363
-		if ( false === current( $this->iterations ) ) {
363
+		if (false === current($this->iterations)) {
364 364
 			return false;
365 365
 		}
366 366
 
367
-		return current( current( $this->iterations ) );
367
+		return current(current($this->iterations));
368 368
 	}
369 369
 
370 370
 	/**
@@ -377,26 +377,26 @@  discard block
 block discarded – undo
377 377
 	 * @param array $filters Filters to normalize.
378 378
 	 * @return WP_Hook[] Array of normalized filters.
379 379
 	 */
380
-	public static function build_preinitialized_hooks( $filters ) {
380
+	public static function build_preinitialized_hooks($filters) {
381 381
 		/** @var WP_Hook[] $normalized */
382 382
 		$normalized = array();
383 383
 
384
-		foreach ( $filters as $tag => $callback_groups ) {
385
-			if ( is_object( $callback_groups ) && $callback_groups instanceof WP_Hook ) {
386
-				$normalized[ $tag ] = $callback_groups;
384
+		foreach ($filters as $tag => $callback_groups) {
385
+			if (is_object($callback_groups) && $callback_groups instanceof WP_Hook) {
386
+				$normalized[$tag] = $callback_groups;
387 387
 				continue;
388 388
 			}
389 389
 			$hook = new WP_Hook();
390 390
 
391 391
 			// Loop through callback groups.
392
-			foreach ( $callback_groups as $priority => $callbacks ) {
392
+			foreach ($callback_groups as $priority => $callbacks) {
393 393
 
394 394
 				// Loop through callbacks.
395
-				foreach ( $callbacks as $cb ) {
396
-					$hook->add_filter( $tag, $cb['function'], $priority, $cb['accepted_args'] );
395
+				foreach ($callbacks as $cb) {
396
+					$hook->add_filter($tag, $cb['function'], $priority, $cb['accepted_args']);
397 397
 				}
398 398
 			}
399
-			$normalized[ $tag ] = $hook;
399
+			$normalized[$tag] = $hook;
400 400
 		}
401 401
 		return $normalized;
402 402
 	}
@@ -412,8 +412,8 @@  discard block
 block discarded – undo
412 412
 	 * @param mixed $offset An offset to check for.
413 413
 	 * @return bool True if the offset exists, false otherwise.
414 414
 	 */
415
-	public function offsetExists( $offset ) {
416
-		return isset( $this->callbacks[ $offset ] );
415
+	public function offsetExists($offset) {
416
+		return isset($this->callbacks[$offset]);
417 417
 	}
418 418
 
419 419
 	/**
@@ -427,8 +427,8 @@  discard block
 block discarded – undo
427 427
 	 * @param mixed $offset The offset to retrieve.
428 428
 	 * @return mixed If set, the value at the specified offset, null otherwise.
429 429
 	 */
430
-	public function offsetGet( $offset ) {
431
-		return isset( $this->callbacks[ $offset ] ) ? $this->callbacks[ $offset ] : null;
430
+	public function offsetGet($offset) {
431
+		return isset($this->callbacks[$offset]) ? $this->callbacks[$offset] : null;
432 432
 	}
433 433
 
434 434
 	/**
@@ -442,11 +442,11 @@  discard block
 block discarded – undo
442 442
 	 * @param mixed $offset The offset to assign the value to.
443 443
 	 * @param mixed $value The value to set.
444 444
 	 */
445
-	public function offsetSet( $offset, $value ) {
446
-		if ( is_null( $offset ) ) {
445
+	public function offsetSet($offset, $value) {
446
+		if (is_null($offset)) {
447 447
 			$this->callbacks[] = $value;
448 448
 		} else {
449
-			$this->callbacks[ $offset ] = $value;
449
+			$this->callbacks[$offset] = $value;
450 450
 		}
451 451
 	}
452 452
 
@@ -460,8 +460,8 @@  discard block
 block discarded – undo
460 460
 	 *
461 461
 	 * @param mixed $offset The offset to unset.
462 462
 	 */
463
-	public function offsetUnset( $offset ) {
464
-		unset( $this->callbacks[ $offset ] );
463
+	public function offsetUnset($offset) {
464
+		unset($this->callbacks[$offset]);
465 465
 	}
466 466
 
467 467
 	/**
@@ -475,7 +475,7 @@  discard block
 block discarded – undo
475 475
 	 * @return array Of callbacks at current priority.
476 476
 	 */
477 477
 	public function current() {
478
-		return current( $this->callbacks );
478
+		return current($this->callbacks);
479 479
 	}
480 480
 
481 481
 	/**
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
 	 * @return array Of callbacks at next priority.
490 490
 	 */
491 491
 	public function next() {
492
-		return next( $this->callbacks );
492
+		return next($this->callbacks);
493 493
 	}
494 494
 
495 495
 	/**
@@ -503,7 +503,7 @@  discard block
 block discarded – undo
503 503
 	 * @return mixed Returns current priority on success, or NULL on failure
504 504
 	 */
505 505
 	public function key() {
506
-		return key( $this->callbacks );
506
+		return key($this->callbacks);
507 507
 	}
508 508
 
509 509
 	/**
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 * @return boolean
518 518
 	 */
519 519
 	public function valid() {
520
-		return key( $this->callbacks ) !== null;
520
+		return key($this->callbacks) !== null;
521 521
 	}
522 522
 
523 523
 	/**
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 * @link http://php.net/manual/en/iterator.rewind.php
530 530
 	 */
531 531
 	public function rewind() {
532
-		reset( $this->callbacks );
532
+		reset($this->callbacks);
533 533
 	}
534 534
 
535 535
 }
Please login to merge, or discard this patch.
src/wp-includes/class-wp-image-editor-imagick.php 3 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -292,7 +292,7 @@  discard block
 block discarded – undo
292 292
 	 * @param int    $dst_h       The destination height.
293 293
 	 * @param string $filter_name Optional. The Imagick filter to use when resizing. Default 'FILTER_TRIANGLE'.
294 294
 	 * @param bool   $strip_meta  Optional. Strip all profiles, excluding color profiles, from the image. Default true.
295
-	 * @return bool|WP_Error
295
+	 * @return null|WP_Error
296 296
 	 */
297 297
 	protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) {
298 298
 		$allowed_filters = array(
@@ -745,7 +745,7 @@  discard block
 block discarded – undo
745 745
 	 * @since 4.7.0
746 746
 	 * @access protected
747 747
 	 *
748
-	 * @return string|WP_Error File to load or WP_Error on failure.
748
+	 * @return string File to load or WP_Error on failure.
749 749
 	 */
750 750
 	protected function pdf_setup() {
751 751
 		try {
Please login to merge, or discard this patch.
Spacing   +163 added lines, -163 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 	protected $image;
25 25
 
26 26
 	public function __destruct() {
27
-		if ( $this->image instanceof Imagick ) {
27
+		if ($this->image instanceof Imagick) {
28 28
 			// we don't need the original in memory anymore
29 29
 			$this->image->clear();
30 30
 			$this->image->destroy();
@@ -45,13 +45,13 @@  discard block
 block discarded – undo
45 45
 	 * @param array $args
46 46
 	 * @return bool
47 47
 	 */
48
-	public static function test( $args = array() ) {
48
+	public static function test($args = array()) {
49 49
 
50 50
 		// First, test Imagick's extension and classes.
51
-		if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) )
51
+		if ( ! extension_loaded('imagick') || ! class_exists('Imagick', false) || ! class_exists('ImagickPixel', false))
52 52
 			return false;
53 53
 
54
-		if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
54
+		if (version_compare(phpversion('imagick'), '2.2.0', '<'))
55 55
 			return false;
56 56
 
57 57
 		$required_methods = array(
@@ -77,16 +77,16 @@  discard block
 block discarded – undo
77 77
 		);
78 78
 
79 79
 		// Now, test for deep requirements within Imagick.
80
-		if ( ! defined( 'imagick::COMPRESSION_JPEG' ) )
80
+		if ( ! defined('imagick::COMPRESSION_JPEG'))
81 81
 			return false;
82 82
 
83
-		$class_methods = array_map( 'strtolower', get_class_methods( 'Imagick' ) );
84
-		if ( array_diff( $required_methods, $class_methods ) ) {
83
+		$class_methods = array_map('strtolower', get_class_methods('Imagick'));
84
+		if (array_diff($required_methods, $class_methods)) {
85 85
 			return false;
86 86
 		}
87 87
 
88 88
 		// HHVM Imagick does not support loading from URL, so fail to allow fallback to GD.
89
-		if ( defined( 'HHVM_VERSION' ) && isset( $args['path'] ) && preg_match( '|^https?://|', $args['path'] ) ) {
89
+		if (defined('HHVM_VERSION') && isset($args['path']) && preg_match('|^https?://|', $args['path'])) {
90 90
 			return false;
91 91
 		}
92 92
 
@@ -104,21 +104,21 @@  discard block
 block discarded – undo
104 104
 	 * @param string $mime_type
105 105
 	 * @return bool
106 106
 	 */
107
-	public static function supports_mime_type( $mime_type ) {
108
-		$imagick_extension = strtoupper( self::get_extension( $mime_type ) );
107
+	public static function supports_mime_type($mime_type) {
108
+		$imagick_extension = strtoupper(self::get_extension($mime_type));
109 109
 
110
-		if ( ! $imagick_extension )
110
+		if ( ! $imagick_extension)
111 111
 			return false;
112 112
 
113 113
 		// setIteratorIndex is optional unless mime is an animated format.
114 114
 		// Here, we just say no if you are missing it and aren't loading a jpeg.
115
-		if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && $mime_type != 'image/jpeg' )
115
+		if ( ! method_exists('Imagick', 'setIteratorIndex') && $mime_type != 'image/jpeg')
116 116
 				return false;
117 117
 
118 118
 		try {
119
-			return ( (bool) @Imagick::queryFormats( $imagick_extension ) );
119
+			return ((bool) @Imagick::queryFormats($imagick_extension));
120 120
 		}
121
-		catch ( Exception $e ) {
121
+		catch (Exception $e) {
122 122
 			return false;
123 123
 		}
124 124
 	}
@@ -132,46 +132,46 @@  discard block
 block discarded – undo
132 132
 	 * @return true|WP_Error True if loaded; WP_Error on failure.
133 133
 	 */
134 134
 	public function load() {
135
-		if ( $this->image instanceof Imagick )
135
+		if ($this->image instanceof Imagick)
136 136
 			return true;
137 137
 
138
-		if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
139
-			return new WP_Error( 'error_loading_image', __('File doesn&#8217;t exist?'), $this->file );
138
+		if ( ! is_file($this->file) && ! preg_match('|^https?://|', $this->file))
139
+			return new WP_Error('error_loading_image', __('File doesn&#8217;t exist?'), $this->file);
140 140
 
141 141
 		/*
142 142
 		 * Even though Imagick uses less PHP memory than GD, set higher limit
143 143
 		 * for users that have low PHP.ini limits.
144 144
 		 */
145
-		wp_raise_memory_limit( 'image' );
145
+		wp_raise_memory_limit('image');
146 146
 
147 147
 		try {
148 148
 			$this->image = new Imagick();
149
-			$file_extension = strtolower( pathinfo( $this->file, PATHINFO_EXTENSION ) );
149
+			$file_extension = strtolower(pathinfo($this->file, PATHINFO_EXTENSION));
150 150
 			$filename = $this->file;
151 151
 
152
-			if ( 'pdf' == $file_extension ) {
152
+			if ('pdf' == $file_extension) {
153 153
 				$filename = $this->pdf_setup();
154 154
 			}
155 155
 
156 156
 			// Reading image after Imagick instantiation because `setResolution`
157 157
 			// only applies correctly before the image is read.
158
-			$this->image->readImage( $filename );
158
+			$this->image->readImage($filename);
159 159
 
160
-			if ( ! $this->image->valid() )
161
-				return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
160
+			if ( ! $this->image->valid())
161
+				return new WP_Error('invalid_image', __('File is not an image.'), $this->file);
162 162
 
163 163
 			// Select the first frame to handle animated images properly
164
-			if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) )
164
+			if (is_callable(array($this->image, 'setIteratorIndex')))
165 165
 				$this->image->setIteratorIndex(0);
166 166
 
167
-			$this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
167
+			$this->mime_type = $this->get_mime_type($this->image->getImageFormat());
168 168
 		}
169
-		catch ( Exception $e ) {
170
-			return new WP_Error( 'invalid_image', $e->getMessage(), $this->file );
169
+		catch (Exception $e) {
170
+			return new WP_Error('invalid_image', $e->getMessage(), $this->file);
171 171
 		}
172 172
 
173 173
 		$updated_size = $this->update_size();
174
-		if ( is_wp_error( $updated_size ) ) {
174
+		if (is_wp_error($updated_size)) {
175 175
 			return $updated_size;
176 176
 		}
177 177
 
@@ -187,25 +187,25 @@  discard block
 block discarded – undo
187 187
 	 * @param int $quality Compression Quality. Range: [1,100]
188 188
 	 * @return true|WP_Error True if set successfully; WP_Error on failure.
189 189
 	 */
190
-	public function set_quality( $quality = null ) {
191
-		$quality_result = parent::set_quality( $quality );
192
-		if ( is_wp_error( $quality_result ) ) {
190
+	public function set_quality($quality = null) {
191
+		$quality_result = parent::set_quality($quality);
192
+		if (is_wp_error($quality_result)) {
193 193
 			return $quality_result;
194 194
 		} else {
195 195
 			$quality = $this->get_quality();
196 196
 		}
197 197
 
198 198
 		try {
199
-			if ( 'image/jpeg' == $this->mime_type ) {
200
-				$this->image->setImageCompressionQuality( $quality );
201
-				$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
199
+			if ('image/jpeg' == $this->mime_type) {
200
+				$this->image->setImageCompressionQuality($quality);
201
+				$this->image->setImageCompression(imagick::COMPRESSION_JPEG);
202 202
 			}
203 203
 			else {
204
-				$this->image->setImageCompressionQuality( $quality );
204
+				$this->image->setImageCompressionQuality($quality);
205 205
 			}
206 206
 		}
207
-		catch ( Exception $e ) {
208
-			return new WP_Error( 'image_quality_error', $e->getMessage() );
207
+		catch (Exception $e) {
208
+			return new WP_Error('image_quality_error', $e->getMessage());
209 209
 		}
210 210
 
211 211
 		return true;
@@ -222,24 +222,24 @@  discard block
 block discarded – undo
222 222
 	 *
223 223
 	 * @return true|WP_Error
224 224
 	 */
225
-	protected function update_size( $width = null, $height = null ) {
225
+	protected function update_size($width = null, $height = null) {
226 226
 		$size = null;
227
-		if ( !$width || !$height ) {
227
+		if ( ! $width || ! $height) {
228 228
 			try {
229 229
 				$size = $this->image->getImageGeometry();
230 230
 			}
231
-			catch ( Exception $e ) {
232
-				return new WP_Error( 'invalid_image', __( 'Could not read image size.' ), $this->file );
231
+			catch (Exception $e) {
232
+				return new WP_Error('invalid_image', __('Could not read image size.'), $this->file);
233 233
 			}
234 234
 		}
235 235
 
236
-		if ( ! $width )
236
+		if ( ! $width)
237 237
 			$width = $size['width'];
238 238
 
239
-		if ( ! $height )
239
+		if ( ! $height)
240 240
 			$height = $size['height'];
241 241
 
242
-		return parent::update_size( $width, $height );
242
+		return parent::update_size($width, $height);
243 243
 	}
244 244
 
245 245
 	/**
@@ -257,26 +257,26 @@  discard block
 block discarded – undo
257 257
 	 * @param  bool     $crop
258 258
 	 * @return bool|WP_Error
259 259
 	 */
260
-	public function resize( $max_w, $max_h, $crop = false ) {
261
-		if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) )
260
+	public function resize($max_w, $max_h, $crop = false) {
261
+		if (($this->size['width'] == $max_w) && ($this->size['height'] == $max_h))
262 262
 			return true;
263 263
 
264
-		$dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $max_w, $max_h, $crop );
265
-		if ( ! $dims )
266
-			return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
267
-		list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
264
+		$dims = image_resize_dimensions($this->size['width'], $this->size['height'], $max_w, $max_h, $crop);
265
+		if ( ! $dims)
266
+			return new WP_Error('error_getting_dimensions', __('Could not calculate resized image dimensions'));
267
+		list($dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h) = $dims;
268 268
 
269
-		if ( $crop ) {
270
-			return $this->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h );
269
+		if ($crop) {
270
+			return $this->crop($src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h);
271 271
 		}
272 272
 
273 273
 		// Execute the resize
274
-		$thumb_result = $this->thumbnail_image( $dst_w, $dst_h );
275
-		if ( is_wp_error( $thumb_result ) ) {
274
+		$thumb_result = $this->thumbnail_image($dst_w, $dst_h);
275
+		if (is_wp_error($thumb_result)) {
276 276
 			return $thumb_result;
277 277
 		}
278 278
 
279
-		return $this->update_size( $dst_w, $dst_h );
279
+		return $this->update_size($dst_w, $dst_h);
280 280
 	}
281 281
 
282 282
 	/**
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	 * @param bool   $strip_meta  Optional. Strip all profiles, excluding color profiles, from the image. Default true.
295 295
 	 * @return bool|WP_Error
296 296
 	 */
297
-	protected function thumbnail_image( $dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true ) {
297
+	protected function thumbnail_image($dst_w, $dst_h, $filter_name = 'FILTER_TRIANGLE', $strip_meta = true) {
298 298
 		$allowed_filters = array(
299 299
 			'FILTER_POINT',
300 300
 			'FILTER_BOX',
@@ -317,10 +317,10 @@  discard block
 block discarded – undo
317 317
 		 * Set the filter value if '$filter_name' name is in our whitelist and the related
318 318
 		 * Imagick constant is defined or fall back to our default filter.
319 319
 		 */
320
-		if ( in_array( $filter_name, $allowed_filters ) && defined( 'Imagick::' . $filter_name ) ) {
321
-			$filter = constant( 'Imagick::' . $filter_name );
320
+		if (in_array($filter_name, $allowed_filters) && defined('Imagick::'.$filter_name)) {
321
+			$filter = constant('Imagick::'.$filter_name);
322 322
 		} else {
323
-			$filter = defined( 'Imagick::FILTER_TRIANGLE' ) ? Imagick::FILTER_TRIANGLE : false;
323
+			$filter = defined('Imagick::FILTER_TRIANGLE') ? Imagick::FILTER_TRIANGLE : false;
324 324
 		}
325 325
 
326 326
 		/**
@@ -333,7 +333,7 @@  discard block
 block discarded – undo
333 333
 		 *
334 334
 		 * @param bool $strip_meta Whether to strip image metadata during resizing. Default true.
335 335
 		 */
336
-		if ( apply_filters( 'image_strip_meta', $strip_meta ) ) {
336
+		if (apply_filters('image_strip_meta', $strip_meta)) {
337 337
 			$this->strip_meta(); // Fail silently if not supported.
338 338
 		}
339 339
 
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 			 * whenever the output size is less that 1/3 of the original image size (1/3^2 ~= .111),
344 344
 			 * unless we would be resampling to a scale smaller than 128x128.
345 345
 			 */
346
-			if ( is_callable( array( $this->image, 'sampleImage' ) ) ) {
347
-				$resize_ratio = ( $dst_w / $this->size['width'] ) * ( $dst_h / $this->size['height'] );
346
+			if (is_callable(array($this->image, 'sampleImage'))) {
347
+				$resize_ratio = ($dst_w / $this->size['width']) * ($dst_h / $this->size['height']);
348 348
 				$sample_factor = 5;
349 349
 
350
-				if ( $resize_ratio < .111 && ( $dst_w * $sample_factor > 128 && $dst_h * $sample_factor > 128 ) ) {
351
-					$this->image->sampleImage( $dst_w * $sample_factor, $dst_h * $sample_factor );
350
+				if ($resize_ratio < .111 && ($dst_w * $sample_factor > 128 && $dst_h * $sample_factor > 128)) {
351
+					$this->image->sampleImage($dst_w * $sample_factor, $dst_h * $sample_factor);
352 352
 				}
353 353
 			}
354 354
 
@@ -358,27 +358,27 @@  discard block
 block discarded – undo
358 358
 			 * results in better image quality over resizeImage() with default filter
359 359
 			 * settings and retains backward compatibility with pre 4.5 functionality.
360 360
 			 */
361
-			if ( is_callable( array( $this->image, 'resizeImage' ) ) && $filter ) {
362
-				$this->image->setOption( 'filter:support', '2.0' );
363
-				$this->image->resizeImage( $dst_w, $dst_h, $filter, 1 );
361
+			if (is_callable(array($this->image, 'resizeImage')) && $filter) {
362
+				$this->image->setOption('filter:support', '2.0');
363
+				$this->image->resizeImage($dst_w, $dst_h, $filter, 1);
364 364
 			} else {
365
-				$this->image->scaleImage( $dst_w, $dst_h );
365
+				$this->image->scaleImage($dst_w, $dst_h);
366 366
 			}
367 367
 
368 368
 			// Set appropriate quality settings after resizing.
369
-			if ( 'image/jpeg' == $this->mime_type ) {
370
-				if ( is_callable( array( $this->image, 'unsharpMaskImage' ) ) ) {
371
-					$this->image->unsharpMaskImage( 0.25, 0.25, 8, 0.065 );
369
+			if ('image/jpeg' == $this->mime_type) {
370
+				if (is_callable(array($this->image, 'unsharpMaskImage'))) {
371
+					$this->image->unsharpMaskImage(0.25, 0.25, 8, 0.065);
372 372
 				}
373 373
 
374
-				$this->image->setOption( 'jpeg:fancy-upsampling', 'off' );
374
+				$this->image->setOption('jpeg:fancy-upsampling', 'off');
375 375
 			}
376 376
 
377
-			if ( 'image/png' === $this->mime_type ) {
378
-				$this->image->setOption( 'png:compression-filter', '5' );
379
-				$this->image->setOption( 'png:compression-level', '9' );
380
-				$this->image->setOption( 'png:compression-strategy', '1' );
381
-				$this->image->setOption( 'png:exclude-chunk', 'all' );
377
+			if ('image/png' === $this->mime_type) {
378
+				$this->image->setOption('png:compression-filter', '5');
379
+				$this->image->setOption('png:compression-level', '9');
380
+				$this->image->setOption('png:compression-strategy', '1');
381
+				$this->image->setOption('png:exclude-chunk', 'all');
382 382
 			}
383 383
 
384 384
 			/*
@@ -387,30 +387,30 @@  discard block
 block discarded – undo
387 387
 			 * Note that Imagick::getImageAlphaChannel() is only available if Imagick
388 388
 			 * has been compiled against ImageMagick version 6.4.0 or newer.
389 389
 			 */
390
-			if ( is_callable( array( $this->image, 'getImageAlphaChannel' ) )
391
-				&& is_callable( array( $this->image, 'setImageAlphaChannel' ) )
392
-				&& defined( 'Imagick::ALPHACHANNEL_UNDEFINED' )
393
-				&& defined( 'Imagick::ALPHACHANNEL_OPAQUE' )
390
+			if (is_callable(array($this->image, 'getImageAlphaChannel'))
391
+				&& is_callable(array($this->image, 'setImageAlphaChannel'))
392
+				&& defined('Imagick::ALPHACHANNEL_UNDEFINED')
393
+				&& defined('Imagick::ALPHACHANNEL_OPAQUE')
394 394
 			) {
395
-				if ( $this->image->getImageAlphaChannel() === Imagick::ALPHACHANNEL_UNDEFINED ) {
396
-					$this->image->setImageAlphaChannel( Imagick::ALPHACHANNEL_OPAQUE );
395
+				if ($this->image->getImageAlphaChannel() === Imagick::ALPHACHANNEL_UNDEFINED) {
396
+					$this->image->setImageAlphaChannel(Imagick::ALPHACHANNEL_OPAQUE);
397 397
 				}
398 398
 			}
399 399
 
400 400
 			// Limit the bit depth of resized images to 8 bits per channel.
401
-			if ( is_callable( array( $this->image, 'getImageDepth' ) ) && is_callable( array( $this->image, 'setImageDepth' ) ) ) {
402
-				if ( 8 < $this->image->getImageDepth() ) {
403
-					$this->image->setImageDepth( 8 );
401
+			if (is_callable(array($this->image, 'getImageDepth')) && is_callable(array($this->image, 'setImageDepth'))) {
402
+				if (8 < $this->image->getImageDepth()) {
403
+					$this->image->setImageDepth(8);
404 404
 				}
405 405
 			}
406 406
 
407
-			if ( is_callable( array( $this->image, 'setInterlaceScheme' ) ) && defined( 'Imagick::INTERLACE_NO' ) ) {
408
-				$this->image->setInterlaceScheme( Imagick::INTERLACE_NO );
407
+			if (is_callable(array($this->image, 'setInterlaceScheme')) && defined('Imagick::INTERLACE_NO')) {
408
+				$this->image->setInterlaceScheme(Imagick::INTERLACE_NO);
409 409
 			}
410 410
 
411 411
 		}
412
-		catch ( Exception $e ) {
413
-			return new WP_Error( 'image_resize_error', $e->getMessage() );
412
+		catch (Exception $e) {
413
+			return new WP_Error('image_resize_error', $e->getMessage());
414 414
 		}
415 415
 	}
416 416
 
@@ -437,42 +437,42 @@  discard block
 block discarded – undo
437 437
 	 * }
438 438
 	 * @return array An array of resized images' metadata by size.
439 439
 	 */
440
-	public function multi_resize( $sizes ) {
440
+	public function multi_resize($sizes) {
441 441
 		$metadata = array();
442 442
 		$orig_size = $this->size;
443 443
 		$orig_image = $this->image->getImage();
444 444
 
445
-		foreach ( $sizes as $size => $size_data ) {
446
-			if ( ! $this->image )
445
+		foreach ($sizes as $size => $size_data) {
446
+			if ( ! $this->image)
447 447
 				$this->image = $orig_image->getImage();
448 448
 
449
-			if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
449
+			if ( ! isset($size_data['width']) && ! isset($size_data['height'])) {
450 450
 				continue;
451 451
 			}
452 452
 
453
-			if ( ! isset( $size_data['width'] ) ) {
453
+			if ( ! isset($size_data['width'])) {
454 454
 				$size_data['width'] = null;
455 455
 			}
456
-			if ( ! isset( $size_data['height'] ) ) {
456
+			if ( ! isset($size_data['height'])) {
457 457
 				$size_data['height'] = null;
458 458
 			}
459 459
 
460
-			if ( ! isset( $size_data['crop'] ) ) {
460
+			if ( ! isset($size_data['crop'])) {
461 461
 				$size_data['crop'] = false;
462 462
 			}
463 463
 
464
-			$resize_result = $this->resize( $size_data['width'], $size_data['height'], $size_data['crop'] );
465
-			$duplicate = ( ( $orig_size['width'] == $size_data['width'] ) && ( $orig_size['height'] == $size_data['height'] ) );
464
+			$resize_result = $this->resize($size_data['width'], $size_data['height'], $size_data['crop']);
465
+			$duplicate = (($orig_size['width'] == $size_data['width']) && ($orig_size['height'] == $size_data['height']));
466 466
 
467
-			if ( ! is_wp_error( $resize_result ) && ! $duplicate ) {
468
-				$resized = $this->_save( $this->image );
467
+			if ( ! is_wp_error($resize_result) && ! $duplicate) {
468
+				$resized = $this->_save($this->image);
469 469
 
470 470
 				$this->image->clear();
471 471
 				$this->image->destroy();
472 472
 				$this->image = null;
473 473
 
474
-				if ( ! is_wp_error( $resized ) && $resized ) {
475
-					unset( $resized['path'] );
474
+				if ( ! is_wp_error($resized) && $resized) {
475
+					unset($resized['path']);
476 476
 					$metadata[$size] = $resized;
477 477
 				}
478 478
 			}
@@ -500,34 +500,34 @@  discard block
 block discarded – undo
500 500
 	 * @param bool $src_abs Optional. If the source crop points are absolute.
501 501
 	 * @return bool|WP_Error
502 502
 	 */
503
-	public function crop( $src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false ) {
504
-		if ( $src_abs ) {
503
+	public function crop($src_x, $src_y, $src_w, $src_h, $dst_w = null, $dst_h = null, $src_abs = false) {
504
+		if ($src_abs) {
505 505
 			$src_w -= $src_x;
506 506
 			$src_h -= $src_y;
507 507
 		}
508 508
 
509 509
 		try {
510
-			$this->image->cropImage( $src_w, $src_h, $src_x, $src_y );
511
-			$this->image->setImagePage( $src_w, $src_h, 0, 0);
510
+			$this->image->cropImage($src_w, $src_h, $src_x, $src_y);
511
+			$this->image->setImagePage($src_w, $src_h, 0, 0);
512 512
 
513
-			if ( $dst_w || $dst_h ) {
513
+			if ($dst_w || $dst_h) {
514 514
 				// If destination width/height isn't specified, use same as
515 515
 				// width/height from source.
516
-				if ( ! $dst_w )
516
+				if ( ! $dst_w)
517 517
 					$dst_w = $src_w;
518
-				if ( ! $dst_h )
518
+				if ( ! $dst_h)
519 519
 					$dst_h = $src_h;
520 520
 
521
-				$thumb_result = $this->thumbnail_image( $dst_w, $dst_h );
522
-				if ( is_wp_error( $thumb_result ) ) {
521
+				$thumb_result = $this->thumbnail_image($dst_w, $dst_h);
522
+				if (is_wp_error($thumb_result)) {
523 523
 					return $thumb_result;
524 524
 				}
525 525
 
526 526
 				return $this->update_size();
527 527
 			}
528 528
 		}
529
-		catch ( Exception $e ) {
530
-			return new WP_Error( 'image_crop_error', $e->getMessage() );
529
+		catch (Exception $e) {
530
+			return new WP_Error('image_crop_error', $e->getMessage());
531 531
 		}
532 532
 		return $this->update_size();
533 533
 	}
@@ -541,23 +541,23 @@  discard block
 block discarded – undo
541 541
 	 * @param float $angle
542 542
 	 * @return true|WP_Error
543 543
 	 */
544
-	public function rotate( $angle ) {
544
+	public function rotate($angle) {
545 545
 		/**
546 546
 		 * $angle is 360-$angle because Imagick rotates clockwise
547 547
 		 * (GD rotates counter-clockwise)
548 548
 		 */
549 549
 		try {
550
-			$this->image->rotateImage( new ImagickPixel('none'), 360-$angle );
550
+			$this->image->rotateImage(new ImagickPixel('none'), 360 - $angle);
551 551
 
552 552
 			// Since this changes the dimensions of the image, update the size.
553 553
 			$result = $this->update_size();
554
-			if ( is_wp_error( $result ) )
554
+			if (is_wp_error($result))
555 555
 				return $result;
556 556
 
557
-			$this->image->setImagePage( $this->size['width'], $this->size['height'], 0, 0 );
557
+			$this->image->setImagePage($this->size['width'], $this->size['height'], 0, 0);
558 558
 		}
559
-		catch ( Exception $e ) {
560
-			return new WP_Error( 'image_rotate_error', $e->getMessage() );
559
+		catch (Exception $e) {
560
+			return new WP_Error('image_rotate_error', $e->getMessage());
561 561
 		}
562 562
 		return true;
563 563
 	}
@@ -572,16 +572,16 @@  discard block
 block discarded – undo
572 572
 	 * @param bool $vert Flip along Vertical Axis
573 573
 	 * @return true|WP_Error
574 574
 	 */
575
-	public function flip( $horz, $vert ) {
575
+	public function flip($horz, $vert) {
576 576
 		try {
577
-			if ( $horz )
577
+			if ($horz)
578 578
 				$this->image->flipImage();
579 579
 
580
-			if ( $vert )
580
+			if ($vert)
581 581
 				$this->image->flopImage();
582 582
 		}
583
-		catch ( Exception $e ) {
584
-			return new WP_Error( 'image_flip_error', $e->getMessage() );
583
+		catch (Exception $e) {
584
+			return new WP_Error('image_flip_error', $e->getMessage());
585 585
 		}
586 586
 		return true;
587 587
 	}
@@ -596,18 +596,18 @@  discard block
 block discarded – undo
596 596
 	 * @param string $mime_type
597 597
 	 * @return array|WP_Error {'path'=>string, 'file'=>string, 'width'=>int, 'height'=>int, 'mime-type'=>string}
598 598
 	 */
599
-	public function save( $destfilename = null, $mime_type = null ) {
600
-		$saved = $this->_save( $this->image, $destfilename, $mime_type );
599
+	public function save($destfilename = null, $mime_type = null) {
600
+		$saved = $this->_save($this->image, $destfilename, $mime_type);
601 601
 
602
-		if ( ! is_wp_error( $saved ) ) {
602
+		if ( ! is_wp_error($saved)) {
603 603
 			$this->file = $saved['path'];
604 604
 			$this->mime_type = $saved['mime-type'];
605 605
 
606 606
 			try {
607
-				$this->image->setImageFormat( strtoupper( $this->get_extension( $this->mime_type ) ) );
607
+				$this->image->setImageFormat(strtoupper($this->get_extension($this->mime_type)));
608 608
 			}
609
-			catch ( Exception $e ) {
610
-				return new WP_Error( 'image_save_error', $e->getMessage(), $this->file );
609
+			catch (Exception $e) {
610
+				return new WP_Error('image_save_error', $e->getMessage(), $this->file);
611 611
 			}
612 612
 		}
613 613
 
@@ -621,35 +621,35 @@  discard block
 block discarded – undo
621 621
 	 * @param string $mime_type
622 622
 	 * @return array|WP_Error
623 623
 	 */
624
-	protected function _save( $image, $filename = null, $mime_type = null ) {
625
-		list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
624
+	protected function _save($image, $filename = null, $mime_type = null) {
625
+		list($filename, $extension, $mime_type) = $this->get_output_format($filename, $mime_type);
626 626
 
627
-		if ( ! $filename )
628
-			$filename = $this->generate_filename( null, null, $extension );
627
+		if ( ! $filename)
628
+			$filename = $this->generate_filename(null, null, $extension);
629 629
 
630 630
 		try {
631 631
 			// Store initial Format
632 632
 			$orig_format = $this->image->getImageFormat();
633 633
 
634
-			$this->image->setImageFormat( strtoupper( $this->get_extension( $mime_type ) ) );
635
-			$this->make_image( $filename, array( $image, 'writeImage' ), array( $filename ) );
634
+			$this->image->setImageFormat(strtoupper($this->get_extension($mime_type)));
635
+			$this->make_image($filename, array($image, 'writeImage'), array($filename));
636 636
 
637 637
 			// Reset original Format
638
-			$this->image->setImageFormat( $orig_format );
638
+			$this->image->setImageFormat($orig_format);
639 639
 		}
640
-		catch ( Exception $e ) {
641
-			return new WP_Error( 'image_save_error', $e->getMessage(), $filename );
640
+		catch (Exception $e) {
641
+			return new WP_Error('image_save_error', $e->getMessage(), $filename);
642 642
 		}
643 643
 
644 644
 		// Set correct file permissions
645
-		$stat = stat( dirname( $filename ) );
645
+		$stat = stat(dirname($filename));
646 646
 		$perms = $stat['mode'] & 0000666; //same permissions as parent folder, strip off the executable bits
647
-		@ chmod( $filename, $perms );
647
+		@ chmod($filename, $perms);
648 648
 
649 649
 		/** This filter is documented in wp-includes/class-wp-image-editor-gd.php */
650 650
 		return array(
651 651
 			'path'      => $filename,
652
-			'file'      => wp_basename( apply_filters( 'image_make_intermediate_size', $filename ) ),
652
+			'file'      => wp_basename(apply_filters('image_make_intermediate_size', $filename)),
653 653
 			'width'     => $this->size['width'],
654 654
 			'height'    => $this->size['height'],
655 655
 			'mime-type' => $mime_type,
@@ -665,22 +665,22 @@  discard block
 block discarded – undo
665 665
 	 * @param string $mime_type
666 666
 	 * @return true|WP_Error
667 667
 	 */
668
-	public function stream( $mime_type = null ) {
669
-		list( $filename, $extension, $mime_type ) = $this->get_output_format( null, $mime_type );
668
+	public function stream($mime_type = null) {
669
+		list($filename, $extension, $mime_type) = $this->get_output_format(null, $mime_type);
670 670
 
671 671
 		try {
672 672
 			// Temporarily change format for stream
673
-			$this->image->setImageFormat( strtoupper( $extension ) );
673
+			$this->image->setImageFormat(strtoupper($extension));
674 674
 
675 675
 			// Output stream of image content
676
-			header( "Content-Type: $mime_type" );
676
+			header("Content-Type: $mime_type");
677 677
 			print $this->image->getImageBlob();
678 678
 
679 679
 			// Reset Image to original Format
680
-			$this->image->setImageFormat( $this->get_extension( $this->mime_type ) );
680
+			$this->image->setImageFormat($this->get_extension($this->mime_type));
681 681
 		}
682
-		catch ( Exception $e ) {
683
-			return new WP_Error( 'image_stream_error', $e->getMessage() );
682
+		catch (Exception $e) {
683
+			return new WP_Error('image_stream_error', $e->getMessage());
684 684
 		}
685 685
 
686 686
 		return true;
@@ -696,14 +696,14 @@  discard block
 block discarded – undo
696 696
 	 */
697 697
 	protected function strip_meta() {
698 698
 
699
-		if ( ! is_callable( array( $this->image, 'getImageProfiles' ) ) ) {
699
+		if ( ! is_callable(array($this->image, 'getImageProfiles'))) {
700 700
 			/* translators: %s: ImageMagick method name */
701
-			return new WP_Error( 'image_strip_meta_error', sprintf( __( '%s is required to strip image meta.' ), '<code>Imagick::getImageProfiles()</code>' ) );
701
+			return new WP_Error('image_strip_meta_error', sprintf(__('%s is required to strip image meta.'), '<code>Imagick::getImageProfiles()</code>'));
702 702
 		}
703 703
 
704
-		if ( ! is_callable( array( $this->image, 'removeImageProfile' ) ) ) {
704
+		if ( ! is_callable(array($this->image, 'removeImageProfile'))) {
705 705
 			/* translators: %s: ImageMagick method name */
706
-			return new WP_Error( 'image_strip_meta_error', sprintf( __( '%s is required to strip image meta.' ), '<code>Imagick::removeImageProfile()</code>' ) );
706
+			return new WP_Error('image_strip_meta_error', sprintf(__('%s is required to strip image meta.'), '<code>Imagick::removeImageProfile()</code>'));
707 707
 		}
708 708
 
709 709
 		/*
@@ -725,14 +725,14 @@  discard block
 block discarded – undo
725 725
 
726 726
 		try {
727 727
 			// Strip profiles.
728
-			foreach ( $this->image->getImageProfiles( '*', true ) as $key => $value ) {
729
-				if ( ! in_array( $key, $protected_profiles ) ) {
730
-					$this->image->removeImageProfile( $key );
728
+			foreach ($this->image->getImageProfiles('*', true) as $key => $value) {
729
+				if ( ! in_array($key, $protected_profiles)) {
730
+					$this->image->removeImageProfile($key);
731 731
 				}
732 732
 			}
733 733
 
734
-		} catch ( Exception $e ) {
735
-			return new WP_Error( 'image_strip_meta_error', $e->getMessage() );
734
+		} catch (Exception $e) {
735
+			return new WP_Error('image_strip_meta_error', $e->getMessage());
736 736
 		}
737 737
 
738 738
 		return true;
@@ -751,13 +751,13 @@  discard block
 block discarded – undo
751 751
 		try {
752 752
 			// By default, PDFs are rendered in a very low resolution.
753 753
 			// We want the thumbnail to be readable, so increase the rendering DPI.
754
-			$this->image->setResolution( 128, 128 );
754
+			$this->image->setResolution(128, 128);
755 755
 
756 756
 			// Only load the first page.
757
-			return $this->file . '[0]';
757
+			return $this->file.'[0]';
758 758
 		}
759
-		catch ( Exception $e ) {
760
-			return new WP_Error( 'pdf_setup_failed', $e->getMessage(), $this->file );
759
+		catch (Exception $e) {
760
+			return new WP_Error('pdf_setup_failed', $e->getMessage(), $this->file);
761 761
 		}
762 762
 	}
763 763
 
Please login to merge, or discard this patch.
Braces   +73 added lines, -66 removed lines patch added patch discarded remove patch
@@ -48,11 +48,13 @@  discard block
 block discarded – undo
48 48
 	public static function test( $args = array() ) {
49 49
 
50 50
 		// First, test Imagick's extension and classes.
51
-		if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) )
52
-			return false;
51
+		if ( ! extension_loaded( 'imagick' ) || ! class_exists( 'Imagick', false ) || ! class_exists( 'ImagickPixel', false ) ) {
52
+					return false;
53
+		}
53 54
 
54
-		if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) )
55
-			return false;
55
+		if ( version_compare( phpversion( 'imagick' ), '2.2.0', '<' ) ) {
56
+					return false;
57
+		}
56 58
 
57 59
 		$required_methods = array(
58 60
 			'clear',
@@ -77,8 +79,9 @@  discard block
 block discarded – undo
77 79
 		);
78 80
 
79 81
 		// Now, test for deep requirements within Imagick.
80
-		if ( ! defined( 'imagick::COMPRESSION_JPEG' ) )
81
-			return false;
82
+		if ( ! defined( 'imagick::COMPRESSION_JPEG' ) ) {
83
+					return false;
84
+		}
82 85
 
83 86
 		$class_methods = array_map( 'strtolower', get_class_methods( 'Imagick' ) );
84 87
 		if ( array_diff( $required_methods, $class_methods ) ) {
@@ -107,18 +110,19 @@  discard block
 block discarded – undo
107 110
 	public static function supports_mime_type( $mime_type ) {
108 111
 		$imagick_extension = strtoupper( self::get_extension( $mime_type ) );
109 112
 
110
-		if ( ! $imagick_extension )
111
-			return false;
113
+		if ( ! $imagick_extension ) {
114
+					return false;
115
+		}
112 116
 
113 117
 		// setIteratorIndex is optional unless mime is an animated format.
114 118
 		// Here, we just say no if you are missing it and aren't loading a jpeg.
115
-		if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && $mime_type != 'image/jpeg' )
116
-				return false;
119
+		if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && $mime_type != 'image/jpeg' ) {
120
+						return false;
121
+		}
117 122
 
118 123
 		try {
119 124
 			return ( (bool) @Imagick::queryFormats( $imagick_extension ) );
120
-		}
121
-		catch ( Exception $e ) {
125
+		} catch ( Exception $e ) {
122 126
 			return false;
123 127
 		}
124 128
 	}
@@ -132,11 +136,13 @@  discard block
 block discarded – undo
132 136
 	 * @return true|WP_Error True if loaded; WP_Error on failure.
133 137
 	 */
134 138
 	public function load() {
135
-		if ( $this->image instanceof Imagick )
136
-			return true;
139
+		if ( $this->image instanceof Imagick ) {
140
+					return true;
141
+		}
137 142
 
138
-		if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) )
139
-			return new WP_Error( 'error_loading_image', __('File doesn&#8217;t exist?'), $this->file );
143
+		if ( ! is_file( $this->file ) && ! preg_match( '|^https?://|', $this->file ) ) {
144
+					return new WP_Error( 'error_loading_image', __('File doesn&#8217;t exist?'), $this->file );
145
+		}
140 146
 
141 147
 		/*
142 148
 		 * Even though Imagick uses less PHP memory than GD, set higher limit
@@ -157,16 +163,17 @@  discard block
 block discarded – undo
157 163
 			// only applies correctly before the image is read.
158 164
 			$this->image->readImage( $filename );
159 165
 
160
-			if ( ! $this->image->valid() )
161
-				return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
166
+			if ( ! $this->image->valid() ) {
167
+							return new WP_Error( 'invalid_image', __('File is not an image.'), $this->file);
168
+			}
162 169
 
163 170
 			// Select the first frame to handle animated images properly
164
-			if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) )
165
-				$this->image->setIteratorIndex(0);
171
+			if ( is_callable( array( $this->image, 'setIteratorIndex' ) ) ) {
172
+							$this->image->setIteratorIndex(0);
173
+			}
166 174
 
167 175
 			$this->mime_type = $this->get_mime_type( $this->image->getImageFormat() );
168
-		}
169
-		catch ( Exception $e ) {
176
+		} catch ( Exception $e ) {
170 177
 			return new WP_Error( 'invalid_image', $e->getMessage(), $this->file );
171 178
 		}
172 179
 
@@ -199,12 +206,10 @@  discard block
 block discarded – undo
199 206
 			if ( 'image/jpeg' == $this->mime_type ) {
200 207
 				$this->image->setImageCompressionQuality( $quality );
201 208
 				$this->image->setImageCompression( imagick::COMPRESSION_JPEG );
202
-			}
203
-			else {
209
+			} else {
204 210
 				$this->image->setImageCompressionQuality( $quality );
205 211
 			}
206
-		}
207
-		catch ( Exception $e ) {
212
+		} catch ( Exception $e ) {
208 213
 			return new WP_Error( 'image_quality_error', $e->getMessage() );
209 214
 		}
210 215
 
@@ -227,17 +232,18 @@  discard block
 block discarded – undo
227 232
 		if ( !$width || !$height ) {
228 233
 			try {
229 234
 				$size = $this->image->getImageGeometry();
230
-			}
231
-			catch ( Exception $e ) {
235
+			} catch ( Exception $e ) {
232 236
 				return new WP_Error( 'invalid_image', __( 'Could not read image size.' ), $this->file );
233 237
 			}
234 238
 		}
235 239
 
236
-		if ( ! $width )
237
-			$width = $size['width'];
240
+		if ( ! $width ) {
241
+					$width = $size['width'];
242
+		}
238 243
 
239
-		if ( ! $height )
240
-			$height = $size['height'];
244
+		if ( ! $height ) {
245
+					$height = $size['height'];
246
+		}
241 247
 
242 248
 		return parent::update_size( $width, $height );
243 249
 	}
@@ -258,12 +264,14 @@  discard block
 block discarded – undo
258 264
 	 * @return bool|WP_Error
259 265
 	 */
260 266
 	public function resize( $max_w, $max_h, $crop = false ) {
261
-		if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) )
262
-			return true;
267
+		if ( ( $this->size['width'] == $max_w ) && ( $this->size['height'] == $max_h ) ) {
268
+					return true;
269
+		}
263 270
 
264 271
 		$dims = image_resize_dimensions( $this->size['width'], $this->size['height'], $max_w, $max_h, $crop );
265
-		if ( ! $dims )
266
-			return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
272
+		if ( ! $dims ) {
273
+					return new WP_Error( 'error_getting_dimensions', __('Could not calculate resized image dimensions') );
274
+		}
267 275
 		list( $dst_x, $dst_y, $src_x, $src_y, $dst_w, $dst_h, $src_w, $src_h ) = $dims;
268 276
 
269 277
 		if ( $crop ) {
@@ -408,8 +416,7 @@  discard block
 block discarded – undo
408 416
 				$this->image->setInterlaceScheme( Imagick::INTERLACE_NO );
409 417
 			}
410 418
 
411
-		}
412
-		catch ( Exception $e ) {
419
+		} catch ( Exception $e ) {
413 420
 			return new WP_Error( 'image_resize_error', $e->getMessage() );
414 421
 		}
415 422
 	}
@@ -443,8 +450,9 @@  discard block
 block discarded – undo
443 450
 		$orig_image = $this->image->getImage();
444 451
 
445 452
 		foreach ( $sizes as $size => $size_data ) {
446
-			if ( ! $this->image )
447
-				$this->image = $orig_image->getImage();
453
+			if ( ! $this->image ) {
454
+							$this->image = $orig_image->getImage();
455
+			}
448 456
 
449 457
 			if ( ! isset( $size_data['width'] ) && ! isset( $size_data['height'] ) ) {
450 458
 				continue;
@@ -513,10 +521,12 @@  discard block
 block discarded – undo
513 521
 			if ( $dst_w || $dst_h ) {
514 522
 				// If destination width/height isn't specified, use same as
515 523
 				// width/height from source.
516
-				if ( ! $dst_w )
517
-					$dst_w = $src_w;
518
-				if ( ! $dst_h )
519
-					$dst_h = $src_h;
524
+				if ( ! $dst_w ) {
525
+									$dst_w = $src_w;
526
+				}
527
+				if ( ! $dst_h ) {
528
+									$dst_h = $src_h;
529
+				}
520 530
 
521 531
 				$thumb_result = $this->thumbnail_image( $dst_w, $dst_h );
522 532
 				if ( is_wp_error( $thumb_result ) ) {
@@ -525,8 +535,7 @@  discard block
 block discarded – undo
525 535
 
526 536
 				return $this->update_size();
527 537
 			}
528
-		}
529
-		catch ( Exception $e ) {
538
+		} catch ( Exception $e ) {
530 539
 			return new WP_Error( 'image_crop_error', $e->getMessage() );
531 540
 		}
532 541
 		return $this->update_size();
@@ -551,12 +560,12 @@  discard block
 block discarded – undo
551 560
 
552 561
 			// Since this changes the dimensions of the image, update the size.
553 562
 			$result = $this->update_size();
554
-			if ( is_wp_error( $result ) )
555
-				return $result;
563
+			if ( is_wp_error( $result ) ) {
564
+							return $result;
565
+			}
556 566
 
557 567
 			$this->image->setImagePage( $this->size['width'], $this->size['height'], 0, 0 );
558
-		}
559
-		catch ( Exception $e ) {
568
+		} catch ( Exception $e ) {
560 569
 			return new WP_Error( 'image_rotate_error', $e->getMessage() );
561 570
 		}
562 571
 		return true;
@@ -574,13 +583,14 @@  discard block
 block discarded – undo
574 583
 	 */
575 584
 	public function flip( $horz, $vert ) {
576 585
 		try {
577
-			if ( $horz )
578
-				$this->image->flipImage();
586
+			if ( $horz ) {
587
+							$this->image->flipImage();
588
+			}
579 589
 
580
-			if ( $vert )
581
-				$this->image->flopImage();
582
-		}
583
-		catch ( Exception $e ) {
590
+			if ( $vert ) {
591
+							$this->image->flopImage();
592
+			}
593
+		} catch ( Exception $e ) {
584 594
 			return new WP_Error( 'image_flip_error', $e->getMessage() );
585 595
 		}
586 596
 		return true;
@@ -605,8 +615,7 @@  discard block
 block discarded – undo
605 615
 
606 616
 			try {
607 617
 				$this->image->setImageFormat( strtoupper( $this->get_extension( $this->mime_type ) ) );
608
-			}
609
-			catch ( Exception $e ) {
618
+			} catch ( Exception $e ) {
610 619
 				return new WP_Error( 'image_save_error', $e->getMessage(), $this->file );
611 620
 			}
612 621
 		}
@@ -624,8 +633,9 @@  discard block
 block discarded – undo
624 633
 	protected function _save( $image, $filename = null, $mime_type = null ) {
625 634
 		list( $filename, $extension, $mime_type ) = $this->get_output_format( $filename, $mime_type );
626 635
 
627
-		if ( ! $filename )
628
-			$filename = $this->generate_filename( null, null, $extension );
636
+		if ( ! $filename ) {
637
+					$filename = $this->generate_filename( null, null, $extension );
638
+		}
629 639
 
630 640
 		try {
631 641
 			// Store initial Format
@@ -636,8 +646,7 @@  discard block
 block discarded – undo
636 646
 
637 647
 			// Reset original Format
638 648
 			$this->image->setImageFormat( $orig_format );
639
-		}
640
-		catch ( Exception $e ) {
649
+		} catch ( Exception $e ) {
641 650
 			return new WP_Error( 'image_save_error', $e->getMessage(), $filename );
642 651
 		}
643 652
 
@@ -678,8 +687,7 @@  discard block
 block discarded – undo
678 687
 
679 688
 			// Reset Image to original Format
680 689
 			$this->image->setImageFormat( $this->get_extension( $this->mime_type ) );
681
-		}
682
-		catch ( Exception $e ) {
690
+		} catch ( Exception $e ) {
683 691
 			return new WP_Error( 'image_stream_error', $e->getMessage() );
684 692
 		}
685 693
 
@@ -755,8 +763,7 @@  discard block
 block discarded – undo
755 763
 
756 764
 			// Only load the first page.
757 765
 			return $this->file . '[0]';
758
-		}
759
-		catch ( Exception $e ) {
766
+		} catch ( Exception $e ) {
760 767
 			return new WP_Error( 'pdf_setup_failed', $e->getMessage(), $this->file );
761 768
 		}
762 769
 	}
Please login to merge, or discard this patch.
src/wp-includes/class-wp-query.php 4 patches
Doc Comments   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1374,7 +1374,7 @@  discard block
 block discarded – undo
1374 1374
 	 *
1375 1375
 	 * @since 3.7.0
1376 1376
 	 *
1377
-	 * @param array $terms Terms to check.
1377
+	 * @param string[] $terms Terms to check.
1378 1378
 	 * @return array Terms that are not stopwords.
1379 1379
 	 */
1380 1380
 	protected function parse_search_terms( $terms ) {
@@ -3372,7 +3372,7 @@  discard block
 block discarded – undo
3372 3372
 	 * @access public
3373 3373
 	 *
3374 3374
 	 * @param string $name Property to check if set.
3375
-	 * @return bool Whether the property is set.
3375
+	 * @return boolean|null Whether the property is set.
3376 3376
 	 */
3377 3377
 	public function __isset( $name ) {
3378 3378
 		if ( in_array( $name, $this->compat_fields ) ) {
@@ -3971,8 +3971,8 @@  discard block
 block discarded – undo
3971 3971
 	 * @global int             $more
3972 3972
 	 * @global int             $numpages
3973 3973
 	 *
3974
-	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
3975
-	 * @return true True when finished.
3974
+	 * @param WP_Post $post WP_Post instance or Post ID/object.
3975
+	 * @return null|boolean True when finished.
3976 3976
 	 */
3977 3977
 	public function setup_postdata( $post ) {
3978 3978
 		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -4210,14 +4210,14 @@
 block discarded – undo
4210 4210
 	}
4211 4211
 
4212 4212
 	/**
4213
- 	 * Is the query for an existing archive page?
4214
- 	 *
4215
- 	 * Month, Year, Category, Author, Post Type archive...
4216
-	 *
4217
- 	 * @since 3.1.0
4218
- 	 *
4219
- 	 * @return bool
4220
- 	 */
4213
+	 * Is the query for an existing archive page?
4214
+	 *
4215
+	 * Month, Year, Category, Author, Post Type archive...
4216
+	 *
4217
+	 * @since 3.1.0
4218
+	 *
4219
+	 * @return bool
4220
+	 */
4221 4221
 	public function is_archive() {
4222 4222
 		return (bool) $this->is_archive;
4223 4223
 	}
Please login to merge, or discard this patch.
Spacing   +814 added lines, -814 removed lines patch added patch discarded remove patch
@@ -482,9 +482,9 @@  discard block
 block discarded – undo
482 482
 	 */
483 483
 	private $stopwords;
484 484
 
485
-	private $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );
485
+	private $compat_fields = array('query_vars_hash', 'query_vars_changed');
486 486
 
487
-	private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
487
+	private $compat_methods = array('init_query_flags', 'parse_tax_query');
488 488
 
489 489
 	/**
490 490
 	 * Resets query flags to false.
@@ -538,10 +538,10 @@  discard block
 block discarded – undo
538 538
 		$this->post_count = 0;
539 539
 		$this->current_post = -1;
540 540
 		$this->in_the_loop = false;
541
-		unset( $this->request );
542
-		unset( $this->post );
543
-		unset( $this->comments );
544
-		unset( $this->comment );
541
+		unset($this->request);
542
+		unset($this->post);
543
+		unset($this->comments);
544
+		unset($this->comment);
545 545
 		$this->comment_count = 0;
546 546
 		$this->current_comment = -1;
547 547
 		$this->found_posts = 0;
@@ -612,17 +612,17 @@  discard block
 block discarded – undo
612 612
 			, 'embed'
613 613
 		);
614 614
 
615
-		foreach ( $keys as $key ) {
616
-			if ( !isset($array[$key]) )
615
+		foreach ($keys as $key) {
616
+			if ( ! isset($array[$key]))
617 617
 				$array[$key] = '';
618 618
 		}
619 619
 
620
-		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
620
+		$array_keys = array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
621 621
 			'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in',
622
-			'author__in', 'author__not_in' );
622
+			'author__in', 'author__not_in');
623 623
 
624
-		foreach ( $array_keys as $key ) {
625
-			if ( !isset($array[$key]) )
624
+		foreach ($array_keys as $key) {
625
+			if ( ! isset($array[$key]))
626 626
 				$array[$key] = array();
627 627
 		}
628 628
 		return $array;
@@ -750,11 +750,11 @@  discard block
 block discarded – undo
750 750
 	 *     @type int          $year                    The four-digit year. Default empty. Accepts any four-digit year.
751 751
 	 * }
752 752
 	 */
753
-	public function parse_query( $query =  '' ) {
754
-		if ( ! empty( $query ) ) {
753
+	public function parse_query($query = '') {
754
+		if ( ! empty($query)) {
755 755
 			$this->init();
756
-			$this->query = $this->query_vars = wp_parse_args( $query );
757
-		} elseif ( ! isset( $this->query ) ) {
756
+			$this->query = $this->query_vars = wp_parse_args($query);
757
+		} elseif ( ! isset($this->query)) {
758 758
 			$this->query = $this->query_vars;
759 759
 		}
760 760
 
@@ -762,86 +762,86 @@  discard block
 block discarded – undo
762 762
 		$qv = &$this->query_vars;
763 763
 		$this->query_vars_changed = true;
764 764
 
765
-		if ( ! empty($qv['robots']) )
765
+		if ( ! empty($qv['robots']))
766 766
 			$this->is_robots = true;
767 767
 
768
-		if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) {
768
+		if ( ! is_scalar($qv['p']) || $qv['p'] < 0) {
769 769
 			$qv['p'] = 0;
770 770
 			$qv['error'] = '404';
771 771
 		} else {
772
-			$qv['p'] = intval( $qv['p'] );
772
+			$qv['p'] = intval($qv['p']);
773 773
 		}
774 774
 
775
-		$qv['page_id'] =  absint($qv['page_id']);
775
+		$qv['page_id'] = absint($qv['page_id']);
776 776
 		$qv['year'] = absint($qv['year']);
777 777
 		$qv['monthnum'] = absint($qv['monthnum']);
778 778
 		$qv['day'] = absint($qv['day']);
779 779
 		$qv['w'] = absint($qv['w']);
780
-		$qv['m'] = is_scalar( $qv['m'] ) ? preg_replace( '|[^0-9]|', '', $qv['m'] ) : '';
780
+		$qv['m'] = is_scalar($qv['m']) ? preg_replace('|[^0-9]|', '', $qv['m']) : '';
781 781
 		$qv['paged'] = absint($qv['paged']);
782
-		$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
783
-		$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers
784
-		$qv['pagename'] = trim( $qv['pagename'] );
785
-		$qv['name'] = trim( $qv['name'] );
786
-		$qv['title'] = trim( $qv['title'] );
787
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
788
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
789
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
790
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
782
+		$qv['cat'] = preg_replace('|[^0-9,-]|', '', $qv['cat']); // comma separated list of positive or negative integers
783
+		$qv['author'] = preg_replace('|[^0-9,-]|', '', $qv['author']); // comma separated list of positive or negative integers
784
+		$qv['pagename'] = trim($qv['pagename']);
785
+		$qv['name'] = trim($qv['name']);
786
+		$qv['title'] = trim($qv['title']);
787
+		if ('' !== $qv['hour']) $qv['hour'] = absint($qv['hour']);
788
+		if ('' !== $qv['minute']) $qv['minute'] = absint($qv['minute']);
789
+		if ('' !== $qv['second']) $qv['second'] = absint($qv['second']);
790
+		if ('' !== $qv['menu_order']) $qv['menu_order'] = absint($qv['menu_order']);
791 791
 
792 792
 		// Fairly insane upper bound for search string lengths.
793
-		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
793
+		if ( ! is_scalar($qv['s']) || ( ! empty($qv['s']) && strlen($qv['s']) > 1600)) {
794 794
 			$qv['s'] = '';
795 795
 		}
796 796
 
797 797
 		// Compat. Map subpost to attachment.
798
-		if ( '' != $qv['subpost'] )
798
+		if ('' != $qv['subpost'])
799 799
 			$qv['attachment'] = $qv['subpost'];
800
-		if ( '' != $qv['subpost_id'] )
800
+		if ('' != $qv['subpost_id'])
801 801
 			$qv['attachment_id'] = $qv['subpost_id'];
802 802
 
803 803
 		$qv['attachment_id'] = absint($qv['attachment_id']);
804 804
 
805
-		if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
805
+		if (('' != $qv['attachment']) || ! empty($qv['attachment_id'])) {
806 806
 			$this->is_single = true;
807 807
 			$this->is_attachment = true;
808
-		} elseif ( '' != $qv['name'] ) {
808
+		} elseif ('' != $qv['name']) {
809 809
 			$this->is_single = true;
810
-		} elseif ( $qv['p'] ) {
810
+		} elseif ($qv['p']) {
811 811
 			$this->is_single = true;
812
-		} elseif ( ('' !== $qv['hour']) && ('' !== $qv['minute']) &&('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) {
812
+		} elseif (('' !== $qv['hour']) && ('' !== $qv['minute']) && ('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
813 813
 			// If year, month, day, hour, minute, and second are set, a single
814 814
 			// post is being queried.
815 815
 			$this->is_single = true;
816
-		} elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) {
816
+		} elseif ('' != $qv['static'] || '' != $qv['pagename'] || ! empty($qv['page_id'])) {
817 817
 			$this->is_page = true;
818 818
 			$this->is_single = false;
819 819
 		} else {
820 820
 			// Look for archive queries. Dates, categories, authors, search, post type archives.
821 821
 
822
-			if ( isset( $this->query['s'] ) ) {
822
+			if (isset($this->query['s'])) {
823 823
 				$this->is_search = true;
824 824
 			}
825 825
 
826
-			if ( '' !== $qv['second'] ) {
826
+			if ('' !== $qv['second']) {
827 827
 				$this->is_time = true;
828 828
 				$this->is_date = true;
829 829
 			}
830 830
 
831
-			if ( '' !== $qv['minute'] ) {
831
+			if ('' !== $qv['minute']) {
832 832
 				$this->is_time = true;
833 833
 				$this->is_date = true;
834 834
 			}
835 835
 
836
-			if ( '' !== $qv['hour'] ) {
836
+			if ('' !== $qv['hour']) {
837 837
 				$this->is_time = true;
838 838
 				$this->is_date = true;
839 839
 			}
840 840
 
841
-			if ( $qv['day'] ) {
842
-				if ( ! $this->is_date ) {
843
-					$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );
844
-					if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {
841
+			if ($qv['day']) {
842
+				if ( ! $this->is_date) {
843
+					$date = sprintf('%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day']);
844
+					if ($qv['monthnum'] && $qv['year'] && ! wp_checkdate($qv['monthnum'], $qv['day'], $qv['year'], $date)) {
845 845
 						$qv['error'] = '404';
846 846
 					} else {
847 847
 						$this->is_day = true;
@@ -850,9 +850,9 @@  discard block
 block discarded – undo
850 850
 				}
851 851
 			}
852 852
 
853
-			if ( $qv['monthnum'] ) {
854
-				if ( ! $this->is_date ) {
855
-					if ( 12 < $qv['monthnum'] ) {
853
+			if ($qv['monthnum']) {
854
+				if ( ! $this->is_date) {
855
+					if (12 < $qv['monthnum']) {
856 856
 						$qv['error'] = '404';
857 857
 					} else {
858 858
 						$this->is_month = true;
@@ -861,40 +861,40 @@  discard block
 block discarded – undo
861 861
 				}
862 862
 			}
863 863
 
864
-			if ( $qv['year'] ) {
865
-				if ( ! $this->is_date ) {
864
+			if ($qv['year']) {
865
+				if ( ! $this->is_date) {
866 866
 					$this->is_year = true;
867 867
 					$this->is_date = true;
868 868
 				}
869 869
 			}
870 870
 
871
-			if ( $qv['m'] ) {
871
+			if ($qv['m']) {
872 872
 				$this->is_date = true;
873
-				if ( strlen($qv['m']) > 9 ) {
873
+				if (strlen($qv['m']) > 9) {
874 874
 					$this->is_time = true;
875
-				} elseif ( strlen( $qv['m'] ) > 7 ) {
875
+				} elseif (strlen($qv['m']) > 7) {
876 876
 					$this->is_day = true;
877
-				} elseif ( strlen( $qv['m'] ) > 5 ) {
877
+				} elseif (strlen($qv['m']) > 5) {
878 878
 					$this->is_month = true;
879 879
 				} else {
880 880
 					$this->is_year = true;
881 881
 				}
882 882
 			}
883 883
 
884
-			if ( '' != $qv['w'] ) {
884
+			if ('' != $qv['w']) {
885 885
 				$this->is_date = true;
886 886
 			}
887 887
 
888 888
 			$this->query_vars_hash = false;
889
-			$this->parse_tax_query( $qv );
889
+			$this->parse_tax_query($qv);
890 890
 
891
-			foreach ( $this->tax_query->queries as $tax_query ) {
892
-				if ( ! is_array( $tax_query ) ) {
891
+			foreach ($this->tax_query->queries as $tax_query) {
892
+				if ( ! is_array($tax_query)) {
893 893
 					continue;
894 894
 				}
895 895
 
896
-				if ( isset( $tax_query['operator'] ) && 'NOT IN' != $tax_query['operator'] ) {
897
-					switch ( $tax_query['taxonomy'] ) {
896
+				if (isset($tax_query['operator']) && 'NOT IN' != $tax_query['operator']) {
897
+					switch ($tax_query['taxonomy']) {
898 898
 						case 'category':
899 899
 							$this->is_category = true;
900 900
 							break;
@@ -906,89 +906,89 @@  discard block
 block discarded – undo
906 906
 					}
907 907
 				}
908 908
 			}
909
-			unset( $tax_query );
909
+			unset($tax_query);
910 910
 
911
-			if ( empty($qv['author']) || ($qv['author'] == '0') ) {
911
+			if (empty($qv['author']) || ($qv['author'] == '0')) {
912 912
 				$this->is_author = false;
913 913
 			} else {
914 914
 				$this->is_author = true;
915 915
 			}
916 916
 
917
-			if ( '' != $qv['author_name'] )
917
+			if ('' != $qv['author_name'])
918 918
 				$this->is_author = true;
919 919
 
920
-			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
921
-				$post_type_obj = get_post_type_object( $qv['post_type'] );
922
-				if ( ! empty( $post_type_obj->has_archive ) )
920
+			if ( ! empty($qv['post_type']) && ! is_array($qv['post_type'])) {
921
+				$post_type_obj = get_post_type_object($qv['post_type']);
922
+				if ( ! empty($post_type_obj->has_archive))
923 923
 					$this->is_post_type_archive = true;
924 924
 			}
925 925
 
926
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
926
+			if ($this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax)
927 927
 				$this->is_archive = true;
928 928
 		}
929 929
 
930
-		if ( '' != $qv['feed'] )
930
+		if ('' != $qv['feed'])
931 931
 			$this->is_feed = true;
932 932
 
933
-		if ( '' != $qv['embed'] ) {
933
+		if ('' != $qv['embed']) {
934 934
 			$this->is_embed = true;
935 935
 		}
936 936
 
937
-		if ( '' != $qv['tb'] )
937
+		if ('' != $qv['tb'])
938 938
 			$this->is_trackback = true;
939 939
 
940
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
940
+		if ('' != $qv['paged'] && (intval($qv['paged']) > 1))
941 941
 			$this->is_paged = true;
942 942
 
943 943
 		// if we're previewing inside the write screen
944
-		if ( '' != $qv['preview'] )
944
+		if ('' != $qv['preview'])
945 945
 			$this->is_preview = true;
946 946
 
947
-		if ( is_admin() )
947
+		if (is_admin())
948 948
 			$this->is_admin = true;
949 949
 
950
-		if ( false !== strpos($qv['feed'], 'comments-') ) {
950
+		if (false !== strpos($qv['feed'], 'comments-')) {
951 951
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
952 952
 			$qv['withcomments'] = 1;
953 953
 		}
954 954
 
955 955
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
956 956
 
957
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
957
+		if ($this->is_feed && ( ! empty($qv['withcomments']) || (empty($qv['withoutcomments']) && $this->is_singular)))
958 958
 			$this->is_comment_feed = true;
959 959
 
960
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
960
+		if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || (defined('REST_REQUEST') && REST_REQUEST) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots))
961 961
 			$this->is_home = true;
962 962
 
963 963
 		// Correct is_* for page_on_front and page_for_posts
964
-		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
964
+		if ($this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front')) {
965 965
 			$_query = wp_parse_args($this->query);
966 966
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
967
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
967
+			if (isset($_query['pagename']) && '' == $_query['pagename'])
968 968
 				unset($_query['pagename']);
969 969
 
970
-			unset( $_query['embed'] );
970
+			unset($_query['embed']);
971 971
 
972
-			if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
972
+			if (empty($_query) || ! array_diff(array_keys($_query), array('preview', 'page', 'paged', 'cpage'))) {
973 973
 				$this->is_page = true;
974 974
 				$this->is_home = false;
975 975
 				$qv['page_id'] = get_option('page_on_front');
976 976
 				// Correct <!--nextpage--> for page_on_front
977
-				if ( !empty($qv['paged']) ) {
977
+				if ( ! empty($qv['paged'])) {
978 978
 					$qv['page'] = $qv['paged'];
979 979
 					unset($qv['paged']);
980 980
 				}
981 981
 			}
982 982
 		}
983 983
 
984
-		if ( '' != $qv['pagename'] ) {
985
-			$this->queried_object = get_page_by_path( $qv['pagename'] );
984
+		if ('' != $qv['pagename']) {
985
+			$this->queried_object = get_page_by_path($qv['pagename']);
986 986
 
987
-			if ( $this->queried_object && 'attachment' == $this->queried_object->post_type ) {
988
-				if ( preg_match( "/^[^%]*%(?:postname)%/", get_option( 'permalink_structure' ) ) ) {
987
+			if ($this->queried_object && 'attachment' == $this->queried_object->post_type) {
988
+				if (preg_match("/^[^%]*%(?:postname)%/", get_option('permalink_structure'))) {
989 989
 					// See if we also have a post with the same slug
990
-					$post = get_page_by_path( $qv['pagename'], OBJECT, 'post' );
991
-					if ( $post ) {
990
+					$post = get_page_by_path($qv['pagename'], OBJECT, 'post');
991
+					if ($post) {
992 992
 						$this->queried_object = $post;
993 993
 						$this->is_page = false;
994 994
 						$this->is_single = true;
@@ -996,53 +996,53 @@  discard block
 block discarded – undo
996 996
 				}
997 997
 			}
998 998
 
999
-			if ( ! empty( $this->queried_object ) ) {
999
+			if ( ! empty($this->queried_object)) {
1000 1000
 				$this->queried_object_id = (int) $this->queried_object->ID;
1001 1001
 			} else {
1002
-				unset( $this->queried_object );
1002
+				unset($this->queried_object);
1003 1003
 			}
1004 1004
 
1005
-			if  ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) {
1005
+			if ('page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts')) {
1006 1006
 				$this->is_page = false;
1007 1007
 				$this->is_home = true;
1008 1008
 				$this->is_posts_page = true;
1009 1009
 			}
1010 1010
 		}
1011 1011
 
1012
-		if ( $qv['page_id'] ) {
1013
-			if  ( 'page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts') ) {
1012
+		if ($qv['page_id']) {
1013
+			if ('page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts')) {
1014 1014
 				$this->is_page = false;
1015 1015
 				$this->is_home = true;
1016 1016
 				$this->is_posts_page = true;
1017 1017
 			}
1018 1018
 		}
1019 1019
 
1020
-		if ( !empty($qv['post_type']) ) {
1021
-			if ( is_array($qv['post_type']) )
1020
+		if ( ! empty($qv['post_type'])) {
1021
+			if (is_array($qv['post_type']))
1022 1022
 				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1023 1023
 			else
1024 1024
 				$qv['post_type'] = sanitize_key($qv['post_type']);
1025 1025
 		}
1026 1026
 
1027
-		if ( ! empty( $qv['post_status'] ) ) {
1028
-			if ( is_array( $qv['post_status'] ) )
1027
+		if ( ! empty($qv['post_status'])) {
1028
+			if (is_array($qv['post_status']))
1029 1029
 				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1030 1030
 			else
1031 1031
 				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1032 1032
 		}
1033 1033
 
1034
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1034
+		if ($this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments']))
1035 1035
 			$this->is_comment_feed = false;
1036 1036
 
1037 1037
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1038 1038
 		// Done correcting is_* for page_on_front and page_for_posts
1039 1039
 
1040
-		if ( '404' == $qv['error'] )
1040
+		if ('404' == $qv['error'])
1041 1041
 			$this->set_404();
1042 1042
 
1043
-		$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
1043
+		$this->is_embed = $this->is_embed && ($this->is_singular || $this->is_404);
1044 1044
 
1045
-		$this->query_vars_hash = md5( serialize( $this->query_vars ) );
1045
+		$this->query_vars_hash = md5(serialize($this->query_vars));
1046 1046
 		$this->query_vars_changed = false;
1047 1047
 
1048 1048
 		/**
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 		 *
1053 1053
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
1054 1054
 		 */
1055
-		do_action_ref_array( 'parse_query', array( &$this ) );
1055
+		do_action_ref_array('parse_query', array(&$this));
1056 1056
 	}
1057 1057
 
1058 1058
 	/**
@@ -1065,77 +1065,77 @@  discard block
 block discarded – undo
1065 1065
 	 *
1066 1066
 	 * @param array $q The query variables. Passed by reference.
1067 1067
 	 */
1068
-	public function parse_tax_query( &$q ) {
1069
-		if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {
1068
+	public function parse_tax_query(&$q) {
1069
+		if ( ! empty($q['tax_query']) && is_array($q['tax_query'])) {
1070 1070
 			$tax_query = $q['tax_query'];
1071 1071
 		} else {
1072 1072
 			$tax_query = array();
1073 1073
 		}
1074 1074
 
1075
-		if ( !empty($q['taxonomy']) && !empty($q['term']) ) {
1075
+		if ( ! empty($q['taxonomy']) && ! empty($q['term'])) {
1076 1076
 			$tax_query[] = array(
1077 1077
 				'taxonomy' => $q['taxonomy'],
1078
-				'terms' => array( $q['term'] ),
1078
+				'terms' => array($q['term']),
1079 1079
 				'field' => 'slug',
1080 1080
 			);
1081 1081
 		}
1082 1082
 
1083
-		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1084
-			if ( 'post_tag' == $taxonomy )
1085
-				continue;	// Handled further down in the $q['tag'] block
1083
+		foreach (get_taxonomies(array(), 'objects') as $taxonomy => $t) {
1084
+			if ('post_tag' == $taxonomy)
1085
+				continue; // Handled further down in the $q['tag'] block
1086 1086
 
1087
-			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1087
+			if ($t->query_var && ! empty($q[$t->query_var])) {
1088 1088
 				$tax_query_defaults = array(
1089 1089
 					'taxonomy' => $taxonomy,
1090 1090
 					'field' => 'slug',
1091 1091
 				);
1092 1092
 
1093
- 				if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
1094
-					$q[$t->query_var] = wp_basename( $q[$t->query_var] );
1093
+ 				if (isset($t->rewrite['hierarchical']) && $t->rewrite['hierarchical']) {
1094
+					$q[$t->query_var] = wp_basename($q[$t->query_var]);
1095 1095
 				}
1096 1096
 
1097 1097
 				$term = $q[$t->query_var];
1098 1098
 
1099
-				if ( is_array( $term ) ) {
1100
-					$term = implode( ',', $term );
1099
+				if (is_array($term)) {
1100
+					$term = implode(',', $term);
1101 1101
 				}
1102 1102
 
1103
-				if ( strpos($term, '+') !== false ) {
1104
-					$terms = preg_split( '/[+]+/', $term );
1105
-					foreach ( $terms as $term ) {
1106
-						$tax_query[] = array_merge( $tax_query_defaults, array(
1107
-							'terms' => array( $term )
1108
-						) );
1103
+				if (strpos($term, '+') !== false) {
1104
+					$terms = preg_split('/[+]+/', $term);
1105
+					foreach ($terms as $term) {
1106
+						$tax_query[] = array_merge($tax_query_defaults, array(
1107
+							'terms' => array($term)
1108
+						));
1109 1109
 					}
1110 1110
 				} else {
1111
-					$tax_query[] = array_merge( $tax_query_defaults, array(
1112
-						'terms' => preg_split( '/[,]+/', $term )
1113
-					) );
1111
+					$tax_query[] = array_merge($tax_query_defaults, array(
1112
+						'terms' => preg_split('/[,]+/', $term)
1113
+					));
1114 1114
 				}
1115 1115
 			}
1116 1116
 		}
1117 1117
 
1118 1118
 		// If querystring 'cat' is an array, implode it.
1119
-		if ( is_array( $q['cat'] ) ) {
1120
-			$q['cat'] = implode( ',', $q['cat'] );
1119
+		if (is_array($q['cat'])) {
1120
+			$q['cat'] = implode(',', $q['cat']);
1121 1121
 		}
1122 1122
 
1123 1123
 		// Category stuff
1124
-		if ( ! empty( $q['cat'] ) && ! $this->is_singular ) {
1124
+		if ( ! empty($q['cat']) && ! $this->is_singular) {
1125 1125
 			$cat_in = $cat_not_in = array();
1126 1126
 
1127
-			$cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) );
1128
-			$cat_array = array_map( 'intval', $cat_array );
1129
-			$q['cat'] = implode( ',', $cat_array );
1127
+			$cat_array = preg_split('/[,\s]+/', urldecode($q['cat']));
1128
+			$cat_array = array_map('intval', $cat_array);
1129
+			$q['cat'] = implode(',', $cat_array);
1130 1130
 
1131
-			foreach ( $cat_array as $cat ) {
1132
-				if ( $cat > 0 )
1131
+			foreach ($cat_array as $cat) {
1132
+				if ($cat > 0)
1133 1133
 					$cat_in[] = $cat;
1134
-				elseif ( $cat < 0 )
1135
-					$cat_not_in[] = abs( $cat );
1134
+				elseif ($cat < 0)
1135
+					$cat_not_in[] = abs($cat);
1136 1136
 			}
1137 1137
 
1138
-			if ( ! empty( $cat_in ) ) {
1138
+			if ( ! empty($cat_in)) {
1139 1139
 				$tax_query[] = array(
1140 1140
 					'taxonomy' => 'category',
1141 1141
 					'terms' => $cat_in,
@@ -1144,7 +1144,7 @@  discard block
 block discarded – undo
1144 1144
 				);
1145 1145
 			}
1146 1146
 
1147
-			if ( ! empty( $cat_not_in ) ) {
1147
+			if ( ! empty($cat_not_in)) {
1148 1148
 				$tax_query[] = array(
1149 1149
 					'taxonomy' => 'category',
1150 1150
 					'terms' => $cat_not_in,
@@ -1153,19 +1153,19 @@  discard block
 block discarded – undo
1153 1153
 					'include_children' => true
1154 1154
 				);
1155 1155
 			}
1156
-			unset( $cat_array, $cat_in, $cat_not_in );
1156
+			unset($cat_array, $cat_in, $cat_not_in);
1157 1157
 		}
1158 1158
 
1159
-		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1159
+		if ( ! empty($q['category__and']) && 1 === count((array) $q['category__and'])) {
1160 1160
 			$q['category__and'] = (array) $q['category__and'];
1161
-			if ( ! isset( $q['category__in'] ) )
1161
+			if ( ! isset($q['category__in']))
1162 1162
 				$q['category__in'] = array();
1163
-			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1164
-			unset( $q['category__and'] );
1163
+			$q['category__in'][] = absint(reset($q['category__and']));
1164
+			unset($q['category__and']);
1165 1165
 		}
1166 1166
 
1167
-		if ( ! empty( $q['category__in'] ) ) {
1168
-			$q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );
1167
+		if ( ! empty($q['category__in'])) {
1168
+			$q['category__in'] = array_map('absint', array_unique((array) $q['category__in']));
1169 1169
 			$tax_query[] = array(
1170 1170
 				'taxonomy' => 'category',
1171 1171
 				'terms' => $q['category__in'],
@@ -1174,8 +1174,8 @@  discard block
 block discarded – undo
1174 1174
 			);
1175 1175
 		}
1176 1176
 
1177
-		if ( ! empty($q['category__not_in']) ) {
1178
-			$q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );
1177
+		if ( ! empty($q['category__not_in'])) {
1178
+			$q['category__not_in'] = array_map('absint', array_unique((array) $q['category__not_in']));
1179 1179
 			$tax_query[] = array(
1180 1180
 				'taxonomy' => 'category',
1181 1181
 				'terms' => $q['category__not_in'],
@@ -1184,8 +1184,8 @@  discard block
 block discarded – undo
1184 1184
 			);
1185 1185
 		}
1186 1186
 
1187
-		if ( ! empty($q['category__and']) ) {
1188
-			$q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );
1187
+		if ( ! empty($q['category__and'])) {
1188
+			$q['category__and'] = array_map('absint', array_unique((array) $q['category__and']));
1189 1189
 			$tax_query[] = array(
1190 1190
 				'taxonomy' => 'category',
1191 1191
 				'terms' => $q['category__and'],
@@ -1196,21 +1196,21 @@  discard block
 block discarded – undo
1196 1196
 		}
1197 1197
 
1198 1198
 		// If querystring 'tag' is array, implode it.
1199
-		if ( is_array( $q['tag'] ) ) {
1200
-			$q['tag'] = implode( ',', $q['tag'] );
1199
+		if (is_array($q['tag'])) {
1200
+			$q['tag'] = implode(',', $q['tag']);
1201 1201
 		}
1202 1202
 
1203 1203
 		// Tag stuff
1204
-		if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
1205
-			if ( strpos($q['tag'], ',') !== false ) {
1204
+		if ('' != $q['tag'] && ! $this->is_singular && $this->query_vars_changed) {
1205
+			if (strpos($q['tag'], ',') !== false) {
1206 1206
 				$tags = preg_split('/[,\r\n\t ]+/', $q['tag']);
1207
-				foreach ( (array) $tags as $tag ) {
1207
+				foreach ((array) $tags as $tag) {
1208 1208
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
1209 1209
 					$q['tag_slug__in'][] = $tag;
1210 1210
 				}
1211
-			} elseif ( preg_match('/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {
1211
+			} elseif (preg_match('/[+\r\n\t ]+/', $q['tag']) || ! empty($q['cat'])) {
1212 1212
 				$tags = preg_split('/[+\r\n\t ]+/', $q['tag']);
1213
-				foreach ( (array) $tags as $tag ) {
1213
+				foreach ((array) $tags as $tag) {
1214 1214
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
1215 1215
 					$q['tag_slug__and'][] = $tag;
1216 1216
 				}
@@ -1220,24 +1220,24 @@  discard block
 block discarded – undo
1220 1220
 			}
1221 1221
 		}
1222 1222
 
1223
-		if ( !empty($q['tag_id']) ) {
1224
-			$q['tag_id'] = absint( $q['tag_id'] );
1223
+		if ( ! empty($q['tag_id'])) {
1224
+			$q['tag_id'] = absint($q['tag_id']);
1225 1225
 			$tax_query[] = array(
1226 1226
 				'taxonomy' => 'post_tag',
1227 1227
 				'terms' => $q['tag_id']
1228 1228
 			);
1229 1229
 		}
1230 1230
 
1231
-		if ( !empty($q['tag__in']) ) {
1232
-			$q['tag__in'] = array_map('absint', array_unique( (array) $q['tag__in'] ) );
1231
+		if ( ! empty($q['tag__in'])) {
1232
+			$q['tag__in'] = array_map('absint', array_unique((array) $q['tag__in']));
1233 1233
 			$tax_query[] = array(
1234 1234
 				'taxonomy' => 'post_tag',
1235 1235
 				'terms' => $q['tag__in']
1236 1236
 			);
1237 1237
 		}
1238 1238
 
1239
-		if ( !empty($q['tag__not_in']) ) {
1240
-			$q['tag__not_in'] = array_map('absint', array_unique( (array) $q['tag__not_in'] ) );
1239
+		if ( ! empty($q['tag__not_in'])) {
1240
+			$q['tag__not_in'] = array_map('absint', array_unique((array) $q['tag__not_in']));
1241 1241
 			$tax_query[] = array(
1242 1242
 				'taxonomy' => 'post_tag',
1243 1243
 				'terms' => $q['tag__not_in'],
@@ -1245,8 +1245,8 @@  discard block
 block discarded – undo
1245 1245
 			);
1246 1246
 		}
1247 1247
 
1248
-		if ( !empty($q['tag__and']) ) {
1249
-			$q['tag__and'] = array_map('absint', array_unique( (array) $q['tag__and'] ) );
1248
+		if ( ! empty($q['tag__and'])) {
1249
+			$q['tag__and'] = array_map('absint', array_unique((array) $q['tag__and']));
1250 1250
 			$tax_query[] = array(
1251 1251
 				'taxonomy' => 'post_tag',
1252 1252
 				'terms' => $q['tag__and'],
@@ -1254,8 +1254,8 @@  discard block
 block discarded – undo
1254 1254
 			);
1255 1255
 		}
1256 1256
 
1257
-		if ( !empty($q['tag_slug__in']) ) {
1258
-			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );
1257
+		if ( ! empty($q['tag_slug__in'])) {
1258
+			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__in']));
1259 1259
 			$tax_query[] = array(
1260 1260
 				'taxonomy' => 'post_tag',
1261 1261
 				'terms' => $q['tag_slug__in'],
@@ -1263,8 +1263,8 @@  discard block
 block discarded – undo
1263 1263
 			);
1264 1264
 		}
1265 1265
 
1266
-		if ( !empty($q['tag_slug__and']) ) {
1267
-			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );
1266
+		if ( ! empty($q['tag_slug__and'])) {
1267
+			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__and']));
1268 1268
 			$tax_query[] = array(
1269 1269
 				'taxonomy' => 'post_tag',
1270 1270
 				'terms' => $q['tag_slug__and'],
@@ -1273,7 +1273,7 @@  discard block
 block discarded – undo
1273 1273
 			);
1274 1274
 		}
1275 1275
 
1276
-		$this->tax_query = new WP_Tax_Query( $tax_query );
1276
+		$this->tax_query = new WP_Tax_Query($tax_query);
1277 1277
 
1278 1278
 		/**
1279 1279
 		 * Fires after taxonomy-related query vars have been parsed.
@@ -1282,7 +1282,7 @@  discard block
 block discarded – undo
1282 1282
 		 *
1283 1283
 		 * @param WP_Query $this The WP_Query instance.
1284 1284
 		 */
1285
-		do_action( 'parse_tax_query', $this );
1285
+		do_action('parse_tax_query', $this);
1286 1286
 	}
1287 1287
 
1288 1288
 	/**
@@ -1293,33 +1293,33 @@  discard block
 block discarded – undo
1293 1293
 	 * @param array $q Query variables.
1294 1294
 	 * @return string WHERE clause.
1295 1295
 	 */
1296
-	protected function parse_search( &$q ) {
1296
+	protected function parse_search(&$q) {
1297 1297
 		global $wpdb;
1298 1298
 
1299 1299
 		$search = '';
1300 1300
 
1301 1301
 		// added slashes screw with quote grouping when done early, so done later
1302
-		$q['s'] = stripslashes( $q['s'] );
1303
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
1304
-			$q['s'] = urldecode( $q['s'] );
1302
+		$q['s'] = stripslashes($q['s']);
1303
+		if (empty($_GET['s']) && $this->is_main_query())
1304
+			$q['s'] = urldecode($q['s']);
1305 1305
 		// there are no line breaks in <input /> fields
1306
-		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
1306
+		$q['s'] = str_replace(array("\r", "\n"), '', $q['s']);
1307 1307
 		$q['search_terms_count'] = 1;
1308
-		if ( ! empty( $q['sentence'] ) ) {
1309
-			$q['search_terms'] = array( $q['s'] );
1308
+		if ( ! empty($q['sentence'])) {
1309
+			$q['search_terms'] = array($q['s']);
1310 1310
 		} else {
1311
-			if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
1312
-				$q['search_terms_count'] = count( $matches[0] );
1313
-				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
1311
+			if (preg_match_all('/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches)) {
1312
+				$q['search_terms_count'] = count($matches[0]);
1313
+				$q['search_terms'] = $this->parse_search_terms($matches[0]);
1314 1314
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
1315
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
1316
-					$q['search_terms'] = array( $q['s'] );
1315
+				if (empty($q['search_terms']) || count($q['search_terms']) > 9)
1316
+					$q['search_terms'] = array($q['s']);
1317 1317
 			} else {
1318
-				$q['search_terms'] = array( $q['s'] );
1318
+				$q['search_terms'] = array($q['s']);
1319 1319
 			}
1320 1320
 		}
1321 1321
 
1322
-		$n = ! empty( $q['exact'] ) ? '' : '%';
1322
+		$n = ! empty($q['exact']) ? '' : '%';
1323 1323
 		$searchand = '';
1324 1324
 		$q['search_orderby_title'] = array();
1325 1325
 
@@ -1331,33 +1331,33 @@  discard block
 block discarded – undo
1331 1331
 		 * @param string $exclusion_prefix The prefix. Default '-'. Returning
1332 1332
 		 *                                 an empty value disables exclusions.
1333 1333
 		 */
1334
-		$exclusion_prefix = apply_filters( 'wp_query_search_exclusion_prefix', '-' );
1334
+		$exclusion_prefix = apply_filters('wp_query_search_exclusion_prefix', '-');
1335 1335
 
1336
-		foreach ( $q['search_terms'] as $term ) {
1336
+		foreach ($q['search_terms'] as $term) {
1337 1337
 			// If there is an $exclusion_prefix, terms prefixed with it should be excluded.
1338
-			$exclude = $exclusion_prefix && ( $exclusion_prefix === substr( $term, 0, 1 ) );
1339
-			if ( $exclude ) {
1338
+			$exclude = $exclusion_prefix && ($exclusion_prefix === substr($term, 0, 1));
1339
+			if ($exclude) {
1340 1340
 				$like_op  = 'NOT LIKE';
1341 1341
 				$andor_op = 'AND';
1342
-				$term     = substr( $term, 1 );
1342
+				$term     = substr($term, 1);
1343 1343
 			} else {
1344 1344
 				$like_op  = 'LIKE';
1345 1345
 				$andor_op = 'OR';
1346 1346
 			}
1347 1347
 
1348
-			if ( $n && ! $exclude ) {
1349
-				$like = '%' . $wpdb->esc_like( $term ) . '%';
1350
-				$q['search_orderby_title'][] = $wpdb->prepare( "{$wpdb->posts}.post_title LIKE %s", $like );
1348
+			if ($n && ! $exclude) {
1349
+				$like = '%'.$wpdb->esc_like($term).'%';
1350
+				$q['search_orderby_title'][] = $wpdb->prepare("{$wpdb->posts}.post_title LIKE %s", $like);
1351 1351
 			}
1352 1352
 
1353
-			$like = $n . $wpdb->esc_like( $term ) . $n;
1354
-			$search .= $wpdb->prepare( "{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like );
1353
+			$like = $n.$wpdb->esc_like($term).$n;
1354
+			$search .= $wpdb->prepare("{$searchand}(({$wpdb->posts}.post_title $like_op %s) $andor_op ({$wpdb->posts}.post_excerpt $like_op %s) $andor_op ({$wpdb->posts}.post_content $like_op %s))", $like, $like, $like);
1355 1355
 			$searchand = ' AND ';
1356 1356
 		}
1357 1357
 
1358
-		if ( ! empty( $search ) ) {
1358
+		if ( ! empty($search)) {
1359 1359
 			$search = " AND ({$search}) ";
1360
-			if ( ! is_user_logged_in() ) {
1360
+			if ( ! is_user_logged_in()) {
1361 1361
 				$search .= " AND ({$wpdb->posts}.post_password = '') ";
1362 1362
 			}
1363 1363
 		}
@@ -1377,24 +1377,24 @@  discard block
 block discarded – undo
1377 1377
 	 * @param array $terms Terms to check.
1378 1378
 	 * @return array Terms that are not stopwords.
1379 1379
 	 */
1380
-	protected function parse_search_terms( $terms ) {
1381
-		$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';
1380
+	protected function parse_search_terms($terms) {
1381
+		$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
1382 1382
 		$checked = array();
1383 1383
 
1384 1384
 		$stopwords = $this->get_search_stopwords();
1385 1385
 
1386
-		foreach ( $terms as $term ) {
1386
+		foreach ($terms as $term) {
1387 1387
 			// keep before/after spaces when term is for exact match
1388
-			if ( preg_match( '/^".+"$/', $term ) )
1389
-				$term = trim( $term, "\"'" );
1388
+			if (preg_match('/^".+"$/', $term))
1389
+				$term = trim($term, "\"'");
1390 1390
 			else
1391
-				$term = trim( $term, "\"' " );
1391
+				$term = trim($term, "\"' ");
1392 1392
 
1393 1393
 			// Avoid single A-Z and single dashes.
1394
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
1394
+			if ( ! $term || (1 === strlen($term) && preg_match('/^[a-z\-]$/i', $term)))
1395 1395
 				continue;
1396 1396
 
1397
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
1397
+			if (in_array(call_user_func($strtolower, $term), $stopwords, true))
1398 1398
 				continue;
1399 1399
 
1400 1400
 			$checked[] = $term;
@@ -1411,20 +1411,20 @@  discard block
 block discarded – undo
1411 1411
 	 * @return array Stopwords.
1412 1412
 	 */
1413 1413
 	protected function get_search_stopwords() {
1414
-		if ( isset( $this->stopwords ) )
1414
+		if (isset($this->stopwords))
1415 1415
 			return $this->stopwords;
1416 1416
 
1417 1417
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
1418 1418
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
1419 1419
 		 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
1420 1420
 		 */
1421
-		$words = explode( ',', _x( 'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
1422
-			'Comma-separated list of search stopwords in your language' ) );
1421
+		$words = explode(',', _x('about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
1422
+			'Comma-separated list of search stopwords in your language'));
1423 1423
 
1424 1424
 		$stopwords = array();
1425
-		foreach ( $words as $word ) {
1426
-			$word = trim( $word, "\r\n\t " );
1427
-			if ( $word )
1425
+		foreach ($words as $word) {
1426
+			$word = trim($word, "\r\n\t ");
1427
+			if ($word)
1428 1428
 				$stopwords[] = $word;
1429 1429
 		}
1430 1430
 
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 		 *
1436 1436
 		 * @param array $stopwords Stopwords.
1437 1437
 		 */
1438
-		$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );
1438
+		$this->stopwords = apply_filters('wp_search_stopwords', $stopwords);
1439 1439
 		return $this->stopwords;
1440 1440
 	}
1441 1441
 
@@ -1445,47 +1445,47 @@  discard block
 block discarded – undo
1445 1445
 	 * @param array $q Query variables.
1446 1446
 	 * @return string ORDER BY clause.
1447 1447
 	 */
1448
-	protected function parse_search_order( &$q ) {
1448
+	protected function parse_search_order(&$q) {
1449 1449
 		global $wpdb;
1450 1450
 
1451
-		if ( $q['search_terms_count'] > 1 ) {
1452
-			$num_terms = count( $q['search_orderby_title'] );
1451
+		if ($q['search_terms_count'] > 1) {
1452
+			$num_terms = count($q['search_orderby_title']);
1453 1453
 
1454 1454
 			// If the search terms contain negative queries, don't bother ordering by sentence matches.
1455 1455
 			$like = '';
1456
-			if ( ! preg_match( '/(?:\s|^)\-/', $q['s'] ) ) {
1457
-				$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
1456
+			if ( ! preg_match('/(?:\s|^)\-/', $q['s'])) {
1457
+				$like = '%'.$wpdb->esc_like($q['s']).'%';
1458 1458
 			}
1459 1459
 
1460 1460
 			$search_orderby = '';
1461 1461
 
1462 1462
 			// sentence match in 'post_title'
1463
-			if ( $like ) {
1464
-				$search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 ", $like );
1463
+			if ($like) {
1464
+				$search_orderby .= $wpdb->prepare("WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 ", $like);
1465 1465
 			}
1466 1466
 
1467 1467
 			// sanity limit, sort as sentence when more than 6 terms
1468 1468
 			// (few searches are longer than 6 terms and most titles are not)
1469
-			if ( $num_terms < 7 ) {
1469
+			if ($num_terms < 7) {
1470 1470
 				// all words in title
1471
-				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
1471
+				$search_orderby .= 'WHEN '.implode(' AND ', $q['search_orderby_title']).' THEN 2 ';
1472 1472
 				// any word in title, not needed when $num_terms == 1
1473
-				if ( $num_terms > 1 )
1474
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
1473
+				if ($num_terms > 1)
1474
+					$search_orderby .= 'WHEN '.implode(' OR ', $q['search_orderby_title']).' THEN 3 ';
1475 1475
 			}
1476 1476
 
1477 1477
 			// Sentence match in 'post_content' and 'post_excerpt'.
1478
-			if ( $like ) {
1479
-				$search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_excerpt LIKE %s THEN 4 ", $like );
1480
-				$search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_content LIKE %s THEN 5 ", $like );
1478
+			if ($like) {
1479
+				$search_orderby .= $wpdb->prepare("WHEN {$wpdb->posts}.post_excerpt LIKE %s THEN 4 ", $like);
1480
+				$search_orderby .= $wpdb->prepare("WHEN {$wpdb->posts}.post_content LIKE %s THEN 5 ", $like);
1481 1481
 			}
1482 1482
 
1483
-			if ( $search_orderby ) {
1484
-				$search_orderby = '(CASE ' . $search_orderby . 'ELSE 6 END)';
1483
+			if ($search_orderby) {
1484
+				$search_orderby = '(CASE '.$search_orderby.'ELSE 6 END)';
1485 1485
 			}
1486 1486
 		} else {
1487 1487
 			// single word or sentence search
1488
-			$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';
1488
+			$search_orderby = reset($q['search_orderby_title']).' DESC';
1489 1489
 		}
1490 1490
 
1491 1491
 		return $search_orderby;
@@ -1501,7 +1501,7 @@  discard block
 block discarded – undo
1501 1501
 	 * @param string $orderby Alias for the field to order by.
1502 1502
 	 * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.
1503 1503
 	 */
1504
-	protected function parse_orderby( $orderby ) {
1504
+	protected function parse_orderby($orderby) {
1505 1505
 		global $wpdb;
1506 1506
 
1507 1507
 		// Used to filter values.
@@ -1514,32 +1514,32 @@  discard block
 block discarded – undo
1514 1514
 		$primary_meta_key = '';
1515 1515
 		$primary_meta_query = false;
1516 1516
 		$meta_clauses = $this->meta_query->get_clauses();
1517
-		if ( ! empty( $meta_clauses ) ) {
1518
-			$primary_meta_query = reset( $meta_clauses );
1517
+		if ( ! empty($meta_clauses)) {
1518
+			$primary_meta_query = reset($meta_clauses);
1519 1519
 
1520
-			if ( ! empty( $primary_meta_query['key'] ) ) {
1520
+			if ( ! empty($primary_meta_query['key'])) {
1521 1521
 				$primary_meta_key = $primary_meta_query['key'];
1522 1522
 				$allowed_keys[] = $primary_meta_key;
1523 1523
 			}
1524 1524
 
1525 1525
 			$allowed_keys[] = 'meta_value';
1526 1526
 			$allowed_keys[] = 'meta_value_num';
1527
-			$allowed_keys   = array_merge( $allowed_keys, array_keys( $meta_clauses ) );
1527
+			$allowed_keys   = array_merge($allowed_keys, array_keys($meta_clauses));
1528 1528
 		}
1529 1529
 
1530 1530
 		// If RAND() contains a seed value, sanitize and add to allowed keys.
1531 1531
 		$rand_with_seed = false;
1532
-		if ( preg_match( '/RAND\(([0-9]+)\)/i', $orderby, $matches ) ) {
1533
-			$orderby = sprintf( 'RAND(%s)', intval( $matches[1] ) );
1532
+		if (preg_match('/RAND\(([0-9]+)\)/i', $orderby, $matches)) {
1533
+			$orderby = sprintf('RAND(%s)', intval($matches[1]));
1534 1534
 			$allowed_keys[] = $orderby;
1535 1535
 			$rand_with_seed = true;
1536 1536
 		}
1537 1537
 
1538
-		if ( ! in_array( $orderby, $allowed_keys, true ) ) {
1538
+		if ( ! in_array($orderby, $allowed_keys, true)) {
1539 1539
 			return false;
1540 1540
 		}
1541 1541
 
1542
-		switch ( $orderby ) {
1542
+		switch ($orderby) {
1543 1543
 			case 'post_name':
1544 1544
 			case 'post_author':
1545 1545
 			case 'post_date':
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 				break;
1558 1558
 			case $primary_meta_key:
1559 1559
 			case 'meta_value':
1560
-				if ( ! empty( $primary_meta_query['type'] ) ) {
1560
+				if ( ! empty($primary_meta_query['type'])) {
1561 1561
 					$orderby_clause = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})";
1562 1562
 				} else {
1563 1563
 					$orderby_clause = "{$primary_meta_query['alias']}.meta_value";
@@ -1567,15 +1567,15 @@  discard block
 block discarded – undo
1567 1567
 				$orderby_clause = "{$primary_meta_query['alias']}.meta_value+0";
1568 1568
 				break;
1569 1569
 			default:
1570
-				if ( array_key_exists( $orderby, $meta_clauses ) ) {
1570
+				if (array_key_exists($orderby, $meta_clauses)) {
1571 1571
 					// $orderby corresponds to a meta_query clause.
1572
-					$meta_clause = $meta_clauses[ $orderby ];
1572
+					$meta_clause = $meta_clauses[$orderby];
1573 1573
 					$orderby_clause = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})";
1574
-				} elseif ( $rand_with_seed ) {
1574
+				} elseif ($rand_with_seed) {
1575 1575
 					$orderby_clause = $orderby;
1576 1576
 				} else {
1577 1577
 					// Default: order by post field.
1578
-					$orderby_clause = "{$wpdb->posts}.post_" . sanitize_key( $orderby );
1578
+					$orderby_clause = "{$wpdb->posts}.post_".sanitize_key($orderby);
1579 1579
 				}
1580 1580
 
1581 1581
 				break;
@@ -1593,12 +1593,12 @@  discard block
 block discarded – undo
1593 1593
 	 * @param string $order The 'order' query variable.
1594 1594
 	 * @return string The sanitized 'order' query variable.
1595 1595
 	 */
1596
-	protected function parse_order( $order ) {
1597
-		if ( ! is_string( $order ) || empty( $order ) ) {
1596
+	protected function parse_order($order) {
1597
+		if ( ! is_string($order) || empty($order)) {
1598 1598
 			return 'DESC';
1599 1599
 		}
1600 1600
 
1601
-		if ( 'ASC' === strtoupper( $order ) ) {
1601
+		if ('ASC' === strtoupper($order)) {
1602 1602
 			return 'ASC';
1603 1603
 		} else {
1604 1604
 			return 'DESC';
@@ -1632,9 +1632,9 @@  discard block
 block discarded – undo
1632 1632
 	 * @param mixed  $default   Optional. Value to return if the query variable is not set. Default empty.
1633 1633
 	 * @return mixed Contents of the query variable.
1634 1634
 	 */
1635
-	public function get( $query_var, $default = '' ) {
1636
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
1637
-			return $this->query_vars[ $query_var ];
1635
+	public function get($query_var, $default = '') {
1636
+		if (isset($this->query_vars[$query_var])) {
1637
+			return $this->query_vars[$query_var];
1638 1638
 		}
1639 1639
 
1640 1640
 		return $default;
@@ -1680,7 +1680,7 @@  discard block
 block discarded – undo
1680 1680
 		 *
1681 1681
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
1682 1682
 		 */
1683
-		do_action_ref_array( 'pre_get_posts', array( &$this ) );
1683
+		do_action_ref_array('pre_get_posts', array(&$this));
1684 1684
 
1685 1685
 		// Shorthand.
1686 1686
 		$q = &$this->query_vars;
@@ -1690,11 +1690,11 @@  discard block
 block discarded – undo
1690 1690
 
1691 1691
 		// Parse meta query
1692 1692
 		$this->meta_query = new WP_Meta_Query();
1693
-		$this->meta_query->parse_query_vars( $q );
1693
+		$this->meta_query->parse_query_vars($q);
1694 1694
 
1695 1695
 		// Set a flag if a pre_get_posts hook changed the query vars.
1696
-		$hash = md5( serialize( $this->query_vars ) );
1697
-		if ( $hash != $this->query_vars_hash ) {
1696
+		$hash = md5(serialize($this->query_vars));
1697
+		if ($hash != $this->query_vars_hash) {
1698 1698
 			$this->query_vars_changed = true;
1699 1699
 			$this->query_vars_hash = $hash;
1700 1700
 		}
@@ -1712,95 +1712,95 @@  discard block
 block discarded – undo
1712 1712
 		$post_status_join = false;
1713 1713
 		$page = 1;
1714 1714
 
1715
-		if ( isset( $q['caller_get_posts'] ) ) {
1716
-			_deprecated_argument( 'WP_Query', '3.1.0', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
1717
-			if ( !isset( $q['ignore_sticky_posts'] ) )
1715
+		if (isset($q['caller_get_posts'])) {
1716
+			_deprecated_argument('WP_Query', '3.1.0', __('"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.'));
1717
+			if ( ! isset($q['ignore_sticky_posts']))
1718 1718
 				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
1719 1719
 		}
1720 1720
 
1721
-		if ( !isset( $q['ignore_sticky_posts'] ) )
1721
+		if ( ! isset($q['ignore_sticky_posts']))
1722 1722
 			$q['ignore_sticky_posts'] = false;
1723 1723
 
1724
-		if ( !isset($q['suppress_filters']) )
1724
+		if ( ! isset($q['suppress_filters']))
1725 1725
 			$q['suppress_filters'] = false;
1726 1726
 
1727
-		if ( !isset($q['cache_results']) ) {
1728
-			if ( wp_using_ext_object_cache() )
1727
+		if ( ! isset($q['cache_results'])) {
1728
+			if (wp_using_ext_object_cache())
1729 1729
 				$q['cache_results'] = false;
1730 1730
 			else
1731 1731
 				$q['cache_results'] = true;
1732 1732
 		}
1733 1733
 
1734
-		if ( !isset($q['update_post_term_cache']) )
1734
+		if ( ! isset($q['update_post_term_cache']))
1735 1735
 			$q['update_post_term_cache'] = true;
1736 1736
 
1737
-		if ( ! isset( $q['lazy_load_term_meta'] ) ) {
1737
+		if ( ! isset($q['lazy_load_term_meta'])) {
1738 1738
 			$q['lazy_load_term_meta'] = $q['update_post_term_cache'];
1739 1739
 		}
1740 1740
 
1741
-		if ( !isset($q['update_post_meta_cache']) )
1741
+		if ( ! isset($q['update_post_meta_cache']))
1742 1742
 			$q['update_post_meta_cache'] = true;
1743 1743
 
1744
-		if ( !isset($q['post_type']) ) {
1745
-			if ( $this->is_search )
1744
+		if ( ! isset($q['post_type'])) {
1745
+			if ($this->is_search)
1746 1746
 				$q['post_type'] = 'any';
1747 1747
 			else
1748 1748
 				$q['post_type'] = '';
1749 1749
 		}
1750 1750
 		$post_type = $q['post_type'];
1751
-		if ( empty( $q['posts_per_page'] ) ) {
1752
-			$q['posts_per_page'] = get_option( 'posts_per_page' );
1751
+		if (empty($q['posts_per_page'])) {
1752
+			$q['posts_per_page'] = get_option('posts_per_page');
1753 1753
 		}
1754
-		if ( isset($q['showposts']) && $q['showposts'] ) {
1754
+		if (isset($q['showposts']) && $q['showposts']) {
1755 1755
 			$q['showposts'] = (int) $q['showposts'];
1756 1756
 			$q['posts_per_page'] = $q['showposts'];
1757 1757
 		}
1758
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
1758
+		if ((isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search))
1759 1759
 			$q['posts_per_page'] = $q['posts_per_archive_page'];
1760
-		if ( !isset($q['nopaging']) ) {
1761
-			if ( $q['posts_per_page'] == -1 ) {
1760
+		if ( ! isset($q['nopaging'])) {
1761
+			if ($q['posts_per_page'] == -1) {
1762 1762
 				$q['nopaging'] = true;
1763 1763
 			} else {
1764 1764
 				$q['nopaging'] = false;
1765 1765
 			}
1766 1766
 		}
1767 1767
 
1768
-		if ( $this->is_feed ) {
1768
+		if ($this->is_feed) {
1769 1769
 			// This overrides posts_per_page.
1770
-			if ( ! empty( $q['posts_per_rss'] ) ) {
1770
+			if ( ! empty($q['posts_per_rss'])) {
1771 1771
 				$q['posts_per_page'] = $q['posts_per_rss'];
1772 1772
 			} else {
1773
-				$q['posts_per_page'] = get_option( 'posts_per_rss' );
1773
+				$q['posts_per_page'] = get_option('posts_per_rss');
1774 1774
 			}
1775 1775
 			$q['nopaging'] = false;
1776 1776
 		}
1777 1777
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
1778
-		if ( $q['posts_per_page'] < -1 )
1778
+		if ($q['posts_per_page'] < -1)
1779 1779
 			$q['posts_per_page'] = abs($q['posts_per_page']);
1780
-		elseif ( $q['posts_per_page'] == 0 )
1780
+		elseif ($q['posts_per_page'] == 0)
1781 1781
 			$q['posts_per_page'] = 1;
1782 1782
 
1783
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
1783
+		if ( ! isset($q['comments_per_page']) || $q['comments_per_page'] == 0)
1784 1784
 			$q['comments_per_page'] = get_option('comments_per_page');
1785 1785
 
1786
-		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
1786
+		if ($this->is_home && (empty($this->query) || $q['preview'] == 'true') && ('page' == get_option('show_on_front')) && get_option('page_on_front')) {
1787 1787
 			$this->is_page = true;
1788 1788
 			$this->is_home = false;
1789 1789
 			$q['page_id'] = get_option('page_on_front');
1790 1790
 		}
1791 1791
 
1792
-		if ( isset($q['page']) ) {
1792
+		if (isset($q['page'])) {
1793 1793
 			$q['page'] = trim($q['page'], '/');
1794 1794
 			$q['page'] = absint($q['page']);
1795 1795
 		}
1796 1796
 
1797 1797
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
1798
-		if ( isset($q['no_found_rows']) )
1798
+		if (isset($q['no_found_rows']))
1799 1799
 			$q['no_found_rows'] = (bool) $q['no_found_rows'];
1800 1800
 		else
1801 1801
 			$q['no_found_rows'] = false;
1802 1802
 
1803
-		switch ( $q['fields'] ) {
1803
+		switch ($q['fields']) {
1804 1804
 			case 'ids':
1805 1805
 				$fields = "{$wpdb->posts}.ID";
1806 1806
 				break;
@@ -1811,79 +1811,79 @@  discard block
 block discarded – undo
1811 1811
 				$fields = "{$wpdb->posts}.*";
1812 1812
 		}
1813 1813
 
1814
-		if ( '' !== $q['menu_order'] ) {
1815
-			$where .= " AND {$wpdb->posts}.menu_order = " . $q['menu_order'];
1814
+		if ('' !== $q['menu_order']) {
1815
+			$where .= " AND {$wpdb->posts}.menu_order = ".$q['menu_order'];
1816 1816
 		}
1817 1817
 		// The "m" parameter is meant for months but accepts datetimes of varying specificity
1818
-		if ( $q['m'] ) {
1819
-			$where .= " AND YEAR({$wpdb->posts}.post_date)=" . substr($q['m'], 0, 4);
1820
-			if ( strlen($q['m']) > 5 ) {
1821
-				$where .= " AND MONTH({$wpdb->posts}.post_date)=" . substr($q['m'], 4, 2);
1818
+		if ($q['m']) {
1819
+			$where .= " AND YEAR({$wpdb->posts}.post_date)=".substr($q['m'], 0, 4);
1820
+			if (strlen($q['m']) > 5) {
1821
+				$where .= " AND MONTH({$wpdb->posts}.post_date)=".substr($q['m'], 4, 2);
1822 1822
 			}
1823
-			if ( strlen($q['m']) > 7 ) {
1824
-				$where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=" . substr($q['m'], 6, 2);
1823
+			if (strlen($q['m']) > 7) {
1824
+				$where .= " AND DAYOFMONTH({$wpdb->posts}.post_date)=".substr($q['m'], 6, 2);
1825 1825
 			}
1826
-			if ( strlen($q['m']) > 9 ) {
1827
-				$where .= " AND HOUR({$wpdb->posts}.post_date)=" . substr($q['m'], 8, 2);
1826
+			if (strlen($q['m']) > 9) {
1827
+				$where .= " AND HOUR({$wpdb->posts}.post_date)=".substr($q['m'], 8, 2);
1828 1828
 			}
1829
-			if ( strlen($q['m']) > 11 ) {
1830
-				$where .= " AND MINUTE({$wpdb->posts}.post_date)=" . substr($q['m'], 10, 2);
1829
+			if (strlen($q['m']) > 11) {
1830
+				$where .= " AND MINUTE({$wpdb->posts}.post_date)=".substr($q['m'], 10, 2);
1831 1831
 			}
1832
-			if ( strlen($q['m']) > 13 ) {
1833
-				$where .= " AND SECOND({$wpdb->posts}.post_date)=" . substr($q['m'], 12, 2);
1832
+			if (strlen($q['m']) > 13) {
1833
+				$where .= " AND SECOND({$wpdb->posts}.post_date)=".substr($q['m'], 12, 2);
1834 1834
 			}
1835 1835
 		}
1836 1836
 
1837 1837
 		// Handle the other individual date parameters
1838 1838
 		$date_parameters = array();
1839 1839
 
1840
-		if ( '' !== $q['hour'] )
1840
+		if ('' !== $q['hour'])
1841 1841
 			$date_parameters['hour'] = $q['hour'];
1842 1842
 
1843
-		if ( '' !== $q['minute'] )
1843
+		if ('' !== $q['minute'])
1844 1844
 			$date_parameters['minute'] = $q['minute'];
1845 1845
 
1846
-		if ( '' !== $q['second'] )
1846
+		if ('' !== $q['second'])
1847 1847
 			$date_parameters['second'] = $q['second'];
1848 1848
 
1849
-		if ( $q['year'] )
1849
+		if ($q['year'])
1850 1850
 			$date_parameters['year'] = $q['year'];
1851 1851
 
1852
-		if ( $q['monthnum'] )
1852
+		if ($q['monthnum'])
1853 1853
 			$date_parameters['monthnum'] = $q['monthnum'];
1854 1854
 
1855
-		if ( $q['w'] )
1855
+		if ($q['w'])
1856 1856
 			$date_parameters['week'] = $q['w'];
1857 1857
 
1858
-		if ( $q['day'] )
1858
+		if ($q['day'])
1859 1859
 			$date_parameters['day'] = $q['day'];
1860 1860
 
1861
-		if ( $date_parameters ) {
1862
-			$date_query = new WP_Date_Query( array( $date_parameters ) );
1861
+		if ($date_parameters) {
1862
+			$date_query = new WP_Date_Query(array($date_parameters));
1863 1863
 			$where .= $date_query->get_sql();
1864 1864
 		}
1865
-		unset( $date_parameters, $date_query );
1865
+		unset($date_parameters, $date_query);
1866 1866
 
1867 1867
 		// Handle complex date queries
1868
-		if ( ! empty( $q['date_query'] ) ) {
1869
-			$this->date_query = new WP_Date_Query( $q['date_query'] );
1868
+		if ( ! empty($q['date_query'])) {
1869
+			$this->date_query = new WP_Date_Query($q['date_query']);
1870 1870
 			$where .= $this->date_query->get_sql();
1871 1871
 		}
1872 1872
 
1873 1873
 
1874 1874
 		// If we've got a post_type AND it's not "any" post_type.
1875
-		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
1876
-			foreach ( (array)$q['post_type'] as $_post_type ) {
1875
+		if ( ! empty($q['post_type']) && 'any' != $q['post_type']) {
1876
+			foreach ((array) $q['post_type'] as $_post_type) {
1877 1877
 				$ptype_obj = get_post_type_object($_post_type);
1878
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
1878
+				if ( ! $ptype_obj || ! $ptype_obj->query_var || empty($q[$ptype_obj->query_var]))
1879 1879
 					continue;
1880 1880
 
1881
-				if ( ! $ptype_obj->hierarchical ) {
1881
+				if ( ! $ptype_obj->hierarchical) {
1882 1882
 					// Non-hierarchical post types can directly use 'name'.
1883
-					$q['name'] = $q[ $ptype_obj->query_var ];
1883
+					$q['name'] = $q[$ptype_obj->query_var];
1884 1884
 				} else {
1885 1885
 					// Hierarchical post types will operate through 'pagename'.
1886
-					$q['pagename'] = $q[ $ptype_obj->query_var ];
1886
+					$q['pagename'] = $q[$ptype_obj->query_var];
1887 1887
 					$q['name'] = '';
1888 1888
 				}
1889 1889
 
@@ -1893,99 +1893,99 @@  discard block
 block discarded – undo
1893 1893
 			unset($ptype_obj);
1894 1894
 		}
1895 1895
 
1896
-		if ( '' !== $q['title'] ) {
1897
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_title = %s", stripslashes( $q['title'] ) );
1896
+		if ('' !== $q['title']) {
1897
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_title = %s", stripslashes($q['title']));
1898 1898
 		}
1899 1899
 
1900 1900
 		// Parameters related to 'post_name'.
1901
-		if ( '' != $q['name'] ) {
1902
-			$q['name'] = sanitize_title_for_query( $q['name'] );
1903
-			$where .= " AND {$wpdb->posts}.post_name = '" . $q['name'] . "'";
1904
-		} elseif ( '' != $q['pagename'] ) {
1905
-			if ( isset($this->queried_object_id) ) {
1901
+		if ('' != $q['name']) {
1902
+			$q['name'] = sanitize_title_for_query($q['name']);
1903
+			$where .= " AND {$wpdb->posts}.post_name = '".$q['name']."'";
1904
+		} elseif ('' != $q['pagename']) {
1905
+			if (isset($this->queried_object_id)) {
1906 1906
 				$reqpage = $this->queried_object_id;
1907 1907
 			} else {
1908
-				if ( 'page' != $q['post_type'] ) {
1909
-					foreach ( (array)$q['post_type'] as $_post_type ) {
1908
+				if ('page' != $q['post_type']) {
1909
+					foreach ((array) $q['post_type'] as $_post_type) {
1910 1910
 						$ptype_obj = get_post_type_object($_post_type);
1911
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
1911
+						if ( ! $ptype_obj || ! $ptype_obj->hierarchical)
1912 1912
 							continue;
1913 1913
 
1914 1914
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
1915
-						if ( $reqpage )
1915
+						if ($reqpage)
1916 1916
 							break;
1917 1917
 					}
1918 1918
 					unset($ptype_obj);
1919 1919
 				} else {
1920 1920
 					$reqpage = get_page_by_path($q['pagename']);
1921 1921
 				}
1922
-				if ( !empty($reqpage) )
1922
+				if ( ! empty($reqpage))
1923 1923
 					$reqpage = $reqpage->ID;
1924 1924
 				else
1925 1925
 					$reqpage = 0;
1926 1926
 			}
1927 1927
 
1928 1928
 			$page_for_posts = get_option('page_for_posts');
1929
-			if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
1930
-				$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );
1929
+			if (('page' != get_option('show_on_front')) || empty($page_for_posts) || ($reqpage != $page_for_posts)) {
1930
+				$q['pagename'] = sanitize_title_for_query(wp_basename($q['pagename']));
1931 1931
 				$q['name'] = $q['pagename'];
1932 1932
 				$where .= " AND ({$wpdb->posts}.ID = '$reqpage')";
1933
-				$reqpage_obj = get_post( $reqpage );
1934
-				if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
1933
+				$reqpage_obj = get_post($reqpage);
1934
+				if (is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type) {
1935 1935
 					$this->is_attachment = true;
1936 1936
 					$post_type = $q['post_type'] = 'attachment';
1937 1937
 					$this->is_page = true;
1938 1938
 					$q['attachment_id'] = $reqpage;
1939 1939
 				}
1940 1940
 			}
1941
-		} elseif ( '' != $q['attachment'] ) {
1942
-			$q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );
1941
+		} elseif ('' != $q['attachment']) {
1942
+			$q['attachment'] = sanitize_title_for_query(wp_basename($q['attachment']));
1943 1943
 			$q['name'] = $q['attachment'];
1944
-			$where .= " AND {$wpdb->posts}.post_name = '" . $q['attachment'] . "'";
1945
-		} elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {
1946
-			$q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );
1947
-			$post_name__in = "'" . implode( "','", $q['post_name__in'] ) . "'";
1944
+			$where .= " AND {$wpdb->posts}.post_name = '".$q['attachment']."'";
1945
+		} elseif (is_array($q['post_name__in']) && ! empty($q['post_name__in'])) {
1946
+			$q['post_name__in'] = array_map('sanitize_title_for_query', $q['post_name__in']);
1947
+			$post_name__in = "'".implode("','", $q['post_name__in'])."'";
1948 1948
 			$where .= " AND {$wpdb->posts}.post_name IN ($post_name__in)";
1949 1949
 		}
1950 1950
 
1951 1951
 		// If an attachment is requested by number, let it supersede any post number.
1952
-		if ( $q['attachment_id'] )
1952
+		if ($q['attachment_id'])
1953 1953
 			$q['p'] = absint($q['attachment_id']);
1954 1954
 
1955 1955
 		// If a post number is specified, load that post
1956
-		if ( $q['p'] ) {
1957
-			$where .= " AND {$wpdb->posts}.ID = " . $q['p'];
1958
-		} elseif ( $q['post__in'] ) {
1959
-			$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
1956
+		if ($q['p']) {
1957
+			$where .= " AND {$wpdb->posts}.ID = ".$q['p'];
1958
+		} elseif ($q['post__in']) {
1959
+			$post__in = implode(',', array_map('absint', $q['post__in']));
1960 1960
 			$where .= " AND {$wpdb->posts}.ID IN ($post__in)";
1961
-		} elseif ( $q['post__not_in'] ) {
1962
-			$post__not_in = implode(',',  array_map( 'absint', $q['post__not_in'] ));
1961
+		} elseif ($q['post__not_in']) {
1962
+			$post__not_in = implode(',', array_map('absint', $q['post__not_in']));
1963 1963
 			$where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
1964 1964
 		}
1965 1965
 
1966
-		if ( is_numeric( $q['post_parent'] ) ) {
1967
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_parent = %d ", $q['post_parent'] );
1968
-		} elseif ( $q['post_parent__in'] ) {
1969
-			$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
1966
+		if (is_numeric($q['post_parent'])) {
1967
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_parent = %d ", $q['post_parent']);
1968
+		} elseif ($q['post_parent__in']) {
1969
+			$post_parent__in = implode(',', array_map('absint', $q['post_parent__in']));
1970 1970
 			$where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
1971
-		} elseif ( $q['post_parent__not_in'] ) {
1972
-			$post_parent__not_in = implode( ',',  array_map( 'absint', $q['post_parent__not_in'] ) );
1971
+		} elseif ($q['post_parent__not_in']) {
1972
+			$post_parent__not_in = implode(',', array_map('absint', $q['post_parent__not_in']));
1973 1973
 			$where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
1974 1974
 		}
1975 1975
 
1976
-		if ( $q['page_id'] ) {
1977
-			if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {
1976
+		if ($q['page_id']) {
1977
+			if (('page' != get_option('show_on_front')) || ($q['page_id'] != get_option('page_for_posts'))) {
1978 1978
 				$q['p'] = $q['page_id'];
1979
-				$where = " AND {$wpdb->posts}.ID = " . $q['page_id'];
1979
+				$where = " AND {$wpdb->posts}.ID = ".$q['page_id'];
1980 1980
 			}
1981 1981
 		}
1982 1982
 
1983 1983
 		// If a search pattern is specified, load the posts that match.
1984
-		if ( strlen( $q['s'] ) ) {
1985
-			$search = $this->parse_search( $q );
1984
+		if (strlen($q['s'])) {
1985
+			$search = $this->parse_search($q);
1986 1986
 		}
1987 1987
 
1988
-		if ( ! $q['suppress_filters'] ) {
1988
+		if ( ! $q['suppress_filters']) {
1989 1989
 			/**
1990 1990
 			 * Filters the search SQL that is used in the WHERE clause of WP_Query.
1991 1991
 			 *
@@ -1994,36 +1994,36 @@  discard block
 block discarded – undo
1994 1994
 			 * @param string   $search Search SQL for WHERE clause.
1995 1995
 			 * @param WP_Query $this   The current WP_Query object.
1996 1996
 			 */
1997
-			$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
1997
+			$search = apply_filters_ref_array('posts_search', array($search, &$this));
1998 1998
 		}
1999 1999
 
2000 2000
 		// Taxonomies
2001
-		if ( !$this->is_singular ) {
2002
-			$this->parse_tax_query( $q );
2001
+		if ( ! $this->is_singular) {
2002
+			$this->parse_tax_query($q);
2003 2003
 
2004
-			$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
2004
+			$clauses = $this->tax_query->get_sql($wpdb->posts, 'ID');
2005 2005
 
2006 2006
 			$join .= $clauses['join'];
2007 2007
 			$where .= $clauses['where'];
2008 2008
 		}
2009 2009
 
2010
-		if ( $this->is_tax ) {
2011
-			if ( empty($post_type) ) {
2010
+		if ($this->is_tax) {
2011
+			if (empty($post_type)) {
2012 2012
 				// Do a fully inclusive search for currently registered post types of queried taxonomies
2013 2013
 				$post_type = array();
2014
-				$taxonomies = array_keys( $this->tax_query->queried_terms );
2015
-				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2016
-					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2017
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2014
+				$taxonomies = array_keys($this->tax_query->queried_terms);
2015
+				foreach (get_post_types(array('exclude_from_search' => false)) as $pt) {
2016
+					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
2017
+					if (array_intersect($taxonomies, $object_taxonomies))
2018 2018
 						$post_type[] = $pt;
2019 2019
 				}
2020
-				if ( ! $post_type )
2020
+				if ( ! $post_type)
2021 2021
 					$post_type = 'any';
2022
-				elseif ( count( $post_type ) == 1 )
2022
+				elseif (count($post_type) == 1)
2023 2023
 					$post_type = $post_type[0];
2024 2024
 
2025 2025
 				$post_status_join = true;
2026
-			} elseif ( in_array('attachment', (array) $post_type) ) {
2026
+			} elseif (in_array('attachment', (array) $post_type)) {
2027 2027
 				$post_status_join = true;
2028 2028
 			}
2029 2029
 		}
@@ -2032,22 +2032,22 @@  discard block
 block discarded – undo
2032 2032
 		 * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and
2033 2033
 		 * 'category_name' vars are set for backward compatibility.
2034 2034
 		 */
2035
-		if ( ! empty( $this->tax_query->queried_terms ) ) {
2035
+		if ( ! empty($this->tax_query->queried_terms)) {
2036 2036
 
2037 2037
 			/*
2038 2038
 			 * Set 'taxonomy', 'term', and 'term_id' to the
2039 2039
 			 * first taxonomy other than 'post_tag' or 'category'.
2040 2040
 			 */
2041
-			if ( ! isset( $q['taxonomy'] ) ) {
2042
-				foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2043
-					if ( empty( $queried_items['terms'][0] ) ) {
2041
+			if ( ! isset($q['taxonomy'])) {
2042
+				foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2043
+					if (empty($queried_items['terms'][0])) {
2044 2044
 						continue;
2045 2045
 					}
2046 2046
 
2047
-					if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {
2047
+					if ( ! in_array($queried_taxonomy, array('category', 'post_tag'))) {
2048 2048
 						$q['taxonomy'] = $queried_taxonomy;
2049 2049
 
2050
-						if ( 'slug' === $queried_items['field'] ) {
2050
+						if ('slug' === $queried_items['field']) {
2051 2051
 							$q['term'] = $queried_items['terms'][0];
2052 2052
 						} else {
2053 2053
 							$q['term_id'] = $queried_items['terms'][0];
@@ -2060,156 +2060,156 @@  discard block
 block discarded – undo
2060 2060
 			}
2061 2061
 
2062 2062
 			// 'cat', 'category_name', 'tag_id'
2063
-			foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2064
-				if ( empty( $queried_items['terms'][0] ) ) {
2063
+			foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2064
+				if (empty($queried_items['terms'][0])) {
2065 2065
 					continue;
2066 2066
 				}
2067 2067
 
2068
-				if ( 'category' === $queried_taxonomy ) {
2069
-					$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );
2070
-					if ( $the_cat ) {
2071
-						$this->set( 'cat', $the_cat->term_id );
2072
-						$this->set( 'category_name', $the_cat->slug );
2068
+				if ('category' === $queried_taxonomy) {
2069
+					$the_cat = get_term_by($queried_items['field'], $queried_items['terms'][0], 'category');
2070
+					if ($the_cat) {
2071
+						$this->set('cat', $the_cat->term_id);
2072
+						$this->set('category_name', $the_cat->slug);
2073 2073
 					}
2074
-					unset( $the_cat );
2074
+					unset($the_cat);
2075 2075
 				}
2076 2076
 
2077
-				if ( 'post_tag' === $queried_taxonomy ) {
2078
-					$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );
2079
-					if ( $the_tag ) {
2080
-						$this->set( 'tag_id', $the_tag->term_id );
2077
+				if ('post_tag' === $queried_taxonomy) {
2078
+					$the_tag = get_term_by($queried_items['field'], $queried_items['terms'][0], 'post_tag');
2079
+					if ($the_tag) {
2080
+						$this->set('tag_id', $the_tag->term_id);
2081 2081
 					}
2082
-					unset( $the_tag );
2082
+					unset($the_tag);
2083 2083
 				}
2084 2084
 			}
2085 2085
 		}
2086 2086
 
2087
-		if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) {
2087
+		if ( ! empty($this->tax_query->queries) || ! empty($this->meta_query->queries)) {
2088 2088
 			$groupby = "{$wpdb->posts}.ID";
2089 2089
 		}
2090 2090
 
2091 2091
 		// Author/user stuff
2092 2092
 
2093
-		if ( ! empty( $q['author'] ) && $q['author'] != '0' ) {
2094
-			$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
2095
-			$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
2096
-			foreach ( $authors as $author ) {
2093
+		if ( ! empty($q['author']) && $q['author'] != '0') {
2094
+			$q['author'] = addslashes_gpc(''.urldecode($q['author']));
2095
+			$authors = array_unique(array_map('intval', preg_split('/[,\s]+/', $q['author'])));
2096
+			foreach ($authors as $author) {
2097 2097
 				$key = $author > 0 ? 'author__in' : 'author__not_in';
2098
-				$q[$key][] = abs( $author );
2098
+				$q[$key][] = abs($author);
2099 2099
 			}
2100
-			$q['author'] = implode( ',', $authors );
2100
+			$q['author'] = implode(',', $authors);
2101 2101
 		}
2102 2102
 
2103
-		if ( ! empty( $q['author__not_in'] ) ) {
2104
-			$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );
2103
+		if ( ! empty($q['author__not_in'])) {
2104
+			$author__not_in = implode(',', array_map('absint', array_unique((array) $q['author__not_in'])));
2105 2105
 			$where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) ";
2106
-		} elseif ( ! empty( $q['author__in'] ) ) {
2107
-			$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
2106
+		} elseif ( ! empty($q['author__in'])) {
2107
+			$author__in = implode(',', array_map('absint', array_unique((array) $q['author__in'])));
2108 2108
 			$where .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
2109 2109
 		}
2110 2110
 
2111 2111
 		// Author stuff for nice URLs
2112 2112
 
2113
-		if ( '' != $q['author_name'] ) {
2114
-			if ( strpos($q['author_name'], '/') !== false ) {
2113
+		if ('' != $q['author_name']) {
2114
+			if (strpos($q['author_name'], '/') !== false) {
2115 2115
 				$q['author_name'] = explode('/', $q['author_name']);
2116
-				if ( $q['author_name'][ count($q['author_name'])-1 ] ) {
2117
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-1]; // no trailing slash
2116
+				if ($q['author_name'][count($q['author_name']) - 1]) {
2117
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 1]; // no trailing slash
2118 2118
 				} else {
2119
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailing slash
2119
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 2]; // there was a trailing slash
2120 2120
 				}
2121 2121
 			}
2122
-			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2122
+			$q['author_name'] = sanitize_title_for_query($q['author_name']);
2123 2123
 			$q['author'] = get_user_by('slug', $q['author_name']);
2124
-			if ( $q['author'] )
2124
+			if ($q['author'])
2125 2125
 				$q['author'] = $q['author']->ID;
2126
-			$whichauthor .= " AND ({$wpdb->posts}.post_author = " . absint($q['author']) . ')';
2126
+			$whichauthor .= " AND ({$wpdb->posts}.post_author = ".absint($q['author']).')';
2127 2127
 		}
2128 2128
 
2129 2129
 		// MIME-Type stuff for attachment browsing
2130 2130
 
2131
-		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) {
2132
-			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
2131
+		if (isset($q['post_mime_type']) && '' != $q['post_mime_type']) {
2132
+			$whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $wpdb->posts);
2133 2133
 		}
2134
-		$where .= $search . $whichauthor . $whichmimetype;
2134
+		$where .= $search.$whichauthor.$whichmimetype;
2135 2135
 
2136
-		if ( ! empty( $this->meta_query->queries ) ) {
2137
-			$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
2136
+		if ( ! empty($this->meta_query->queries)) {
2137
+			$clauses = $this->meta_query->get_sql('post', $wpdb->posts, 'ID', $this);
2138 2138
 			$join   .= $clauses['join'];
2139 2139
 			$where  .= $clauses['where'];
2140 2140
 		}
2141 2141
 
2142
-		$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
2143
-		if ( ! isset( $q['order'] ) ) {
2142
+		$rand = (isset($q['orderby']) && 'rand' === $q['orderby']);
2143
+		if ( ! isset($q['order'])) {
2144 2144
 			$q['order'] = $rand ? '' : 'DESC';
2145 2145
 		} else {
2146
-			$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
2146
+			$q['order'] = $rand ? '' : $this->parse_order($q['order']);
2147 2147
 		}
2148 2148
 
2149 2149
 		// Order by.
2150
-		if ( empty( $q['orderby'] ) ) {
2150
+		if (empty($q['orderby'])) {
2151 2151
 			/*
2152 2152
 			 * Boolean false or empty array blanks out ORDER BY,
2153 2153
 			 * while leaving the value unset or otherwise empty sets the default.
2154 2154
 			 */
2155
-			if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {
2155
+			if (isset($q['orderby']) && (is_array($q['orderby']) || false === $q['orderby'])) {
2156 2156
 				$orderby = '';
2157 2157
 			} else {
2158
-				$orderby = "{$wpdb->posts}.post_date " . $q['order'];
2158
+				$orderby = "{$wpdb->posts}.post_date ".$q['order'];
2159 2159
 			}
2160
-		} elseif ( 'none' == $q['orderby'] ) {
2160
+		} elseif ('none' == $q['orderby']) {
2161 2161
 			$orderby = '';
2162
-		} elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
2162
+		} elseif ($q['orderby'] == 'post__in' && ! empty($post__in)) {
2163 2163
 			$orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
2164
-		} elseif ( $q['orderby'] == 'post_parent__in' && ! empty( $post_parent__in ) ) {
2164
+		} elseif ($q['orderby'] == 'post_parent__in' && ! empty($post_parent__in)) {
2165 2165
 			$orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
2166
-		} elseif ( $q['orderby'] == 'post_name__in' && ! empty( $post_name__in ) ) {
2166
+		} elseif ($q['orderby'] == 'post_name__in' && ! empty($post_name__in)) {
2167 2167
 			$orderby = "FIELD( {$wpdb->posts}.post_name, $post_name__in )";
2168 2168
 		} else {
2169 2169
 			$orderby_array = array();
2170
-			if ( is_array( $q['orderby'] ) ) {
2171
-				foreach ( $q['orderby'] as $_orderby => $order ) {
2172
-					$orderby = addslashes_gpc( urldecode( $_orderby ) );
2173
-					$parsed  = $this->parse_orderby( $orderby );
2170
+			if (is_array($q['orderby'])) {
2171
+				foreach ($q['orderby'] as $_orderby => $order) {
2172
+					$orderby = addslashes_gpc(urldecode($_orderby));
2173
+					$parsed  = $this->parse_orderby($orderby);
2174 2174
 
2175
-					if ( ! $parsed ) {
2175
+					if ( ! $parsed) {
2176 2176
 						continue;
2177 2177
 					}
2178 2178
 
2179
-					$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );
2179
+					$orderby_array[] = $parsed.' '.$this->parse_order($order);
2180 2180
 				}
2181
-				$orderby = implode( ', ', $orderby_array );
2181
+				$orderby = implode(', ', $orderby_array);
2182 2182
 
2183 2183
 			} else {
2184
-				$q['orderby'] = urldecode( $q['orderby'] );
2185
-				$q['orderby'] = addslashes_gpc( $q['orderby'] );
2184
+				$q['orderby'] = urldecode($q['orderby']);
2185
+				$q['orderby'] = addslashes_gpc($q['orderby']);
2186 2186
 
2187
-				foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {
2188
-					$parsed = $this->parse_orderby( $orderby );
2187
+				foreach (explode(' ', $q['orderby']) as $i => $orderby) {
2188
+					$parsed = $this->parse_orderby($orderby);
2189 2189
 					// Only allow certain values for safety.
2190
-					if ( ! $parsed ) {
2190
+					if ( ! $parsed) {
2191 2191
 						continue;
2192 2192
 					}
2193 2193
 
2194 2194
 					$orderby_array[] = $parsed;
2195 2195
 				}
2196
-				$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );
2196
+				$orderby = implode(' '.$q['order'].', ', $orderby_array);
2197 2197
 
2198
-				if ( empty( $orderby ) ) {
2199
-					$orderby = "{$wpdb->posts}.post_date " . $q['order'];
2200
-				} elseif ( ! empty( $q['order'] ) ) {
2198
+				if (empty($orderby)) {
2199
+					$orderby = "{$wpdb->posts}.post_date ".$q['order'];
2200
+				} elseif ( ! empty($q['order'])) {
2201 2201
 					$orderby .= " {$q['order']}";
2202 2202
 				}
2203 2203
 			}
2204 2204
 		}
2205 2205
 
2206 2206
 		// Order search results by relevance only when another "orderby" is not specified in the query.
2207
-		if ( ! empty( $q['s'] ) ) {
2207
+		if ( ! empty($q['s'])) {
2208 2208
 			$search_orderby = '';
2209
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
2210
-				$search_orderby = $this->parse_search_order( $q );
2209
+			if ( ! empty($q['search_orderby_title']) && (empty($q['orderby']) && ! $this->is_feed) || (isset($q['orderby']) && 'relevance' === $q['orderby']))
2210
+				$search_orderby = $this->parse_search_order($q);
2211 2211
 
2212
-			if ( ! $q['suppress_filters'] ) {
2212
+			if ( ! $q['suppress_filters']) {
2213 2213
 				/**
2214 2214
 				 * Filters the ORDER BY used when ordering search results.
2215 2215
 				 *
@@ -2218,95 +2218,95 @@  discard block
 block discarded – undo
2218 2218
 				 * @param string   $search_orderby The ORDER BY clause.
2219 2219
 				 * @param WP_Query $this           The current WP_Query instance.
2220 2220
 				 */
2221
-				$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
2221
+				$search_orderby = apply_filters('posts_search_orderby', $search_orderby, $this);
2222 2222
 			}
2223 2223
 
2224
-			if ( $search_orderby )
2225
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
2224
+			if ($search_orderby)
2225
+				$orderby = $orderby ? $search_orderby.', '.$orderby : $search_orderby;
2226 2226
 		}
2227 2227
 
2228
-		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
2228
+		if (is_array($post_type) && count($post_type) > 1) {
2229 2229
 			$post_type_cap = 'multiple_post_type';
2230 2230
 		} else {
2231
-			if ( is_array( $post_type ) )
2232
-				$post_type = reset( $post_type );
2233
-			$post_type_object = get_post_type_object( $post_type );
2234
-			if ( empty( $post_type_object ) )
2231
+			if (is_array($post_type))
2232
+				$post_type = reset($post_type);
2233
+			$post_type_object = get_post_type_object($post_type);
2234
+			if (empty($post_type_object))
2235 2235
 				$post_type_cap = $post_type;
2236 2236
 		}
2237 2237
 
2238
-		if ( isset( $q['post_password'] ) ) {
2239
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_password = %s", $q['post_password'] );
2240
-			if ( empty( $q['perm'] ) ) {
2238
+		if (isset($q['post_password'])) {
2239
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_password = %s", $q['post_password']);
2240
+			if (empty($q['perm'])) {
2241 2241
 				$q['perm'] = 'readable';
2242 2242
 			}
2243
-		} elseif ( isset( $q['has_password'] ) ) {
2244
-			$where .= sprintf( " AND {$wpdb->posts}.post_password %s ''", $q['has_password'] ? '!=' : '=' );
2243
+		} elseif (isset($q['has_password'])) {
2244
+			$where .= sprintf(" AND {$wpdb->posts}.post_password %s ''", $q['has_password'] ? '!=' : '=');
2245 2245
 		}
2246 2246
 
2247
-		if ( ! empty( $q['comment_status'] ) ) {
2248
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.comment_status = %s ", $q['comment_status'] );
2247
+		if ( ! empty($q['comment_status'])) {
2248
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.comment_status = %s ", $q['comment_status']);
2249 2249
 		}
2250 2250
 
2251
-		if ( ! empty( $q['ping_status'] ) )  {
2252
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.ping_status = %s ", $q['ping_status'] );
2251
+		if ( ! empty($q['ping_status'])) {
2252
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.ping_status = %s ", $q['ping_status']);
2253 2253
 		}
2254 2254
 
2255
-		if ( 'any' == $post_type ) {
2256
-			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
2257
-			if ( empty( $in_search_post_types ) ) {
2255
+		if ('any' == $post_type) {
2256
+			$in_search_post_types = get_post_types(array('exclude_from_search' => false));
2257
+			if (empty($in_search_post_types)) {
2258 2258
 				$where .= ' AND 1=0 ';
2259 2259
 			} else {
2260
-				$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
2260
+				$where .= " AND {$wpdb->posts}.post_type IN ('".join("', '", $in_search_post_types)."')";
2261 2261
 			}
2262
-		} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
2263
-			$where .= " AND {$wpdb->posts}.post_type IN ('" . join("', '", $post_type) . "')";
2264
-		} elseif ( ! empty( $post_type ) ) {
2262
+		} elseif ( ! empty($post_type) && is_array($post_type)) {
2263
+			$where .= " AND {$wpdb->posts}.post_type IN ('".join("', '", $post_type)."')";
2264
+		} elseif ( ! empty($post_type)) {
2265 2265
 			$where .= " AND {$wpdb->posts}.post_type = '$post_type'";
2266
-			$post_type_object = get_post_type_object ( $post_type );
2267
-		} elseif ( $this->is_attachment ) {
2266
+			$post_type_object = get_post_type_object($post_type);
2267
+		} elseif ($this->is_attachment) {
2268 2268
 			$where .= " AND {$wpdb->posts}.post_type = 'attachment'";
2269
-			$post_type_object = get_post_type_object ( 'attachment' );
2270
-		} elseif ( $this->is_page ) {
2269
+			$post_type_object = get_post_type_object('attachment');
2270
+		} elseif ($this->is_page) {
2271 2271
 			$where .= " AND {$wpdb->posts}.post_type = 'page'";
2272
-			$post_type_object = get_post_type_object ( 'page' );
2272
+			$post_type_object = get_post_type_object('page');
2273 2273
 		} else {
2274 2274
 			$where .= " AND {$wpdb->posts}.post_type = 'post'";
2275
-			$post_type_object = get_post_type_object ( 'post' );
2275
+			$post_type_object = get_post_type_object('post');
2276 2276
 		}
2277 2277
 
2278 2278
 		$edit_cap = 'edit_post';
2279 2279
 		$read_cap = 'read_post';
2280 2280
 
2281
-		if ( ! empty( $post_type_object ) ) {
2281
+		if ( ! empty($post_type_object)) {
2282 2282
 			$edit_others_cap = $post_type_object->cap->edit_others_posts;
2283 2283
 			$read_private_cap = $post_type_object->cap->read_private_posts;
2284 2284
 		} else {
2285
-			$edit_others_cap = 'edit_others_' . $post_type_cap . 's';
2286
-			$read_private_cap = 'read_private_' . $post_type_cap . 's';
2285
+			$edit_others_cap = 'edit_others_'.$post_type_cap.'s';
2286
+			$read_private_cap = 'read_private_'.$post_type_cap.'s';
2287 2287
 		}
2288 2288
 
2289 2289
 		$user_id = get_current_user_id();
2290 2290
 
2291 2291
 		$q_status = array();
2292
-		if ( ! empty( $q['post_status'] ) ) {
2292
+		if ( ! empty($q['post_status'])) {
2293 2293
 			$statuswheres = array();
2294 2294
 			$q_status = $q['post_status'];
2295
-			if ( ! is_array( $q_status ) )
2295
+			if ( ! is_array($q_status))
2296 2296
 				$q_status = explode(',', $q_status);
2297 2297
 			$r_status = array();
2298 2298
 			$p_status = array();
2299 2299
 			$e_status = array();
2300
-			if ( in_array( 'any', $q_status ) ) {
2301
-				foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
2302
-					if ( ! in_array( $status, $q_status ) ) {
2300
+			if (in_array('any', $q_status)) {
2301
+				foreach (get_post_stati(array('exclude_from_search' => true)) as $status) {
2302
+					if ( ! in_array($status, $q_status)) {
2303 2303
 						$e_status[] = "{$wpdb->posts}.post_status <> '$status'";
2304 2304
 					}
2305 2305
 				}
2306 2306
 			} else {
2307
-				foreach ( get_post_stati() as $status ) {
2308
-					if ( in_array( $status, $q_status ) ) {
2309
-						if ( 'private' == $status ) {
2307
+				foreach (get_post_stati() as $status) {
2308
+					if (in_array($status, $q_status)) {
2309
+						if ('private' == $status) {
2310 2310
 							$p_status[] = "{$wpdb->posts}.post_status = '$status'";
2311 2311
 						} else {
2312 2312
 							$r_status[] = "{$wpdb->posts}.post_status = '$status'";
@@ -2315,62 +2315,62 @@  discard block
 block discarded – undo
2315 2315
 				}
2316 2316
 			}
2317 2317
 
2318
-			if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
2318
+			if (empty($q['perm']) || 'readable' != $q['perm']) {
2319 2319
 				$r_status = array_merge($r_status, $p_status);
2320 2320
 				unset($p_status);
2321 2321
 			}
2322 2322
 
2323
-			if ( !empty($e_status) ) {
2324
-				$statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
2323
+			if ( ! empty($e_status)) {
2324
+				$statuswheres[] = "(".join(' AND ', $e_status).")";
2325 2325
 			}
2326
-			if ( !empty($r_status) ) {
2327
-				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) ) {
2328
-					$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
2326
+			if ( ! empty($r_status)) {
2327
+				if ( ! empty($q['perm']) && 'editable' == $q['perm'] && ! current_user_can($edit_others_cap)) {
2328
+					$statuswheres[] = "({$wpdb->posts}.post_author = $user_id "."AND (".join(' OR ', $r_status)."))";
2329 2329
 				} else {
2330
-					$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
2330
+					$statuswheres[] = "(".join(' OR ', $r_status).")";
2331 2331
 				}
2332 2332
 			}
2333
-			if ( !empty($p_status) ) {
2334
-				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) ) {
2335
-					$statuswheres[] = "({$wpdb->posts}.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
2333
+			if ( ! empty($p_status)) {
2334
+				if ( ! empty($q['perm']) && 'readable' == $q['perm'] && ! current_user_can($read_private_cap)) {
2335
+					$statuswheres[] = "({$wpdb->posts}.post_author = $user_id "."AND (".join(' OR ', $p_status)."))";
2336 2336
 				} else {
2337
-					$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
2337
+					$statuswheres[] = "(".join(' OR ', $p_status).")";
2338 2338
 				}
2339 2339
 			}
2340
-			if ( $post_status_join ) {
2340
+			if ($post_status_join) {
2341 2341
 				$join .= " LEFT JOIN {$wpdb->posts} AS p2 ON ({$wpdb->posts}.post_parent = p2.ID) ";
2342
-				foreach ( $statuswheres as $index => $statuswhere ) {
2343
-					$statuswheres[$index] = "($statuswhere OR ({$wpdb->posts}.post_status = 'inherit' AND " . str_replace( $wpdb->posts, 'p2', $statuswhere ) . "))";
2342
+				foreach ($statuswheres as $index => $statuswhere) {
2343
+					$statuswheres[$index] = "($statuswhere OR ({$wpdb->posts}.post_status = 'inherit' AND ".str_replace($wpdb->posts, 'p2', $statuswhere)."))";
2344 2344
 				}
2345 2345
 			}
2346
-			$where_status = implode( ' OR ', $statuswheres );
2347
-			if ( ! empty( $where_status ) ) {
2346
+			$where_status = implode(' OR ', $statuswheres);
2347
+			if ( ! empty($where_status)) {
2348 2348
 				$where .= " AND ($where_status)";
2349 2349
 			}
2350
-		} elseif ( !$this->is_singular ) {
2350
+		} elseif ( ! $this->is_singular) {
2351 2351
 			$where .= " AND ({$wpdb->posts}.post_status = 'publish'";
2352 2352
 
2353 2353
 			// Add public states.
2354
-			$public_states = get_post_stati( array('public' => true) );
2355
-			foreach ( (array) $public_states as $state ) {
2356
-				if ( 'publish' == $state ) // Publish is hard-coded above.
2354
+			$public_states = get_post_stati(array('public' => true));
2355
+			foreach ((array) $public_states as $state) {
2356
+				if ('publish' == $state) // Publish is hard-coded above.
2357 2357
 					continue;
2358 2358
 				$where .= " OR {$wpdb->posts}.post_status = '$state'";
2359 2359
 			}
2360 2360
 
2361
-			if ( $this->is_admin ) {
2361
+			if ($this->is_admin) {
2362 2362
 				// Add protected states that should show in the admin all list.
2363
-				$admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
2364
-				foreach ( (array) $admin_all_states as $state ) {
2363
+				$admin_all_states = get_post_stati(array('protected' => true, 'show_in_admin_all_list' => true));
2364
+				foreach ((array) $admin_all_states as $state) {
2365 2365
 					$where .= " OR {$wpdb->posts}.post_status = '$state'";
2366 2366
 				}
2367 2367
 			}
2368 2368
 
2369
-			if ( is_user_logged_in() ) {
2369
+			if (is_user_logged_in()) {
2370 2370
 				// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
2371
-				$private_states = get_post_stati( array('private' => true) );
2372
-				foreach ( (array) $private_states as $state ) {
2373
-					$where .= current_user_can( $read_private_cap ) ? " OR {$wpdb->posts}.post_status = '$state'" : " OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'";
2371
+				$private_states = get_post_stati(array('private' => true));
2372
+				foreach ((array) $private_states as $state) {
2373
+					$where .= current_user_can($read_private_cap) ? " OR {$wpdb->posts}.post_status = '$state'" : " OR {$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$state'";
2374 2374
 				}
2375 2375
 			}
2376 2376
 
@@ -2381,7 +2381,7 @@  discard block
 block discarded – undo
2381 2381
 		 * Apply filters on where and join prior to paging so that any
2382 2382
 		 * manipulations to them are reflected in the paging by day queries.
2383 2383
 		 */
2384
-		if ( !$q['suppress_filters'] ) {
2384
+		if ( ! $q['suppress_filters']) {
2385 2385
 			/**
2386 2386
 			 * Filters the WHERE clause of the query.
2387 2387
 			 *
@@ -2390,7 +2390,7 @@  discard block
 block discarded – undo
2390 2390
 			 * @param string   $where The WHERE clause of the query.
2391 2391
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2392 2392
 			 */
2393
-			$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
2393
+			$where = apply_filters_ref_array('posts_where', array($where, &$this));
2394 2394
 
2395 2395
 			/**
2396 2396
 			 * Filters the JOIN clause of the query.
@@ -2400,28 +2400,28 @@  discard block
 block discarded – undo
2400 2400
 			 * @param string   $where The JOIN clause of the query.
2401 2401
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2402 2402
 			 */
2403
-			$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
2403
+			$join = apply_filters_ref_array('posts_join', array($join, &$this));
2404 2404
 		}
2405 2405
 
2406 2406
 		// Paging
2407
-		if ( empty($q['nopaging']) && !$this->is_singular ) {
2407
+		if (empty($q['nopaging']) && ! $this->is_singular) {
2408 2408
 			$page = absint($q['paged']);
2409
-			if ( !$page )
2409
+			if ( ! $page)
2410 2410
 				$page = 1;
2411 2411
 
2412 2412
 			// If 'offset' is provided, it takes precedence over 'paged'.
2413
-			if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
2414
-				$q['offset'] = absint( $q['offset'] );
2415
-				$pgstrt = $q['offset'] . ', ';
2413
+			if (isset($q['offset']) && is_numeric($q['offset'])) {
2414
+				$q['offset'] = absint($q['offset']);
2415
+				$pgstrt = $q['offset'].', ';
2416 2416
 			} else {
2417
-				$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
2417
+				$pgstrt = absint(($page - 1) * $q['posts_per_page']).', ';
2418 2418
 			}
2419
-			$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
2419
+			$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
2420 2420
 		}
2421 2421
 
2422 2422
 		// Comments feeds
2423
-		if ( $this->is_comment_feed && ! $this->is_singular ) {
2424
-			if ( $this->is_archive || $this->is_search ) {
2423
+		if ($this->is_comment_feed && ! $this->is_singular) {
2424
+			if ($this->is_archive || $this->is_search) {
2425 2425
 				$cjoin = "JOIN {$wpdb->posts} ON ({$wpdb->comments}.comment_post_ID = {$wpdb->posts}.ID) $join ";
2426 2426
 				$cwhere = "WHERE comment_approved = '1' $where";
2427 2427
 				$cgroupby = "{$wpdb->comments}.comment_id";
@@ -2431,7 +2431,7 @@  discard block
 block discarded – undo
2431 2431
 				$cgroupby = '';
2432 2432
 			}
2433 2433
 
2434
-			if ( !$q['suppress_filters'] ) {
2434
+			if ( ! $q['suppress_filters']) {
2435 2435
 				/**
2436 2436
 				 * Filters the JOIN clause of the comments feed query before sending.
2437 2437
 				 *
@@ -2440,7 +2440,7 @@  discard block
 block discarded – undo
2440 2440
 				 * @param string   $cjoin The JOIN clause of the query.
2441 2441
 				 * @param WP_Query &$this The WP_Query instance (passed by reference).
2442 2442
 				 */
2443
-				$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
2443
+				$cjoin = apply_filters_ref_array('comment_feed_join', array($cjoin, &$this));
2444 2444
 
2445 2445
 				/**
2446 2446
 				 * Filters the WHERE clause of the comments feed query before sending.
@@ -2450,7 +2450,7 @@  discard block
 block discarded – undo
2450 2450
 				 * @param string   $cwhere The WHERE clause of the query.
2451 2451
 				 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2452 2452
 				 */
2453
-				$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
2453
+				$cwhere = apply_filters_ref_array('comment_feed_where', array($cwhere, &$this));
2454 2454
 
2455 2455
 				/**
2456 2456
 				 * Filters the GROUP BY clause of the comments feed query before sending.
@@ -2460,7 +2460,7 @@  discard block
 block discarded – undo
2460 2460
 				 * @param string   $cgroupby The GROUP BY clause of the query.
2461 2461
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
2462 2462
 				 */
2463
-				$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
2463
+				$cgroupby = apply_filters_ref_array('comment_feed_groupby', array($cgroupby, &$this));
2464 2464
 
2465 2465
 				/**
2466 2466
 				 * Filters the ORDER BY clause of the comments feed query before sending.
@@ -2470,7 +2470,7 @@  discard block
 block discarded – undo
2470 2470
 				 * @param string   $corderby The ORDER BY clause of the query.
2471 2471
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
2472 2472
 				 */
2473
-				$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
2473
+				$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
2474 2474
 
2475 2475
 				/**
2476 2476
 				 * Filters the LIMIT clause of the comments feed query before sending.
@@ -2480,37 +2480,37 @@  discard block
 block discarded – undo
2480 2480
 				 * @param string   $climits The JOIN clause of the query.
2481 2481
 				 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2482 2482
 				 */
2483
-				$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
2483
+				$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
2484 2484
 			}
2485
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
2486
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
2485
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
2486
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
2487 2487
 
2488 2488
 			$comments = (array) $wpdb->get_results("SELECT $distinct {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits");
2489 2489
 			// Convert to WP_Comment
2490
-			$this->comments = array_map( 'get_comment', $comments );
2490
+			$this->comments = array_map('get_comment', $comments);
2491 2491
 			$this->comment_count = count($this->comments);
2492 2492
 
2493 2493
 			$post_ids = array();
2494 2494
 
2495
-			foreach ( $this->comments as $comment )
2495
+			foreach ($this->comments as $comment)
2496 2496
 				$post_ids[] = (int) $comment->comment_post_ID;
2497 2497
 
2498 2498
 			$post_ids = join(',', $post_ids);
2499 2499
 			$join = '';
2500
-			if ( $post_ids ) {
2500
+			if ($post_ids) {
2501 2501
 				$where = "AND {$wpdb->posts}.ID IN ($post_ids) ";
2502 2502
 			} else {
2503 2503
 				$where = "AND 0";
2504 2504
 			}
2505 2505
 		}
2506 2506
 
2507
-		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
2507
+		$pieces = array('where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits');
2508 2508
 
2509 2509
 		/*
2510 2510
 		 * Apply post-paging filters on where and join. Only plugins that
2511 2511
 		 * manipulate paging queries should use these hooks.
2512 2512
 		 */
2513
-		if ( !$q['suppress_filters'] ) {
2513
+		if ( ! $q['suppress_filters']) {
2514 2514
 			/**
2515 2515
 			 * Filters the WHERE clause of the query.
2516 2516
 			 *
@@ -2521,7 +2521,7 @@  discard block
 block discarded – undo
2521 2521
 			 * @param string   $where The WHERE clause of the query.
2522 2522
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2523 2523
 			 */
2524
-			$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
2524
+			$where = apply_filters_ref_array('posts_where_paged', array($where, &$this));
2525 2525
 
2526 2526
 			/**
2527 2527
 			 * Filters the GROUP BY clause of the query.
@@ -2531,7 +2531,7 @@  discard block
 block discarded – undo
2531 2531
 			 * @param string   $groupby The GROUP BY clause of the query.
2532 2532
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2533 2533
 			 */
2534
-			$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );
2534
+			$groupby = apply_filters_ref_array('posts_groupby', array($groupby, &$this));
2535 2535
 
2536 2536
 			/**
2537 2537
 			 * Filters the JOIN clause of the query.
@@ -2543,7 +2543,7 @@  discard block
 block discarded – undo
2543 2543
 			 * @param string   $join  The JOIN clause of the query.
2544 2544
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2545 2545
 			 */
2546
-			$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );
2546
+			$join = apply_filters_ref_array('posts_join_paged', array($join, &$this));
2547 2547
 
2548 2548
 			/**
2549 2549
 			 * Filters the ORDER BY clause of the query.
@@ -2553,7 +2553,7 @@  discard block
 block discarded – undo
2553 2553
 			 * @param string   $orderby The ORDER BY clause of the query.
2554 2554
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2555 2555
 			 */
2556
-			$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );
2556
+			$orderby = apply_filters_ref_array('posts_orderby', array($orderby, &$this));
2557 2557
 
2558 2558
 			/**
2559 2559
 			 * Filters the DISTINCT clause of the query.
@@ -2563,7 +2563,7 @@  discard block
 block discarded – undo
2563 2563
 			 * @param string   $distinct The DISTINCT clause of the query.
2564 2564
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
2565 2565
 			 */
2566
-			$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );
2566
+			$distinct = apply_filters_ref_array('posts_distinct', array($distinct, &$this));
2567 2567
 
2568 2568
 			/**
2569 2569
 			 * Filters the LIMIT clause of the query.
@@ -2573,7 +2573,7 @@  discard block
 block discarded – undo
2573 2573
 			 * @param string   $limits The LIMIT clause of the query.
2574 2574
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2575 2575
 			 */
2576
-			$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
2576
+			$limits = apply_filters_ref_array('post_limits', array($limits, &$this));
2577 2577
 
2578 2578
 			/**
2579 2579
 			 * Filters the SELECT clause of the query.
@@ -2583,7 +2583,7 @@  discard block
 block discarded – undo
2583 2583
 			 * @param string   $fields The SELECT clause of the query.
2584 2584
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2585 2585
 			 */
2586
-			$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
2586
+			$fields = apply_filters_ref_array('posts_fields', array($fields, &$this));
2587 2587
 
2588 2588
 			/**
2589 2589
 			 * Filters all query clauses at once, for convenience.
@@ -2596,15 +2596,15 @@  discard block
 block discarded – undo
2596 2596
 			 * @param array    $clauses The list of clauses for the query.
2597 2597
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2598 2598
 			 */
2599
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
2600
-
2601
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
2602
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
2603
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
2604
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
2605
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
2606
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
2607
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
2599
+			$clauses = (array) apply_filters_ref_array('posts_clauses', array(compact($pieces), &$this));
2600
+
2601
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
2602
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
2603
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
2604
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
2605
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
2606
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
2607
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
2608 2608
 		}
2609 2609
 
2610 2610
 		/**
@@ -2616,13 +2616,13 @@  discard block
 block discarded – undo
2616 2616
 		 *
2617 2617
 		 * @param string $selection The assembled selection query.
2618 2618
 		 */
2619
-		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
2619
+		do_action('posts_selection', $where.$groupby.$orderby.$limits.$join);
2620 2620
 
2621 2621
 		/*
2622 2622
 		 * Filters again for the benefit of caching plugins.
2623 2623
 		 * Regular plugins should use the hooks above.
2624 2624
 		 */
2625
-		if ( !$q['suppress_filters'] ) {
2625
+		if ( ! $q['suppress_filters']) {
2626 2626
 			/**
2627 2627
 			 * Filters the WHERE clause of the query.
2628 2628
 			 *
@@ -2633,7 +2633,7 @@  discard block
 block discarded – undo
2633 2633
 			 * @param string   $where The WHERE clause of the query.
2634 2634
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2635 2635
 			 */
2636
-			$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );
2636
+			$where = apply_filters_ref_array('posts_where_request', array($where, &$this));
2637 2637
 
2638 2638
 			/**
2639 2639
 			 * Filters the GROUP BY clause of the query.
@@ -2645,7 +2645,7 @@  discard block
 block discarded – undo
2645 2645
 			 * @param string   $groupby The GROUP BY clause of the query.
2646 2646
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2647 2647
 			 */
2648
-			$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );
2648
+			$groupby = apply_filters_ref_array('posts_groupby_request', array($groupby, &$this));
2649 2649
 
2650 2650
 			/**
2651 2651
 			 * Filters the JOIN clause of the query.
@@ -2657,7 +2657,7 @@  discard block
 block discarded – undo
2657 2657
 			 * @param string   $join  The JOIN clause of the query.
2658 2658
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2659 2659
 			 */
2660
-			$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );
2660
+			$join = apply_filters_ref_array('posts_join_request', array($join, &$this));
2661 2661
 
2662 2662
 			/**
2663 2663
 			 * Filters the ORDER BY clause of the query.
@@ -2669,7 +2669,7 @@  discard block
 block discarded – undo
2669 2669
 			 * @param string   $orderby The ORDER BY clause of the query.
2670 2670
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2671 2671
 			 */
2672
-			$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );
2672
+			$orderby = apply_filters_ref_array('posts_orderby_request', array($orderby, &$this));
2673 2673
 
2674 2674
 			/**
2675 2675
 			 * Filters the DISTINCT clause of the query.
@@ -2681,7 +2681,7 @@  discard block
 block discarded – undo
2681 2681
 			 * @param string   $distinct The DISTINCT clause of the query.
2682 2682
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
2683 2683
 			 */
2684
-			$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
2684
+			$distinct = apply_filters_ref_array('posts_distinct_request', array($distinct, &$this));
2685 2685
 
2686 2686
 			/**
2687 2687
 			 * Filters the SELECT clause of the query.
@@ -2693,7 +2693,7 @@  discard block
 block discarded – undo
2693 2693
 			 * @param string   $fields The SELECT clause of the query.
2694 2694
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2695 2695
 			 */
2696
-			$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );
2696
+			$fields = apply_filters_ref_array('posts_fields_request', array($fields, &$this));
2697 2697
 
2698 2698
 			/**
2699 2699
 			 * Filters the LIMIT clause of the query.
@@ -2705,7 +2705,7 @@  discard block
 block discarded – undo
2705 2705
 			 * @param string   $limits The LIMIT clause of the query.
2706 2706
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2707 2707
 			 */
2708
-			$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
2708
+			$limits = apply_filters_ref_array('post_limits_request', array($limits, &$this));
2709 2709
 
2710 2710
 			/**
2711 2711
 			 * Filters all query clauses at once, for convenience.
@@ -2720,29 +2720,29 @@  discard block
 block discarded – undo
2720 2720
 			 * @param array    $pieces The pieces of the query.
2721 2721
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
2722 2722
 			 */
2723
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
2724
-
2725
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
2726
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
2727
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
2728
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
2729
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
2730
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
2731
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
2723
+			$clauses = (array) apply_filters_ref_array('posts_clauses_request', array(compact($pieces), &$this));
2724
+
2725
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
2726
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
2727
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
2728
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
2729
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
2730
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
2731
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
2732 2732
 		}
2733 2733
 
2734
-		if ( ! empty($groupby) )
2735
-			$groupby = 'GROUP BY ' . $groupby;
2736
-		if ( !empty( $orderby ) )
2737
-			$orderby = 'ORDER BY ' . $orderby;
2734
+		if ( ! empty($groupby))
2735
+			$groupby = 'GROUP BY '.$groupby;
2736
+		if ( ! empty($orderby))
2737
+			$orderby = 'ORDER BY '.$orderby;
2738 2738
 
2739 2739
 		$found_rows = '';
2740
-		if ( !$q['no_found_rows'] && !empty($limits) )
2740
+		if ( ! $q['no_found_rows'] && ! empty($limits))
2741 2741
 			$found_rows = 'SQL_CALC_FOUND_ROWS';
2742 2742
 
2743 2743
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits";
2744 2744
 
2745
-		if ( !$q['suppress_filters'] ) {
2745
+		if ( ! $q['suppress_filters']) {
2746 2746
 			/**
2747 2747
 			 * Filters the completed SQL query before sending.
2748 2748
 			 *
@@ -2751,7 +2751,7 @@  discard block
 block discarded – undo
2751 2751
 			 * @param string   $request The complete SQL query.
2752 2752
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
2753 2753
 			 */
2754
-			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
2754
+			$this->request = apply_filters_ref_array('posts_request', array($this->request, &$this));
2755 2755
 		}
2756 2756
 
2757 2757
 		/**
@@ -2770,41 +2770,41 @@  discard block
 block discarded – undo
2770 2770
 		 *                          or null to allow WP to run its normal queries.
2771 2771
 		 * @param WP_Query   $this  The WP_Query instance, passed by reference.
2772 2772
 		 */
2773
-		$this->posts = apply_filters_ref_array( 'posts_pre_query', array( null, &$this ) );
2773
+		$this->posts = apply_filters_ref_array('posts_pre_query', array(null, &$this));
2774 2774
 
2775
-		if ( 'ids' == $q['fields'] ) {
2776
-			if ( null === $this->posts ) {
2777
-				$this->posts = $wpdb->get_col( $this->request );
2775
+		if ('ids' == $q['fields']) {
2776
+			if (null === $this->posts) {
2777
+				$this->posts = $wpdb->get_col($this->request);
2778 2778
 			}
2779 2779
 
2780
-			$this->posts = array_map( 'intval', $this->posts );
2781
-			$this->post_count = count( $this->posts );
2782
-			$this->set_found_posts( $q, $limits );
2780
+			$this->posts = array_map('intval', $this->posts);
2781
+			$this->post_count = count($this->posts);
2782
+			$this->set_found_posts($q, $limits);
2783 2783
 
2784 2784
 			return $this->posts;
2785 2785
 		}
2786 2786
 
2787
-		if ( 'id=>parent' == $q['fields'] ) {
2788
-			if ( null === $this->posts ) {
2789
-				$this->posts = $wpdb->get_results( $this->request );
2787
+		if ('id=>parent' == $q['fields']) {
2788
+			if (null === $this->posts) {
2789
+				$this->posts = $wpdb->get_results($this->request);
2790 2790
 			}
2791 2791
 
2792
-			$this->post_count = count( $this->posts );
2793
-			$this->set_found_posts( $q, $limits );
2792
+			$this->post_count = count($this->posts);
2793
+			$this->set_found_posts($q, $limits);
2794 2794
 
2795 2795
 			$r = array();
2796
-			foreach ( $this->posts as $key => $post ) {
2797
-				$this->posts[ $key ]->ID = (int) $post->ID;
2798
-				$this->posts[ $key ]->post_parent = (int) $post->post_parent;
2796
+			foreach ($this->posts as $key => $post) {
2797
+				$this->posts[$key]->ID = (int) $post->ID;
2798
+				$this->posts[$key]->post_parent = (int) $post->post_parent;
2799 2799
 
2800
-				$r[ (int) $post->ID ] = (int) $post->post_parent;
2800
+				$r[(int) $post->ID] = (int) $post->post_parent;
2801 2801
 			}
2802 2802
 
2803 2803
 			return $r;
2804 2804
 		}
2805 2805
 
2806
-		if ( null === $this->posts ) {
2807
-			$split_the_query = ( $old_request == $this->request && "{$wpdb->posts}.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
2806
+		if (null === $this->posts) {
2807
+			$split_the_query = ($old_request == $this->request && "{$wpdb->posts}.*" == $fields && ! empty($limits) && $q['posts_per_page'] < 500);
2808 2808
 
2809 2809
 			/**
2810 2810
 			 * Filters whether to split the query.
@@ -2818,9 +2818,9 @@  discard block
 block discarded – undo
2818 2818
 			 * @param bool     $split_the_query Whether or not to split the query.
2819 2819
 			 * @param WP_Query $this            The WP_Query instance.
2820 2820
 			 */
2821
-			$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
2821
+			$split_the_query = apply_filters('split_the_query', $split_the_query, $this);
2822 2822
 
2823
-			if ( $split_the_query ) {
2823
+			if ($split_the_query) {
2824 2824
 				// First get the IDs and then fill in the objects
2825 2825
 
2826 2826
 				$this->request = "SELECT $found_rows $distinct {$wpdb->posts}.ID FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits";
@@ -2833,29 +2833,29 @@  discard block
 block discarded – undo
2833 2833
 				 * @param string   $request The post ID request.
2834 2834
 				 * @param WP_Query $this    The WP_Query instance.
2835 2835
 				 */
2836
-				$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
2836
+				$this->request = apply_filters('posts_request_ids', $this->request, $this);
2837 2837
 
2838
-				$ids = $wpdb->get_col( $this->request );
2838
+				$ids = $wpdb->get_col($this->request);
2839 2839
 
2840
-				if ( $ids ) {
2840
+				if ($ids) {
2841 2841
 					$this->posts = $ids;
2842
-					$this->set_found_posts( $q, $limits );
2843
-					_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
2842
+					$this->set_found_posts($q, $limits);
2843
+					_prime_post_caches($ids, $q['update_post_term_cache'], $q['update_post_meta_cache']);
2844 2844
 				} else {
2845 2845
 					$this->posts = array();
2846 2846
 				}
2847 2847
 			} else {
2848
-				$this->posts = $wpdb->get_results( $this->request );
2849
-				$this->set_found_posts( $q, $limits );
2848
+				$this->posts = $wpdb->get_results($this->request);
2849
+				$this->set_found_posts($q, $limits);
2850 2850
 			}
2851 2851
 		}
2852 2852
 
2853 2853
 		// Convert to WP_Post objects.
2854
-		if ( $this->posts ) {
2855
-			$this->posts = array_map( 'get_post', $this->posts );
2854
+		if ($this->posts) {
2855
+			$this->posts = array_map('get_post', $this->posts);
2856 2856
 		}
2857 2857
 
2858
-		if ( ! $q['suppress_filters'] ) {
2858
+		if ( ! $q['suppress_filters']) {
2859 2859
 			/**
2860 2860
 			 * Filters the raw post results array, prior to status checks.
2861 2861
 			 *
@@ -2864,38 +2864,38 @@  discard block
 block discarded – undo
2864 2864
 			 * @param array    $posts The post results array.
2865 2865
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2866 2866
 			 */
2867
-			$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );
2867
+			$this->posts = apply_filters_ref_array('posts_results', array($this->posts, &$this));
2868 2868
 		}
2869 2869
 
2870
-		if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
2870
+		if ( ! empty($this->posts) && $this->is_comment_feed && $this->is_singular) {
2871 2871
 			/** This filter is documented in wp-includes/query.php */
2872
-			$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
2872
+			$cjoin = apply_filters_ref_array('comment_feed_join', array('', &$this));
2873 2873
 
2874 2874
 			/** This filter is documented in wp-includes/query.php */
2875
-			$cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
2875
+			$cwhere = apply_filters_ref_array('comment_feed_where', array("WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this));
2876 2876
 
2877 2877
 			/** This filter is documented in wp-includes/query.php */
2878
-			$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
2879
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
2878
+			$cgroupby = apply_filters_ref_array('comment_feed_groupby', array('', &$this));
2879
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
2880 2880
 
2881 2881
 			/** This filter is documented in wp-includes/query.php */
2882
-			$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
2883
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
2882
+			$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
2883
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
2884 2884
 
2885 2885
 			/** This filter is documented in wp-includes/query.php */
2886
-			$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
2886
+			$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
2887 2887
 
2888 2888
 			$comments_request = "SELECT {$wpdb->comments}.* FROM {$wpdb->comments} $cjoin $cwhere $cgroupby $corderby $climits";
2889 2889
 			$comments = $wpdb->get_results($comments_request);
2890 2890
 			// Convert to WP_Comment
2891
-			$this->comments = array_map( 'get_comment', $comments );
2891
+			$this->comments = array_map('get_comment', $comments);
2892 2892
 			$this->comment_count = count($this->comments);
2893 2893
 		}
2894 2894
 
2895 2895
 		// Check post status to determine if post should be displayed.
2896
-		if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
2896
+		if ( ! empty($this->posts) && ($this->is_single || $this->is_page)) {
2897 2897
 			$status = get_post_status($this->posts[0]);
2898
-			if ( 'attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent ) {
2898
+			if ('attachment' === $this->posts[0]->post_type && 0 === (int) $this->posts[0]->post_parent) {
2899 2899
 				$this->is_page = false;
2900 2900
 				$this->is_single = true;
2901 2901
 				$this->is_attachment = true;
@@ -2903,23 +2903,23 @@  discard block
 block discarded – undo
2903 2903
 			$post_status_obj = get_post_status_object($status);
2904 2904
 
2905 2905
 			// If the post_status was specifically requested, let it pass through.
2906
-			if ( !$post_status_obj->public && ! in_array( $status, $q_status ) ) {
2906
+			if ( ! $post_status_obj->public && ! in_array($status, $q_status)) {
2907 2907
 
2908
-				if ( ! is_user_logged_in() ) {
2908
+				if ( ! is_user_logged_in()) {
2909 2909
 					// User must be logged in to view unpublished posts.
2910 2910
 					$this->posts = array();
2911 2911
 				} else {
2912
-					if  ( $post_status_obj->protected ) {
2912
+					if ($post_status_obj->protected) {
2913 2913
 						// User must have edit permissions on the draft to preview.
2914
-						if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) {
2914
+						if ( ! current_user_can($edit_cap, $this->posts[0]->ID)) {
2915 2915
 							$this->posts = array();
2916 2916
 						} else {
2917 2917
 							$this->is_preview = true;
2918
-							if ( 'future' != $status )
2918
+							if ('future' != $status)
2919 2919
 								$this->posts[0]->post_date = current_time('mysql');
2920 2920
 						}
2921
-					} elseif ( $post_status_obj->private ) {
2922
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
2921
+					} elseif ($post_status_obj->private) {
2922
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID))
2923 2923
 							$this->posts = array();
2924 2924
 					} else {
2925 2925
 						$this->posts = array();
@@ -2927,7 +2927,7 @@  discard block
 block discarded – undo
2927 2927
 				}
2928 2928
 			}
2929 2929
 
2930
-			if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {
2930
+			if ($this->is_preview && $this->posts && current_user_can($edit_cap, $this->posts[0]->ID)) {
2931 2931
 				/**
2932 2932
 				 * Filters the single post for preview mode.
2933 2933
 				 *
@@ -2936,18 +2936,18 @@  discard block
 block discarded – undo
2936 2936
 				 * @param WP_Post  $post_preview  The Post object.
2937 2937
 				 * @param WP_Query &$this         The WP_Query instance (passed by reference).
2938 2938
 				 */
2939
-				$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );
2939
+				$this->posts[0] = get_post(apply_filters_ref_array('the_preview', array($this->posts[0], &$this)));
2940 2940
 			}
2941 2941
 		}
2942 2942
 
2943 2943
 		// Put sticky posts at the top of the posts array
2944 2944
 		$sticky_posts = get_option('sticky_posts');
2945
-		if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
2945
+		if ($this->is_home && $page <= 1 && is_array($sticky_posts) && ! empty($sticky_posts) && ! $q['ignore_sticky_posts']) {
2946 2946
 			$num_posts = count($this->posts);
2947 2947
 			$sticky_offset = 0;
2948 2948
 			// Loop over posts and relocate stickies to the front.
2949
-			for ( $i = 0; $i < $num_posts; $i++ ) {
2950
-				if ( in_array($this->posts[$i]->ID, $sticky_posts) ) {
2949
+			for ($i = 0; $i < $num_posts; $i++) {
2950
+				if (in_array($this->posts[$i]->ID, $sticky_posts)) {
2951 2951
 					$sticky_post = $this->posts[$i];
2952 2952
 					// Remove sticky from current position
2953 2953
 					array_splice($this->posts, $i, 1);
@@ -2957,36 +2957,36 @@  discard block
 block discarded – undo
2957 2957
 					$sticky_offset++;
2958 2958
 					// Remove post from sticky posts array
2959 2959
 					$offset = array_search($sticky_post->ID, $sticky_posts);
2960
-					unset( $sticky_posts[$offset] );
2960
+					unset($sticky_posts[$offset]);
2961 2961
 				}
2962 2962
 			}
2963 2963
 
2964 2964
 			// If any posts have been excluded specifically, Ignore those that are sticky.
2965
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
2965
+			if ( ! empty($sticky_posts) && ! empty($q['post__not_in']))
2966 2966
 				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
2967 2967
 
2968 2968
 			// Fetch sticky posts that weren't in the query results
2969
-			if ( !empty($sticky_posts) ) {
2970
-				$stickies = get_posts( array(
2969
+			if ( ! empty($sticky_posts)) {
2970
+				$stickies = get_posts(array(
2971 2971
 					'post__in' => $sticky_posts,
2972 2972
 					'post_type' => $post_type,
2973 2973
 					'post_status' => 'publish',
2974 2974
 					'nopaging' => true
2975
-				) );
2975
+				));
2976 2976
 
2977
-				foreach ( $stickies as $sticky_post ) {
2978
-					array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
2977
+				foreach ($stickies as $sticky_post) {
2978
+					array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
2979 2979
 					$sticky_offset++;
2980 2980
 				}
2981 2981
 			}
2982 2982
 		}
2983 2983
 
2984 2984
 		// If comments have been fetched as part of the query, make sure comment meta lazy-loading is set up.
2985
-		if ( ! empty( $this->comments ) ) {
2986
-			wp_queue_comments_for_comment_meta_lazyload( $this->comments );
2985
+		if ( ! empty($this->comments)) {
2986
+			wp_queue_comments_for_comment_meta_lazyload($this->comments);
2987 2987
 		}
2988 2988
 
2989
-		if ( ! $q['suppress_filters'] ) {
2989
+		if ( ! $q['suppress_filters']) {
2990 2990
 			/**
2991 2991
 			 * Filters the array of retrieved posts after they've been fetched and
2992 2992
 			 * internally processed.
@@ -2996,27 +2996,27 @@  discard block
 block discarded – undo
2996 2996
 			 * @param array    $posts The array of retrieved posts.
2997 2997
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
2998 2998
 			 */
2999
-			$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
2999
+			$this->posts = apply_filters_ref_array('the_posts', array($this->posts, &$this));
3000 3000
 		}
3001 3001
 
3002 3002
 		// Ensure that any posts added/modified via one of the filters above are
3003 3003
 		// of the type WP_Post and are filtered.
3004
-		if ( $this->posts ) {
3005
-			$this->post_count = count( $this->posts );
3004
+		if ($this->posts) {
3005
+			$this->post_count = count($this->posts);
3006 3006
 
3007
-			$this->posts = array_map( 'get_post', $this->posts );
3007
+			$this->posts = array_map('get_post', $this->posts);
3008 3008
 
3009
-			if ( $q['cache_results'] )
3009
+			if ($q['cache_results'])
3010 3010
 				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3011 3011
 
3012
-			$this->post = reset( $this->posts );
3012
+			$this->post = reset($this->posts);
3013 3013
 		} else {
3014 3014
 			$this->post_count = 0;
3015 3015
 			$this->posts = array();
3016 3016
 		}
3017 3017
 
3018
-		if ( $q['lazy_load_term_meta'] ) {
3019
-			wp_queue_posts_for_term_meta_lazyload( $this->posts );
3018
+		if ($q['lazy_load_term_meta']) {
3019
+			wp_queue_posts_for_term_meta_lazyload($this->posts);
3020 3020
 		}
3021 3021
 
3022 3022
 		return $this->posts;
@@ -3032,14 +3032,14 @@  discard block
 block discarded – undo
3032 3032
 	 * @param array  $q      Query variables.
3033 3033
 	 * @param string $limits LIMIT clauses of the query.
3034 3034
 	 */
3035
-	private function set_found_posts( $q, $limits ) {
3035
+	private function set_found_posts($q, $limits) {
3036 3036
 		global $wpdb;
3037 3037
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3038 3038
 		// null, or false to accommodate caching plugins that fill posts later.
3039
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3039
+		if ($q['no_found_rows'] || (is_array($this->posts) && ! $this->posts))
3040 3040
 			return;
3041 3041
 
3042
-		if ( ! empty( $limits ) ) {
3042
+		if ( ! empty($limits)) {
3043 3043
 			/**
3044 3044
 			 * Filters the query to run for retrieving the found posts.
3045 3045
 			 *
@@ -3048,9 +3048,9 @@  discard block
 block discarded – undo
3048 3048
 			 * @param string   $found_posts The query to run to find the found posts.
3049 3049
 			 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3050 3050
 			 */
3051
-			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
3051
+			$this->found_posts = $wpdb->get_var(apply_filters_ref_array('found_posts_query', array('SELECT FOUND_ROWS()', &$this)));
3052 3052
 		} else {
3053
-			$this->found_posts = count( $this->posts );
3053
+			$this->found_posts = count($this->posts);
3054 3054
 		}
3055 3055
 
3056 3056
 		/**
@@ -3061,10 +3061,10 @@  discard block
 block discarded – undo
3061 3061
 		 * @param int      $found_posts The number of posts found.
3062 3062
 		 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3063 3063
 		 */
3064
-		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3064
+		$this->found_posts = apply_filters_ref_array('found_posts', array($this->found_posts, &$this));
3065 3065
 
3066
-		if ( ! empty( $limits ) )
3067
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3066
+		if ( ! empty($limits))
3067
+			$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
3068 3068
 	}
3069 3069
 
3070 3070
 	/**
@@ -3098,7 +3098,7 @@  discard block
 block discarded – undo
3098 3098
 		global $post;
3099 3099
 		$this->in_the_loop = true;
3100 3100
 
3101
-		if ( $this->current_post == -1 ) // loop has just started
3101
+		if ($this->current_post == -1) // loop has just started
3102 3102
 			/**
3103 3103
 			 * Fires once the loop is started.
3104 3104
 			 *
@@ -3106,10 +3106,10 @@  discard block
 block discarded – undo
3106 3106
 			 *
3107 3107
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3108 3108
 			 */
3109
-			do_action_ref_array( 'loop_start', array( &$this ) );
3109
+			do_action_ref_array('loop_start', array(&$this));
3110 3110
 
3111 3111
 		$post = $this->next_post();
3112
-		$this->setup_postdata( $post );
3112
+		$this->setup_postdata($post);
3113 3113
 	}
3114 3114
 
3115 3115
 	/**
@@ -3123,9 +3123,9 @@  discard block
 block discarded – undo
3123 3123
 	 * @return bool True if posts are available, false if end of loop.
3124 3124
 	 */
3125 3125
 	public function have_posts() {
3126
-		if ( $this->current_post + 1 < $this->post_count ) {
3126
+		if ($this->current_post + 1 < $this->post_count) {
3127 3127
 			return true;
3128
-		} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
3128
+		} elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
3129 3129
 			/**
3130 3130
 			 * Fires once the loop has ended.
3131 3131
 			 *
@@ -3133,7 +3133,7 @@  discard block
 block discarded – undo
3133 3133
 			 *
3134 3134
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3135 3135
 			 */
3136
-			do_action_ref_array( 'loop_end', array( &$this ) );
3136
+			do_action_ref_array('loop_end', array(&$this));
3137 3137
 			// Do some cleaning up after the loop
3138 3138
 			$this->rewind_posts();
3139 3139
 		}
@@ -3150,7 +3150,7 @@  discard block
 block discarded – undo
3150 3150
 	 */
3151 3151
 	public function rewind_posts() {
3152 3152
 		$this->current_post = -1;
3153
-		if ( $this->post_count > 0 ) {
3153
+		if ($this->post_count > 0) {
3154 3154
 			$this->post = $this->posts[0];
3155 3155
 		}
3156 3156
 	}
@@ -3182,13 +3182,13 @@  discard block
 block discarded – undo
3182 3182
 
3183 3183
 		$comment = $this->next_comment();
3184 3184
 
3185
-		if ( $this->current_comment == 0 ) {
3185
+		if ($this->current_comment == 0) {
3186 3186
 			/**
3187 3187
 			 * Fires once the comment loop is started.
3188 3188
 			 *
3189 3189
 			 * @since 2.2.0
3190 3190
 			 */
3191
-			do_action( 'comment_loop_start' );
3191
+			do_action('comment_loop_start');
3192 3192
 		}
3193 3193
 	}
3194 3194
 
@@ -3203,9 +3203,9 @@  discard block
 block discarded – undo
3203 3203
 	 * @return bool True, if more comments. False, if no more posts.
3204 3204
 	 */
3205 3205
 	public function have_comments() {
3206
-		if ( $this->current_comment + 1 < $this->comment_count ) {
3206
+		if ($this->current_comment + 1 < $this->comment_count) {
3207 3207
 			return true;
3208
-		} elseif ( $this->current_comment + 1 == $this->comment_count ) {
3208
+		} elseif ($this->current_comment + 1 == $this->comment_count) {
3209 3209
 			$this->rewind_comments();
3210 3210
 		}
3211 3211
 
@@ -3220,7 +3220,7 @@  discard block
 block discarded – undo
3220 3220
 	 */
3221 3221
 	public function rewind_comments() {
3222 3222
 		$this->current_comment = -1;
3223
-		if ( $this->comment_count > 0 ) {
3223
+		if ($this->comment_count > 0) {
3224 3224
 			$this->comment = $this->comments[0];
3225 3225
 		}
3226 3226
 	}
@@ -3234,9 +3234,9 @@  discard block
 block discarded – undo
3234 3234
 	 * @param string|array $query URL query string or array of query arguments.
3235 3235
 	 * @return array List of posts.
3236 3236
 	 */
3237
-	public function query( $query ) {
3237
+	public function query($query) {
3238 3238
 		$this->init();
3239
-		$this->query = $this->query_vars = wp_parse_args( $query );
3239
+		$this->query = $this->query_vars = wp_parse_args($query);
3240 3240
 		return $this->get_posts();
3241 3241
 	}
3242 3242
 
@@ -3253,64 +3253,64 @@  discard block
 block discarded – undo
3253 3253
 	 * @return object
3254 3254
 	 */
3255 3255
 	public function get_queried_object() {
3256
-		if ( isset($this->queried_object) )
3256
+		if (isset($this->queried_object))
3257 3257
 			return $this->queried_object;
3258 3258
 
3259 3259
 		$this->queried_object = null;
3260 3260
 		$this->queried_object_id = null;
3261 3261
 
3262
-		if ( $this->is_category || $this->is_tag || $this->is_tax ) {
3263
-			if ( $this->is_category ) {
3264
-				if ( $this->get( 'cat' ) ) {
3265
-					$term = get_term( $this->get( 'cat' ), 'category' );
3266
-				} elseif ( $this->get( 'category_name' ) ) {
3267
-					$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );
3262
+		if ($this->is_category || $this->is_tag || $this->is_tax) {
3263
+			if ($this->is_category) {
3264
+				if ($this->get('cat')) {
3265
+					$term = get_term($this->get('cat'), 'category');
3266
+				} elseif ($this->get('category_name')) {
3267
+					$term = get_term_by('slug', $this->get('category_name'), 'category');
3268 3268
 				}
3269
-			} elseif ( $this->is_tag ) {
3270
-				if ( $this->get( 'tag_id' ) ) {
3271
-					$term = get_term( $this->get( 'tag_id' ), 'post_tag' );
3272
-				} elseif ( $this->get( 'tag' ) ) {
3273
-					$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
3269
+			} elseif ($this->is_tag) {
3270
+				if ($this->get('tag_id')) {
3271
+					$term = get_term($this->get('tag_id'), 'post_tag');
3272
+				} elseif ($this->get('tag')) {
3273
+					$term = get_term_by('slug', $this->get('tag'), 'post_tag');
3274 3274
 				}
3275 3275
 			} else {
3276 3276
 				// For other tax queries, grab the first term from the first clause.
3277
-				if ( ! empty( $this->tax_query->queried_terms ) ) {
3278
-					$queried_taxonomies = array_keys( $this->tax_query->queried_terms );
3279
-					$matched_taxonomy = reset( $queried_taxonomies );
3280
-					$query = $this->tax_query->queried_terms[ $matched_taxonomy ];
3281
-
3282
-					if ( ! empty( $query['terms'] ) ) {
3283
-						if ( 'term_id' == $query['field'] ) {
3284
-							$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
3277
+				if ( ! empty($this->tax_query->queried_terms)) {
3278
+					$queried_taxonomies = array_keys($this->tax_query->queried_terms);
3279
+					$matched_taxonomy = reset($queried_taxonomies);
3280
+					$query = $this->tax_query->queried_terms[$matched_taxonomy];
3281
+
3282
+					if ( ! empty($query['terms'])) {
3283
+						if ('term_id' == $query['field']) {
3284
+							$term = get_term(reset($query['terms']), $matched_taxonomy);
3285 3285
 						} else {
3286
-							$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
3286
+							$term = get_term_by($query['field'], reset($query['terms']), $matched_taxonomy);
3287 3287
 						}
3288 3288
 					}
3289 3289
 				}
3290 3290
 			}
3291 3291
 
3292
-			if ( ! empty( $term ) && ! is_wp_error( $term ) )  {
3292
+			if ( ! empty($term) && ! is_wp_error($term)) {
3293 3293
 				$this->queried_object = $term;
3294 3294
 				$this->queried_object_id = (int) $term->term_id;
3295 3295
 
3296
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
3297
-					_make_cat_compat( $this->queried_object );
3296
+				if ($this->is_category && 'category' === $this->queried_object->taxonomy)
3297
+					_make_cat_compat($this->queried_object);
3298 3298
 			}
3299
-		} elseif ( $this->is_post_type_archive ) {
3300
-			$post_type = $this->get( 'post_type' );
3301
-			if ( is_array( $post_type ) )
3302
-				$post_type = reset( $post_type );
3303
-			$this->queried_object = get_post_type_object( $post_type );
3304
-		} elseif ( $this->is_posts_page ) {
3299
+		} elseif ($this->is_post_type_archive) {
3300
+			$post_type = $this->get('post_type');
3301
+			if (is_array($post_type))
3302
+				$post_type = reset($post_type);
3303
+			$this->queried_object = get_post_type_object($post_type);
3304
+		} elseif ($this->is_posts_page) {
3305 3305
 			$page_for_posts = get_option('page_for_posts');
3306
-			$this->queried_object = get_post( $page_for_posts );
3306
+			$this->queried_object = get_post($page_for_posts);
3307 3307
 			$this->queried_object_id = (int) $this->queried_object->ID;
3308
-		} elseif ( $this->is_singular && ! empty( $this->post ) ) {
3308
+		} elseif ($this->is_singular && ! empty($this->post)) {
3309 3309
 			$this->queried_object = $this->post;
3310 3310
 			$this->queried_object_id = (int) $this->post->ID;
3311
-		} elseif ( $this->is_author ) {
3311
+		} elseif ($this->is_author) {
3312 3312
 			$this->queried_object_id = (int) $this->get('author');
3313
-			$this->queried_object = get_userdata( $this->queried_object_id );
3313
+			$this->queried_object = get_userdata($this->queried_object_id);
3314 3314
 		}
3315 3315
 
3316 3316
 		return $this->queried_object;
@@ -3327,7 +3327,7 @@  discard block
 block discarded – undo
3327 3327
 	public function get_queried_object_id() {
3328 3328
 		$this->get_queried_object();
3329 3329
 
3330
-		if ( isset($this->queried_object_id) ) {
3330
+		if (isset($this->queried_object_id)) {
3331 3331
 			return $this->queried_object_id;
3332 3332
 		}
3333 3333
 
@@ -3344,9 +3344,9 @@  discard block
 block discarded – undo
3344 3344
 	 *
3345 3345
 	 * @param string|array $query URL query string or array of vars.
3346 3346
 	 */
3347
-	public function __construct( $query = '' ) {
3348
-		if ( ! empty( $query ) ) {
3349
-			$this->query( $query );
3347
+	public function __construct($query = '') {
3348
+		if ( ! empty($query)) {
3349
+			$this->query($query);
3350 3350
 		}
3351 3351
 	}
3352 3352
 
@@ -3359,8 +3359,8 @@  discard block
 block discarded – undo
3359 3359
 	 * @param string $name Property to get.
3360 3360
 	 * @return mixed Property.
3361 3361
 	 */
3362
-	public function __get( $name ) {
3363
-		if ( in_array( $name, $this->compat_fields ) ) {
3362
+	public function __get($name) {
3363
+		if (in_array($name, $this->compat_fields)) {
3364 3364
 			return $this->$name;
3365 3365
 		}
3366 3366
 	}
@@ -3374,9 +3374,9 @@  discard block
 block discarded – undo
3374 3374
 	 * @param string $name Property to check if set.
3375 3375
 	 * @return bool Whether the property is set.
3376 3376
 	 */
3377
-	public function __isset( $name ) {
3378
-		if ( in_array( $name, $this->compat_fields ) ) {
3379
-			return isset( $this->$name );
3377
+	public function __isset($name) {
3378
+		if (in_array($name, $this->compat_fields)) {
3379
+			return isset($this->$name);
3380 3380
 		}
3381 3381
 	}
3382 3382
 
@@ -3390,9 +3390,9 @@  discard block
 block discarded – undo
3390 3390
 	 * @param array    $arguments Arguments to pass when calling.
3391 3391
 	 * @return mixed|false Return value of the callback, false otherwise.
3392 3392
 	 */
3393
-	public function __call( $name, $arguments ) {
3394
-		if ( in_array( $name, $this->compat_methods ) ) {
3395
-			return call_user_func_array( array( $this, $name ), $arguments );
3393
+	public function __call($name, $arguments) {
3394
+		if (in_array($name, $this->compat_methods)) {
3395
+			return call_user_func_array(array($this, $name), $arguments);
3396 3396
 		}
3397 3397
 		return false;
3398 3398
 	}
@@ -3418,16 +3418,16 @@  discard block
 block discarded – undo
3418 3418
 	 * @param mixed $post_types Optional. Post type or array of posts types to check against.
3419 3419
 	 * @return bool
3420 3420
 	 */
3421
-	public function is_post_type_archive( $post_types = '' ) {
3422
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
3421
+	public function is_post_type_archive($post_types = '') {
3422
+		if (empty($post_types) || ! $this->is_post_type_archive)
3423 3423
 			return (bool) $this->is_post_type_archive;
3424 3424
 
3425
-		$post_type = $this->get( 'post_type' );
3426
-		if ( is_array( $post_type ) )
3427
-			$post_type = reset( $post_type );
3428
-		$post_type_object = get_post_type_object( $post_type );
3425
+		$post_type = $this->get('post_type');
3426
+		if (is_array($post_type))
3427
+			$post_type = reset($post_type);
3428
+		$post_type_object = get_post_type_object($post_type);
3429 3429
 
3430
-		return in_array( $post_type_object->name, (array) $post_types );
3430
+		return in_array($post_type_object->name, (array) $post_types);
3431 3431
 	}
3432 3432
 
3433 3433
 	/**
@@ -3438,24 +3438,24 @@  discard block
 block discarded – undo
3438 3438
 	 * @param mixed $attachment Attachment ID, title, slug, or array of such.
3439 3439
 	 * @return bool
3440 3440
 	 */
3441
-	public function is_attachment( $attachment = '' ) {
3442
-		if ( ! $this->is_attachment ) {
3441
+	public function is_attachment($attachment = '') {
3442
+		if ( ! $this->is_attachment) {
3443 3443
 			return false;
3444 3444
 		}
3445 3445
 
3446
-		if ( empty( $attachment ) ) {
3446
+		if (empty($attachment)) {
3447 3447
 			return true;
3448 3448
 		}
3449 3449
 
3450
-		$attachment = array_map( 'strval', (array) $attachment );
3450
+		$attachment = array_map('strval', (array) $attachment);
3451 3451
 
3452 3452
 		$post_obj = $this->get_queried_object();
3453 3453
 
3454
-		if ( in_array( (string) $post_obj->ID, $attachment ) ) {
3454
+		if (in_array((string) $post_obj->ID, $attachment)) {
3455 3455
 			return true;
3456
-		} elseif ( in_array( $post_obj->post_title, $attachment ) ) {
3456
+		} elseif (in_array($post_obj->post_title, $attachment)) {
3457 3457
 			return true;
3458
-		} elseif ( in_array( $post_obj->post_name, $attachment ) ) {
3458
+		} elseif (in_array($post_obj->post_name, $attachment)) {
3459 3459
 			return true;
3460 3460
 		}
3461 3461
 		return false;
@@ -3472,22 +3472,22 @@  discard block
 block discarded – undo
3472 3472
 	 * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
3473 3473
 	 * @return bool
3474 3474
 	 */
3475
-	public function is_author( $author = '' ) {
3476
-		if ( !$this->is_author )
3475
+	public function is_author($author = '') {
3476
+		if ( ! $this->is_author)
3477 3477
 			return false;
3478 3478
 
3479
-		if ( empty($author) )
3479
+		if (empty($author))
3480 3480
 			return true;
3481 3481
 
3482 3482
 		$author_obj = $this->get_queried_object();
3483 3483
 
3484
-		$author = array_map( 'strval', (array) $author );
3484
+		$author = array_map('strval', (array) $author);
3485 3485
 
3486
-		if ( in_array( (string) $author_obj->ID, $author ) )
3486
+		if (in_array((string) $author_obj->ID, $author))
3487 3487
 			return true;
3488
-		elseif ( in_array( $author_obj->nickname, $author ) )
3488
+		elseif (in_array($author_obj->nickname, $author))
3489 3489
 			return true;
3490
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
3490
+		elseif (in_array($author_obj->user_nicename, $author))
3491 3491
 			return true;
3492 3492
 
3493 3493
 		return false;
@@ -3504,22 +3504,22 @@  discard block
 block discarded – undo
3504 3504
 	 * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
3505 3505
 	 * @return bool
3506 3506
 	 */
3507
-	public function is_category( $category = '' ) {
3508
-		if ( !$this->is_category )
3507
+	public function is_category($category = '') {
3508
+		if ( ! $this->is_category)
3509 3509
 			return false;
3510 3510
 
3511
-		if ( empty($category) )
3511
+		if (empty($category))
3512 3512
 			return true;
3513 3513
 
3514 3514
 		$cat_obj = $this->get_queried_object();
3515 3515
 
3516
-		$category = array_map( 'strval', (array) $category );
3516
+		$category = array_map('strval', (array) $category);
3517 3517
 
3518
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
3518
+		if (in_array((string) $cat_obj->term_id, $category))
3519 3519
 			return true;
3520
-		elseif ( in_array( $cat_obj->name, $category ) )
3520
+		elseif (in_array($cat_obj->name, $category))
3521 3521
 			return true;
3522
-		elseif ( in_array( $cat_obj->slug, $category ) )
3522
+		elseif (in_array($cat_obj->slug, $category))
3523 3523
 			return true;
3524 3524
 
3525 3525
 		return false;
@@ -3536,22 +3536,22 @@  discard block
 block discarded – undo
3536 3536
 	 * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
3537 3537
 	 * @return bool
3538 3538
 	 */
3539
-	public function is_tag( $tag = '' ) {
3540
-		if ( ! $this->is_tag )
3539
+	public function is_tag($tag = '') {
3540
+		if ( ! $this->is_tag)
3541 3541
 			return false;
3542 3542
 
3543
-		if ( empty( $tag ) )
3543
+		if (empty($tag))
3544 3544
 			return true;
3545 3545
 
3546 3546
 		$tag_obj = $this->get_queried_object();
3547 3547
 
3548
-		$tag = array_map( 'strval', (array) $tag );
3548
+		$tag = array_map('strval', (array) $tag);
3549 3549
 
3550
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
3550
+		if (in_array((string) $tag_obj->term_id, $tag))
3551 3551
 			return true;
3552
-		elseif ( in_array( $tag_obj->name, $tag ) )
3552
+		elseif (in_array($tag_obj->name, $tag))
3553 3553
 			return true;
3554
-		elseif ( in_array( $tag_obj->slug, $tag ) )
3554
+		elseif (in_array($tag_obj->slug, $tag))
3555 3555
 			return true;
3556 3556
 
3557 3557
 		return false;
@@ -3575,32 +3575,32 @@  discard block
 block discarded – undo
3575 3575
 	 * @param mixed $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
3576 3576
 	 * @return bool True for custom taxonomy archive pages, false for built-in taxonomies (category and tag archives).
3577 3577
 	 */
3578
-	public function is_tax( $taxonomy = '', $term = '' ) {
3578
+	public function is_tax($taxonomy = '', $term = '') {
3579 3579
 		global $wp_taxonomies;
3580 3580
 
3581
-		if ( !$this->is_tax )
3581
+		if ( ! $this->is_tax)
3582 3582
 			return false;
3583 3583
 
3584
-		if ( empty( $taxonomy ) )
3584
+		if (empty($taxonomy))
3585 3585
 			return true;
3586 3586
 
3587 3587
 		$queried_object = $this->get_queried_object();
3588
-		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
3588
+		$tax_array = array_intersect(array_keys($wp_taxonomies), (array) $taxonomy);
3589 3589
 		$term_array = (array) $term;
3590 3590
 
3591 3591
 		// Check that the taxonomy matches.
3592
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
3592
+		if ( ! (isset($queried_object->taxonomy) && count($tax_array) && in_array($queried_object->taxonomy, $tax_array)))
3593 3593
 			return false;
3594 3594
 
3595 3595
 		// Only a Taxonomy provided.
3596
-		if ( empty( $term ) )
3596
+		if (empty($term))
3597 3597
 			return true;
3598 3598
 
3599
-		return isset( $queried_object->term_id ) &&
3600
-			count( array_intersect(
3601
-				array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),
3599
+		return isset($queried_object->term_id) &&
3600
+			count(array_intersect(
3601
+				array($queried_object->term_id, $queried_object->name, $queried_object->slug),
3602 3602
 				$term_array
3603
-			) );
3603
+			));
3604 3604
 	}
3605 3605
 
3606 3606
 	/**
@@ -3612,7 +3612,7 @@  discard block
 block discarded – undo
3612 3612
 	 * @return bool
3613 3613
 	 */
3614 3614
 	public function is_comments_popup() {
3615
-		_deprecated_function( __FUNCTION__, '4.5.0' );
3615
+		_deprecated_function(__FUNCTION__, '4.5.0');
3616 3616
 
3617 3617
 		return false;
3618 3618
 	}
@@ -3647,13 +3647,13 @@  discard block
 block discarded – undo
3647 3647
 	 * @param string|array $feeds Optional feed types to check.
3648 3648
 	 * @return bool
3649 3649
 	 */
3650
-	public function is_feed( $feeds = '' ) {
3651
-		if ( empty( $feeds ) || ! $this->is_feed )
3650
+	public function is_feed($feeds = '') {
3651
+		if (empty($feeds) || ! $this->is_feed)
3652 3652
 			return (bool) $this->is_feed;
3653
-		$qv = $this->get( 'feed' );
3654
-		if ( 'feed' == $qv )
3653
+		$qv = $this->get('feed');
3654
+		if ('feed' == $qv)
3655 3655
 			$qv = get_default_feed();
3656
-		return in_array( $qv, (array) $feeds );
3656
+		return in_array($qv, (array) $feeds);
3657 3657
 	}
3658 3658
 
3659 3659
 	/**
@@ -3685,9 +3685,9 @@  discard block
 block discarded – undo
3685 3685
 	 */
3686 3686
 	public function is_front_page() {
3687 3687
 		// most likely case
3688
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
3688
+		if ('posts' == get_option('show_on_front') && $this->is_home())
3689 3689
 			return true;
3690
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
3690
+		elseif ('page' == get_option('show_on_front') && get_option('page_on_front') && $this->is_page(get_option('page_on_front')))
3691 3691
 			return true;
3692 3692
 		else
3693 3693
 			return false;
@@ -3738,31 +3738,31 @@  discard block
 block discarded – undo
3738 3738
 	 * @param int|string|array $page Optional. Page ID, title, slug, path, or array of such. Default empty.
3739 3739
 	 * @return bool Whether the query is for an existing single page.
3740 3740
 	 */
3741
-	public function is_page( $page = '' ) {
3742
-		if ( !$this->is_page )
3741
+	public function is_page($page = '') {
3742
+		if ( ! $this->is_page)
3743 3743
 			return false;
3744 3744
 
3745
-		if ( empty( $page ) )
3745
+		if (empty($page))
3746 3746
 			return true;
3747 3747
 
3748 3748
 		$page_obj = $this->get_queried_object();
3749 3749
 
3750
-		$page = array_map( 'strval', (array) $page );
3750
+		$page = array_map('strval', (array) $page);
3751 3751
 
3752
-		if ( in_array( (string) $page_obj->ID, $page ) ) {
3752
+		if (in_array((string) $page_obj->ID, $page)) {
3753 3753
 			return true;
3754
-		} elseif ( in_array( $page_obj->post_title, $page ) ) {
3754
+		} elseif (in_array($page_obj->post_title, $page)) {
3755 3755
 			return true;
3756
-		} elseif ( in_array( $page_obj->post_name, $page ) ) {
3756
+		} elseif (in_array($page_obj->post_name, $page)) {
3757 3757
 			return true;
3758 3758
 		} else {
3759
-			foreach ( $page as $pagepath ) {
3760
-				if ( ! strpos( $pagepath, '/' ) ) {
3759
+			foreach ($page as $pagepath) {
3760
+				if ( ! strpos($pagepath, '/')) {
3761 3761
 					continue;
3762 3762
 				}
3763
-				$pagepath_obj = get_page_by_path( $pagepath );
3763
+				$pagepath_obj = get_page_by_path($pagepath);
3764 3764
 
3765
-				if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
3765
+				if ($pagepath_obj && ($pagepath_obj->ID == $page_obj->ID)) {
3766 3766
 					return true;
3767 3767
 				}
3768 3768
 			}
@@ -3831,31 +3831,31 @@  discard block
 block discarded – undo
3831 3831
 	 * @param int|string|array $post Optional. Post ID, title, slug, path, or array of such. Default empty.
3832 3832
 	 * @return bool Whether the query is for an existing single post.
3833 3833
 	 */
3834
-	public function is_single( $post = '' ) {
3835
-		if ( !$this->is_single )
3834
+	public function is_single($post = '') {
3835
+		if ( ! $this->is_single)
3836 3836
 			return false;
3837 3837
 
3838
-		if ( empty($post) )
3838
+		if (empty($post))
3839 3839
 			return true;
3840 3840
 
3841 3841
 		$post_obj = $this->get_queried_object();
3842 3842
 
3843
-		$post = array_map( 'strval', (array) $post );
3843
+		$post = array_map('strval', (array) $post);
3844 3844
 
3845
-		if ( in_array( (string) $post_obj->ID, $post ) ) {
3845
+		if (in_array((string) $post_obj->ID, $post)) {
3846 3846
 			return true;
3847
-		} elseif ( in_array( $post_obj->post_title, $post ) ) {
3847
+		} elseif (in_array($post_obj->post_title, $post)) {
3848 3848
 			return true;
3849
-		} elseif ( in_array( $post_obj->post_name, $post ) ) {
3849
+		} elseif (in_array($post_obj->post_name, $post)) {
3850 3850
 			return true;
3851 3851
 		} else {
3852
-			foreach ( $post as $postpath ) {
3853
-				if ( ! strpos( $postpath, '/' ) ) {
3852
+			foreach ($post as $postpath) {
3853
+				if ( ! strpos($postpath, '/')) {
3854 3854
 					continue;
3855 3855
 				}
3856
-				$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );
3856
+				$postpath_obj = get_page_by_path($postpath, OBJECT, $post_obj->post_type);
3857 3857
 
3858
-				if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
3858
+				if ($postpath_obj && ($postpath_obj->ID == $post_obj->ID)) {
3859 3859
 					return true;
3860 3860
 				}
3861 3861
 			}
@@ -3877,13 +3877,13 @@  discard block
 block discarded – undo
3877 3877
 	 * @param string|array $post_types Optional. Post type or array of post types. Default empty.
3878 3878
 	 * @return bool Whether the query is for an existing single post of any of the given post types.
3879 3879
 	 */
3880
-	public function is_singular( $post_types = '' ) {
3881
-		if ( empty( $post_types ) || !$this->is_singular )
3880
+	public function is_singular($post_types = '') {
3881
+		if (empty($post_types) || ! $this->is_singular)
3882 3882
 			return (bool) $this->is_singular;
3883 3883
 
3884 3884
 		$post_obj = $this->get_queried_object();
3885 3885
 
3886
-		return in_array( $post_obj->post_type, (array) $post_types );
3886
+		return in_array($post_obj->post_type, (array) $post_types);
3887 3887
 	}
3888 3888
 
3889 3889
 	/**
@@ -3974,14 +3974,14 @@  discard block
 block discarded – undo
3974 3974
 	 * @param WP_Post|object|int $post WP_Post instance or Post ID/object.
3975 3975
 	 * @return true True when finished.
3976 3976
 	 */
3977
-	public function setup_postdata( $post ) {
3977
+	public function setup_postdata($post) {
3978 3978
 		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
3979 3979
 
3980
-		if ( ! ( $post instanceof WP_Post ) ) {
3981
-			$post = get_post( $post );
3980
+		if ( ! ($post instanceof WP_Post)) {
3981
+			$post = get_post($post);
3982 3982
 		}
3983 3983
 
3984
-		if ( ! $post ) {
3984
+		if ( ! $post) {
3985 3985
 			return;
3986 3986
 		}
3987 3987
 
@@ -3993,35 +3993,35 @@  discard block
 block discarded – undo
3993 3993
 		$currentmonth = mysql2date('m', $post->post_date, false);
3994 3994
 		$numpages = 1;
3995 3995
 		$multipage = 0;
3996
-		$page = $this->get( 'page' );
3997
-		if ( ! $page )
3996
+		$page = $this->get('page');
3997
+		if ( ! $page)
3998 3998
 			$page = 1;
3999 3999
 
4000 4000
 		/*
4001 4001
 		 * Force full post content when viewing the permalink for the $post,
4002 4002
 		 * or when on an RSS feed. Otherwise respect the 'more' tag.
4003 4003
 		 */
4004
-		if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {
4004
+		if ($post->ID === get_queried_object_id() && ($this->is_page() || $this->is_single())) {
4005 4005
 			$more = 1;
4006
-		} elseif ( $this->is_feed() ) {
4006
+		} elseif ($this->is_feed()) {
4007 4007
 			$more = 1;
4008 4008
 		} else {
4009 4009
 			$more = 0;
4010 4010
 		}
4011 4011
 
4012 4012
 		$content = $post->post_content;
4013
-		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
4014
-			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
4015
-			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
4016
-			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4013
+		if (false !== strpos($content, '<!--nextpage-->')) {
4014
+			$content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
4015
+			$content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
4016
+			$content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
4017 4017
 
4018 4018
 			// Ignore nextpage at the beginning of the content.
4019
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4020
-				$content = substr( $content, 15 );
4019
+			if (0 === strpos($content, '<!--nextpage-->'))
4020
+				$content = substr($content, 15);
4021 4021
 
4022 4022
 			$pages = explode('<!--nextpage-->', $content);
4023 4023
 		} else {
4024
-			$pages = array( $post->post_content );
4024
+			$pages = array($post->post_content);
4025 4025
 		}
4026 4026
 
4027 4027
 		/**
@@ -4036,12 +4036,12 @@  discard block
 block discarded – undo
4036 4036
 		 *                       of `<!-- nextpage -->` tags..
4037 4037
 		 * @param WP_Post $post  Current post object.
4038 4038
 		 */
4039
-		$pages = apply_filters( 'content_pagination', $pages, $post );
4039
+		$pages = apply_filters('content_pagination', $pages, $post);
4040 4040
 
4041
-		$numpages = count( $pages );
4041
+		$numpages = count($pages);
4042 4042
 
4043
-		if ( $numpages > 1 ) {
4044
-			if ( $page > 1 ) {
4043
+		if ($numpages > 1) {
4044
+			if ($page > 1) {
4045 4045
 				$more = 1;
4046 4046
 			}
4047 4047
 			$multipage = 1;
@@ -4058,7 +4058,7 @@  discard block
 block discarded – undo
4058 4058
 		 * @param WP_Post  &$post The Post object (passed by reference).
4059 4059
 		 * @param WP_Query &$this The current Query object (passed by reference).
4060 4060
 		 */
4061
-		do_action_ref_array( 'the_post', array( &$post, &$this ) );
4061
+		do_action_ref_array('the_post', array(&$post, &$this));
4062 4062
 
4063 4063
 		return true;
4064 4064
 	}
@@ -4071,9 +4071,9 @@  discard block
 block discarded – undo
4071 4071
 	 * @global WP_Post $post
4072 4072
 	 */
4073 4073
 	public function reset_postdata() {
4074
-		if ( ! empty( $this->post ) ) {
4074
+		if ( ! empty($this->post)) {
4075 4075
 			$GLOBALS['post'] = $this->post;
4076
-			$this->setup_postdata( $this->post );
4076
+			$this->setup_postdata($this->post);
4077 4077
 		}
4078 4078
 	}
4079 4079
 
@@ -4087,8 +4087,8 @@  discard block
 block discarded – undo
4087 4087
 	 * @param int   $term_id
4088 4088
 	 * @return mixed
4089 4089
 	 */
4090
-	public function lazyload_term_meta( $check, $term_id ) {
4091
-		_deprecated_function( __METHOD__, '4.5.0' );
4090
+	public function lazyload_term_meta($check, $term_id) {
4091
+		_deprecated_function(__METHOD__, '4.5.0');
4092 4092
 		return $check;
4093 4093
 	}
4094 4094
 
@@ -4102,8 +4102,8 @@  discard block
 block discarded – undo
4102 4102
 	 * @param int   $comment_id
4103 4103
 	 * @return mixed
4104 4104
 	 */
4105
-	public function lazyload_comment_meta( $check, $comment_id ) {
4106
-		_deprecated_function( __METHOD__, '4.5.0' );
4105
+	public function lazyload_comment_meta($check, $comment_id) {
4106
+		_deprecated_function(__METHOD__, '4.5.0');
4107 4107
 		return $check;
4108 4108
 	}
4109 4109
 }
Please login to merge, or discard this patch.
Braces   +358 added lines, -244 removed lines patch added patch discarded remove patch
@@ -613,8 +613,9 @@  discard block
 block discarded – undo
613 613
 		);
614 614
 
615 615
 		foreach ( $keys as $key ) {
616
-			if ( !isset($array[$key]) )
617
-				$array[$key] = '';
616
+			if ( !isset($array[$key]) ) {
617
+							$array[$key] = '';
618
+			}
618 619
 		}
619 620
 
620 621
 		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
@@ -622,8 +623,9 @@  discard block
 block discarded – undo
622 623
 			'author__in', 'author__not_in' );
623 624
 
624 625
 		foreach ( $array_keys as $key ) {
625
-			if ( !isset($array[$key]) )
626
-				$array[$key] = array();
626
+			if ( !isset($array[$key]) ) {
627
+							$array[$key] = array();
628
+			}
627 629
 		}
628 630
 		return $array;
629 631
 	}
@@ -762,8 +764,9 @@  discard block
 block discarded – undo
762 764
 		$qv = &$this->query_vars;
763 765
 		$this->query_vars_changed = true;
764 766
 
765
-		if ( ! empty($qv['robots']) )
766
-			$this->is_robots = true;
767
+		if ( ! empty($qv['robots']) ) {
768
+					$this->is_robots = true;
769
+		}
767 770
 
768 771
 		if ( ! is_scalar( $qv['p'] ) || $qv['p'] < 0 ) {
769 772
 			$qv['p'] = 0;
@@ -784,10 +787,18 @@  discard block
 block discarded – undo
784 787
 		$qv['pagename'] = trim( $qv['pagename'] );
785 788
 		$qv['name'] = trim( $qv['name'] );
786 789
 		$qv['title'] = trim( $qv['title'] );
787
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
788
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
789
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
790
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
790
+		if ( '' !== $qv['hour'] ) {
791
+			$qv['hour'] = absint($qv['hour']);
792
+		}
793
+		if ( '' !== $qv['minute'] ) {
794
+			$qv['minute'] = absint($qv['minute']);
795
+		}
796
+		if ( '' !== $qv['second'] ) {
797
+			$qv['second'] = absint($qv['second']);
798
+		}
799
+		if ( '' !== $qv['menu_order'] ) {
800
+			$qv['menu_order'] = absint($qv['menu_order']);
801
+		}
791 802
 
792 803
 		// Fairly insane upper bound for search string lengths.
793 804
 		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
@@ -795,10 +806,12 @@  discard block
 block discarded – undo
795 806
 		}
796 807
 
797 808
 		// Compat. Map subpost to attachment.
798
-		if ( '' != $qv['subpost'] )
799
-			$qv['attachment'] = $qv['subpost'];
800
-		if ( '' != $qv['subpost_id'] )
801
-			$qv['attachment_id'] = $qv['subpost_id'];
809
+		if ( '' != $qv['subpost'] ) {
810
+					$qv['attachment'] = $qv['subpost'];
811
+		}
812
+		if ( '' != $qv['subpost_id'] ) {
813
+					$qv['attachment_id'] = $qv['subpost_id'];
814
+		}
802 815
 
803 816
 		$qv['attachment_id'] = absint($qv['attachment_id']);
804 817
 
@@ -914,38 +927,46 @@  discard block
 block discarded – undo
914 927
 				$this->is_author = true;
915 928
 			}
916 929
 
917
-			if ( '' != $qv['author_name'] )
918
-				$this->is_author = true;
930
+			if ( '' != $qv['author_name'] ) {
931
+							$this->is_author = true;
932
+			}
919 933
 
920 934
 			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
921 935
 				$post_type_obj = get_post_type_object( $qv['post_type'] );
922
-				if ( ! empty( $post_type_obj->has_archive ) )
923
-					$this->is_post_type_archive = true;
936
+				if ( ! empty( $post_type_obj->has_archive ) ) {
937
+									$this->is_post_type_archive = true;
938
+				}
924 939
 			}
925 940
 
926
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
927
-				$this->is_archive = true;
941
+			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) {
942
+							$this->is_archive = true;
943
+			}
928 944
 		}
929 945
 
930
-		if ( '' != $qv['feed'] )
931
-			$this->is_feed = true;
946
+		if ( '' != $qv['feed'] ) {
947
+					$this->is_feed = true;
948
+		}
932 949
 
933 950
 		if ( '' != $qv['embed'] ) {
934 951
 			$this->is_embed = true;
935 952
 		}
936 953
 
937
-		if ( '' != $qv['tb'] )
938
-			$this->is_trackback = true;
954
+		if ( '' != $qv['tb'] ) {
955
+					$this->is_trackback = true;
956
+		}
939 957
 
940
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
941
-			$this->is_paged = true;
958
+		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) ) {
959
+					$this->is_paged = true;
960
+		}
942 961
 
943 962
 		// if we're previewing inside the write screen
944
-		if ( '' != $qv['preview'] )
945
-			$this->is_preview = true;
963
+		if ( '' != $qv['preview'] ) {
964
+					$this->is_preview = true;
965
+		}
946 966
 
947
-		if ( is_admin() )
948
-			$this->is_admin = true;
967
+		if ( is_admin() ) {
968
+					$this->is_admin = true;
969
+		}
949 970
 
950 971
 		if ( false !== strpos($qv['feed'], 'comments-') ) {
951 972
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
@@ -954,18 +975,21 @@  discard block
 block discarded – undo
954 975
 
955 976
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
956 977
 
957
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
958
-			$this->is_comment_feed = true;
978
+		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) {
979
+					$this->is_comment_feed = true;
980
+		}
959 981
 
960
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) )
961
-			$this->is_home = true;
982
+		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || ( defined( 'REST_REQUEST' ) && REST_REQUEST ) || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_robots ) ) {
983
+					$this->is_home = true;
984
+		}
962 985
 
963 986
 		// Correct is_* for page_on_front and page_for_posts
964 987
 		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
965 988
 			$_query = wp_parse_args($this->query);
966 989
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
967
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
968
-				unset($_query['pagename']);
990
+			if ( isset($_query['pagename']) && '' == $_query['pagename'] ) {
991
+							unset($_query['pagename']);
992
+			}
969 993
 
970 994
 			unset( $_query['embed'] );
971 995
 
@@ -1018,27 +1042,31 @@  discard block
 block discarded – undo
1018 1042
 		}
1019 1043
 
1020 1044
 		if ( !empty($qv['post_type']) ) {
1021
-			if ( is_array($qv['post_type']) )
1022
-				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1023
-			else
1024
-				$qv['post_type'] = sanitize_key($qv['post_type']);
1045
+			if ( is_array($qv['post_type']) ) {
1046
+							$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1047
+			} else {
1048
+							$qv['post_type'] = sanitize_key($qv['post_type']);
1049
+			}
1025 1050
 		}
1026 1051
 
1027 1052
 		if ( ! empty( $qv['post_status'] ) ) {
1028
-			if ( is_array( $qv['post_status'] ) )
1029
-				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1030
-			else
1031
-				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1053
+			if ( is_array( $qv['post_status'] ) ) {
1054
+							$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1055
+			} else {
1056
+							$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1057
+			}
1032 1058
 		}
1033 1059
 
1034
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1035
-			$this->is_comment_feed = false;
1060
+		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) {
1061
+					$this->is_comment_feed = false;
1062
+		}
1036 1063
 
1037 1064
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1038 1065
 		// Done correcting is_* for page_on_front and page_for_posts
1039 1066
 
1040
-		if ( '404' == $qv['error'] )
1041
-			$this->set_404();
1067
+		if ( '404' == $qv['error'] ) {
1068
+					$this->set_404();
1069
+		}
1042 1070
 
1043 1071
 		$this->is_embed = $this->is_embed && ( $this->is_singular || $this->is_404 );
1044 1072
 
@@ -1081,8 +1109,10 @@  discard block
 block discarded – undo
1081 1109
 		}
1082 1110
 
1083 1111
 		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1084
-			if ( 'post_tag' == $taxonomy )
1085
-				continue;	// Handled further down in the $q['tag'] block
1112
+			if ( 'post_tag' == $taxonomy ) {
1113
+							continue;
1114
+			}
1115
+			// Handled further down in the $q['tag'] block
1086 1116
 
1087 1117
 			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1088 1118
 				$tax_query_defaults = array(
@@ -1129,10 +1159,11 @@  discard block
 block discarded – undo
1129 1159
 			$q['cat'] = implode( ',', $cat_array );
1130 1160
 
1131 1161
 			foreach ( $cat_array as $cat ) {
1132
-				if ( $cat > 0 )
1133
-					$cat_in[] = $cat;
1134
-				elseif ( $cat < 0 )
1135
-					$cat_not_in[] = abs( $cat );
1162
+				if ( $cat > 0 ) {
1163
+									$cat_in[] = $cat;
1164
+				} elseif ( $cat < 0 ) {
1165
+									$cat_not_in[] = abs( $cat );
1166
+				}
1136 1167
 			}
1137 1168
 
1138 1169
 			if ( ! empty( $cat_in ) ) {
@@ -1158,8 +1189,9 @@  discard block
 block discarded – undo
1158 1189
 
1159 1190
 		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1160 1191
 			$q['category__and'] = (array) $q['category__and'];
1161
-			if ( ! isset( $q['category__in'] ) )
1162
-				$q['category__in'] = array();
1192
+			if ( ! isset( $q['category__in'] ) ) {
1193
+							$q['category__in'] = array();
1194
+			}
1163 1195
 			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1164 1196
 			unset( $q['category__and'] );
1165 1197
 		}
@@ -1300,8 +1332,9 @@  discard block
 block discarded – undo
1300 1332
 
1301 1333
 		// added slashes screw with quote grouping when done early, so done later
1302 1334
 		$q['s'] = stripslashes( $q['s'] );
1303
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
1304
-			$q['s'] = urldecode( $q['s'] );
1335
+		if ( empty( $_GET['s'] ) && $this->is_main_query() ) {
1336
+					$q['s'] = urldecode( $q['s'] );
1337
+		}
1305 1338
 		// there are no line breaks in <input /> fields
1306 1339
 		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
1307 1340
 		$q['search_terms_count'] = 1;
@@ -1312,8 +1345,9 @@  discard block
 block discarded – undo
1312 1345
 				$q['search_terms_count'] = count( $matches[0] );
1313 1346
 				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
1314 1347
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
1315
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
1316
-					$q['search_terms'] = array( $q['s'] );
1348
+				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {
1349
+									$q['search_terms'] = array( $q['s'] );
1350
+				}
1317 1351
 			} else {
1318 1352
 				$q['search_terms'] = array( $q['s'] );
1319 1353
 			}
@@ -1385,17 +1419,20 @@  discard block
 block discarded – undo
1385 1419
 
1386 1420
 		foreach ( $terms as $term ) {
1387 1421
 			// keep before/after spaces when term is for exact match
1388
-			if ( preg_match( '/^".+"$/', $term ) )
1389
-				$term = trim( $term, "\"'" );
1390
-			else
1391
-				$term = trim( $term, "\"' " );
1422
+			if ( preg_match( '/^".+"$/', $term ) ) {
1423
+							$term = trim( $term, "\"'" );
1424
+			} else {
1425
+							$term = trim( $term, "\"' " );
1426
+			}
1392 1427
 
1393 1428
 			// Avoid single A-Z and single dashes.
1394
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) )
1395
-				continue;
1429
+			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z\-]$/i', $term ) ) ) {
1430
+							continue;
1431
+			}
1396 1432
 
1397
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
1398
-				continue;
1433
+			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {
1434
+							continue;
1435
+			}
1399 1436
 
1400 1437
 			$checked[] = $term;
1401 1438
 		}
@@ -1411,8 +1448,9 @@  discard block
 block discarded – undo
1411 1448
 	 * @return array Stopwords.
1412 1449
 	 */
1413 1450
 	protected function get_search_stopwords() {
1414
-		if ( isset( $this->stopwords ) )
1415
-			return $this->stopwords;
1451
+		if ( isset( $this->stopwords ) ) {
1452
+					return $this->stopwords;
1453
+		}
1416 1454
 
1417 1455
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
1418 1456
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
@@ -1424,8 +1462,9 @@  discard block
 block discarded – undo
1424 1462
 		$stopwords = array();
1425 1463
 		foreach ( $words as $word ) {
1426 1464
 			$word = trim( $word, "\r\n\t " );
1427
-			if ( $word )
1428
-				$stopwords[] = $word;
1465
+			if ( $word ) {
1466
+							$stopwords[] = $word;
1467
+			}
1429 1468
 		}
1430 1469
 
1431 1470
 		/**
@@ -1470,8 +1509,9 @@  discard block
 block discarded – undo
1470 1509
 				// all words in title
1471 1510
 				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
1472 1511
 				// any word in title, not needed when $num_terms == 1
1473
-				if ( $num_terms > 1 )
1474
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
1512
+				if ( $num_terms > 1 ) {
1513
+									$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
1514
+				}
1475 1515
 			}
1476 1516
 
1477 1517
 			// Sentence match in 'post_content' and 'post_excerpt'.
@@ -1714,38 +1754,45 @@  discard block
 block discarded – undo
1714 1754
 
1715 1755
 		if ( isset( $q['caller_get_posts'] ) ) {
1716 1756
 			_deprecated_argument( 'WP_Query', '3.1.0', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
1717
-			if ( !isset( $q['ignore_sticky_posts'] ) )
1718
-				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
1757
+			if ( !isset( $q['ignore_sticky_posts'] ) ) {
1758
+							$q['ignore_sticky_posts'] = $q['caller_get_posts'];
1759
+			}
1719 1760
 		}
1720 1761
 
1721
-		if ( !isset( $q['ignore_sticky_posts'] ) )
1722
-			$q['ignore_sticky_posts'] = false;
1762
+		if ( !isset( $q['ignore_sticky_posts'] ) ) {
1763
+					$q['ignore_sticky_posts'] = false;
1764
+		}
1723 1765
 
1724
-		if ( !isset($q['suppress_filters']) )
1725
-			$q['suppress_filters'] = false;
1766
+		if ( !isset($q['suppress_filters']) ) {
1767
+					$q['suppress_filters'] = false;
1768
+		}
1726 1769
 
1727 1770
 		if ( !isset($q['cache_results']) ) {
1728
-			if ( wp_using_ext_object_cache() )
1729
-				$q['cache_results'] = false;
1730
-			else
1731
-				$q['cache_results'] = true;
1771
+			if ( wp_using_ext_object_cache() ) {
1772
+							$q['cache_results'] = false;
1773
+			} else {
1774
+							$q['cache_results'] = true;
1775
+			}
1732 1776
 		}
1733 1777
 
1734
-		if ( !isset($q['update_post_term_cache']) )
1735
-			$q['update_post_term_cache'] = true;
1778
+		if ( !isset($q['update_post_term_cache']) ) {
1779
+					$q['update_post_term_cache'] = true;
1780
+		}
1736 1781
 
1737 1782
 		if ( ! isset( $q['lazy_load_term_meta'] ) ) {
1738 1783
 			$q['lazy_load_term_meta'] = $q['update_post_term_cache'];
1739 1784
 		}
1740 1785
 
1741
-		if ( !isset($q['update_post_meta_cache']) )
1742
-			$q['update_post_meta_cache'] = true;
1786
+		if ( !isset($q['update_post_meta_cache']) ) {
1787
+					$q['update_post_meta_cache'] = true;
1788
+		}
1743 1789
 
1744 1790
 		if ( !isset($q['post_type']) ) {
1745
-			if ( $this->is_search )
1746
-				$q['post_type'] = 'any';
1747
-			else
1748
-				$q['post_type'] = '';
1791
+			if ( $this->is_search ) {
1792
+							$q['post_type'] = 'any';
1793
+			} else {
1794
+							$q['post_type'] = '';
1795
+			}
1749 1796
 		}
1750 1797
 		$post_type = $q['post_type'];
1751 1798
 		if ( empty( $q['posts_per_page'] ) ) {
@@ -1755,8 +1802,9 @@  discard block
 block discarded – undo
1755 1802
 			$q['showposts'] = (int) $q['showposts'];
1756 1803
 			$q['posts_per_page'] = $q['showposts'];
1757 1804
 		}
1758
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
1759
-			$q['posts_per_page'] = $q['posts_per_archive_page'];
1805
+		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) ) {
1806
+					$q['posts_per_page'] = $q['posts_per_archive_page'];
1807
+		}
1760 1808
 		if ( !isset($q['nopaging']) ) {
1761 1809
 			if ( $q['posts_per_page'] == -1 ) {
1762 1810
 				$q['nopaging'] = true;
@@ -1775,13 +1823,15 @@  discard block
 block discarded – undo
1775 1823
 			$q['nopaging'] = false;
1776 1824
 		}
1777 1825
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
1778
-		if ( $q['posts_per_page'] < -1 )
1779
-			$q['posts_per_page'] = abs($q['posts_per_page']);
1780
-		elseif ( $q['posts_per_page'] == 0 )
1781
-			$q['posts_per_page'] = 1;
1826
+		if ( $q['posts_per_page'] < -1 ) {
1827
+					$q['posts_per_page'] = abs($q['posts_per_page']);
1828
+		} elseif ( $q['posts_per_page'] == 0 ) {
1829
+					$q['posts_per_page'] = 1;
1830
+		}
1782 1831
 
1783
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
1784
-			$q['comments_per_page'] = get_option('comments_per_page');
1832
+		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 ) {
1833
+					$q['comments_per_page'] = get_option('comments_per_page');
1834
+		}
1785 1835
 
1786 1836
 		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
1787 1837
 			$this->is_page = true;
@@ -1795,10 +1845,11 @@  discard block
 block discarded – undo
1795 1845
 		}
1796 1846
 
1797 1847
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
1798
-		if ( isset($q['no_found_rows']) )
1799
-			$q['no_found_rows'] = (bool) $q['no_found_rows'];
1800
-		else
1801
-			$q['no_found_rows'] = false;
1848
+		if ( isset($q['no_found_rows']) ) {
1849
+					$q['no_found_rows'] = (bool) $q['no_found_rows'];
1850
+		} else {
1851
+					$q['no_found_rows'] = false;
1852
+		}
1802 1853
 
1803 1854
 		switch ( $q['fields'] ) {
1804 1855
 			case 'ids':
@@ -1837,26 +1888,33 @@  discard block
 block discarded – undo
1837 1888
 		// Handle the other individual date parameters
1838 1889
 		$date_parameters = array();
1839 1890
 
1840
-		if ( '' !== $q['hour'] )
1841
-			$date_parameters['hour'] = $q['hour'];
1891
+		if ( '' !== $q['hour'] ) {
1892
+					$date_parameters['hour'] = $q['hour'];
1893
+		}
1842 1894
 
1843
-		if ( '' !== $q['minute'] )
1844
-			$date_parameters['minute'] = $q['minute'];
1895
+		if ( '' !== $q['minute'] ) {
1896
+					$date_parameters['minute'] = $q['minute'];
1897
+		}
1845 1898
 
1846
-		if ( '' !== $q['second'] )
1847
-			$date_parameters['second'] = $q['second'];
1899
+		if ( '' !== $q['second'] ) {
1900
+					$date_parameters['second'] = $q['second'];
1901
+		}
1848 1902
 
1849
-		if ( $q['year'] )
1850
-			$date_parameters['year'] = $q['year'];
1903
+		if ( $q['year'] ) {
1904
+					$date_parameters['year'] = $q['year'];
1905
+		}
1851 1906
 
1852
-		if ( $q['monthnum'] )
1853
-			$date_parameters['monthnum'] = $q['monthnum'];
1907
+		if ( $q['monthnum'] ) {
1908
+					$date_parameters['monthnum'] = $q['monthnum'];
1909
+		}
1854 1910
 
1855
-		if ( $q['w'] )
1856
-			$date_parameters['week'] = $q['w'];
1911
+		if ( $q['w'] ) {
1912
+					$date_parameters['week'] = $q['w'];
1913
+		}
1857 1914
 
1858
-		if ( $q['day'] )
1859
-			$date_parameters['day'] = $q['day'];
1915
+		if ( $q['day'] ) {
1916
+					$date_parameters['day'] = $q['day'];
1917
+		}
1860 1918
 
1861 1919
 		if ( $date_parameters ) {
1862 1920
 			$date_query = new WP_Date_Query( array( $date_parameters ) );
@@ -1875,8 +1933,9 @@  discard block
 block discarded – undo
1875 1933
 		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
1876 1934
 			foreach ( (array)$q['post_type'] as $_post_type ) {
1877 1935
 				$ptype_obj = get_post_type_object($_post_type);
1878
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
1879
-					continue;
1936
+				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) ) {
1937
+									continue;
1938
+				}
1880 1939
 
1881 1940
 				if ( ! $ptype_obj->hierarchical ) {
1882 1941
 					// Non-hierarchical post types can directly use 'name'.
@@ -1908,21 +1967,24 @@  discard block
 block discarded – undo
1908 1967
 				if ( 'page' != $q['post_type'] ) {
1909 1968
 					foreach ( (array)$q['post_type'] as $_post_type ) {
1910 1969
 						$ptype_obj = get_post_type_object($_post_type);
1911
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
1912
-							continue;
1970
+						if ( !$ptype_obj || !$ptype_obj->hierarchical ) {
1971
+													continue;
1972
+						}
1913 1973
 
1914 1974
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
1915
-						if ( $reqpage )
1916
-							break;
1975
+						if ( $reqpage ) {
1976
+													break;
1977
+						}
1917 1978
 					}
1918 1979
 					unset($ptype_obj);
1919 1980
 				} else {
1920 1981
 					$reqpage = get_page_by_path($q['pagename']);
1921 1982
 				}
1922
-				if ( !empty($reqpage) )
1923
-					$reqpage = $reqpage->ID;
1924
-				else
1925
-					$reqpage = 0;
1983
+				if ( !empty($reqpage) ) {
1984
+									$reqpage = $reqpage->ID;
1985
+				} else {
1986
+									$reqpage = 0;
1987
+				}
1926 1988
 			}
1927 1989
 
1928 1990
 			$page_for_posts = get_option('page_for_posts');
@@ -1949,8 +2011,9 @@  discard block
 block discarded – undo
1949 2011
 		}
1950 2012
 
1951 2013
 		// If an attachment is requested by number, let it supersede any post number.
1952
-		if ( $q['attachment_id'] )
1953
-			$q['p'] = absint($q['attachment_id']);
2014
+		if ( $q['attachment_id'] ) {
2015
+					$q['p'] = absint($q['attachment_id']);
2016
+		}
1954 2017
 
1955 2018
 		// If a post number is specified, load that post
1956 2019
 		if ( $q['p'] ) {
@@ -2014,13 +2077,15 @@  discard block
 block discarded – undo
2014 2077
 				$taxonomies = array_keys( $this->tax_query->queried_terms );
2015 2078
 				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2016 2079
 					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2017
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2018
-						$post_type[] = $pt;
2080
+					if ( array_intersect( $taxonomies, $object_taxonomies ) ) {
2081
+											$post_type[] = $pt;
2082
+					}
2083
+				}
2084
+				if ( ! $post_type ) {
2085
+									$post_type = 'any';
2086
+				} elseif ( count( $post_type ) == 1 ) {
2087
+									$post_type = $post_type[0];
2019 2088
 				}
2020
-				if ( ! $post_type )
2021
-					$post_type = 'any';
2022
-				elseif ( count( $post_type ) == 1 )
2023
-					$post_type = $post_type[0];
2024 2089
 
2025 2090
 				$post_status_join = true;
2026 2091
 			} elseif ( in_array('attachment', (array) $post_type) ) {
@@ -2121,8 +2186,9 @@  discard block
 block discarded – undo
2121 2186
 			}
2122 2187
 			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2123 2188
 			$q['author'] = get_user_by('slug', $q['author_name']);
2124
-			if ( $q['author'] )
2125
-				$q['author'] = $q['author']->ID;
2189
+			if ( $q['author'] ) {
2190
+							$q['author'] = $q['author']->ID;
2191
+			}
2126 2192
 			$whichauthor .= " AND ({$wpdb->posts}.post_author = " . absint($q['author']) . ')';
2127 2193
 		}
2128 2194
 
@@ -2206,8 +2272,9 @@  discard block
 block discarded – undo
2206 2272
 		// Order search results by relevance only when another "orderby" is not specified in the query.
2207 2273
 		if ( ! empty( $q['s'] ) ) {
2208 2274
 			$search_orderby = '';
2209
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
2210
-				$search_orderby = $this->parse_search_order( $q );
2275
+			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {
2276
+							$search_orderby = $this->parse_search_order( $q );
2277
+			}
2211 2278
 
2212 2279
 			if ( ! $q['suppress_filters'] ) {
2213 2280
 				/**
@@ -2221,18 +2288,21 @@  discard block
 block discarded – undo
2221 2288
 				$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
2222 2289
 			}
2223 2290
 
2224
-			if ( $search_orderby )
2225
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
2291
+			if ( $search_orderby ) {
2292
+							$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
2293
+			}
2226 2294
 		}
2227 2295
 
2228 2296
 		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
2229 2297
 			$post_type_cap = 'multiple_post_type';
2230 2298
 		} else {
2231
-			if ( is_array( $post_type ) )
2232
-				$post_type = reset( $post_type );
2299
+			if ( is_array( $post_type ) ) {
2300
+							$post_type = reset( $post_type );
2301
+			}
2233 2302
 			$post_type_object = get_post_type_object( $post_type );
2234
-			if ( empty( $post_type_object ) )
2235
-				$post_type_cap = $post_type;
2303
+			if ( empty( $post_type_object ) ) {
2304
+							$post_type_cap = $post_type;
2305
+			}
2236 2306
 		}
2237 2307
 
2238 2308
 		if ( isset( $q['post_password'] ) ) {
@@ -2292,8 +2362,9 @@  discard block
 block discarded – undo
2292 2362
 		if ( ! empty( $q['post_status'] ) ) {
2293 2363
 			$statuswheres = array();
2294 2364
 			$q_status = $q['post_status'];
2295
-			if ( ! is_array( $q_status ) )
2296
-				$q_status = explode(',', $q_status);
2365
+			if ( ! is_array( $q_status ) ) {
2366
+							$q_status = explode(',', $q_status);
2367
+			}
2297 2368
 			$r_status = array();
2298 2369
 			$p_status = array();
2299 2370
 			$e_status = array();
@@ -2353,8 +2424,10 @@  discard block
 block discarded – undo
2353 2424
 			// Add public states.
2354 2425
 			$public_states = get_post_stati( array('public' => true) );
2355 2426
 			foreach ( (array) $public_states as $state ) {
2356
-				if ( 'publish' == $state ) // Publish is hard-coded above.
2427
+				if ( 'publish' == $state ) {
2428
+					// Publish is hard-coded above.
2357 2429
 					continue;
2430
+				}
2358 2431
 				$where .= " OR {$wpdb->posts}.post_status = '$state'";
2359 2432
 			}
2360 2433
 
@@ -2406,8 +2479,9 @@  discard block
 block discarded – undo
2406 2479
 		// Paging
2407 2480
 		if ( empty($q['nopaging']) && !$this->is_singular ) {
2408 2481
 			$page = absint($q['paged']);
2409
-			if ( !$page )
2410
-				$page = 1;
2482
+			if ( !$page ) {
2483
+							$page = 1;
2484
+			}
2411 2485
 
2412 2486
 			// If 'offset' is provided, it takes precedence over 'paged'.
2413 2487
 			if ( isset( $q['offset'] ) && is_numeric( $q['offset'] ) ) {
@@ -2492,8 +2566,9 @@  discard block
 block discarded – undo
2492 2566
 
2493 2567
 			$post_ids = array();
2494 2568
 
2495
-			foreach ( $this->comments as $comment )
2496
-				$post_ids[] = (int) $comment->comment_post_ID;
2569
+			foreach ( $this->comments as $comment ) {
2570
+							$post_ids[] = (int) $comment->comment_post_ID;
2571
+			}
2497 2572
 
2498 2573
 			$post_ids = join(',', $post_ids);
2499 2574
 			$join = '';
@@ -2731,14 +2806,17 @@  discard block
 block discarded – undo
2731 2806
 			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
2732 2807
 		}
2733 2808
 
2734
-		if ( ! empty($groupby) )
2735
-			$groupby = 'GROUP BY ' . $groupby;
2736
-		if ( !empty( $orderby ) )
2737
-			$orderby = 'ORDER BY ' . $orderby;
2809
+		if ( ! empty($groupby) ) {
2810
+					$groupby = 'GROUP BY ' . $groupby;
2811
+		}
2812
+		if ( !empty( $orderby ) ) {
2813
+					$orderby = 'ORDER BY ' . $orderby;
2814
+		}
2738 2815
 
2739 2816
 		$found_rows = '';
2740
-		if ( !$q['no_found_rows'] && !empty($limits) )
2741
-			$found_rows = 'SQL_CALC_FOUND_ROWS';
2817
+		if ( !$q['no_found_rows'] && !empty($limits) ) {
2818
+					$found_rows = 'SQL_CALC_FOUND_ROWS';
2819
+		}
2742 2820
 
2743 2821
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM {$wpdb->posts} $join WHERE 1=1 $where $groupby $orderby $limits";
2744 2822
 
@@ -2915,12 +2993,14 @@  discard block
 block discarded – undo
2915 2993
 							$this->posts = array();
2916 2994
 						} else {
2917 2995
 							$this->is_preview = true;
2918
-							if ( 'future' != $status )
2919
-								$this->posts[0]->post_date = current_time('mysql');
2996
+							if ( 'future' != $status ) {
2997
+															$this->posts[0]->post_date = current_time('mysql');
2998
+							}
2920 2999
 						}
2921 3000
 					} elseif ( $post_status_obj->private ) {
2922
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
2923
-							$this->posts = array();
3001
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID) ) {
3002
+													$this->posts = array();
3003
+						}
2924 3004
 					} else {
2925 3005
 						$this->posts = array();
2926 3006
 					}
@@ -2962,8 +3042,9 @@  discard block
 block discarded – undo
2962 3042
 			}
2963 3043
 
2964 3044
 			// If any posts have been excluded specifically, Ignore those that are sticky.
2965
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
2966
-				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3045
+			if ( !empty($sticky_posts) && !empty($q['post__not_in']) ) {
3046
+							$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3047
+			}
2967 3048
 
2968 3049
 			// Fetch sticky posts that weren't in the query results
2969 3050
 			if ( !empty($sticky_posts) ) {
@@ -3006,8 +3087,9 @@  discard block
 block discarded – undo
3006 3087
 
3007 3088
 			$this->posts = array_map( 'get_post', $this->posts );
3008 3089
 
3009
-			if ( $q['cache_results'] )
3010
-				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3090
+			if ( $q['cache_results'] ) {
3091
+							update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3092
+			}
3011 3093
 
3012 3094
 			$this->post = reset( $this->posts );
3013 3095
 		} else {
@@ -3036,8 +3118,9 @@  discard block
 block discarded – undo
3036 3118
 		global $wpdb;
3037 3119
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3038 3120
 		// null, or false to accommodate caching plugins that fill posts later.
3039
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3040
-			return;
3121
+		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
3122
+					return;
3123
+		}
3041 3124
 
3042 3125
 		if ( ! empty( $limits ) ) {
3043 3126
 			/**
@@ -3063,8 +3146,9 @@  discard block
 block discarded – undo
3063 3146
 		 */
3064 3147
 		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3065 3148
 
3066
-		if ( ! empty( $limits ) )
3067
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3149
+		if ( ! empty( $limits ) ) {
3150
+					$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3151
+		}
3068 3152
 	}
3069 3153
 
3070 3154
 	/**
@@ -3098,7 +3182,8 @@  discard block
 block discarded – undo
3098 3182
 		global $post;
3099 3183
 		$this->in_the_loop = true;
3100 3184
 
3101
-		if ( $this->current_post == -1 ) // loop has just started
3185
+		if ( $this->current_post == -1 ) {
3186
+			// loop has just started
3102 3187
 			/**
3103 3188
 			 * Fires once the loop is started.
3104 3189
 			 *
@@ -3107,6 +3192,7 @@  discard block
 block discarded – undo
3107 3192
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3108 3193
 			 */
3109 3194
 			do_action_ref_array( 'loop_start', array( &$this ) );
3195
+		}
3110 3196
 
3111 3197
 		$post = $this->next_post();
3112 3198
 		$this->setup_postdata( $post );
@@ -3253,8 +3339,9 @@  discard block
 block discarded – undo
3253 3339
 	 * @return object
3254 3340
 	 */
3255 3341
 	public function get_queried_object() {
3256
-		if ( isset($this->queried_object) )
3257
-			return $this->queried_object;
3342
+		if ( isset($this->queried_object) ) {
3343
+					return $this->queried_object;
3344
+		}
3258 3345
 
3259 3346
 		$this->queried_object = null;
3260 3347
 		$this->queried_object_id = null;
@@ -3293,13 +3380,15 @@  discard block
 block discarded – undo
3293 3380
 				$this->queried_object = $term;
3294 3381
 				$this->queried_object_id = (int) $term->term_id;
3295 3382
 
3296
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
3297
-					_make_cat_compat( $this->queried_object );
3383
+				if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
3384
+									_make_cat_compat( $this->queried_object );
3385
+				}
3298 3386
 			}
3299 3387
 		} elseif ( $this->is_post_type_archive ) {
3300 3388
 			$post_type = $this->get( 'post_type' );
3301
-			if ( is_array( $post_type ) )
3302
-				$post_type = reset( $post_type );
3389
+			if ( is_array( $post_type ) ) {
3390
+							$post_type = reset( $post_type );
3391
+			}
3303 3392
 			$this->queried_object = get_post_type_object( $post_type );
3304 3393
 		} elseif ( $this->is_posts_page ) {
3305 3394
 			$page_for_posts = get_option('page_for_posts');
@@ -3419,12 +3508,14 @@  discard block
 block discarded – undo
3419 3508
 	 * @return bool
3420 3509
 	 */
3421 3510
 	public function is_post_type_archive( $post_types = '' ) {
3422
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
3423
-			return (bool) $this->is_post_type_archive;
3511
+		if ( empty( $post_types ) || ! $this->is_post_type_archive ) {
3512
+					return (bool) $this->is_post_type_archive;
3513
+		}
3424 3514
 
3425 3515
 		$post_type = $this->get( 'post_type' );
3426
-		if ( is_array( $post_type ) )
3427
-			$post_type = reset( $post_type );
3516
+		if ( is_array( $post_type ) ) {
3517
+					$post_type = reset( $post_type );
3518
+		}
3428 3519
 		$post_type_object = get_post_type_object( $post_type );
3429 3520
 
3430 3521
 		return in_array( $post_type_object->name, (array) $post_types );
@@ -3473,22 +3564,25 @@  discard block
 block discarded – undo
3473 3564
 	 * @return bool
3474 3565
 	 */
3475 3566
 	public function is_author( $author = '' ) {
3476
-		if ( !$this->is_author )
3477
-			return false;
3567
+		if ( !$this->is_author ) {
3568
+					return false;
3569
+		}
3478 3570
 
3479
-		if ( empty($author) )
3480
-			return true;
3571
+		if ( empty($author) ) {
3572
+					return true;
3573
+		}
3481 3574
 
3482 3575
 		$author_obj = $this->get_queried_object();
3483 3576
 
3484 3577
 		$author = array_map( 'strval', (array) $author );
3485 3578
 
3486
-		if ( in_array( (string) $author_obj->ID, $author ) )
3487
-			return true;
3488
-		elseif ( in_array( $author_obj->nickname, $author ) )
3489
-			return true;
3490
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
3491
-			return true;
3579
+		if ( in_array( (string) $author_obj->ID, $author ) ) {
3580
+					return true;
3581
+		} elseif ( in_array( $author_obj->nickname, $author ) ) {
3582
+					return true;
3583
+		} elseif ( in_array( $author_obj->user_nicename, $author ) ) {
3584
+					return true;
3585
+		}
3492 3586
 
3493 3587
 		return false;
3494 3588
 	}
@@ -3505,22 +3599,25 @@  discard block
 block discarded – undo
3505 3599
 	 * @return bool
3506 3600
 	 */
3507 3601
 	public function is_category( $category = '' ) {
3508
-		if ( !$this->is_category )
3509
-			return false;
3602
+		if ( !$this->is_category ) {
3603
+					return false;
3604
+		}
3510 3605
 
3511
-		if ( empty($category) )
3512
-			return true;
3606
+		if ( empty($category) ) {
3607
+					return true;
3608
+		}
3513 3609
 
3514 3610
 		$cat_obj = $this->get_queried_object();
3515 3611
 
3516 3612
 		$category = array_map( 'strval', (array) $category );
3517 3613
 
3518
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
3519
-			return true;
3520
-		elseif ( in_array( $cat_obj->name, $category ) )
3521
-			return true;
3522
-		elseif ( in_array( $cat_obj->slug, $category ) )
3523
-			return true;
3614
+		if ( in_array( (string) $cat_obj->term_id, $category ) ) {
3615
+					return true;
3616
+		} elseif ( in_array( $cat_obj->name, $category ) ) {
3617
+					return true;
3618
+		} elseif ( in_array( $cat_obj->slug, $category ) ) {
3619
+					return true;
3620
+		}
3524 3621
 
3525 3622
 		return false;
3526 3623
 	}
@@ -3537,22 +3634,25 @@  discard block
 block discarded – undo
3537 3634
 	 * @return bool
3538 3635
 	 */
3539 3636
 	public function is_tag( $tag = '' ) {
3540
-		if ( ! $this->is_tag )
3541
-			return false;
3637
+		if ( ! $this->is_tag ) {
3638
+					return false;
3639
+		}
3542 3640
 
3543
-		if ( empty( $tag ) )
3544
-			return true;
3641
+		if ( empty( $tag ) ) {
3642
+					return true;
3643
+		}
3545 3644
 
3546 3645
 		$tag_obj = $this->get_queried_object();
3547 3646
 
3548 3647
 		$tag = array_map( 'strval', (array) $tag );
3549 3648
 
3550
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
3551
-			return true;
3552
-		elseif ( in_array( $tag_obj->name, $tag ) )
3553
-			return true;
3554
-		elseif ( in_array( $tag_obj->slug, $tag ) )
3555
-			return true;
3649
+		if ( in_array( (string) $tag_obj->term_id, $tag ) ) {
3650
+					return true;
3651
+		} elseif ( in_array( $tag_obj->name, $tag ) ) {
3652
+					return true;
3653
+		} elseif ( in_array( $tag_obj->slug, $tag ) ) {
3654
+					return true;
3655
+		}
3556 3656
 
3557 3657
 		return false;
3558 3658
 	}
@@ -3578,23 +3678,27 @@  discard block
 block discarded – undo
3578 3678
 	public function is_tax( $taxonomy = '', $term = '' ) {
3579 3679
 		global $wp_taxonomies;
3580 3680
 
3581
-		if ( !$this->is_tax )
3582
-			return false;
3681
+		if ( !$this->is_tax ) {
3682
+					return false;
3683
+		}
3583 3684
 
3584
-		if ( empty( $taxonomy ) )
3585
-			return true;
3685
+		if ( empty( $taxonomy ) ) {
3686
+					return true;
3687
+		}
3586 3688
 
3587 3689
 		$queried_object = $this->get_queried_object();
3588 3690
 		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
3589 3691
 		$term_array = (array) $term;
3590 3692
 
3591 3693
 		// Check that the taxonomy matches.
3592
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
3593
-			return false;
3694
+		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {
3695
+					return false;
3696
+		}
3594 3697
 
3595 3698
 		// Only a Taxonomy provided.
3596
-		if ( empty( $term ) )
3597
-			return true;
3699
+		if ( empty( $term ) ) {
3700
+					return true;
3701
+		}
3598 3702
 
3599 3703
 		return isset( $queried_object->term_id ) &&
3600 3704
 			count( array_intersect(
@@ -3648,11 +3752,13 @@  discard block
 block discarded – undo
3648 3752
 	 * @return bool
3649 3753
 	 */
3650 3754
 	public function is_feed( $feeds = '' ) {
3651
-		if ( empty( $feeds ) || ! $this->is_feed )
3652
-			return (bool) $this->is_feed;
3755
+		if ( empty( $feeds ) || ! $this->is_feed ) {
3756
+					return (bool) $this->is_feed;
3757
+		}
3653 3758
 		$qv = $this->get( 'feed' );
3654
-		if ( 'feed' == $qv )
3655
-			$qv = get_default_feed();
3759
+		if ( 'feed' == $qv ) {
3760
+					$qv = get_default_feed();
3761
+		}
3656 3762
 		return in_array( $qv, (array) $feeds );
3657 3763
 	}
3658 3764
 
@@ -3685,12 +3791,13 @@  discard block
 block discarded – undo
3685 3791
 	 */
3686 3792
 	public function is_front_page() {
3687 3793
 		// most likely case
3688
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
3689
-			return true;
3690
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
3691
-			return true;
3692
-		else
3693
-			return false;
3794
+		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() ) {
3795
+					return true;
3796
+		} elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {
3797
+					return true;
3798
+		} else {
3799
+					return false;
3800
+		}
3694 3801
 	}
3695 3802
 
3696 3803
 	/**
@@ -3739,11 +3846,13 @@  discard block
 block discarded – undo
3739 3846
 	 * @return bool Whether the query is for an existing single page.
3740 3847
 	 */
3741 3848
 	public function is_page( $page = '' ) {
3742
-		if ( !$this->is_page )
3743
-			return false;
3849
+		if ( !$this->is_page ) {
3850
+					return false;
3851
+		}
3744 3852
 
3745
-		if ( empty( $page ) )
3746
-			return true;
3853
+		if ( empty( $page ) ) {
3854
+					return true;
3855
+		}
3747 3856
 
3748 3857
 		$page_obj = $this->get_queried_object();
3749 3858
 
@@ -3832,11 +3941,13 @@  discard block
 block discarded – undo
3832 3941
 	 * @return bool Whether the query is for an existing single post.
3833 3942
 	 */
3834 3943
 	public function is_single( $post = '' ) {
3835
-		if ( !$this->is_single )
3836
-			return false;
3944
+		if ( !$this->is_single ) {
3945
+					return false;
3946
+		}
3837 3947
 
3838
-		if ( empty($post) )
3839
-			return true;
3948
+		if ( empty($post) ) {
3949
+					return true;
3950
+		}
3840 3951
 
3841 3952
 		$post_obj = $this->get_queried_object();
3842 3953
 
@@ -3878,8 +3989,9 @@  discard block
 block discarded – undo
3878 3989
 	 * @return bool Whether the query is for an existing single post of any of the given post types.
3879 3990
 	 */
3880 3991
 	public function is_singular( $post_types = '' ) {
3881
-		if ( empty( $post_types ) || !$this->is_singular )
3882
-			return (bool) $this->is_singular;
3992
+		if ( empty( $post_types ) || !$this->is_singular ) {
3993
+					return (bool) $this->is_singular;
3994
+		}
3883 3995
 
3884 3996
 		$post_obj = $this->get_queried_object();
3885 3997
 
@@ -3994,8 +4106,9 @@  discard block
 block discarded – undo
3994 4106
 		$numpages = 1;
3995 4107
 		$multipage = 0;
3996 4108
 		$page = $this->get( 'page' );
3997
-		if ( ! $page )
3998
-			$page = 1;
4109
+		if ( ! $page ) {
4110
+					$page = 1;
4111
+		}
3999 4112
 
4000 4113
 		/*
4001 4114
 		 * Force full post content when viewing the permalink for the $post,
@@ -4016,8 +4129,9 @@  discard block
 block discarded – undo
4016 4129
 			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4017 4130
 
4018 4131
 			// Ignore nextpage at the beginning of the content.
4019
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4020
-				$content = substr( $content, 15 );
4132
+			if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
4133
+							$content = substr( $content, 15 );
4134
+			}
4021 4135
 
4022 4136
 			$pages = explode('<!--nextpage-->', $content);
4023 4137
 		} else {
Please login to merge, or discard this patch.
src/wp-includes/class-wp-text-diff-renderer-table.php 4 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
 	 * @access public
184 184
 	 *
185 185
 	 * @param string $name Property to check if set.
186
-	 * @return bool Whether the property is set.
186
+	 * @return boolean|null Whether the property is set.
187 187
 	 */
188 188
 	public function __isset( $name ) {
189 189
 		if ( in_array( $name, $this->compat_fields ) ) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -169,7 +169,7 @@
 block discarded – undo
169 169
 				 *
170 170
 				 * @param String $processed_line The processed diffed line.
171 171
 				 * @param String $line           The unprocessed diffed line.
172
-		 		 * @param string null            The line context. Values are 'added', 'deleted' or 'unchanged'.
172
+				 * @param string null            The line context. Values are 'added', 'deleted' or 'unchanged'.
173 173
 				 */
174 174
 				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
175 175
 			}
Please login to merge, or discard this patch.
Spacing   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 * @access public
22 22
 	 * @since 2.6.0
23 23
 	 */
24
-	public $_leading_context_lines  = 10000;
24
+	public $_leading_context_lines = 10000;
25 25
 
26 26
 	/**
27 27
 	 * @see Text_Diff_Renderer::_trailing_context_lines
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 	 */
59 59
 	protected $_show_split_view = true;
60 60
 
61
-	protected $compat_fields = array( '_show_split_view', 'inline_diff_renderer', '_diff_threshold' );
61
+	protected $compat_fields = array('_show_split_view', 'inline_diff_renderer', '_diff_threshold');
62 62
 
63 63
 	/**
64 64
 	 * Constructor - Call parent constructor with params array.
@@ -69,10 +69,10 @@  discard block
 block discarded – undo
69 69
 	 *
70 70
 	 * @param array $params
71 71
 	 */
72
-	public function __construct( $params = array() ) {
73
-		parent::__construct( $params );
74
-		if ( isset( $params[ 'show_split_view' ] ) )
75
-			$this->_show_split_view = $params[ 'show_split_view' ];
72
+	public function __construct($params = array()) {
73
+		parent::__construct($params);
74
+		if (isset($params['show_split_view']))
75
+			$this->_show_split_view = $params['show_split_view'];
76 76
 	}
77 77
 
78 78
 	/**
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 	 * @param string $header
82 82
 	 * @return string
83 83
 	 */
84
-	public function _startBlock( $header ) {
84
+	public function _startBlock($header) {
85 85
 		return '';
86 86
 	}
87 87
 
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
 	 * @param array $lines
92 92
 	 * @param string $prefix
93 93
 	 */
94
-	public function _lines( $lines, $prefix=' ' ) {
94
+	public function _lines($lines, $prefix = ' ') {
95 95
 	}
96 96
 
97 97
 	/**
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 	 * @param string $line HTML-escape the value.
101 101
 	 * @return string
102 102
 	 */
103
-	public function addedLine( $line ) {
103
+	public function addedLine($line) {
104 104
 		return "<td class='diff-addedline'>{$line}</td>";
105 105
 
106 106
 	}
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 * @param string $line HTML-escape the value.
112 112
 	 * @return string
113 113
 	 */
114
-	public function deletedLine( $line ) {
114
+	public function deletedLine($line) {
115 115
 		return "<td class='diff-deletedline'>{$line}</td>";
116 116
 	}
117 117
 
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
 	 * @param string $line HTML-escape the value.
122 122
 	 * @return string
123 123
 	 */
124
-	public function contextLine( $line ) {
124
+	public function contextLine($line) {
125 125
 		return "<td class='diff-context'>{$line}</td>";
126 126
 	}
127 127
 
@@ -142,11 +142,11 @@  discard block
 block discarded – undo
142 142
 	 * @param bool $encode
143 143
 	 * @return string
144 144
 	 */
145
-	public function _added( $lines, $encode = true ) {
145
+	public function _added($lines, $encode = true) {
146 146
 		$r = '';
147 147
 		foreach ($lines as $line) {
148
-			if ( $encode ) {
149
-				$processed_line = htmlspecialchars( $line );
148
+			if ($encode) {
149
+				$processed_line = htmlspecialchars($line);
150 150
 
151 151
 				/**
152 152
 				 * Contextually filters a diffed line.
@@ -161,13 +161,13 @@  discard block
 block discarded – undo
161 161
 				 * @param String $line           The unprocessed diffed line.
162 162
 		 		 * @param string null            The line context. Values are 'added', 'deleted' or 'unchanged'.
163 163
 				 */
164
-				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'added' );
164
+				$line = apply_filters('process_text_diff_html', $processed_line, $line, 'added');
165 165
 			}
166 166
 
167
-			if ( $this->_show_split_view ) {
168
-				$r .= '<tr>' . $this->emptyLine() . $this->emptyLine() . $this->addedLine( $line ) . "</tr>\n";
167
+			if ($this->_show_split_view) {
168
+				$r .= '<tr>'.$this->emptyLine().$this->emptyLine().$this->addedLine($line)."</tr>\n";
169 169
 			} else {
170
-				$r .= '<tr>' . $this->addedLine( $line ) . "</tr>\n";
170
+				$r .= '<tr>'.$this->addedLine($line)."</tr>\n";
171 171
 			}
172 172
 		}
173 173
 		return $r;
@@ -181,19 +181,19 @@  discard block
 block discarded – undo
181 181
 	 * @param bool $encode
182 182
 	 * @return string
183 183
 	 */
184
-	public function _deleted( $lines, $encode = true ) {
184
+	public function _deleted($lines, $encode = true) {
185 185
 		$r = '';
186 186
 		foreach ($lines as $line) {
187
-			if ( $encode ) {
188
-				$processed_line = htmlspecialchars( $line );
187
+			if ($encode) {
188
+				$processed_line = htmlspecialchars($line);
189 189
 
190 190
 				/** This filter is documented in wp-includes/wp-diff.php */
191
-				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'deleted' );
191
+				$line = apply_filters('process_text_diff_html', $processed_line, $line, 'deleted');
192 192
 			}
193
-			if ( $this->_show_split_view ) {
194
-				$r .= '<tr>' . $this->deletedLine( $line ) . $this->emptyLine() . $this->emptyLine() . "</tr>\n";
193
+			if ($this->_show_split_view) {
194
+				$r .= '<tr>'.$this->deletedLine($line).$this->emptyLine().$this->emptyLine()."</tr>\n";
195 195
 			} else {
196
-				$r .= '<tr>' . $this->deletedLine( $line ) . "</tr>\n";
196
+				$r .= '<tr>'.$this->deletedLine($line)."</tr>\n";
197 197
 			}
198 198
 
199 199
 		}
@@ -208,19 +208,19 @@  discard block
 block discarded – undo
208 208
 	 * @param bool $encode
209 209
 	 * @return string
210 210
 	 */
211
-	public function _context( $lines, $encode = true ) {
211
+	public function _context($lines, $encode = true) {
212 212
 		$r = '';
213 213
 		foreach ($lines as $line) {
214
-			if ( $encode ) {
215
-				$processed_line = htmlspecialchars( $line );
214
+			if ($encode) {
215
+				$processed_line = htmlspecialchars($line);
216 216
 
217 217
 				/** This filter is documented in wp-includes/wp-diff.php */
218
-				$line = apply_filters( 'process_text_diff_html', $processed_line, $line, 'unchanged' );
218
+				$line = apply_filters('process_text_diff_html', $processed_line, $line, 'unchanged');
219 219
 			}
220
-			if (  $this->_show_split_view ) {
221
-				$r .= '<tr>' . $this->contextLine( $line ) . $this->emptyLine() . $this->contextLine( $line )  . "</tr>\n";
220
+			if ($this->_show_split_view) {
221
+				$r .= '<tr>'.$this->contextLine($line).$this->emptyLine().$this->contextLine($line)."</tr>\n";
222 222
 			} else {
223
-				$r .= '<tr>' . $this->contextLine( $line ) . "</tr>\n";
223
+				$r .= '<tr>'.$this->contextLine($line)."</tr>\n";
224 224
 			}
225 225
 		}
226 226
 		return $r;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 	 * @param array $final
240 240
 	 * @return string
241 241
 	 */
242
-	public function _changed( $orig, $final ) {
242
+	public function _changed($orig, $final) {
243 243
 		$r = '';
244 244
 
245 245
 		// Does the aforementioned additional processing
@@ -249,66 +249,66 @@  discard block
 block discarded – undo
249 249
 		// *_rows are column vectors for the orig column and the final column.
250 250
 		//	row >= 0: an indix of the $orig or $final array
251 251
 		//	row  < 0: a blank row for that column
252
-		list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines( $orig, $final );
252
+		list($orig_matches, $final_matches, $orig_rows, $final_rows) = $this->interleave_changed_lines($orig, $final);
253 253
 
254 254
 		// These will hold the word changes as determined by an inline diff
255 255
 		$orig_diffs  = array();
256 256
 		$final_diffs = array();
257 257
 
258 258
 		// Compute word diffs for each matched pair using the inline diff
259
-		foreach ( $orig_matches as $o => $f ) {
260
-			if ( is_numeric($o) && is_numeric($f) ) {
261
-				$text_diff = new Text_Diff( 'auto', array( array($orig[$o]), array($final[$f]) ) );
259
+		foreach ($orig_matches as $o => $f) {
260
+			if (is_numeric($o) && is_numeric($f)) {
261
+				$text_diff = new Text_Diff('auto', array(array($orig[$o]), array($final[$f])));
262 262
 				$renderer = new $this->inline_diff_renderer;
263
-				$diff = $renderer->render( $text_diff );
263
+				$diff = $renderer->render($text_diff);
264 264
 
265 265
 				// If they're too different, don't include any <ins> or <dels>
266
-				if ( preg_match_all( '!(<ins>.*?</ins>|<del>.*?</del>)!', $diff, $diff_matches ) ) {
266
+				if (preg_match_all('!(<ins>.*?</ins>|<del>.*?</del>)!', $diff, $diff_matches)) {
267 267
 					// length of all text between <ins> or <del>
268
-					$stripped_matches = strlen(strip_tags( join(' ', $diff_matches[0]) ));
268
+					$stripped_matches = strlen(strip_tags(join(' ', $diff_matches[0])));
269 269
 					// since we count lengith of text between <ins> or <del> (instead of picking just one),
270 270
 					//	we double the length of chars not in those tags.
271
-					$stripped_diff = strlen(strip_tags( $diff )) * 2 - $stripped_matches;
271
+					$stripped_diff = strlen(strip_tags($diff)) * 2 - $stripped_matches;
272 272
 					$diff_ratio = $stripped_matches / $stripped_diff;
273
-					if ( $diff_ratio > $this->_diff_threshold )
273
+					if ($diff_ratio > $this->_diff_threshold)
274 274
 						continue; // Too different. Don't save diffs.
275 275
 				}
276 276
 
277 277
 				// Un-inline the diffs by removing del or ins
278
-				$orig_diffs[$o]  = preg_replace( '|<ins>.*?</ins>|', '', $diff );
279
-				$final_diffs[$f] = preg_replace( '|<del>.*?</del>|', '', $diff );
278
+				$orig_diffs[$o]  = preg_replace('|<ins>.*?</ins>|', '', $diff);
279
+				$final_diffs[$f] = preg_replace('|<del>.*?</del>|', '', $diff);
280 280
 			}
281 281
 		}
282 282
 
283
-		foreach ( array_keys($orig_rows) as $row ) {
283
+		foreach (array_keys($orig_rows) as $row) {
284 284
 			// Both columns have blanks. Ignore them.
285
-			if ( $orig_rows[$row] < 0 && $final_rows[$row] < 0 )
285
+			if ($orig_rows[$row] < 0 && $final_rows[$row] < 0)
286 286
 				continue;
287 287
 
288 288
 			// If we have a word based diff, use it. Otherwise, use the normal line.
289
-			if ( isset( $orig_diffs[$orig_rows[$row]] ) )
289
+			if (isset($orig_diffs[$orig_rows[$row]]))
290 290
 				$orig_line = $orig_diffs[$orig_rows[$row]];
291
-			elseif ( isset( $orig[$orig_rows[$row]] ) )
291
+			elseif (isset($orig[$orig_rows[$row]]))
292 292
 				$orig_line = htmlspecialchars($orig[$orig_rows[$row]]);
293 293
 			else
294 294
 				$orig_line = '';
295 295
 
296
-			if ( isset( $final_diffs[$final_rows[$row]] ) )
296
+			if (isset($final_diffs[$final_rows[$row]]))
297 297
 				$final_line = $final_diffs[$final_rows[$row]];
298
-			elseif ( isset( $final[$final_rows[$row]] ) )
298
+			elseif (isset($final[$final_rows[$row]]))
299 299
 				$final_line = htmlspecialchars($final[$final_rows[$row]]);
300 300
 			else
301 301
 				$final_line = '';
302 302
 
303
-			if ( $orig_rows[$row] < 0 ) { // Orig is blank. This is really an added row.
304
-				$r .= $this->_added( array($final_line), false );
305
-			} elseif ( $final_rows[$row] < 0 ) { // Final is blank. This is really a deleted row.
306
-				$r .= $this->_deleted( array($orig_line), false );
303
+			if ($orig_rows[$row] < 0) { // Orig is blank. This is really an added row.
304
+				$r .= $this->_added(array($final_line), false);
305
+			} elseif ($final_rows[$row] < 0) { // Final is blank. This is really a deleted row.
306
+				$r .= $this->_deleted(array($orig_line), false);
307 307
 			} else { // A true changed row.
308
-				if ( $this->_show_split_view ) {
309
-					$r .= '<tr>' . $this->deletedLine( $orig_line ) . $this->emptyLine() . $this->addedLine( $final_line ) . "</tr>\n";
308
+				if ($this->_show_split_view) {
309
+					$r .= '<tr>'.$this->deletedLine($orig_line).$this->emptyLine().$this->addedLine($final_line)."</tr>\n";
310 310
 				} else {
311
-					$r .= '<tr>' . $this->deletedLine( $orig_line ) . "</tr><tr>" . $this->addedLine( $final_line ) . "</tr>\n";
311
+					$r .= '<tr>'.$this->deletedLine($orig_line)."</tr><tr>".$this->addedLine($final_line)."</tr>\n";
312 312
 				}
313 313
 			}
314 314
 		}
@@ -330,13 +330,13 @@  discard block
 block discarded – undo
330 330
 	 * @param array $final
331 331
 	 * @return array
332 332
 	 */
333
-	public function interleave_changed_lines( $orig, $final ) {
333
+	public function interleave_changed_lines($orig, $final) {
334 334
 
335 335
 		// Contains all pairwise string comparisons. Keys are such that this need only be a one dimensional array.
336 336
 		$matches = array();
337
-		foreach ( array_keys($orig) as $o ) {
338
-			foreach ( array_keys($final) as $f ) {
339
-				$matches["$o,$f"] = $this->compute_string_distance( $orig[$o], $final[$f] );
337
+		foreach (array_keys($orig) as $o) {
338
+			foreach (array_keys($final) as $f) {
339
+				$matches["$o,$f"] = $this->compute_string_distance($orig[$o], $final[$f]);
340 340
 			}
341 341
 		}
342 342
 		asort($matches); // Order by string distance.
@@ -344,28 +344,28 @@  discard block
 block discarded – undo
344 344
 		$orig_matches  = array();
345 345
 		$final_matches = array();
346 346
 
347
-		foreach ( $matches as $keys => $difference ) {
347
+		foreach ($matches as $keys => $difference) {
348 348
 			list($o, $f) = explode(',', $keys);
349 349
 			$o = (int) $o;
350 350
 			$f = (int) $f;
351 351
 
352 352
 			// Already have better matches for these guys
353
-			if ( isset($orig_matches[$o]) && isset($final_matches[$f]) )
353
+			if (isset($orig_matches[$o]) && isset($final_matches[$f]))
354 354
 				continue;
355 355
 
356 356
 			// First match for these guys. Must be best match
357
-			if ( !isset($orig_matches[$o]) && !isset($final_matches[$f]) ) {
357
+			if ( ! isset($orig_matches[$o]) && ! isset($final_matches[$f])) {
358 358
 				$orig_matches[$o] = $f;
359 359
 				$final_matches[$f] = $o;
360 360
 				continue;
361 361
 			}
362 362
 
363 363
 			// Best match of this final is already taken?  Must mean this final is a new row.
364
-			if ( isset($orig_matches[$o]) )
364
+			if (isset($orig_matches[$o]))
365 365
 				$final_matches[$f] = 'x';
366 366
 
367 367
 			// Best match of this orig is already taken?  Must mean this orig is a deleted row.
368
-			elseif ( isset($final_matches[$f]) )
368
+			elseif (isset($final_matches[$f]))
369 369
 				$orig_matches[$o] = 'x';
370 370
 		}
371 371
 
@@ -379,31 +379,31 @@  discard block
 block discarded – undo
379 379
 
380 380
 		// Interleaves rows with blanks to keep matches aligned.
381 381
 		// We may end up with some extraneous blank rows, but we'll just ignore them later.
382
-		foreach ( $orig_rows_copy as $orig_row ) {
382
+		foreach ($orig_rows_copy as $orig_row) {
383 383
 			$final_pos = array_search($orig_matches[$orig_row], $final_rows, true);
384 384
 			$orig_pos = (int) array_search($orig_row, $orig_rows, true);
385 385
 
386
-			if ( false === $final_pos ) { // This orig is paired with a blank final.
387
-				array_splice( $final_rows, $orig_pos, 0, -1 );
388
-			} elseif ( $final_pos < $orig_pos ) { // This orig's match is up a ways. Pad final with blank rows.
386
+			if (false === $final_pos) { // This orig is paired with a blank final.
387
+				array_splice($final_rows, $orig_pos, 0, -1);
388
+			} elseif ($final_pos < $orig_pos) { // This orig's match is up a ways. Pad final with blank rows.
389 389
 				$diff_pos = $final_pos - $orig_pos;
390
-				while ( $diff_pos < 0 )
391
-					array_splice( $final_rows, $orig_pos, 0, $diff_pos++ );
392
-			} elseif ( $final_pos > $orig_pos ) { // This orig's match is down a ways. Pad orig with blank rows.
390
+				while ($diff_pos < 0)
391
+					array_splice($final_rows, $orig_pos, 0, $diff_pos++);
392
+			} elseif ($final_pos > $orig_pos) { // This orig's match is down a ways. Pad orig with blank rows.
393 393
 				$diff_pos = $orig_pos - $final_pos;
394
-				while ( $diff_pos < 0 )
395
-					array_splice( $orig_rows, $orig_pos, 0, $diff_pos++ );
394
+				while ($diff_pos < 0)
395
+					array_splice($orig_rows, $orig_pos, 0, $diff_pos++);
396 396
 			}
397 397
 		}
398 398
 
399 399
 		// Pad the ends with blank rows if the columns aren't the same length
400 400
 		$diff_count = count($orig_rows) - count($final_rows);
401
-		if ( $diff_count < 0 ) {
402
-			while ( $diff_count < 0 )
401
+		if ($diff_count < 0) {
402
+			while ($diff_count < 0)
403 403
 				array_push($orig_rows, $diff_count++);
404
-		} elseif ( $diff_count > 0 ) {
404
+		} elseif ($diff_count > 0) {
405 405
 			$diff_count = -1 * $diff_count;
406
-			while ( $diff_count < 0 )
406
+			while ($diff_count < 0)
407 407
 				array_push($final_rows, $diff_count++);
408 408
 		}
409 409
 
@@ -419,16 +419,16 @@  discard block
 block discarded – undo
419 419
 	 * @param string $string2
420 420
 	 * @return int
421 421
 	 */
422
-	public function compute_string_distance( $string1, $string2 ) {
422
+	public function compute_string_distance($string1, $string2) {
423 423
 		// Vectors containing character frequency for all chars in each string
424 424
 		$chars1 = count_chars($string1);
425 425
 		$chars2 = count_chars($string2);
426 426
 
427 427
 		// L1-norm of difference vector.
428
-		$difference = array_sum( array_map( array($this, 'difference'), $chars1, $chars2 ) );
428
+		$difference = array_sum(array_map(array($this, 'difference'), $chars1, $chars2));
429 429
 
430 430
 		// $string1 has zero length? Odd. Give huge penalty by not dividing.
431
-		if ( !$string1 )
431
+		if ( ! $string1)
432 432
 			return $difference;
433 433
 
434 434
 		// Return distance per character (of string1).
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 	 * @param int $b
444 444
 	 * @return int
445 445
 	 */
446
-	public function difference( $a, $b ) {
447
-		return abs( $a - $b );
446
+	public function difference($a, $b) {
447
+		return abs($a - $b);
448 448
 	}
449 449
 
450 450
 	/**
@@ -456,8 +456,8 @@  discard block
 block discarded – undo
456 456
 	 * @param string $name Property to get.
457 457
 	 * @return mixed Property.
458 458
 	 */
459
-	public function __get( $name ) {
460
-		if ( in_array( $name, $this->compat_fields ) ) {
459
+	public function __get($name) {
460
+		if (in_array($name, $this->compat_fields)) {
461 461
 			return $this->$name;
462 462
 		}
463 463
 	}
@@ -472,8 +472,8 @@  discard block
 block discarded – undo
472 472
 	 * @param mixed  $value Property value.
473 473
 	 * @return mixed Newly-set property.
474 474
 	 */
475
-	public function __set( $name, $value ) {
476
-		if ( in_array( $name, $this->compat_fields ) ) {
475
+	public function __set($name, $value) {
476
+		if (in_array($name, $this->compat_fields)) {
477 477
 			return $this->$name = $value;
478 478
 		}
479 479
 	}
@@ -487,9 +487,9 @@  discard block
 block discarded – undo
487 487
 	 * @param string $name Property to check if set.
488 488
 	 * @return bool Whether the property is set.
489 489
 	 */
490
-	public function __isset( $name ) {
491
-		if ( in_array( $name, $this->compat_fields ) ) {
492
-			return isset( $this->$name );
490
+	public function __isset($name) {
491
+		if (in_array($name, $this->compat_fields)) {
492
+			return isset($this->$name);
493 493
 		}
494 494
 	}
495 495
 
@@ -501,9 +501,9 @@  discard block
 block discarded – undo
501 501
 	 *
502 502
 	 * @param string $name Property to unset.
503 503
 	 */
504
-	public function __unset( $name ) {
505
-		if ( in_array( $name, $this->compat_fields ) ) {
506
-			unset( $this->$name );
504
+	public function __unset($name) {
505
+		if (in_array($name, $this->compat_fields)) {
506
+			unset($this->$name);
507 507
 		}
508 508
 	}
509 509
 }
Please login to merge, or discard this patch.
Braces   +49 added lines, -35 removed lines patch added patch discarded remove patch
@@ -81,8 +81,9 @@  discard block
 block discarded – undo
81 81
 	 */
82 82
 	public function __construct( $params = array() ) {
83 83
 		parent::__construct( $params );
84
-		if ( isset( $params[ 'show_split_view' ] ) )
85
-			$this->_show_split_view = $params[ 'show_split_view' ];
84
+		if ( isset( $params[ 'show_split_view' ] ) ) {
85
+					$this->_show_split_view = $params[ 'show_split_view' ];
86
+		}
86 87
 	}
87 88
 
88 89
 	/**
@@ -280,8 +281,10 @@  discard block
 block discarded – undo
280 281
 					//	we double the length of chars not in those tags.
281 282
 					$stripped_diff = strlen(strip_tags( $diff )) * 2 - $stripped_matches;
282 283
 					$diff_ratio = $stripped_matches / $stripped_diff;
283
-					if ( $diff_ratio > $this->_diff_threshold )
284
-						continue; // Too different. Don't save diffs.
284
+					if ( $diff_ratio > $this->_diff_threshold ) {
285
+											continue;
286
+					}
287
+					// Too different. Don't save diffs.
285 288
 				}
286 289
 
287 290
 				// Un-inline the diffs by removing del or ins
@@ -292,23 +295,26 @@  discard block
 block discarded – undo
292 295
 
293 296
 		foreach ( array_keys($orig_rows) as $row ) {
294 297
 			// Both columns have blanks. Ignore them.
295
-			if ( $orig_rows[$row] < 0 && $final_rows[$row] < 0 )
296
-				continue;
298
+			if ( $orig_rows[$row] < 0 && $final_rows[$row] < 0 ) {
299
+							continue;
300
+			}
297 301
 
298 302
 			// If we have a word based diff, use it. Otherwise, use the normal line.
299
-			if ( isset( $orig_diffs[$orig_rows[$row]] ) )
300
-				$orig_line = $orig_diffs[$orig_rows[$row]];
301
-			elseif ( isset( $orig[$orig_rows[$row]] ) )
302
-				$orig_line = htmlspecialchars($orig[$orig_rows[$row]]);
303
-			else
304
-				$orig_line = '';
305
-
306
-			if ( isset( $final_diffs[$final_rows[$row]] ) )
307
-				$final_line = $final_diffs[$final_rows[$row]];
308
-			elseif ( isset( $final[$final_rows[$row]] ) )
309
-				$final_line = htmlspecialchars($final[$final_rows[$row]]);
310
-			else
311
-				$final_line = '';
303
+			if ( isset( $orig_diffs[$orig_rows[$row]] ) ) {
304
+							$orig_line = $orig_diffs[$orig_rows[$row]];
305
+			} elseif ( isset( $orig[$orig_rows[$row]] ) ) {
306
+							$orig_line = htmlspecialchars($orig[$orig_rows[$row]]);
307
+			} else {
308
+							$orig_line = '';
309
+			}
310
+
311
+			if ( isset( $final_diffs[$final_rows[$row]] ) ) {
312
+							$final_line = $final_diffs[$final_rows[$row]];
313
+			} elseif ( isset( $final[$final_rows[$row]] ) ) {
314
+							$final_line = htmlspecialchars($final[$final_rows[$row]]);
315
+			} else {
316
+							$final_line = '';
317
+			}
312 318
 
313 319
 			if ( $orig_rows[$row] < 0 ) { // Orig is blank. This is really an added row.
314 320
 				$r .= $this->_added( array($final_line), false );
@@ -360,8 +366,9 @@  discard block
 block discarded – undo
360 366
 			$f = (int) $f;
361 367
 
362 368
 			// Already have better matches for these guys
363
-			if ( isset($orig_matches[$o]) && isset($final_matches[$f]) )
364
-				continue;
369
+			if ( isset($orig_matches[$o]) && isset($final_matches[$f]) ) {
370
+							continue;
371
+			}
365 372
 
366 373
 			// First match for these guys. Must be best match
367 374
 			if ( !isset($orig_matches[$o]) && !isset($final_matches[$f]) ) {
@@ -371,12 +378,14 @@  discard block
 block discarded – undo
371 378
 			}
372 379
 
373 380
 			// Best match of this final is already taken?  Must mean this final is a new row.
374
-			if ( isset($orig_matches[$o]) )
375
-				$final_matches[$f] = 'x';
381
+			if ( isset($orig_matches[$o]) ) {
382
+							$final_matches[$f] = 'x';
383
+			}
376 384
 
377 385
 			// Best match of this orig is already taken?  Must mean this orig is a deleted row.
378
-			elseif ( isset($final_matches[$f]) )
379
-				$orig_matches[$o] = 'x';
386
+			elseif ( isset($final_matches[$f]) ) {
387
+							$orig_matches[$o] = 'x';
388
+			}
380 389
 		}
381 390
 
382 391
 		// We read the text in this order
@@ -397,24 +406,28 @@  discard block
 block discarded – undo
397 406
 				array_splice( $final_rows, $orig_pos, 0, -1 );
398 407
 			} elseif ( $final_pos < $orig_pos ) { // This orig's match is up a ways. Pad final with blank rows.
399 408
 				$diff_pos = $final_pos - $orig_pos;
400
-				while ( $diff_pos < 0 )
401
-					array_splice( $final_rows, $orig_pos, 0, $diff_pos++ );
409
+				while ( $diff_pos < 0 ) {
410
+									array_splice( $final_rows, $orig_pos, 0, $diff_pos++ );
411
+				}
402 412
 			} elseif ( $final_pos > $orig_pos ) { // This orig's match is down a ways. Pad orig with blank rows.
403 413
 				$diff_pos = $orig_pos - $final_pos;
404
-				while ( $diff_pos < 0 )
405
-					array_splice( $orig_rows, $orig_pos, 0, $diff_pos++ );
414
+				while ( $diff_pos < 0 ) {
415
+									array_splice( $orig_rows, $orig_pos, 0, $diff_pos++ );
416
+				}
406 417
 			}
407 418
 		}
408 419
 
409 420
 		// Pad the ends with blank rows if the columns aren't the same length
410 421
 		$diff_count = count($orig_rows) - count($final_rows);
411 422
 		if ( $diff_count < 0 ) {
412
-			while ( $diff_count < 0 )
413
-				array_push($orig_rows, $diff_count++);
423
+			while ( $diff_count < 0 ) {
424
+							array_push($orig_rows, $diff_count++);
425
+			}
414 426
 		} elseif ( $diff_count > 0 ) {
415 427
 			$diff_count = -1 * $diff_count;
416
-			while ( $diff_count < 0 )
417
-				array_push($final_rows, $diff_count++);
428
+			while ( $diff_count < 0 ) {
429
+							array_push($final_rows, $diff_count++);
430
+			}
418 431
 		}
419 432
 
420 433
 		return array($orig_matches, $final_matches, $orig_rows, $final_rows);
@@ -438,8 +451,9 @@  discard block
 block discarded – undo
438 451
 		$difference = array_sum( array_map( array($this, 'difference'), $chars1, $chars2 ) );
439 452
 
440 453
 		// $string1 has zero length? Odd. Give huge penalty by not dividing.
441
-		if ( !$string1 )
442
-			return $difference;
454
+		if ( !$string1 ) {
455
+					return $difference;
456
+		}
443 457
 
444 458
 		// Return distance per character (of string1).
445 459
 		return $difference / strlen($string1);
Please login to merge, or discard this patch.
src/wp-includes/comment.php 3 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
  * @param bool   $avoid_die When true, a disallowed comment will result in the function
797 797
  *                          returning a WP_Error object, rather than executing wp_die().
798 798
  *                          Default false.
799
- * @return bool Whether comment flooding is occurring.
799
+ * @return boolean|null Whether comment flooding is occurring.
800 800
  */
801 801
 function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
802 802
 
@@ -1636,7 +1636,7 @@  discard block
 block discarded – undo
1636 1636
  *
1637 1637
  * @since 2.0.4
1638 1638
  *
1639
- * @return array Comment author, email, url respectively.
1639
+ * @return string Comment author, email, url respectively.
1640 1640
  */
1641 1641
 function wp_get_current_commenter() {
1642 1642
 	// Cookies should already be sanitized.
@@ -2830,7 +2830,7 @@  discard block
 block discarded – undo
2830 2830
  *
2831 2831
  * @param WP_Post  $posts Post data object.
2832 2832
  * @param WP_Query $query Query object.
2833
- * @return array
2833
+ * @return WP_Post
2834 2834
  */
2835 2835
 function _close_comments_for_old_posts( $posts, $query ) {
2836 2836
 	if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
Please login to merge, or discard this patch.
Spacing   +564 added lines, -564 removed lines patch added patch discarded remove patch
@@ -40,15 +40,15 @@  discard block
 block discarded – undo
40 40
 	global $wpdb;
41 41
 
42 42
 	// If manual moderation is enabled, skip all checks and return false.
43
-	if ( 1 == get_option('comment_moderation') )
43
+	if (1 == get_option('comment_moderation'))
44 44
 		return false;
45 45
 
46 46
 	/** This filter is documented in wp-includes/comment-template.php */
47
-	$comment = apply_filters( 'comment_text', $comment );
47
+	$comment = apply_filters('comment_text', $comment);
48 48
 
49 49
 	// Check for the number of external links if a max allowed number is set.
50
-	if ( $max_links = get_option( 'comment_max_links' ) ) {
51
-		$num_links = preg_match_all( '/<a [^>]*href/i', $comment, $out );
50
+	if ($max_links = get_option('comment_max_links')) {
51
+		$num_links = preg_match_all('/<a [^>]*href/i', $comment, $out);
52 52
 
53 53
 		/**
54 54
 		 * Filters the number of links found in a comment.
@@ -60,27 +60,27 @@  discard block
 block discarded – undo
60 60
 		 * @param string $url       Comment author's URL. Included in allowed links total.
61 61
 		 * @param string $comment   Content of the comment.
62 62
 		 */
63
-		$num_links = apply_filters( 'comment_max_links_url', $num_links, $url, $comment );
63
+		$num_links = apply_filters('comment_max_links_url', $num_links, $url, $comment);
64 64
 
65 65
 		/*
66 66
 		 * If the number of links in the comment exceeds the allowed amount,
67 67
 		 * fail the check by returning false.
68 68
 		 */
69
-		if ( $num_links >= $max_links )
69
+		if ($num_links >= $max_links)
70 70
 			return false;
71 71
 	}
72 72
 
73 73
 	$mod_keys = trim(get_option('moderation_keys'));
74 74
 
75 75
 	// If moderation 'keys' (keywords) are set, process them.
76
-	if ( !empty($mod_keys) ) {
77
-		$words = explode("\n", $mod_keys );
76
+	if ( ! empty($mod_keys)) {
77
+		$words = explode("\n", $mod_keys);
78 78
 
79
-		foreach ( (array) $words as $word) {
79
+		foreach ((array) $words as $word) {
80 80
 			$word = trim($word);
81 81
 
82 82
 			// Skip empty lines.
83
-			if ( empty($word) )
83
+			if (empty($word))
84 84
 				continue;
85 85
 
86 86
 			/*
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 			 * fail the check for the given field by returning false.
95 95
 			 */
96 96
 			$pattern = "#$word#i";
97
-			if ( preg_match($pattern, $author) ) return false;
98
-			if ( preg_match($pattern, $email) ) return false;
99
-			if ( preg_match($pattern, $url) ) return false;
100
-			if ( preg_match($pattern, $comment) ) return false;
101
-			if ( preg_match($pattern, $user_ip) ) return false;
102
-			if ( preg_match($pattern, $user_agent) ) return false;
97
+			if (preg_match($pattern, $author)) return false;
98
+			if (preg_match($pattern, $email)) return false;
99
+			if (preg_match($pattern, $url)) return false;
100
+			if (preg_match($pattern, $comment)) return false;
101
+			if (preg_match($pattern, $user_ip)) return false;
102
+			if (preg_match($pattern, $user_agent)) return false;
103 103
 		}
104 104
 	}
105 105
 
@@ -110,17 +110,17 @@  discard block
 block discarded – undo
110 110
 	 * as well as whether there are any moderation keywords (if set) present in the author
111 111
 	 * email address. If both checks pass, return true. Otherwise, return false.
112 112
 	 */
113
-	if ( 1 == get_option('comment_whitelist')) {
114
-		if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) {
115
-			$comment_user = get_user_by( 'email', wp_unslash( $email ) );
116
-			if ( ! empty( $comment_user->ID ) ) {
117
-				$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID ) );
113
+	if (1 == get_option('comment_whitelist')) {
114
+		if ('trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '') {
115
+			$comment_user = get_user_by('email', wp_unslash($email));
116
+			if ( ! empty($comment_user->ID)) {
117
+				$ok_to_comment = $wpdb->get_var($wpdb->prepare("SELECT comment_approved FROM $wpdb->comments WHERE user_id = %d AND comment_approved = '1' LIMIT 1", $comment_user->ID));
118 118
 			} else {
119 119
 				// expected_slashed ($author, $email)
120
-				$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) );
120
+				$ok_to_comment = $wpdb->get_var($wpdb->prepare("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email));
121 121
 			}
122
-			if ( ( 1 == $ok_to_comment ) &&
123
-				( empty($mod_keys) || false === strpos( $email, $mod_keys) ) )
122
+			if ((1 == $ok_to_comment) &&
123
+				(empty($mod_keys) || false === strpos($email, $mod_keys)))
124 124
 					return true;
125 125
 			else
126 126
 				return false;
@@ -142,8 +142,8 @@  discard block
 block discarded – undo
142 142
  * @return int|array $comments The approved comments, or number of comments if `$count`
143 143
  *                             argument is true.
144 144
  */
145
-function get_approved_comments( $post_id, $args = array() ) {
146
-	if ( ! $post_id ) {
145
+function get_approved_comments($post_id, $args = array()) {
146
+	if ( ! $post_id) {
147 147
 		return array();
148 148
 	}
149 149
 
@@ -152,10 +152,10 @@  discard block
 block discarded – undo
152 152
 		'post_id' => $post_id,
153 153
 		'order'   => 'ASC',
154 154
 	);
155
-	$r = wp_parse_args( $args, $defaults );
155
+	$r = wp_parse_args($args, $defaults);
156 156
 
157 157
 	$query = new WP_Comment_Query;
158
-	return $query->query( $r );
158
+	return $query->query($r);
159 159
 }
160 160
 
161 161
 /**
@@ -174,20 +174,20 @@  discard block
 block discarded – undo
174 174
  *                                       a WP_Comment object, an associative array, or a numeric array, respectively. Default OBJECT.
175 175
  * @return WP_Comment|array|null Depends on $output value.
176 176
  */
177
-function get_comment( &$comment = null, $output = OBJECT ) {
178
-	if ( empty( $comment ) && isset( $GLOBALS['comment'] ) ) {
177
+function get_comment(&$comment = null, $output = OBJECT) {
178
+	if (empty($comment) && isset($GLOBALS['comment'])) {
179 179
 		$comment = $GLOBALS['comment'];
180 180
 	}
181 181
 
182
-	if ( $comment instanceof WP_Comment ) {
182
+	if ($comment instanceof WP_Comment) {
183 183
 		$_comment = $comment;
184
-	} elseif ( is_object( $comment ) ) {
185
-		$_comment = new WP_Comment( $comment );
184
+	} elseif (is_object($comment)) {
185
+		$_comment = new WP_Comment($comment);
186 186
 	} else {
187
-		$_comment = WP_Comment::get_instance( $comment );
187
+		$_comment = WP_Comment::get_instance($comment);
188 188
 	}
189 189
 
190
-	if ( ! $_comment ) {
190
+	if ( ! $_comment) {
191 191
 		return null;
192 192
 	}
193 193
 
@@ -198,14 +198,14 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @param mixed $_comment Comment data.
200 200
 	 */
201
-	$_comment = apply_filters( 'get_comment', $_comment );
201
+	$_comment = apply_filters('get_comment', $_comment);
202 202
 
203
-	if ( $output == OBJECT ) {
203
+	if ($output == OBJECT) {
204 204
 		return $_comment;
205
-	} elseif ( $output == ARRAY_A ) {
205
+	} elseif ($output == ARRAY_A) {
206 206
 		return $_comment->to_array();
207
-	} elseif ( $output == ARRAY_N ) {
208
-		return array_values( $_comment->to_array() );
207
+	} elseif ($output == ARRAY_N) {
208
+		return array_values($_comment->to_array());
209 209
 	}
210 210
 	return $_comment;
211 211
 }
@@ -221,9 +221,9 @@  discard block
 block discarded – undo
221 221
  *                           for information on accepted arguments. Default empty.
222 222
  * @return int|array List of comments or number of found comments if `$count` argument is true.
223 223
  */
224
-function get_comments( $args = '' ) {
224
+function get_comments($args = '') {
225 225
 	$query = new WP_Comment_Query;
226
-	return $query->query( $args );
226
+	return $query->query($args);
227 227
 }
228 228
 
229 229
 /**
@@ -238,10 +238,10 @@  discard block
 block discarded – undo
238 238
  */
239 239
 function get_comment_statuses() {
240 240
 	$status = array(
241
-		'hold'		=> __( 'Unapproved' ),
242
-		'approve'	=> _x( 'Approved', 'comment status' ),
243
-		'spam'		=> _x( 'Spam', 'comment status' ),
244
-		'trash'		=> _x( 'Trash', 'comment status' ),
241
+		'hold'		=> __('Unapproved'),
242
+		'approve'	=> _x('Approved', 'comment status'),
243
+		'spam'		=> _x('Spam', 'comment status'),
244
+		'trash'		=> _x('Trash', 'comment status'),
245 245
 	);
246 246
 
247 247
 	return $status;
@@ -256,8 +256,8 @@  discard block
 block discarded – undo
256 256
  * @param string $comment_type Optional. Comment type. Default 'comment'.
257 257
  * @return string Expected return value is 'open' or 'closed'.
258 258
  */
259
-function get_default_comment_status( $post_type = 'post', $comment_type = 'comment' ) {
260
-	switch ( $comment_type ) {
259
+function get_default_comment_status($post_type = 'post', $comment_type = 'comment') {
260
+	switch ($comment_type) {
261 261
 		case 'pingback' :
262 262
 		case 'trackback' :
263 263
 			$supports = 'trackbacks';
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
 	}
270 270
 
271 271
 	// Set the status.
272
-	if ( 'page' === $post_type ) {
272
+	if ('page' === $post_type) {
273 273
 		$status = 'closed';
274
-	} elseif ( post_type_supports( $post_type, $supports ) ) {
275
-		$status = get_option( "default_{$option}_status" );
274
+	} elseif (post_type_supports($post_type, $supports)) {
275
+		$status = get_option("default_{$option}_status");
276 276
 	} else {
277 277
 		$status = 'closed';
278 278
 	}
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	 * @param string $post_type    Post type. Default is `post`.
288 288
 	 * @param string $comment_type Type of comment. Default is `comment`.
289 289
 	 */
290
-	return apply_filters( 'get_default_comment_status' , $status, $post_type, $comment_type );
290
+	return apply_filters('get_default_comment_status', $status, $post_type, $comment_type);
291 291
 }
292 292
 
293 293
 /**
@@ -302,33 +302,33 @@  discard block
 block discarded – undo
302 302
  * @param string $timezone Which timezone to use in reference to 'gmt', 'blog', or 'server' locations.
303 303
  * @return string|false Last comment modified date on success, false on failure.
304 304
  */
305
-function get_lastcommentmodified( $timezone = 'server' ) {
305
+function get_lastcommentmodified($timezone = 'server') {
306 306
 	global $wpdb;
307 307
 
308
-	$timezone = strtolower( $timezone );
308
+	$timezone = strtolower($timezone);
309 309
 	$key = "lastcommentmodified:$timezone";
310 310
 
311
-	$comment_modified_date = wp_cache_get( $key, 'timeinfo' );
312
-	if ( false !== $comment_modified_date ) {
311
+	$comment_modified_date = wp_cache_get($key, 'timeinfo');
312
+	if (false !== $comment_modified_date) {
313 313
 		return $comment_modified_date;
314 314
 	}
315 315
 
316
-	switch ( $timezone ) {
316
+	switch ($timezone) {
317 317
 		case 'gmt':
318
-			$comment_modified_date = $wpdb->get_var( "SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
318
+			$comment_modified_date = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");
319 319
 			break;
320 320
 		case 'blog':
321
-			$comment_modified_date = $wpdb->get_var( "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1" );
321
+			$comment_modified_date = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");
322 322
 			break;
323 323
 		case 'server':
324
-			$add_seconds_server = date( 'Z' );
324
+			$add_seconds_server = date('Z');
325 325
 
326
-			$comment_modified_date = $wpdb->get_var( $wpdb->prepare( "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server ) );
326
+			$comment_modified_date = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server));
327 327
 			break;
328 328
 	}
329 329
 
330
-	if ( $comment_modified_date ) {
331
-		wp_cache_set( $key, $comment_modified_date, 'timeinfo' );
330
+	if ($comment_modified_date) {
331
+		wp_cache_set($key, $comment_modified_date, 'timeinfo');
332 332
 
333 333
 		return $comment_modified_date;
334 334
 	}
@@ -349,13 +349,13 @@  discard block
 block discarded – undo
349 349
  * @param int $post_id Optional. Comment amount in post if > 0, else total comments blog wide.
350 350
  * @return array The amount of spam, approved, awaiting moderation, and total comments.
351 351
  */
352
-function get_comment_count( $post_id = 0 ) {
352
+function get_comment_count($post_id = 0) {
353 353
 	global $wpdb;
354 354
 
355 355
 	$post_id = (int) $post_id;
356 356
 
357 357
 	$where = '';
358
-	if ( $post_id > 0 ) {
358
+	if ($post_id > 0) {
359 359
 		$where = $wpdb->prepare("WHERE comment_post_ID = %d", $post_id);
360 360
 	}
361 361
 
@@ -376,8 +376,8 @@  discard block
 block discarded – undo
376 376
 		'all'                 => 0,
377 377
 	);
378 378
 
379
-	foreach ( $totals as $row ) {
380
-		switch ( $row['comment_approved'] ) {
379
+	foreach ($totals as $row) {
380
+		switch ($row['comment_approved']) {
381 381
 			case 'trash':
382 382
 				$comment_count['trash'] = $row['total'];
383 383
 				break;
@@ -489,20 +489,20 @@  discard block
 block discarded – undo
489 489
  *
490 490
  * @param array $comments Array of comment objects.
491 491
  */
492
-function wp_queue_comments_for_comment_meta_lazyload( $comments ) {
492
+function wp_queue_comments_for_comment_meta_lazyload($comments) {
493 493
 	// Don't use `wp_list_pluck()` to avoid by-reference manipulation.
494 494
 	$comment_ids = array();
495
-	if ( is_array( $comments ) ) {
496
-		foreach ( $comments as $comment ) {
497
-			if ( $comment instanceof WP_Comment ) {
495
+	if (is_array($comments)) {
496
+		foreach ($comments as $comment) {
497
+			if ($comment instanceof WP_Comment) {
498 498
 				$comment_ids[] = $comment->comment_ID;
499 499
 			}
500 500
 		}
501 501
 	}
502 502
 
503
-	if ( $comment_ids ) {
503
+	if ($comment_ids) {
504 504
 		$lazyloader = wp_metadata_lazyloader();
505
-		$lazyloader->queue_objects( 'comment', $comment_ids );
505
+		$lazyloader->queue_objects('comment', $comment_ids);
506 506
 	}
507 507
 }
508 508
 
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
  * @since 3.4.0
517 517
  */
518 518
 function wp_set_comment_cookies($comment, $user) {
519
-	if ( $user->exists() )
519
+	if ($user->exists())
520 520
 		return;
521 521
 
522 522
 	/**
@@ -526,11 +526,11 @@  discard block
 block discarded – undo
526 526
 	 *
527 527
 	 * @param int $seconds Comment cookie lifetime. Default 30000000.
528 528
 	 */
529
-	$comment_cookie_lifetime = apply_filters( 'comment_cookie_lifetime', 30000000 );
530
-	$secure = ( 'https' === parse_url( home_url(), PHP_URL_SCHEME ) );
531
-	setcookie( 'comment_author_' . COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
532
-	setcookie( 'comment_author_email_' . COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
533
-	setcookie( 'comment_author_url_' . COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure );
529
+	$comment_cookie_lifetime = apply_filters('comment_cookie_lifetime', 30000000);
530
+	$secure = ('https' === parse_url(home_url(), PHP_URL_SCHEME));
531
+	setcookie('comment_author_'.COOKIEHASH, $comment->comment_author, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure);
532
+	setcookie('comment_author_email_'.COOKIEHASH, $comment->comment_author_email, time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure);
533
+	setcookie('comment_author_url_'.COOKIEHASH, esc_url($comment->comment_author_url), time() + $comment_cookie_lifetime, COOKIEPATH, COOKIE_DOMAIN, $secure);
534 534
 }
535 535
 
536 536
 /**
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
  * @since 2.0.4
543 543
  */
544 544
 function sanitize_comment_cookies() {
545
-	if ( isset( $_COOKIE['comment_author_' . COOKIEHASH] ) ) {
545
+	if (isset($_COOKIE['comment_author_'.COOKIEHASH])) {
546 546
 		/**
547 547
 		 * Filters the comment author's name cookie before it is set.
548 548
 		 *
@@ -553,13 +553,13 @@  discard block
 block discarded – undo
553 553
 		 *
554 554
 		 * @param string $author_cookie The comment author name cookie.
555 555
 		 */
556
-		$comment_author = apply_filters( 'pre_comment_author_name', $_COOKIE['comment_author_' . COOKIEHASH] );
556
+		$comment_author = apply_filters('pre_comment_author_name', $_COOKIE['comment_author_'.COOKIEHASH]);
557 557
 		$comment_author = wp_unslash($comment_author);
558 558
 		$comment_author = esc_attr($comment_author);
559
-		$_COOKIE['comment_author_' . COOKIEHASH] = $comment_author;
559
+		$_COOKIE['comment_author_'.COOKIEHASH] = $comment_author;
560 560
 	}
561 561
 
562
-	if ( isset( $_COOKIE['comment_author_email_' . COOKIEHASH] ) ) {
562
+	if (isset($_COOKIE['comment_author_email_'.COOKIEHASH])) {
563 563
 		/**
564 564
 		 * Filters the comment author's email cookie before it is set.
565 565
 		 *
@@ -570,13 +570,13 @@  discard block
 block discarded – undo
570 570
 		 *
571 571
 		 * @param string $author_email_cookie The comment author email cookie.
572 572
 		 */
573
-		$comment_author_email = apply_filters( 'pre_comment_author_email', $_COOKIE['comment_author_email_' . COOKIEHASH] );
573
+		$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
574 574
 		$comment_author_email = wp_unslash($comment_author_email);
575 575
 		$comment_author_email = esc_attr($comment_author_email);
576 576
 		$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
577 577
 	}
578 578
 
579
-	if ( isset( $_COOKIE['comment_author_url_' . COOKIEHASH] ) ) {
579
+	if (isset($_COOKIE['comment_author_url_'.COOKIEHASH])) {
580 580
 		/**
581 581
 		 * Filters the comment author's URL cookie before it is set.
582 582
 		 *
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 		 *
588 588
 		 * @param string $author_url_cookie The comment author URL cookie.
589 589
 		 */
590
-		$comment_author_url = apply_filters( 'pre_comment_author_url', $_COOKIE['comment_author_url_' . COOKIEHASH] );
590
+		$comment_author_url = apply_filters('pre_comment_author_url', $_COOKIE['comment_author_url_'.COOKIEHASH]);
591 591
 		$comment_author_url = wp_unslash($comment_author_url);
592 592
 		$_COOKIE['comment_author_url_'.COOKIEHASH] = $comment_author_url;
593 593
 	}
@@ -609,29 +609,29 @@  discard block
 block discarded – undo
609 609
  * @return int|string|WP_Error Allowed comments return the approval status (0|1|'spam').
610 610
  *                             If `$avoid_die` is true, disallowed comments return a WP_Error.
611 611
  */
612
-function wp_allow_comment( $commentdata, $avoid_die = false ) {
612
+function wp_allow_comment($commentdata, $avoid_die = false) {
613 613
 	global $wpdb;
614 614
 
615 615
 	// Simple duplicate check
616 616
 	// expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
617 617
 	$dupe = $wpdb->prepare(
618 618
 		"SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ",
619
-		wp_unslash( $commentdata['comment_post_ID'] ),
620
-		wp_unslash( $commentdata['comment_parent'] ),
621
-		wp_unslash( $commentdata['comment_author'] )
619
+		wp_unslash($commentdata['comment_post_ID']),
620
+		wp_unslash($commentdata['comment_parent']),
621
+		wp_unslash($commentdata['comment_author'])
622 622
 	);
623
-	if ( $commentdata['comment_author_email'] ) {
623
+	if ($commentdata['comment_author_email']) {
624 624
 		$dupe .= $wpdb->prepare(
625 625
 			"AND comment_author_email = %s ",
626
-			wp_unslash( $commentdata['comment_author_email'] )
626
+			wp_unslash($commentdata['comment_author_email'])
627 627
 		);
628 628
 	}
629 629
 	$dupe .= $wpdb->prepare(
630 630
 		") AND comment_content = %s LIMIT 1",
631
-		wp_unslash( $commentdata['comment_content'] )
631
+		wp_unslash($commentdata['comment_content'])
632 632
 	);
633 633
 
634
-	$dupe_id = $wpdb->get_var( $dupe );
634
+	$dupe_id = $wpdb->get_var($dupe);
635 635
 
636 636
 	/**
637 637
 	 * Filters the ID, if any, of the duplicate comment found when creating a new comment.
@@ -643,9 +643,9 @@  discard block
 block discarded – undo
643 643
 	 * @param int   $dupe_id     ID of the comment identified as a duplicate.
644 644
 	 * @param array $commentdata Data for the comment being created.
645 645
 	 */
646
-	$dupe_id = apply_filters( 'duplicate_comment_id', $dupe_id, $commentdata );
646
+	$dupe_id = apply_filters('duplicate_comment_id', $dupe_id, $commentdata);
647 647
 
648
-	if ( $dupe_id ) {
648
+	if ($dupe_id) {
649 649
 		/**
650 650
 		 * Fires immediately after a duplicate comment is detected.
651 651
 		 *
@@ -653,15 +653,15 @@  discard block
 block discarded – undo
653 653
 		 *
654 654
 		 * @param array $commentdata Comment data.
655 655
 		 */
656
-		do_action( 'comment_duplicate_trigger', $commentdata );
657
-		if ( true === $avoid_die ) {
658
-			return new WP_Error( 'comment_duplicate', __( 'Duplicate comment detected; it looks as though you&#8217;ve already said that!' ), 409 );
656
+		do_action('comment_duplicate_trigger', $commentdata);
657
+		if (true === $avoid_die) {
658
+			return new WP_Error('comment_duplicate', __('Duplicate comment detected; it looks as though you&#8217;ve already said that!'), 409);
659 659
 		} else {
660
-			if ( wp_doing_ajax() ) {
661
-				die( __('Duplicate comment detected; it looks as though you&#8217;ve already said that!') );
660
+			if (wp_doing_ajax()) {
661
+				die(__('Duplicate comment detected; it looks as though you&#8217;ve already said that!'));
662 662
 			}
663 663
 
664
-			wp_die( __( 'Duplicate comment detected; it looks as though you&#8217;ve already said that!' ), 409 );
664
+			wp_die(__('Duplicate comment detected; it looks as though you&#8217;ve already said that!'), 409);
665 665
 		}
666 666
 	}
667 667
 
@@ -710,24 +710,24 @@  discard block
 block discarded – undo
710 710
 		$avoid_die
711 711
 	);
712 712
 
713
-	if ( $is_flood ) {
714
-		return new WP_Error( 'comment_flood', __( 'You are posting comments too quickly. Slow down.' ), 429 );
713
+	if ($is_flood) {
714
+		return new WP_Error('comment_flood', __('You are posting comments too quickly. Slow down.'), 429);
715 715
 	}
716 716
 
717
-	if ( ! empty( $commentdata['user_id'] ) ) {
718
-		$user = get_userdata( $commentdata['user_id'] );
719
-		$post_author = $wpdb->get_var( $wpdb->prepare(
717
+	if ( ! empty($commentdata['user_id'])) {
718
+		$user = get_userdata($commentdata['user_id']);
719
+		$post_author = $wpdb->get_var($wpdb->prepare(
720 720
 			"SELECT post_author FROM $wpdb->posts WHERE ID = %d LIMIT 1",
721 721
 			$commentdata['comment_post_ID']
722
-		) );
722
+		));
723 723
 	}
724 724
 
725
-	if ( isset( $user ) && ( $commentdata['user_id'] == $post_author || $user->has_cap( 'moderate_comments' ) ) ) {
725
+	if (isset($user) && ($commentdata['user_id'] == $post_author || $user->has_cap('moderate_comments'))) {
726 726
 		// The author and the admins get respect.
727 727
 		$approved = 1;
728 728
 	} else {
729 729
 		// Everyone else's comments will be checked.
730
-		if ( check_comment(
730
+		if (check_comment(
731 731
 			$commentdata['comment_author'],
732 732
 			$commentdata['comment_author_email'],
733 733
 			$commentdata['comment_author_url'],
@@ -735,20 +735,20 @@  discard block
 block discarded – undo
735 735
 			$commentdata['comment_author_IP'],
736 736
 			$commentdata['comment_agent'],
737 737
 			$commentdata['comment_type']
738
-		) ) {
738
+		)) {
739 739
 			$approved = 1;
740 740
 		} else {
741 741
 			$approved = 0;
742 742
 		}
743 743
 
744
-		if ( wp_blacklist_check(
744
+		if (wp_blacklist_check(
745 745
 			$commentdata['comment_author'],
746 746
 			$commentdata['comment_author_email'],
747 747
 			$commentdata['comment_author_url'],
748 748
 			$commentdata['comment_content'],
749 749
 			$commentdata['comment_author_IP'],
750 750
 			$commentdata['comment_agent']
751
-		) ) {
751
+		)) {
752 752
 			$approved = EMPTY_TRASH_DAYS ? 'trash' : 'spam';
753 753
 		}
754 754
 	}
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
 	 * @param bool|string $approved    The approval status. Accepts 1, 0, or 'spam'.
762 762
 	 * @param array       $commentdata Comment data.
763 763
 	 */
764
-	$approved = apply_filters( 'pre_comment_approved', $approved, $commentdata );
764
+	$approved = apply_filters('pre_comment_approved', $approved, $commentdata);
765 765
 	return $approved;
766 766
 }
767 767
 
@@ -776,7 +776,7 @@  discard block
 block discarded – undo
776 776
  * @since 4.7.0 Converted to be an add_filter() wrapper.
777 777
  */
778 778
 function check_comment_flood_db() {
779
-	add_filter( 'wp_is_comment_flood', 'wp_check_comment_flood', 10, 5 );
779
+	add_filter('wp_is_comment_flood', 'wp_check_comment_flood', 10, 5);
780 780
 }
781 781
 
782 782
 /**
@@ -798,22 +798,22 @@  discard block
 block discarded – undo
798 798
  *                          Default false.
799 799
  * @return bool Whether comment flooding is occurring.
800 800
  */
801
-function wp_check_comment_flood( $is_flood, $ip, $email, $date, $avoid_die = false ) {
801
+function wp_check_comment_flood($is_flood, $ip, $email, $date, $avoid_die = false) {
802 802
 
803 803
 	global $wpdb;
804 804
 
805 805
 	// Another callback has declared a flood. Trust it.
806
-	if ( true === $is_flood ) {
806
+	if (true === $is_flood) {
807 807
 		return $is_flood;
808 808
 	}
809 809
 
810 810
 	// don't throttle admins or moderators
811
-	if ( current_user_can( 'manage_options' ) || current_user_can( 'moderate_comments' ) ) {
811
+	if (current_user_can('manage_options') || current_user_can('moderate_comments')) {
812 812
 		return false;
813 813
 	}
814
-	$hour_ago = gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS );
814
+	$hour_ago = gmdate('Y-m-d H:i:s', time() - HOUR_IN_SECONDS);
815 815
 
816
-	if ( is_user_logged_in() ) {
816
+	if (is_user_logged_in()) {
817 817
 		$user = get_current_user_id();
818 818
 		$check_column = '`user_id`';
819 819
 	} else {
@@ -827,8 +827,8 @@  discard block
 block discarded – undo
827 827
 		$user,
828 828
 		$email
829 829
 	);
830
-	$lasttime = $wpdb->get_var( $sql );
831
-	if ( $lasttime ) {
830
+	$lasttime = $wpdb->get_var($sql);
831
+	if ($lasttime) {
832 832
 		$time_lastcomment = mysql2date('U', $lasttime, false);
833 833
 		$time_newcomment  = mysql2date('U', $date, false);
834 834
 		/**
@@ -840,8 +840,8 @@  discard block
 block discarded – undo
840 840
 		 * @param int  $time_lastcomment Timestamp of when the last comment was posted.
841 841
 		 * @param int  $time_newcomment  Timestamp of when the new comment was posted.
842 842
 		 */
843
-		$flood_die = apply_filters( 'comment_flood_filter', false, $time_lastcomment, $time_newcomment );
844
-		if ( $flood_die ) {
843
+		$flood_die = apply_filters('comment_flood_filter', false, $time_lastcomment, $time_newcomment);
844
+		if ($flood_die) {
845 845
 			/**
846 846
 			 * Fires before the comment flood message is triggered.
847 847
 			 *
@@ -850,15 +850,15 @@  discard block
 block discarded – undo
850 850
 			 * @param int $time_lastcomment Timestamp of when the last comment was posted.
851 851
 			 * @param int $time_newcomment  Timestamp of when the new comment was posted.
852 852
 			 */
853
-			do_action( 'comment_flood_trigger', $time_lastcomment, $time_newcomment );
854
-			if ( true === $avoid_die ) {
853
+			do_action('comment_flood_trigger', $time_lastcomment, $time_newcomment);
854
+			if (true === $avoid_die) {
855 855
 				return true;
856 856
 			} else {
857
-				if ( wp_doing_ajax() ) {
858
-					die( __('You are posting comments too quickly. Slow down.') );
857
+				if (wp_doing_ajax()) {
858
+					die(__('You are posting comments too quickly. Slow down.'));
859 859
 				}
860 860
 
861
-				wp_die( __( 'You are posting comments too quickly. Slow down.' ), 429 );
861
+				wp_die(__('You are posting comments too quickly. Slow down.'), 429);
862 862
 			}
863 863
 		}
864 864
 	}
@@ -877,12 +877,12 @@  discard block
 block discarded – undo
877 877
 function separate_comments(&$comments) {
878 878
 	$comments_by_type = array('comment' => array(), 'trackback' => array(), 'pingback' => array(), 'pings' => array());
879 879
 	$count = count($comments);
880
-	for ( $i = 0; $i < $count; $i++ ) {
880
+	for ($i = 0; $i < $count; $i++) {
881 881
 		$type = $comments[$i]->comment_type;
882
-		if ( empty($type) )
882
+		if (empty($type))
883 883
 			$type = 'comment';
884 884
 		$comments_by_type[$type][] = &$comments[$i];
885
-		if ( 'trackback' == $type || 'pingback' == $type )
885
+		if ('trackback' == $type || 'pingback' == $type)
886 886
 			$comments_by_type['pings'][] = &$comments[$i];
887 887
 	}
888 888
 
@@ -903,37 +903,37 @@  discard block
 block discarded – undo
903 903
  * @param bool  $threaded Optional control over flat or threaded comments.
904 904
  * @return int Number of comment pages.
905 905
  */
906
-function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
906
+function get_comment_pages_count($comments = null, $per_page = null, $threaded = null) {
907 907
 	global $wp_query;
908 908
 
909
-	if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )
909
+	if (null === $comments && null === $per_page && null === $threaded && ! empty($wp_query->max_num_comment_pages))
910 910
 		return $wp_query->max_num_comment_pages;
911 911
 
912
-	if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments )  )
912
+	if (( ! $comments || ! is_array($comments)) && ! empty($wp_query->comments))
913 913
 		$comments = $wp_query->comments;
914 914
 
915
-	if ( empty($comments) )
915
+	if (empty($comments))
916 916
 		return 0;
917 917
 
918
-	if ( ! get_option( 'page_comments' ) ) {
918
+	if ( ! get_option('page_comments')) {
919 919
 		return 1;
920 920
 	}
921 921
 
922
-	if ( !isset($per_page) )
922
+	if ( ! isset($per_page))
923 923
 		$per_page = (int) get_query_var('comments_per_page');
924
-	if ( 0 === $per_page )
924
+	if (0 === $per_page)
925 925
 		$per_page = (int) get_option('comments_per_page');
926
-	if ( 0 === $per_page )
926
+	if (0 === $per_page)
927 927
 		return 1;
928 928
 
929
-	if ( !isset($threaded) )
929
+	if ( ! isset($threaded))
930 930
 		$threaded = get_option('thread_comments');
931 931
 
932
-	if ( $threaded ) {
932
+	if ($threaded) {
933 933
 		$walker = new Walker_Comment;
934
-		$count = ceil( $walker->get_number_of_root_elements( $comments ) / $per_page );
934
+		$count = ceil($walker->get_number_of_root_elements($comments) / $per_page);
935 935
 	} else {
936
-		$count = ceil( count( $comments ) / $per_page );
936
+		$count = ceil(count($comments) / $per_page);
937 937
 	}
938 938
 
939 939
 	return $count;
@@ -959,49 +959,49 @@  discard block
 block discarded – undo
959 959
  * } *
960 960
  * @return int|null Comment page number or null on error.
961 961
  */
962
-function get_page_of_comment( $comment_ID, $args = array() ) {
962
+function get_page_of_comment($comment_ID, $args = array()) {
963 963
 	global $wpdb;
964 964
 
965 965
 	$page = null;
966 966
 
967
-	if ( !$comment = get_comment( $comment_ID ) )
967
+	if ( ! $comment = get_comment($comment_ID))
968 968
 		return;
969 969
 
970
-	$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
971
-	$args = wp_parse_args( $args, $defaults );
970
+	$defaults = array('type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '');
971
+	$args = wp_parse_args($args, $defaults);
972 972
 	$original_args = $args;
973 973
 
974 974
 	// Order of precedence: 1. `$args['per_page']`, 2. 'comments_per_page' query_var, 3. 'comments_per_page' option.
975
-	if ( get_option( 'page_comments' ) ) {
976
-		if ( '' === $args['per_page'] ) {
977
-			$args['per_page'] = get_query_var( 'comments_per_page' );
975
+	if (get_option('page_comments')) {
976
+		if ('' === $args['per_page']) {
977
+			$args['per_page'] = get_query_var('comments_per_page');
978 978
 		}
979 979
 
980
-		if ( '' === $args['per_page'] ) {
981
-			$args['per_page'] = get_option( 'comments_per_page' );
980
+		if ('' === $args['per_page']) {
981
+			$args['per_page'] = get_option('comments_per_page');
982 982
 		}
983 983
 	}
984 984
 
985
-	if ( empty($args['per_page']) ) {
985
+	if (empty($args['per_page'])) {
986 986
 		$args['per_page'] = 0;
987 987
 		$args['page'] = 0;
988 988
 	}
989 989
 
990
-	if ( $args['per_page'] < 1 ) {
990
+	if ($args['per_page'] < 1) {
991 991
 		$page = 1;
992 992
 	}
993 993
 
994
-	if ( null === $page ) {
995
-		if ( '' === $args['max_depth'] ) {
996
-			if ( get_option('thread_comments') )
994
+	if (null === $page) {
995
+		if ('' === $args['max_depth']) {
996
+			if (get_option('thread_comments'))
997 997
 				$args['max_depth'] = get_option('thread_comments_depth');
998 998
 			else
999 999
 				$args['max_depth'] = -1;
1000 1000
 		}
1001 1001
 
1002 1002
 		// Find this comment's top level parent if threading is enabled
1003
-		if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
1004
-			return get_page_of_comment( $comment->comment_parent, $args );
1003
+		if ($args['max_depth'] > 1 && 0 != $comment->comment_parent)
1004
+			return get_page_of_comment($comment->comment_parent, $args);
1005 1005
 
1006 1006
 		$comment_args = array(
1007 1007
 			'type'       => $args['type'],
@@ -1019,15 +1019,15 @@  discard block
 block discarded – undo
1019 1019
 		);
1020 1020
 
1021 1021
 		$comment_query = new WP_Comment_Query();
1022
-		$older_comment_count = $comment_query->query( $comment_args );
1022
+		$older_comment_count = $comment_query->query($comment_args);
1023 1023
 
1024 1024
 		// No older comments? Then it's page #1.
1025
-		if ( 0 == $older_comment_count ) {
1025
+		if (0 == $older_comment_count) {
1026 1026
 			$page = 1;
1027 1027
 
1028 1028
 		// Divide comments older than this one by comments per page to get this comment's page number
1029 1029
 		} else {
1030
-			$page = ceil( ( $older_comment_count + 1 ) / $args['per_page'] );
1030
+			$page = ceil(($older_comment_count + 1) / $args['per_page']);
1031 1031
 		}
1032 1032
 	}
1033 1033
 
@@ -1058,7 +1058,7 @@  discard block
 block discarded – undo
1058 1058
 	 * }
1059 1059
 	 * @param int $comment_ID ID of the comment.
1060 1060
 	 */
1061
-	return apply_filters( 'get_page_of_comment', (int) $page, $args, $original_args, $comment_ID );
1061
+	return apply_filters('get_page_of_comment', (int) $page, $args, $original_args, $comment_ID);
1062 1062
 }
1063 1063
 
1064 1064
 /**
@@ -1080,28 +1080,28 @@  discard block
 block discarded – undo
1080 1080
 		'comment_content'      => 65525,
1081 1081
 	);
1082 1082
 
1083
-	if ( $wpdb->is_mysql ) {
1084
-		foreach ( $lengths as $column => $length ) {
1085
-			$col_length = $wpdb->get_col_length( $wpdb->comments, $column );
1083
+	if ($wpdb->is_mysql) {
1084
+		foreach ($lengths as $column => $length) {
1085
+			$col_length = $wpdb->get_col_length($wpdb->comments, $column);
1086 1086
 			$max_length = 0;
1087 1087
 
1088 1088
 			// No point if we can't get the DB column lengths
1089
-			if ( is_wp_error( $col_length ) ) {
1089
+			if (is_wp_error($col_length)) {
1090 1090
 				break;
1091 1091
 			}
1092 1092
 
1093
-			if ( ! is_array( $col_length ) && (int) $col_length > 0 ) {
1093
+			if ( ! is_array($col_length) && (int) $col_length > 0) {
1094 1094
 				$max_length = (int) $col_length;
1095
-			} elseif ( is_array( $col_length ) && isset( $col_length['length'] ) && intval( $col_length['length'] ) > 0 ) {
1095
+			} elseif (is_array($col_length) && isset($col_length['length']) && intval($col_length['length']) > 0) {
1096 1096
 				$max_length = (int) $col_length['length'];
1097 1097
 
1098
-				if ( ! empty( $col_length['type'] ) && 'byte' === $col_length['type'] ) {
1098
+				if ( ! empty($col_length['type']) && 'byte' === $col_length['type']) {
1099 1099
 					$max_length = $max_length - 10;
1100 1100
 				}
1101 1101
 			}
1102 1102
 
1103
-			if ( $max_length > 0 ) {
1104
-				$lengths[ $column ] = $max_length;
1103
+			if ($max_length > 0) {
1104
+				$lengths[$column] = $max_length;
1105 1105
 			}
1106 1106
 		}
1107 1107
 	}
@@ -1113,7 +1113,7 @@  discard block
 block discarded – undo
1113 1113
 	 *
1114 1114
 	 * @param array $lengths Associative array `'field_name' => 'maximum length'`.
1115 1115
 	 */
1116
-	return apply_filters( 'wp_get_comment_fields_max_lengths', $lengths );
1116
+	return apply_filters('wp_get_comment_fields_max_lengths', $lengths);
1117 1117
 }
1118 1118
 
1119 1119
 /**
@@ -1125,23 +1125,23 @@  discard block
 block discarded – undo
1125 1125
  * @return WP_Error|true WP_Error when a comment field exceeds the limit,
1126 1126
  *                       otherwise true.
1127 1127
  */
1128
-function wp_check_comment_data_max_lengths( $comment_data ) {
1128
+function wp_check_comment_data_max_lengths($comment_data) {
1129 1129
 	$max_lengths = wp_get_comment_fields_max_lengths();
1130 1130
 
1131
-	if ( isset( $comment_data['comment_author'] ) && mb_strlen( $comment_data['comment_author'], '8bit' ) > $max_lengths['comment_author'] ) {
1132
-		return new WP_Error( 'comment_author_column_length', __( '<strong>ERROR</strong>: your name is too long.' ), 200 );
1131
+	if (isset($comment_data['comment_author']) && mb_strlen($comment_data['comment_author'], '8bit') > $max_lengths['comment_author']) {
1132
+		return new WP_Error('comment_author_column_length', __('<strong>ERROR</strong>: your name is too long.'), 200);
1133 1133
 	}
1134 1134
 
1135
-	if ( isset( $comment_data['comment_author_email'] ) && strlen( $comment_data['comment_author_email'] ) > $max_lengths['comment_author_email'] ) {
1136
-		return new WP_Error( 'comment_author_email_column_length', __( '<strong>ERROR</strong>: your email address is too long.' ), 200 );
1135
+	if (isset($comment_data['comment_author_email']) && strlen($comment_data['comment_author_email']) > $max_lengths['comment_author_email']) {
1136
+		return new WP_Error('comment_author_email_column_length', __('<strong>ERROR</strong>: your email address is too long.'), 200);
1137 1137
 	}
1138 1138
 
1139
-	if ( isset( $comment_data['comment_author_url'] ) && strlen( $comment_data['comment_author_url'] ) > $max_lengths['comment_author_url'] ) {
1140
-		return new WP_Error( 'comment_author_url_column_length', __( '<strong>ERROR</strong>: your url is too long.' ), 200 );
1139
+	if (isset($comment_data['comment_author_url']) && strlen($comment_data['comment_author_url']) > $max_lengths['comment_author_url']) {
1140
+		return new WP_Error('comment_author_url_column_length', __('<strong>ERROR</strong>: your url is too long.'), 200);
1141 1141
 	}
1142 1142
 
1143
-	if ( isset( $comment_data['comment_content'] ) && mb_strlen( $comment_data['comment_content'], '8bit' ) > $max_lengths['comment_content'] ) {
1144
-		return new WP_Error( 'comment_content_column_length', __( '<strong>ERROR</strong>: your comment is too long.' ), 200 );
1143
+	if (isset($comment_data['comment_content']) && mb_strlen($comment_data['comment_content'], '8bit') > $max_lengths['comment_content']) {
1144
+		return new WP_Error('comment_content_column_length', __('<strong>ERROR</strong>: your comment is too long.'), 200);
1145 1145
 	}
1146 1146
 
1147 1147
 	return true;
@@ -1173,22 +1173,22 @@  discard block
 block discarded – undo
1173 1173
 	 * @param string $user_ip    Comment author's IP address.
1174 1174
 	 * @param string $user_agent Comment author's browser user agent.
1175 1175
 	 */
1176
-	do_action( 'wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
1176
+	do_action('wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent);
1177 1177
 
1178
-	$mod_keys = trim( get_option('blacklist_keys') );
1179
-	if ( '' == $mod_keys )
1178
+	$mod_keys = trim(get_option('blacklist_keys'));
1179
+	if ('' == $mod_keys)
1180 1180
 		return false; // If moderation keys are empty
1181 1181
 
1182 1182
 	// Ensure HTML tags are not being used to bypass the blacklist.
1183
-	$comment_without_html = wp_strip_all_tags( $comment );
1183
+	$comment_without_html = wp_strip_all_tags($comment);
1184 1184
 
1185
-	$words = explode("\n", $mod_keys );
1185
+	$words = explode("\n", $mod_keys);
1186 1186
 
1187
-	foreach ( (array) $words as $word ) {
1187
+	foreach ((array) $words as $word) {
1188 1188
 		$word = trim($word);
1189 1189
 
1190 1190
 		// Skip empty lines
1191
-		if ( empty($word) ) { continue; }
1191
+		if (empty($word)) { continue; }
1192 1192
 
1193 1193
 		// Do some escaping magic so that '#' chars in the
1194 1194
 		// spam words don't break things:
@@ -1225,7 +1225,7 @@  discard block
 block discarded – undo
1225 1225
  * @param int $post_id Optional. Post ID.
1226 1226
  * @return object|array Comment stats.
1227 1227
  */
1228
-function wp_count_comments( $post_id = 0 ) {
1228
+function wp_count_comments($post_id = 0) {
1229 1229
 	$post_id = (int) $post_id;
1230 1230
 
1231 1231
 	/**
@@ -1236,22 +1236,22 @@  discard block
 block discarded – undo
1236 1236
 	 * @param array $count   An empty array.
1237 1237
 	 * @param int   $post_id The post ID.
1238 1238
 	 */
1239
-	$filtered = apply_filters( 'wp_count_comments', array(), $post_id );
1240
-	if ( ! empty( $filtered ) ) {
1239
+	$filtered = apply_filters('wp_count_comments', array(), $post_id);
1240
+	if ( ! empty($filtered)) {
1241 1241
 		return $filtered;
1242 1242
 	}
1243 1243
 
1244
-	$count = wp_cache_get( "comments-{$post_id}", 'counts' );
1245
-	if ( false !== $count ) {
1244
+	$count = wp_cache_get("comments-{$post_id}", 'counts');
1245
+	if (false !== $count) {
1246 1246
 		return $count;
1247 1247
 	}
1248 1248
 
1249
-	$stats = get_comment_count( $post_id );
1249
+	$stats = get_comment_count($post_id);
1250 1250
 	$stats['moderated'] = $stats['awaiting_moderation'];
1251
-	unset( $stats['awaiting_moderation'] );
1251
+	unset($stats['awaiting_moderation']);
1252 1252
 
1253 1253
 	$stats_object = (object) $stats;
1254
-	wp_cache_set( "comments-{$post_id}", $stats_object, 'counts' );
1254
+	wp_cache_set("comments-{$post_id}", $stats_object, 'counts');
1255 1255
 
1256 1256
 	return $stats_object;
1257 1257
 }
@@ -1275,10 +1275,10 @@  discard block
 block discarded – undo
1275 1275
  */
1276 1276
 function wp_delete_comment($comment_id, $force_delete = false) {
1277 1277
 	global $wpdb;
1278
-	if (!$comment = get_comment($comment_id))
1278
+	if ( ! $comment = get_comment($comment_id))
1279 1279
 		return false;
1280 1280
 
1281
-	if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ) ) )
1281
+	if ( ! $force_delete && EMPTY_TRASH_DAYS && ! in_array(wp_get_comment_status($comment), array('trash', 'spam')))
1282 1282
 		return wp_trash_comment($comment_id);
1283 1283
 
1284 1284
 	/**
@@ -1288,21 +1288,21 @@  discard block
 block discarded – undo
1288 1288
 	 *
1289 1289
 	 * @param int $comment_id The comment ID.
1290 1290
 	 */
1291
-	do_action( 'delete_comment', $comment->comment_ID );
1291
+	do_action('delete_comment', $comment->comment_ID);
1292 1292
 
1293 1293
 	// Move children up a level.
1294
-	$children = $wpdb->get_col( $wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID) );
1295
-	if ( !empty($children) ) {
1294
+	$children = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_parent = %d", $comment->comment_ID));
1295
+	if ( ! empty($children)) {
1296 1296
 		$wpdb->update($wpdb->comments, array('comment_parent' => $comment->comment_parent), array('comment_parent' => $comment->comment_ID));
1297 1297
 		clean_comment_cache($children);
1298 1298
 	}
1299 1299
 
1300 1300
 	// Delete metadata
1301
-	$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) );
1302
-	foreach ( $meta_ids as $mid )
1303
-		delete_metadata_by_mid( 'comment', $mid );
1301
+	$meta_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID));
1302
+	foreach ($meta_ids as $mid)
1303
+		delete_metadata_by_mid('comment', $mid);
1304 1304
 
1305
-	if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) )
1305
+	if ( ! $wpdb->delete($wpdb->comments, array('comment_ID' => $comment->comment_ID)))
1306 1306
 		return false;
1307 1307
 
1308 1308
 	/**
@@ -1312,16 +1312,16 @@  discard block
 block discarded – undo
1312 1312
 	 *
1313 1313
 	 * @param int $comment_id The comment ID.
1314 1314
 	 */
1315
-	do_action( 'deleted_comment', $comment->comment_ID );
1315
+	do_action('deleted_comment', $comment->comment_ID);
1316 1316
 
1317 1317
 	$post_id = $comment->comment_post_ID;
1318
-	if ( $post_id && $comment->comment_approved == 1 )
1318
+	if ($post_id && $comment->comment_approved == 1)
1319 1319
 		wp_update_comment_count($post_id);
1320 1320
 
1321
-	clean_comment_cache( $comment->comment_ID );
1321
+	clean_comment_cache($comment->comment_ID);
1322 1322
 
1323 1323
 	/** This action is documented in wp-includes/comment.php */
1324
-	do_action( 'wp_set_comment_status', $comment->comment_ID, 'delete' );
1324
+	do_action('wp_set_comment_status', $comment->comment_ID, 'delete');
1325 1325
 
1326 1326
 	wp_transition_comment_status('delete', $comment->comment_approved, $comment);
1327 1327
 	return true;
@@ -1338,10 +1338,10 @@  discard block
 block discarded – undo
1338 1338
  * @return bool True on success, false on failure.
1339 1339
  */
1340 1340
 function wp_trash_comment($comment_id) {
1341
-	if ( !EMPTY_TRASH_DAYS )
1341
+	if ( ! EMPTY_TRASH_DAYS)
1342 1342
 		return wp_delete_comment($comment_id, true);
1343 1343
 
1344
-	if ( !$comment = get_comment($comment_id) )
1344
+	if ( ! $comment = get_comment($comment_id))
1345 1345
 		return false;
1346 1346
 
1347 1347
 	/**
@@ -1351,13 +1351,13 @@  discard block
 block discarded – undo
1351 1351
 	 *
1352 1352
 	 * @param int $comment_id The comment ID.
1353 1353
 	 */
1354
-	do_action( 'trash_comment', $comment->comment_ID );
1354
+	do_action('trash_comment', $comment->comment_ID);
1355 1355
 
1356
-	if ( wp_set_comment_status( $comment, 'trash' ) ) {
1357
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1358
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1359
-		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
1360
-		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );
1356
+	if (wp_set_comment_status($comment, 'trash')) {
1357
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_status');
1358
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_time');
1359
+		add_comment_meta($comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved);
1360
+		add_comment_meta($comment->comment_ID, '_wp_trash_meta_time', time());
1361 1361
 
1362 1362
 		/**
1363 1363
 		 * Fires immediately after a comment is sent to Trash.
@@ -1366,7 +1366,7 @@  discard block
 block discarded – undo
1366 1366
 		 *
1367 1367
 		 * @param int $comment_id The comment ID.
1368 1368
 		 */
1369
-		do_action( 'trashed_comment', $comment->comment_ID );
1369
+		do_action('trashed_comment', $comment->comment_ID);
1370 1370
 		return true;
1371 1371
 	}
1372 1372
 
@@ -1382,8 +1382,8 @@  discard block
 block discarded – undo
1382 1382
  * @return bool True on success, false on failure.
1383 1383
  */
1384 1384
 function wp_untrash_comment($comment_id) {
1385
-	$comment = get_comment( $comment_id );
1386
-	if ( ! $comment ) {
1385
+	$comment = get_comment($comment_id);
1386
+	if ( ! $comment) {
1387 1387
 		return false;
1388 1388
 	}
1389 1389
 
@@ -1394,15 +1394,15 @@  discard block
 block discarded – undo
1394 1394
 	 *
1395 1395
 	 * @param int $comment_id The comment ID.
1396 1396
 	 */
1397
-	do_action( 'untrash_comment', $comment->comment_ID );
1397
+	do_action('untrash_comment', $comment->comment_ID);
1398 1398
 
1399
-	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1400
-	if ( empty($status) )
1399
+	$status = (string) get_comment_meta($comment->comment_ID, '_wp_trash_meta_status', true);
1400
+	if (empty($status))
1401 1401
 		$status = '0';
1402 1402
 
1403
-	if ( wp_set_comment_status( $comment, $status ) ) {
1404
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1405
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1403
+	if (wp_set_comment_status($comment, $status)) {
1404
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_time');
1405
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_status');
1406 1406
 		/**
1407 1407
 		 * Fires immediately after a comment is restored from the Trash.
1408 1408
 		 *
@@ -1410,7 +1410,7 @@  discard block
 block discarded – undo
1410 1410
 		 *
1411 1411
 		 * @param int $comment_id The comment ID.
1412 1412
 		 */
1413
-		do_action( 'untrashed_comment', $comment->comment_ID );
1413
+		do_action('untrashed_comment', $comment->comment_ID);
1414 1414
 		return true;
1415 1415
 	}
1416 1416
 
@@ -1425,9 +1425,9 @@  discard block
 block discarded – undo
1425 1425
  * @param int|WP_Comment $comment_id Comment ID or WP_Comment object.
1426 1426
  * @return bool True on success, false on failure.
1427 1427
  */
1428
-function wp_spam_comment( $comment_id ) {
1429
-	$comment = get_comment( $comment_id );
1430
-	if ( ! $comment ) {
1428
+function wp_spam_comment($comment_id) {
1429
+	$comment = get_comment($comment_id);
1430
+	if ( ! $comment) {
1431 1431
 		return false;
1432 1432
 	}
1433 1433
 
@@ -1438,13 +1438,13 @@  discard block
 block discarded – undo
1438 1438
 	 *
1439 1439
 	 * @param int $comment_id The comment ID.
1440 1440
 	 */
1441
-	do_action( 'spam_comment', $comment->comment_ID );
1441
+	do_action('spam_comment', $comment->comment_ID);
1442 1442
 
1443
-	if ( wp_set_comment_status( $comment, 'spam' ) ) {
1444
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1445
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1446
-		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved );
1447
-		add_comment_meta( $comment->comment_ID, '_wp_trash_meta_time', time() );
1443
+	if (wp_set_comment_status($comment, 'spam')) {
1444
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_status');
1445
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_time');
1446
+		add_comment_meta($comment->comment_ID, '_wp_trash_meta_status', $comment->comment_approved);
1447
+		add_comment_meta($comment->comment_ID, '_wp_trash_meta_time', time());
1448 1448
 		/**
1449 1449
 		 * Fires immediately after a comment is marked as Spam.
1450 1450
 		 *
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
 		 *
1453 1453
 		 * @param int $comment_id The comment ID.
1454 1454
 		 */
1455
-		do_action( 'spammed_comment', $comment->comment_ID );
1455
+		do_action('spammed_comment', $comment->comment_ID);
1456 1456
 		return true;
1457 1457
 	}
1458 1458
 
@@ -1467,9 +1467,9 @@  discard block
 block discarded – undo
1467 1467
  * @param int|WP_Comment $comment_id Comment ID or WP_Comment object.
1468 1468
  * @return bool True on success, false on failure.
1469 1469
  */
1470
-function wp_unspam_comment( $comment_id ) {
1471
-	$comment = get_comment( $comment_id );
1472
-	if ( ! $comment ) {
1470
+function wp_unspam_comment($comment_id) {
1471
+	$comment = get_comment($comment_id);
1472
+	if ( ! $comment) {
1473 1473
 		return false;
1474 1474
 	}
1475 1475
 
@@ -1480,15 +1480,15 @@  discard block
 block discarded – undo
1480 1480
 	 *
1481 1481
 	 * @param int $comment_id The comment ID.
1482 1482
 	 */
1483
-	do_action( 'unspam_comment', $comment->comment_ID );
1483
+	do_action('unspam_comment', $comment->comment_ID);
1484 1484
 
1485
-	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1486
-	if ( empty($status) )
1485
+	$status = (string) get_comment_meta($comment->comment_ID, '_wp_trash_meta_status', true);
1486
+	if (empty($status))
1487 1487
 		$status = '0';
1488 1488
 
1489
-	if ( wp_set_comment_status( $comment, $status ) ) {
1490
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
1491
-		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
1489
+	if (wp_set_comment_status($comment, $status)) {
1490
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_status');
1491
+		delete_comment_meta($comment->comment_ID, '_wp_trash_meta_time');
1492 1492
 		/**
1493 1493
 		 * Fires immediately after a comment is unmarked as Spam.
1494 1494
 		 *
@@ -1496,7 +1496,7 @@  discard block
 block discarded – undo
1496 1496
 		 *
1497 1497
 		 * @param int $comment_id The comment ID.
1498 1498
 		 */
1499
-		do_action( 'unspammed_comment', $comment->comment_ID );
1499
+		do_action('unspammed_comment', $comment->comment_ID);
1500 1500
 		return true;
1501 1501
 	}
1502 1502
 
@@ -1513,20 +1513,20 @@  discard block
 block discarded – undo
1513 1513
  */
1514 1514
 function wp_get_comment_status($comment_id) {
1515 1515
 	$comment = get_comment($comment_id);
1516
-	if ( !$comment )
1516
+	if ( ! $comment)
1517 1517
 		return false;
1518 1518
 
1519 1519
 	$approved = $comment->comment_approved;
1520 1520
 
1521
-	if ( $approved == null )
1521
+	if ($approved == null)
1522 1522
 		return false;
1523
-	elseif ( $approved == '1' )
1523
+	elseif ($approved == '1')
1524 1524
 		return 'approved';
1525
-	elseif ( $approved == '0' )
1525
+	elseif ($approved == '0')
1526 1526
 		return 'unapproved';
1527
-	elseif ( $approved == 'spam' )
1527
+	elseif ($approved == 'spam')
1528 1528
 		return 'spam';
1529
-	elseif ( $approved == 'trash' )
1529
+	elseif ($approved == 'trash')
1530 1530
 		return 'trash';
1531 1531
 	else
1532 1532
 		return false;
@@ -1562,11 +1562,11 @@  discard block
 block discarded – undo
1562 1562
 		1         => 'approved',
1563 1563
 		'approve' => 'approved', // wp_set_comment_status() uses "approve"
1564 1564
 	);
1565
-	if ( isset($comment_statuses[$new_status]) ) $new_status = $comment_statuses[$new_status];
1566
-	if ( isset($comment_statuses[$old_status]) ) $old_status = $comment_statuses[$old_status];
1565
+	if (isset($comment_statuses[$new_status])) $new_status = $comment_statuses[$new_status];
1566
+	if (isset($comment_statuses[$old_status])) $old_status = $comment_statuses[$old_status];
1567 1567
 
1568 1568
 	// Call the hooks
1569
-	if ( $new_status != $old_status ) {
1569
+	if ($new_status != $old_status) {
1570 1570
 		/**
1571 1571
 		 * Fires when the comment status is in transition.
1572 1572
 		 *
@@ -1576,7 +1576,7 @@  discard block
 block discarded – undo
1576 1576
 		 * @param int|string $old_status The old comment status.
1577 1577
 		 * @param object     $comment    The comment data.
1578 1578
 		 */
1579
-		do_action( 'transition_comment_status', $new_status, $old_status, $comment );
1579
+		do_action('transition_comment_status', $new_status, $old_status, $comment);
1580 1580
 		/**
1581 1581
 		 * Fires when the comment status is in transition from one specific status to another.
1582 1582
 		 *
@@ -1587,7 +1587,7 @@  discard block
 block discarded – undo
1587 1587
 		 *
1588 1588
 		 * @param WP_Comment $comment Comment object.
1589 1589
 		 */
1590
-		do_action( "comment_{$old_status}_to_{$new_status}", $comment );
1590
+		do_action("comment_{$old_status}_to_{$new_status}", $comment);
1591 1591
 	}
1592 1592
 	/**
1593 1593
 	 * Fires when the status of a specific comment type is in transition.
@@ -1603,7 +1603,7 @@  discard block
 block discarded – undo
1603 1603
 	 * @param int        $comment_ID The comment ID.
1604 1604
 	 * @param WP_Comment $comment    Comment object.
1605 1605
 	 */
1606
-	do_action( "comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment );
1606
+	do_action("comment_{$new_status}_{$comment->comment_type}", $comment->comment_ID, $comment);
1607 1607
 }
1608 1608
 
1609 1609
 /**
@@ -1618,10 +1618,10 @@  discard block
 block discarded – undo
1618 1618
  * @param string $new_status The new comment status.
1619 1619
  * @param string $old_status The old comment status.
1620 1620
  */
1621
-function _clear_modified_cache_on_transition_comment_status( $new_status, $old_status ) {
1622
-	if ( 'approved' === $new_status || 'approved' === $old_status ) {
1623
-		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
1624
-			wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' );
1621
+function _clear_modified_cache_on_transition_comment_status($new_status, $old_status) {
1622
+	if ('approved' === $new_status || 'approved' === $old_status) {
1623
+		foreach (array('server', 'gmt', 'blog') as $timezone) {
1624
+			wp_cache_delete("lastcommentmodified:$timezone", 'timeinfo');
1625 1625
 		}
1626 1626
 	}
1627 1627
 }
@@ -1642,15 +1642,15 @@  discard block
 block discarded – undo
1642 1642
 	// Cookies should already be sanitized.
1643 1643
 
1644 1644
 	$comment_author = '';
1645
-	if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )
1645
+	if (isset($_COOKIE['comment_author_'.COOKIEHASH]))
1646 1646
 		$comment_author = $_COOKIE['comment_author_'.COOKIEHASH];
1647 1647
 
1648 1648
 	$comment_author_email = '';
1649
-	if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) )
1649
+	if (isset($_COOKIE['comment_author_email_'.COOKIEHASH]))
1650 1650
 		$comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH];
1651 1651
 
1652 1652
 	$comment_author_url = '';
1653
-	if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )
1653
+	if (isset($_COOKIE['comment_author_url_'.COOKIEHASH]))
1654 1654
 		$comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];
1655 1655
 
1656 1656
 	/**
@@ -1666,7 +1666,7 @@  discard block
 block discarded – undo
1666 1666
 	 *     @type string $comment_author_url   The URL address of the `$comment_author`. Default empty.
1667 1667
 	 * }
1668 1668
 	 */
1669
-	return apply_filters( 'wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url') );
1669
+	return apply_filters('wp_get_current_commenter', compact('comment_author', 'comment_author_email', 'comment_author_url'));
1670 1670
 }
1671 1671
 
1672 1672
 /**
@@ -1704,51 +1704,51 @@  discard block
 block discarded – undo
1704 1704
  * }
1705 1705
  * @return int|false The new comment's ID on success, false on failure.
1706 1706
  */
1707
-function wp_insert_comment( $commentdata ) {
1707
+function wp_insert_comment($commentdata) {
1708 1708
 	global $wpdb;
1709
-	$data = wp_unslash( $commentdata );
1709
+	$data = wp_unslash($commentdata);
1710 1710
 
1711
-	$comment_author       = ! isset( $data['comment_author'] )       ? '' : $data['comment_author'];
1712
-	$comment_author_email = ! isset( $data['comment_author_email'] ) ? '' : $data['comment_author_email'];
1713
-	$comment_author_url   = ! isset( $data['comment_author_url'] )   ? '' : $data['comment_author_url'];
1714
-	$comment_author_IP    = ! isset( $data['comment_author_IP'] )    ? '' : $data['comment_author_IP'];
1711
+	$comment_author       = ! isset($data['comment_author']) ? '' : $data['comment_author'];
1712
+	$comment_author_email = ! isset($data['comment_author_email']) ? '' : $data['comment_author_email'];
1713
+	$comment_author_url   = ! isset($data['comment_author_url']) ? '' : $data['comment_author_url'];
1714
+	$comment_author_IP    = ! isset($data['comment_author_IP']) ? '' : $data['comment_author_IP'];
1715 1715
 
1716
-	$comment_date     = ! isset( $data['comment_date'] )     ? current_time( 'mysql' )            : $data['comment_date'];
1717
-	$comment_date_gmt = ! isset( $data['comment_date_gmt'] ) ? get_gmt_from_date( $comment_date ) : $data['comment_date_gmt'];
1716
+	$comment_date     = ! isset($data['comment_date']) ? current_time('mysql') : $data['comment_date'];
1717
+	$comment_date_gmt = ! isset($data['comment_date_gmt']) ? get_gmt_from_date($comment_date) : $data['comment_date_gmt'];
1718 1718
 
1719
-	$comment_post_ID  = ! isset( $data['comment_post_ID'] )  ? 0  : $data['comment_post_ID'];
1720
-	$comment_content  = ! isset( $data['comment_content'] )  ? '' : $data['comment_content'];
1721
-	$comment_karma    = ! isset( $data['comment_karma'] )    ? 0  : $data['comment_karma'];
1722
-	$comment_approved = ! isset( $data['comment_approved'] ) ? 1  : $data['comment_approved'];
1723
-	$comment_agent    = ! isset( $data['comment_agent'] )    ? '' : $data['comment_agent'];
1724
-	$comment_type     = ! isset( $data['comment_type'] )     ? '' : $data['comment_type'];
1725
-	$comment_parent   = ! isset( $data['comment_parent'] )   ? 0  : $data['comment_parent'];
1719
+	$comment_post_ID  = ! isset($data['comment_post_ID']) ? 0 : $data['comment_post_ID'];
1720
+	$comment_content  = ! isset($data['comment_content']) ? '' : $data['comment_content'];
1721
+	$comment_karma    = ! isset($data['comment_karma']) ? 0 : $data['comment_karma'];
1722
+	$comment_approved = ! isset($data['comment_approved']) ? 1 : $data['comment_approved'];
1723
+	$comment_agent    = ! isset($data['comment_agent']) ? '' : $data['comment_agent'];
1724
+	$comment_type     = ! isset($data['comment_type']) ? '' : $data['comment_type'];
1725
+	$comment_parent   = ! isset($data['comment_parent']) ? 0 : $data['comment_parent'];
1726 1726
 
1727
-	$user_id  = ! isset( $data['user_id'] ) ? 0 : $data['user_id'];
1727
+	$user_id = ! isset($data['user_id']) ? 0 : $data['user_id'];
1728 1728
 
1729
-	$compacted = compact( 'comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id' );
1730
-	if ( ! $wpdb->insert( $wpdb->comments, $compacted ) ) {
1729
+	$compacted = compact('comment_post_ID', 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_author_IP', 'comment_date', 'comment_date_gmt', 'comment_content', 'comment_karma', 'comment_approved', 'comment_agent', 'comment_type', 'comment_parent', 'user_id');
1730
+	if ( ! $wpdb->insert($wpdb->comments, $compacted)) {
1731 1731
 		return false;
1732 1732
 	}
1733 1733
 
1734 1734
 	$id = (int) $wpdb->insert_id;
1735 1735
 
1736
-	if ( $comment_approved == 1 ) {
1737
-		wp_update_comment_count( $comment_post_ID );
1736
+	if ($comment_approved == 1) {
1737
+		wp_update_comment_count($comment_post_ID);
1738 1738
 
1739
-		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
1740
-			wp_cache_delete( "lastcommentmodified:$timezone", 'timeinfo' );
1739
+		foreach (array('server', 'gmt', 'blog') as $timezone) {
1740
+			wp_cache_delete("lastcommentmodified:$timezone", 'timeinfo');
1741 1741
 		}
1742 1742
 	}
1743 1743
 
1744
-	clean_comment_cache( $id );
1744
+	clean_comment_cache($id);
1745 1745
 
1746
-	$comment = get_comment( $id );
1746
+	$comment = get_comment($id);
1747 1747
 
1748 1748
 	// If metadata is provided, store it.
1749
-	if ( isset( $commentdata['comment_meta'] ) && is_array( $commentdata['comment_meta'] ) ) {
1750
-		foreach ( $commentdata['comment_meta'] as $meta_key => $meta_value ) {
1751
-			add_comment_meta( $comment->comment_ID, $meta_key, $meta_value, true );
1749
+	if (isset($commentdata['comment_meta']) && is_array($commentdata['comment_meta'])) {
1750
+		foreach ($commentdata['comment_meta'] as $meta_key => $meta_value) {
1751
+			add_comment_meta($comment->comment_ID, $meta_key, $meta_value, true);
1752 1752
 		}
1753 1753
 	}
1754 1754
 
@@ -1760,7 +1760,7 @@  discard block
 block discarded – undo
1760 1760
 	 * @param int        $id      The comment ID.
1761 1761
 	 * @param WP_Comment $comment Comment object.
1762 1762
 	 */
1763
-	do_action( 'wp_insert_comment', $id, $comment );
1763
+	do_action('wp_insert_comment', $id, $comment);
1764 1764
 
1765 1765
 	return $id;
1766 1766
 }
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
  * @return array Parsed comment information.
1779 1779
  */
1780 1780
 function wp_filter_comment($commentdata) {
1781
-	if ( isset( $commentdata['user_ID'] ) ) {
1781
+	if (isset($commentdata['user_ID'])) {
1782 1782
 		/**
1783 1783
 		 * Filters the comment author's user id before it is set.
1784 1784
 		 *
@@ -1789,10 +1789,10 @@  discard block
 block discarded – undo
1789 1789
 		 *
1790 1790
 		 * @param int $user_ID The comment author's user ID.
1791 1791
 		 */
1792
-		$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_ID'] );
1793
-	} elseif ( isset( $commentdata['user_id'] ) ) {
1792
+		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_ID']);
1793
+	} elseif (isset($commentdata['user_id'])) {
1794 1794
 		/** This filter is documented in wp-includes/comment.php */
1795
-		$commentdata['user_id'] = apply_filters( 'pre_user_id', $commentdata['user_id'] );
1795
+		$commentdata['user_id'] = apply_filters('pre_user_id', $commentdata['user_id']);
1796 1796
 	}
1797 1797
 
1798 1798
 	/**
@@ -1802,9 +1802,9 @@  discard block
 block discarded – undo
1802 1802
 	 *
1803 1803
 	 * @param string $comment_agent The comment author's browser user agent.
1804 1804
 	 */
1805
-	$commentdata['comment_agent'] = apply_filters( 'pre_comment_user_agent', ( isset( $commentdata['comment_agent'] ) ? $commentdata['comment_agent'] : '' ) );
1805
+	$commentdata['comment_agent'] = apply_filters('pre_comment_user_agent', (isset($commentdata['comment_agent']) ? $commentdata['comment_agent'] : ''));
1806 1806
 	/** This filter is documented in wp-includes/comment.php */
1807
-	$commentdata['comment_author'] = apply_filters( 'pre_comment_author_name', $commentdata['comment_author'] );
1807
+	$commentdata['comment_author'] = apply_filters('pre_comment_author_name', $commentdata['comment_author']);
1808 1808
 	/**
1809 1809
 	 * Filters the comment content before it is set.
1810 1810
 	 *
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
 	 *
1813 1813
 	 * @param string $comment_content The comment content.
1814 1814
 	 */
1815
-	$commentdata['comment_content'] = apply_filters( 'pre_comment_content', $commentdata['comment_content'] );
1815
+	$commentdata['comment_content'] = apply_filters('pre_comment_content', $commentdata['comment_content']);
1816 1816
 	/**
1817 1817
 	 * Filters the comment author's IP before it is set.
1818 1818
 	 *
@@ -1820,11 +1820,11 @@  discard block
 block discarded – undo
1820 1820
 	 *
1821 1821
 	 * @param string $comment_author_ip The comment author's IP.
1822 1822
 	 */
1823
-	$commentdata['comment_author_IP'] = apply_filters( 'pre_comment_user_ip', $commentdata['comment_author_IP'] );
1823
+	$commentdata['comment_author_IP'] = apply_filters('pre_comment_user_ip', $commentdata['comment_author_IP']);
1824 1824
 	/** This filter is documented in wp-includes/comment.php */
1825
-	$commentdata['comment_author_url'] = apply_filters( 'pre_comment_author_url', $commentdata['comment_author_url'] );
1825
+	$commentdata['comment_author_url'] = apply_filters('pre_comment_author_url', $commentdata['comment_author_url']);
1826 1826
 	/** This filter is documented in wp-includes/comment.php */
1827
-	$commentdata['comment_author_email'] = apply_filters( 'pre_comment_author_email', $commentdata['comment_author_email'] );
1827
+	$commentdata['comment_author_email'] = apply_filters('pre_comment_author_email', $commentdata['comment_author_email']);
1828 1828
 	$commentdata['filtered'] = true;
1829 1829
 	return $commentdata;
1830 1830
 }
@@ -1840,9 +1840,9 @@  discard block
 block discarded – undo
1840 1840
  * @return bool Whether comment should be blocked.
1841 1841
  */
1842 1842
 function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
1843
-	if ( $block ) // a plugin has already blocked... we'll let that decision stand
1843
+	if ($block) // a plugin has already blocked... we'll let that decision stand
1844 1844
 		return $block;
1845
-	if ( ($time_newcomment - $time_lastcomment) < 15 )
1845
+	if (($time_newcomment - $time_lastcomment) < 15)
1846 1846
 		return true;
1847 1847
 	return false;
1848 1848
 }
@@ -1891,14 +1891,14 @@  discard block
 block discarded – undo
1891 1891
  *                        executing wp_die()? Default false.
1892 1892
  * @return int|false|WP_Error The ID of the comment on success, false or WP_Error on failure.
1893 1893
  */
1894
-function wp_new_comment( $commentdata, $avoid_die = false ) {
1894
+function wp_new_comment($commentdata, $avoid_die = false) {
1895 1895
 	global $wpdb;
1896 1896
 
1897
-	if ( isset( $commentdata['user_ID'] ) ) {
1897
+	if (isset($commentdata['user_ID'])) {
1898 1898
 		$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
1899 1899
 	}
1900 1900
 
1901
-	$prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
1901
+	$prefiltered_user_id = (isset($commentdata['user_id'])) ? (int) $commentdata['user_id'] : 0;
1902 1902
 
1903 1903
 	/**
1904 1904
 	 * Filters a comment's data before it is sanitized and inserted into the database.
@@ -1907,63 +1907,63 @@  discard block
 block discarded – undo
1907 1907
 	 *
1908 1908
 	 * @param array $commentdata Comment data.
1909 1909
 	 */
1910
-	$commentdata = apply_filters( 'preprocess_comment', $commentdata );
1910
+	$commentdata = apply_filters('preprocess_comment', $commentdata);
1911 1911
 
1912 1912
 	$commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
1913
-	if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) {
1913
+	if (isset($commentdata['user_ID']) && $prefiltered_user_id !== (int) $commentdata['user_ID']) {
1914 1914
 		$commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
1915
-	} elseif ( isset( $commentdata['user_id'] ) ) {
1915
+	} elseif (isset($commentdata['user_id'])) {
1916 1916
 		$commentdata['user_id'] = (int) $commentdata['user_id'];
1917 1917
 	}
1918 1918
 
1919 1919
 	$commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
1920
-	$parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
1921
-	$commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
1920
+	$parent_status = (0 < $commentdata['comment_parent']) ? wp_get_comment_status($commentdata['comment_parent']) : '';
1921
+	$commentdata['comment_parent'] = ('approved' == $parent_status || 'unapproved' == $parent_status) ? $commentdata['comment_parent'] : 0;
1922 1922
 
1923
-	if ( ! isset( $commentdata['comment_author_IP'] ) ) {
1923
+	if ( ! isset($commentdata['comment_author_IP'])) {
1924 1924
 		$commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
1925 1925
 	}
1926
-	$commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] );
1926
+	$commentdata['comment_author_IP'] = preg_replace('/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP']);
1927 1927
 
1928
-	if ( ! isset( $commentdata['comment_agent'] ) ) {
1929
-		$commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '';
1928
+	if ( ! isset($commentdata['comment_agent'])) {
1929
+		$commentdata['comment_agent'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
1930 1930
 	}
1931
-	$commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 );
1931
+	$commentdata['comment_agent'] = substr($commentdata['comment_agent'], 0, 254);
1932 1932
 
1933
-	if ( empty( $commentdata['comment_date'] ) ) {
1933
+	if (empty($commentdata['comment_date'])) {
1934 1934
 		$commentdata['comment_date'] = current_time('mysql');
1935 1935
 	}
1936 1936
 
1937
-	if ( empty( $commentdata['comment_date_gmt'] ) ) {
1938
-		$commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
1937
+	if (empty($commentdata['comment_date_gmt'])) {
1938
+		$commentdata['comment_date_gmt'] = current_time('mysql', 1);
1939 1939
 	}
1940 1940
 
1941 1941
 	$commentdata = wp_filter_comment($commentdata);
1942 1942
 
1943
-	$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
1944
-	if ( is_wp_error( $commentdata['comment_approved'] ) ) {
1943
+	$commentdata['comment_approved'] = wp_allow_comment($commentdata, $avoid_die);
1944
+	if (is_wp_error($commentdata['comment_approved'])) {
1945 1945
 		return $commentdata['comment_approved'];
1946 1946
 	}
1947 1947
 
1948 1948
 	$comment_ID = wp_insert_comment($commentdata);
1949
-	if ( ! $comment_ID ) {
1950
-		$fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
1949
+	if ( ! $comment_ID) {
1950
+		$fields = array('comment_author', 'comment_author_email', 'comment_author_url', 'comment_content');
1951 1951
 
1952
-		foreach ( $fields as $field ) {
1953
-			if ( isset( $commentdata[ $field ] ) ) {
1954
-				$commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
1952
+		foreach ($fields as $field) {
1953
+			if (isset($commentdata[$field])) {
1954
+				$commentdata[$field] = $wpdb->strip_invalid_text_for_column($wpdb->comments, $field, $commentdata[$field]);
1955 1955
 			}
1956 1956
 		}
1957 1957
 
1958
-		$commentdata = wp_filter_comment( $commentdata );
1958
+		$commentdata = wp_filter_comment($commentdata);
1959 1959
 
1960
-		$commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
1961
-		if ( is_wp_error( $commentdata['comment_approved'] ) ) {
1960
+		$commentdata['comment_approved'] = wp_allow_comment($commentdata, $avoid_die);
1961
+		if (is_wp_error($commentdata['comment_approved'])) {
1962 1962
 			return $commentdata['comment_approved'];
1963 1963
 		}
1964 1964
 
1965
-		$comment_ID = wp_insert_comment( $commentdata );
1966
-		if ( ! $comment_ID ) {
1965
+		$comment_ID = wp_insert_comment($commentdata);
1966
+		if ( ! $comment_ID) {
1967 1967
 			return false;
1968 1968
 		}
1969 1969
 	}
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 	 * @param int|string $comment_approved 1 if the comment is approved, 0 if not, 'spam' if spam.
1979 1979
 	 * @param array      $commentdata      Comment data.
1980 1980
 	 */
1981
-	do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata );
1981
+	do_action('comment_post', $comment_ID, $commentdata['comment_approved'], $commentdata);
1982 1982
 
1983 1983
 	return $comment_ID;
1984 1984
 }
@@ -1991,20 +1991,20 @@  discard block
 block discarded – undo
1991 1991
  * @param int $comment_ID ID of the comment.
1992 1992
  * @return bool True on success, false on failure.
1993 1993
  */
1994
-function wp_new_comment_notify_moderator( $comment_ID ) {
1995
-	$comment = get_comment( $comment_ID );
1994
+function wp_new_comment_notify_moderator($comment_ID) {
1995
+	$comment = get_comment($comment_ID);
1996 1996
 
1997 1997
 	// Only send notifications for pending comments.
1998
-	$maybe_notify = ( '0' == $comment->comment_approved );
1998
+	$maybe_notify = ('0' == $comment->comment_approved);
1999 1999
 
2000 2000
 	/** This filter is documented in wp-includes/comment.php */
2001
-	$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_ID );
2001
+	$maybe_notify = apply_filters('notify_moderator', $maybe_notify, $comment_ID);
2002 2002
 
2003
-	if ( ! $maybe_notify ) {
2003
+	if ( ! $maybe_notify) {
2004 2004
 		return false;
2005 2005
 	}
2006 2006
 
2007
-	return wp_notify_moderator( $comment_ID );
2007
+	return wp_notify_moderator($comment_ID);
2008 2008
 }
2009 2009
 
2010 2010
 /**
@@ -2018,10 +2018,10 @@  discard block
 block discarded – undo
2018 2018
  * @param int $comment_ID Comment ID.
2019 2019
  * @return bool True on success, false on failure.
2020 2020
  */
2021
-function wp_new_comment_notify_postauthor( $comment_ID ) {
2022
-	$comment = get_comment( $comment_ID );
2021
+function wp_new_comment_notify_postauthor($comment_ID) {
2022
+	$comment = get_comment($comment_ID);
2023 2023
 
2024
-	$maybe_notify = get_option( 'comments_notify' );
2024
+	$maybe_notify = get_option('comments_notify');
2025 2025
 
2026 2026
 	/**
2027 2027
 	 * Filters whether to send the post author new comment notification emails,
@@ -2032,22 +2032,22 @@  discard block
 block discarded – undo
2032 2032
 	 * @param bool $maybe_notify Whether to notify the post author about the new comment.
2033 2033
 	 * @param int  $comment_ID   The ID of the comment for the notification.
2034 2034
 	 */
2035
-	$maybe_notify = apply_filters( 'notify_post_author', $maybe_notify, $comment_ID );
2035
+	$maybe_notify = apply_filters('notify_post_author', $maybe_notify, $comment_ID);
2036 2036
 
2037 2037
 	/*
2038 2038
 	 * wp_notify_postauthor() checks if notifying the author of their own comment.
2039 2039
 	 * By default, it won't, but filters can override this.
2040 2040
 	 */
2041
-	if ( ! $maybe_notify ) {
2041
+	if ( ! $maybe_notify) {
2042 2042
 		return false;
2043 2043
 	}
2044 2044
 
2045 2045
 	// Only send notifications for approved comments.
2046
-	if ( ! isset( $comment->comment_approved ) || '1' != $comment->comment_approved ) {
2046
+	if ( ! isset($comment->comment_approved) || '1' != $comment->comment_approved) {
2047 2047
 		return false;
2048 2048
 	}
2049 2049
 
2050
-	return wp_notify_postauthor( $comment_ID );
2050
+	return wp_notify_postauthor($comment_ID);
2051 2051
 }
2052 2052
 
2053 2053
 /**
@@ -2068,7 +2068,7 @@  discard block
 block discarded – undo
2068 2068
 function wp_set_comment_status($comment_id, $comment_status, $wp_error = false) {
2069 2069
 	global $wpdb;
2070 2070
 
2071
-	switch ( $comment_status ) {
2071
+	switch ($comment_status) {
2072 2072
 		case 'hold':
2073 2073
 		case '0':
2074 2074
 			$status = '0';
@@ -2076,7 +2076,7 @@  discard block
 block discarded – undo
2076 2076
 		case 'approve':
2077 2077
 		case '1':
2078 2078
 			$status = '1';
2079
-			add_action( 'wp_set_comment_status', 'wp_new_comment_notify_postauthor' );
2079
+			add_action('wp_set_comment_status', 'wp_new_comment_notify_postauthor');
2080 2080
 			break;
2081 2081
 		case 'spam':
2082 2082
 			$status = 'spam';
@@ -2090,16 +2090,16 @@  discard block
 block discarded – undo
2090 2090
 
2091 2091
 	$comment_old = clone get_comment($comment_id);
2092 2092
 
2093
-	if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array( 'comment_ID' => $comment_old->comment_ID ) ) ) {
2094
-		if ( $wp_error )
2093
+	if ( ! $wpdb->update($wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_old->comment_ID))) {
2094
+		if ($wp_error)
2095 2095
 			return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
2096 2096
 		else
2097 2097
 			return false;
2098 2098
 	}
2099 2099
 
2100
-	clean_comment_cache( $comment_old->comment_ID );
2100
+	clean_comment_cache($comment_old->comment_ID);
2101 2101
 
2102
-	$comment = get_comment( $comment_old->comment_ID );
2102
+	$comment = get_comment($comment_old->comment_ID);
2103 2103
 
2104 2104
 	/**
2105 2105
 	 * Fires immediately before transitioning a comment's status from one to another
@@ -2111,7 +2111,7 @@  discard block
 block discarded – undo
2111 2111
 	 * @param string|bool $comment_status Current comment status. Possible values include
2112 2112
 	 *                                    'hold', 'approve', 'spam', 'trash', or false.
2113 2113
 	 */
2114
-	do_action( 'wp_set_comment_status', $comment->comment_ID, $comment_status );
2114
+	do_action('wp_set_comment_status', $comment->comment_ID, $comment_status);
2115 2115
 
2116 2116
 	wp_transition_comment_status($comment_status, $comment_old->comment_approved, $comment);
2117 2117
 
@@ -2137,12 +2137,12 @@  discard block
 block discarded – undo
2137 2137
 
2138 2138
 	// First, get all of the original fields
2139 2139
 	$comment = get_comment($commentarr['comment_ID'], ARRAY_A);
2140
-	if ( empty( $comment ) ) {
2140
+	if (empty($comment)) {
2141 2141
 		return 0;
2142 2142
 	}
2143 2143
 
2144 2144
 	// Make sure that the comment post ID is valid (if specified).
2145
-	if ( ! empty( $commentarr['comment_post_ID'] ) && ! get_post( $commentarr['comment_post_ID'] ) ) {
2145
+	if ( ! empty($commentarr['comment_post_ID']) && ! get_post($commentarr['comment_post_ID'])) {
2146 2146
 		return 0;
2147 2147
 	}
2148 2148
 
@@ -2154,10 +2154,10 @@  discard block
 block discarded – undo
2154 2154
 	// Merge old and new fields with new fields overwriting old ones.
2155 2155
 	$commentarr = array_merge($comment, $commentarr);
2156 2156
 
2157
-	$commentarr = wp_filter_comment( $commentarr );
2157
+	$commentarr = wp_filter_comment($commentarr);
2158 2158
 
2159 2159
 	// Now extract the merged array.
2160
-	$data = wp_unslash( $commentarr );
2160
+	$data = wp_unslash($commentarr);
2161 2161
 
2162 2162
 	/**
2163 2163
 	 * Filters the comment content before it is updated in the database.
@@ -2166,15 +2166,15 @@  discard block
 block discarded – undo
2166 2166
 	 *
2167 2167
 	 * @param string $comment_content The comment data.
2168 2168
 	 */
2169
-	$data['comment_content'] = apply_filters( 'comment_save_pre', $data['comment_content'] );
2169
+	$data['comment_content'] = apply_filters('comment_save_pre', $data['comment_content']);
2170 2170
 
2171
-	$data['comment_date_gmt'] = get_gmt_from_date( $data['comment_date'] );
2171
+	$data['comment_date_gmt'] = get_gmt_from_date($data['comment_date']);
2172 2172
 
2173
-	if ( ! isset( $data['comment_approved'] ) ) {
2173
+	if ( ! isset($data['comment_approved'])) {
2174 2174
 		$data['comment_approved'] = 1;
2175
-	} elseif ( 'hold' == $data['comment_approved'] ) {
2175
+	} elseif ('hold' == $data['comment_approved']) {
2176 2176
 		$data['comment_approved'] = 0;
2177
-	} elseif ( 'approve' == $data['comment_approved'] ) {
2177
+	} elseif ('approve' == $data['comment_approved']) {
2178 2178
 		$data['comment_approved'] = 1;
2179 2179
 	}
2180 2180
 
@@ -2192,15 +2192,15 @@  discard block
 block discarded – undo
2192 2192
 	 * @param array $comment    The old, unslashed comment data.
2193 2193
 	 * @param array $commentarr The new, raw comment data.
2194 2194
 	 */
2195
-	$data = apply_filters( 'wp_update_comment_data', $data, $comment, $commentarr );
2195
+	$data = apply_filters('wp_update_comment_data', $data, $comment, $commentarr);
2196 2196
 
2197
-	$keys = array( 'comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP' );
2198
-	$data = wp_array_slice_assoc( $data, $keys );
2197
+	$keys = array('comment_post_ID', 'comment_content', 'comment_author', 'comment_author_email', 'comment_approved', 'comment_karma', 'comment_author_url', 'comment_date', 'comment_date_gmt', 'comment_type', 'comment_parent', 'user_id', 'comment_agent', 'comment_author_IP');
2198
+	$data = wp_array_slice_assoc($data, $keys);
2199 2199
 
2200
-	$rval = $wpdb->update( $wpdb->comments, $data, compact( 'comment_ID' ) );
2200
+	$rval = $wpdb->update($wpdb->comments, $data, compact('comment_ID'));
2201 2201
 
2202
-	clean_comment_cache( $comment_ID );
2203
-	wp_update_comment_count( $comment_post_ID );
2202
+	clean_comment_cache($comment_ID);
2203
+	wp_update_comment_count($comment_post_ID);
2204 2204
 	/**
2205 2205
 	 * Fires immediately after a comment is updated in the database.
2206 2206
 	 *
@@ -2212,7 +2212,7 @@  discard block
 block discarded – undo
2212 2212
 	 * @param int   $comment_ID The comment ID.
2213 2213
 	 * @param array $data       Comment data.
2214 2214
 	 */
2215
-	do_action( 'edit_comment', $comment_ID, $data );
2215
+	do_action('edit_comment', $comment_ID, $data);
2216 2216
 	$comment = get_comment($comment_ID);
2217 2217
 	wp_transition_comment_status($comment->comment_approved, $old_status, $comment);
2218 2218
 	return $rval;
@@ -2232,14 +2232,14 @@  discard block
 block discarded – undo
2232 2232
  * @param bool $defer
2233 2233
  * @return bool
2234 2234
  */
2235
-function wp_defer_comment_counting($defer=null) {
2235
+function wp_defer_comment_counting($defer = null) {
2236 2236
 	static $_defer = false;
2237 2237
 
2238
-	if ( is_bool($defer) ) {
2238
+	if (is_bool($defer)) {
2239 2239
 		$_defer = $defer;
2240 2240
 		// flush any deferred counts
2241
-		if ( !$defer )
2242
-			wp_update_comment_count( null, true );
2241
+		if ( ! $defer)
2242
+			wp_update_comment_count(null, true);
2243 2243
 	}
2244 2244
 
2245 2245
 	return $_defer;
@@ -2267,26 +2267,26 @@  discard block
 block discarded – undo
2267 2267
  * @return bool|void True on success, false on failure or if post with ID does
2268 2268
  *                   not exist.
2269 2269
  */
2270
-function wp_update_comment_count($post_id, $do_deferred=false) {
2270
+function wp_update_comment_count($post_id, $do_deferred = false) {
2271 2271
 	static $_deferred = array();
2272 2272
 
2273
-	if ( empty( $post_id ) && ! $do_deferred ) {
2273
+	if (empty($post_id) && ! $do_deferred) {
2274 2274
 		return false;
2275 2275
 	}
2276 2276
 
2277
-	if ( $do_deferred ) {
2277
+	if ($do_deferred) {
2278 2278
 		$_deferred = array_unique($_deferred);
2279
-		foreach ( $_deferred as $i => $_post_id ) {
2279
+		foreach ($_deferred as $i => $_post_id) {
2280 2280
 			wp_update_comment_count_now($_post_id);
2281
-			unset( $_deferred[$i] ); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */
2281
+			unset($_deferred[$i]); /** @todo Move this outside of the foreach and reset $_deferred to an array instead */
2282 2282
 		}
2283 2283
 	}
2284 2284
 
2285
-	if ( wp_defer_comment_counting() ) {
2285
+	if (wp_defer_comment_counting()) {
2286 2286
 		$_deferred[] = $post_id;
2287 2287
 		return true;
2288 2288
 	}
2289
-	elseif ( $post_id ) {
2289
+	elseif ($post_id) {
2290 2290
 		return wp_update_comment_count_now($post_id);
2291 2291
 	}
2292 2292
 
@@ -2305,13 +2305,13 @@  discard block
 block discarded – undo
2305 2305
 function wp_update_comment_count_now($post_id) {
2306 2306
 	global $wpdb;
2307 2307
 	$post_id = (int) $post_id;
2308
-	if ( !$post_id )
2308
+	if ( ! $post_id)
2309 2309
 		return false;
2310 2310
 
2311
-	wp_cache_delete( 'comments-0', 'counts' );
2312
-	wp_cache_delete( "comments-{$post_id}", 'counts' );
2311
+	wp_cache_delete('comments-0', 'counts');
2312
+	wp_cache_delete("comments-{$post_id}", 'counts');
2313 2313
 
2314
-	if ( !$post = get_post($post_id) )
2314
+	if ( ! $post = get_post($post_id))
2315 2315
 		return false;
2316 2316
 
2317 2317
 	$old = (int) $post->comment_count;
@@ -2325,17 +2325,17 @@  discard block
 block discarded – undo
2325 2325
 	 * @param int $old     The old comment count.
2326 2326
 	 * @param int $post_id Post ID.
2327 2327
 	 */
2328
-	$new = apply_filters( 'pre_wp_update_comment_count_now', null, $old, $post_id );
2328
+	$new = apply_filters('pre_wp_update_comment_count_now', null, $old, $post_id);
2329 2329
 
2330
-	if ( is_null( $new ) ) {
2331
-		$new = (int) $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id ) );
2330
+	if (is_null($new)) {
2331
+		$new = (int) $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id));
2332 2332
 	} else {
2333 2333
 		$new = (int) $new;
2334 2334
 	}
2335 2335
 
2336
-	$wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
2336
+	$wpdb->update($wpdb->posts, array('comment_count' => $new), array('ID' => $post_id));
2337 2337
 
2338
-	clean_post_cache( $post );
2338
+	clean_post_cache($post);
2339 2339
 
2340 2340
 	/**
2341 2341
 	 * Fires immediately after a post's comment count is updated in the database.
@@ -2346,9 +2346,9 @@  discard block
 block discarded – undo
2346 2346
 	 * @param int $new     The new comment count.
2347 2347
 	 * @param int $old     The old comment count.
2348 2348
 	 */
2349
-	do_action( 'wp_update_comment_count', $post_id, $new, $old );
2349
+	do_action('wp_update_comment_count', $post_id, $new, $old);
2350 2350
 	/** This action is documented in wp-includes/post.php */
2351
-	do_action( 'edit_post', $post_id, $post );
2351
+	do_action('edit_post', $post_id, $post);
2352 2352
 
2353 2353
 	return true;
2354 2354
 }
@@ -2370,9 +2370,9 @@  discard block
 block discarded – undo
2370 2370
  * @param int $deprecated Not Used.
2371 2371
  * @return false|string False on failure, string containing URI on success.
2372 2372
  */
2373
-function discover_pingback_server_uri( $url, $deprecated = '' ) {
2374
-	if ( !empty( $deprecated ) )
2375
-		_deprecated_argument( __FUNCTION__, '2.7.0' );
2373
+function discover_pingback_server_uri($url, $deprecated = '') {
2374
+	if ( ! empty($deprecated))
2375
+		_deprecated_argument(__FUNCTION__, '2.7.0');
2376 2376
 
2377 2377
 	$pingback_str_dquote = 'rel="pingback"';
2378 2378
 	$pingback_str_squote = 'rel=\'pingback\'';
@@ -2380,47 +2380,47 @@  discard block
 block discarded – undo
2380 2380
 	/** @todo Should use Filter Extension or custom preg_match instead. */
2381 2381
 	$parsed_url = parse_url($url);
2382 2382
 
2383
-	if ( ! isset( $parsed_url['host'] ) ) // Not a URL. This should never happen.
2383
+	if ( ! isset($parsed_url['host'])) // Not a URL. This should never happen.
2384 2384
 		return false;
2385 2385
 
2386 2386
 	//Do not search for a pingback server on our own uploads
2387 2387
 	$uploads_dir = wp_get_upload_dir();
2388
-	if ( 0 === strpos($url, $uploads_dir['baseurl']) )
2388
+	if (0 === strpos($url, $uploads_dir['baseurl']))
2389 2389
 		return false;
2390 2390
 
2391
-	$response = wp_safe_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
2391
+	$response = wp_safe_remote_head($url, array('timeout' => 2, 'httpversion' => '1.0'));
2392 2392
 
2393
-	if ( is_wp_error( $response ) )
2393
+	if (is_wp_error($response))
2394 2394
 		return false;
2395 2395
 
2396
-	if ( wp_remote_retrieve_header( $response, 'x-pingback' ) )
2397
-		return wp_remote_retrieve_header( $response, 'x-pingback' );
2396
+	if (wp_remote_retrieve_header($response, 'x-pingback'))
2397
+		return wp_remote_retrieve_header($response, 'x-pingback');
2398 2398
 
2399 2399
 	// Not an (x)html, sgml, or xml page, no use going further.
2400
-	if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) )
2400
+	if (preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header($response, 'content-type')))
2401 2401
 		return false;
2402 2402
 
2403 2403
 	// Now do a GET since we're going to look in the html headers (and we're sure it's not a binary file)
2404
-	$response = wp_safe_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
2404
+	$response = wp_safe_remote_get($url, array('timeout' => 2, 'httpversion' => '1.0'));
2405 2405
 
2406
-	if ( is_wp_error( $response ) )
2406
+	if (is_wp_error($response))
2407 2407
 		return false;
2408 2408
 
2409
-	$contents = wp_remote_retrieve_body( $response );
2409
+	$contents = wp_remote_retrieve_body($response);
2410 2410
 
2411 2411
 	$pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
2412 2412
 	$pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
2413
-	if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
2413
+	if ($pingback_link_offset_dquote || $pingback_link_offset_squote) {
2414 2414
 		$quote = ($pingback_link_offset_dquote) ? '"' : '\'';
2415
-		$pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
2415
+		$pingback_link_offset = ($quote == '"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
2416 2416
 		$pingback_href_pos = @strpos($contents, 'href=', $pingback_link_offset);
2417
-		$pingback_href_start = $pingback_href_pos+6;
2417
+		$pingback_href_start = $pingback_href_pos + 6;
2418 2418
 		$pingback_href_end = @strpos($contents, $quote, $pingback_href_start);
2419 2419
 		$pingback_server_url_len = $pingback_href_end - $pingback_href_start;
2420 2420
 		$pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
2421 2421
 
2422 2422
 		// We may find rel="pingback" but an incomplete pingback URL
2423
-		if ( $pingback_server_url_len > 0 ) { // We got it!
2423
+		if ($pingback_server_url_len > 0) { // We got it!
2424 2424
 			return $pingback_server_url;
2425 2425
 		}
2426 2426
 	}
@@ -2440,20 +2440,20 @@  discard block
 block discarded – undo
2440 2440
 
2441 2441
 	// Do pingbacks
2442 2442
 	while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) {
2443
-		delete_metadata_by_mid( 'post', $ping->meta_id );
2444
-		pingback( $ping->post_content, $ping->ID );
2443
+		delete_metadata_by_mid('post', $ping->meta_id);
2444
+		pingback($ping->post_content, $ping->ID);
2445 2445
 	}
2446 2446
 
2447 2447
 	// Do Enclosures
2448 2448
 	while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
2449
-		delete_metadata_by_mid( 'post', $enclosure->meta_id );
2450
-		do_enclose( $enclosure->post_content, $enclosure->ID );
2449
+		delete_metadata_by_mid('post', $enclosure->meta_id);
2450
+		do_enclose($enclosure->post_content, $enclosure->ID);
2451 2451
 	}
2452 2452
 
2453 2453
 	// Do Trackbacks
2454 2454
 	$trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'");
2455
-	if ( is_array($trackbacks) )
2456
-		foreach ( $trackbacks as $trackback )
2455
+	if (is_array($trackbacks))
2456
+		foreach ($trackbacks as $trackback)
2457 2457
 			do_trackbacks($trackback);
2458 2458
 
2459 2459
 	//Do Update Services/Generic Pings
@@ -2470,44 +2470,44 @@  discard block
 block discarded – undo
2470 2470
  *
2471 2471
  * @param int|WP_Post $post_id Post object or ID to do trackbacks on.
2472 2472
  */
2473
-function do_trackbacks( $post_id ) {
2473
+function do_trackbacks($post_id) {
2474 2474
 	global $wpdb;
2475
-	$post = get_post( $post_id );
2476
-	if ( ! $post ) {
2475
+	$post = get_post($post_id);
2476
+	if ( ! $post) {
2477 2477
 		return false;
2478 2478
 	}
2479 2479
 
2480
-	$to_ping = get_to_ping( $post );
2481
-	$pinged  = get_pung( $post );
2482
-	if ( empty( $to_ping ) ) {
2483
-		$wpdb->update($wpdb->posts, array( 'to_ping' => '' ), array( 'ID' => $post->ID ) );
2480
+	$to_ping = get_to_ping($post);
2481
+	$pinged  = get_pung($post);
2482
+	if (empty($to_ping)) {
2483
+		$wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post->ID));
2484 2484
 		return;
2485 2485
 	}
2486 2486
 
2487
-	if ( empty($post->post_excerpt) ) {
2487
+	if (empty($post->post_excerpt)) {
2488 2488
 		/** This filter is documented in wp-includes/post-template.php */
2489
-		$excerpt = apply_filters( 'the_content', $post->post_content, $post->ID );
2489
+		$excerpt = apply_filters('the_content', $post->post_content, $post->ID);
2490 2490
 	} else {
2491 2491
 		/** This filter is documented in wp-includes/post-template.php */
2492
-		$excerpt = apply_filters( 'the_excerpt', $post->post_excerpt );
2492
+		$excerpt = apply_filters('the_excerpt', $post->post_excerpt);
2493 2493
 	}
2494 2494
 
2495 2495
 	$excerpt = str_replace(']]>', ']]&gt;', $excerpt);
2496 2496
 	$excerpt = wp_html_excerpt($excerpt, 252, '&#8230;');
2497 2497
 
2498 2498
 	/** This filter is documented in wp-includes/post-template.php */
2499
-	$post_title = apply_filters( 'the_title', $post->post_title, $post->ID );
2499
+	$post_title = apply_filters('the_title', $post->post_title, $post->ID);
2500 2500
 	$post_title = strip_tags($post_title);
2501 2501
 
2502
-	if ( $to_ping ) {
2503
-		foreach ( (array) $to_ping as $tb_ping ) {
2502
+	if ($to_ping) {
2503
+		foreach ((array) $to_ping as $tb_ping) {
2504 2504
 			$tb_ping = trim($tb_ping);
2505
-			if ( !in_array($tb_ping, $pinged) ) {
2506
-				trackback( $tb_ping, $post_title, $excerpt, $post->ID );
2505
+			if ( ! in_array($tb_ping, $pinged)) {
2506
+				trackback($tb_ping, $post_title, $excerpt, $post->ID);
2507 2507
 				$pinged[] = $tb_ping;
2508 2508
 			} else {
2509
-				$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s,
2510
-					'')) WHERE ID = %d", $tb_ping, $post->ID ) );
2509
+				$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s,
2510
+					'')) WHERE ID = %d", $tb_ping, $post->ID));
2511 2511
 			}
2512 2512
 		}
2513 2513
 	}
@@ -2521,13 +2521,13 @@  discard block
 block discarded – undo
2521 2521
  * @param int $post_id Post ID.
2522 2522
  * @return int Same as Post ID from parameter
2523 2523
  */
2524
-function generic_ping( $post_id = 0 ) {
2524
+function generic_ping($post_id = 0) {
2525 2525
 	$services = get_option('ping_sites');
2526 2526
 
2527 2527
 	$services = explode("\n", $services);
2528
-	foreach ( (array) $services as $service ) {
2528
+	foreach ((array) $services as $service) {
2529 2529
 		$service = trim($service);
2530
-		if ( '' != $service )
2530
+		if ('' != $service)
2531 2531
 			weblog_ping($service);
2532 2532
 	}
2533 2533
 
@@ -2543,27 +2543,27 @@  discard block
 block discarded – undo
2543 2543
  * @param string $content Post content to check for links. If empty will retrieve from post.
2544 2544
  * @param int|WP_Post $post_id Post Object or ID.
2545 2545
  */
2546
-function pingback( $content, $post_id ) {
2547
-	include_once( ABSPATH . WPINC . '/class-IXR.php' );
2548
-	include_once( ABSPATH . WPINC . '/class-wp-http-ixr-client.php' );
2546
+function pingback($content, $post_id) {
2547
+	include_once(ABSPATH.WPINC.'/class-IXR.php');
2548
+	include_once(ABSPATH.WPINC.'/class-wp-http-ixr-client.php');
2549 2549
 
2550 2550
 	// original code by Mort (http://mort.mine.nu:8080)
2551 2551
 	$post_links = array();
2552 2552
 
2553
-	$post = get_post( $post_id );
2554
-	if ( ! $post ) {
2553
+	$post = get_post($post_id);
2554
+	if ( ! $post) {
2555 2555
 		return;
2556 2556
 	}
2557 2557
 
2558
-	$pung = get_pung( $post );
2558
+	$pung = get_pung($post);
2559 2559
 
2560
-	if ( empty( $content ) ) {
2560
+	if (empty($content)) {
2561 2561
 		$content = $post->post_content;
2562 2562
 	}
2563 2563
 
2564 2564
 	// Step 1
2565 2565
 	// Parsing the post, external links (if any) are stored in the $post_links array
2566
-	$post_links_temp = wp_extract_urls( $content );
2566
+	$post_links_temp = wp_extract_urls($content);
2567 2567
 
2568 2568
 	// Step 2.
2569 2569
 	// Walking thru the links array
@@ -2574,19 +2574,19 @@  discard block
 block discarded – undo
2574 2574
 	// http://dummy-weblog.org/post.php
2575 2575
 	// We don't wanna ping first and second types, even if they have a valid <link/>
2576 2576
 
2577
-	foreach ( (array) $post_links_temp as $link_test ) :
2578
-		if ( ! in_array( $link_test, $pung ) && ( url_to_postid( $link_test ) != $post->ID ) // If we haven't pung it already and it isn't a link to itself
2579
-				&& !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
2580
-			if ( $test = @parse_url($link_test) ) {
2581
-				if ( isset($test['query']) )
2577
+	foreach ((array) $post_links_temp as $link_test) :
2578
+		if ( ! in_array($link_test, $pung) && (url_to_postid($link_test) != $post->ID) // If we haven't pung it already and it isn't a link to itself
2579
+				&& ! is_local_attachment($link_test)) : // Also, let's never ping local attachments.
2580
+			if ($test = @parse_url($link_test)) {
2581
+				if (isset($test['query']))
2582 2582
 					$post_links[] = $link_test;
2583
-				elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) )
2583
+				elseif (isset($test['path']) && ($test['path'] != '/') && ($test['path'] != ''))
2584 2584
 					$post_links[] = $link_test;
2585 2585
 			}
2586 2586
 		endif;
2587 2587
 	endforeach;
2588 2588
 
2589
-	$post_links = array_unique( $post_links );
2589
+	$post_links = array_unique($post_links);
2590 2590
 	/**
2591 2591
 	 * Fires just before pinging back links found in a post.
2592 2592
 	 *
@@ -2596,15 +2596,15 @@  discard block
 block discarded – undo
2596 2596
 	 * @param array &$pung       Whether a link has already been pinged, passed by reference.
2597 2597
 	 * @param int   $post_ID     The post ID.
2598 2598
 	 */
2599
-	do_action_ref_array( 'pre_ping', array( &$post_links, &$pung, $post->ID ) );
2599
+	do_action_ref_array('pre_ping', array(&$post_links, &$pung, $post->ID));
2600 2600
 
2601
-	foreach ( (array) $post_links as $pagelinkedto ) {
2602
-		$pingback_server_url = discover_pingback_server_uri( $pagelinkedto );
2601
+	foreach ((array) $post_links as $pagelinkedto) {
2602
+		$pingback_server_url = discover_pingback_server_uri($pagelinkedto);
2603 2603
 
2604
-		if ( $pingback_server_url ) {
2605
-			@ set_time_limit( 60 );
2604
+		if ($pingback_server_url) {
2605
+			@ set_time_limit(60);
2606 2606
 			// Now, the RPC call
2607
-			$pagelinkedfrom = get_permalink( $post );
2607
+			$pagelinkedfrom = get_permalink($post);
2608 2608
 
2609 2609
 			// using a timeout of 3 seconds should be enough to cover slow servers
2610 2610
 			$client = new WP_HTTP_IXR_Client($pingback_server_url);
@@ -2621,12 +2621,12 @@  discard block
 block discarded – undo
2621 2621
 			 * @param string $pagelinkedto        URL of page linked to.
2622 2622
 			 * @param string $pagelinkedfrom      URL of page linked from.
2623 2623
 			 */
2624
-			$client->useragent = apply_filters( 'pingback_useragent', $client->useragent . ' -- WordPress/' . get_bloginfo( 'version' ), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom );
2624
+			$client->useragent = apply_filters('pingback_useragent', $client->useragent.' -- WordPress/'.get_bloginfo('version'), $client->useragent, $pingback_server_url, $pagelinkedto, $pagelinkedfrom);
2625 2625
 			// when set to true, this outputs debug messages by itself
2626 2626
 			$client->debug = false;
2627 2627
 
2628
-			if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered
2629
-				add_ping( $post, $pagelinkedto );
2628
+			if ($client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || (isset($client->error->code) && 48 == $client->error->code)) // Already registered
2629
+				add_ping($post, $pagelinkedto);
2630 2630
 		}
2631 2631
 	}
2632 2632
 }
@@ -2640,7 +2640,7 @@  discard block
 block discarded – undo
2640 2640
  * @return mixed Empty string if blog is not public, returns $sites, if site is public.
2641 2641
  */
2642 2642
 function privacy_ping_filter($sites) {
2643
-	if ( '0' != get_option('blog_public') )
2643
+	if ('0' != get_option('blog_public'))
2644 2644
 		return $sites;
2645 2645
 	else
2646 2646
 		return '';
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
 function trackback($trackback_url, $title, $excerpt, $ID) {
2665 2665
 	global $wpdb;
2666 2666
 
2667
-	if ( empty($trackback_url) )
2667
+	if (empty($trackback_url))
2668 2668
 		return;
2669 2669
 
2670 2670
 	$options = array();
@@ -2676,13 +2676,13 @@  discard block
 block discarded – undo
2676 2676
 		'excerpt' => $excerpt
2677 2677
 	);
2678 2678
 
2679
-	$response = wp_safe_remote_post( $trackback_url, $options );
2679
+	$response = wp_safe_remote_post($trackback_url, $options);
2680 2680
 
2681
-	if ( is_wp_error( $response ) )
2681
+	if (is_wp_error($response))
2682 2682
 		return;
2683 2683
 
2684
-	$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID) );
2685
-	return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID) );
2684
+	$wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID));
2685
+	return $wpdb->query($wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID));
2686 2686
 }
2687 2687
 
2688 2688
 /**
@@ -2694,18 +2694,18 @@  discard block
 block discarded – undo
2694 2694
  * @param string $path Path to send the ping.
2695 2695
  */
2696 2696
 function weblog_ping($server = '', $path = '') {
2697
-	include_once( ABSPATH . WPINC . '/class-IXR.php' );
2698
-	include_once( ABSPATH . WPINC . '/class-wp-http-ixr-client.php' );
2697
+	include_once(ABSPATH.WPINC.'/class-IXR.php');
2698
+	include_once(ABSPATH.WPINC.'/class-wp-http-ixr-client.php');
2699 2699
 
2700 2700
 	// using a timeout of 3 seconds should be enough to cover slow servers
2701
-	$client = new WP_HTTP_IXR_Client($server, ((!strlen(trim($path)) || ('/' == $path)) ? false : $path));
2701
+	$client = new WP_HTTP_IXR_Client($server, (( ! strlen(trim($path)) || ('/' == $path)) ? false : $path));
2702 2702
 	$client->timeout = 3;
2703
-	$client->useragent .= ' -- WordPress/' . get_bloginfo( 'version' );
2703
+	$client->useragent .= ' -- WordPress/'.get_bloginfo('version');
2704 2704
 
2705 2705
 	// when set to true, this outputs debug messages by itself
2706 2706
 	$client->debug = false;
2707
-	$home = trailingslashit( home_url() );
2708
-	if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
2707
+	$home = trailingslashit(home_url());
2708
+	if ( ! $client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) // then try a normal ping
2709 2709
 		$client->query('weblogUpdates.ping', get_option('blogname'), $home);
2710 2710
 }
2711 2711
 
@@ -2718,8 +2718,8 @@  discard block
 block discarded – undo
2718 2718
  * @param string $source_uri
2719 2719
  * @return string
2720 2720
  */
2721
-function pingback_ping_source_uri( $source_uri ) {
2722
-	return (string) wp_http_validate_url( $source_uri );
2721
+function pingback_ping_source_uri($source_uri) {
2722
+	return (string) wp_http_validate_url($source_uri);
2723 2723
 }
2724 2724
 
2725 2725
 /**
@@ -2734,10 +2734,10 @@  discard block
 block discarded – undo
2734 2734
  * @param IXR_Error $ixr_error
2735 2735
  * @return IXR_Error
2736 2736
  */
2737
-function xmlrpc_pingback_error( $ixr_error ) {
2738
-	if ( $ixr_error->code === 48 )
2737
+function xmlrpc_pingback_error($ixr_error) {
2738
+	if ($ixr_error->code === 48)
2739 2739
 		return $ixr_error;
2740
-	return new IXR_Error( 0, '' );
2740
+	return new IXR_Error(0, '');
2741 2741
 }
2742 2742
 
2743 2743
 //
@@ -2752,8 +2752,8 @@  discard block
 block discarded – undo
2752 2752
  * @param int|array $ids Comment ID or an array of comment IDs to remove from cache.
2753 2753
  */
2754 2754
 function clean_comment_cache($ids) {
2755
-	foreach ( (array) $ids as $id ) {
2756
-		wp_cache_delete( $id, 'comment' );
2755
+	foreach ((array) $ids as $id) {
2756
+		wp_cache_delete($id, 'comment');
2757 2757
 
2758 2758
 		/**
2759 2759
 		 * Fires immediately after a comment has been removed from the object cache.
@@ -2762,10 +2762,10 @@  discard block
 block discarded – undo
2762 2762
 		 *
2763 2763
 		 * @param int $id Comment ID.
2764 2764
 		 */
2765
-		do_action( 'clean_comment_cache', $id );
2765
+		do_action('clean_comment_cache', $id);
2766 2766
 	}
2767 2767
 
2768
-	wp_cache_set( 'last_changed', microtime(), 'comment' );
2768
+	wp_cache_set('last_changed', microtime(), 'comment');
2769 2769
 }
2770 2770
 
2771 2771
 /**
@@ -2781,17 +2781,17 @@  discard block
 block discarded – undo
2781 2781
  * @param array $comments          Array of comment row objects
2782 2782
  * @param bool  $update_meta_cache Whether to update commentmeta cache. Default true.
2783 2783
  */
2784
-function update_comment_cache( $comments, $update_meta_cache = true ) {
2785
-	foreach ( (array) $comments as $comment )
2784
+function update_comment_cache($comments, $update_meta_cache = true) {
2785
+	foreach ((array) $comments as $comment)
2786 2786
 		wp_cache_add($comment->comment_ID, $comment, 'comment');
2787 2787
 
2788
-	if ( $update_meta_cache ) {
2788
+	if ($update_meta_cache) {
2789 2789
 		// Avoid `wp_list_pluck()` in case `$comments` is passed by reference.
2790 2790
 		$comment_ids = array();
2791
-		foreach ( $comments as $comment ) {
2791
+		foreach ($comments as $comment) {
2792 2792
 			$comment_ids[] = $comment->comment_ID;
2793 2793
 		}
2794
-		update_meta_cache( 'comment', $comment_ids );
2794
+		update_meta_cache('comment', $comment_ids);
2795 2795
 	}
2796 2796
 }
2797 2797
 
@@ -2807,14 +2807,14 @@  discard block
 block discarded – undo
2807 2807
  * @param array $comment_ids       Array of comment IDs.
2808 2808
  * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
2809 2809
  */
2810
-function _prime_comment_caches( $comment_ids, $update_meta_cache = true ) {
2810
+function _prime_comment_caches($comment_ids, $update_meta_cache = true) {
2811 2811
 	global $wpdb;
2812 2812
 
2813
-	$non_cached_ids = _get_non_cached_ids( $comment_ids, 'comment' );
2814
-	if ( !empty( $non_cached_ids ) ) {
2815
-		$fresh_comments = $wpdb->get_results( sprintf( "SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", join( ",", array_map( 'intval', $non_cached_ids ) ) ) );
2813
+	$non_cached_ids = _get_non_cached_ids($comment_ids, 'comment');
2814
+	if ( ! empty($non_cached_ids)) {
2815
+		$fresh_comments = $wpdb->get_results(sprintf("SELECT $wpdb->comments.* FROM $wpdb->comments WHERE comment_ID IN (%s)", join(",", array_map('intval', $non_cached_ids))));
2816 2816
 
2817
-		update_comment_cache( $fresh_comments, $update_meta_cache );
2817
+		update_comment_cache($fresh_comments, $update_meta_cache);
2818 2818
 	}
2819 2819
 }
2820 2820
 
@@ -2832,8 +2832,8 @@  discard block
 block discarded – undo
2832 2832
  * @param WP_Query $query Query object.
2833 2833
  * @return array
2834 2834
  */
2835
-function _close_comments_for_old_posts( $posts, $query ) {
2836
-	if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
2835
+function _close_comments_for_old_posts($posts, $query) {
2836
+	if (empty($posts) || ! $query->is_singular() || ! get_option('close_comments_for_old_posts'))
2837 2837
 		return $posts;
2838 2838
 
2839 2839
 	/**
@@ -2843,15 +2843,15 @@  discard block
 block discarded – undo
2843 2843
 	 *
2844 2844
 	 * @param array $post_types An array of registered post types. Default array with 'post'.
2845 2845
 	 */
2846
-	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
2847
-	if ( ! in_array( $posts[0]->post_type, $post_types ) )
2846
+	$post_types = apply_filters('close_comments_for_post_types', array('post'));
2847
+	if ( ! in_array($posts[0]->post_type, $post_types))
2848 2848
 		return $posts;
2849 2849
 
2850
-	$days_old = (int) get_option( 'close_comments_days_old' );
2851
-	if ( ! $days_old )
2850
+	$days_old = (int) get_option('close_comments_days_old');
2851
+	if ( ! $days_old)
2852 2852
 		return $posts;
2853 2853
 
2854
-	if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
2854
+	if (time() - strtotime($posts[0]->post_date_gmt) > ($days_old * DAY_IN_SECONDS)) {
2855 2855
 		$posts[0]->comment_status = 'closed';
2856 2856
 		$posts[0]->ping_status = 'closed';
2857 2857
 	}
@@ -2869,30 +2869,30 @@  discard block
 block discarded – undo
2869 2869
  * @param int $post_id Post ID
2870 2870
  * @return bool $open
2871 2871
  */
2872
-function _close_comments_for_old_post( $open, $post_id ) {
2873
-	if ( ! $open )
2872
+function _close_comments_for_old_post($open, $post_id) {
2873
+	if ( ! $open)
2874 2874
 		return $open;
2875 2875
 
2876
-	if ( !get_option('close_comments_for_old_posts') )
2876
+	if ( ! get_option('close_comments_for_old_posts'))
2877 2877
 		return $open;
2878 2878
 
2879 2879
 	$days_old = (int) get_option('close_comments_days_old');
2880
-	if ( !$days_old )
2880
+	if ( ! $days_old)
2881 2881
 		return $open;
2882 2882
 
2883 2883
 	$post = get_post($post_id);
2884 2884
 
2885 2885
 	/** This filter is documented in wp-includes/comment.php */
2886
-	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
2887
-	if ( ! in_array( $post->post_type, $post_types ) )
2886
+	$post_types = apply_filters('close_comments_for_post_types', array('post'));
2887
+	if ( ! in_array($post->post_type, $post_types))
2888 2888
 		return $open;
2889 2889
 
2890 2890
 	// Undated drafts should not show up as comments closed.
2891
-	if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
2891
+	if ('0000-00-00 00:00:00' === $post->post_date_gmt) {
2892 2892
 		return $open;
2893 2893
 	}
2894 2894
 
2895
-	if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) )
2895
+	if (time() - strtotime($post->post_date_gmt) > ($days_old * DAY_IN_SECONDS))
2896 2896
 		return false;
2897 2897
 
2898 2898
 	return $open;
@@ -2919,33 +2919,33 @@  discard block
 block discarded – undo
2919 2919
  * }
2920 2920
  * @return WP_Comment|WP_Error A WP_Comment object on success, a WP_Error object on failure.
2921 2921
  */
2922
-function wp_handle_comment_submission( $comment_data ) {
2922
+function wp_handle_comment_submission($comment_data) {
2923 2923
 
2924 2924
 	$comment_post_ID = $comment_parent = 0;
2925 2925
 	$comment_author = $comment_author_email = $comment_author_url = $comment_content = null;
2926 2926
 
2927
-	if ( isset( $comment_data['comment_post_ID'] ) ) {
2927
+	if (isset($comment_data['comment_post_ID'])) {
2928 2928
 		$comment_post_ID = (int) $comment_data['comment_post_ID'];
2929 2929
 	}
2930
-	if ( isset( $comment_data['author'] ) && is_string( $comment_data['author'] ) ) {
2931
-		$comment_author = trim( strip_tags( $comment_data['author'] ) );
2930
+	if (isset($comment_data['author']) && is_string($comment_data['author'])) {
2931
+		$comment_author = trim(strip_tags($comment_data['author']));
2932 2932
 	}
2933
-	if ( isset( $comment_data['email'] ) && is_string( $comment_data['email'] ) ) {
2934
-		$comment_author_email = trim( $comment_data['email'] );
2933
+	if (isset($comment_data['email']) && is_string($comment_data['email'])) {
2934
+		$comment_author_email = trim($comment_data['email']);
2935 2935
 	}
2936
-	if ( isset( $comment_data['url'] ) && is_string( $comment_data['url'] ) ) {
2937
-		$comment_author_url = trim( $comment_data['url'] );
2936
+	if (isset($comment_data['url']) && is_string($comment_data['url'])) {
2937
+		$comment_author_url = trim($comment_data['url']);
2938 2938
 	}
2939
-	if ( isset( $comment_data['comment'] ) && is_string( $comment_data['comment'] ) ) {
2940
-		$comment_content = trim( $comment_data['comment'] );
2939
+	if (isset($comment_data['comment']) && is_string($comment_data['comment'])) {
2940
+		$comment_content = trim($comment_data['comment']);
2941 2941
 	}
2942
-	if ( isset( $comment_data['comment_parent'] ) ) {
2943
-		$comment_parent = absint( $comment_data['comment_parent'] );
2942
+	if (isset($comment_data['comment_parent'])) {
2943
+		$comment_parent = absint($comment_data['comment_parent']);
2944 2944
 	}
2945 2945
 
2946
-	$post = get_post( $comment_post_ID );
2946
+	$post = get_post($comment_post_ID);
2947 2947
 
2948
-	if ( empty( $post->comment_status ) ) {
2948
+	if (empty($post->comment_status)) {
2949 2949
 
2950 2950
 		/**
2951 2951
 		 * Fires when a comment is attempted on a post that does not exist.
@@ -2954,22 +2954,22 @@  discard block
 block discarded – undo
2954 2954
 		 *
2955 2955
 		 * @param int $comment_post_ID Post ID.
2956 2956
 		 */
2957
-		do_action( 'comment_id_not_found', $comment_post_ID );
2957
+		do_action('comment_id_not_found', $comment_post_ID);
2958 2958
 
2959
-		return new WP_Error( 'comment_id_not_found' );
2959
+		return new WP_Error('comment_id_not_found');
2960 2960
 
2961 2961
 	}
2962 2962
 
2963 2963
 	// get_post_status() will get the parent status for attachments.
2964
-	$status = get_post_status( $post );
2964
+	$status = get_post_status($post);
2965 2965
 
2966
-	if ( ( 'private' == $status ) && ! current_user_can( 'read_post', $comment_post_ID ) ) {
2967
-		return new WP_Error( 'comment_id_not_found' );
2966
+	if (('private' == $status) && ! current_user_can('read_post', $comment_post_ID)) {
2967
+		return new WP_Error('comment_id_not_found');
2968 2968
 	}
2969 2969
 
2970
-	$status_obj = get_post_status_object( $status );
2970
+	$status_obj = get_post_status_object($status);
2971 2971
 
2972
-	if ( ! comments_open( $comment_post_ID ) ) {
2972
+	if ( ! comments_open($comment_post_ID)) {
2973 2973
 
2974 2974
 		/**
2975 2975
 		 * Fires when a comment is attempted on a post that has comments closed.
@@ -2978,11 +2978,11 @@  discard block
 block discarded – undo
2978 2978
 		 *
2979 2979
 		 * @param int $comment_post_ID Post ID.
2980 2980
 		 */
2981
-		do_action( 'comment_closed', $comment_post_ID );
2981
+		do_action('comment_closed', $comment_post_ID);
2982 2982
 
2983
-		return new WP_Error( 'comment_closed', __( 'Sorry, comments are closed for this item.' ), 403 );
2983
+		return new WP_Error('comment_closed', __('Sorry, comments are closed for this item.'), 403);
2984 2984
 
2985
-	} elseif ( 'trash' == $status ) {
2985
+	} elseif ('trash' == $status) {
2986 2986
 
2987 2987
 		/**
2988 2988
 		 * Fires when a comment is attempted on a trashed post.
@@ -2991,11 +2991,11 @@  discard block
 block discarded – undo
2991 2991
 		 *
2992 2992
 		 * @param int $comment_post_ID Post ID.
2993 2993
 		 */
2994
-		do_action( 'comment_on_trash', $comment_post_ID );
2994
+		do_action('comment_on_trash', $comment_post_ID);
2995 2995
 
2996
-		return new WP_Error( 'comment_on_trash' );
2996
+		return new WP_Error('comment_on_trash');
2997 2997
 
2998
-	} elseif ( ! $status_obj->public && ! $status_obj->private ) {
2998
+	} elseif ( ! $status_obj->public && ! $status_obj->private) {
2999 2999
 
3000 3000
 		/**
3001 3001
 		 * Fires when a comment is attempted on a post in draft mode.
@@ -3004,11 +3004,11 @@  discard block
 block discarded – undo
3004 3004
 		 *
3005 3005
 		 * @param int $comment_post_ID Post ID.
3006 3006
 		 */
3007
-		do_action( 'comment_on_draft', $comment_post_ID );
3007
+		do_action('comment_on_draft', $comment_post_ID);
3008 3008
 
3009
-		return new WP_Error( 'comment_on_draft' );
3009
+		return new WP_Error('comment_on_draft');
3010 3010
 
3011
-	} elseif ( post_password_required( $comment_post_ID ) ) {
3011
+	} elseif (post_password_required($comment_post_ID)) {
3012 3012
 
3013 3013
 		/**
3014 3014
 		 * Fires when a comment is attempted on a password-protected post.
@@ -3017,9 +3017,9 @@  discard block
 block discarded – undo
3017 3017
 		 *
3018 3018
 		 * @param int $comment_post_ID Post ID.
3019 3019
 		 */
3020
-		do_action( 'comment_on_password_protected', $comment_post_ID );
3020
+		do_action('comment_on_password_protected', $comment_post_ID);
3021 3021
 
3022
-		return new WP_Error( 'comment_on_password_protected' );
3022
+		return new WP_Error('comment_on_password_protected');
3023 3023
 
3024 3024
 	} else {
3025 3025
 
@@ -3030,46 +3030,46 @@  discard block
 block discarded – undo
3030 3030
 		 *
3031 3031
 		 * @param int $comment_post_ID Post ID.
3032 3032
 		 */
3033
-		do_action( 'pre_comment_on_post', $comment_post_ID );
3033
+		do_action('pre_comment_on_post', $comment_post_ID);
3034 3034
 
3035 3035
 	}
3036 3036
 
3037 3037
 	// If the user is logged in
3038 3038
 	$user = wp_get_current_user();
3039
-	if ( $user->exists() ) {
3040
-		if ( empty( $user->display_name ) ) {
3041
-			$user->display_name=$user->user_login;
3039
+	if ($user->exists()) {
3040
+		if (empty($user->display_name)) {
3041
+			$user->display_name = $user->user_login;
3042 3042
 		}
3043 3043
 		$comment_author       = $user->display_name;
3044 3044
 		$comment_author_email = $user->user_email;
3045 3045
 		$comment_author_url   = $user->user_url;
3046 3046
 		$user_ID              = $user->ID;
3047
-		if ( current_user_can( 'unfiltered_html' ) ) {
3048
-			if ( ! isset( $comment_data['_wp_unfiltered_html_comment'] )
3049
-				|| ! wp_verify_nonce( $comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_' . $comment_post_ID )
3047
+		if (current_user_can('unfiltered_html')) {
3048
+			if ( ! isset($comment_data['_wp_unfiltered_html_comment'])
3049
+				|| ! wp_verify_nonce($comment_data['_wp_unfiltered_html_comment'], 'unfiltered-html-comment_'.$comment_post_ID)
3050 3050
 			) {
3051 3051
 				kses_remove_filters(); // start with a clean slate
3052 3052
 				kses_init_filters(); // set up the filters
3053 3053
 			}
3054 3054
 		}
3055 3055
 	} else {
3056
-		if ( get_option( 'comment_registration' ) ) {
3057
-			return new WP_Error( 'not_logged_in', __( 'Sorry, you must be logged in to comment.' ), 403 );
3056
+		if (get_option('comment_registration')) {
3057
+			return new WP_Error('not_logged_in', __('Sorry, you must be logged in to comment.'), 403);
3058 3058
 		}
3059 3059
 	}
3060 3060
 
3061 3061
 	$comment_type = '';
3062 3062
 
3063
-	if ( get_option( 'require_name_email' ) && ! $user->exists() ) {
3064
-		if ( 6 > strlen( $comment_author_email ) || '' == $comment_author ) {
3065
-			return new WP_Error( 'require_name_email', __( '<strong>ERROR</strong>: please fill the required fields (name, email).' ), 200 );
3066
-		} elseif ( ! is_email( $comment_author_email ) ) {
3067
-			return new WP_Error( 'require_valid_email', __( '<strong>ERROR</strong>: please enter a valid email address.' ), 200 );
3063
+	if (get_option('require_name_email') && ! $user->exists()) {
3064
+		if (6 > strlen($comment_author_email) || '' == $comment_author) {
3065
+			return new WP_Error('require_name_email', __('<strong>ERROR</strong>: please fill the required fields (name, email).'), 200);
3066
+		} elseif ( ! is_email($comment_author_email)) {
3067
+			return new WP_Error('require_valid_email', __('<strong>ERROR</strong>: please enter a valid email address.'), 200);
3068 3068
 		}
3069 3069
 	}
3070 3070
 
3071
-	if ( '' == $comment_content ) {
3072
-		return new WP_Error( 'require_valid_comment', __( '<strong>ERROR</strong>: please type a comment.' ), 200 );
3071
+	if ('' == $comment_content) {
3072
+		return new WP_Error('require_valid_comment', __('<strong>ERROR</strong>: please type a comment.'), 200);
3073 3073
 	}
3074 3074
 
3075 3075
 	$commentdata = compact(
@@ -3083,19 +3083,19 @@  discard block
 block discarded – undo
3083 3083
 		'user_ID'
3084 3084
 	);
3085 3085
 
3086
-	$check_max_lengths = wp_check_comment_data_max_lengths( $commentdata );
3087
-	if ( is_wp_error( $check_max_lengths ) ) {
3086
+	$check_max_lengths = wp_check_comment_data_max_lengths($commentdata);
3087
+	if (is_wp_error($check_max_lengths)) {
3088 3088
 		return $check_max_lengths;
3089 3089
 	}
3090 3090
 
3091
-	$comment_id = wp_new_comment( wp_slash( $commentdata ), true );
3092
-	if ( is_wp_error( $comment_id ) ) {
3091
+	$comment_id = wp_new_comment(wp_slash($commentdata), true);
3092
+	if (is_wp_error($comment_id)) {
3093 3093
 		return $comment_id;
3094 3094
 	}
3095 3095
 
3096
-	if ( ! $comment_id ) {
3097
-		return new WP_Error( 'comment_save_error', __( '<strong>ERROR</strong>: The comment could not be saved. Please try again later.' ), 500 );
3096
+	if ( ! $comment_id) {
3097
+		return new WP_Error('comment_save_error', __('<strong>ERROR</strong>: The comment could not be saved. Please try again later.'), 500);
3098 3098
 	}
3099 3099
 
3100
-	return get_comment( $comment_id );
3100
+	return get_comment($comment_id);
3101 3101
 }
Please login to merge, or discard this patch.
Braces   +241 added lines, -157 removed lines patch added patch discarded remove patch
@@ -40,8 +40,9 @@  discard block
 block discarded – undo
40 40
 	global $wpdb;
41 41
 
42 42
 	// If manual moderation is enabled, skip all checks and return false.
43
-	if ( 1 == get_option('comment_moderation') )
44
-		return false;
43
+	if ( 1 == get_option('comment_moderation') ) {
44
+			return false;
45
+	}
45 46
 
46 47
 	/** This filter is documented in wp-includes/comment-template.php */
47 48
 	$comment = apply_filters( 'comment_text', $comment );
@@ -66,8 +67,9 @@  discard block
 block discarded – undo
66 67
 		 * If the number of links in the comment exceeds the allowed amount,
67 68
 		 * fail the check by returning false.
68 69
 		 */
69
-		if ( $num_links >= $max_links )
70
-			return false;
70
+		if ( $num_links >= $max_links ) {
71
+					return false;
72
+		}
71 73
 	}
72 74
 
73 75
 	$mod_keys = trim(get_option('moderation_keys'));
@@ -80,8 +82,9 @@  discard block
 block discarded – undo
80 82
 			$word = trim($word);
81 83
 
82 84
 			// Skip empty lines.
83
-			if ( empty($word) )
84
-				continue;
85
+			if ( empty($word) ) {
86
+							continue;
87
+			}
85 88
 
86 89
 			/*
87 90
 			 * Do some escaping magic so that '#' (number of) characters in the spam
@@ -94,12 +97,24 @@  discard block
 block discarded – undo
94 97
 			 * fail the check for the given field by returning false.
95 98
 			 */
96 99
 			$pattern = "#$word#i";
97
-			if ( preg_match($pattern, $author) ) return false;
98
-			if ( preg_match($pattern, $email) ) return false;
99
-			if ( preg_match($pattern, $url) ) return false;
100
-			if ( preg_match($pattern, $comment) ) return false;
101
-			if ( preg_match($pattern, $user_ip) ) return false;
102
-			if ( preg_match($pattern, $user_agent) ) return false;
100
+			if ( preg_match($pattern, $author) ) {
101
+				return false;
102
+			}
103
+			if ( preg_match($pattern, $email) ) {
104
+				return false;
105
+			}
106
+			if ( preg_match($pattern, $url) ) {
107
+				return false;
108
+			}
109
+			if ( preg_match($pattern, $comment) ) {
110
+				return false;
111
+			}
112
+			if ( preg_match($pattern, $user_ip) ) {
113
+				return false;
114
+			}
115
+			if ( preg_match($pattern, $user_agent) ) {
116
+				return false;
117
+			}
103 118
 		}
104 119
 	}
105 120
 
@@ -120,10 +135,11 @@  discard block
 block discarded – undo
120 135
 				$ok_to_comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = %s AND comment_author_email = %s and comment_approved = '1' LIMIT 1", $author, $email ) );
121 136
 			}
122 137
 			if ( ( 1 == $ok_to_comment ) &&
123
-				( empty($mod_keys) || false === strpos( $email, $mod_keys) ) )
124
-					return true;
125
-			else
126
-				return false;
138
+				( empty($mod_keys) || false === strpos( $email, $mod_keys) ) ) {
139
+								return true;
140
+			} else {
141
+							return false;
142
+			}
127 143
 		} else {
128 144
 			return false;
129 145
 		}
@@ -516,8 +532,9 @@  discard block
 block discarded – undo
516 532
  * @since 3.4.0
517 533
  */
518 534
 function wp_set_comment_cookies($comment, $user) {
519
-	if ( $user->exists() )
520
-		return;
535
+	if ( $user->exists() ) {
536
+			return;
537
+	}
521 538
 
522 539
 	/**
523 540
 	 * Filters the lifetime of the comment cookie in seconds.
@@ -879,11 +896,13 @@  discard block
 block discarded – undo
879 896
 	$count = count($comments);
880 897
 	for ( $i = 0; $i < $count; $i++ ) {
881 898
 		$type = $comments[$i]->comment_type;
882
-		if ( empty($type) )
883
-			$type = 'comment';
899
+		if ( empty($type) ) {
900
+					$type = 'comment';
901
+		}
884 902
 		$comments_by_type[$type][] = &$comments[$i];
885
-		if ( 'trackback' == $type || 'pingback' == $type )
886
-			$comments_by_type['pings'][] = &$comments[$i];
903
+		if ( 'trackback' == $type || 'pingback' == $type ) {
904
+					$comments_by_type['pings'][] = &$comments[$i];
905
+		}
887 906
 	}
888 907
 
889 908
 	return $comments_by_type;
@@ -906,28 +925,35 @@  discard block
 block discarded – undo
906 925
 function get_comment_pages_count( $comments = null, $per_page = null, $threaded = null ) {
907 926
 	global $wp_query;
908 927
 
909
-	if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) )
910
-		return $wp_query->max_num_comment_pages;
928
+	if ( null === $comments && null === $per_page && null === $threaded && !empty($wp_query->max_num_comment_pages) ) {
929
+			return $wp_query->max_num_comment_pages;
930
+	}
911 931
 
912
-	if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments )  )
913
-		$comments = $wp_query->comments;
932
+	if ( ( ! $comments || ! is_array( $comments ) ) && ! empty( $wp_query->comments )  ) {
933
+			$comments = $wp_query->comments;
934
+	}
914 935
 
915
-	if ( empty($comments) )
916
-		return 0;
936
+	if ( empty($comments) ) {
937
+			return 0;
938
+	}
917 939
 
918 940
 	if ( ! get_option( 'page_comments' ) ) {
919 941
 		return 1;
920 942
 	}
921 943
 
922
-	if ( !isset($per_page) )
923
-		$per_page = (int) get_query_var('comments_per_page');
924
-	if ( 0 === $per_page )
925
-		$per_page = (int) get_option('comments_per_page');
926
-	if ( 0 === $per_page )
927
-		return 1;
944
+	if ( !isset($per_page) ) {
945
+			$per_page = (int) get_query_var('comments_per_page');
946
+	}
947
+	if ( 0 === $per_page ) {
948
+			$per_page = (int) get_option('comments_per_page');
949
+	}
950
+	if ( 0 === $per_page ) {
951
+			return 1;
952
+	}
928 953
 
929
-	if ( !isset($threaded) )
930
-		$threaded = get_option('thread_comments');
954
+	if ( !isset($threaded) ) {
955
+			$threaded = get_option('thread_comments');
956
+	}
931 957
 
932 958
 	if ( $threaded ) {
933 959
 		$walker = new Walker_Comment;
@@ -964,8 +990,9 @@  discard block
 block discarded – undo
964 990
 
965 991
 	$page = null;
966 992
 
967
-	if ( !$comment = get_comment( $comment_ID ) )
968
-		return;
993
+	if ( !$comment = get_comment( $comment_ID ) ) {
994
+			return;
995
+	}
969 996
 
970 997
 	$defaults = array( 'type' => 'all', 'page' => '', 'per_page' => '', 'max_depth' => '' );
971 998
 	$args = wp_parse_args( $args, $defaults );
@@ -993,15 +1020,17 @@  discard block
 block discarded – undo
993 1020
 
994 1021
 	if ( null === $page ) {
995 1022
 		if ( '' === $args['max_depth'] ) {
996
-			if ( get_option('thread_comments') )
997
-				$args['max_depth'] = get_option('thread_comments_depth');
998
-			else
999
-				$args['max_depth'] = -1;
1023
+			if ( get_option('thread_comments') ) {
1024
+							$args['max_depth'] = get_option('thread_comments_depth');
1025
+			} else {
1026
+							$args['max_depth'] = -1;
1027
+			}
1000 1028
 		}
1001 1029
 
1002 1030
 		// Find this comment's top level parent if threading is enabled
1003
-		if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent )
1004
-			return get_page_of_comment( $comment->comment_parent, $args );
1031
+		if ( $args['max_depth'] > 1 && 0 != $comment->comment_parent ) {
1032
+					return get_page_of_comment( $comment->comment_parent, $args );
1033
+		}
1005 1034
 
1006 1035
 		$comment_args = array(
1007 1036
 			'type'       => $args['type'],
@@ -1176,8 +1205,10 @@  discard block
 block discarded – undo
1176 1205
 	do_action( 'wp_blacklist_check', $author, $email, $url, $comment, $user_ip, $user_agent );
1177 1206
 
1178 1207
 	$mod_keys = trim( get_option('blacklist_keys') );
1179
-	if ( '' == $mod_keys )
1180
-		return false; // If moderation keys are empty
1208
+	if ( '' == $mod_keys ) {
1209
+			return false;
1210
+	}
1211
+	// If moderation keys are empty
1181 1212
 
1182 1213
 	// Ensure HTML tags are not being used to bypass the blacklist.
1183 1214
 	$comment_without_html = wp_strip_all_tags( $comment );
@@ -1203,8 +1234,9 @@  discard block
 block discarded – undo
1203 1234
 			|| preg_match($pattern, $comment_without_html)
1204 1235
 			|| preg_match($pattern, $user_ip)
1205 1236
 			|| preg_match($pattern, $user_agent)
1206
-		 )
1207
-			return true;
1237
+		 ) {
1238
+					return true;
1239
+		}
1208 1240
 	}
1209 1241
 	return false;
1210 1242
 }
@@ -1275,11 +1307,13 @@  discard block
 block discarded – undo
1275 1307
  */
1276 1308
 function wp_delete_comment($comment_id, $force_delete = false) {
1277 1309
 	global $wpdb;
1278
-	if (!$comment = get_comment($comment_id))
1279
-		return false;
1310
+	if (!$comment = get_comment($comment_id)) {
1311
+			return false;
1312
+	}
1280 1313
 
1281
-	if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ) ) )
1282
-		return wp_trash_comment($comment_id);
1314
+	if ( !$force_delete && EMPTY_TRASH_DAYS && !in_array( wp_get_comment_status( $comment ), array( 'trash', 'spam' ) ) ) {
1315
+			return wp_trash_comment($comment_id);
1316
+	}
1283 1317
 
1284 1318
 	/**
1285 1319
 	 * Fires immediately before a comment is deleted from the database.
@@ -1299,11 +1333,13 @@  discard block
 block discarded – undo
1299 1333
 
1300 1334
 	// Delete metadata
1301 1335
 	$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) );
1302
-	foreach ( $meta_ids as $mid )
1303
-		delete_metadata_by_mid( 'comment', $mid );
1336
+	foreach ( $meta_ids as $mid ) {
1337
+			delete_metadata_by_mid( 'comment', $mid );
1338
+	}
1304 1339
 
1305
-	if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) )
1306
-		return false;
1340
+	if ( ! $wpdb->delete( $wpdb->comments, array( 'comment_ID' => $comment->comment_ID ) ) ) {
1341
+			return false;
1342
+	}
1307 1343
 
1308 1344
 	/**
1309 1345
 	 * Fires immediately after a comment is deleted from the database.
@@ -1315,8 +1351,9 @@  discard block
 block discarded – undo
1315 1351
 	do_action( 'deleted_comment', $comment->comment_ID );
1316 1352
 
1317 1353
 	$post_id = $comment->comment_post_ID;
1318
-	if ( $post_id && $comment->comment_approved == 1 )
1319
-		wp_update_comment_count($post_id);
1354
+	if ( $post_id && $comment->comment_approved == 1 ) {
1355
+			wp_update_comment_count($post_id);
1356
+	}
1320 1357
 
1321 1358
 	clean_comment_cache( $comment->comment_ID );
1322 1359
 
@@ -1338,11 +1375,13 @@  discard block
 block discarded – undo
1338 1375
  * @return bool True on success, false on failure.
1339 1376
  */
1340 1377
 function wp_trash_comment($comment_id) {
1341
-	if ( !EMPTY_TRASH_DAYS )
1342
-		return wp_delete_comment($comment_id, true);
1378
+	if ( !EMPTY_TRASH_DAYS ) {
1379
+			return wp_delete_comment($comment_id, true);
1380
+	}
1343 1381
 
1344
-	if ( !$comment = get_comment($comment_id) )
1345
-		return false;
1382
+	if ( !$comment = get_comment($comment_id) ) {
1383
+			return false;
1384
+	}
1346 1385
 
1347 1386
 	/**
1348 1387
 	 * Fires immediately before a comment is sent to the Trash.
@@ -1397,8 +1436,9 @@  discard block
 block discarded – undo
1397 1436
 	do_action( 'untrash_comment', $comment->comment_ID );
1398 1437
 
1399 1438
 	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1400
-	if ( empty($status) )
1401
-		$status = '0';
1439
+	if ( empty($status) ) {
1440
+			$status = '0';
1441
+	}
1402 1442
 
1403 1443
 	if ( wp_set_comment_status( $comment, $status ) ) {
1404 1444
 		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_time' );
@@ -1483,8 +1523,9 @@  discard block
 block discarded – undo
1483 1523
 	do_action( 'unspam_comment', $comment->comment_ID );
1484 1524
 
1485 1525
 	$status = (string) get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true );
1486
-	if ( empty($status) )
1487
-		$status = '0';
1526
+	if ( empty($status) ) {
1527
+			$status = '0';
1528
+	}
1488 1529
 
1489 1530
 	if ( wp_set_comment_status( $comment, $status ) ) {
1490 1531
 		delete_comment_meta( $comment->comment_ID, '_wp_trash_meta_status' );
@@ -1513,24 +1554,26 @@  discard block
 block discarded – undo
1513 1554
  */
1514 1555
 function wp_get_comment_status($comment_id) {
1515 1556
 	$comment = get_comment($comment_id);
1516
-	if ( !$comment )
1517
-		return false;
1557
+	if ( !$comment ) {
1558
+			return false;
1559
+	}
1518 1560
 
1519 1561
 	$approved = $comment->comment_approved;
1520 1562
 
1521
-	if ( $approved == null )
1522
-		return false;
1523
-	elseif ( $approved == '1' )
1524
-		return 'approved';
1525
-	elseif ( $approved == '0' )
1526
-		return 'unapproved';
1527
-	elseif ( $approved == 'spam' )
1528
-		return 'spam';
1529
-	elseif ( $approved == 'trash' )
1530
-		return 'trash';
1531
-	else
1532
-		return false;
1533
-}
1563
+	if ( $approved == null ) {
1564
+			return false;
1565
+	} elseif ( $approved == '1' ) {
1566
+			return 'approved';
1567
+	} elseif ( $approved == '0' ) {
1568
+			return 'unapproved';
1569
+	} elseif ( $approved == 'spam' ) {
1570
+			return 'spam';
1571
+	} elseif ( $approved == 'trash' ) {
1572
+			return 'trash';
1573
+	} else {
1574
+			return false;
1575
+	}
1576
+	}
1534 1577
 
1535 1578
 /**
1536 1579
  * Call hooks for when a comment status transition occurs.
@@ -1562,8 +1605,12 @@  discard block
 block discarded – undo
1562 1605
 		1         => 'approved',
1563 1606
 		'approve' => 'approved', // wp_set_comment_status() uses "approve"
1564 1607
 	);
1565
-	if ( isset($comment_statuses[$new_status]) ) $new_status = $comment_statuses[$new_status];
1566
-	if ( isset($comment_statuses[$old_status]) ) $old_status = $comment_statuses[$old_status];
1608
+	if ( isset($comment_statuses[$new_status]) ) {
1609
+		$new_status = $comment_statuses[$new_status];
1610
+	}
1611
+	if ( isset($comment_statuses[$old_status]) ) {
1612
+		$old_status = $comment_statuses[$old_status];
1613
+	}
1567 1614
 
1568 1615
 	// Call the hooks
1569 1616
 	if ( $new_status != $old_status ) {
@@ -1642,16 +1689,19 @@  discard block
 block discarded – undo
1642 1689
 	// Cookies should already be sanitized.
1643 1690
 
1644 1691
 	$comment_author = '';
1645
-	if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) )
1646
-		$comment_author = $_COOKIE['comment_author_'.COOKIEHASH];
1692
+	if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
1693
+			$comment_author = $_COOKIE['comment_author_'.COOKIEHASH];
1694
+	}
1647 1695
 
1648 1696
 	$comment_author_email = '';
1649
-	if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) )
1650
-		$comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH];
1697
+	if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
1698
+			$comment_author_email = $_COOKIE['comment_author_email_'.COOKIEHASH];
1699
+	}
1651 1700
 
1652 1701
 	$comment_author_url = '';
1653
-	if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) )
1654
-		$comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];
1702
+	if ( isset($_COOKIE['comment_author_url_'.COOKIEHASH]) ) {
1703
+			$comment_author_url = $_COOKIE['comment_author_url_'.COOKIEHASH];
1704
+	}
1655 1705
 
1656 1706
 	/**
1657 1707
 	 * Filters the current commenter's name, email, and URL.
@@ -1840,10 +1890,13 @@  discard block
 block discarded – undo
1840 1890
  * @return bool Whether comment should be blocked.
1841 1891
  */
1842 1892
 function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
1843
-	if ( $block ) // a plugin has already blocked... we'll let that decision stand
1893
+	if ( $block ) {
1894
+		// a plugin has already blocked... we'll let that decision stand
1844 1895
 		return $block;
1845
-	if ( ($time_newcomment - $time_lastcomment) < 15 )
1846
-		return true;
1896
+	}
1897
+	if ( ($time_newcomment - $time_lastcomment) < 15 ) {
1898
+			return true;
1899
+	}
1847 1900
 	return false;
1848 1901
 }
1849 1902
 
@@ -2091,10 +2144,11 @@  discard block
 block discarded – undo
2091 2144
 	$comment_old = clone get_comment($comment_id);
2092 2145
 
2093 2146
 	if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array( 'comment_ID' => $comment_old->comment_ID ) ) ) {
2094
-		if ( $wp_error )
2095
-			return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
2096
-		else
2097
-			return false;
2147
+		if ( $wp_error ) {
2148
+					return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error);
2149
+		} else {
2150
+					return false;
2151
+		}
2098 2152
 	}
2099 2153
 
2100 2154
 	clean_comment_cache( $comment_old->comment_ID );
@@ -2238,8 +2292,9 @@  discard block
 block discarded – undo
2238 2292
 	if ( is_bool($defer) ) {
2239 2293
 		$_defer = $defer;
2240 2294
 		// flush any deferred counts
2241
-		if ( !$defer )
2242
-			wp_update_comment_count( null, true );
2295
+		if ( !$defer ) {
2296
+					wp_update_comment_count( null, true );
2297
+		}
2243 2298
 	}
2244 2299
 
2245 2300
 	return $_defer;
@@ -2285,8 +2340,7 @@  discard block
 block discarded – undo
2285 2340
 	if ( wp_defer_comment_counting() ) {
2286 2341
 		$_deferred[] = $post_id;
2287 2342
 		return true;
2288
-	}
2289
-	elseif ( $post_id ) {
2343
+	} elseif ( $post_id ) {
2290 2344
 		return wp_update_comment_count_now($post_id);
2291 2345
 	}
2292 2346
 
@@ -2305,14 +2359,16 @@  discard block
 block discarded – undo
2305 2359
 function wp_update_comment_count_now($post_id) {
2306 2360
 	global $wpdb;
2307 2361
 	$post_id = (int) $post_id;
2308
-	if ( !$post_id )
2309
-		return false;
2362
+	if ( !$post_id ) {
2363
+			return false;
2364
+	}
2310 2365
 
2311 2366
 	wp_cache_delete( 'comments-0', 'counts' );
2312 2367
 	wp_cache_delete( "comments-{$post_id}", 'counts' );
2313 2368
 
2314
-	if ( !$post = get_post($post_id) )
2315
-		return false;
2369
+	if ( !$post = get_post($post_id) ) {
2370
+			return false;
2371
+	}
2316 2372
 
2317 2373
 	$old = (int) $post->comment_count;
2318 2374
 
@@ -2371,8 +2427,9 @@  discard block
 block discarded – undo
2371 2427
  * @return false|string False on failure, string containing URI on success.
2372 2428
  */
2373 2429
 function discover_pingback_server_uri( $url, $deprecated = '' ) {
2374
-	if ( !empty( $deprecated ) )
2375
-		_deprecated_argument( __FUNCTION__, '2.7.0' );
2430
+	if ( !empty( $deprecated ) ) {
2431
+			_deprecated_argument( __FUNCTION__, '2.7.0' );
2432
+	}
2376 2433
 
2377 2434
 	$pingback_str_dquote = 'rel="pingback"';
2378 2435
 	$pingback_str_squote = 'rel=\'pingback\'';
@@ -2380,31 +2437,38 @@  discard block
 block discarded – undo
2380 2437
 	/** @todo Should use Filter Extension or custom preg_match instead. */
2381 2438
 	$parsed_url = parse_url($url);
2382 2439
 
2383
-	if ( ! isset( $parsed_url['host'] ) ) // Not a URL. This should never happen.
2440
+	if ( ! isset( $parsed_url['host'] ) ) {
2441
+		// Not a URL. This should never happen.
2384 2442
 		return false;
2443
+	}
2385 2444
 
2386 2445
 	//Do not search for a pingback server on our own uploads
2387 2446
 	$uploads_dir = wp_get_upload_dir();
2388
-	if ( 0 === strpos($url, $uploads_dir['baseurl']) )
2389
-		return false;
2447
+	if ( 0 === strpos($url, $uploads_dir['baseurl']) ) {
2448
+			return false;
2449
+	}
2390 2450
 
2391 2451
 	$response = wp_safe_remote_head( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
2392 2452
 
2393
-	if ( is_wp_error( $response ) )
2394
-		return false;
2453
+	if ( is_wp_error( $response ) ) {
2454
+			return false;
2455
+	}
2395 2456
 
2396
-	if ( wp_remote_retrieve_header( $response, 'x-pingback' ) )
2397
-		return wp_remote_retrieve_header( $response, 'x-pingback' );
2457
+	if ( wp_remote_retrieve_header( $response, 'x-pingback' ) ) {
2458
+			return wp_remote_retrieve_header( $response, 'x-pingback' );
2459
+	}
2398 2460
 
2399 2461
 	// Not an (x)html, sgml, or xml page, no use going further.
2400
-	if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) )
2401
-		return false;
2462
+	if ( preg_match('#(image|audio|video|model)/#is', wp_remote_retrieve_header( $response, 'content-type' )) ) {
2463
+			return false;
2464
+	}
2402 2465
 
2403 2466
 	// Now do a GET since we're going to look in the html headers (and we're sure it's not a binary file)
2404 2467
 	$response = wp_safe_remote_get( $url, array( 'timeout' => 2, 'httpversion' => '1.0' ) );
2405 2468
 
2406
-	if ( is_wp_error( $response ) )
2407
-		return false;
2469
+	if ( is_wp_error( $response ) ) {
2470
+			return false;
2471
+	}
2408 2472
 
2409 2473
 	$contents = wp_remote_retrieve_body( $response );
2410 2474
 
@@ -2452,9 +2516,10 @@  discard block
 block discarded – undo
2452 2516
 
2453 2517
 	// Do Trackbacks
2454 2518
 	$trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'");
2455
-	if ( is_array($trackbacks) )
2456
-		foreach ( $trackbacks as $trackback )
2519
+	if ( is_array($trackbacks) ) {
2520
+			foreach ( $trackbacks as $trackback )
2457 2521
 			do_trackbacks($trackback);
2522
+	}
2458 2523
 
2459 2524
 	//Do Update Services/Generic Pings
2460 2525
 	generic_ping();
@@ -2527,8 +2592,9 @@  discard block
 block discarded – undo
2527 2592
 	$services = explode("\n", $services);
2528 2593
 	foreach ( (array) $services as $service ) {
2529 2594
 		$service = trim($service);
2530
-		if ( '' != $service )
2531
-			weblog_ping($service);
2595
+		if ( '' != $service ) {
2596
+					weblog_ping($service);
2597
+		}
2532 2598
 	}
2533 2599
 
2534 2600
 	return $post_id;
@@ -2578,10 +2644,11 @@  discard block
 block discarded – undo
2578 2644
 		if ( ! in_array( $link_test, $pung ) && ( url_to_postid( $link_test ) != $post->ID ) // If we haven't pung it already and it isn't a link to itself
2579 2645
 				&& !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
2580 2646
 			if ( $test = @parse_url($link_test) ) {
2581
-				if ( isset($test['query']) )
2582
-					$post_links[] = $link_test;
2583
-				elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) )
2584
-					$post_links[] = $link_test;
2647
+				if ( isset($test['query']) ) {
2648
+									$post_links[] = $link_test;
2649
+				} elseif ( isset( $test['path'] ) && ( $test['path'] != '/' ) && ( $test['path'] != '' ) ) {
2650
+									$post_links[] = $link_test;
2651
+				}
2585 2652
 			}
2586 2653
 		endif;
2587 2654
 	endforeach;
@@ -2625,8 +2692,10 @@  discard block
 block discarded – undo
2625 2692
 			// when set to true, this outputs debug messages by itself
2626 2693
 			$client->debug = false;
2627 2694
 
2628
-			if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) // Already registered
2695
+			if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto) || ( isset($client->error->code) && 48 == $client->error->code ) ) {
2696
+				// Already registered
2629 2697
 				add_ping( $post, $pagelinkedto );
2698
+			}
2630 2699
 		}
2631 2700
 	}
2632 2701
 }
@@ -2640,11 +2709,12 @@  discard block
 block discarded – undo
2640 2709
  * @return mixed Empty string if blog is not public, returns $sites, if site is public.
2641 2710
  */
2642 2711
 function privacy_ping_filter($sites) {
2643
-	if ( '0' != get_option('blog_public') )
2644
-		return $sites;
2645
-	else
2646
-		return '';
2647
-}
2712
+	if ( '0' != get_option('blog_public') ) {
2713
+			return $sites;
2714
+	} else {
2715
+			return '';
2716
+	}
2717
+	}
2648 2718
 
2649 2719
 /**
2650 2720
  * Send a Trackback.
@@ -2664,8 +2734,9 @@  discard block
 block discarded – undo
2664 2734
 function trackback($trackback_url, $title, $excerpt, $ID) {
2665 2735
 	global $wpdb;
2666 2736
 
2667
-	if ( empty($trackback_url) )
2668
-		return;
2737
+	if ( empty($trackback_url) ) {
2738
+			return;
2739
+	}
2669 2740
 
2670 2741
 	$options = array();
2671 2742
 	$options['timeout'] = 10;
@@ -2678,8 +2749,9 @@  discard block
 block discarded – undo
2678 2749
 
2679 2750
 	$response = wp_safe_remote_post( $trackback_url, $options );
2680 2751
 
2681
-	if ( is_wp_error( $response ) )
2682
-		return;
2752
+	if ( is_wp_error( $response ) ) {
2753
+			return;
2754
+	}
2683 2755
 
2684 2756
 	$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET pinged = CONCAT(pinged, '\n', %s) WHERE ID = %d", $trackback_url, $ID) );
2685 2757
 	return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, %s, '')) WHERE ID = %d", $trackback_url, $ID) );
@@ -2705,9 +2777,11 @@  discard block
 block discarded – undo
2705 2777
 	// when set to true, this outputs debug messages by itself
2706 2778
 	$client->debug = false;
2707 2779
 	$home = trailingslashit( home_url() );
2708
-	if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) // then try a normal ping
2780
+	if ( !$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url') ) ) {
2781
+		// then try a normal ping
2709 2782
 		$client->query('weblogUpdates.ping', get_option('blogname'), $home);
2710
-}
2783
+	}
2784
+	}
2711 2785
 
2712 2786
 /**
2713 2787
  * Default filter attached to pingback_ping_source_uri to validate the pingback's Source URI
@@ -2735,8 +2809,9 @@  discard block
 block discarded – undo
2735 2809
  * @return IXR_Error
2736 2810
  */
2737 2811
 function xmlrpc_pingback_error( $ixr_error ) {
2738
-	if ( $ixr_error->code === 48 )
2739
-		return $ixr_error;
2812
+	if ( $ixr_error->code === 48 ) {
2813
+			return $ixr_error;
2814
+	}
2740 2815
 	return new IXR_Error( 0, '' );
2741 2816
 }
2742 2817
 
@@ -2782,8 +2857,9 @@  discard block
 block discarded – undo
2782 2857
  * @param bool  $update_meta_cache Whether to update commentmeta cache. Default true.
2783 2858
  */
2784 2859
 function update_comment_cache( $comments, $update_meta_cache = true ) {
2785
-	foreach ( (array) $comments as $comment )
2786
-		wp_cache_add($comment->comment_ID, $comment, 'comment');
2860
+	foreach ( (array) $comments as $comment ) {
2861
+			wp_cache_add($comment->comment_ID, $comment, 'comment');
2862
+	}
2787 2863
 
2788 2864
 	if ( $update_meta_cache ) {
2789 2865
 		// Avoid `wp_list_pluck()` in case `$comments` is passed by reference.
@@ -2833,8 +2909,9 @@  discard block
 block discarded – undo
2833 2909
  * @return array
2834 2910
  */
2835 2911
 function _close_comments_for_old_posts( $posts, $query ) {
2836
-	if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) )
2837
-		return $posts;
2912
+	if ( empty( $posts ) || ! $query->is_singular() || ! get_option( 'close_comments_for_old_posts' ) ) {
2913
+			return $posts;
2914
+	}
2838 2915
 
2839 2916
 	/**
2840 2917
 	 * Filters the list of post types to automatically close comments for.
@@ -2844,12 +2921,14 @@  discard block
 block discarded – undo
2844 2921
 	 * @param array $post_types An array of registered post types. Default array with 'post'.
2845 2922
 	 */
2846 2923
 	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
2847
-	if ( ! in_array( $posts[0]->post_type, $post_types ) )
2848
-		return $posts;
2924
+	if ( ! in_array( $posts[0]->post_type, $post_types ) ) {
2925
+			return $posts;
2926
+	}
2849 2927
 
2850 2928
 	$days_old = (int) get_option( 'close_comments_days_old' );
2851
-	if ( ! $days_old )
2852
-		return $posts;
2929
+	if ( ! $days_old ) {
2930
+			return $posts;
2931
+	}
2853 2932
 
2854 2933
 	if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
2855 2934
 		$posts[0]->comment_status = 'closed';
@@ -2870,30 +2949,35 @@  discard block
 block discarded – undo
2870 2949
  * @return bool $open
2871 2950
  */
2872 2951
 function _close_comments_for_old_post( $open, $post_id ) {
2873
-	if ( ! $open )
2874
-		return $open;
2952
+	if ( ! $open ) {
2953
+			return $open;
2954
+	}
2875 2955
 
2876
-	if ( !get_option('close_comments_for_old_posts') )
2877
-		return $open;
2956
+	if ( !get_option('close_comments_for_old_posts') ) {
2957
+			return $open;
2958
+	}
2878 2959
 
2879 2960
 	$days_old = (int) get_option('close_comments_days_old');
2880
-	if ( !$days_old )
2881
-		return $open;
2961
+	if ( !$days_old ) {
2962
+			return $open;
2963
+	}
2882 2964
 
2883 2965
 	$post = get_post($post_id);
2884 2966
 
2885 2967
 	/** This filter is documented in wp-includes/comment.php */
2886 2968
 	$post_types = apply_filters( 'close_comments_for_post_types', array( 'post' ) );
2887
-	if ( ! in_array( $post->post_type, $post_types ) )
2888
-		return $open;
2969
+	if ( ! in_array( $post->post_type, $post_types ) ) {
2970
+			return $open;
2971
+	}
2889 2972
 
2890 2973
 	// Undated drafts should not show up as comments closed.
2891 2974
 	if ( '0000-00-00 00:00:00' === $post->post_date_gmt ) {
2892 2975
 		return $open;
2893 2976
 	}
2894 2977
 
2895
-	if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) )
2896
-		return false;
2978
+	if ( time() - strtotime( $post->post_date_gmt ) > ( $days_old * DAY_IN_SECONDS ) ) {
2979
+			return false;
2980
+	}
2897 2981
 
2898 2982
 	return $open;
2899 2983
 }
Please login to merge, or discard this patch.