Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-includes/meta.php 2 patches
Braces   +84 added lines, -59 removed lines patch added patch discarded remove patch
@@ -68,13 +68,15 @@  discard block
 block discarded – undo
68 68
 	 *                              for the object. Optional. Default false.
69 69
 	 */
70 70
 	$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
71
-	if ( null !== $check )
72
-		return $check;
71
+	if ( null !== $check ) {
72
+			return $check;
73
+	}
73 74
 
74 75
 	if ( $unique && $wpdb->get_var( $wpdb->prepare(
75 76
 		"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
76
-		$meta_key, $object_id ) ) )
77
-		return false;
77
+		$meta_key, $object_id ) ) ) {
78
+			return false;
79
+	}
78 80
 
79 81
 	$_meta_value = $meta_value;
80 82
 	$meta_value = maybe_serialize( $meta_value );
@@ -99,8 +101,9 @@  discard block
 block discarded – undo
99 101
 		'meta_value' => $meta_value
100 102
 	) );
101 103
 
102
-	if ( ! $result )
103
-		return false;
104
+	if ( ! $result ) {
105
+			return false;
106
+	}
104 107
 
105 108
 	$mid = (int) $wpdb->insert_id;
106 109
 
@@ -185,15 +188,17 @@  discard block
 block discarded – undo
185 188
 	 *                              Otherwise, update all entries.
186 189
 	 */
187 190
 	$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
188
-	if ( null !== $check )
189
-		return (bool) $check;
191
+	if ( null !== $check ) {
192
+			return (bool) $check;
193
+	}
190 194
 
191 195
 	// Compare existing value to new value if no prev value given and the key exists only once.
192 196
 	if ( empty($prev_value) ) {
193 197
 		$old_value = get_metadata($meta_type, $object_id, $meta_key);
194 198
 		if ( count($old_value) == 1 ) {
195
-			if ( $old_value[0] === $meta_value )
196
-				return false;
199
+			if ( $old_value[0] === $meta_value ) {
200
+							return false;
201
+			}
197 202
 		}
198 203
 	}
199 204
 
@@ -245,8 +250,9 @@  discard block
 block discarded – undo
245 250
 	}
246 251
 
247 252
 	$result = $wpdb->update( $table, $data, $where );
248
-	if ( ! $result )
249
-		return false;
253
+	if ( ! $result ) {
254
+			return false;
255
+	}
250 256
 
251 257
 	wp_cache_delete($object_id, $meta_type . '_meta');
252 258
 
@@ -345,23 +351,27 @@  discard block
 block discarded – undo
345 351
 	 *                              Default false.
346 352
 	 */
347 353
 	$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
348
-	if ( null !== $check )
349
-		return (bool) $check;
354
+	if ( null !== $check ) {
355
+			return (bool) $check;
356
+	}
350 357
 
351 358
 	$_meta_value = $meta_value;
352 359
 	$meta_value = maybe_serialize( $meta_value );
353 360
 
354 361
 	$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
355 362
 
356
-	if ( !$delete_all )
357
-		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
363
+	if ( !$delete_all ) {
364
+			$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
365
+	}
358 366
 
359
-	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value )
360
-		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
367
+	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
368
+			$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
369
+	}
361 370
 
362 371
 	$meta_ids = $wpdb->get_col( $query );
363
-	if ( !count( $meta_ids ) )
364
-		return false;
372
+	if ( !count( $meta_ids ) ) {
373
+			return false;
374
+	}
365 375
 
366 376
 	if ( $delete_all ) {
367 377
 		$value_clause = '';
@@ -403,8 +413,9 @@  discard block
 block discarded – undo
403 413
 
404 414
 	$count = $wpdb->query($query);
405 415
 
406
-	if ( !$count )
407
-		return false;
416
+	if ( !$count ) {
417
+			return false;
418
+	}
408 419
 
409 420
 	if ( $delete_all ) {
410 421
 		foreach ( (array) $object_ids as $o_id ) {
@@ -485,10 +496,11 @@  discard block
 block discarded – undo
485 496
 	 */
486 497
 	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
487 498
 	if ( null !== $check ) {
488
-		if ( $single && is_array( $check ) )
489
-			return $check[0];
490
-		else
491
-			return $check;
499
+		if ( $single && is_array( $check ) ) {
500
+					return $check[0];
501
+		} else {
502
+					return $check;
503
+		}
492 504
 	}
493 505
 
494 506
 	$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
@@ -503,17 +515,19 @@  discard block
 block discarded – undo
503 515
 	}
504 516
 
505 517
 	if ( isset($meta_cache[$meta_key]) ) {
506
-		if ( $single )
507
-			return maybe_unserialize( $meta_cache[$meta_key][0] );
508
-		else
509
-			return array_map('maybe_unserialize', $meta_cache[$meta_key]);
518
+		if ( $single ) {
519
+					return maybe_unserialize( $meta_cache[$meta_key][0] );
520
+		} else {
521
+					return array_map('maybe_unserialize', $meta_cache[$meta_key]);
522
+		}
510 523
 	}
511 524
 
512
-	if ($single)
513
-		return '';
514
-	else
515
-		return array();
516
-}
525
+	if ($single) {
526
+			return '';
527
+	} else {
528
+			return array();
529
+	}
530
+	}
517 531
 
518 532
 /**
519 533
  * Determine if a meta key is set for a given object
@@ -537,8 +551,9 @@  discard block
 block discarded – undo
537 551
 
538 552
 	/** This filter is documented in wp-includes/meta.php */
539 553
 	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
540
-	if ( null !== $check )
541
-		return (bool) $check;
554
+	if ( null !== $check ) {
555
+			return (bool) $check;
556
+	}
542 557
 
543 558
 	$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
544 559
 
@@ -547,8 +562,9 @@  discard block
 block discarded – undo
547 562
 		$meta_cache = $meta_cache[$object_id];
548 563
 	}
549 564
 
550
-	if ( isset( $meta_cache[ $meta_key ] ) )
551
-		return true;
565
+	if ( isset( $meta_cache[ $meta_key ] ) ) {
566
+			return true;
567
+	}
552 568
 
553 569
 	return false;
554 570
 }
@@ -585,11 +601,13 @@  discard block
 block discarded – undo
585 601
 
586 602
 	$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
587 603
 
588
-	if ( empty( $meta ) )
589
-		return false;
604
+	if ( empty( $meta ) ) {
605
+			return false;
606
+	}
590 607
 
591
-	if ( isset( $meta->meta_value ) )
592
-		$meta->meta_value = maybe_unserialize( $meta->meta_value );
608
+	if ( isset( $meta->meta_value ) ) {
609
+			$meta->meta_value = maybe_unserialize( $meta->meta_value );
610
+	}
593 611
 
594 612
 	return $meta;
595 613
 }
@@ -666,8 +684,9 @@  discard block
 block discarded – undo
666 684
 
667 685
 		// Run the update query, all fields in $data are %s, $where is a %d.
668 686
 		$result = $wpdb->update( $table, $data, $where, '%s', '%d' );
669
-		if ( ! $result )
670
-			return false;
687
+		if ( ! $result ) {
688
+					return false;
689
+		}
671 690
 
672 691
 		// Clear the caches.
673 692
 		wp_cache_delete($object_id, $meta_type . '_meta');
@@ -811,14 +830,16 @@  discard block
 block discarded – undo
811 830
 	$cache = array();
812 831
 	foreach ( $object_ids as $id ) {
813 832
 		$cached_object = wp_cache_get( $id, $cache_key );
814
-		if ( false === $cached_object )
815
-			$ids[] = $id;
816
-		else
817
-			$cache[$id] = $cached_object;
833
+		if ( false === $cached_object ) {
834
+					$ids[] = $id;
835
+		} else {
836
+					$cache[$id] = $cached_object;
837
+		}
818 838
 	}
819 839
 
820
-	if ( empty( $ids ) )
821
-		return $cache;
840
+	if ( empty( $ids ) ) {
841
+			return $cache;
842
+	}
822 843
 
823 844
 	// Get meta info
824 845
 	$id_list = join( ',', $ids );
@@ -832,10 +853,12 @@  discard block
 block discarded – undo
832 853
 			$mval = $metarow['meta_value'];
833 854
 
834 855
 			// Force subkeys to be array type:
835
-			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
836
-				$cache[$mpid] = array();
837
-			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
838
-				$cache[$mpid][$mkey] = array();
856
+			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) ) {
857
+							$cache[$mpid] = array();
858
+			}
859
+			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) ) {
860
+							$cache[$mpid][$mkey] = array();
861
+			}
839 862
 
840 863
 			// Add a value to the current pid/key:
841 864
 			$cache[$mpid][$mkey][] = $mval;
@@ -843,8 +866,9 @@  discard block
 block discarded – undo
843 866
 	}
844 867
 
845 868
 	foreach ( $ids as $id ) {
846
-		if ( ! isset($cache[$id]) )
847
-			$cache[$id] = array();
869
+		if ( ! isset($cache[$id]) ) {
870
+					$cache[$id] = array();
871
+		}
848 872
 		wp_cache_add( $id, $cache[$id], $cache_key );
849 873
 	}
850 874
 
@@ -902,8 +926,9 @@  discard block
 block discarded – undo
902 926
 
903 927
 	$table_name = $type . 'meta';
904 928
 
905
-	if ( empty($wpdb->$table_name) )
906
-		return false;
929
+	if ( empty($wpdb->$table_name) ) {
930
+			return false;
931
+	}
907 932
 
908 933
 	return $wpdb->$table_name;
909 934
 }
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
31 31
 	global $wpdb;
32 32
 
33
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
33
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id)) {
34 34
 		return false;
35 35
 	}
36 36
 
37
-	$object_id = absint( $object_id );
38
-	if ( ! $object_id ) {
37
+	$object_id = absint($object_id);
38
+	if ( ! $object_id) {
39 39
 		return false;
40 40
 	}
41 41
 
42
-	$table = _get_meta_table( $meta_type );
43
-	if ( ! $table ) {
42
+	$table = _get_meta_table($meta_type);
43
+	if ( ! $table) {
44 44
 		return false;
45 45
 	}
46 46
 
47
-	$column = sanitize_key($meta_type . '_id');
47
+	$column = sanitize_key($meta_type.'_id');
48 48
 
49 49
 	// expected_slashed ($meta_key)
50 50
 	$meta_key = wp_unslash($meta_key);
51 51
 	$meta_value = wp_unslash($meta_value);
52
-	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
52
+	$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
53 53
 
54 54
 	/**
55 55
 	 * Filters whether to add metadata of a specific type.
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	 * @param bool      $unique     Whether the specified meta key should be unique
68 68
 	 *                              for the object. Optional. Default false.
69 69
 	 */
70
-	$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
71
-	if ( null !== $check )
70
+	$check = apply_filters("add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique);
71
+	if (null !== $check)
72 72
 		return $check;
73 73
 
74
-	if ( $unique && $wpdb->get_var( $wpdb->prepare(
74
+	if ($unique && $wpdb->get_var($wpdb->prepare(
75 75
 		"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
76
-		$meta_key, $object_id ) ) )
76
+		$meta_key, $object_id )))
77 77
 		return false;
78 78
 
79 79
 	$_meta_value = $meta_value;
80
-	$meta_value = maybe_serialize( $meta_value );
80
+	$meta_value = maybe_serialize($meta_value);
81 81
 
82 82
 	/**
83 83
 	 * Fires immediately before meta of a specific type is added.
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
 	 * @param string $meta_key   Meta key.
92 92
 	 * @param mixed  $meta_value Meta value.
93 93
 	 */
94
-	do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
94
+	do_action("add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value);
95 95
 
96
-	$result = $wpdb->insert( $table, array(
96
+	$result = $wpdb->insert($table, array(
97 97
 		$column => $object_id,
98 98
 		'meta_key' => $meta_key,
99 99
 		'meta_value' => $meta_value
100
-	) );
100
+	));
101 101
 
102
-	if ( ! $result )
102
+	if ( ! $result)
103 103
 		return false;
104 104
 
105 105
 	$mid = (int) $wpdb->insert_id;
106 106
 
107
-	wp_cache_delete($object_id, $meta_type . '_meta');
107
+	wp_cache_delete($object_id, $meta_type.'_meta');
108 108
 
109 109
 	/**
110 110
 	 * Fires immediately after meta of a specific type is added.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string $meta_key   Meta key.
120 120
 	 * @param mixed  $meta_value Meta value.
121 121
 	 */
122
-	do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
122
+	do_action("added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value);
123 123
 
124 124
 	return $mid;
125 125
 }
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
 function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
144 144
 	global $wpdb;
145 145
 
146
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
146
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id)) {
147 147
 		return false;
148 148
 	}
149 149
 
150
-	$object_id = absint( $object_id );
151
-	if ( ! $object_id ) {
150
+	$object_id = absint($object_id);
151
+	if ( ! $object_id) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$table = _get_meta_table( $meta_type );
156
-	if ( ! $table ) {
155
+	$table = _get_meta_table($meta_type);
156
+	if ( ! $table) {
157 157
 		return false;
158 158
 	}
159 159
 
160
-	$column = sanitize_key($meta_type . '_id');
160
+	$column = sanitize_key($meta_type.'_id');
161 161
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
162 162
 
163 163
 	// expected_slashed ($meta_key)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	$meta_key = wp_unslash($meta_key);
166 166
 	$passed_value = $meta_value;
167 167
 	$meta_value = wp_unslash($meta_value);
168
-	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
168
+	$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
169 169
 
170 170
 	/**
171 171
 	 * Filters whether to update metadata of a specific type.
@@ -184,36 +184,36 @@  discard block
 block discarded – undo
184 184
 	 *                              metadata entries with the specified value.
185 185
 	 *                              Otherwise, update all entries.
186 186
 	 */
187
-	$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
188
-	if ( null !== $check )
187
+	$check = apply_filters("update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value);
188
+	if (null !== $check)
189 189
 		return (bool) $check;
190 190
 
191 191
 	// Compare existing value to new value if no prev value given and the key exists only once.
192
-	if ( empty($prev_value) ) {
192
+	if (empty($prev_value)) {
193 193
 		$old_value = get_metadata($meta_type, $object_id, $meta_key);
194
-		if ( count($old_value) == 1 ) {
195
-			if ( $old_value[0] === $meta_value )
194
+		if (count($old_value) == 1) {
195
+			if ($old_value[0] === $meta_value)
196 196
 				return false;
197 197
 		}
198 198
 	}
199 199
 
200
-	$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
201
-	if ( empty( $meta_ids ) ) {
202
-		return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
200
+	$meta_ids = $wpdb->get_col($wpdb->prepare("SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id));
201
+	if (empty($meta_ids)) {
202
+		return add_metadata($meta_type, $object_id, $raw_meta_key, $passed_value);
203 203
 	}
204 204
 
205 205
 	$_meta_value = $meta_value;
206
-	$meta_value = maybe_serialize( $meta_value );
206
+	$meta_value = maybe_serialize($meta_value);
207 207
 
208
-	$data  = compact( 'meta_value' );
209
-	$where = array( $column => $object_id, 'meta_key' => $meta_key );
208
+	$data  = compact('meta_value');
209
+	$where = array($column => $object_id, 'meta_key' => $meta_key);
210 210
 
211
-	if ( !empty( $prev_value ) ) {
211
+	if ( ! empty($prev_value)) {
212 212
 		$prev_value = maybe_serialize($prev_value);
213 213
 		$where['meta_value'] = $prev_value;
214 214
 	}
215 215
 
216
-	foreach ( $meta_ids as $meta_id ) {
216
+	foreach ($meta_ids as $meta_id) {
217 217
 		/**
218 218
 		 * Fires immediately before updating metadata of a specific type.
219 219
 		 *
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		 * @param string $meta_key   Meta key.
228 228
 		 * @param mixed  $meta_value Meta value.
229 229
 		 */
230
-		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
230
+		do_action("update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
231 231
 
232
-		if ( 'post' == $meta_type ) {
232
+		if ('post' == $meta_type) {
233 233
 			/**
234 234
 			 * Fires immediately before updating a post's metadata.
235 235
 			 *
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 			 * @param string $meta_key   Meta key.
241 241
 			 * @param mixed  $meta_value Meta value.
242 242
 			 */
243
-			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
243
+			do_action('update_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
244 244
 		}
245 245
 	}
246 246
 
247
-	$result = $wpdb->update( $table, $data, $where );
248
-	if ( ! $result )
247
+	$result = $wpdb->update($table, $data, $where);
248
+	if ( ! $result)
249 249
 		return false;
250 250
 
251
-	wp_cache_delete($object_id, $meta_type . '_meta');
251
+	wp_cache_delete($object_id, $meta_type.'_meta');
252 252
 
253
-	foreach ( $meta_ids as $meta_id ) {
253
+	foreach ($meta_ids as $meta_id) {
254 254
 		/**
255 255
 		 * Fires immediately after updating metadata of a specific type.
256 256
 		 *
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 		 * @param string $meta_key   Meta key.
265 265
 		 * @param mixed  $meta_value Meta value.
266 266
 		 */
267
-		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
267
+		do_action("updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
268 268
 
269
-		if ( 'post' == $meta_type ) {
269
+		if ('post' == $meta_type) {
270 270
 			/**
271 271
 			 * Fires immediately after updating a post's metadata.
272 272
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 * @param string $meta_key   Meta key.
278 278
 			 * @param mixed  $meta_value Meta value.
279 279
 			 */
280
-			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
280
+			do_action('updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
281 281
 		}
282 282
 	}
283 283
 
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
 function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
308 308
 	global $wpdb;
309 309
 
310
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
310
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id) && ! $delete_all) {
311 311
 		return false;
312 312
 	}
313 313
 
314
-	$object_id = absint( $object_id );
315
-	if ( ! $object_id && ! $delete_all ) {
314
+	$object_id = absint($object_id);
315
+	if ( ! $object_id && ! $delete_all) {
316 316
 		return false;
317 317
 	}
318 318
 
319
-	$table = _get_meta_table( $meta_type );
320
-	if ( ! $table ) {
319
+	$table = _get_meta_table($meta_type);
320
+	if ( ! $table) {
321 321
 		return false;
322 322
 	}
323 323
 
324
-	$type_column = sanitize_key($meta_type . '_id');
324
+	$type_column = sanitize_key($meta_type.'_id');
325 325
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
326 326
 	// expected_slashed ($meta_key)
327 327
 	$meta_key = wp_unslash($meta_key);
@@ -344,32 +344,32 @@  discard block
 block discarded – undo
344 344
 	 *                              for all objects, ignoring the specified $object_id.
345 345
 	 *                              Default false.
346 346
 	 */
347
-	$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
348
-	if ( null !== $check )
347
+	$check = apply_filters("delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all);
348
+	if (null !== $check)
349 349
 		return (bool) $check;
350 350
 
351 351
 	$_meta_value = $meta_value;
352
-	$meta_value = maybe_serialize( $meta_value );
352
+	$meta_value = maybe_serialize($meta_value);
353 353
 
354
-	$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
354
+	$query = $wpdb->prepare("SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key);
355 355
 
356
-	if ( !$delete_all )
357
-		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
356
+	if ( ! $delete_all)
357
+		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id);
358 358
 
359
-	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value )
360
-		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
359
+	if ('' !== $meta_value && null !== $meta_value && false !== $meta_value)
360
+		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value);
361 361
 
362
-	$meta_ids = $wpdb->get_col( $query );
363
-	if ( !count( $meta_ids ) )
362
+	$meta_ids = $wpdb->get_col($query);
363
+	if ( ! count($meta_ids))
364 364
 		return false;
365 365
 
366
-	if ( $delete_all ) {
366
+	if ($delete_all) {
367 367
 		$value_clause = '';
368
-		if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
369
-			$value_clause = $wpdb->prepare( " AND meta_value = %s", $meta_value );
368
+		if ('' !== $meta_value && null !== $meta_value && false !== $meta_value) {
369
+			$value_clause = $wpdb->prepare(" AND meta_value = %s", $meta_value);
370 370
 		}
371 371
 
372
-		$object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s $value_clause", $meta_key ) );
372
+		$object_ids = $wpdb->get_col($wpdb->prepare("SELECT $type_column FROM $table WHERE meta_key = %s $value_clause", $meta_key));
373 373
 	}
374 374
 
375 375
 	/**
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 	 * @param string $meta_key   Meta key.
386 386
 	 * @param mixed  $meta_value Meta value.
387 387
 	 */
388
-	do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
388
+	do_action("delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value);
389 389
 
390 390
 	// Old-style action.
391
-	if ( 'post' == $meta_type ) {
391
+	if ('post' == $meta_type) {
392 392
 		/**
393 393
 		 * Fires immediately before deleting metadata for a post.
394 394
 		 *
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
 		 *
397 397
 		 * @param array $meta_ids An array of post metadata entry IDs to delete.
398 398
 		 */
399
-		do_action( 'delete_postmeta', $meta_ids );
399
+		do_action('delete_postmeta', $meta_ids);
400 400
 	}
401 401
 
402
-	$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
402
+	$query = "DELETE FROM $table WHERE $id_column IN( ".implode(',', $meta_ids)." )";
403 403
 
404 404
 	$count = $wpdb->query($query);
405 405
 
406
-	if ( !$count )
406
+	if ( ! $count)
407 407
 		return false;
408 408
 
409
-	if ( $delete_all ) {
410
-		foreach ( (array) $object_ids as $o_id ) {
411
-			wp_cache_delete($o_id, $meta_type . '_meta');
409
+	if ($delete_all) {
410
+		foreach ((array) $object_ids as $o_id) {
411
+			wp_cache_delete($o_id, $meta_type.'_meta');
412 412
 		}
413 413
 	} else {
414
-		wp_cache_delete($object_id, $meta_type . '_meta');
414
+		wp_cache_delete($object_id, $meta_type.'_meta');
415 415
 	}
416 416
 
417 417
 	/**
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 * @param string $meta_key   Meta key.
428 428
 	 * @param mixed  $meta_value Meta value.
429 429
 	 */
430
-	do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
430
+	do_action("deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value);
431 431
 
432 432
 	// Old-style action.
433
-	if ( 'post' == $meta_type ) {
433
+	if ('post' == $meta_type) {
434 434
 		/**
435 435
 		 * Fires immediately after deleting metadata for a post.
436 436
 		 *
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 *
439 439
 		 * @param array $meta_ids An array of deleted post metadata entry IDs.
440 440
 		 */
441
-		do_action( 'deleted_postmeta', $meta_ids );
441
+		do_action('deleted_postmeta', $meta_ids);
442 442
 	}
443 443
 
444 444
 	return true;
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
  * @return mixed Single metadata value, or array of values
460 460
  */
461 461
 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
462
-	if ( ! $meta_type || ! is_numeric( $object_id ) ) {
462
+	if ( ! $meta_type || ! is_numeric($object_id)) {
463 463
 		return false;
464 464
 	}
465 465
 
466
-	$object_id = absint( $object_id );
467
-	if ( ! $object_id ) {
466
+	$object_id = absint($object_id);
467
+	if ( ! $object_id) {
468 468
 		return false;
469 469
 	}
470 470
 
@@ -483,28 +483,28 @@  discard block
 block discarded – undo
483 483
 	 * @param string            $meta_key  Meta key.
484 484
 	 * @param bool              $single    Whether to return only the first value of the specified $meta_key.
485 485
 	 */
486
-	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
487
-	if ( null !== $check ) {
488
-		if ( $single && is_array( $check ) )
486
+	$check = apply_filters("get_{$meta_type}_metadata", null, $object_id, $meta_key, $single);
487
+	if (null !== $check) {
488
+		if ($single && is_array($check))
489 489
 			return $check[0];
490 490
 		else
491 491
 			return $check;
492 492
 	}
493 493
 
494
-	$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
494
+	$meta_cache = wp_cache_get($object_id, $meta_type.'_meta');
495 495
 
496
-	if ( !$meta_cache ) {
497
-		$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
496
+	if ( ! $meta_cache) {
497
+		$meta_cache = update_meta_cache($meta_type, array($object_id));
498 498
 		$meta_cache = $meta_cache[$object_id];
499 499
 	}
500 500
 
501
-	if ( ! $meta_key ) {
501
+	if ( ! $meta_key) {
502 502
 		return $meta_cache;
503 503
 	}
504 504
 
505
-	if ( isset($meta_cache[$meta_key]) ) {
506
-		if ( $single )
507
-			return maybe_unserialize( $meta_cache[$meta_key][0] );
505
+	if (isset($meta_cache[$meta_key])) {
506
+		if ($single)
507
+			return maybe_unserialize($meta_cache[$meta_key][0]);
508 508
 		else
509 509
 			return array_map('maybe_unserialize', $meta_cache[$meta_key]);
510 510
 	}
@@ -525,29 +525,29 @@  discard block
 block discarded – undo
525 525
  * @param string $meta_key  Metadata key.
526 526
  * @return bool True of the key is set, false if not.
527 527
  */
528
-function metadata_exists( $meta_type, $object_id, $meta_key ) {
529
-	if ( ! $meta_type || ! is_numeric( $object_id ) ) {
528
+function metadata_exists($meta_type, $object_id, $meta_key) {
529
+	if ( ! $meta_type || ! is_numeric($object_id)) {
530 530
 		return false;
531 531
 	}
532 532
 
533
-	$object_id = absint( $object_id );
534
-	if ( ! $object_id ) {
533
+	$object_id = absint($object_id);
534
+	if ( ! $object_id) {
535 535
 		return false;
536 536
 	}
537 537
 
538 538
 	/** This filter is documented in wp-includes/meta.php */
539
-	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
540
-	if ( null !== $check )
539
+	$check = apply_filters("get_{$meta_type}_metadata", null, $object_id, $meta_key, true);
540
+	if (null !== $check)
541 541
 		return (bool) $check;
542 542
 
543
-	$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
543
+	$meta_cache = wp_cache_get($object_id, $meta_type.'_meta');
544 544
 
545
-	if ( !$meta_cache ) {
546
-		$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
545
+	if ( ! $meta_cache) {
546
+		$meta_cache = update_meta_cache($meta_type, array($object_id));
547 547
 		$meta_cache = $meta_cache[$object_id];
548 548
 	}
549 549
 
550
-	if ( isset( $meta_cache[ $meta_key ] ) )
550
+	if (isset($meta_cache[$meta_key]))
551 551
 		return true;
552 552
 
553 553
 	return false;
@@ -564,32 +564,32 @@  discard block
 block discarded – undo
564 564
  * @param int    $meta_id   ID for a specific meta row
565 565
  * @return object|false Meta object or false.
566 566
  */
567
-function get_metadata_by_mid( $meta_type, $meta_id ) {
567
+function get_metadata_by_mid($meta_type, $meta_id) {
568 568
 	global $wpdb;
569 569
 
570
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
570
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
571 571
 		return false;
572 572
 	}
573 573
 
574
-	$meta_id = intval( $meta_id );
575
-	if ( $meta_id <= 0 ) {
574
+	$meta_id = intval($meta_id);
575
+	if ($meta_id <= 0) {
576 576
 		return false;
577 577
 	}
578 578
 
579
-	$table = _get_meta_table( $meta_type );
580
-	if ( ! $table ) {
579
+	$table = _get_meta_table($meta_type);
580
+	if ( ! $table) {
581 581
 		return false;
582 582
 	}
583 583
 
584
-	$id_column = ( 'user' == $meta_type ) ? 'umeta_id' : 'meta_id';
584
+	$id_column = ('user' == $meta_type) ? 'umeta_id' : 'meta_id';
585 585
 
586
-	$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
586
+	$meta = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE $id_column = %d", $meta_id));
587 587
 
588
-	if ( empty( $meta ) )
588
+	if (empty($meta))
589 589
 		return false;
590 590
 
591
-	if ( isset( $meta->meta_value ) )
592
-		$meta->meta_value = maybe_unserialize( $meta->meta_value );
591
+	if (isset($meta->meta_value))
592
+		$meta->meta_value = maybe_unserialize($meta->meta_value);
593 593
 
594 594
 	return $meta;
595 595
 }
@@ -607,44 +607,44 @@  discard block
 block discarded – undo
607 607
  * @param string $meta_key   Optional, you can provide a meta key to update it
608 608
  * @return bool True on successful update, false on failure.
609 609
  */
610
-function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
610
+function update_metadata_by_mid($meta_type, $meta_id, $meta_value, $meta_key = false) {
611 611
 	global $wpdb;
612 612
 
613 613
 	// Make sure everything is valid.
614
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
614
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
615 615
 		return false;
616 616
 	}
617 617
 
618
-	$meta_id = intval( $meta_id );
619
-	if ( $meta_id <= 0 ) {
618
+	$meta_id = intval($meta_id);
619
+	if ($meta_id <= 0) {
620 620
 		return false;
621 621
 	}
622 622
 
623
-	$table = _get_meta_table( $meta_type );
624
-	if ( ! $table ) {
623
+	$table = _get_meta_table($meta_type);
624
+	if ( ! $table) {
625 625
 		return false;
626 626
 	}
627 627
 
628
-	$column = sanitize_key($meta_type . '_id');
628
+	$column = sanitize_key($meta_type.'_id');
629 629
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
630 630
 
631 631
 	// Fetch the meta and go on if it's found.
632
-	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
632
+	if ($meta = get_metadata_by_mid($meta_type, $meta_id)) {
633 633
 		$original_key = $meta->meta_key;
634 634
 		$object_id = $meta->{$column};
635 635
 
636 636
 		// If a new meta_key (last parameter) was specified, change the meta key,
637 637
 		// otherwise use the original key in the update statement.
638
-		if ( false === $meta_key ) {
638
+		if (false === $meta_key) {
639 639
 			$meta_key = $original_key;
640
-		} elseif ( ! is_string( $meta_key ) ) {
640
+		} elseif ( ! is_string($meta_key)) {
641 641
 			return false;
642 642
 		}
643 643
 
644 644
 		// Sanitize the meta
645 645
 		$_meta_value = $meta_value;
646
-		$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
647
-		$meta_value = maybe_serialize( $meta_value );
646
+		$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
647
+		$meta_value = maybe_serialize($meta_value);
648 648
 
649 649
 		// Format the data query arguments.
650 650
 		$data = array(
@@ -657,27 +657,27 @@  discard block
 block discarded – undo
657 657
 		$where[$id_column] = $meta_id;
658 658
 
659 659
 		/** This action is documented in wp-includes/meta.php */
660
-		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
660
+		do_action("update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
661 661
 
662
-		if ( 'post' == $meta_type ) {
662
+		if ('post' == $meta_type) {
663 663
 			/** This action is documented in wp-includes/meta.php */
664
-			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
664
+			do_action('update_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
665 665
 		}
666 666
 
667 667
 		// Run the update query, all fields in $data are %s, $where is a %d.
668
-		$result = $wpdb->update( $table, $data, $where, '%s', '%d' );
669
-		if ( ! $result )
668
+		$result = $wpdb->update($table, $data, $where, '%s', '%d');
669
+		if ( ! $result)
670 670
 			return false;
671 671
 
672 672
 		// Clear the caches.
673
-		wp_cache_delete($object_id, $meta_type . '_meta');
673
+		wp_cache_delete($object_id, $meta_type.'_meta');
674 674
 
675 675
 		/** This action is documented in wp-includes/meta.php */
676
-		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
676
+		do_action("updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
677 677
 
678
-		if ( 'post' == $meta_type ) {
678
+		if ('post' == $meta_type) {
679 679
 			/** This action is documented in wp-includes/meta.php */
680
-			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
680
+			do_action('updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
681 681
 		}
682 682
 
683 683
 		return true;
@@ -698,37 +698,37 @@  discard block
 block discarded – undo
698 698
  * @param int    $meta_id   ID for a specific meta row
699 699
  * @return bool True on successful delete, false on failure.
700 700
  */
701
-function delete_metadata_by_mid( $meta_type, $meta_id ) {
701
+function delete_metadata_by_mid($meta_type, $meta_id) {
702 702
 	global $wpdb;
703 703
 
704 704
 	// Make sure everything is valid.
705
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
705
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
706 706
 		return false;
707 707
 	}
708 708
 
709
-	$meta_id = intval( $meta_id );
710
-	if ( $meta_id <= 0 ) {
709
+	$meta_id = intval($meta_id);
710
+	if ($meta_id <= 0) {
711 711
 		return false;
712 712
 	}
713 713
 
714
-	$table = _get_meta_table( $meta_type );
715
-	if ( ! $table ) {
714
+	$table = _get_meta_table($meta_type);
715
+	if ( ! $table) {
716 716
 		return false;
717 717
 	}
718 718
 
719 719
 	// object and id columns
720
-	$column = sanitize_key($meta_type . '_id');
720
+	$column = sanitize_key($meta_type.'_id');
721 721
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
722 722
 
723 723
 	// Fetch the meta and go on if it's found.
724
-	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
724
+	if ($meta = get_metadata_by_mid($meta_type, $meta_id)) {
725 725
 		$object_id = $meta->{$column};
726 726
 
727 727
 		/** This action is documented in wp-includes/meta.php */
728
-		do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
728
+		do_action("delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value);
729 729
 
730 730
 		// Old-style action.
731
-		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
731
+		if ('post' == $meta_type || 'comment' == $meta_type) {
732 732
 			/**
733 733
 			 * Fires immediately before deleting post or comment metadata of a specific type.
734 734
 			 *
@@ -739,20 +739,20 @@  discard block
 block discarded – undo
739 739
 			 *
740 740
 			 * @param int $meta_id ID of the metadata entry to delete.
741 741
 			 */
742
-			do_action( "delete_{$meta_type}meta", $meta_id );
742
+			do_action("delete_{$meta_type}meta", $meta_id);
743 743
 		}
744 744
 
745 745
 		// Run the query, will return true if deleted, false otherwise
746
-		$result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) );
746
+		$result = (bool) $wpdb->delete($table, array($id_column => $meta_id));
747 747
 
748 748
 		// Clear the caches.
749
-		wp_cache_delete($object_id, $meta_type . '_meta');
749
+		wp_cache_delete($object_id, $meta_type.'_meta');
750 750
 
751 751
 		/** This action is documented in wp-includes/meta.php */
752
-		do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
752
+		do_action("deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value);
753 753
 
754 754
 		// Old-style action.
755
-		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
755
+		if ('post' == $meta_type || 'comment' == $meta_type) {
756 756
 			/**
757 757
 			 * Fires immediately after deleting post or comment metadata of a specific type.
758 758
 			 *
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 			 *
764 764
 			 * @param int $meta_ids Deleted metadata entry ID.
765 765
 			 */
766
-			do_action( "deleted_{$meta_type}meta", $meta_id );
766
+			do_action("deleted_{$meta_type}meta", $meta_id);
767 767
 		}
768 768
 
769 769
 		return $result;
@@ -788,53 +788,53 @@  discard block
 block discarded – undo
788 788
 function update_meta_cache($meta_type, $object_ids) {
789 789
 	global $wpdb;
790 790
 
791
-	if ( ! $meta_type || ! $object_ids ) {
791
+	if ( ! $meta_type || ! $object_ids) {
792 792
 		return false;
793 793
 	}
794 794
 
795
-	$table = _get_meta_table( $meta_type );
796
-	if ( ! $table ) {
795
+	$table = _get_meta_table($meta_type);
796
+	if ( ! $table) {
797 797
 		return false;
798 798
 	}
799 799
 
800
-	$column = sanitize_key($meta_type . '_id');
800
+	$column = sanitize_key($meta_type.'_id');
801 801
 
802
-	if ( !is_array($object_ids) ) {
802
+	if ( ! is_array($object_ids)) {
803 803
 		$object_ids = preg_replace('|[^0-9,]|', '', $object_ids);
804 804
 		$object_ids = explode(',', $object_ids);
805 805
 	}
806 806
 
807 807
 	$object_ids = array_map('intval', $object_ids);
808 808
 
809
-	$cache_key = $meta_type . '_meta';
809
+	$cache_key = $meta_type.'_meta';
810 810
 	$ids = array();
811 811
 	$cache = array();
812
-	foreach ( $object_ids as $id ) {
813
-		$cached_object = wp_cache_get( $id, $cache_key );
814
-		if ( false === $cached_object )
812
+	foreach ($object_ids as $id) {
813
+		$cached_object = wp_cache_get($id, $cache_key);
814
+		if (false === $cached_object)
815 815
 			$ids[] = $id;
816 816
 		else
817 817
 			$cache[$id] = $cached_object;
818 818
 	}
819 819
 
820
-	if ( empty( $ids ) )
820
+	if (empty($ids))
821 821
 		return $cache;
822 822
 
823 823
 	// Get meta info
824
-	$id_list = join( ',', $ids );
824
+	$id_list = join(',', $ids);
825 825
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
826
-	$meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A );
826
+	$meta_list = $wpdb->get_results("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A);
827 827
 
828
-	if ( !empty($meta_list) ) {
829
-		foreach ( $meta_list as $metarow) {
828
+	if ( ! empty($meta_list)) {
829
+		foreach ($meta_list as $metarow) {
830 830
 			$mpid = intval($metarow[$column]);
831 831
 			$mkey = $metarow['meta_key'];
832 832
 			$mval = $metarow['meta_value'];
833 833
 
834 834
 			// Force subkeys to be array type:
835
-			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
835
+			if ( ! isset($cache[$mpid]) || ! is_array($cache[$mpid]))
836 836
 				$cache[$mpid] = array();
837
-			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
837
+			if ( ! isset($cache[$mpid][$mkey]) || ! is_array($cache[$mpid][$mkey]))
838 838
 				$cache[$mpid][$mkey] = array();
839 839
 
840 840
 			// Add a value to the current pid/key:
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 		}
843 843
 	}
844 844
 
845
-	foreach ( $ids as $id ) {
846
-		if ( ! isset($cache[$id]) )
845
+	foreach ($ids as $id) {
846
+		if ( ! isset($cache[$id]))
847 847
 			$cache[$id] = array();
848
-		wp_cache_add( $id, $cache[$id], $cache_key );
848
+		wp_cache_add($id, $cache[$id], $cache_key);
849 849
 	}
850 850
 
851 851
 	return $cache;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 function wp_metadata_lazyloader() {
862 862
 	static $wp_metadata_lazyloader;
863 863
 
864
-	if ( null === $wp_metadata_lazyloader ) {
864
+	if (null === $wp_metadata_lazyloader) {
865 865
 		$wp_metadata_lazyloader = new WP_Metadata_Lazyloader();
866 866
 	}
867 867
 
@@ -882,9 +882,9 @@  discard block
 block discarded – undo
882 882
  * @param object $context           Optional. The main query object
883 883
  * @return array Associative array of `JOIN` and `WHERE` SQL.
884 884
  */
885
-function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
886
-	$meta_query_obj = new WP_Meta_Query( $meta_query );
887
-	return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context );
885
+function get_meta_sql($meta_query, $type, $primary_table, $primary_id_column, $context = null) {
886
+	$meta_query_obj = new WP_Meta_Query($meta_query);
887
+	return $meta_query_obj->get_sql($type, $primary_table, $primary_id_column, $context);
888 888
 }
889 889
 
890 890
 /**
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
 function _get_meta_table($type) {
901 901
 	global $wpdb;
902 902
 
903
-	$table_name = $type . 'meta';
903
+	$table_name = $type.'meta';
904 904
 
905
-	if ( empty($wpdb->$table_name) )
905
+	if (empty($wpdb->$table_name))
906 906
 		return false;
907 907
 
908 908
 	return $wpdb->$table_name;
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
  * @param string|null $meta_type
918 918
  * @return bool True if the key is protected, false otherwise.
919 919
  */
920
-function is_protected_meta( $meta_key, $meta_type = null ) {
921
-	$protected = ( '_' == $meta_key[0] );
920
+function is_protected_meta($meta_key, $meta_type = null) {
921
+	$protected = ('_' == $meta_key[0]);
922 922
 
923 923
 	/**
924 924
 	 * Filters whether a meta key is protected.
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 * @param string $meta_key  Meta key.
930 930
 	 * @param string $meta_type Meta type.
931 931
 	 */
932
-	return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
932
+	return apply_filters('is_protected_meta', $protected, $meta_key, $meta_type);
933 933
 }
934 934
 
935 935
 /**
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
  *
944 944
  * @return mixed Sanitized $meta_value.
945 945
  */
946
-function sanitize_meta( $meta_key, $meta_value, $object_type ) {
946
+function sanitize_meta($meta_key, $meta_value, $object_type) {
947 947
 	/**
948 948
 	 * Filters the sanitization of a specific meta key of a specific meta type.
949 949
 	 *
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 	 * @param string $meta_key        Meta key.
958 958
 	 * @param string $object_type     Object type.
959 959
 	 */
960
-	return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type );
960
+	return apply_filters("sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type);
961 961
 }
962 962
 
963 963
 /**
@@ -986,10 +986,10 @@  discard block
 block discarded – undo
986 986
  *                       Registering a meta key with distinct sanitize and auth callbacks will fire those
987 987
  *                       callbacks, but will not add to the global registry.
988 988
  */
989
-function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
989
+function register_meta($object_type, $meta_key, $args, $deprecated = null) {
990 990
 	global $wp_meta_keys;
991 991
 
992
-	if ( ! is_array( $wp_meta_keys ) ) {
992
+	if ( ! is_array($wp_meta_keys)) {
993 993
 		$wp_meta_keys = array();
994 994
 	}
995 995
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 	$has_old_sanitize_cb = false;
1007 1007
 	$has_old_auth_cb = false;
1008 1008
 
1009
-	if ( is_callable( $args ) ) {
1009
+	if (is_callable($args)) {
1010 1010
 		$args = array(
1011 1011
 			'sanitize_callback' => $args,
1012 1012
 		);
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 		$args = (array) $args;
1017 1017
 	}
1018 1018
 
1019
-	if ( is_callable( $deprecated ) ) {
1019
+	if (is_callable($deprecated)) {
1020 1020
 		$args['auth_callback'] = $deprecated;
1021 1021
 		$has_old_auth_cb = true;
1022 1022
 	}
@@ -1031,12 +1031,12 @@  discard block
 block discarded – undo
1031 1031
 	 * @param string $object_type Object type.
1032 1032
 	 * @param string $meta_key    Meta key.
1033 1033
 	 */
1034
-	$args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
1035
-	$args = wp_parse_args( $args, $defaults );
1034
+	$args = apply_filters('register_meta_args', $args, $defaults, $object_type, $meta_key);
1035
+	$args = wp_parse_args($args, $defaults);
1036 1036
 
1037 1037
 	// If `auth_callback` is not provided, fall back to `is_protected_meta()`.
1038
-	if ( empty( $args['auth_callback'] ) ) {
1039
-		if ( is_protected_meta( $meta_key, $object_type ) ) {
1038
+	if (empty($args['auth_callback'])) {
1039
+		if (is_protected_meta($meta_key, $object_type)) {
1040 1040
 			$args['auth_callback'] = '__return_false';
1041 1041
 		} else {
1042 1042
 			$args['auth_callback'] = '__return_true';
@@ -1044,17 +1044,17 @@  discard block
 block discarded – undo
1044 1044
 	}
1045 1045
 
1046 1046
 	// Back-compat: old sanitize and auth callbacks are applied to all of an object type.
1047
-	if ( is_callable( $args['sanitize_callback'] ) ) {
1048
-		add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 );
1047
+	if (is_callable($args['sanitize_callback'])) {
1048
+		add_filter("sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3);
1049 1049
 	}
1050 1050
 
1051
-	if ( is_callable( $args['auth_callback'] ) ) {
1052
-		add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
1051
+	if (is_callable($args['auth_callback'])) {
1052
+		add_filter("auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6);
1053 1053
 	}
1054 1054
 
1055 1055
 	// Global registry only contains meta keys registered with the array of arguments added in 4.6.0.
1056
-	if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb ) {
1057
-		$wp_meta_keys[ $object_type ][ $meta_key ] = $args;
1056
+	if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb) {
1057
+		$wp_meta_keys[$object_type][$meta_key] = $args;
1058 1058
 
1059 1059
 		return true;
1060 1060
 	}
@@ -1072,18 +1072,18 @@  discard block
 block discarded – undo
1072 1072
  *
1073 1073
  * @return bool True if the meta key is registered to the object type. False if not.
1074 1074
  */
1075
-function registered_meta_key_exists( $object_type, $meta_key ) {
1075
+function registered_meta_key_exists($object_type, $meta_key) {
1076 1076
 	global $wp_meta_keys;
1077 1077
 
1078
-	if ( ! is_array( $wp_meta_keys ) ) {
1078
+	if ( ! is_array($wp_meta_keys)) {
1079 1079
 		return false;
1080 1080
 	}
1081 1081
 
1082
-	if ( ! isset( $wp_meta_keys[ $object_type ] ) ) {
1082
+	if ( ! isset($wp_meta_keys[$object_type])) {
1083 1083
 		return false;
1084 1084
 	}
1085 1085
 
1086
-	if ( isset( $wp_meta_keys[ $object_type ][ $meta_key ] ) ) {
1086
+	if (isset($wp_meta_keys[$object_type][$meta_key])) {
1087 1087
 		return true;
1088 1088
 	}
1089 1089
 
@@ -1099,28 +1099,28 @@  discard block
 block discarded – undo
1099 1099
  * @param string $meta_key    The meta key.
1100 1100
  * @return bool True if successful. False if the meta key was not registered.
1101 1101
  */
1102
-function unregister_meta_key( $object_type, $meta_key ) {
1102
+function unregister_meta_key($object_type, $meta_key) {
1103 1103
 	global $wp_meta_keys;
1104 1104
 
1105
-	if ( ! registered_meta_key_exists( $object_type, $meta_key ) ) {
1105
+	if ( ! registered_meta_key_exists($object_type, $meta_key)) {
1106 1106
 		return false;
1107 1107
 	}
1108 1108
 
1109
-	$args = $wp_meta_keys[ $object_type ][ $meta_key ];
1109
+	$args = $wp_meta_keys[$object_type][$meta_key];
1110 1110
 
1111
-	if ( isset( $args['sanitize_callback'] ) && is_callable( $args['sanitize_callback'] ) ) {
1112
-		remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] );
1111
+	if (isset($args['sanitize_callback']) && is_callable($args['sanitize_callback'])) {
1112
+		remove_filter("sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback']);
1113 1113
 	}
1114 1114
 
1115
-	if ( isset( $args['auth_callback'] ) && is_callable( $args['auth_callback'] ) ) {
1116
-		remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] );
1115
+	if (isset($args['auth_callback']) && is_callable($args['auth_callback'])) {
1116
+		remove_filter("auth_{$object_type}_meta_{$meta_key}", $args['auth_callback']);
1117 1117
 	}
1118 1118
 
1119
-	unset( $wp_meta_keys[ $object_type ][ $meta_key ] );
1119
+	unset($wp_meta_keys[$object_type][$meta_key]);
1120 1120
 
1121 1121
 	// Do some clean up
1122
-	if ( empty( $wp_meta_keys[ $object_type ] ) ) {
1123
-		unset( $wp_meta_keys[ $object_type ] );
1122
+	if (empty($wp_meta_keys[$object_type])) {
1123
+		unset($wp_meta_keys[$object_type]);
1124 1124
 	}
1125 1125
 
1126 1126
 	return true;
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
  * @param string $object_type The type of object. Post, comment, user, term.
1135 1135
  * @return array List of registered meta keys.
1136 1136
  */
1137
-function get_registered_meta_keys( $object_type ) {
1137
+function get_registered_meta_keys($object_type) {
1138 1138
 	global $wp_meta_keys;
1139 1139
 
1140
-	if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $object_type ] ) ) {
1140
+	if ( ! is_array($wp_meta_keys) || ! isset($wp_meta_keys[$object_type])) {
1141 1141
 		return array();
1142 1142
 	}
1143 1143
 
1144
-	return $wp_meta_keys[ $object_type ];
1144
+	return $wp_meta_keys[$object_type];
1145 1145
 }
1146 1146
 
1147 1147
 /**
@@ -1156,28 +1156,28 @@  discard block
 block discarded – undo
1156 1156
  * @return mixed A single value or array of values for a key if specified. An array of all registered keys
1157 1157
  *               and values for an object ID if not.
1158 1158
  */
1159
-function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) {
1160
-	if ( ! empty( $meta_key ) ) {
1161
-		if ( ! registered_meta_key_exists( $object_type, $meta_key ) ) {
1159
+function get_registered_metadata($object_type, $object_id, $meta_key = '') {
1160
+	if ( ! empty($meta_key)) {
1161
+		if ( ! registered_meta_key_exists($object_type, $meta_key)) {
1162 1162
 			return false;
1163 1163
 		}
1164
-		$meta_keys = get_registered_meta_keys( $object_type );
1165
-		$meta_key_data = $meta_keys[ $meta_key ];
1164
+		$meta_keys = get_registered_meta_keys($object_type);
1165
+		$meta_key_data = $meta_keys[$meta_key];
1166 1166
 
1167
-		$data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] );
1167
+		$data = get_metadata($object_type, $object_id, $meta_key, $meta_key_data['single']);
1168 1168
 
1169 1169
 		return $data;
1170 1170
 	}
1171 1171
 
1172
-	$data = get_metadata( $object_type, $object_id );
1172
+	$data = get_metadata($object_type, $object_id);
1173 1173
 
1174
-	$meta_keys = get_registered_meta_keys( $object_type );
1174
+	$meta_keys = get_registered_meta_keys($object_type);
1175 1175
 	$registered_data = array();
1176 1176
 
1177 1177
 	// Someday, array_filter()
1178
-	foreach ( $meta_keys as $k => $v ) {
1179
-		if ( isset( $data[ $k ] ) ) {
1180
-			$registered_data[ $k ] = $data[ $k ];
1178
+	foreach ($meta_keys as $k => $v) {
1179
+		if (isset($data[$k])) {
1180
+			$registered_data[$k] = $data[$k];
1181 1181
 		}
1182 1182
 	}
1183 1183
 
@@ -1197,13 +1197,13 @@  discard block
 block discarded – undo
1197 1197
  *
1198 1198
  * @return array Filtered arguments.
1199 1199
  */
1200
-function _wp_register_meta_args_whitelist( $args, $default_args ) {
1201
-	$whitelist = array_keys( $default_args );
1200
+function _wp_register_meta_args_whitelist($args, $default_args) {
1201
+	$whitelist = array_keys($default_args);
1202 1202
 
1203 1203
 	// In an anonymous function world, this would be better as an array_filter()
1204
-	foreach ( $args as $key => $value ) {
1205
-		if ( ! in_array( $key, $whitelist ) ) {
1206
-			unset( $args[ $key ] );
1204
+	foreach ($args as $key => $value) {
1205
+		if ( ! in_array($key, $whitelist)) {
1206
+			unset($args[$key]);
1207 1207
 		}
1208 1208
 	}
1209 1209
 
Please login to merge, or discard this patch.
src/wp-includes/registration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
  *
5 5
  * @package WordPress
6 6
  */
7
-_deprecated_file( basename(__FILE__), '3.1.0', null, __( 'This file no longer needs to be included.' ) );
7
+_deprecated_file(basename(__FILE__), '3.1.0', null, __('This file no longer needs to be included.'));
Please login to merge, or discard this patch.
src/wp-includes/author-template.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 function get_the_author($deprecated = '') {
24 24
 	global $authordata;
25 25
 
26
-	if ( !empty( $deprecated ) )
27
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
26
+	if ( !empty( $deprecated ) ) {
27
+			_deprecated_argument( __FUNCTION__, '2.1.0' );
28
+	}
28 29
 
29 30
 	/**
30 31
 	 * Filters the display name of the current post's author.
@@ -131,8 +132,9 @@  discard block
 block discarded – undo
131 132
 		$authordata = get_userdata( $user_id );
132 133
 	}
133 134
 
134
-	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) )
135
-		$field = 'user_' . $field;
135
+	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) ) {
136
+			$field = 'user_' . $field;
137
+	}
136 138
 
137 139
 	$value = isset( $authordata->$field ) ? $authordata->$field : '';
138 140
 
@@ -304,8 +306,9 @@  discard block
 block discarded – undo
304 306
 	} else {
305 307
 		if ( '' == $author_nicename ) {
306 308
 			$user = get_userdata($author_id);
307
-			if ( !empty($user->user_nicename) )
308
-				$author_nicename = $user->user_nicename;
309
+			if ( !empty($user->user_nicename) ) {
310
+							$author_nicename = $user->user_nicename;
311
+			}
309 312
 		}
310 313
 		$link = str_replace('%author%', $author_nicename, $link);
311 314
 		$link = home_url( user_trailingslashit( $link ) );
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 function get_the_author($deprecated = '') {
24 24
 	global $authordata;
25 25
 
26
-	if ( !empty( $deprecated ) )
27
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
26
+	if ( ! empty($deprecated))
27
+		_deprecated_argument(__FUNCTION__, '2.1.0');
28 28
 
29 29
 	/**
30 30
 	 * Filters the display name of the current post's author.
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
  * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
56 56
  * @return string|null The author's display name, from get_the_author().
57 57
  */
58
-function the_author( $deprecated = '', $deprecated_echo = true ) {
59
-	if ( ! empty( $deprecated ) ) {
60
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
58
+function the_author($deprecated = '', $deprecated_echo = true) {
59
+	if ( ! empty($deprecated)) {
60
+		_deprecated_argument(__FUNCTION__, '2.1.0');
61 61
 	}
62 62
 
63
-	if ( true !== $deprecated_echo ) {
64
-		_deprecated_argument( __FUNCTION__, '1.5.0',
63
+	if (true !== $deprecated_echo) {
64
+		_deprecated_argument(__FUNCTION__, '1.5.0',
65 65
 			/* translators: %s: get_the_author() */
66
-			sprintf( __( 'Use %s instead if you do not want the value echoed.' ),
66
+			sprintf(__('Use %s instead if you do not want the value echoed.'),
67 67
 				'<code>get_the_author()</code>'
68 68
 			)
69 69
 		);
70 70
 	}
71 71
 
72
-	if ( $deprecated_echo ) {
72
+	if ($deprecated_echo) {
73 73
 		echo get_the_author();
74 74
 	}
75 75
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @return string|void The author's display name.
85 85
  */
86 86
 function get_the_modified_author() {
87
-	if ( $last_id = get_post_meta( get_post()->ID, '_edit_last', true) ) {
87
+	if ($last_id = get_post_meta(get_post()->ID, '_edit_last', true)) {
88 88
 		$last_user = get_userdata($last_id);
89 89
 
90 90
 		/**
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
  * @param int $user_id Optional. User ID.
122 122
  * @return string The author's field from the current author's DB object, otherwise an empty string.
123 123
  */
124
-function get_the_author_meta( $field = '', $user_id = false ) {
124
+function get_the_author_meta($field = '', $user_id = false) {
125 125
 	$original_user_id = $user_id;
126 126
 
127
-	if ( ! $user_id ) {
127
+	if ( ! $user_id) {
128 128
 		global $authordata;
129
-		$user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
129
+		$user_id = isset($authordata->ID) ? $authordata->ID : 0;
130 130
 	} else {
131
-		$authordata = get_userdata( $user_id );
131
+		$authordata = get_userdata($user_id);
132 132
 	}
133 133
 
134
-	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) )
135
-		$field = 'user_' . $field;
134
+	if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status')))
135
+		$field = 'user_'.$field;
136 136
 
137
-	$value = isset( $authordata->$field ) ? $authordata->$field : '';
137
+	$value = isset($authordata->$field) ? $authordata->$field : '';
138 138
 
139 139
 	/**
140 140
 	 * Filters the value of the requested user metadata.
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param int      $user_id          The user ID for the value.
149 149
 	 * @param int|bool $original_user_id The original user ID, as passed to the function.
150 150
 	 */
151
-	return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );
151
+	return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
152 152
 }
153 153
 
154 154
 /**
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
  * @param string $field selects the field of the users record.
162 162
  * @param int $user_id Optional. User ID.
163 163
  */
164
-function the_author_meta( $field = '', $user_id = false ) {
165
-	$author_meta = get_the_author_meta( $field, $user_id );
164
+function the_author_meta($field = '', $user_id = false) {
165
+	$author_meta = get_the_author_meta($field, $user_id);
166 166
 
167 167
 	/**
168 168
 	 * The value of the requested user metadata.
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param string $author_meta The value of the metadata.
175 175
 	 * @param int    $user_id     The user ID.
176 176
 	 */
177
-	echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
177
+	echo apply_filters("the_author_{$field}", $author_meta, $user_id);
178 178
 }
179 179
 
180 180
 /**
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
  *                     else the result of get_the_author().
190 190
  */
191 191
 function get_the_author_link() {
192
-	if ( get_the_author_meta('url') ) {
193
-		return sprintf( '<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
194
-			esc_url( get_the_author_meta('url') ),
192
+	if (get_the_author_meta('url')) {
193
+		return sprintf('<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
194
+			esc_url(get_the_author_meta('url')),
195 195
 			/* translators: %s: author's display name */
196
-			esc_attr( sprintf( __( 'Visit %s&#8217;s website' ), get_the_author() ) ),
196
+			esc_attr(sprintf(__('Visit %s&#8217;s website'), get_the_author())),
197 197
 			get_the_author()
198 198
 		);
199 199
 	} else {
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function get_the_author_posts() {
226 226
 	$post = get_post();
227
-	if ( ! $post ) {
227
+	if ( ! $post) {
228 228
 		return 0;
229 229
 	}
230
-	return count_user_posts( $post->post_author, $post->post_type );
230
+	return count_user_posts($post->post_author, $post->post_type);
231 231
 }
232 232
 
233 233
 /**
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function get_the_author_posts_link() {
255 255
 	global $authordata;
256
-	if ( ! is_object( $authordata ) ) {
256
+	if ( ! is_object($authordata)) {
257 257
 		return;
258 258
 	}
259 259
 
260
-	$link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
261
-		esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
260
+	$link = sprintf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
261
+		esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
262 262
 		/* translators: %s: author's display name */
263
-		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
263
+		esc_attr(sprintf(__('Posts by %s'), get_the_author())),
264 264
 		get_the_author()
265 265
 	);
266 266
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @param string $link HTML link.
273 273
 	 */
274
-	return apply_filters( 'the_author_posts_link', $link );
274
+	return apply_filters('the_author_posts_link', $link);
275 275
 }
276 276
 
277 277
 /**
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param string $deprecated Unused.
284 284
  */
285
-function the_author_posts_link( $deprecated = '' ) {
286
-	if ( ! empty( $deprecated ) ) {
287
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
285
+function the_author_posts_link($deprecated = '') {
286
+	if ( ! empty($deprecated)) {
287
+		_deprecated_argument(__FUNCTION__, '2.1.0');
288 288
 	}
289 289
 	echo get_the_author_posts_link();
290 290
 }
@@ -300,22 +300,22 @@  discard block
 block discarded – undo
300 300
  * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
301 301
  * @return string The URL to the author's page.
302 302
  */
303
-function get_author_posts_url( $author_id, $author_nicename = '' ) {
303
+function get_author_posts_url($author_id, $author_nicename = '') {
304 304
 	global $wp_rewrite;
305 305
 	$auth_ID = (int) $author_id;
306 306
 	$link = $wp_rewrite->get_author_permastruct();
307 307
 
308
-	if ( empty($link) ) {
309
-		$file = home_url( '/' );
310
-		$link = $file . '?author=' . $auth_ID;
308
+	if (empty($link)) {
309
+		$file = home_url('/');
310
+		$link = $file.'?author='.$auth_ID;
311 311
 	} else {
312
-		if ( '' == $author_nicename ) {
312
+		if ('' == $author_nicename) {
313 313
 			$user = get_userdata($author_id);
314
-			if ( !empty($user->user_nicename) )
314
+			if ( ! empty($user->user_nicename))
315 315
 				$author_nicename = $user->user_nicename;
316 316
 		}
317 317
 		$link = str_replace('%author%', $author_nicename, $link);
318
-		$link = home_url( user_trailingslashit( $link ) );
318
+		$link = home_url(user_trailingslashit($link));
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @param int    $author_id       The author's id.
328 328
 	 * @param string $author_nicename The author's nice name.
329 329
 	 */
330
-	$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
330
+	$link = apply_filters('author_link', $link, $author_id, $author_nicename);
331 331
 
332 332
 	return $link;
333 333
 }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  * }
368 368
  * @return string|void The output, if echo is set to false.
369 369
  */
370
-function wp_list_authors( $args = '' ) {
370
+function wp_list_authors($args = '') {
371 371
 	global $wpdb;
372 372
 
373 373
 	$defaults = array(
@@ -378,94 +378,94 @@  discard block
 block discarded – undo
378 378
 		'style' => 'list', 'html' => true, 'exclude' => '', 'include' => ''
379 379
 	);
380 380
 
381
-	$args = wp_parse_args( $args, $defaults );
381
+	$args = wp_parse_args($args, $defaults);
382 382
 
383 383
 	$return = '';
384 384
 
385
-	$query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) );
385
+	$query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'number', 'exclude', 'include'));
386 386
 	$query_args['fields'] = 'ids';
387
-	$authors = get_users( $query_args );
387
+	$authors = get_users($query_args);
388 388
 
389 389
 	$author_count = array();
390
-	foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author" ) as $row ) {
390
+	foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE ".get_private_posts_cap_sql('post')." GROUP BY post_author") as $row) {
391 391
 		$author_count[$row->post_author] = $row->count;
392 392
 	}
393
-	foreach ( $authors as $author_id ) {
394
-		$author = get_userdata( $author_id );
393
+	foreach ($authors as $author_id) {
394
+		$author = get_userdata($author_id);
395 395
 
396
-		if ( $args['exclude_admin'] && 'admin' == $author->display_name ) {
396
+		if ($args['exclude_admin'] && 'admin' == $author->display_name) {
397 397
 			continue;
398 398
 		}
399 399
 
400
-		$posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;
400
+		$posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
401 401
 
402
-		if ( ! $posts && $args['hide_empty'] ) {
402
+		if ( ! $posts && $args['hide_empty']) {
403 403
 			continue;
404 404
 		}
405 405
 
406
-		if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
406
+		if ($args['show_fullname'] && $author->first_name && $author->last_name) {
407 407
 			$name = "$author->first_name $author->last_name";
408 408
 		} else {
409 409
 			$name = $author->display_name;
410 410
 		}
411 411
 
412
-		if ( ! $args['html'] ) {
413
-			$return .= $name . ', ';
412
+		if ( ! $args['html']) {
413
+			$return .= $name.', ';
414 414
 
415 415
 			continue; // No need to go further to process HTML.
416 416
 		}
417 417
 
418
-		if ( 'list' == $args['style'] ) {
418
+		if ('list' == $args['style']) {
419 419
 			$return .= '<li>';
420 420
 		}
421 421
 
422
-		$link = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>',
423
-			get_author_posts_url( $author->ID, $author->user_nicename ),
422
+		$link = sprintf('<a href="%1$s" title="%2$s">%3$s</a>',
423
+			get_author_posts_url($author->ID, $author->user_nicename),
424 424
 			/* translators: %s: author's display name */
425
-			esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ),
425
+			esc_attr(sprintf(__('Posts by %s'), $author->display_name)),
426 426
 			$name
427 427
 		);
428 428
 
429
-		if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
429
+		if ( ! empty($args['feed_image']) || ! empty($args['feed'])) {
430 430
 			$link .= ' ';
431
-			if ( empty( $args['feed_image'] ) ) {
431
+			if (empty($args['feed_image'])) {
432 432
 				$link .= '(';
433 433
 			}
434 434
 
435
-			$link .= '<a href="' . get_author_feed_link( $author->ID, $args['feed_type'] ) . '"';
435
+			$link .= '<a href="'.get_author_feed_link($author->ID, $args['feed_type']).'"';
436 436
 
437 437
 			$alt = '';
438
-			if ( ! empty( $args['feed'] ) ) {
439
-				$alt = ' alt="' . esc_attr( $args['feed'] ) . '"';
438
+			if ( ! empty($args['feed'])) {
439
+				$alt = ' alt="'.esc_attr($args['feed']).'"';
440 440
 				$name = $args['feed'];
441 441
 			}
442 442
 
443 443
 			$link .= '>';
444 444
 
445
-			if ( ! empty( $args['feed_image'] ) ) {
446
-				$link .= '<img src="' . esc_url( $args['feed_image'] ) . '" style="border: none;"' . $alt . ' />';
445
+			if ( ! empty($args['feed_image'])) {
446
+				$link .= '<img src="'.esc_url($args['feed_image']).'" style="border: none;"'.$alt.' />';
447 447
 			} else {
448 448
 				$link .= $name;
449 449
 			}
450 450
 
451 451
 			$link .= '</a>';
452 452
 
453
-			if ( empty( $args['feed_image'] ) ) {
453
+			if (empty($args['feed_image'])) {
454 454
 				$link .= ')';
455 455
 			}
456 456
 		}
457 457
 
458
-		if ( $args['optioncount'] ) {
459
-			$link .= ' ('. $posts . ')';
458
+		if ($args['optioncount']) {
459
+			$link .= ' ('.$posts.')';
460 460
 		}
461 461
 
462 462
 		$return .= $link;
463
-		$return .= ( 'list' == $args['style'] ) ? '</li>' : ', ';
463
+		$return .= ('list' == $args['style']) ? '</li>' : ', ';
464 464
 	}
465 465
 
466
-	$return = rtrim( $return, ', ' );
466
+	$return = rtrim($return, ', ');
467 467
 
468
-	if ( ! $args['echo'] ) {
468
+	if ( ! $args['echo']) {
469 469
 		return $return;
470 470
 	}
471 471
 	echo $return;
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
 function is_multi_author() {
486 486
 	global $wpdb;
487 487
 
488
-	if ( false === ( $is_multi_author = get_transient( 'is_multi_author' ) ) ) {
488
+	if (false === ($is_multi_author = get_transient('is_multi_author'))) {
489 489
 		$rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2");
490
-		$is_multi_author = 1 < count( $rows ) ? 1 : 0;
491
-		set_transient( 'is_multi_author', $is_multi_author );
490
+		$is_multi_author = 1 < count($rows) ? 1 : 0;
491
+		set_transient('is_multi_author', $is_multi_author);
492 492
 	}
493 493
 
494 494
 	/**
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
500 500
 	 */
501
-	return apply_filters( 'is_multi_author', (bool) $is_multi_author );
501
+	return apply_filters('is_multi_author', (bool) $is_multi_author);
502 502
 }
503 503
 
504 504
 /**
@@ -508,5 +508,5 @@  discard block
 block discarded – undo
508 508
  * @access private
509 509
  */
510 510
 function __clear_multi_author_cache() {
511
-	delete_transient( 'is_multi_author' );
511
+	delete_transient('is_multi_author');
512 512
 }
Please login to merge, or discard this patch.
src/wp-includes/registration-functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
  *
5 5
  * @package WordPress
6 6
  */
7
-_deprecated_file( basename(__FILE__), '2.1.0', null, __( 'This file no longer needs to be included.' ) );
7
+_deprecated_file(basename(__FILE__), '2.1.0', null, __('This file no longer needs to be included.'));
Please login to merge, or discard this patch.
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   +271 added lines, -271 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
 /**
@@ -125,11 +125,11 @@  discard block
 block discarded – undo
125 125
  * @param int $post_id Optional. Post ID to retrieve categories.
126 126
  * @return string
127 127
  */
128
-function get_the_category_list( $separator = '', $parents = '', $post_id = false ) {
128
+function get_the_category_list($separator = '', $parents = '', $post_id = false) {
129 129
 	global $wp_rewrite;
130
-	if ( ! is_object_in_taxonomy( get_post_type( $post_id ), 'category' ) ) {
130
+	if ( ! is_object_in_taxonomy(get_post_type($post_id), 'category')) {
131 131
 		/** This filter is documented in wp-includes/category-template.php */
132
-		return apply_filters( 'the_category', '', $separator, $parents );
132
+		return apply_filters('the_category', '', $separator, $parents);
133 133
 	}
134 134
 
135 135
 	/**
@@ -141,58 +141,58 @@  discard block
 block discarded – undo
141 141
 	 * @param int|bool $post_id    ID of the post we're retrieving categories for. When `false`, we assume the
142 142
 	 *                             current post in the loop.
143 143
 	 */
144
-	$categories = apply_filters( 'the_category_list', get_the_category( $post_id ), $post_id );
144
+	$categories = apply_filters('the_category_list', get_the_category($post_id), $post_id);
145 145
 
146
-	if ( empty( $categories ) ) {
146
+	if (empty($categories)) {
147 147
 		/** This filter is documented in wp-includes/category-template.php */
148
-		return apply_filters( 'the_category', __( 'Uncategorized' ), $separator, $parents );
148
+		return apply_filters('the_category', __('Uncategorized'), $separator, $parents);
149 149
 	}
150 150
 
151
-	$rel = ( is_object( $wp_rewrite ) && $wp_rewrite->using_permalinks() ) ? 'rel="category tag"' : 'rel="category"';
151
+	$rel = (is_object($wp_rewrite) && $wp_rewrite->using_permalinks()) ? 'rel="category tag"' : 'rel="category"';
152 152
 
153 153
 	$thelist = '';
154
-	if ( '' == $separator ) {
154
+	if ('' == $separator) {
155 155
 		$thelist .= '<ul class="post-categories">';
156
-		foreach ( $categories as $category ) {
156
+		foreach ($categories as $category) {
157 157
 			$thelist .= "\n\t<li>";
158
-			switch ( strtolower( $parents ) ) {
158
+			switch (strtolower($parents)) {
159 159
 				case 'multiple':
160
-					if ( $category->parent )
161
-						$thelist .= get_category_parents( $category->parent, true, $separator );
162
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
160
+					if ($category->parent)
161
+						$thelist .= get_category_parents($category->parent, true, $separator);
162
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a></li>';
163 163
 					break;
164 164
 				case 'single':
165
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"  ' . $rel . '>';
166
-					if ( $category->parent )
167
-						$thelist .= get_category_parents( $category->parent, false, $separator );
165
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'"  '.$rel.'>';
166
+					if ($category->parent)
167
+						$thelist .= get_category_parents($category->parent, false, $separator);
168 168
 					$thelist .= $category->name.'</a></li>';
169 169
 					break;
170 170
 				case '':
171 171
 				default:
172
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
172
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a></li>';
173 173
 			}
174 174
 		}
175 175
 		$thelist .= '</ul>';
176 176
 	} else {
177 177
 		$i = 0;
178
-		foreach ( $categories as $category ) {
179
-			if ( 0 < $i )
178
+		foreach ($categories as $category) {
179
+			if (0 < $i)
180 180
 				$thelist .= $separator;
181
-			switch ( strtolower( $parents ) ) {
181
+			switch (strtolower($parents)) {
182 182
 				case 'multiple':
183
-					if ( $category->parent )
184
-						$thelist .= get_category_parents( $category->parent, true, $separator );
185
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
183
+					if ($category->parent)
184
+						$thelist .= get_category_parents($category->parent, true, $separator);
185
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a>';
186 186
 					break;
187 187
 				case 'single':
188
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
189
-					if ( $category->parent )
190
-						$thelist .= get_category_parents( $category->parent, false, $separator );
188
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>';
189
+					if ($category->parent)
190
+						$thelist .= get_category_parents($category->parent, false, $separator);
191 191
 					$thelist .= "$category->name</a>";
192 192
 					break;
193 193
 				case '':
194 194
 				default:
195
-					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
195
+					$thelist .= '<a href="'.esc_url(get_category_link($category->term_id)).'" '.$rel.'>'.$category->name.'</a>';
196 196
 			}
197 197
 			++$i;
198 198
 		}
@@ -208,7 +208,7 @@  discard block
 block discarded – undo
208 208
 	 * @param string $parents   How to display the category parents. Accepts 'multiple',
209 209
 	 *                          'single', or empty.
210 210
 	 */
211
-	return apply_filters( 'the_category', $thelist, $separator, $parents );
211
+	return apply_filters('the_category', $thelist, $separator, $parents);
212 212
 }
213 213
 
214 214
 /**
@@ -229,11 +229,11 @@  discard block
 block discarded – undo
229 229
  * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
230 230
  * @return bool True if the current post is in any of the given categories.
231 231
  */
232
-function in_category( $category, $post = null ) {
233
-	if ( empty( $category ) )
232
+function in_category($category, $post = null) {
233
+	if (empty($category))
234 234
 		return false;
235 235
 
236
-	return has_category( $category, $post );
236
+	return has_category($category, $post);
237 237
 }
238 238
 
239 239
 /**
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
  * @param string $parents Optional. How to display the parents.
247 247
  * @param int $post_id Optional. Post ID to retrieve categories.
248 248
  */
249
-function the_category( $separator = '', $parents = '', $post_id = false ) {
250
-	echo get_the_category_list( $separator, $parents, $post_id );
249
+function the_category($separator = '', $parents = '', $post_id = false) {
250
+	echo get_the_category_list($separator, $parents, $post_id);
251 251
 }
252 252
 
253 253
 /**
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
  * @param int $category Optional. Category ID. Will use global category ID by default.
259 259
  * @return string Category description, available.
260 260
  */
261
-function category_description( $category = 0 ) {
262
-	return term_description( $category, 'category' );
261
+function category_description($category = 0) {
262
+	return term_description($category, 'category');
263 263
 }
264 264
 
265 265
 /**
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
  * }
305 305
  * @return string HTML content only if 'echo' argument is 0.
306 306
  */
307
-function wp_dropdown_categories( $args = '' ) {
307
+function wp_dropdown_categories($args = '') {
308 308
 	$defaults = array(
309 309
 		'show_option_all'   => '',
310 310
 		'show_option_none'  => '',
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
 		'required'          => false,
330 330
 	);
331 331
 
332
-	$defaults['selected'] = ( is_category() ) ? get_query_var( 'cat' ) : 0;
332
+	$defaults['selected'] = (is_category()) ? get_query_var('cat') : 0;
333 333
 
334 334
 	// Back compat.
335
-	if ( isset( $args['type'] ) && 'link' == $args['type'] ) {
336
-		_deprecated_argument( __FUNCTION__, '3.0.0',
335
+	if (isset($args['type']) && 'link' == $args['type']) {
336
+		_deprecated_argument(__FUNCTION__, '3.0.0',
337 337
 			/* translators: 1: "type => link", 2: "taxonomy => link_category" */
338
-			sprintf( __( '%1$s is deprecated. Use %2$s instead.' ),
338
+			sprintf(__('%1$s is deprecated. Use %2$s instead.'),
339 339
 				'<code>type => link</code>',
340 340
 				'<code>taxonomy => link_category</code>'
341 341
 			)
@@ -343,36 +343,36 @@  discard block
 block discarded – undo
343 343
 		$args['taxonomy'] = 'link_category';
344 344
 	}
345 345
 
346
-	$r = wp_parse_args( $args, $defaults );
346
+	$r = wp_parse_args($args, $defaults);
347 347
 	$option_none_value = $r['option_none_value'];
348 348
 
349
-	if ( ! isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
349
+	if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical']) {
350 350
 		$r['pad_counts'] = true;
351 351
 	}
352 352
 
353 353
 	$tab_index = $r['tab_index'];
354 354
 
355 355
 	$tab_index_attribute = '';
356
-	if ( (int) $tab_index > 0 ) {
356
+	if ((int) $tab_index > 0) {
357 357
 		$tab_index_attribute = " tabindex=\"$tab_index\"";
358 358
 	}
359 359
 
360 360
 	// Avoid clashes with the 'name' param of get_terms().
361 361
 	$get_terms_args = $r;
362
-	unset( $get_terms_args['name'] );
363
-	$categories = get_terms( $r['taxonomy'], $get_terms_args );
362
+	unset($get_terms_args['name']);
363
+	$categories = get_terms($r['taxonomy'], $get_terms_args);
364 364
 
365
-	$name = esc_attr( $r['name'] );
366
-	$class = esc_attr( $r['class'] );
367
-	$id = $r['id'] ? esc_attr( $r['id'] ) : $name;
365
+	$name = esc_attr($r['name']);
366
+	$class = esc_attr($r['class']);
367
+	$id = $r['id'] ? esc_attr($r['id']) : $name;
368 368
 	$required = $r['required'] ? 'required' : '';
369 369
 
370
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
370
+	if ( ! $r['hide_if_empty'] || ! empty($categories)) {
371 371
 		$output = "<select $required name='$name' id='$id' class='$class' $tab_index_attribute>\n";
372 372
 	} else {
373 373
 		$output = '';
374 374
 	}
375
-	if ( empty( $categories ) && ! $r['hide_if_empty'] && ! empty( $r['show_option_none'] ) ) {
375
+	if (empty($categories) && ! $r['hide_if_empty'] && ! empty($r['show_option_none'])) {
376 376
 
377 377
 		/**
378 378
 		 * Filters a taxonomy drop-down display element.
@@ -388,37 +388,37 @@  discard block
 block discarded – undo
388 388
 		 *
389 389
 		 * @param string $element Taxonomy element to list.
390 390
 		 */
391
-		$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
392
-		$output .= "\t<option value='" . esc_attr( $option_none_value ) . "' selected='selected'>$show_option_none</option>\n";
391
+		$show_option_none = apply_filters('list_cats', $r['show_option_none']);
392
+		$output .= "\t<option value='".esc_attr($option_none_value)."' selected='selected'>$show_option_none</option>\n";
393 393
 	}
394 394
 
395
-	if ( ! empty( $categories ) ) {
395
+	if ( ! empty($categories)) {
396 396
 
397
-		if ( $r['show_option_all'] ) {
397
+		if ($r['show_option_all']) {
398 398
 
399 399
 			/** This filter is documented in wp-includes/category-template.php */
400
-			$show_option_all = apply_filters( 'list_cats', $r['show_option_all'] );
401
-			$selected = ( '0' === strval($r['selected']) ) ? " selected='selected'" : '';
400
+			$show_option_all = apply_filters('list_cats', $r['show_option_all']);
401
+			$selected = ('0' === strval($r['selected'])) ? " selected='selected'" : '';
402 402
 			$output .= "\t<option value='0'$selected>$show_option_all</option>\n";
403 403
 		}
404 404
 
405
-		if ( $r['show_option_none'] ) {
405
+		if ($r['show_option_none']) {
406 406
 
407 407
 			/** This filter is documented in wp-includes/category-template.php */
408
-			$show_option_none = apply_filters( 'list_cats', $r['show_option_none'] );
409
-			$selected = selected( $option_none_value, $r['selected'], false );
410
-			$output .= "\t<option value='" . esc_attr( $option_none_value ) . "'$selected>$show_option_none</option>\n";
408
+			$show_option_none = apply_filters('list_cats', $r['show_option_none']);
409
+			$selected = selected($option_none_value, $r['selected'], false);
410
+			$output .= "\t<option value='".esc_attr($option_none_value)."'$selected>$show_option_none</option>\n";
411 411
 		}
412 412
 
413
-		if ( $r['hierarchical'] ) {
414
-			$depth = $r['depth'];  // Walk the full depth.
413
+		if ($r['hierarchical']) {
414
+			$depth = $r['depth']; // Walk the full depth.
415 415
 		} else {
416 416
 			$depth = -1; // Flat.
417 417
 		}
418
-		$output .= walk_category_dropdown_tree( $categories, $depth, $r );
418
+		$output .= walk_category_dropdown_tree($categories, $depth, $r);
419 419
 	}
420 420
 
421
-	if ( ! $r['hide_if_empty'] || ! empty( $categories ) ) {
421
+	if ( ! $r['hide_if_empty'] || ! empty($categories)) {
422 422
 		$output .= "</select>\n";
423 423
 	}
424 424
 	/**
@@ -429,9 +429,9 @@  discard block
 block discarded – undo
429 429
 	 * @param string $output HTML output.
430 430
 	 * @param array  $r      Arguments used to build the drop-down.
431 431
 	 */
432
-	$output = apply_filters( 'wp_dropdown_cats', $output, $r );
432
+	$output = apply_filters('wp_dropdown_cats', $output, $r);
433 433
 
434
-	if ( $r['echo'] ) {
434
+	if ($r['echo']) {
435 435
 		echo $output;
436 436
 	}
437 437
 	return $output;
@@ -488,7 +488,7 @@  discard block
 block discarded – undo
488 488
  * }
489 489
  * @return false|string HTML content only if 'echo' argument is 0.
490 490
  */
491
-function wp_list_categories( $args = '' ) {
491
+function wp_list_categories($args = '') {
492 492
 	$defaults = array(
493 493
 		'child_of'            => 0,
494 494
 		'current_category'    => 0,
@@ -507,110 +507,110 @@  discard block
 block discarded – undo
507 507
 		'separator'           => '<br />',
508 508
 		'show_count'          => 0,
509 509
 		'show_option_all'     => '',
510
-		'show_option_none'    => __( 'No categories' ),
510
+		'show_option_none'    => __('No categories'),
511 511
 		'style'               => 'list',
512 512
 		'taxonomy'            => 'category',
513
-		'title_li'            => __( 'Categories' ),
513
+		'title_li'            => __('Categories'),
514 514
 		'use_desc_for_title'  => 1,
515 515
 	);
516 516
 
517
-	$r = wp_parse_args( $args, $defaults );
517
+	$r = wp_parse_args($args, $defaults);
518 518
 
519
-	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] )
519
+	if ( ! isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical'])
520 520
 		$r['pad_counts'] = true;
521 521
 
522 522
 	// Descendants of exclusions should be excluded too.
523
-	if ( true == $r['hierarchical'] ) {
523
+	if (true == $r['hierarchical']) {
524 524
 		$exclude_tree = array();
525 525
 
526
-		if ( $r['exclude_tree'] ) {
527
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude_tree'] ) );
526
+		if ($r['exclude_tree']) {
527
+			$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude_tree']));
528 528
 		}
529 529
 
530
-		if ( $r['exclude'] ) {
531
-			$exclude_tree = array_merge( $exclude_tree, wp_parse_id_list( $r['exclude'] ) );
530
+		if ($r['exclude']) {
531
+			$exclude_tree = array_merge($exclude_tree, wp_parse_id_list($r['exclude']));
532 532
 		}
533 533
 
534 534
 		$r['exclude_tree'] = $exclude_tree;
535 535
 		$r['exclude'] = '';
536 536
 	}
537 537
 
538
-	if ( ! isset( $r['class'] ) )
539
-		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
538
+	if ( ! isset($r['class']))
539
+		$r['class'] = ('category' == $r['taxonomy']) ? 'categories' : $r['taxonomy'];
540 540
 
541
-	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
541
+	if ( ! taxonomy_exists($r['taxonomy'])) {
542 542
 		return false;
543 543
 	}
544 544
 
545 545
 	$show_option_all = $r['show_option_all'];
546 546
 	$show_option_none = $r['show_option_none'];
547 547
 
548
-	$categories = get_categories( $r );
548
+	$categories = get_categories($r);
549 549
 
550 550
 	$output = '';
551
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
552
-		$output = '<li class="' . esc_attr( $r['class'] ) . '">' . $r['title_li'] . '<ul>';
551
+	if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
552
+		$output = '<li class="'.esc_attr($r['class']).'">'.$r['title_li'].'<ul>';
553 553
 	}
554
-	if ( empty( $categories ) ) {
555
-		if ( ! empty( $show_option_none ) ) {
556
-			if ( 'list' == $r['style'] ) {
557
-				$output .= '<li class="cat-item-none">' . $show_option_none . '</li>';
554
+	if (empty($categories)) {
555
+		if ( ! empty($show_option_none)) {
556
+			if ('list' == $r['style']) {
557
+				$output .= '<li class="cat-item-none">'.$show_option_none.'</li>';
558 558
 			} else {
559 559
 				$output .= $show_option_none;
560 560
 			}
561 561
 		}
562 562
 	} else {
563
-		if ( ! empty( $show_option_all ) ) {
563
+		if ( ! empty($show_option_all)) {
564 564
 
565 565
 			$posts_page = '';
566 566
 
567 567
 			// For taxonomies that belong only to custom post types, point to a valid archive.
568
-			$taxonomy_object = get_taxonomy( $r['taxonomy'] );
569
-			if ( ! in_array( 'post', $taxonomy_object->object_type ) && ! in_array( 'page', $taxonomy_object->object_type ) ) {
570
-				foreach ( $taxonomy_object->object_type as $object_type ) {
571
-					$_object_type = get_post_type_object( $object_type );
568
+			$taxonomy_object = get_taxonomy($r['taxonomy']);
569
+			if ( ! in_array('post', $taxonomy_object->object_type) && ! in_array('page', $taxonomy_object->object_type)) {
570
+				foreach ($taxonomy_object->object_type as $object_type) {
571
+					$_object_type = get_post_type_object($object_type);
572 572
 
573 573
 					// Grab the first one.
574
-					if ( ! empty( $_object_type->has_archive ) ) {
575
-						$posts_page = get_post_type_archive_link( $object_type );
574
+					if ( ! empty($_object_type->has_archive)) {
575
+						$posts_page = get_post_type_archive_link($object_type);
576 576
 						break;
577 577
 					}
578 578
 				}
579 579
 			}
580 580
 
581 581
 			// Fallback for the 'All' link is the posts page.
582
-			if ( ! $posts_page ) {
583
-				if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) ) {
584
-					$posts_page = get_permalink( get_option( 'page_for_posts' ) );
582
+			if ( ! $posts_page) {
583
+				if ('page' == get_option('show_on_front') && get_option('page_for_posts')) {
584
+					$posts_page = get_permalink(get_option('page_for_posts'));
585 585
 				} else {
586
-					$posts_page = home_url( '/' );
586
+					$posts_page = home_url('/');
587 587
 				}
588 588
 			}
589 589
 
590
-			$posts_page = esc_url( $posts_page );
591
-			if ( 'list' == $r['style'] ) {
590
+			$posts_page = esc_url($posts_page);
591
+			if ('list' == $r['style']) {
592 592
 				$output .= "<li class='cat-item-all'><a href='$posts_page'>$show_option_all</a></li>";
593 593
 			} else {
594 594
 				$output .= "<a href='$posts_page'>$show_option_all</a>";
595 595
 			}
596 596
 		}
597 597
 
598
-		if ( empty( $r['current_category'] ) && ( is_category() || is_tax() || is_tag() ) ) {
598
+		if (empty($r['current_category']) && (is_category() || is_tax() || is_tag())) {
599 599
 			$current_term_object = get_queried_object();
600
-			if ( $current_term_object && $r['taxonomy'] === $current_term_object->taxonomy ) {
600
+			if ($current_term_object && $r['taxonomy'] === $current_term_object->taxonomy) {
601 601
 				$r['current_category'] = get_queried_object_id();
602 602
 			}
603 603
 		}
604 604
 
605
-		if ( $r['hierarchical'] ) {
605
+		if ($r['hierarchical']) {
606 606
 			$depth = $r['depth'];
607 607
 		} else {
608 608
 			$depth = -1; // Flat.
609 609
 		}
610
-		$output .= walk_category_tree( $categories, $depth, $r );
610
+		$output .= walk_category_tree($categories, $depth, $r);
611 611
 	}
612 612
 
613
-	if ( $r['title_li'] && 'list' == $r['style'] && ( ! empty( $categories ) || ! $r['hide_title_if_empty'] ) ) {
613
+	if ($r['title_li'] && 'list' == $r['style'] && ( ! empty($categories) || ! $r['hide_title_if_empty'])) {
614 614
 		$output .= '</ul></li>';
615 615
 	}
616 616
 
@@ -622,9 +622,9 @@  discard block
 block discarded – undo
622 622
 	 * @param string $output HTML output.
623 623
 	 * @param array  $args   An array of taxonomy-listing arguments.
624 624
 	 */
625
-	$html = apply_filters( 'wp_list_categories', $output, $args );
625
+	$html = apply_filters('wp_list_categories', $output, $args);
626 626
 
627
-	if ( $r['echo'] ) {
627
+	if ($r['echo']) {
628 628
 		echo $html;
629 629
 	} else {
630 630
 		return $html;
@@ -666,33 +666,33 @@  discard block
 block discarded – undo
666 666
  * @return void|array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
667 667
  *                    Otherwise, this function outputs the tag cloud.
668 668
  */
669
-function wp_tag_cloud( $args = '' ) {
669
+function wp_tag_cloud($args = '') {
670 670
 	$defaults = array(
671 671
 		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
672 672
 		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
673 673
 		'exclude' => '', 'include' => '', 'link' => 'view', 'taxonomy' => 'post_tag', 'post_type' => '', 'echo' => true,
674 674
 		'show_count' => 0,
675 675
 	);
676
-	$args = wp_parse_args( $args, $defaults );
676
+	$args = wp_parse_args($args, $defaults);
677 677
 
678
-	$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
678
+	$tags = get_terms($args['taxonomy'], array_merge($args, array('orderby' => 'count', 'order' => 'DESC'))); // Always query top tags
679 679
 
680
-	if ( empty( $tags ) || is_wp_error( $tags ) )
680
+	if (empty($tags) || is_wp_error($tags))
681 681
 		return;
682 682
 
683
-	foreach ( $tags as $key => $tag ) {
684
-		if ( 'edit' == $args['link'] )
685
-			$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
683
+	foreach ($tags as $key => $tag) {
684
+		if ('edit' == $args['link'])
685
+			$link = get_edit_term_link($tag->term_id, $tag->taxonomy, $args['post_type']);
686 686
 		else
687
-			$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
688
-		if ( is_wp_error( $link ) )
687
+			$link = get_term_link(intval($tag->term_id), $tag->taxonomy);
688
+		if (is_wp_error($link))
689 689
 			return;
690 690
 
691
-		$tags[ $key ]->link = $link;
692
-		$tags[ $key ]->id = $tag->term_id;
691
+		$tags[$key]->link = $link;
692
+		$tags[$key]->id = $tag->term_id;
693 693
 	}
694 694
 
695
-	$return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args
695
+	$return = wp_generate_tag_cloud($tags, $args); // Here's where those top tags get sorted according to $args
696 696
 
697 697
 	/**
698 698
 	 * Filters the tag cloud output.
@@ -702,9 +702,9 @@  discard block
 block discarded – undo
702 702
 	 * @param string $return HTML output of the tag cloud.
703 703
 	 * @param array  $args   An array of tag cloud arguments.
704 704
 	 */
705
-	$return = apply_filters( 'wp_tag_cloud', $return, $args );
705
+	$return = apply_filters('wp_tag_cloud', $return, $args);
706 706
 
707
-	if ( 'array' == $args['format'] || empty($args['echo']) )
707
+	if ('array' == $args['format'] || empty($args['echo']))
708 708
 		return $return;
709 709
 
710 710
 	echo $return;
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
  * @param int $count Number of posts with that tag.
719 719
  * @return int Scaled count.
720 720
  */
721
-function default_topic_count_scale( $count ) {
721
+function default_topic_count_scale($count) {
722 722
 	return round(log10($count + 1) * 100);
723 723
 }
724 724
 
@@ -768,7 +768,7 @@  discard block
 block discarded – undo
768 768
  * }
769 769
  * @return string|array Tag cloud as a string or an array, depending on 'format' argument.
770 770
  */
771
-function wp_generate_tag_cloud( $tags, $args = '' ) {
771
+function wp_generate_tag_cloud($tags, $args = '') {
772 772
 	$defaults = array(
773 773
 		'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 0,
774 774
 		'format' => 'flat', 'separator' => "\n", 'orderby' => 'name', 'order' => 'ASC',
@@ -777,31 +777,31 @@  discard block
 block discarded – undo
777 777
 		'show_count' => 0,
778 778
 	);
779 779
 
780
-	$args = wp_parse_args( $args, $defaults );
780
+	$args = wp_parse_args($args, $defaults);
781 781
 
782
-	$return = ( 'array' === $args['format'] ) ? array() : '';
782
+	$return = ('array' === $args['format']) ? array() : '';
783 783
 
784
-	if ( empty( $tags ) ) {
784
+	if (empty($tags)) {
785 785
 		return $return;
786 786
 	}
787 787
 
788 788
 	// Juggle topic counts.
789
-	if ( isset( $args['topic_count_text'] ) ) {
789
+	if (isset($args['topic_count_text'])) {
790 790
 		// First look for nooped plural support via topic_count_text.
791 791
 		$translate_nooped_plural = $args['topic_count_text'];
792
-	} elseif ( ! empty( $args['topic_count_text_callback'] ) ) {
792
+	} elseif ( ! empty($args['topic_count_text_callback'])) {
793 793
 		// Look for the alternative callback style. Ignore the previous default.
794
-		if ( $args['topic_count_text_callback'] === 'default_topic_count_text' ) {
795
-			$translate_nooped_plural = _n_noop( '%s item', '%s items' );
794
+		if ($args['topic_count_text_callback'] === 'default_topic_count_text') {
795
+			$translate_nooped_plural = _n_noop('%s item', '%s items');
796 796
 		} else {
797 797
 			$translate_nooped_plural = false;
798 798
 		}
799
-	} elseif ( isset( $args['single_text'] ) && isset( $args['multiple_text'] ) ) {
799
+	} elseif (isset($args['single_text']) && isset($args['multiple_text'])) {
800 800
 		// If no callback exists, look for the old-style single_text and multiple_text arguments.
801
-		$translate_nooped_plural = _n_noop( $args['single_text'], $args['multiple_text'] );
801
+		$translate_nooped_plural = _n_noop($args['single_text'], $args['multiple_text']);
802 802
 	} else {
803 803
 		// This is the default for when no callback, plural, or argument is passed in.
804
-		$translate_nooped_plural = _n_noop( '%s item', '%s items' );
804
+		$translate_nooped_plural = _n_noop('%s item', '%s items');
805 805
 	}
806 806
 
807 807
 	/**
@@ -812,47 +812,47 @@  discard block
 block discarded – undo
812 812
 	 * @param array $tags Ordered array of terms.
813 813
 	 * @param array $args An array of tag cloud arguments.
814 814
 	 */
815
-	$tags_sorted = apply_filters( 'tag_cloud_sort', $tags, $args );
816
-	if ( empty( $tags_sorted ) ) {
815
+	$tags_sorted = apply_filters('tag_cloud_sort', $tags, $args);
816
+	if (empty($tags_sorted)) {
817 817
 		return $return;
818 818
 	}
819 819
 
820
-	if ( $tags_sorted !== $tags ) {
820
+	if ($tags_sorted !== $tags) {
821 821
 		$tags = $tags_sorted;
822
-		unset( $tags_sorted );
822
+		unset($tags_sorted);
823 823
 	} else {
824
-		if ( 'RAND' === $args['order'] ) {
825
-			shuffle( $tags );
824
+		if ('RAND' === $args['order']) {
825
+			shuffle($tags);
826 826
 		} else {
827 827
 			// SQL cannot save you; this is a second (potentially different) sort on a subset of data.
828
-			if ( 'name' === $args['orderby'] ) {
829
-				uasort( $tags, '_wp_object_name_sort_cb' );
828
+			if ('name' === $args['orderby']) {
829
+				uasort($tags, '_wp_object_name_sort_cb');
830 830
 			} else {
831
-				uasort( $tags, '_wp_object_count_sort_cb' );
831
+				uasort($tags, '_wp_object_count_sort_cb');
832 832
 			}
833 833
 
834
-			if ( 'DESC' === $args['order'] ) {
835
-				$tags = array_reverse( $tags, true );
834
+			if ('DESC' === $args['order']) {
835
+				$tags = array_reverse($tags, true);
836 836
 			}
837 837
 		}
838 838
 	}
839 839
 
840
-	if ( $args['number'] > 0 )
841
-		$tags = array_slice( $tags, 0, $args['number'] );
840
+	if ($args['number'] > 0)
841
+		$tags = array_slice($tags, 0, $args['number']);
842 842
 
843 843
 	$counts = array();
844 844
 	$real_counts = array(); // For the alt tag
845
-	foreach ( (array) $tags as $key => $tag ) {
846
-		$real_counts[ $key ] = $tag->count;
847
-		$counts[ $key ] = call_user_func( $args['topic_count_scale_callback'], $tag->count );
845
+	foreach ((array) $tags as $key => $tag) {
846
+		$real_counts[$key] = $tag->count;
847
+		$counts[$key] = call_user_func($args['topic_count_scale_callback'], $tag->count);
848 848
 	}
849 849
 
850
-	$min_count = min( $counts );
851
-	$spread = max( $counts ) - $min_count;
852
-	if ( $spread <= 0 )
850
+	$min_count = min($counts);
851
+	$spread = max($counts) - $min_count;
852
+	if ($spread <= 0)
853 853
 		$spread = 1;
854 854
 	$font_spread = $args['largest'] - $args['smallest'];
855
-	if ( $font_spread < 0 )
855
+	if ($font_spread < 0)
856 856
 		$font_spread = 1;
857 857
 	$font_step = $font_spread / $spread;
858 858
 
@@ -868,22 +868,22 @@  discard block
 block discarded – undo
868 868
 	 * - when the tag count is displayed (for example when users check the checkbox in the
869 869
 	 *   Tag Cloud widget), regardless of the tags font size
870 870
 	 */
871
-	if ( $args['show_count'] || 0 !== $font_spread ) {
871
+	if ($args['show_count'] || 0 !== $font_spread) {
872 872
 		$aria_label = true;
873 873
 	}
874 874
 
875 875
 	// Assemble the data that will be used to generate the tag cloud markup.
876 876
 	$tags_data = array();
877
-	foreach ( $tags as $key => $tag ) {
878
-		$tag_id = isset( $tag->id ) ? $tag->id : $key;
877
+	foreach ($tags as $key => $tag) {
878
+		$tag_id = isset($tag->id) ? $tag->id : $key;
879 879
 
880
-		$count = $counts[ $key ];
881
-		$real_count = $real_counts[ $key ];
880
+		$count = $counts[$key];
881
+		$real_count = $real_counts[$key];
882 882
 
883
-		if ( $translate_nooped_plural ) {
884
-			$formatted_count = sprintf( translate_nooped_plural( $translate_nooped_plural, $real_count ), number_format_i18n( $real_count ) );
883
+		if ($translate_nooped_plural) {
884
+			$formatted_count = sprintf(translate_nooped_plural($translate_nooped_plural, $real_count), number_format_i18n($real_count));
885 885
 		} else {
886
-			$formatted_count = call_user_func( $args['topic_count_text_callback'], $real_count, $tag, $args );
886
+			$formatted_count = call_user_func($args['topic_count_text_callback'], $real_count, $tag, $args);
887 887
 		}
888 888
 
889 889
 		$tags_data[] = array(
@@ -894,10 +894,10 @@  discard block
 block discarded – undo
894 894
 			'formatted_count' => $formatted_count,
895 895
 			'slug'            => $tag->slug,
896 896
 			'real_count'      => $real_count,
897
-			'class'           => 'tag-cloud-link tag-link-' . $tag_id,
898
-			'font_size'       => $args['smallest'] + ( $count - $min_count ) * $font_step,
899
-			'aria_label'      => $aria_label ? sprintf( ' aria-label="%1$s (%2$s)"', esc_attr( $tag->name ), esc_attr( $formatted_count ) ) : '',
900
-			'show_count'      => $args['show_count'] ? '<span class="tag-link-count"> (' . $real_count . ')</span>' : '',
897
+			'class'           => 'tag-cloud-link tag-link-'.$tag_id,
898
+			'font_size'       => $args['smallest'] + ($count - $min_count) * $font_step,
899
+			'aria_label'      => $aria_label ? sprintf(' aria-label="%1$s (%2$s)"', esc_attr($tag->name), esc_attr($formatted_count)) : '',
900
+			'show_count'      => $args['show_count'] ? '<span class="tag-link-count"> ('.$real_count.')</span>' : '',
901 901
 		);
902 902
 	}
903 903
 
@@ -908,28 +908,28 @@  discard block
 block discarded – undo
908 908
 	 *
909 909
 	 * @param array $tags_data An array of term data for term used to generate the tag cloud.
910 910
 	 */
911
-	$tags_data = apply_filters( 'wp_generate_tag_cloud_data', $tags_data );
911
+	$tags_data = apply_filters('wp_generate_tag_cloud_data', $tags_data);
912 912
 
913 913
 	$a = array();
914 914
 
915 915
 	// Generate the output links array.
916
-	foreach ( $tags_data as $key => $tag_data ) {
917
-		$class = $tag_data['class'] . ' tag-link-position-' . ( $key + 1 );
916
+	foreach ($tags_data as $key => $tag_data) {
917
+		$class = $tag_data['class'].' tag-link-position-'.($key + 1);
918 918
 		$a[] = sprintf(
919 919
 			'<a href="%1$s"%2$s class="%3$s" style="font-size: %4$s;"%5$s>%6$s%7$s</a>',
920
-			esc_url( $tag_data['url'] ),
920
+			esc_url($tag_data['url']),
921 921
 			$tag_data['role'],
922
-			esc_attr( $class ),
923
-			esc_attr( str_replace( ',', '.', $tag_data['font_size'] ) . $args['unit'] ),
922
+			esc_attr($class),
923
+			esc_attr(str_replace(',', '.', $tag_data['font_size']).$args['unit']),
924 924
 			$tag_data['aria_label'],
925
-			esc_html( $tag_data['name'] ),
925
+			esc_html($tag_data['name']),
926 926
 			$tag_data['show_count']
927 927
 		);
928 928
 	}
929 929
 
930
-	switch ( $args['format'] ) {
930
+	switch ($args['format']) {
931 931
 		case 'array' :
932
-			$return =& $a;
932
+			$return = & $a;
933 933
 			break;
934 934
 		case 'list' :
935 935
 			/*
@@ -938,15 +938,15 @@  discard block
 block discarded – undo
938 938
 			 * Note: this is redundant but doesn't harm.
939 939
 			 */
940 940
 			$return = "<ul class='wp-tag-cloud' role='list'>\n\t<li>";
941
-			$return .= join( "</li>\n\t<li>", $a );
941
+			$return .= join("</li>\n\t<li>", $a);
942 942
 			$return .= "</li>\n</ul>\n";
943 943
 			break;
944 944
 		default :
945
-			$return = join( $args['separator'], $a );
945
+			$return = join($args['separator'], $a);
946 946
 			break;
947 947
 	}
948 948
 
949
-	if ( $args['filter'] ) {
949
+	if ($args['filter']) {
950 950
 		/**
951 951
 		 * Filters the generated output of a tag cloud.
952 952
 		 *
@@ -963,7 +963,7 @@  discard block
 block discarded – undo
963 963
 		 * @param array        $tags   An array of terms used in the tag cloud.
964 964
 		 * @param array        $args   An array of wp_generate_tag_cloud() arguments.
965 965
 		 */
966
-		return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
966
+		return apply_filters('wp_generate_tag_cloud', $return, $tags, $args);
967 967
 	}
968 968
 
969 969
 	else
@@ -983,8 +983,8 @@  discard block
 block discarded – undo
983 983
  * @return int Negative number if `$a->name` is less than `$b->name`, zero if they are equal,
984 984
  *             or greater than zero if `$a->name` is greater than `$b->name`.
985 985
  */
986
-function _wp_object_name_sort_cb( $a, $b ) {
987
-	return strnatcasecmp( $a->name, $b->name );
986
+function _wp_object_name_sort_cb($a, $b) {
987
+	return strnatcasecmp($a->name, $b->name);
988 988
 }
989 989
 
990 990
 /**
@@ -999,8 +999,8 @@  discard block
 block discarded – undo
999 999
  * @param object $b The second object to compare.
1000 1000
  * @return bool Whether the count value for `$a` is greater than the count value for `$b`.
1001 1001
  */
1002
-function _wp_object_count_sort_cb( $a, $b ) {
1003
-	return ( $a->count > $b->count );
1002
+function _wp_object_count_sort_cb($a, $b) {
1003
+	return ($a->count > $b->count);
1004 1004
 }
1005 1005
 
1006 1006
 //
@@ -1018,12 +1018,12 @@  discard block
 block discarded – undo
1018 1018
 function walk_category_tree() {
1019 1019
 	$args = func_get_args();
1020 1020
 	// the user's options are the third parameter
1021
-	if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
1021
+	if (empty($args[2]['walker']) || ! ($args[2]['walker'] instanceof Walker)) {
1022 1022
 		$walker = new Walker_Category;
1023 1023
 	} else {
1024 1024
 		$walker = $args[2]['walker'];
1025 1025
 	}
1026
-	return call_user_func_array( array( $walker, 'walk' ), $args );
1026
+	return call_user_func_array(array($walker, 'walk'), $args);
1027 1027
 }
1028 1028
 
1029 1029
 /**
@@ -1037,12 +1037,12 @@  discard block
 block discarded – undo
1037 1037
 function walk_category_dropdown_tree() {
1038 1038
 	$args = func_get_args();
1039 1039
 	// the user's options are the third parameter
1040
-	if ( empty( $args[2]['walker'] ) || ! ( $args[2]['walker'] instanceof Walker ) ) {
1040
+	if (empty($args[2]['walker']) || ! ($args[2]['walker'] instanceof Walker)) {
1041 1041
 		$walker = new Walker_CategoryDropdown;
1042 1042
 	} else {
1043 1043
 		$walker = $args[2]['walker'];
1044 1044
 	}
1045
-	return call_user_func_array( array( $walker, 'walk' ), $args );
1045
+	return call_user_func_array(array($walker, 'walk'), $args);
1046 1046
 }
1047 1047
 
1048 1048
 //
@@ -1058,13 +1058,13 @@  discard block
 block discarded – undo
1058 1058
  * @param int|object $tag Tag ID or object.
1059 1059
  * @return string Link on success, empty string if tag does not exist.
1060 1060
  */
1061
-function get_tag_link( $tag ) {
1062
-	if ( ! is_object( $tag ) )
1061
+function get_tag_link($tag) {
1062
+	if ( ! is_object($tag))
1063 1063
 		$tag = (int) $tag;
1064 1064
 
1065
-	$tag = get_term_link( $tag, 'post_tag' );
1065
+	$tag = get_term_link($tag, 'post_tag');
1066 1066
 
1067
-	if ( is_wp_error( $tag ) )
1067
+	if (is_wp_error($tag))
1068 1068
 		return '';
1069 1069
 
1070 1070
 	return $tag;
@@ -1078,7 +1078,7 @@  discard block
 block discarded – undo
1078 1078
  * @param int $id Post ID.
1079 1079
  * @return array|false|WP_Error Array of tag objects on success, false on failure.
1080 1080
  */
1081
-function get_the_tags( $id = 0 ) {
1081
+function get_the_tags($id = 0) {
1082 1082
 
1083 1083
 	/**
1084 1084
 	 * Filters the array of tags for the given post.
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 	 *
1090 1090
 	 * @param array $terms An array of tags for the given post.
1091 1091
 	 */
1092
-	return apply_filters( 'get_the_tags', get_the_terms( $id, 'post_tag' ) );
1092
+	return apply_filters('get_the_tags', get_the_terms($id, 'post_tag'));
1093 1093
 }
1094 1094
 
1095 1095
 /**
@@ -1103,7 +1103,7 @@  discard block
 block discarded – undo
1103 1103
  * @param int $id Optional. Post ID. Defaults to the current post.
1104 1104
  * @return string|false|WP_Error A list of tags on success, false if there are no terms, WP_Error on failure.
1105 1105
  */
1106
-function get_the_tag_list( $before = '', $sep = '', $after = '', $id = 0 ) {
1106
+function get_the_tag_list($before = '', $sep = '', $after = '', $id = 0) {
1107 1107
 
1108 1108
 	/**
1109 1109
 	 * Filters the tags list for a given post.
@@ -1116,7 +1116,7 @@  discard block
 block discarded – undo
1116 1116
 	 * @param string $after    String to use after tags.
1117 1117
 	 * @param int    $id       Post ID.
1118 1118
 	 */
1119
-	return apply_filters( 'the_tags', get_the_term_list( $id, 'post_tag', $before, $sep, $after ), $before, $sep, $after, $id );
1119
+	return apply_filters('the_tags', get_the_term_list($id, 'post_tag', $before, $sep, $after), $before, $sep, $after, $id);
1120 1120
 }
1121 1121
 
1122 1122
 /**
@@ -1128,13 +1128,13 @@  discard block
 block discarded – undo
1128 1128
  * @param string $sep Optional. Separate items using this.
1129 1129
  * @param string $after Optional. After list.
1130 1130
  */
1131
-function the_tags( $before = null, $sep = ', ', $after = '' ) {
1132
-	if ( null === $before )
1131
+function the_tags($before = null, $sep = ', ', $after = '') {
1132
+	if (null === $before)
1133 1133
 		$before = __('Tags: ');
1134 1134
 
1135
-	$the_tags = get_the_tag_list( $before, $sep, $after );
1135
+	$the_tags = get_the_tag_list($before, $sep, $after);
1136 1136
 
1137
-	if ( ! is_wp_error( $the_tags ) ) {
1137
+	if ( ! is_wp_error($the_tags)) {
1138 1138
 		echo $the_tags;
1139 1139
 	}
1140 1140
 }
@@ -1147,8 +1147,8 @@  discard block
 block discarded – undo
1147 1147
  * @param int $tag Optional. Tag ID. Will use global tag ID by default.
1148 1148
  * @return string Tag description, available.
1149 1149
  */
1150
-function tag_description( $tag = 0 ) {
1151
-	return term_description( $tag );
1150
+function tag_description($tag = 0) {
1151
+	return term_description($tag);
1152 1152
 }
1153 1153
 
1154 1154
 /**
@@ -1160,16 +1160,16 @@  discard block
 block discarded – undo
1160 1160
  * @param string $taxonomy Optional taxonomy name. Defaults to 'post_tag'.
1161 1161
  * @return string Term description, available.
1162 1162
  */
1163
-function term_description( $term = 0, $taxonomy = 'post_tag' ) {
1164
-	if ( ! $term && ( is_tax() || is_tag() || is_category() ) ) {
1163
+function term_description($term = 0, $taxonomy = 'post_tag') {
1164
+	if ( ! $term && (is_tax() || is_tag() || is_category())) {
1165 1165
 		$term = get_queried_object();
1166
-		if ( $term ) {
1166
+		if ($term) {
1167 1167
 			$taxonomy = $term->taxonomy;
1168 1168
 			$term = $term->term_id;
1169 1169
 		}
1170 1170
 	}
1171
-	$description = get_term_field( 'description', $term, $taxonomy );
1172
-	return is_wp_error( $description ) ? '' : $description;
1171
+	$description = get_term_field('description', $term, $taxonomy);
1172
+	return is_wp_error($description) ? '' : $description;
1173 1173
 }
1174 1174
 
1175 1175
 /**
@@ -1182,16 +1182,16 @@  discard block
 block discarded – undo
1182 1182
  * @return array|false|WP_Error Array of WP_Term objects on success, false if there are no terms
1183 1183
  *                              or the post does not exist, WP_Error on failure.
1184 1184
  */
1185
-function get_the_terms( $post, $taxonomy ) {
1186
-	if ( ! $post = get_post( $post ) )
1185
+function get_the_terms($post, $taxonomy) {
1186
+	if ( ! $post = get_post($post))
1187 1187
 		return false;
1188 1188
 
1189
-	$terms = get_object_term_cache( $post->ID, $taxonomy );
1190
-	if ( false === $terms ) {
1191
-		$terms = wp_get_object_terms( $post->ID, $taxonomy );
1192
-		if ( ! is_wp_error( $terms ) ) {
1193
-			$term_ids = wp_list_pluck( $terms, 'term_id' );
1194
-			wp_cache_add( $post->ID, $term_ids, $taxonomy . '_relationships' );
1189
+	$terms = get_object_term_cache($post->ID, $taxonomy);
1190
+	if (false === $terms) {
1191
+		$terms = wp_get_object_terms($post->ID, $taxonomy);
1192
+		if ( ! is_wp_error($terms)) {
1193
+			$term_ids = wp_list_pluck($terms, 'term_id');
1194
+			wp_cache_add($post->ID, $term_ids, $taxonomy.'_relationships');
1195 1195
 		}
1196 1196
 	}
1197 1197
 
@@ -1204,9 +1204,9 @@  discard block
 block discarded – undo
1204 1204
 	 * @param int            $post_id  Post ID.
1205 1205
 	 * @param string         $taxonomy Name of the taxonomy.
1206 1206
 	 */
1207
-	$terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
1207
+	$terms = apply_filters('get_the_terms', $terms, $post->ID, $taxonomy);
1208 1208
 
1209
-	if ( empty( $terms ) )
1209
+	if (empty($terms))
1210 1210
 		return false;
1211 1211
 
1212 1212
 	return $terms;
@@ -1224,23 +1224,23 @@  discard block
 block discarded – undo
1224 1224
  * @param string $after Optional. After list.
1225 1225
  * @return string|false|WP_Error A list of terms on success, false if there are no terms, WP_Error on failure.
1226 1226
  */
1227
-function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
1228
-	$terms = get_the_terms( $id, $taxonomy );
1227
+function get_the_term_list($id, $taxonomy, $before = '', $sep = '', $after = '') {
1228
+	$terms = get_the_terms($id, $taxonomy);
1229 1229
 
1230
-	if ( is_wp_error( $terms ) )
1230
+	if (is_wp_error($terms))
1231 1231
 		return $terms;
1232 1232
 
1233
-	if ( empty( $terms ) )
1233
+	if (empty($terms))
1234 1234
 		return false;
1235 1235
 
1236 1236
 	$links = array();
1237 1237
 
1238
-	foreach ( $terms as $term ) {
1239
-		$link = get_term_link( $term, $taxonomy );
1240
-		if ( is_wp_error( $link ) ) {
1238
+	foreach ($terms as $term) {
1239
+		$link = get_term_link($term, $taxonomy);
1240
+		if (is_wp_error($link)) {
1241 1241
 			return $link;
1242 1242
 		}
1243
-		$links[] = '<a href="' . esc_url( $link ) . '" rel="tag">' . $term->name . '</a>';
1243
+		$links[] = '<a href="'.esc_url($link).'" rel="tag">'.$term->name.'</a>';
1244 1244
 	}
1245 1245
 
1246 1246
 	/**
@@ -1253,9 +1253,9 @@  discard block
 block discarded – undo
1253 1253
 	 *
1254 1254
 	 * @param array $links An array of term links.
1255 1255
 	 */
1256
-	$term_links = apply_filters( "term_links-{$taxonomy}", $links );
1256
+	$term_links = apply_filters("term_links-{$taxonomy}", $links);
1257 1257
 
1258
-	return $before . join( $sep, $term_links ) . $after;
1258
+	return $before.join($sep, $term_links).$after;
1259 1259
 }
1260 1260
 
1261 1261
 /**
@@ -1276,15 +1276,15 @@  discard block
 block discarded – undo
1276 1276
  * }
1277 1277
  * @return string|WP_Error A list of term parents on success, WP_Error or empty string on failure.
1278 1278
  */
1279
-function get_term_parents_list( $term_id, $taxonomy, $args = array() ) {
1279
+function get_term_parents_list($term_id, $taxonomy, $args = array()) {
1280 1280
 	$list = '';
1281
-	$term = get_term( $term_id, $taxonomy );
1281
+	$term = get_term($term_id, $taxonomy);
1282 1282
 
1283
-	if ( is_wp_error( $term ) ) {
1283
+	if (is_wp_error($term)) {
1284 1284
 		return $term;
1285 1285
 	}
1286 1286
 
1287
-	if ( ! $term ) {
1287
+	if ( ! $term) {
1288 1288
 		return $list;
1289 1289
 	}
1290 1290
 
@@ -1297,26 +1297,26 @@  discard block
 block discarded – undo
1297 1297
 		'inclusive' => true,
1298 1298
 	);
1299 1299
 
1300
-	$args = wp_parse_args( $args, $defaults );
1300
+	$args = wp_parse_args($args, $defaults);
1301 1301
 
1302
-	foreach ( array( 'link', 'inclusive' ) as $bool ) {
1303
-		$args[ $bool ] = wp_validate_boolean( $args[ $bool ] );
1302
+	foreach (array('link', 'inclusive') as $bool) {
1303
+		$args[$bool] = wp_validate_boolean($args[$bool]);
1304 1304
 	}
1305 1305
 
1306
-	$parents = get_ancestors( $term_id, $taxonomy, 'taxonomy' );
1306
+	$parents = get_ancestors($term_id, $taxonomy, 'taxonomy');
1307 1307
 
1308
-	if ( $args['inclusive'] ) {
1309
-		array_unshift( $parents, $term_id );
1308
+	if ($args['inclusive']) {
1309
+		array_unshift($parents, $term_id);
1310 1310
 	}
1311 1311
 
1312
-	foreach ( array_reverse( $parents ) as $term_id ) {
1313
-		$parent = get_term( $term_id, $taxonomy );
1314
-		$name   = ( 'slug' === $args['format'] ) ? $parent->slug : $parent->name;
1312
+	foreach (array_reverse($parents) as $term_id) {
1313
+		$parent = get_term($term_id, $taxonomy);
1314
+		$name   = ('slug' === $args['format']) ? $parent->slug : $parent->name;
1315 1315
 
1316
-		if ( $args['link'] ) {
1317
-			$list .= '<a href="' . esc_url( get_term_link( $parent->term_id, $taxonomy ) ) . '">' . $name . '</a>' . $args['separator'];
1316
+		if ($args['link']) {
1317
+			$list .= '<a href="'.esc_url(get_term_link($parent->term_id, $taxonomy)).'">'.$name.'</a>'.$args['separator'];
1318 1318
 		} else {
1319
-			$list .= $name . $args['separator'];
1319
+			$list .= $name.$args['separator'];
1320 1320
 		}
1321 1321
 	}
1322 1322
 
@@ -1335,10 +1335,10 @@  discard block
 block discarded – undo
1335 1335
  * @param string $after Optional. After list.
1336 1336
  * @return false|void False on WordPress error.
1337 1337
  */
1338
-function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
1339
-	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
1338
+function the_terms($id, $taxonomy, $before = '', $sep = ', ', $after = '') {
1339
+	$term_list = get_the_term_list($id, $taxonomy, $before, $sep, $after);
1340 1340
 
1341
-	if ( is_wp_error( $term_list ) )
1341
+	if (is_wp_error($term_list))
1342 1342
 		return false;
1343 1343
 
1344 1344
 	/**
@@ -1352,7 +1352,7 @@  discard block
 block discarded – undo
1352 1352
 	 * @param string $sep       String to use between the terms.
1353 1353
 	 * @param string $after     String to use after the terms.
1354 1354
 	 */
1355
-	echo apply_filters( 'the_terms', $term_list, $taxonomy, $before, $sep, $after );
1355
+	echo apply_filters('the_terms', $term_list, $taxonomy, $before, $sep, $after);
1356 1356
 }
1357 1357
 
1358 1358
 /**
@@ -1364,8 +1364,8 @@  discard block
 block discarded – undo
1364 1364
  * @param int|object $post Optional. Post to check instead of the current post.
1365 1365
  * @return bool True if the current post has any of the given categories (or any category, if no category specified).
1366 1366
  */
1367
-function has_category( $category = '', $post = null ) {
1368
-	return has_term( $category, 'category', $post );
1367
+function has_category($category = '', $post = null) {
1368
+	return has_term($category, 'category', $post);
1369 1369
 }
1370 1370
 
1371 1371
 /**
@@ -1385,8 +1385,8 @@  discard block
 block discarded – undo
1385 1385
  * @param int|object $post Optional. Post to check instead of the current post. (since 2.7.0)
1386 1386
  * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
1387 1387
  */
1388
-function has_tag( $tag = '', $post = null ) {
1389
-	return has_term( $tag, 'post_tag', $post );
1388
+function has_tag($tag = '', $post = null) {
1389
+	return has_term($tag, 'post_tag', $post);
1390 1390
 }
1391 1391
 
1392 1392
 /**
@@ -1403,14 +1403,14 @@  discard block
 block discarded – undo
1403 1403
  * @param int|object $post Optional. Post to check instead of the current post.
1404 1404
  * @return bool True if the current post has any of the given tags (or any tag, if no tag specified).
1405 1405
  */
1406
-function has_term( $term = '', $taxonomy = '', $post = null ) {
1406
+function has_term($term = '', $taxonomy = '', $post = null) {
1407 1407
 	$post = get_post($post);
1408 1408
 
1409
-	if ( !$post )
1409
+	if ( ! $post)
1410 1410
 		return false;
1411 1411
 
1412
-	$r = is_object_in_term( $post->ID, $taxonomy, $term );
1413
-	if ( is_wp_error( $r ) )
1412
+	$r = is_object_in_term($post->ID, $taxonomy, $term);
1413
+	if (is_wp_error($r))
1414 1414
 		return false;
1415 1415
 
1416 1416
 	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
 }
@@ -157,14 +161,16 @@  discard block
 block discarded – undo
157 161
 			$thelist .= "\n\t<li>";
158 162
 			switch ( strtolower( $parents ) ) {
159 163
 				case 'multiple':
160
-					if ( $category->parent )
161
-						$thelist .= get_category_parents( $category->parent, true, $separator );
164
+					if ( $category->parent ) {
165
+											$thelist .= get_category_parents( $category->parent, true, $separator );
166
+					}
162 167
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a></li>';
163 168
 					break;
164 169
 				case 'single':
165 170
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '"  ' . $rel . '>';
166
-					if ( $category->parent )
167
-						$thelist .= get_category_parents( $category->parent, false, $separator );
171
+					if ( $category->parent ) {
172
+											$thelist .= get_category_parents( $category->parent, false, $separator );
173
+					}
168 174
 					$thelist .= $category->name.'</a></li>';
169 175
 					break;
170 176
 				case '':
@@ -176,18 +182,21 @@  discard block
 block discarded – undo
176 182
 	} else {
177 183
 		$i = 0;
178 184
 		foreach ( $categories as $category ) {
179
-			if ( 0 < $i )
180
-				$thelist .= $separator;
185
+			if ( 0 < $i ) {
186
+							$thelist .= $separator;
187
+			}
181 188
 			switch ( strtolower( $parents ) ) {
182 189
 				case 'multiple':
183
-					if ( $category->parent )
184
-						$thelist .= get_category_parents( $category->parent, true, $separator );
190
+					if ( $category->parent ) {
191
+											$thelist .= get_category_parents( $category->parent, true, $separator );
192
+					}
185 193
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>' . $category->name.'</a>';
186 194
 					break;
187 195
 				case 'single':
188 196
 					$thelist .= '<a href="' . esc_url( get_category_link( $category->term_id ) ) . '" ' . $rel . '>';
189
-					if ( $category->parent )
190
-						$thelist .= get_category_parents( $category->parent, false, $separator );
197
+					if ( $category->parent ) {
198
+											$thelist .= get_category_parents( $category->parent, false, $separator );
199
+					}
191 200
 					$thelist .= "$category->name</a>";
192 201
 					break;
193 202
 				case '':
@@ -230,8 +239,9 @@  discard block
 block discarded – undo
230 239
  * @return bool True if the current post is in any of the given categories.
231 240
  */
232 241
 function in_category( $category, $post = null ) {
233
-	if ( empty( $category ) )
234
-		return false;
242
+	if ( empty( $category ) ) {
243
+			return false;
244
+	}
235 245
 
236 246
 	return has_category( $category, $post );
237 247
 }
@@ -516,8 +526,9 @@  discard block
 block discarded – undo
516 526
 
517 527
 	$r = wp_parse_args( $args, $defaults );
518 528
 
519
-	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] )
520
-		$r['pad_counts'] = true;
529
+	if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) {
530
+			$r['pad_counts'] = true;
531
+	}
521 532
 
522 533
 	// Descendants of exclusions should be excluded too.
523 534
 	if ( true == $r['hierarchical'] ) {
@@ -535,8 +546,9 @@  discard block
 block discarded – undo
535 546
 		$r['exclude'] = '';
536 547
 	}
537 548
 
538
-	if ( ! isset( $r['class'] ) )
539
-		$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
549
+	if ( ! isset( $r['class'] ) ) {
550
+			$r['class'] = ( 'category' == $r['taxonomy'] ) ? 'categories' : $r['taxonomy'];
551
+	}
540 552
 
541 553
 	if ( ! taxonomy_exists( $r['taxonomy'] ) ) {
542 554
 		return false;
@@ -677,16 +689,19 @@  discard block
 block discarded – undo
677 689
 
678 690
 	$tags = get_terms( $args['taxonomy'], array_merge( $args, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
679 691
 
680
-	if ( empty( $tags ) || is_wp_error( $tags ) )
681
-		return;
692
+	if ( empty( $tags ) || is_wp_error( $tags ) ) {
693
+			return;
694
+	}
682 695
 
683 696
 	foreach ( $tags as $key => $tag ) {
684
-		if ( 'edit' == $args['link'] )
685
-			$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
686
-		else
687
-			$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
688
-		if ( is_wp_error( $link ) )
689
-			return;
697
+		if ( 'edit' == $args['link'] ) {
698
+					$link = get_edit_term_link( $tag->term_id, $tag->taxonomy, $args['post_type'] );
699
+		} else {
700
+					$link = get_term_link( intval($tag->term_id), $tag->taxonomy );
701
+		}
702
+		if ( is_wp_error( $link ) ) {
703
+					return;
704
+		}
690 705
 
691 706
 		$tags[ $key ]->link = $link;
692 707
 		$tags[ $key ]->id = $tag->term_id;
@@ -704,8 +719,9 @@  discard block
 block discarded – undo
704 719
 	 */
705 720
 	$return = apply_filters( 'wp_tag_cloud', $return, $args );
706 721
 
707
-	if ( 'array' == $args['format'] || empty($args['echo']) )
708
-		return $return;
722
+	if ( 'array' == $args['format'] || empty($args['echo']) ) {
723
+			return $return;
724
+	}
709 725
 
710 726
 	echo $return;
711 727
 }
@@ -837,8 +853,9 @@  discard block
 block discarded – undo
837 853
 		}
838 854
 	}
839 855
 
840
-	if ( $args['number'] > 0 )
841
-		$tags = array_slice( $tags, 0, $args['number'] );
856
+	if ( $args['number'] > 0 ) {
857
+			$tags = array_slice( $tags, 0, $args['number'] );
858
+	}
842 859
 
843 860
 	$counts = array();
844 861
 	$real_counts = array(); // For the alt tag
@@ -849,11 +866,13 @@  discard block
 block discarded – undo
849 866
 
850 867
 	$min_count = min( $counts );
851 868
 	$spread = max( $counts ) - $min_count;
852
-	if ( $spread <= 0 )
853
-		$spread = 1;
869
+	if ( $spread <= 0 ) {
870
+			$spread = 1;
871
+	}
854 872
 	$font_spread = $args['largest'] - $args['smallest'];
855
-	if ( $font_spread < 0 )
856
-		$font_spread = 1;
873
+	if ( $font_spread < 0 ) {
874
+			$font_spread = 1;
875
+	}
857 876
 	$font_step = $font_spread / $spread;
858 877
 
859 878
 	$aria_label = false;
@@ -964,11 +983,10 @@  discard block
 block discarded – undo
964 983
 		 * @param array        $args   An array of wp_generate_tag_cloud() arguments.
965 984
 		 */
966 985
 		return apply_filters( 'wp_generate_tag_cloud', $return, $tags, $args );
986
+	} else {
987
+			return $return;
988
+	}
967 989
 	}
968
-
969
-	else
970
-		return $return;
971
-}
972 990
 
973 991
 /**
974 992
  * Serves as a callback for comparing objects based on name.
@@ -1059,13 +1077,15 @@  discard block
 block discarded – undo
1059 1077
  * @return string Link on success, empty string if tag does not exist.
1060 1078
  */
1061 1079
 function get_tag_link( $tag ) {
1062
-	if ( ! is_object( $tag ) )
1063
-		$tag = (int) $tag;
1080
+	if ( ! is_object( $tag ) ) {
1081
+			$tag = (int) $tag;
1082
+	}
1064 1083
 
1065 1084
 	$tag = get_term_link( $tag, 'post_tag' );
1066 1085
 
1067
-	if ( is_wp_error( $tag ) )
1068
-		return '';
1086
+	if ( is_wp_error( $tag ) ) {
1087
+			return '';
1088
+	}
1069 1089
 
1070 1090
 	return $tag;
1071 1091
 }
@@ -1129,8 +1149,9 @@  discard block
 block discarded – undo
1129 1149
  * @param string $after Optional. After list.
1130 1150
  */
1131 1151
 function the_tags( $before = null, $sep = ', ', $after = '' ) {
1132
-	if ( null === $before )
1133
-		$before = __('Tags: ');
1152
+	if ( null === $before ) {
1153
+			$before = __('Tags: ');
1154
+	}
1134 1155
 
1135 1156
 	$the_tags = get_the_tag_list( $before, $sep, $after );
1136 1157
 
@@ -1183,8 +1204,9 @@  discard block
 block discarded – undo
1183 1204
  *                              or the post does not exist, WP_Error on failure.
1184 1205
  */
1185 1206
 function get_the_terms( $post, $taxonomy ) {
1186
-	if ( ! $post = get_post( $post ) )
1187
-		return false;
1207
+	if ( ! $post = get_post( $post ) ) {
1208
+			return false;
1209
+	}
1188 1210
 
1189 1211
 	$terms = get_object_term_cache( $post->ID, $taxonomy );
1190 1212
 	if ( false === $terms ) {
@@ -1206,8 +1228,9 @@  discard block
 block discarded – undo
1206 1228
 	 */
1207 1229
 	$terms = apply_filters( 'get_the_terms', $terms, $post->ID, $taxonomy );
1208 1230
 
1209
-	if ( empty( $terms ) )
1210
-		return false;
1231
+	if ( empty( $terms ) ) {
1232
+			return false;
1233
+	}
1211 1234
 
1212 1235
 	return $terms;
1213 1236
 }
@@ -1227,11 +1250,13 @@  discard block
 block discarded – undo
1227 1250
 function get_the_term_list( $id, $taxonomy, $before = '', $sep = '', $after = '' ) {
1228 1251
 	$terms = get_the_terms( $id, $taxonomy );
1229 1252
 
1230
-	if ( is_wp_error( $terms ) )
1231
-		return $terms;
1253
+	if ( is_wp_error( $terms ) ) {
1254
+			return $terms;
1255
+	}
1232 1256
 
1233
-	if ( empty( $terms ) )
1234
-		return false;
1257
+	if ( empty( $terms ) ) {
1258
+			return false;
1259
+	}
1235 1260
 
1236 1261
 	$links = array();
1237 1262
 
@@ -1338,8 +1363,9 @@  discard block
 block discarded – undo
1338 1363
 function the_terms( $id, $taxonomy, $before = '', $sep = ', ', $after = '' ) {
1339 1364
 	$term_list = get_the_term_list( $id, $taxonomy, $before, $sep, $after );
1340 1365
 
1341
-	if ( is_wp_error( $term_list ) )
1342
-		return false;
1366
+	if ( is_wp_error( $term_list ) ) {
1367
+			return false;
1368
+	}
1343 1369
 
1344 1370
 	/**
1345 1371
 	 * Filters the list of terms to display.
@@ -1406,12 +1432,14 @@  discard block
 block discarded – undo
1406 1432
 function has_term( $term = '', $taxonomy = '', $post = null ) {
1407 1433
 	$post = get_post($post);
1408 1434
 
1409
-	if ( !$post )
1410
-		return false;
1435
+	if ( !$post ) {
1436
+			return false;
1437
+	}
1411 1438
 
1412 1439
 	$r = is_object_in_term( $post->ID, $taxonomy, $term );
1413
-	if ( is_wp_error( $r ) )
1414
-		return false;
1440
+	if ( is_wp_error( $r ) ) {
1441
+			return false;
1442
+	}
1415 1443
 
1416 1444
 	return $r;
1417 1445
 }
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.
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.
Spacing   +1142 added lines, -1142 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
 
@@ -469,21 +469,21 @@  discard block
 block discarded – undo
469 469
 		global $pagenow;
470 470
 
471 471
 		// Check permissions for customize.php access since this method is called before customize.php can run any code,
472
-		if ( 'customize.php' === $pagenow && ! current_user_can( 'customize' ) ) {
473
-			if ( ! is_user_logged_in() ) {
472
+		if ('customize.php' === $pagenow && ! current_user_can('customize')) {
473
+			if ( ! is_user_logged_in()) {
474 474
 				auth_redirect();
475 475
 			} else {
476 476
 				wp_die(
477
-					'<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
478
-					'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
477
+					'<h1>'.__('Cheatin&#8217; uh?').'</h1>'.
478
+					'<p>'.__('Sorry, you are not allowed to customize this site.').'</p>',
479 479
 					403
480 480
 				);
481 481
 			}
482 482
 			return;
483 483
 		}
484 484
 
485
-		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 ) ) {
486
-			$this->wp_die( -1, __( 'Invalid changeset UUID' ) );
485
+		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)) {
486
+			$this->wp_die( -1, __('Invalid changeset UUID') );
487 487
 		}
488 488
 
489 489
 		/*
@@ -493,15 +493,15 @@  discard block
 block discarded – undo
493 493
 		 * a user when a valid nonce isn't present.
494 494
 		 */
495 495
 		$has_post_data_nonce = (
496
-			check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'nonce', false )
496
+			check_ajax_referer('preview-customize_'.$this->get_stylesheet(), 'nonce', false)
497 497
 			||
498
-			check_ajax_referer( 'save-customize_' . $this->get_stylesheet(), 'nonce', false )
498
+			check_ajax_referer('save-customize_'.$this->get_stylesheet(), 'nonce', false)
499 499
 			||
500
-			check_ajax_referer( 'preview-customize_' . $this->get_stylesheet(), 'customize_preview_nonce', false )
500
+			check_ajax_referer('preview-customize_'.$this->get_stylesheet(), 'customize_preview_nonce', false)
501 501
 		);
502
-		if ( ! current_user_can( 'customize' ) || ! $has_post_data_nonce ) {
503
-			unset( $_POST['customized'] );
504
-			unset( $_REQUEST['customized'] );
502
+		if ( ! current_user_can('customize') || ! $has_post_data_nonce) {
503
+			unset($_POST['customized']);
504
+			unset($_REQUEST['customized']);
505 505
 		}
506 506
 
507 507
 		/*
@@ -509,37 +509,37 @@  discard block
 block discarded – undo
509 509
 		 * In this way, the UUID serves as a secret key. If the messenger channel is present,
510 510
 		 * then send unauthenticated code to prompt re-auth.
511 511
 		 */
512
-		if ( ! current_user_can( 'customize' ) && ! $this->changeset_post_id() ) {
513
-			$this->wp_die( $this->messenger_channel ? 0 : -1, __( 'Non-existent changeset UUID.' ) );
512
+		if ( ! current_user_can('customize') && ! $this->changeset_post_id()) {
513
+			$this->wp_die($this->messenger_channel ? 0 : -1, __('Non-existent changeset UUID.'));
514 514
 		}
515 515
 
516
-		if ( ! headers_sent() ) {
516
+		if ( ! headers_sent()) {
517 517
 			send_origin_headers();
518 518
 		}
519 519
 
520 520
 		// Hide the admin bar if we're embedded in the customizer iframe.
521
-		if ( $this->messenger_channel ) {
522
-			show_admin_bar( false );
521
+		if ($this->messenger_channel) {
522
+			show_admin_bar(false);
523 523
 		}
524 524
 
525
-		if ( $this->is_theme_active() ) {
525
+		if ($this->is_theme_active()) {
526 526
 			// Once the theme is loaded, we'll validate it.
527
-			add_action( 'after_setup_theme', array( $this, 'after_setup_theme' ) );
527
+			add_action('after_setup_theme', array($this, 'after_setup_theme'));
528 528
 		} else {
529 529
 			// If the requested theme is not the active theme and the user doesn't have the
530 530
 			// switch_themes cap, bail.
531
-			if ( ! current_user_can( 'switch_themes' ) ) {
532
-				$this->wp_die( -1, __( 'Sorry, you are not allowed to edit theme options on this site.' ) );
531
+			if ( ! current_user_can('switch_themes')) {
532
+				$this->wp_die( -1, __('Sorry, you are not allowed to edit theme options on this site.') );
533 533
 			}
534 534
 
535 535
 			// If the theme has errors while loading, bail.
536
-			if ( $this->theme()->errors() ) {
536
+			if ($this->theme()->errors()) {
537 537
 				$this->wp_die( -1, $this->theme()->errors()->get_error_message() );
538 538
 			}
539 539
 
540 540
 			// If the theme isn't allowed per multisite settings, bail.
541
-			if ( ! $this->theme()->is_allowed() ) {
542
-				$this->wp_die( -1, __( 'The requested theme does not exist.' ) );
541
+			if ( ! $this->theme()->is_allowed()) {
542
+				$this->wp_die( -1, __('The requested theme does not exist.') );
543 543
 			}
544 544
 		}
545 545
 
@@ -548,8 +548,8 @@  discard block
 block discarded – undo
548 548
 		 * Import starter content at after_setup_theme:100 so that any
549 549
 		 * add_theme_support( 'starter-content' ) calls will have been made.
550 550
 		 */
551
-		if ( get_option( 'fresh_site' ) && 'customize.php' === $pagenow ) {
552
-			add_action( 'after_setup_theme', array( $this, 'import_theme_starter_content' ), 100 );
551
+		if (get_option('fresh_site') && 'customize.php' === $pagenow) {
552
+			add_action('after_setup_theme', array($this, 'import_theme_starter_content'), 100);
553 553
 		}
554 554
 
555 555
 		$this->start_previewing_theme();
@@ -561,9 +561,9 @@  discard block
 block discarded – undo
561 561
 	 * @since 3.4.0
562 562
 	 */
563 563
 	public function after_setup_theme() {
564
-		$doing_ajax_or_is_customized = ( $this->doing_ajax() || isset( $_POST['customized'] ) );
565
-		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme() ) {
566
-			wp_redirect( 'themes.php?broken=true' );
564
+		$doing_ajax_or_is_customized = ($this->doing_ajax() || isset($_POST['customized']));
565
+		if ( ! $doing_ajax_or_is_customized && ! validate_current_theme()) {
566
+			wp_redirect('themes.php?broken=true');
567 567
 			exit;
568 568
 		}
569 569
 	}
@@ -576,24 +576,24 @@  discard block
 block discarded – undo
576 576
 	 */
577 577
 	public function start_previewing_theme() {
578 578
 		// Bail if we're already previewing.
579
-		if ( $this->is_preview() ) {
579
+		if ($this->is_preview()) {
580 580
 			return;
581 581
 		}
582 582
 
583 583
 		$this->previewing = true;
584 584
 
585
-		if ( ! $this->is_theme_active() ) {
586
-			add_filter( 'template', array( $this, 'get_template' ) );
587
-			add_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
588
-			add_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
585
+		if ( ! $this->is_theme_active()) {
586
+			add_filter('template', array($this, 'get_template'));
587
+			add_filter('stylesheet', array($this, 'get_stylesheet'));
588
+			add_filter('pre_option_current_theme', array($this, 'current_theme'));
589 589
 
590 590
 			// @link: https://core.trac.wordpress.org/ticket/20027
591
-			add_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
592
-			add_filter( 'pre_option_template', array( $this, 'get_template' ) );
591
+			add_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
592
+			add_filter('pre_option_template', array($this, 'get_template'));
593 593
 
594 594
 			// Handle custom theme roots.
595
-			add_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
596
-			add_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
595
+			add_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
596
+			add_filter('pre_option_template_root', array($this, 'get_template_root'));
597 597
 		}
598 598
 
599 599
 		/**
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		 *
604 604
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
605 605
 		 */
606
-		do_action( 'start_previewing_theme', $this );
606
+		do_action('start_previewing_theme', $this);
607 607
 	}
608 608
 
609 609
 	/**
@@ -614,24 +614,24 @@  discard block
 block discarded – undo
614 614
 	 * @since 3.4.0
615 615
 	 */
616 616
 	public function stop_previewing_theme() {
617
-		if ( ! $this->is_preview() ) {
617
+		if ( ! $this->is_preview()) {
618 618
 			return;
619 619
 		}
620 620
 
621 621
 		$this->previewing = false;
622 622
 
623
-		if ( ! $this->is_theme_active() ) {
624
-			remove_filter( 'template', array( $this, 'get_template' ) );
625
-			remove_filter( 'stylesheet', array( $this, 'get_stylesheet' ) );
626
-			remove_filter( 'pre_option_current_theme', array( $this, 'current_theme' ) );
623
+		if ( ! $this->is_theme_active()) {
624
+			remove_filter('template', array($this, 'get_template'));
625
+			remove_filter('stylesheet', array($this, 'get_stylesheet'));
626
+			remove_filter('pre_option_current_theme', array($this, 'current_theme'));
627 627
 
628 628
 			// @link: https://core.trac.wordpress.org/ticket/20027
629
-			remove_filter( 'pre_option_stylesheet', array( $this, 'get_stylesheet' ) );
630
-			remove_filter( 'pre_option_template', array( $this, 'get_template' ) );
629
+			remove_filter('pre_option_stylesheet', array($this, 'get_stylesheet'));
630
+			remove_filter('pre_option_template', array($this, 'get_template'));
631 631
 
632 632
 			// Handle custom theme roots.
633
-			remove_filter( 'pre_option_stylesheet_root', array( $this, 'get_stylesheet_root' ) );
634
-			remove_filter( 'pre_option_template_root', array( $this, 'get_template_root' ) );
633
+			remove_filter('pre_option_stylesheet_root', array($this, 'get_stylesheet_root'));
634
+			remove_filter('pre_option_template_root', array($this, 'get_template_root'));
635 635
 		}
636 636
 
637 637
 		/**
@@ -641,7 +641,7 @@  discard block
 block discarded – undo
641 641
 		 *
642 642
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
643 643
 		 */
644
-		do_action( 'stop_previewing_theme', $this );
644
+		do_action('stop_previewing_theme', $this);
645 645
 	}
646 646
 
647 647
 	/**
@@ -664,7 +664,7 @@  discard block
 block discarded – undo
664 664
 	 * @return WP_Theme
665 665
 	 */
666 666
 	public function theme() {
667
-		if ( ! $this->theme ) {
667
+		if ( ! $this->theme) {
668 668
 			$this->theme = wp_get_theme();
669 669
 		}
670 670
 		return $this->theme;
@@ -751,7 +751,7 @@  discard block
 block discarded – undo
751 751
 		 *
752 752
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
753 753
 		 */
754
-		do_action( 'customize_register', $this );
754
+		do_action('customize_register', $this);
755 755
 
756 756
 		/*
757 757
 		 * Note that settings must be previewed here even outside the customizer preview
@@ -761,13 +761,13 @@  discard block
 block discarded – undo
761 761
 		 * may short-circuit because it will detect that there are no changes to
762 762
 		 * make.
763 763
 		 */
764
-		if ( ! $this->doing_ajax( 'customize_save' ) ) {
765
-			foreach ( $this->settings as $setting ) {
764
+		if ( ! $this->doing_ajax('customize_save')) {
765
+			foreach ($this->settings as $setting) {
766 766
 				$setting->preview();
767 767
 			}
768 768
 		}
769 769
 
770
-		if ( $this->is_preview() && ! is_admin() ) {
770
+		if ($this->is_preview() && ! is_admin()) {
771 771
 			$this->customize_preview_init();
772 772
 		}
773 773
 	}
@@ -784,10 +784,10 @@  discard block
 block discarded – undo
784 784
 	 * @param int $status Status.
785 785
 	 * @return int
786 786
 	 */
787
-	public function wp_redirect_status( $status ) {
788
-		_deprecated_function( __FUNCTION__, '4.7.0' );
787
+	public function wp_redirect_status($status) {
788
+		_deprecated_function(__FUNCTION__, '4.7.0');
789 789
 
790
-		if ( $this->is_preview() && ! is_admin() ) {
790
+		if ($this->is_preview() && ! is_admin()) {
791 791
 			return 200;
792 792
 		}
793 793
 
@@ -803,14 +803,14 @@  discard block
 block discarded – undo
803 803
 	 * @param string $uuid Changeset UUID.
804 804
 	 * @return int|null Returns post ID on success and null on failure.
805 805
 	 */
806
-	public function find_changeset_post_id( $uuid ) {
806
+	public function find_changeset_post_id($uuid) {
807 807
 		$cache_group = 'customize_changeset_post';
808
-		$changeset_post_id = wp_cache_get( $uuid, $cache_group );
809
-		if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) {
808
+		$changeset_post_id = wp_cache_get($uuid, $cache_group);
809
+		if ($changeset_post_id && 'customize_changeset' === get_post_type($changeset_post_id)) {
810 810
 			return $changeset_post_id;
811 811
 		}
812 812
 
813
-		$changeset_post_query = new WP_Query( array(
813
+		$changeset_post_query = new WP_Query(array(
814 814
 			'post_type' => 'customize_changeset',
815 815
 			'post_status' => get_post_stati(),
816 816
 			'name' => $uuid,
@@ -820,11 +820,11 @@  discard block
 block discarded – undo
820 820
 			'update_post_meta_cache' => false,
821 821
 			'update_post_term_cache' => false,
822 822
 			'lazy_load_term_meta' => false,
823
-		) );
824
-		if ( ! empty( $changeset_post_query->posts ) ) {
823
+		));
824
+		if ( ! empty($changeset_post_query->posts)) {
825 825
 			// Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed.
826 826
 			$changeset_post_id = $changeset_post_query->posts[0]->ID;
827
-			wp_cache_set( $this->_changeset_uuid, $changeset_post_id, $cache_group );
827
+			wp_cache_set($this->_changeset_uuid, $changeset_post_id, $cache_group);
828 828
 			return $changeset_post_id;
829 829
 		}
830 830
 
@@ -840,14 +840,14 @@  discard block
 block discarded – undo
840 840
 	 * @return int|null Post ID on success or null if there is no post yet saved.
841 841
 	 */
842 842
 	public function changeset_post_id() {
843
-		if ( ! isset( $this->_changeset_post_id ) ) {
844
-			$post_id = $this->find_changeset_post_id( $this->_changeset_uuid );
845
-			if ( ! $post_id ) {
843
+		if ( ! isset($this->_changeset_post_id)) {
844
+			$post_id = $this->find_changeset_post_id($this->_changeset_uuid);
845
+			if ( ! $post_id) {
846 846
 				$post_id = false;
847 847
 			}
848 848
 			$this->_changeset_post_id = $post_id;
849 849
 		}
850
-		if ( false === $this->_changeset_post_id ) {
850
+		if (false === $this->_changeset_post_id) {
851 851
 			return null;
852 852
 		}
853 853
 		return $this->_changeset_post_id;
@@ -862,23 +862,23 @@  discard block
 block discarded – undo
862 862
 	 * @param int $post_id Changeset post ID.
863 863
 	 * @return array|WP_Error Changeset data or WP_Error on error.
864 864
 	 */
865
-	protected function get_changeset_post_data( $post_id ) {
866
-		if ( ! $post_id ) {
867
-			return new WP_Error( 'empty_post_id' );
865
+	protected function get_changeset_post_data($post_id) {
866
+		if ( ! $post_id) {
867
+			return new WP_Error('empty_post_id');
868 868
 		}
869
-		$changeset_post = get_post( $post_id );
870
-		if ( ! $changeset_post ) {
871
-			return new WP_Error( 'missing_post' );
869
+		$changeset_post = get_post($post_id);
870
+		if ( ! $changeset_post) {
871
+			return new WP_Error('missing_post');
872 872
 		}
873
-		if ( 'customize_changeset' !== $changeset_post->post_type ) {
874
-			return new WP_Error( 'wrong_post_type' );
873
+		if ('customize_changeset' !== $changeset_post->post_type) {
874
+			return new WP_Error('wrong_post_type');
875 875
 		}
876
-		$changeset_data = json_decode( $changeset_post->post_content, true );
877
-		if ( function_exists( 'json_last_error' ) && json_last_error() ) {
878
-			return new WP_Error( 'json_parse_error', '', json_last_error() );
876
+		$changeset_data = json_decode($changeset_post->post_content, true);
877
+		if (function_exists('json_last_error') && json_last_error()) {
878
+			return new WP_Error('json_parse_error', '', json_last_error());
879 879
 		}
880
-		if ( ! is_array( $changeset_data ) ) {
881
-			return new WP_Error( 'expected_array' );
880
+		if ( ! is_array($changeset_data)) {
881
+			return new WP_Error('expected_array');
882 882
 		}
883 883
 		return $changeset_data;
884 884
 	}
@@ -892,15 +892,15 @@  discard block
 block discarded – undo
892 892
 	 * @return array Changeset data.
893 893
 	 */
894 894
 	public function changeset_data() {
895
-		if ( isset( $this->_changeset_data ) ) {
895
+		if (isset($this->_changeset_data)) {
896 896
 			return $this->_changeset_data;
897 897
 		}
898 898
 		$changeset_post_id = $this->changeset_post_id();
899
-		if ( ! $changeset_post_id ) {
899
+		if ( ! $changeset_post_id) {
900 900
 			$this->_changeset_data = array();
901 901
 		} else {
902
-			$data = $this->get_changeset_post_data( $changeset_post_id );
903
-			if ( ! is_wp_error( $data ) ) {
902
+			$data = $this->get_changeset_post_data($changeset_post_id);
903
+			if ( ! is_wp_error($data)) {
904 904
 				$this->_changeset_data = $data;
905 905
 			} else {
906 906
 				$this->_changeset_data = array();
@@ -926,179 +926,179 @@  discard block
 block discarded – undo
926 926
 	 *
927 927
 	 * @param array $starter_content Starter content. Defaults to `get_theme_starter_content()`.
928 928
 	 */
929
-	function import_theme_starter_content( $starter_content = array() ) {
930
-		if ( empty( $starter_content ) ) {
929
+	function import_theme_starter_content($starter_content = array()) {
930
+		if (empty($starter_content)) {
931 931
 			$starter_content = get_theme_starter_content();
932 932
 		}
933 933
 
934 934
 		$changeset_data = array();
935
-		if ( $this->changeset_post_id() ) {
936
-			$changeset_data = $this->get_changeset_post_data( $this->changeset_post_id() );
935
+		if ($this->changeset_post_id()) {
936
+			$changeset_data = $this->get_changeset_post_data($this->changeset_post_id());
937 937
 		}
938 938
 
939
-		$sidebars_widgets = isset( $starter_content['widgets'] ) && ! empty( $this->widgets ) ? $starter_content['widgets'] : array();
940
-		$attachments = isset( $starter_content['attachments'] ) && ! empty( $this->nav_menus ) ? $starter_content['attachments'] : array();
941
-		$posts = isset( $starter_content['posts'] ) && ! empty( $this->nav_menus ) ? $starter_content['posts'] : array();
942
-		$options = isset( $starter_content['options'] ) ? $starter_content['options'] : array();
943
-		$nav_menus = isset( $starter_content['nav_menus'] ) && ! empty( $this->nav_menus ) ? $starter_content['nav_menus'] : array();
944
-		$theme_mods = isset( $starter_content['theme_mods'] ) ? $starter_content['theme_mods'] : array();
939
+		$sidebars_widgets = isset($starter_content['widgets']) && ! empty($this->widgets) ? $starter_content['widgets'] : array();
940
+		$attachments = isset($starter_content['attachments']) && ! empty($this->nav_menus) ? $starter_content['attachments'] : array();
941
+		$posts = isset($starter_content['posts']) && ! empty($this->nav_menus) ? $starter_content['posts'] : array();
942
+		$options = isset($starter_content['options']) ? $starter_content['options'] : array();
943
+		$nav_menus = isset($starter_content['nav_menus']) && ! empty($this->nav_menus) ? $starter_content['nav_menus'] : array();
944
+		$theme_mods = isset($starter_content['theme_mods']) ? $starter_content['theme_mods'] : array();
945 945
 
946 946
 		// Widgets.
947 947
 		$max_widget_numbers = array();
948
-		foreach ( $sidebars_widgets as $sidebar_id => $widgets ) {
948
+		foreach ($sidebars_widgets as $sidebar_id => $widgets) {
949 949
 			$sidebar_widget_ids = array();
950
-			foreach ( $widgets as $widget ) {
951
-				list( $id_base, $instance ) = $widget;
950
+			foreach ($widgets as $widget) {
951
+				list($id_base, $instance) = $widget;
952 952
 
953
-				if ( ! isset( $max_widget_numbers[ $id_base ] ) ) {
953
+				if ( ! isset($max_widget_numbers[$id_base])) {
954 954
 
955 955
 					// When $settings is an array-like object, get an intrinsic array for use with array_keys().
956
-					$settings = get_option( "widget_{$id_base}", array() );
957
-					if ( $settings instanceof ArrayObject || $settings instanceof ArrayIterator ) {
956
+					$settings = get_option("widget_{$id_base}", array());
957
+					if ($settings instanceof ArrayObject || $settings instanceof ArrayIterator) {
958 958
 						$settings = $settings->getArrayCopy();
959 959
 					}
960 960
 
961 961
 					// Find the max widget number for this type.
962
-					$widget_numbers = array_keys( $settings );
963
-					if ( count( $widget_numbers ) > 0 ) {
962
+					$widget_numbers = array_keys($settings);
963
+					if (count($widget_numbers) > 0) {
964 964
 						$widget_numbers[] = 1;
965
-						$max_widget_numbers[ $id_base ] = call_user_func_array( 'max', $widget_numbers );
965
+						$max_widget_numbers[$id_base] = call_user_func_array('max', $widget_numbers);
966 966
 					} else {
967
-						$max_widget_numbers[ $id_base ] = 1;
967
+						$max_widget_numbers[$id_base] = 1;
968 968
 					}
969 969
 				}
970
-				$max_widget_numbers[ $id_base ] += 1;
970
+				$max_widget_numbers[$id_base] += 1;
971 971
 
972
-				$widget_id = sprintf( '%s-%d', $id_base, $max_widget_numbers[ $id_base ] );
973
-				$setting_id = sprintf( 'widget_%s[%d]', $id_base, $max_widget_numbers[ $id_base ] );
972
+				$widget_id = sprintf('%s-%d', $id_base, $max_widget_numbers[$id_base]);
973
+				$setting_id = sprintf('widget_%s[%d]', $id_base, $max_widget_numbers[$id_base]);
974 974
 
975
-				$setting_value = $this->widgets->sanitize_widget_js_instance( $instance );
976
-				if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
977
-					$this->set_post_value( $setting_id, $setting_value );
975
+				$setting_value = $this->widgets->sanitize_widget_js_instance($instance);
976
+				if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
977
+					$this->set_post_value($setting_id, $setting_value);
978 978
 					$this->pending_starter_content_settings_ids[] = $setting_id;
979 979
 				}
980 980
 				$sidebar_widget_ids[] = $widget_id;
981 981
 			}
982 982
 
983
-			$setting_id = sprintf( 'sidebars_widgets[%s]', $sidebar_id );
984
-			if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
985
-				$this->set_post_value( $setting_id, $sidebar_widget_ids );
983
+			$setting_id = sprintf('sidebars_widgets[%s]', $sidebar_id);
984
+			if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
985
+				$this->set_post_value($setting_id, $sidebar_widget_ids);
986 986
 				$this->pending_starter_content_settings_ids[] = $setting_id;
987 987
 			}
988 988
 		}
989 989
 
990 990
 		$starter_content_auto_draft_post_ids = array();
991
-		if ( ! empty( $changeset_data['nav_menus_created_posts']['value'] ) ) {
992
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value'] );
991
+		if ( ! empty($changeset_data['nav_menus_created_posts']['value'])) {
992
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, $changeset_data['nav_menus_created_posts']['value']);
993 993
 		}
994 994
 
995 995
 		// Make an index of all the posts needed and what their slugs are.
996 996
 		$needed_posts = array();
997
-		$attachments = $this->prepare_starter_content_attachments( $attachments );
998
-		foreach ( $attachments as $attachment ) {
999
-			$key = 'attachment:' . $attachment['post_name'];
1000
-			$needed_posts[ $key ] = true;
1001
-		}
1002
-		foreach ( array_keys( $posts ) as $post_symbol ) {
1003
-			if ( empty( $posts[ $post_symbol ]['post_name'] ) && empty( $posts[ $post_symbol ]['post_title'] ) ) {
1004
-				unset( $posts[ $post_symbol ] );
997
+		$attachments = $this->prepare_starter_content_attachments($attachments);
998
+		foreach ($attachments as $attachment) {
999
+			$key = 'attachment:'.$attachment['post_name'];
1000
+			$needed_posts[$key] = true;
1001
+		}
1002
+		foreach (array_keys($posts) as $post_symbol) {
1003
+			if (empty($posts[$post_symbol]['post_name']) && empty($posts[$post_symbol]['post_title'])) {
1004
+				unset($posts[$post_symbol]);
1005 1005
 				continue;
1006 1006
 			}
1007
-			if ( empty( $posts[ $post_symbol ]['post_name'] ) ) {
1008
-				$posts[ $post_symbol ]['post_name'] = sanitize_title( $posts[ $post_symbol ]['post_title'] );
1007
+			if (empty($posts[$post_symbol]['post_name'])) {
1008
+				$posts[$post_symbol]['post_name'] = sanitize_title($posts[$post_symbol]['post_title']);
1009 1009
 			}
1010
-			if ( empty( $posts[ $post_symbol ]['post_type'] ) ) {
1011
-				$posts[ $post_symbol ]['post_type'] = 'post';
1010
+			if (empty($posts[$post_symbol]['post_type'])) {
1011
+				$posts[$post_symbol]['post_type'] = 'post';
1012 1012
 			}
1013
-			$needed_posts[ $posts[ $post_symbol ]['post_type'] . ':' . $posts[ $post_symbol ]['post_name'] ] = true;
1013
+			$needed_posts[$posts[$post_symbol]['post_type'].':'.$posts[$post_symbol]['post_name']] = true;
1014 1014
 		}
1015 1015
 		$all_post_slugs = array_merge(
1016
-			wp_list_pluck( $attachments, 'post_name' ),
1017
-			wp_list_pluck( $posts, 'post_name' )
1016
+			wp_list_pluck($attachments, 'post_name'),
1017
+			wp_list_pluck($posts, 'post_name')
1018 1018
 		);
1019 1019
 
1020 1020
 		/*
1021 1021
 		 * Obtain all post types referenced in starter content to use in query.
1022 1022
 		 * This is needed because 'any' will not account for post types not yet registered.
1023 1023
 		 */
1024
-		$post_types = array_filter( array_merge( array( 'attachment' ), wp_list_pluck( $posts, 'post_type' ) ) );
1024
+		$post_types = array_filter(array_merge(array('attachment'), wp_list_pluck($posts, 'post_type')));
1025 1025
 
1026 1026
 		// Re-use auto-draft starter content posts referenced in the current customized state.
1027 1027
 		$existing_starter_content_posts = array();
1028
-		if ( ! empty( $starter_content_auto_draft_post_ids ) ) {
1029
-			$existing_posts_query = new WP_Query( array(
1028
+		if ( ! empty($starter_content_auto_draft_post_ids)) {
1029
+			$existing_posts_query = new WP_Query(array(
1030 1030
 				'post__in' => $starter_content_auto_draft_post_ids,
1031 1031
 				'post_status' => 'auto-draft',
1032 1032
 				'post_type' => $post_types,
1033 1033
 				'posts_per_page' => -1,
1034
-			) );
1035
-			foreach ( $existing_posts_query->posts as $existing_post ) {
1034
+			));
1035
+			foreach ($existing_posts_query->posts as $existing_post) {
1036 1036
 				$post_name = $existing_post->post_name;
1037
-				if ( empty( $post_name ) ) {
1038
-					$post_name = get_post_meta( $existing_post->ID, '_customize_draft_post_name', true );
1037
+				if (empty($post_name)) {
1038
+					$post_name = get_post_meta($existing_post->ID, '_customize_draft_post_name', true);
1039 1039
 				}
1040
-				$existing_starter_content_posts[ $existing_post->post_type . ':' . $post_name ] = $existing_post;
1040
+				$existing_starter_content_posts[$existing_post->post_type.':'.$post_name] = $existing_post;
1041 1041
 			}
1042 1042
 		}
1043 1043
 
1044 1044
 		// Re-use non-auto-draft posts.
1045
-		if ( ! empty( $all_post_slugs ) ) {
1046
-			$existing_posts_query = new WP_Query( array(
1045
+		if ( ! empty($all_post_slugs)) {
1046
+			$existing_posts_query = new WP_Query(array(
1047 1047
 				'post_name__in' => $all_post_slugs,
1048
-				'post_status' => array_diff( get_post_stati(), array( 'auto-draft' ) ),
1048
+				'post_status' => array_diff(get_post_stati(), array('auto-draft')),
1049 1049
 				'post_type' => 'any',
1050 1050
 				'posts_per_page' => -1,
1051
-			) );
1052
-			foreach ( $existing_posts_query->posts as $existing_post ) {
1053
-				$key = $existing_post->post_type . ':' . $existing_post->post_name;
1054
-				if ( isset( $needed_posts[ $key ] ) && ! isset( $existing_starter_content_posts[ $key ] ) ) {
1055
-					$existing_starter_content_posts[ $key ] = $existing_post;
1051
+			));
1052
+			foreach ($existing_posts_query->posts as $existing_post) {
1053
+				$key = $existing_post->post_type.':'.$existing_post->post_name;
1054
+				if (isset($needed_posts[$key]) && ! isset($existing_starter_content_posts[$key])) {
1055
+					$existing_starter_content_posts[$key] = $existing_post;
1056 1056
 				}
1057 1057
 			}
1058 1058
 		}
1059 1059
 
1060 1060
 		// Attachments are technically posts but handled differently.
1061
-		if ( ! empty( $attachments ) ) {
1061
+		if ( ! empty($attachments)) {
1062 1062
 
1063 1063
 			$attachment_ids = array();
1064 1064
 
1065
-			foreach ( $attachments as $symbol => $attachment ) {
1065
+			foreach ($attachments as $symbol => $attachment) {
1066 1066
 				$file_array = array(
1067 1067
 					'name' => $attachment['file_name'],
1068 1068
 				);
1069 1069
 				$file_path = $attachment['file_path'];
1070 1070
 				$attachment_id = null;
1071 1071
 				$attached_file = null;
1072
-				if ( isset( $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ] ) ) {
1073
-					$attachment_post = $existing_starter_content_posts[ 'attachment:' . $attachment['post_name'] ];
1072
+				if (isset($existing_starter_content_posts['attachment:'.$attachment['post_name']])) {
1073
+					$attachment_post = $existing_starter_content_posts['attachment:'.$attachment['post_name']];
1074 1074
 					$attachment_id = $attachment_post->ID;
1075
-					$attached_file = get_attached_file( $attachment_id );
1076
-					if ( empty( $attached_file ) || ! file_exists( $attached_file ) ) {
1075
+					$attached_file = get_attached_file($attachment_id);
1076
+					if (empty($attached_file) || ! file_exists($attached_file)) {
1077 1077
 						$attachment_id = null;
1078 1078
 						$attached_file = null;
1079
-					} elseif ( $this->get_stylesheet() !== get_post_meta( $attachment_post->ID, '_starter_content_theme', true ) ) {
1079
+					} elseif ($this->get_stylesheet() !== get_post_meta($attachment_post->ID, '_starter_content_theme', true)) {
1080 1080
 
1081 1081
 						// Re-generate attachment metadata since it was previously generated for a different theme.
1082
-						$metadata = wp_generate_attachment_metadata( $attachment_post->ID, $attached_file );
1083
-						wp_update_attachment_metadata( $attachment_id, $metadata );
1084
-						update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() );
1082
+						$metadata = wp_generate_attachment_metadata($attachment_post->ID, $attached_file);
1083
+						wp_update_attachment_metadata($attachment_id, $metadata);
1084
+						update_post_meta($attachment_id, '_starter_content_theme', $this->get_stylesheet());
1085 1085
 					}
1086 1086
 				}
1087 1087
 
1088 1088
 				// Insert the attachment auto-draft because it doesn't yet exist or the attached file is gone.
1089
-				if ( ! $attachment_id ) {
1089
+				if ( ! $attachment_id) {
1090 1090
 
1091 1091
 					// Copy file to temp location so that original file won't get deleted from theme after sideloading.
1092
-					$temp_file_name = wp_tempnam( basename( $file_path ) );
1093
-					if ( $temp_file_name && copy( $file_path, $temp_file_name ) ) {
1092
+					$temp_file_name = wp_tempnam(basename($file_path));
1093
+					if ($temp_file_name && copy($file_path, $temp_file_name)) {
1094 1094
 						$file_array['tmp_name'] = $temp_file_name;
1095 1095
 					}
1096
-					if ( empty( $file_array['tmp_name'] ) ) {
1096
+					if (empty($file_array['tmp_name'])) {
1097 1097
 						continue;
1098 1098
 					}
1099 1099
 
1100 1100
 					$attachment_post_data = array_merge(
1101
-						wp_array_slice_assoc( $attachment, array( 'post_title', 'post_content', 'post_excerpt' ) ),
1101
+						wp_array_slice_assoc($attachment, array('post_title', 'post_content', 'post_excerpt')),
1102 1102
 						array(
1103 1103
 							'post_status' => 'auto-draft', // So attachment will be garbage collected in a week if changeset is never published.
1104 1104
 						)
@@ -1107,124 +1107,124 @@  discard block
 block discarded – undo
1107 1107
 					// In PHP < 5.6 filesize() returns 0 for the temp files unless we clear the file status cache.
1108 1108
 					// Technically, PHP < 5.6.0 || < 5.5.13 || < 5.4.29 but no need to be so targeted.
1109 1109
 					// See https://bugs.php.net/bug.php?id=65701
1110
-					if ( version_compare( PHP_VERSION, '5.6', '<' ) ) {
1110
+					if (version_compare(PHP_VERSION, '5.6', '<')) {
1111 1111
 						clearstatcache();
1112 1112
 					}
1113 1113
 
1114
-					$attachment_id = media_handle_sideload( $file_array, 0, null, $attachment_post_data );
1115
-					if ( is_wp_error( $attachment_id ) ) {
1114
+					$attachment_id = media_handle_sideload($file_array, 0, null, $attachment_post_data);
1115
+					if (is_wp_error($attachment_id)) {
1116 1116
 						continue;
1117 1117
 					}
1118
-					update_post_meta( $attachment_id, '_starter_content_theme', $this->get_stylesheet() );
1119
-					update_post_meta( $attachment_id, '_customize_draft_post_name', $attachment['post_name'] );
1118
+					update_post_meta($attachment_id, '_starter_content_theme', $this->get_stylesheet());
1119
+					update_post_meta($attachment_id, '_customize_draft_post_name', $attachment['post_name']);
1120 1120
 				}
1121 1121
 
1122
-				$attachment_ids[ $symbol ] = $attachment_id;
1122
+				$attachment_ids[$symbol] = $attachment_id;
1123 1123
 			}
1124
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, array_values( $attachment_ids ) );
1124
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, array_values($attachment_ids));
1125 1125
 		}
1126 1126
 
1127 1127
 		// Posts & pages.
1128
-		if ( ! empty( $posts ) ) {
1129
-			foreach ( array_keys( $posts ) as $post_symbol ) {
1130
-				if ( empty( $posts[ $post_symbol ]['post_type'] ) || empty( $posts[ $post_symbol ]['post_name'] ) ) {
1128
+		if ( ! empty($posts)) {
1129
+			foreach (array_keys($posts) as $post_symbol) {
1130
+				if (empty($posts[$post_symbol]['post_type']) || empty($posts[$post_symbol]['post_name'])) {
1131 1131
 					continue;
1132 1132
 				}
1133
-				$post_type = $posts[ $post_symbol ]['post_type'];
1134
-				if ( ! empty( $posts[ $post_symbol ]['post_name'] ) ) {
1135
-					$post_name = $posts[ $post_symbol ]['post_name'];
1136
-				} elseif ( ! empty( $posts[ $post_symbol ]['post_title'] ) ) {
1137
-					$post_name = sanitize_title( $posts[ $post_symbol ]['post_title'] );
1133
+				$post_type = $posts[$post_symbol]['post_type'];
1134
+				if ( ! empty($posts[$post_symbol]['post_name'])) {
1135
+					$post_name = $posts[$post_symbol]['post_name'];
1136
+				} elseif ( ! empty($posts[$post_symbol]['post_title'])) {
1137
+					$post_name = sanitize_title($posts[$post_symbol]['post_title']);
1138 1138
 				} else {
1139 1139
 					continue;
1140 1140
 				}
1141 1141
 
1142 1142
 				// Use existing auto-draft post if one already exists with the same type and name.
1143
-				if ( isset( $existing_starter_content_posts[ $post_type . ':' . $post_name ] ) ) {
1144
-					$posts[ $post_symbol ]['ID'] = $existing_starter_content_posts[ $post_type . ':' . $post_name ]->ID;
1143
+				if (isset($existing_starter_content_posts[$post_type.':'.$post_name])) {
1144
+					$posts[$post_symbol]['ID'] = $existing_starter_content_posts[$post_type.':'.$post_name]->ID;
1145 1145
 					continue;
1146 1146
 				}
1147 1147
 
1148 1148
 				// Translate the featured image symbol.
1149
-				if ( ! empty( $posts[ $post_symbol ]['thumbnail'] )
1150
-					&& preg_match( '/^{{(?P<symbol>.+)}}$/', $posts[ $post_symbol ]['thumbnail'], $matches )
1151
-					&& isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1152
-					$posts[ $post_symbol ]['meta_input']['_thumbnail_id'] = $attachment_ids[ $matches['symbol'] ];
1149
+				if ( ! empty($posts[$post_symbol]['thumbnail'])
1150
+					&& preg_match('/^{{(?P<symbol>.+)}}$/', $posts[$post_symbol]['thumbnail'], $matches)
1151
+					&& isset($attachment_ids[$matches['symbol']])) {
1152
+					$posts[$post_symbol]['meta_input']['_thumbnail_id'] = $attachment_ids[$matches['symbol']];
1153 1153
 				}
1154 1154
 
1155
-				if ( ! empty( $posts[ $post_symbol ]['template'] ) ) {
1156
-					$posts[ $post_symbol ]['meta_input']['_wp_page_template'] = $posts[ $post_symbol ]['template'];
1155
+				if ( ! empty($posts[$post_symbol]['template'])) {
1156
+					$posts[$post_symbol]['meta_input']['_wp_page_template'] = $posts[$post_symbol]['template'];
1157 1157
 				}
1158 1158
 
1159
-				$r = $this->nav_menus->insert_auto_draft_post( $posts[ $post_symbol ] );
1160
-				if ( $r instanceof WP_Post ) {
1161
-					$posts[ $post_symbol ]['ID'] = $r->ID;
1159
+				$r = $this->nav_menus->insert_auto_draft_post($posts[$post_symbol]);
1160
+				if ($r instanceof WP_Post) {
1161
+					$posts[$post_symbol]['ID'] = $r->ID;
1162 1162
 				}
1163 1163
 			}
1164 1164
 
1165
-			$starter_content_auto_draft_post_ids = array_merge( $starter_content_auto_draft_post_ids, wp_list_pluck( $posts, 'ID' ) );
1165
+			$starter_content_auto_draft_post_ids = array_merge($starter_content_auto_draft_post_ids, wp_list_pluck($posts, 'ID'));
1166 1166
 		}
1167 1167
 
1168 1168
 		// The nav_menus_created_posts setting is why nav_menus component is dependency for adding posts.
1169
-		if ( ! empty( $this->nav_menus ) && ! empty( $starter_content_auto_draft_post_ids ) ) {
1169
+		if ( ! empty($this->nav_menus) && ! empty($starter_content_auto_draft_post_ids)) {
1170 1170
 			$setting_id = 'nav_menus_created_posts';
1171
-			$this->set_post_value( $setting_id, array_unique( array_values( $starter_content_auto_draft_post_ids ) ) );
1171
+			$this->set_post_value($setting_id, array_unique(array_values($starter_content_auto_draft_post_ids)));
1172 1172
 			$this->pending_starter_content_settings_ids[] = $setting_id;
1173 1173
 		}
1174 1174
 
1175 1175
 		// Nav menus.
1176 1176
 		$placeholder_id = -1;
1177 1177
 		$reused_nav_menu_setting_ids = array();
1178
-		foreach ( $nav_menus as $nav_menu_location => $nav_menu ) {
1178
+		foreach ($nav_menus as $nav_menu_location => $nav_menu) {
1179 1179
 
1180 1180
 			$nav_menu_term_id = null;
1181 1181
 			$nav_menu_setting_id = null;
1182 1182
 			$matches = array();
1183 1183
 
1184 1184
 			// Look for an existing placeholder menu with starter content to re-use.
1185
-			foreach ( $changeset_data as $setting_id => $setting_params ) {
1185
+			foreach ($changeset_data as $setting_id => $setting_params) {
1186 1186
 				$can_reuse = (
1187
-					! empty( $setting_params['starter_content'] )
1187
+					! empty($setting_params['starter_content'])
1188 1188
 					&&
1189
-					! in_array( $setting_id, $reused_nav_menu_setting_ids, true )
1189
+					! in_array($setting_id, $reused_nav_menu_setting_ids, true)
1190 1190
 					&&
1191
-					preg_match( '#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches )
1191
+					preg_match('#^nav_menu\[(?P<nav_menu_id>-?\d+)\]$#', $setting_id, $matches)
1192 1192
 				);
1193
-				if ( $can_reuse ) {
1194
-					$nav_menu_term_id = intval( $matches['nav_menu_id'] );
1193
+				if ($can_reuse) {
1194
+					$nav_menu_term_id = intval($matches['nav_menu_id']);
1195 1195
 					$nav_menu_setting_id = $setting_id;
1196 1196
 					$reused_nav_menu_setting_ids[] = $setting_id;
1197 1197
 					break;
1198 1198
 				}
1199 1199
 			}
1200 1200
 
1201
-			if ( ! $nav_menu_term_id ) {
1202
-				while ( isset( $changeset_data[ sprintf( 'nav_menu[%d]', $placeholder_id ) ] ) ) {
1201
+			if ( ! $nav_menu_term_id) {
1202
+				while (isset($changeset_data[sprintf('nav_menu[%d]', $placeholder_id)])) {
1203 1203
 					$placeholder_id--;
1204 1204
 				}
1205 1205
 				$nav_menu_term_id = $placeholder_id;
1206
-				$nav_menu_setting_id = sprintf( 'nav_menu[%d]', $placeholder_id );
1206
+				$nav_menu_setting_id = sprintf('nav_menu[%d]', $placeholder_id);
1207 1207
 			}
1208 1208
 
1209
-			$this->set_post_value( $nav_menu_setting_id, array(
1210
-				'name' => isset( $nav_menu['name'] ) ? $nav_menu['name'] : $nav_menu_location,
1211
-			) );
1209
+			$this->set_post_value($nav_menu_setting_id, array(
1210
+				'name' => isset($nav_menu['name']) ? $nav_menu['name'] : $nav_menu_location,
1211
+			));
1212 1212
 			$this->pending_starter_content_settings_ids[] = $nav_menu_setting_id;
1213 1213
 
1214 1214
 			// @todo Add support for menu_item_parent.
1215 1215
 			$position = 0;
1216
-			foreach ( $nav_menu['items'] as $nav_menu_item ) {
1217
-				$nav_menu_item_setting_id = sprintf( 'nav_menu_item[%d]', $placeholder_id-- );
1218
-				if ( ! isset( $nav_menu_item['position'] ) ) {
1216
+			foreach ($nav_menu['items'] as $nav_menu_item) {
1217
+				$nav_menu_item_setting_id = sprintf('nav_menu_item[%d]', $placeholder_id--);
1218
+				if ( ! isset($nav_menu_item['position'])) {
1219 1219
 					$nav_menu_item['position'] = $position++;
1220 1220
 				}
1221 1221
 				$nav_menu_item['nav_menu_term_id'] = $nav_menu_term_id;
1222 1222
 
1223
-				if ( isset( $nav_menu_item['object_id'] ) ) {
1224
-					if ( 'post_type' === $nav_menu_item['type'] && preg_match( '/^{{(?P<symbol>.+)}}$/', $nav_menu_item['object_id'], $matches ) && isset( $posts[ $matches['symbol'] ] ) ) {
1225
-						$nav_menu_item['object_id'] = $posts[ $matches['symbol'] ]['ID'];
1226
-						if ( empty( $nav_menu_item['title'] ) ) {
1227
-							$original_object = get_post( $nav_menu_item['object_id'] );
1223
+				if (isset($nav_menu_item['object_id'])) {
1224
+					if ('post_type' === $nav_menu_item['type'] && preg_match('/^{{(?P<symbol>.+)}}$/', $nav_menu_item['object_id'], $matches) && isset($posts[$matches['symbol']])) {
1225
+						$nav_menu_item['object_id'] = $posts[$matches['symbol']]['ID'];
1226
+						if (empty($nav_menu_item['title'])) {
1227
+							$original_object = get_post($nav_menu_item['object_id']);
1228 1228
 							$nav_menu_item['title'] = $original_object->post_title;
1229 1229
 						}
1230 1230
 					} else {
@@ -1234,77 +1234,77 @@  discard block
 block discarded – undo
1234 1234
 					$nav_menu_item['object_id'] = 0;
1235 1235
 				}
1236 1236
 
1237
-				if ( empty( $changeset_data[ $nav_menu_item_setting_id ] ) || ! empty( $changeset_data[ $nav_menu_item_setting_id ]['starter_content'] ) ) {
1238
-					$this->set_post_value( $nav_menu_item_setting_id, $nav_menu_item );
1237
+				if (empty($changeset_data[$nav_menu_item_setting_id]) || ! empty($changeset_data[$nav_menu_item_setting_id]['starter_content'])) {
1238
+					$this->set_post_value($nav_menu_item_setting_id, $nav_menu_item);
1239 1239
 					$this->pending_starter_content_settings_ids[] = $nav_menu_item_setting_id;
1240 1240
 				}
1241 1241
 			}
1242 1242
 
1243
-			$setting_id = sprintf( 'nav_menu_locations[%s]', $nav_menu_location );
1244
-			if ( empty( $changeset_data[ $setting_id ] ) || ! empty( $changeset_data[ $setting_id ]['starter_content'] ) ) {
1245
-				$this->set_post_value( $setting_id, $nav_menu_term_id );
1243
+			$setting_id = sprintf('nav_menu_locations[%s]', $nav_menu_location);
1244
+			if (empty($changeset_data[$setting_id]) || ! empty($changeset_data[$setting_id]['starter_content'])) {
1245
+				$this->set_post_value($setting_id, $nav_menu_term_id);
1246 1246
 				$this->pending_starter_content_settings_ids[] = $setting_id;
1247 1247
 			}
1248 1248
 		}
1249 1249
 
1250 1250
 		// Options.
1251
-		foreach ( $options as $name => $value ) {
1252
-			if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) {
1253
-				if ( isset( $posts[ $matches['symbol'] ] ) ) {
1254
-					$value = $posts[ $matches['symbol'] ]['ID'];
1255
-				} elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1256
-					$value = $attachment_ids[ $matches['symbol'] ];
1251
+		foreach ($options as $name => $value) {
1252
+			if (preg_match('/^{{(?P<symbol>.+)}}$/', $value, $matches)) {
1253
+				if (isset($posts[$matches['symbol']])) {
1254
+					$value = $posts[$matches['symbol']]['ID'];
1255
+				} elseif (isset($attachment_ids[$matches['symbol']])) {
1256
+					$value = $attachment_ids[$matches['symbol']];
1257 1257
 				} else {
1258 1258
 					continue;
1259 1259
 				}
1260 1260
 			}
1261 1261
 
1262
-			if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) {
1263
-				$this->set_post_value( $name, $value );
1262
+			if (empty($changeset_data[$name]) || ! empty($changeset_data[$name]['starter_content'])) {
1263
+				$this->set_post_value($name, $value);
1264 1264
 				$this->pending_starter_content_settings_ids[] = $name;
1265 1265
 			}
1266 1266
 		}
1267 1267
 
1268 1268
 		// Theme mods.
1269
-		foreach ( $theme_mods as $name => $value ) {
1270
-			if ( preg_match( '/^{{(?P<symbol>.+)}}$/', $value, $matches ) ) {
1271
-				if ( isset( $posts[ $matches['symbol'] ] ) ) {
1272
-					$value = $posts[ $matches['symbol'] ]['ID'];
1273
-				} elseif ( isset( $attachment_ids[ $matches['symbol'] ] ) ) {
1274
-					$value = $attachment_ids[ $matches['symbol'] ];
1269
+		foreach ($theme_mods as $name => $value) {
1270
+			if (preg_match('/^{{(?P<symbol>.+)}}$/', $value, $matches)) {
1271
+				if (isset($posts[$matches['symbol']])) {
1272
+					$value = $posts[$matches['symbol']]['ID'];
1273
+				} elseif (isset($attachment_ids[$matches['symbol']])) {
1274
+					$value = $attachment_ids[$matches['symbol']];
1275 1275
 				} else {
1276 1276
 					continue;
1277 1277
 				}
1278 1278
 			}
1279 1279
 
1280 1280
 			// Handle header image as special case since setting has a legacy format.
1281
-			if ( 'header_image' === $name ) {
1281
+			if ('header_image' === $name) {
1282 1282
 				$name = 'header_image_data';
1283
-				$metadata = wp_get_attachment_metadata( $value );
1284
-				if ( empty( $metadata ) ) {
1283
+				$metadata = wp_get_attachment_metadata($value);
1284
+				if (empty($metadata)) {
1285 1285
 					continue;
1286 1286
 				}
1287 1287
 				$value = array(
1288 1288
 					'attachment_id' => $value,
1289
-					'url' => wp_get_attachment_url( $value ),
1289
+					'url' => wp_get_attachment_url($value),
1290 1290
 					'height' => $metadata['height'],
1291 1291
 					'width' => $metadata['width'],
1292 1292
 				);
1293
-			} elseif ( 'background_image' === $name ) {
1294
-				$value = wp_get_attachment_url( $value );
1293
+			} elseif ('background_image' === $name) {
1294
+				$value = wp_get_attachment_url($value);
1295 1295
 			}
1296 1296
 
1297
-			if ( empty( $changeset_data[ $name ] ) || ! empty( $changeset_data[ $name ]['starter_content'] ) ) {
1298
-				$this->set_post_value( $name, $value );
1297
+			if (empty($changeset_data[$name]) || ! empty($changeset_data[$name]['starter_content'])) {
1298
+				$this->set_post_value($name, $value);
1299 1299
 				$this->pending_starter_content_settings_ids[] = $name;
1300 1300
 			}
1301 1301
 		}
1302 1302
 
1303
-		if ( ! empty( $this->pending_starter_content_settings_ids ) ) {
1304
-			if ( did_action( 'customize_register' ) ) {
1303
+		if ( ! empty($this->pending_starter_content_settings_ids)) {
1304
+			if (did_action('customize_register')) {
1305 1305
 				$this->_save_starter_content_changeset();
1306 1306
 			} else {
1307
-				add_action( 'customize_register', array( $this, '_save_starter_content_changeset' ), 1000 );
1307
+				add_action('customize_register', array($this, '_save_starter_content_changeset'), 1000);
1308 1308
 			}
1309 1309
 		}
1310 1310
 	}
@@ -1320,54 +1320,54 @@  discard block
 block discarded – undo
1320 1320
 	 * @param array $attachments Attachments.
1321 1321
 	 * @return array Prepared attachments.
1322 1322
 	 */
1323
-	protected function prepare_starter_content_attachments( $attachments ) {
1323
+	protected function prepare_starter_content_attachments($attachments) {
1324 1324
 		$prepared_attachments = array();
1325
-		if ( empty( $attachments ) ) {
1325
+		if (empty($attachments)) {
1326 1326
 			return $prepared_attachments;
1327 1327
 		}
1328 1328
 
1329 1329
 		// Such is The WordPress Way.
1330
-		require_once( ABSPATH . 'wp-admin/includes/file.php' );
1331
-		require_once( ABSPATH . 'wp-admin/includes/media.php' );
1332
-		require_once( ABSPATH . 'wp-admin/includes/image.php' );
1330
+		require_once(ABSPATH.'wp-admin/includes/file.php');
1331
+		require_once(ABSPATH.'wp-admin/includes/media.php');
1332
+		require_once(ABSPATH.'wp-admin/includes/image.php');
1333 1333
 
1334
-		foreach ( $attachments as $symbol => $attachment ) {
1334
+		foreach ($attachments as $symbol => $attachment) {
1335 1335
 
1336 1336
 			// A file is required and URLs to files are not currently allowed.
1337
-			if ( empty( $attachment['file'] ) || preg_match( '#^https?://$#', $attachment['file'] ) ) {
1337
+			if (empty($attachment['file']) || preg_match('#^https?://$#', $attachment['file'])) {
1338 1338
 				continue;
1339 1339
 			}
1340 1340
 
1341 1341
 			$file_path = null;
1342
-			if ( file_exists( $attachment['file'] ) ) {
1342
+			if (file_exists($attachment['file'])) {
1343 1343
 				$file_path = $attachment['file']; // Could be absolute path to file in plugin.
1344
-			} elseif ( is_child_theme() && file_exists( get_stylesheet_directory() . '/' . $attachment['file'] ) ) {
1345
-				$file_path = get_stylesheet_directory() . '/' . $attachment['file'];
1346
-			} elseif ( file_exists( get_template_directory() . '/' . $attachment['file'] ) ) {
1347
-				$file_path = get_template_directory() . '/' . $attachment['file'];
1344
+			} elseif (is_child_theme() && file_exists(get_stylesheet_directory().'/'.$attachment['file'])) {
1345
+				$file_path = get_stylesheet_directory().'/'.$attachment['file'];
1346
+			} elseif (file_exists(get_template_directory().'/'.$attachment['file'])) {
1347
+				$file_path = get_template_directory().'/'.$attachment['file'];
1348 1348
 			} else {
1349 1349
 				continue;
1350 1350
 			}
1351
-			$file_name = basename( $attachment['file'] );
1351
+			$file_name = basename($attachment['file']);
1352 1352
 
1353 1353
 			// Skip file types that are not recognized.
1354
-			$checked_filetype = wp_check_filetype( $file_name );
1355
-			if ( empty( $checked_filetype['type'] ) ) {
1354
+			$checked_filetype = wp_check_filetype($file_name);
1355
+			if (empty($checked_filetype['type'])) {
1356 1356
 				continue;
1357 1357
 			}
1358 1358
 
1359 1359
 			// Ensure post_name is set since not automatically derived from post_title for new auto-draft posts.
1360
-			if ( empty( $attachment['post_name'] ) ) {
1361
-				if ( ! empty( $attachment['post_title'] ) ) {
1362
-					$attachment['post_name'] = sanitize_title( $attachment['post_title'] );
1360
+			if (empty($attachment['post_name'])) {
1361
+				if ( ! empty($attachment['post_title'])) {
1362
+					$attachment['post_name'] = sanitize_title($attachment['post_title']);
1363 1363
 				} else {
1364
-					$attachment['post_name'] = sanitize_title( preg_replace( '/\.\w+$/', '', $file_name ) );
1364
+					$attachment['post_name'] = sanitize_title(preg_replace('/\.\w+$/', '', $file_name));
1365 1365
 				}
1366 1366
 			}
1367 1367
 
1368 1368
 			$attachment['file_name'] = $file_name;
1369 1369
 			$attachment['file_path'] = $file_path;
1370
-			$prepared_attachments[ $symbol ] = $attachment;
1370
+			$prepared_attachments[$symbol] = $attachment;
1371 1371
 		}
1372 1372
 		return $prepared_attachments;
1373 1373
 	}
@@ -1380,14 +1380,14 @@  discard block
 block discarded – undo
1380 1380
 	 */
1381 1381
 	public function _save_starter_content_changeset() {
1382 1382
 
1383
-		if ( empty( $this->pending_starter_content_settings_ids ) ) {
1383
+		if (empty($this->pending_starter_content_settings_ids)) {
1384 1384
 			return;
1385 1385
 		}
1386 1386
 
1387
-		$this->save_changeset_post( array(
1388
-			'data' => array_fill_keys( $this->pending_starter_content_settings_ids, array( 'starter_content' => true ) ),
1387
+		$this->save_changeset_post(array(
1388
+			'data' => array_fill_keys($this->pending_starter_content_settings_ids, array('starter_content' => true)),
1389 1389
 			'starter_content' => true,
1390
-		) );
1390
+		));
1391 1391
 
1392 1392
 		$this->pending_starter_content_settings_ids = array();
1393 1393
 	}
@@ -1419,11 +1419,11 @@  discard block
 block discarded – undo
1419 1419
 	 * }
1420 1420
 	 * @return array
1421 1421
 	 */
1422
-	public function unsanitized_post_values( $args = array() ) {
1422
+	public function unsanitized_post_values($args = array()) {
1423 1423
 		$args = array_merge(
1424 1424
 			array(
1425 1425
 				'exclude_changeset' => false,
1426
-				'exclude_post_data' => ! current_user_can( 'customize' ),
1426
+				'exclude_post_data' => ! current_user_can('customize'),
1427 1427
 			),
1428 1428
 			$args
1429 1429
 		);
@@ -1431,46 +1431,46 @@  discard block
 block discarded – undo
1431 1431
 		$values = array();
1432 1432
 
1433 1433
 		// Let default values be from the stashed theme mods if doing a theme switch and if no changeset is present.
1434
-		if ( ! $this->is_theme_active() ) {
1435
-			$stashed_theme_mods = get_option( 'customize_stashed_theme_mods' );
1434
+		if ( ! $this->is_theme_active()) {
1435
+			$stashed_theme_mods = get_option('customize_stashed_theme_mods');
1436 1436
 			$stylesheet = $this->get_stylesheet();
1437
-			if ( isset( $stashed_theme_mods[ $stylesheet ] ) ) {
1438
-				$values = array_merge( $values, wp_list_pluck( $stashed_theme_mods[ $stylesheet ], 'value' ) );
1437
+			if (isset($stashed_theme_mods[$stylesheet])) {
1438
+				$values = array_merge($values, wp_list_pluck($stashed_theme_mods[$stylesheet], 'value'));
1439 1439
 			}
1440 1440
 		}
1441 1441
 
1442
-		if ( ! $args['exclude_changeset'] ) {
1443
-			foreach ( $this->changeset_data() as $setting_id => $setting_params ) {
1444
-				if ( ! array_key_exists( 'value', $setting_params ) ) {
1442
+		if ( ! $args['exclude_changeset']) {
1443
+			foreach ($this->changeset_data() as $setting_id => $setting_params) {
1444
+				if ( ! array_key_exists('value', $setting_params)) {
1445 1445
 					continue;
1446 1446
 				}
1447
-				if ( isset( $setting_params['type'] ) && 'theme_mod' === $setting_params['type'] ) {
1447
+				if (isset($setting_params['type']) && 'theme_mod' === $setting_params['type']) {
1448 1448
 
1449 1449
 					// Ensure that theme mods values are only used if they were saved under the current theme.
1450 1450
 					$namespace_pattern = '/^(?P<stylesheet>.+?)::(?P<setting_id>.+)$/';
1451
-					if ( preg_match( $namespace_pattern, $setting_id, $matches ) && $this->get_stylesheet() === $matches['stylesheet'] ) {
1452
-						$values[ $matches['setting_id'] ] = $setting_params['value'];
1451
+					if (preg_match($namespace_pattern, $setting_id, $matches) && $this->get_stylesheet() === $matches['stylesheet']) {
1452
+						$values[$matches['setting_id']] = $setting_params['value'];
1453 1453
 					}
1454 1454
 				} else {
1455
-					$values[ $setting_id ] = $setting_params['value'];
1455
+					$values[$setting_id] = $setting_params['value'];
1456 1456
 				}
1457 1457
 			}
1458 1458
 		}
1459 1459
 
1460
-		if ( ! $args['exclude_post_data'] ) {
1461
-			if ( ! isset( $this->_post_values ) ) {
1462
-				if ( isset( $_POST['customized'] ) ) {
1463
-					$post_values = json_decode( wp_unslash( $_POST['customized'] ), true );
1460
+		if ( ! $args['exclude_post_data']) {
1461
+			if ( ! isset($this->_post_values)) {
1462
+				if (isset($_POST['customized'])) {
1463
+					$post_values = json_decode(wp_unslash($_POST['customized']), true);
1464 1464
 				} else {
1465 1465
 					$post_values = array();
1466 1466
 				}
1467
-				if ( is_array( $post_values ) ) {
1467
+				if (is_array($post_values)) {
1468 1468
 					$this->_post_values = $post_values;
1469 1469
 				} else {
1470 1470
 					$this->_post_values = array();
1471 1471
 				}
1472 1472
 			}
1473
-			$values = array_merge( $values, $this->_post_values );
1473
+			$values = array_merge($values, $this->_post_values);
1474 1474
 		}
1475 1475
 		return $values;
1476 1476
 	}
@@ -1496,18 +1496,18 @@  discard block
 block discarded – undo
1496 1496
 	 *                                      or the post value is invalid (added in 4.6.0).
1497 1497
 	 * @return string|mixed $post_value Sanitized value or the $default provided.
1498 1498
 	 */
1499
-	public function post_value( $setting, $default = null ) {
1499
+	public function post_value($setting, $default = null) {
1500 1500
 		$post_values = $this->unsanitized_post_values();
1501
-		if ( ! array_key_exists( $setting->id, $post_values ) ) {
1501
+		if ( ! array_key_exists($setting->id, $post_values)) {
1502 1502
 			return $default;
1503 1503
 		}
1504
-		$value = $post_values[ $setting->id ];
1505
-		$valid = $setting->validate( $value );
1506
-		if ( is_wp_error( $valid ) ) {
1504
+		$value = $post_values[$setting->id];
1505
+		$valid = $setting->validate($value);
1506
+		if (is_wp_error($valid)) {
1507 1507
 			return $default;
1508 1508
 		}
1509
-		$value = $setting->sanitize( $value );
1510
-		if ( is_null( $value ) || is_wp_error( $value ) ) {
1509
+		$value = $setting->sanitize($value);
1510
+		if (is_null($value) || is_wp_error($value)) {
1511 1511
 			return $default;
1512 1512
 		}
1513 1513
 		return $value;
@@ -1525,9 +1525,9 @@  discard block
 block discarded – undo
1525 1525
 	 * @param string $setting_id ID for the WP_Customize_Setting instance.
1526 1526
 	 * @param mixed  $value      Post value.
1527 1527
 	 */
1528
-	public function set_post_value( $setting_id, $value ) {
1528
+	public function set_post_value($setting_id, $value) {
1529 1529
 		$this->unsanitized_post_values(); // Populate _post_values from $_POST['customized'].
1530
-		$this->_post_values[ $setting_id ] = $value;
1530
+		$this->_post_values[$setting_id] = $value;
1531 1531
 
1532 1532
 		/**
1533 1533
 		 * Announce when a specific setting's unsanitized post value has been set.
@@ -1541,7 +1541,7 @@  discard block
 block discarded – undo
1541 1541
 		 * @param mixed                $value Unsanitized setting post value.
1542 1542
 		 * @param WP_Customize_Manager $this  WP_Customize_Manager instance.
1543 1543
 		 */
1544
-		do_action( "customize_post_value_set_{$setting_id}", $value, $this );
1544
+		do_action("customize_post_value_set_{$setting_id}", $value, $this);
1545 1545
 
1546 1546
 		/**
1547 1547
 		 * Announce when any setting's unsanitized post value has been set.
@@ -1557,7 +1557,7 @@  discard block
 block discarded – undo
1557 1557
 		 * @param mixed                $value      Unsanitized setting post value.
1558 1558
 		 * @param WP_Customize_Manager $this       WP_Customize_Manager instance.
1559 1559
 		 */
1560
-		do_action( 'customize_post_value_set', $setting_id, $value, $this );
1560
+		do_action('customize_post_value_set', $setting_id, $value, $this);
1561 1561
 	}
1562 1562
 
1563 1563
 	/**
@@ -1575,33 +1575,33 @@  discard block
 block discarded – undo
1575 1575
 		 * allowed then the auth cookies would not be sent and WordPress would
1576 1576
 		 * not send no-cache headers by default.
1577 1577
 		 */
1578
-		if ( ! headers_sent() ) {
1578
+		if ( ! headers_sent()) {
1579 1579
 			nocache_headers();
1580
-			header( 'X-Robots: noindex, nofollow, noarchive' );
1580
+			header('X-Robots: noindex, nofollow, noarchive');
1581 1581
 		}
1582
-		add_action( 'wp_head', 'wp_no_robots' );
1583
-		add_filter( 'wp_headers', array( $this, 'filter_iframe_security_headers' ) );
1582
+		add_action('wp_head', 'wp_no_robots');
1583
+		add_filter('wp_headers', array($this, 'filter_iframe_security_headers'));
1584 1584
 
1585 1585
 		/*
1586 1586
 		 * If preview is being served inside the customizer preview iframe, and
1587 1587
 		 * if the user doesn't have customize capability, then it is assumed
1588 1588
 		 * that the user's session has expired and they need to re-authenticate.
1589 1589
 		 */
1590
-		if ( $this->messenger_channel && ! current_user_can( 'customize' ) ) {
1591
-			$this->wp_die( -1, __( 'Unauthorized. You may remove the customize_messenger_channel param to preview as frontend.' ) );
1590
+		if ($this->messenger_channel && ! current_user_can('customize')) {
1591
+			$this->wp_die( -1, __('Unauthorized. You may remove the customize_messenger_channel param to preview as frontend.') );
1592 1592
 			return;
1593 1593
 		}
1594 1594
 
1595 1595
 		$this->prepare_controls();
1596 1596
 
1597
-		add_filter( 'wp_redirect', array( $this, 'add_state_query_params' ) );
1597
+		add_filter('wp_redirect', array($this, 'add_state_query_params'));
1598 1598
 
1599
-		wp_enqueue_script( 'customize-preview' );
1600
-		wp_enqueue_style( 'customize-preview' );
1601
-		add_action( 'wp_head', array( $this, 'customize_preview_loading_style' ) );
1602
-		add_action( 'wp_head', array( $this, 'remove_frameless_preview_messenger_channel' ) );
1603
-		add_action( 'wp_footer', array( $this, 'customize_preview_settings' ), 20 );
1604
-		add_filter( 'get_edit_post_link', '__return_empty_string' );
1599
+		wp_enqueue_script('customize-preview');
1600
+		wp_enqueue_style('customize-preview');
1601
+		add_action('wp_head', array($this, 'customize_preview_loading_style'));
1602
+		add_action('wp_head', array($this, 'remove_frameless_preview_messenger_channel'));
1603
+		add_action('wp_footer', array($this, 'customize_preview_settings'), 20);
1604
+		add_filter('get_edit_post_link', '__return_empty_string');
1605 1605
 
1606 1606
 		/**
1607 1607
 		 * Fires once the Customizer preview has initialized and JavaScript
@@ -1611,7 +1611,7 @@  discard block
 block discarded – undo
1611 1611
 		 *
1612 1612
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
1613 1613
 		 */
1614
-		do_action( 'customize_preview_init', $this );
1614
+		do_action('customize_preview_init', $this);
1615 1615
 	}
1616 1616
 
1617 1617
 	/**
@@ -1623,10 +1623,10 @@  discard block
 block discarded – undo
1623 1623
 	 * @param array $headers Headers.
1624 1624
 	 * @return array Headers.
1625 1625
 	 */
1626
-	public function filter_iframe_security_headers( $headers ) {
1627
-		$customize_url = admin_url( 'customize.php' );
1628
-		$headers['X-Frame-Options'] = 'ALLOW-FROM ' . $customize_url;
1629
-		$headers['Content-Security-Policy'] = 'frame-ancestors ' . preg_replace( '#^(\w+://[^/]+).+?$#', '$1', $customize_url );
1626
+	public function filter_iframe_security_headers($headers) {
1627
+		$customize_url = admin_url('customize.php');
1628
+		$headers['X-Frame-Options'] = 'ALLOW-FROM '.$customize_url;
1629
+		$headers['Content-Security-Policy'] = 'frame-ancestors '.preg_replace('#^(\w+://[^/]+).+?$#', '$1', $customize_url);
1630 1630
 		return $headers;
1631 1631
 	}
1632 1632
 
@@ -1641,34 +1641,34 @@  discard block
 block discarded – undo
1641 1641
 	 * @param string $url URL.
1642 1642
 	 * @return string URL.
1643 1643
 	 */
1644
-	public function add_state_query_params( $url ) {
1645
-		$parsed_original_url = wp_parse_url( $url );
1644
+	public function add_state_query_params($url) {
1645
+		$parsed_original_url = wp_parse_url($url);
1646 1646
 		$is_allowed = false;
1647
-		foreach ( $this->get_allowed_urls() as $allowed_url ) {
1648
-			$parsed_allowed_url = wp_parse_url( $allowed_url );
1647
+		foreach ($this->get_allowed_urls() as $allowed_url) {
1648
+			$parsed_allowed_url = wp_parse_url($allowed_url);
1649 1649
 			$is_allowed = (
1650 1650
 				$parsed_allowed_url['scheme'] === $parsed_original_url['scheme']
1651 1651
 				&&
1652 1652
 				$parsed_allowed_url['host'] === $parsed_original_url['host']
1653 1653
 				&&
1654
-				0 === strpos( $parsed_original_url['path'], $parsed_allowed_url['path'] )
1654
+				0 === strpos($parsed_original_url['path'], $parsed_allowed_url['path'])
1655 1655
 			);
1656
-			if ( $is_allowed ) {
1656
+			if ($is_allowed) {
1657 1657
 				break;
1658 1658
 			}
1659 1659
 		}
1660 1660
 
1661
-		if ( $is_allowed ) {
1661
+		if ($is_allowed) {
1662 1662
 			$query_params = array(
1663 1663
 				'customize_changeset_uuid' => $this->changeset_uuid(),
1664 1664
 			);
1665
-			if ( ! $this->is_theme_active() ) {
1665
+			if ( ! $this->is_theme_active()) {
1666 1666
 				$query_params['customize_theme'] = $this->get_stylesheet();
1667 1667
 			}
1668
-			if ( $this->messenger_channel ) {
1668
+			if ($this->messenger_channel) {
1669 1669
 				$query_params['customize_messenger_channel'] = $this->messenger_channel;
1670 1670
 			}
1671
-			$url = add_query_arg( $query_params, $url );
1671
+			$url = add_query_arg($query_params, $url);
1672 1672
 		}
1673 1673
 
1674 1674
 		return $url;
@@ -1683,7 +1683,7 @@  discard block
 block discarded – undo
1683 1683
 	 * @access public
1684 1684
 	 */
1685 1685
 	public function customize_preview_override_404_status() {
1686
-		_deprecated_function( __METHOD__, '4.7.0' );
1686
+		_deprecated_function(__METHOD__, '4.7.0');
1687 1687
 	}
1688 1688
 
1689 1689
 	/**
@@ -1693,7 +1693,7 @@  discard block
 block discarded – undo
1693 1693
 	 * @deprecated 4.7.0
1694 1694
 	 */
1695 1695
 	public function customize_preview_base() {
1696
-		_deprecated_function( __METHOD__, '4.7.0' );
1696
+		_deprecated_function(__METHOD__, '4.7.0');
1697 1697
 	}
1698 1698
 
1699 1699
 	/**
@@ -1703,7 +1703,7 @@  discard block
 block discarded – undo
1703 1703
 	 * @deprecated 4.7.0 Customizer no longer supports IE8, so all supported browsers recognize HTML5.
1704 1704
 	 */
1705 1705
 	public function customize_preview_html5() {
1706
-		_deprecated_function( __FUNCTION__, '4.7.0' );
1706
+		_deprecated_function(__FUNCTION__, '4.7.0');
1707 1707
 	}
1708 1708
 
1709 1709
 	/**
@@ -1744,7 +1744,7 @@  discard block
 block discarded – undo
1744 1744
 	 * @access public
1745 1745
 	 */
1746 1746
 	public function remove_frameless_preview_messenger_channel() {
1747
-		if ( ! $this->messenger_channel ) {
1747
+		if ( ! $this->messenger_channel) {
1748 1748
 			return;
1749 1749
 		}
1750 1750
 		?>
@@ -1778,40 +1778,40 @@  discard block
 block discarded – undo
1778 1778
 	 * @since 3.4.0
1779 1779
 	 */
1780 1780
 	public function customize_preview_settings() {
1781
-		$post_values = $this->unsanitized_post_values( array( 'exclude_changeset' => true ) );
1782
-		$setting_validities = $this->validate_setting_values( $post_values );
1783
-		$exported_setting_validities = array_map( array( $this, 'prepare_setting_validity_for_js' ), $setting_validities );
1781
+		$post_values = $this->unsanitized_post_values(array('exclude_changeset' => true));
1782
+		$setting_validities = $this->validate_setting_values($post_values);
1783
+		$exported_setting_validities = array_map(array($this, 'prepare_setting_validity_for_js'), $setting_validities);
1784 1784
 
1785 1785
 		// Note that the REQUEST_URI is not passed into home_url() since this breaks subdirectory installs.
1786
-		$self_url = empty( $_SERVER['REQUEST_URI'] ) ? home_url( '/' ) : esc_url_raw( wp_unslash( $_SERVER['REQUEST_URI'] ) );
1786
+		$self_url = empty($_SERVER['REQUEST_URI']) ? home_url('/') : esc_url_raw(wp_unslash($_SERVER['REQUEST_URI']));
1787 1787
 		$state_query_params = array(
1788 1788
 			'customize_theme',
1789 1789
 			'customize_changeset_uuid',
1790 1790
 			'customize_messenger_channel',
1791 1791
 		);
1792
-		$self_url = remove_query_arg( $state_query_params, $self_url );
1792
+		$self_url = remove_query_arg($state_query_params, $self_url);
1793 1793
 
1794 1794
 		$allowed_urls = $this->get_allowed_urls();
1795 1795
 		$allowed_hosts = array();
1796
-		foreach ( $allowed_urls as $allowed_url ) {
1797
-			$parsed = wp_parse_url( $allowed_url );
1798
-			if ( empty( $parsed['host'] ) ) {
1796
+		foreach ($allowed_urls as $allowed_url) {
1797
+			$parsed = wp_parse_url($allowed_url);
1798
+			if (empty($parsed['host'])) {
1799 1799
 				continue;
1800 1800
 			}
1801 1801
 			$host = $parsed['host'];
1802
-			if ( ! empty( $parsed['port'] ) ) {
1803
-				$host .= ':' . $parsed['port'];
1802
+			if ( ! empty($parsed['port'])) {
1803
+				$host .= ':'.$parsed['port'];
1804 1804
 			}
1805 1805
 			$allowed_hosts[] = $host;
1806 1806
 		}
1807 1807
 
1808
-		$switched_locale = switch_to_locale( get_user_locale() );
1808
+		$switched_locale = switch_to_locale(get_user_locale());
1809 1809
 		$l10n = array(
1810
-			'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
1811
-			'linkUnpreviewable' => __( 'This link is not live-previewable.' ),
1812
-			'formUnpreviewable' => __( 'This form is not live-previewable.' ),
1810
+			'shiftClickToEdit' => __('Shift-click to edit this element.'),
1811
+			'linkUnpreviewable' => __('This link is not live-previewable.'),
1812
+			'formUnpreviewable' => __('This form is not live-previewable.'),
1813 1813
 		);
1814
-		if ( $switched_locale ) {
1814
+		if ($switched_locale) {
1815 1815
 			restore_previous_locale();
1816 1816
 		}
1817 1817
 
@@ -1829,8 +1829,8 @@  discard block
 block discarded – undo
1829 1829
 			),
1830 1830
 			'url' => array(
1831 1831
 				'self' => $self_url,
1832
-				'allowed' => array_map( 'esc_url_raw', $this->get_allowed_urls() ),
1833
-				'allowedHosts' => array_unique( $allowed_hosts ),
1832
+				'allowed' => array_map('esc_url_raw', $this->get_allowed_urls()),
1833
+				'allowedHosts' => array_unique($allowed_hosts),
1834 1834
 				'isCrossDomain' => $this->is_cross_domain(),
1835 1835
 			),
1836 1836
 			'channel' => $this->messenger_channel,
@@ -1838,35 +1838,35 @@  discard block
 block discarded – undo
1838 1838
 			'activeSections' => array(),
1839 1839
 			'activeControls' => array(),
1840 1840
 			'settingValidities' => $exported_setting_validities,
1841
-			'nonce' => current_user_can( 'customize' ) ? $this->get_nonces() : array(),
1841
+			'nonce' => current_user_can('customize') ? $this->get_nonces() : array(),
1842 1842
 			'l10n' => $l10n,
1843
-			'_dirty' => array_keys( $post_values ),
1843
+			'_dirty' => array_keys($post_values),
1844 1844
 		);
1845 1845
 
1846
-		foreach ( $this->panels as $panel_id => $panel ) {
1847
-			if ( $panel->check_capabilities() ) {
1848
-				$settings['activePanels'][ $panel_id ] = $panel->active();
1849
-				foreach ( $panel->sections as $section_id => $section ) {
1850
-					if ( $section->check_capabilities() ) {
1851
-						$settings['activeSections'][ $section_id ] = $section->active();
1846
+		foreach ($this->panels as $panel_id => $panel) {
1847
+			if ($panel->check_capabilities()) {
1848
+				$settings['activePanels'][$panel_id] = $panel->active();
1849
+				foreach ($panel->sections as $section_id => $section) {
1850
+					if ($section->check_capabilities()) {
1851
+						$settings['activeSections'][$section_id] = $section->active();
1852 1852
 					}
1853 1853
 				}
1854 1854
 			}
1855 1855
 		}
1856
-		foreach ( $this->sections as $id => $section ) {
1857
-			if ( $section->check_capabilities() ) {
1858
-				$settings['activeSections'][ $id ] = $section->active();
1856
+		foreach ($this->sections as $id => $section) {
1857
+			if ($section->check_capabilities()) {
1858
+				$settings['activeSections'][$id] = $section->active();
1859 1859
 			}
1860 1860
 		}
1861
-		foreach ( $this->controls as $id => $control ) {
1862
-			if ( $control->check_capabilities() ) {
1863
-				$settings['activeControls'][ $id ] = $control->active();
1861
+		foreach ($this->controls as $id => $control) {
1862
+			if ($control->check_capabilities()) {
1863
+				$settings['activeControls'][$id] = $control->active();
1864 1864
 			}
1865 1865
 		}
1866 1866
 
1867 1867
 		?>
1868 1868
 		<script type="text/javascript">
1869
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
1869
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
1870 1870
 			_wpCustomizeSettings.values = {};
1871 1871
 			(function( v ) {
1872 1872
 				<?php
@@ -1875,12 +1875,12 @@  discard block
 block discarded – undo
1875 1875
 				 * serialization in order to avoid a peak memory usage spike.
1876 1876
 				 * @todo We may not even need to export the values at all since the pane syncs them anyway.
1877 1877
 				 */
1878
-				foreach ( $this->settings as $id => $setting ) {
1879
-					if ( $setting->check_capabilities() ) {
1878
+				foreach ($this->settings as $id => $setting) {
1879
+					if ($setting->check_capabilities()) {
1880 1880
 						printf(
1881 1881
 							"v[%s] = %s;\n",
1882
-							wp_json_encode( $id ),
1883
-							wp_json_encode( $setting->js_value() )
1882
+							wp_json_encode($id),
1883
+							wp_json_encode($setting->js_value())
1884 1884
 						);
1885 1885
 					}
1886 1886
 				}
@@ -1897,7 +1897,7 @@  discard block
 block discarded – undo
1897 1897
 	 * @deprecated 4.7.0
1898 1898
 	 */
1899 1899
 	public function customize_preview_signature() {
1900
-		_deprecated_function( __METHOD__, '4.7.0' );
1900
+		_deprecated_function(__METHOD__, '4.7.0');
1901 1901
 	}
1902 1902
 
1903 1903
 	/**
@@ -1909,8 +1909,8 @@  discard block
 block discarded – undo
1909 1909
 	 * @param mixed $return Value passed through for {@see 'wp_die_handler'} filter.
1910 1910
 	 * @return mixed Value passed through for {@see 'wp_die_handler'} filter.
1911 1911
 	 */
1912
-	public function remove_preview_signature( $return = null ) {
1913
-		_deprecated_function( __METHOD__, '4.7.0' );
1912
+	public function remove_preview_signature($return = null) {
1913
+		_deprecated_function(__METHOD__, '4.7.0');
1914 1914
 
1915 1915
 		return $return;
1916 1916
 	}
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
 	 * @return string Theme root.
1957 1957
 	 */
1958 1958
 	public function get_template_root() {
1959
-		return get_raw_theme_root( $this->get_template(), true );
1959
+		return get_raw_theme_root($this->get_template(), true);
1960 1960
 	}
1961 1961
 
1962 1962
 	/**
@@ -1967,7 +1967,7 @@  discard block
 block discarded – undo
1967 1967
 	 * @return string Theme root.
1968 1968
 	 */
1969 1969
 	public function get_stylesheet_root() {
1970
-		return get_raw_theme_root( $this->get_stylesheet(), true );
1970
+		return get_raw_theme_root($this->get_stylesheet(), true);
1971 1971
 	}
1972 1972
 
1973 1973
 	/**
@@ -1978,7 +1978,7 @@  discard block
 block discarded – undo
1978 1978
 	 * @param $current_theme {@internal Parameter is not used}
1979 1979
 	 * @return string Theme name.
1980 1980
 	 */
1981
-	public function current_theme( $current_theme ) {
1981
+	public function current_theme($current_theme) {
1982 1982
 		return $this->theme()->display('Name');
1983 1983
 	}
1984 1984
 
@@ -2005,48 +2005,48 @@  discard block
 block discarded – undo
2005 2005
 	 * }
2006 2006
 	 * @return array Mapping of setting IDs to return value of validate method calls, either `true` or `WP_Error`.
2007 2007
 	 */
2008
-	public function validate_setting_values( $setting_values, $options = array() ) {
2009
-		$options = wp_parse_args( $options, array(
2008
+	public function validate_setting_values($setting_values, $options = array()) {
2009
+		$options = wp_parse_args($options, array(
2010 2010
 			'validate_capability' => false,
2011 2011
 			'validate_existence' => false,
2012
-		) );
2012
+		));
2013 2013
 
2014 2014
 		$validities = array();
2015
-		foreach ( $setting_values as $setting_id => $unsanitized_value ) {
2016
-			$setting = $this->get_setting( $setting_id );
2017
-			if ( ! $setting ) {
2018
-				if ( $options['validate_existence'] ) {
2019
-					$validities[ $setting_id ] = new WP_Error( 'unrecognized', __( 'Setting does not exist or is unrecognized.' ) );
2015
+		foreach ($setting_values as $setting_id => $unsanitized_value) {
2016
+			$setting = $this->get_setting($setting_id);
2017
+			if ( ! $setting) {
2018
+				if ($options['validate_existence']) {
2019
+					$validities[$setting_id] = new WP_Error('unrecognized', __('Setting does not exist or is unrecognized.'));
2020 2020
 				}
2021 2021
 				continue;
2022 2022
 			}
2023
-			if ( $options['validate_capability'] && ! current_user_can( $setting->capability ) ) {
2024
-				$validity = new WP_Error( 'unauthorized', __( 'Unauthorized to modify setting due to capability.' ) );
2023
+			if ($options['validate_capability'] && ! current_user_can($setting->capability)) {
2024
+				$validity = new WP_Error('unauthorized', __('Unauthorized to modify setting due to capability.'));
2025 2025
 			} else {
2026
-				if ( is_null( $unsanitized_value ) ) {
2026
+				if (is_null($unsanitized_value)) {
2027 2027
 					continue;
2028 2028
 				}
2029
-				$validity = $setting->validate( $unsanitized_value );
2029
+				$validity = $setting->validate($unsanitized_value);
2030 2030
 			}
2031
-			if ( ! is_wp_error( $validity ) ) {
2031
+			if ( ! is_wp_error($validity)) {
2032 2032
 				/** This filter is documented in wp-includes/class-wp-customize-setting.php */
2033
-				$late_validity = apply_filters( "customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting );
2034
-				if ( ! empty( $late_validity->errors ) ) {
2033
+				$late_validity = apply_filters("customize_validate_{$setting->id}", new WP_Error(), $unsanitized_value, $setting);
2034
+				if ( ! empty($late_validity->errors)) {
2035 2035
 					$validity = $late_validity;
2036 2036
 				}
2037 2037
 			}
2038
-			if ( ! is_wp_error( $validity ) ) {
2039
-				$value = $setting->sanitize( $unsanitized_value );
2040
-				if ( is_null( $value ) ) {
2038
+			if ( ! is_wp_error($validity)) {
2039
+				$value = $setting->sanitize($unsanitized_value);
2040
+				if (is_null($value)) {
2041 2041
 					$validity = false;
2042
-				} elseif ( is_wp_error( $value ) ) {
2042
+				} elseif (is_wp_error($value)) {
2043 2043
 					$validity = $value;
2044 2044
 				}
2045 2045
 			}
2046
-			if ( false === $validity ) {
2047
-				$validity = new WP_Error( 'invalid_value', __( 'Invalid value.' ) );
2046
+			if (false === $validity) {
2047
+				$validity = new WP_Error('invalid_value', __('Invalid value.'));
2048 2048
 			}
2049
-			$validities[ $setting_id ] = $validity;
2049
+			$validities[$setting_id] = $validity;
2050 2050
 		}
2051 2051
 		return $validities;
2052 2052
 	}
@@ -2065,13 +2065,13 @@  discard block
 block discarded – undo
2065 2065
 	 *                    to their respective `message` and `data` to pass into the
2066 2066
 	 *                    `wp.customize.Notification` JS model.
2067 2067
 	 */
2068
-	public function prepare_setting_validity_for_js( $validity ) {
2069
-		if ( is_wp_error( $validity ) ) {
2068
+	public function prepare_setting_validity_for_js($validity) {
2069
+		if (is_wp_error($validity)) {
2070 2070
 			$notification = array();
2071
-			foreach ( $validity->errors as $error_code => $error_messages ) {
2072
-				$notification[ $error_code ] = array(
2073
-					'message' => join( ' ', $error_messages ),
2074
-					'data' => $validity->get_error_data( $error_code ),
2071
+			foreach ($validity->errors as $error_code => $error_messages) {
2072
+				$notification[$error_code] = array(
2073
+					'message' => join(' ', $error_messages),
2074
+					'data' => $validity->get_error_data($error_code),
2075 2075
 				);
2076 2076
 			}
2077 2077
 			return $notification;
@@ -2087,34 +2087,34 @@  discard block
 block discarded – undo
2087 2087
 	 * @since 4.7.0 The semantics of this method have changed to update a changeset, optionally to also change the status and other attributes.
2088 2088
 	 */
2089 2089
 	public function save() {
2090
-		if ( ! is_user_logged_in() ) {
2091
-			wp_send_json_error( 'unauthenticated' );
2090
+		if ( ! is_user_logged_in()) {
2091
+			wp_send_json_error('unauthenticated');
2092 2092
 		}
2093 2093
 
2094
-		if ( ! $this->is_preview() ) {
2095
-			wp_send_json_error( 'not_preview' );
2094
+		if ( ! $this->is_preview()) {
2095
+			wp_send_json_error('not_preview');
2096 2096
 		}
2097 2097
 
2098
-		$action = 'save-customize_' . $this->get_stylesheet();
2099
-		if ( ! check_ajax_referer( $action, 'nonce', false ) ) {
2100
-			wp_send_json_error( 'invalid_nonce' );
2098
+		$action = 'save-customize_'.$this->get_stylesheet();
2099
+		if ( ! check_ajax_referer($action, 'nonce', false)) {
2100
+			wp_send_json_error('invalid_nonce');
2101 2101
 		}
2102 2102
 
2103 2103
 		$changeset_post_id = $this->changeset_post_id();
2104
-		if ( empty( $changeset_post_id ) ) {
2105
-			if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->create_posts ) ) {
2106
-				wp_send_json_error( 'cannot_create_changeset_post' );
2104
+		if (empty($changeset_post_id)) {
2105
+			if ( ! current_user_can(get_post_type_object('customize_changeset')->cap->create_posts)) {
2106
+				wp_send_json_error('cannot_create_changeset_post');
2107 2107
 			}
2108 2108
 		} else {
2109
-			if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) {
2110
-				wp_send_json_error( 'cannot_edit_changeset_post' );
2109
+			if ( ! current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $changeset_post_id)) {
2110
+				wp_send_json_error('cannot_edit_changeset_post');
2111 2111
 			}
2112 2112
 		}
2113 2113
 
2114
-		if ( ! empty( $_POST['customize_changeset_data'] ) ) {
2115
-			$input_changeset_data = json_decode( wp_unslash( $_POST['customize_changeset_data'] ), true );
2116
-			if ( ! is_array( $input_changeset_data ) ) {
2117
-				wp_send_json_error( 'invalid_customize_changeset_data' );
2114
+		if ( ! empty($_POST['customize_changeset_data'])) {
2115
+			$input_changeset_data = json_decode(wp_unslash($_POST['customize_changeset_data']), true);
2116
+			if ( ! is_array($input_changeset_data)) {
2117
+				wp_send_json_error('invalid_customize_changeset_data');
2118 2118
 			}
2119 2119
 		} else {
2120 2120
 			$input_changeset_data = array();
@@ -2122,21 +2122,21 @@  discard block
 block discarded – undo
2122 2122
 
2123 2123
 		// Validate title.
2124 2124
 		$changeset_title = null;
2125
-		if ( isset( $_POST['customize_changeset_title'] ) ) {
2126
-			$changeset_title = sanitize_text_field( wp_unslash( $_POST['customize_changeset_title'] ) );
2125
+		if (isset($_POST['customize_changeset_title'])) {
2126
+			$changeset_title = sanitize_text_field(wp_unslash($_POST['customize_changeset_title']));
2127 2127
 		}
2128 2128
 
2129 2129
 		// Validate changeset status param.
2130 2130
 		$is_publish = null;
2131 2131
 		$changeset_status = null;
2132
-		if ( isset( $_POST['customize_changeset_status'] ) ) {
2133
-			$changeset_status = wp_unslash( $_POST['customize_changeset_status'] );
2134
-			if ( ! get_post_status_object( $changeset_status ) || ! in_array( $changeset_status, array( 'draft', 'pending', 'publish', 'future' ), true ) ) {
2135
-				wp_send_json_error( 'bad_customize_changeset_status', 400 );
2132
+		if (isset($_POST['customize_changeset_status'])) {
2133
+			$changeset_status = wp_unslash($_POST['customize_changeset_status']);
2134
+			if ( ! get_post_status_object($changeset_status) || ! in_array($changeset_status, array('draft', 'pending', 'publish', 'future'), true)) {
2135
+				wp_send_json_error('bad_customize_changeset_status', 400);
2136 2136
 			}
2137
-			$is_publish = ( 'publish' === $changeset_status || 'future' === $changeset_status );
2138
-			if ( $is_publish && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->publish_posts ) ) {
2139
-				wp_send_json_error( 'changeset_publish_unauthorized', 403 );
2137
+			$is_publish = ('publish' === $changeset_status || 'future' === $changeset_status);
2138
+			if ($is_publish && ! current_user_can(get_post_type_object('customize_changeset')->cap->publish_posts)) {
2139
+				wp_send_json_error('changeset_publish_unauthorized', 403);
2140 2140
 			}
2141 2141
 		}
2142 2142
 
@@ -2147,39 +2147,39 @@  discard block
 block discarded – undo
2147 2147
 		 * or a string like "+10 minutes".
2148 2148
 		 */
2149 2149
 		$changeset_date_gmt = null;
2150
-		if ( isset( $_POST['customize_changeset_date'] ) ) {
2151
-			$changeset_date = wp_unslash( $_POST['customize_changeset_date'] );
2152
-			if ( preg_match( '/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date ) ) {
2153
-				$mm = substr( $changeset_date, 5, 2 );
2154
-				$jj = substr( $changeset_date, 8, 2 );
2155
-				$aa = substr( $changeset_date, 0, 4 );
2156
-				$valid_date = wp_checkdate( $mm, $jj, $aa, $changeset_date );
2157
-				if ( ! $valid_date ) {
2158
-					wp_send_json_error( 'bad_customize_changeset_date', 400 );
2150
+		if (isset($_POST['customize_changeset_date'])) {
2151
+			$changeset_date = wp_unslash($_POST['customize_changeset_date']);
2152
+			if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d$/', $changeset_date)) {
2153
+				$mm = substr($changeset_date, 5, 2);
2154
+				$jj = substr($changeset_date, 8, 2);
2155
+				$aa = substr($changeset_date, 0, 4);
2156
+				$valid_date = wp_checkdate($mm, $jj, $aa, $changeset_date);
2157
+				if ( ! $valid_date) {
2158
+					wp_send_json_error('bad_customize_changeset_date', 400);
2159 2159
 				}
2160
-				$changeset_date_gmt = get_gmt_from_date( $changeset_date );
2160
+				$changeset_date_gmt = get_gmt_from_date($changeset_date);
2161 2161
 			} else {
2162
-				$timestamp = strtotime( $changeset_date );
2163
-				if ( ! $timestamp ) {
2164
-					wp_send_json_error( 'bad_customize_changeset_date', 400 );
2162
+				$timestamp = strtotime($changeset_date);
2163
+				if ( ! $timestamp) {
2164
+					wp_send_json_error('bad_customize_changeset_date', 400);
2165 2165
 				}
2166
-				$changeset_date_gmt = gmdate( 'Y-m-d H:i:s', $timestamp );
2166
+				$changeset_date_gmt = gmdate('Y-m-d H:i:s', $timestamp);
2167 2167
 			}
2168 2168
 		}
2169 2169
 
2170
-		$r = $this->save_changeset_post( array(
2170
+		$r = $this->save_changeset_post(array(
2171 2171
 			'status' => $changeset_status,
2172 2172
 			'title' => $changeset_title,
2173 2173
 			'date_gmt' => $changeset_date_gmt,
2174 2174
 			'data' => $input_changeset_data,
2175
-		) );
2176
-		if ( is_wp_error( $r ) ) {
2175
+		));
2176
+		if (is_wp_error($r)) {
2177 2177
 			$response = array(
2178 2178
 				'message' => $r->get_error_message(),
2179 2179
 				'code' => $r->get_error_code(),
2180 2180
 			);
2181
-			if ( is_array( $r->get_error_data() ) ) {
2182
-				$response = array_merge( $response, $r->get_error_data() );
2181
+			if (is_array($r->get_error_data())) {
2182
+				$response = array_merge($response, $r->get_error_data());
2183 2183
 			} else {
2184 2184
 				$response['data'] = $r->get_error_data();
2185 2185
 			}
@@ -2187,18 +2187,18 @@  discard block
 block discarded – undo
2187 2187
 			$response = $r;
2188 2188
 
2189 2189
 			// Note that if the changeset status was publish, then it will get set to trash if revisions are not supported.
2190
-			$response['changeset_status'] = get_post_status( $this->changeset_post_id() );
2191
-			if ( $is_publish && 'trash' === $response['changeset_status'] ) {
2190
+			$response['changeset_status'] = get_post_status($this->changeset_post_id());
2191
+			if ($is_publish && 'trash' === $response['changeset_status']) {
2192 2192
 				$response['changeset_status'] = 'publish';
2193 2193
 			}
2194 2194
 
2195
-			if ( 'publish' === $response['changeset_status'] ) {
2195
+			if ('publish' === $response['changeset_status']) {
2196 2196
 				$response['next_changeset_uuid'] = wp_generate_uuid4();
2197 2197
 			}
2198 2198
 		}
2199 2199
 
2200
-		if ( isset( $response['setting_validities'] ) ) {
2201
-			$response['setting_validities'] = array_map( array( $this, 'prepare_setting_validity_for_js' ), $response['setting_validities'] );
2200
+		if (isset($response['setting_validities'])) {
2201
+			$response['setting_validities'] = array_map(array($this, 'prepare_setting_validity_for_js'), $response['setting_validities']);
2202 2202
 		}
2203 2203
 
2204 2204
 		/**
@@ -2212,12 +2212,12 @@  discard block
 block discarded – undo
2212 2212
 		 *                                       event on `wp.customize`.
2213 2213
 		 * @param WP_Customize_Manager $this     WP_Customize_Manager instance.
2214 2214
 		 */
2215
-		$response = apply_filters( 'customize_save_response', $response, $this );
2215
+		$response = apply_filters('customize_save_response', $response, $this);
2216 2216
 
2217
-		if ( is_wp_error( $r ) ) {
2218
-			wp_send_json_error( $response );
2217
+		if (is_wp_error($r)) {
2218
+			wp_send_json_error($response);
2219 2219
 		} else {
2220
-			wp_send_json_success( $response );
2220
+			wp_send_json_success($response);
2221 2221
 		}
2222 2222
 	}
2223 2223
 
@@ -2240,7 +2240,7 @@  discard block
 block discarded – undo
2240 2240
 	 *
2241 2241
 	 * @return array|WP_Error Returns array on success and WP_Error with array data on error.
2242 2242
 	 */
2243
-	function save_changeset_post( $args = array() ) {
2243
+	function save_changeset_post($args = array()) {
2244 2244
 
2245 2245
 		$args = array_merge(
2246 2246
 			array(
@@ -2256,41 +2256,41 @@  discard block
 block discarded – undo
2256 2256
 
2257 2257
 		$changeset_post_id = $this->changeset_post_id();
2258 2258
 		$existing_changeset_data = array();
2259
-		if ( $changeset_post_id ) {
2260
-			$existing_status = get_post_status( $changeset_post_id );
2261
-			if ( 'publish' === $existing_status || 'trash' === $existing_status ) {
2262
-				return new WP_Error( 'changeset_already_published' );
2259
+		if ($changeset_post_id) {
2260
+			$existing_status = get_post_status($changeset_post_id);
2261
+			if ('publish' === $existing_status || 'trash' === $existing_status) {
2262
+				return new WP_Error('changeset_already_published');
2263 2263
 			}
2264 2264
 
2265
-			$existing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2265
+			$existing_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2266 2266
 		}
2267 2267
 
2268 2268
 		// Fail if attempting to publish but publish hook is missing.
2269
-		if ( 'publish' === $args['status'] && false === has_action( 'transition_post_status', '_wp_customize_publish_changeset' ) ) {
2270
-			return new WP_Error( 'missing_publish_callback' );
2269
+		if ('publish' === $args['status'] && false === has_action('transition_post_status', '_wp_customize_publish_changeset')) {
2270
+			return new WP_Error('missing_publish_callback');
2271 2271
 		}
2272 2272
 
2273 2273
 		// Validate date.
2274
-		$now = gmdate( 'Y-m-d H:i:59' );
2275
-		if ( $args['date_gmt'] ) {
2276
-			$is_future_dated = ( mysql2date( 'U', $args['date_gmt'], false ) > mysql2date( 'U', $now, false ) );
2277
-			if ( ! $is_future_dated ) {
2278
-				return new WP_Error( 'not_future_date' ); // Only future dates are allowed.
2274
+		$now = gmdate('Y-m-d H:i:59');
2275
+		if ($args['date_gmt']) {
2276
+			$is_future_dated = (mysql2date('U', $args['date_gmt'], false) > mysql2date('U', $now, false));
2277
+			if ( ! $is_future_dated) {
2278
+				return new WP_Error('not_future_date'); // Only future dates are allowed.
2279 2279
 			}
2280 2280
 
2281
-			if ( ! $this->is_theme_active() && ( 'future' === $args['status'] || $is_future_dated ) ) {
2282
-				return new WP_Error( 'cannot_schedule_theme_switches' ); // This should be allowed in the future, when theme is a regular setting.
2281
+			if ( ! $this->is_theme_active() && ('future' === $args['status'] || $is_future_dated)) {
2282
+				return new WP_Error('cannot_schedule_theme_switches'); // This should be allowed in the future, when theme is a regular setting.
2283 2283
 			}
2284
-			$will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status( $changeset_post_id ) ) );
2285
-			if ( $will_remain_auto_draft ) {
2286
-				return new WP_Error( 'cannot_supply_date_for_auto_draft_changeset' );
2284
+			$will_remain_auto_draft = ( ! $args['status'] && ( ! $changeset_post_id || 'auto-draft' === get_post_status($changeset_post_id)));
2285
+			if ($will_remain_auto_draft) {
2286
+				return new WP_Error('cannot_supply_date_for_auto_draft_changeset');
2287 2287
 			}
2288
-		} elseif ( $changeset_post_id && 'future' === $args['status'] ) {
2288
+		} elseif ($changeset_post_id && 'future' === $args['status']) {
2289 2289
 
2290 2290
 			// Fail if the new status is future but the existing post's date is not in the future.
2291
-			$changeset_post = get_post( $changeset_post_id );
2292
-			if ( mysql2date( 'U', $changeset_post->post_date_gmt, false ) <= mysql2date( 'U', $now, false ) ) {
2293
-				return new WP_Error( 'not_future_date' );
2291
+			$changeset_post = get_post($changeset_post_id);
2292
+			if (mysql2date('U', $changeset_post->post_date_gmt, false) <= mysql2date('U', $now, false)) {
2293
+				return new WP_Error('not_future_date');
2294 2294
 			}
2295 2295
 		}
2296 2296
 
@@ -2299,18 +2299,18 @@  discard block
 block discarded – undo
2299 2299
 		$allow_revision = (bool) $args['status'];
2300 2300
 
2301 2301
 		// Amend post values with any supplied data.
2302
-		foreach ( $args['data'] as $setting_id => $setting_params ) {
2303
-			if ( array_key_exists( 'value', $setting_params ) ) {
2304
-				$this->set_post_value( $setting_id, $setting_params['value'] ); // Add to post values so that they can be validated and sanitized.
2302
+		foreach ($args['data'] as $setting_id => $setting_params) {
2303
+			if (array_key_exists('value', $setting_params)) {
2304
+				$this->set_post_value($setting_id, $setting_params['value']); // Add to post values so that they can be validated and sanitized.
2305 2305
 			}
2306 2306
 		}
2307 2307
 
2308 2308
 		// Note that in addition to post data, this will include any stashed theme mods.
2309
-		$post_values = $this->unsanitized_post_values( array(
2309
+		$post_values = $this->unsanitized_post_values(array(
2310 2310
 			'exclude_changeset' => true,
2311 2311
 			'exclude_post_data' => false,
2312
-		) );
2313
-		$this->add_dynamic_settings( array_keys( $post_values ) ); // Ensure settings get created even if they lack an input value.
2312
+		));
2313
+		$this->add_dynamic_settings(array_keys($post_values)); // Ensure settings get created even if they lack an input value.
2314 2314
 
2315 2315
 		/*
2316 2316
 		 * Get list of IDs for settings that have values different from what is currently
@@ -2321,23 +2321,23 @@  discard block
 block discarded – undo
2321 2321
 		 * previous saved settings and overriding the associated user_id if they made no change.
2322 2322
 		 */
2323 2323
 		$changed_setting_ids = array();
2324
-		foreach ( $post_values as $setting_id => $setting_value ) {
2325
-			$setting = $this->get_setting( $setting_id );
2324
+		foreach ($post_values as $setting_id => $setting_value) {
2325
+			$setting = $this->get_setting($setting_id);
2326 2326
 
2327
-			if ( $setting && 'theme_mod' === $setting->type ) {
2328
-				$prefixed_setting_id = $this->get_stylesheet() . '::' . $setting->id;
2327
+			if ($setting && 'theme_mod' === $setting->type) {
2328
+				$prefixed_setting_id = $this->get_stylesheet().'::'.$setting->id;
2329 2329
 			} else {
2330 2330
 				$prefixed_setting_id = $setting_id;
2331 2331
 			}
2332 2332
 
2333 2333
 			$is_value_changed = (
2334
-				! isset( $existing_changeset_data[ $prefixed_setting_id ] )
2334
+				! isset($existing_changeset_data[$prefixed_setting_id])
2335 2335
 				||
2336
-				! array_key_exists( 'value', $existing_changeset_data[ $prefixed_setting_id ] )
2336
+				! array_key_exists('value', $existing_changeset_data[$prefixed_setting_id])
2337 2337
 				||
2338
-				$existing_changeset_data[ $prefixed_setting_id ]['value'] !== $setting_value
2338
+				$existing_changeset_data[$prefixed_setting_id]['value'] !== $setting_value
2339 2339
 			);
2340
-			if ( $is_value_changed ) {
2340
+			if ($is_value_changed) {
2341 2341
 				$changed_setting_ids[] = $setting_id;
2342 2342
 			}
2343 2343
 		}
@@ -2353,82 +2353,82 @@  discard block
 block discarded – undo
2353 2353
 		 *
2354 2354
 		 * @param WP_Customize_Manager $this WP_Customize_Manager instance.
2355 2355
 		 */
2356
-		do_action( 'customize_save_validation_before', $this );
2356
+		do_action('customize_save_validation_before', $this);
2357 2357
 
2358 2358
 		// Validate settings.
2359 2359
 		$validated_values = array_merge(
2360
-			array_fill_keys( array_keys( $args['data'] ), null ), // Make sure existence/capability checks are done on value-less setting updates.
2360
+			array_fill_keys(array_keys($args['data']), null), // Make sure existence/capability checks are done on value-less setting updates.
2361 2361
 			$post_values
2362 2362
 		);
2363
-		$setting_validities = $this->validate_setting_values( $validated_values, array(
2363
+		$setting_validities = $this->validate_setting_values($validated_values, array(
2364 2364
 			'validate_capability' => true,
2365 2365
 			'validate_existence' => true,
2366
-		) );
2367
-		$invalid_setting_count = count( array_filter( $setting_validities, 'is_wp_error' ) );
2366
+		));
2367
+		$invalid_setting_count = count(array_filter($setting_validities, 'is_wp_error'));
2368 2368
 
2369 2369
 		/*
2370 2370
 		 * Short-circuit if there are invalid settings the update is transactional.
2371 2371
 		 * A changeset update is transactional when a status is supplied in the request.
2372 2372
 		 */
2373
-		if ( $update_transactionally && $invalid_setting_count > 0 ) {
2373
+		if ($update_transactionally && $invalid_setting_count > 0) {
2374 2374
 			$response = array(
2375 2375
 				'setting_validities' => $setting_validities,
2376
-				'message' => sprintf( _n( 'There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count ), number_format_i18n( $invalid_setting_count ) ),
2376
+				'message' => sprintf(_n('There is %s invalid setting.', 'There are %s invalid settings.', $invalid_setting_count), number_format_i18n($invalid_setting_count)),
2377 2377
 			);
2378
-			return new WP_Error( 'transaction_fail', '', $response );
2378
+			return new WP_Error('transaction_fail', '', $response);
2379 2379
 		}
2380 2380
 
2381 2381
 		// Obtain/merge data for changeset.
2382
-		$original_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2382
+		$original_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2383 2383
 		$data = $original_changeset_data;
2384
-		if ( is_wp_error( $data ) ) {
2384
+		if (is_wp_error($data)) {
2385 2385
 			$data = array();
2386 2386
 		}
2387 2387
 
2388 2388
 		// Ensure that all post values are included in the changeset data.
2389
-		foreach ( $post_values as $setting_id => $post_value ) {
2390
-			if ( ! isset( $args['data'][ $setting_id ] ) ) {
2391
-				$args['data'][ $setting_id ] = array();
2389
+		foreach ($post_values as $setting_id => $post_value) {
2390
+			if ( ! isset($args['data'][$setting_id])) {
2391
+				$args['data'][$setting_id] = array();
2392 2392
 			}
2393
-			if ( ! isset( $args['data'][ $setting_id ]['value'] ) ) {
2394
-				$args['data'][ $setting_id ]['value'] = $post_value;
2393
+			if ( ! isset($args['data'][$setting_id]['value'])) {
2394
+				$args['data'][$setting_id]['value'] = $post_value;
2395 2395
 			}
2396 2396
 		}
2397 2397
 
2398
-		foreach ( $args['data'] as $setting_id => $setting_params ) {
2399
-			$setting = $this->get_setting( $setting_id );
2400
-			if ( ! $setting || ! $setting->check_capabilities() ) {
2398
+		foreach ($args['data'] as $setting_id => $setting_params) {
2399
+			$setting = $this->get_setting($setting_id);
2400
+			if ( ! $setting || ! $setting->check_capabilities()) {
2401 2401
 				continue;
2402 2402
 			}
2403 2403
 
2404 2404
 			// Skip updating changeset for invalid setting values.
2405
-			if ( isset( $setting_validities[ $setting_id ] ) && is_wp_error( $setting_validities[ $setting_id ] ) ) {
2405
+			if (isset($setting_validities[$setting_id]) && is_wp_error($setting_validities[$setting_id])) {
2406 2406
 				continue;
2407 2407
 			}
2408 2408
 
2409 2409
 			$changeset_setting_id = $setting_id;
2410
-			if ( 'theme_mod' === $setting->type ) {
2411
-				$changeset_setting_id = sprintf( '%s::%s', $this->get_stylesheet(), $setting_id );
2410
+			if ('theme_mod' === $setting->type) {
2411
+				$changeset_setting_id = sprintf('%s::%s', $this->get_stylesheet(), $setting_id);
2412 2412
 			}
2413 2413
 
2414
-			if ( null === $setting_params ) {
2414
+			if (null === $setting_params) {
2415 2415
 				// Remove setting from changeset entirely.
2416
-				unset( $data[ $changeset_setting_id ] );
2416
+				unset($data[$changeset_setting_id]);
2417 2417
 			} else {
2418 2418
 
2419
-				if ( ! isset( $data[ $changeset_setting_id ] ) ) {
2420
-					$data[ $changeset_setting_id ] = array();
2419
+				if ( ! isset($data[$changeset_setting_id])) {
2420
+					$data[$changeset_setting_id] = array();
2421 2421
 				}
2422 2422
 
2423 2423
 				// Merge any additional setting params that have been supplied with the existing params.
2424
-				$merged_setting_params = array_merge( $data[ $changeset_setting_id ], $setting_params );
2424
+				$merged_setting_params = array_merge($data[$changeset_setting_id], $setting_params);
2425 2425
 
2426 2426
 				// Skip updating setting params if unchanged (ensuring the user_id is not overwritten).
2427
-				if ( $data[ $changeset_setting_id ] === $merged_setting_params ) {
2427
+				if ($data[$changeset_setting_id] === $merged_setting_params) {
2428 2428
 					continue;
2429 2429
 				}
2430 2430
 
2431
-				$data[ $changeset_setting_id ] = array_merge(
2431
+				$data[$changeset_setting_id] = array_merge(
2432 2432
 					$merged_setting_params,
2433 2433
 					array(
2434 2434
 						'type' => $setting->type,
@@ -2437,8 +2437,8 @@  discard block
 block discarded – undo
2437 2437
 				);
2438 2438
 
2439 2439
 				// Clear starter_content flag in data if changeset is not explicitly being updated for starter content.
2440
-				if ( empty( $args['starter_content'] ) ) {
2441
-					unset( $data[ $changeset_setting_id ]['starter_content'] );
2440
+				if (empty($args['starter_content'])) {
2441
+					unset($data[$changeset_setting_id]['starter_content']);
2442 2442
 				}
2443 2443
 			}
2444 2444
 		}
@@ -2449,7 +2449,7 @@  discard block
 block discarded – undo
2449 2449
 			'status' => $args['status'],
2450 2450
 			'date_gmt' => $args['date_gmt'],
2451 2451
 			'post_id' => $changeset_post_id,
2452
-			'previous_data' => is_wp_error( $original_changeset_data ) ? array() : $original_changeset_data,
2452
+			'previous_data' => is_wp_error($original_changeset_data) ? array() : $original_changeset_data,
2453 2453
 			'manager' => $this,
2454 2454
 		);
2455 2455
 
@@ -2473,90 +2473,90 @@  discard block
 block discarded – undo
2473 2473
 		 *     @type WP_Customize_Manager $manager       Manager instance.
2474 2474
 		 * }
2475 2475
 		 */
2476
-		$data = apply_filters( 'customize_changeset_save_data', $data, $filter_context );
2476
+		$data = apply_filters('customize_changeset_save_data', $data, $filter_context);
2477 2477
 
2478 2478
 		// Switch theme if publishing changes now.
2479
-		if ( 'publish' === $args['status'] && ! $this->is_theme_active() ) {
2479
+		if ('publish' === $args['status'] && ! $this->is_theme_active()) {
2480 2480
 			// Temporarily stop previewing the theme to allow switch_themes() to operate properly.
2481 2481
 			$this->stop_previewing_theme();
2482
-			switch_theme( $this->get_stylesheet() );
2483
-			update_option( 'theme_switched_via_customizer', true );
2482
+			switch_theme($this->get_stylesheet());
2483
+			update_option('theme_switched_via_customizer', true);
2484 2484
 			$this->start_previewing_theme();
2485 2485
 		}
2486 2486
 
2487 2487
 		// Gather the data for wp_insert_post()/wp_update_post().
2488 2488
 		$json_options = 0;
2489
-		if ( defined( 'JSON_UNESCAPED_SLASHES' ) ) {
2489
+		if (defined('JSON_UNESCAPED_SLASHES')) {
2490 2490
 			$json_options |= JSON_UNESCAPED_SLASHES; // Introduced in PHP 5.4. This is only to improve readability as slashes needn't be escaped in storage.
2491 2491
 		}
2492 2492
 		$json_options |= JSON_PRETTY_PRINT; // Also introduced in PHP 5.4, but WP defines constant for back compat. See WP Trac #30139.
2493 2493
 		$post_array = array(
2494
-			'post_content' => wp_json_encode( $data, $json_options ),
2494
+			'post_content' => wp_json_encode($data, $json_options),
2495 2495
 		);
2496
-		if ( $args['title'] ) {
2496
+		if ($args['title']) {
2497 2497
 			$post_array['post_title'] = $args['title'];
2498 2498
 		}
2499
-		if ( $changeset_post_id ) {
2499
+		if ($changeset_post_id) {
2500 2500
 			$post_array['ID'] = $changeset_post_id;
2501 2501
 		} else {
2502 2502
 			$post_array['post_type'] = 'customize_changeset';
2503 2503
 			$post_array['post_name'] = $this->changeset_uuid();
2504 2504
 			$post_array['post_status'] = 'auto-draft';
2505 2505
 		}
2506
-		if ( $args['status'] ) {
2506
+		if ($args['status']) {
2507 2507
 			$post_array['post_status'] = $args['status'];
2508 2508
 		}
2509 2509
 
2510 2510
 		// Reset post date to now if we are publishing, otherwise pass post_date_gmt and translate for post_date.
2511
-		if ( 'publish' === $args['status'] ) {
2511
+		if ('publish' === $args['status']) {
2512 2512
 			$post_array['post_date_gmt'] = '0000-00-00 00:00:00';
2513 2513
 			$post_array['post_date'] = '0000-00-00 00:00:00';
2514
-		} elseif ( $args['date_gmt'] ) {
2514
+		} elseif ($args['date_gmt']) {
2515 2515
 			$post_array['post_date_gmt'] = $args['date_gmt'];
2516
-			$post_array['post_date'] = get_date_from_gmt( $args['date_gmt'] );
2517
-		} elseif ( $changeset_post_id && 'auto-draft' === get_post_status( $changeset_post_id ) ) {
2516
+			$post_array['post_date'] = get_date_from_gmt($args['date_gmt']);
2517
+		} elseif ($changeset_post_id && 'auto-draft' === get_post_status($changeset_post_id)) {
2518 2518
 			/*
2519 2519
 			 * Keep bumping the date for the auto-draft whenever it is modified;
2520 2520
 			 * this extends its life, preserving it from garbage-collection via
2521 2521
 			 * wp_delete_auto_drafts().
2522 2522
 			 */
2523
-			$post_array['post_date'] = current_time( 'mysql' );
2523
+			$post_array['post_date'] = current_time('mysql');
2524 2524
 			$post_array['post_date_gmt'] = '';
2525 2525
 		}
2526 2526
 
2527 2527
 		$this->store_changeset_revision = $allow_revision;
2528
-		add_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ), 5, 3 );
2528
+		add_filter('wp_save_post_revision_post_has_changed', array($this, '_filter_revision_post_has_changed'), 5, 3);
2529 2529
 
2530 2530
 		// Update the changeset post. The publish_customize_changeset action will cause the settings in the changeset to be saved via WP_Customize_Setting::save().
2531
-		$has_kses = ( false !== has_filter( 'content_save_pre', 'wp_filter_post_kses' ) );
2532
-		if ( $has_kses ) {
2531
+		$has_kses = (false !== has_filter('content_save_pre', 'wp_filter_post_kses'));
2532
+		if ($has_kses) {
2533 2533
 			kses_remove_filters(); // Prevent KSES from corrupting JSON in post_content.
2534 2534
 		}
2535 2535
 
2536 2536
 		// Note that updating a post with publish status will trigger WP_Customize_Manager::publish_changeset_values().
2537
-		if ( $changeset_post_id ) {
2537
+		if ($changeset_post_id) {
2538 2538
 			$post_array['edit_date'] = true; // Prevent date clearing.
2539
-			$r = wp_update_post( wp_slash( $post_array ), true );
2539
+			$r = wp_update_post(wp_slash($post_array), true);
2540 2540
 		} else {
2541
-			$r = wp_insert_post( wp_slash( $post_array ), true );
2542
-			if ( ! is_wp_error( $r ) ) {
2541
+			$r = wp_insert_post(wp_slash($post_array), true);
2542
+			if ( ! is_wp_error($r)) {
2543 2543
 				$this->_changeset_post_id = $r; // Update cached post ID for the loaded changeset.
2544 2544
 			}
2545 2545
 		}
2546
-		if ( $has_kses ) {
2546
+		if ($has_kses) {
2547 2547
 			kses_init_filters();
2548 2548
 		}
2549 2549
 		$this->_changeset_data = null; // Reset so WP_Customize_Manager::changeset_data() will re-populate with updated contents.
2550 2550
 
2551
-		remove_filter( 'wp_save_post_revision_post_has_changed', array( $this, '_filter_revision_post_has_changed' ) );
2551
+		remove_filter('wp_save_post_revision_post_has_changed', array($this, '_filter_revision_post_has_changed'));
2552 2552
 
2553 2553
 		$response = array(
2554 2554
 			'setting_validities' => $setting_validities,
2555 2555
 		);
2556 2556
 
2557
-		if ( is_wp_error( $r ) ) {
2557
+		if (is_wp_error($r)) {
2558 2558
 			$response['changeset_post_save_failure'] = $r->get_error_code();
2559
-			return new WP_Error( 'changeset_post_save_failure', '', $response );
2559
+			return new WP_Error('changeset_post_save_failure', '', $response);
2560 2560
 		}
2561 2561
 
2562 2562
 		return $response;
@@ -2585,9 +2585,9 @@  discard block
 block discarded – undo
2585 2585
 	 *
2586 2586
 	 * @return bool Whether a revision should be made.
2587 2587
 	 */
2588
-	public function _filter_revision_post_has_changed( $post_has_changed, $last_revision, $post ) {
2589
-		unset( $last_revision );
2590
-		if ( 'customize_changeset' === $post->post_type ) {
2588
+	public function _filter_revision_post_has_changed($post_has_changed, $last_revision, $post) {
2589
+		unset($last_revision);
2590
+		if ('customize_changeset' === $post->post_type) {
2591 2591
 			$post_has_changed = $this->store_changeset_revision;
2592 2592
 		}
2593 2593
 		return $post_has_changed;
@@ -2613,13 +2613,13 @@  discard block
 block discarded – undo
2613 2613
 	 * @param int $changeset_post_id ID for customize_changeset post. Defaults to the changeset for the current manager instance.
2614 2614
 	 * @return true|WP_Error True or error info.
2615 2615
 	 */
2616
-	public function _publish_changeset_values( $changeset_post_id ) {
2617
-		$publishing_changeset_data = $this->get_changeset_post_data( $changeset_post_id );
2618
-		if ( is_wp_error( $publishing_changeset_data ) ) {
2616
+	public function _publish_changeset_values($changeset_post_id) {
2617
+		$publishing_changeset_data = $this->get_changeset_post_data($changeset_post_id);
2618
+		if (is_wp_error($publishing_changeset_data)) {
2619 2619
 			return $publishing_changeset_data;
2620 2620
 		}
2621 2621
 
2622
-		$changeset_post = get_post( $changeset_post_id );
2622
+		$changeset_post = get_post($changeset_post_id);
2623 2623
 
2624 2624
 		/*
2625 2625
 		 * Temporarily override the changeset context so that it will be read
@@ -2638,24 +2638,24 @@  discard block
 block discarded – undo
2638 2638
 		$theme_mod_settings = array();
2639 2639
 		$namespace_pattern = '/^(?P<stylesheet>.+?)::(?P<setting_id>.+)$/';
2640 2640
 		$matches = array();
2641
-		foreach ( $this->_changeset_data as $raw_setting_id => $setting_params ) {
2641
+		foreach ($this->_changeset_data as $raw_setting_id => $setting_params) {
2642 2642
 			$actual_setting_id = null;
2643 2643
 			$is_theme_mod_setting = (
2644
-				isset( $setting_params['value'] )
2644
+				isset($setting_params['value'])
2645 2645
 				&&
2646
-				isset( $setting_params['type'] )
2646
+				isset($setting_params['type'])
2647 2647
 				&&
2648 2648
 				'theme_mod' === $setting_params['type']
2649 2649
 				&&
2650
-				preg_match( $namespace_pattern, $raw_setting_id, $matches )
2650
+				preg_match($namespace_pattern, $raw_setting_id, $matches)
2651 2651
 			);
2652
-			if ( $is_theme_mod_setting ) {
2653
-				if ( ! isset( $theme_mod_settings[ $matches['stylesheet'] ] ) ) {
2654
-					$theme_mod_settings[ $matches['stylesheet'] ] = array();
2652
+			if ($is_theme_mod_setting) {
2653
+				if ( ! isset($theme_mod_settings[$matches['stylesheet']])) {
2654
+					$theme_mod_settings[$matches['stylesheet']] = array();
2655 2655
 				}
2656
-				$theme_mod_settings[ $matches['stylesheet'] ][ $matches['setting_id'] ] = $setting_params;
2656
+				$theme_mod_settings[$matches['stylesheet']][$matches['setting_id']] = $setting_params;
2657 2657
 
2658
-				if ( $this->get_stylesheet() === $matches['stylesheet'] ) {
2658
+				if ($this->get_stylesheet() === $matches['stylesheet']) {
2659 2659
 					$actual_setting_id = $matches['setting_id'];
2660 2660
 				}
2661 2661
 			} else {
@@ -2663,17 +2663,17 @@  discard block
 block discarded – undo
2663 2663
 			}
2664 2664
 
2665 2665
 			// Keep track of the user IDs for settings actually for this theme.
2666
-			if ( $actual_setting_id && isset( $setting_params['user_id'] ) ) {
2667
-				$setting_user_ids[ $actual_setting_id ] = $setting_params['user_id'];
2666
+			if ($actual_setting_id && isset($setting_params['user_id'])) {
2667
+				$setting_user_ids[$actual_setting_id] = $setting_params['user_id'];
2668 2668
 			}
2669 2669
 		}
2670 2670
 
2671
-		$changeset_setting_values = $this->unsanitized_post_values( array(
2671
+		$changeset_setting_values = $this->unsanitized_post_values(array(
2672 2672
 			'exclude_post_data' => true,
2673 2673
 			'exclude_changeset' => false,
2674
-		) );
2675
-		$changeset_setting_ids = array_keys( $changeset_setting_values );
2676
-		$this->add_dynamic_settings( $changeset_setting_ids );
2674
+		));
2675
+		$changeset_setting_ids = array_keys($changeset_setting_values);
2676
+		$this->add_dynamic_settings($changeset_setting_ids);
2677 2677
 
2678 2678
 		/**
2679 2679
 		 * Fires once the theme has switched in the Customizer, but before settings
@@ -2683,7 +2683,7 @@  discard block
 block discarded – undo
2683 2683
 		 *
2684 2684
 		 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
2685 2685
 		 */
2686
-		do_action( 'customize_save', $this );
2686
+		do_action('customize_save', $this);
2687 2687
 
2688 2688
 		/*
2689 2689
 		 * Ensure that all settings will allow themselves to be saved. Note that
@@ -2692,18 +2692,18 @@  discard block
 block discarded – undo
2692 2692
 		 * an additional capability check is not required here.
2693 2693
 		 */
2694 2694
 		$original_setting_capabilities = array();
2695
-		foreach ( $changeset_setting_ids as $setting_id ) {
2696
-			$setting = $this->get_setting( $setting_id );
2697
-			if ( $setting && ! isset( $setting_user_ids[ $setting_id ] ) ) {
2698
-				$original_setting_capabilities[ $setting->id ] = $setting->capability;
2695
+		foreach ($changeset_setting_ids as $setting_id) {
2696
+			$setting = $this->get_setting($setting_id);
2697
+			if ($setting && ! isset($setting_user_ids[$setting_id])) {
2698
+				$original_setting_capabilities[$setting->id] = $setting->capability;
2699 2699
 				$setting->capability = 'exist';
2700 2700
 			}
2701 2701
 		}
2702 2702
 
2703 2703
 		$original_user_id = get_current_user_id();
2704
-		foreach ( $changeset_setting_ids as $setting_id ) {
2705
-			$setting = $this->get_setting( $setting_id );
2706
-			if ( $setting ) {
2704
+		foreach ($changeset_setting_ids as $setting_id) {
2705
+			$setting = $this->get_setting($setting_id);
2706
+			if ($setting) {
2707 2707
 				/*
2708 2708
 				 * Set the current user to match the user who saved the value into
2709 2709
 				 * the changeset so that any filters that apply during the save
@@ -2711,22 +2711,22 @@  discard block
 block discarded – undo
2711 2711
 				 * will ensure, for example, that KSES won't strip unsafe HTML
2712 2712
 				 * when a scheduled changeset publishes via WP Cron.
2713 2713
 				 */
2714
-				if ( isset( $setting_user_ids[ $setting_id ] ) ) {
2715
-					wp_set_current_user( $setting_user_ids[ $setting_id ] );
2714
+				if (isset($setting_user_ids[$setting_id])) {
2715
+					wp_set_current_user($setting_user_ids[$setting_id]);
2716 2716
 				} else {
2717
-					wp_set_current_user( $original_user_id );
2717
+					wp_set_current_user($original_user_id);
2718 2718
 				}
2719 2719
 
2720 2720
 				$setting->save();
2721 2721
 			}
2722 2722
 		}
2723
-		wp_set_current_user( $original_user_id );
2723
+		wp_set_current_user($original_user_id);
2724 2724
 
2725 2725
 		// Update the stashed theme mod settings, removing the active theme's stashed settings, if activated.
2726
-		if ( did_action( 'switch_theme' ) ) {
2726
+		if (did_action('switch_theme')) {
2727 2727
 			$other_theme_mod_settings = $theme_mod_settings;
2728
-			unset( $other_theme_mod_settings[ $this->get_stylesheet() ] );
2729
-			$this->update_stashed_theme_mod_settings( $other_theme_mod_settings );
2728
+			unset($other_theme_mod_settings[$this->get_stylesheet()]);
2729
+			$this->update_stashed_theme_mod_settings($other_theme_mod_settings);
2730 2730
 		}
2731 2731
 
2732 2732
 		/**
@@ -2736,12 +2736,12 @@  discard block
 block discarded – undo
2736 2736
 		 *
2737 2737
 		 * @param WP_Customize_Manager $manager WP_Customize_Manager instance.
2738 2738
 		 */
2739
-		do_action( 'customize_save_after', $this );
2739
+		do_action('customize_save_after', $this);
2740 2740
 
2741 2741
 		// Restore original capabilities.
2742
-		foreach ( $original_setting_capabilities as $setting_id => $capability ) {
2743
-			$setting = $this->get_setting( $setting_id );
2744
-			if ( $setting ) {
2742
+		foreach ($original_setting_capabilities as $setting_id => $capability) {
2743
+			$setting = $this->get_setting($setting_id);
2744
+			if ($setting) {
2745 2745
 				$setting->capability = $capability;
2746 2746
 			}
2747 2747
 		}
@@ -2763,30 +2763,30 @@  discard block
 block discarded – undo
2763 2763
 	 * @param array $inactive_theme_mod_settings Mapping of stylesheet to arrays of theme mod settings.
2764 2764
 	 * @return array|false Returns array of updated stashed theme mods or false if the update failed or there were no changes.
2765 2765
 	 */
2766
-	protected function update_stashed_theme_mod_settings( $inactive_theme_mod_settings ) {
2767
-		$stashed_theme_mod_settings = get_option( 'customize_stashed_theme_mods' );
2768
-		if ( empty( $stashed_theme_mod_settings ) ) {
2766
+	protected function update_stashed_theme_mod_settings($inactive_theme_mod_settings) {
2767
+		$stashed_theme_mod_settings = get_option('customize_stashed_theme_mods');
2768
+		if (empty($stashed_theme_mod_settings)) {
2769 2769
 			$stashed_theme_mod_settings = array();
2770 2770
 		}
2771 2771
 
2772 2772
 		// Delete any stashed theme mods for the active theme since since they would have been loaded and saved upon activation.
2773
-		unset( $stashed_theme_mod_settings[ $this->get_stylesheet() ] );
2773
+		unset($stashed_theme_mod_settings[$this->get_stylesheet()]);
2774 2774
 
2775 2775
 		// Merge inactive theme mods with the stashed theme mod settings.
2776
-		foreach ( $inactive_theme_mod_settings as $stylesheet => $theme_mod_settings ) {
2777
-			if ( ! isset( $stashed_theme_mod_settings[ $stylesheet ] ) ) {
2778
-				$stashed_theme_mod_settings[ $stylesheet ] = array();
2776
+		foreach ($inactive_theme_mod_settings as $stylesheet => $theme_mod_settings) {
2777
+			if ( ! isset($stashed_theme_mod_settings[$stylesheet])) {
2778
+				$stashed_theme_mod_settings[$stylesheet] = array();
2779 2779
 			}
2780 2780
 
2781
-			$stashed_theme_mod_settings[ $stylesheet ] = array_merge(
2782
-				$stashed_theme_mod_settings[ $stylesheet ],
2781
+			$stashed_theme_mod_settings[$stylesheet] = array_merge(
2782
+				$stashed_theme_mod_settings[$stylesheet],
2783 2783
 				$theme_mod_settings
2784 2784
 			);
2785 2785
 		}
2786 2786
 
2787 2787
 		$autoload = false;
2788
-		$result = update_option( 'customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload );
2789
-		if ( ! $result ) {
2788
+		$result = update_option('customize_stashed_theme_mods', $stashed_theme_mod_settings, $autoload);
2789
+		if ( ! $result) {
2790 2790
 			return false;
2791 2791
 		}
2792 2792
 		return $stashed_theme_mod_settings;
@@ -2798,11 +2798,11 @@  discard block
 block discarded – undo
2798 2798
 	 * @since 4.2.0
2799 2799
 	 */
2800 2800
 	public function refresh_nonces() {
2801
-		if ( ! $this->is_preview() ) {
2802
-			wp_send_json_error( 'not_preview' );
2801
+		if ( ! $this->is_preview()) {
2802
+			wp_send_json_error('not_preview');
2803 2803
 		}
2804 2804
 
2805
-		wp_send_json_success( $this->get_nonces() );
2805
+		wp_send_json_success($this->get_nonces());
2806 2806
 	}
2807 2807
 
2808 2808
 	/**
@@ -2833,22 +2833,22 @@  discard block
 block discarded – undo
2833 2833
 	 * }
2834 2834
 	 * @return WP_Customize_Setting             The instance of the setting that was added.
2835 2835
 	 */
2836
-	public function add_setting( $id, $args = array() ) {
2837
-		if ( $id instanceof WP_Customize_Setting ) {
2836
+	public function add_setting($id, $args = array()) {
2837
+		if ($id instanceof WP_Customize_Setting) {
2838 2838
 			$setting = $id;
2839 2839
 		} else {
2840 2840
 			$class = 'WP_Customize_Setting';
2841 2841
 
2842 2842
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
2843
-			$args = apply_filters( 'customize_dynamic_setting_args', $args, $id );
2843
+			$args = apply_filters('customize_dynamic_setting_args', $args, $id);
2844 2844
 
2845 2845
 			/** This filter is documented in wp-includes/class-wp-customize-manager.php */
2846
-			$class = apply_filters( 'customize_dynamic_setting_class', $class, $id, $args );
2846
+			$class = apply_filters('customize_dynamic_setting_class', $class, $id, $args);
2847 2847
 
2848
-			$setting = new $class( $this, $id, $args );
2848
+			$setting = new $class($this, $id, $args);
2849 2849
 		}
2850 2850
 
2851
-		$this->settings[ $setting->id ] = $setting;
2851
+		$this->settings[$setting->id] = $setting;
2852 2852
 		return $setting;
2853 2853
 	}
2854 2854
 
@@ -2867,11 +2867,11 @@  discard block
 block discarded – undo
2867 2867
 	 * @param array $setting_ids The setting IDs to add.
2868 2868
 	 * @return array The WP_Customize_Setting objects added.
2869 2869
 	 */
2870
-	public function add_dynamic_settings( $setting_ids ) {
2870
+	public function add_dynamic_settings($setting_ids) {
2871 2871
 		$new_settings = array();
2872
-		foreach ( $setting_ids as $setting_id ) {
2872
+		foreach ($setting_ids as $setting_id) {
2873 2873
 			// Skip settings already created
2874
-			if ( $this->get_setting( $setting_id ) ) {
2874
+			if ($this->get_setting($setting_id)) {
2875 2875
 				continue;
2876 2876
 			}
2877 2877
 
@@ -2890,8 +2890,8 @@  discard block
 block discarded – undo
2890 2890
 			 * @param false|array $setting_args The arguments to the WP_Customize_Setting constructor.
2891 2891
 			 * @param string      $setting_id   ID for dynamic setting, usually coming from `$_POST['customized']`.
2892 2892
 			 */
2893
-			$setting_args = apply_filters( 'customize_dynamic_setting_args', $setting_args, $setting_id );
2894
-			if ( false === $setting_args ) {
2893
+			$setting_args = apply_filters('customize_dynamic_setting_args', $setting_args, $setting_id);
2894
+			if (false === $setting_args) {
2895 2895
 				continue;
2896 2896
 			}
2897 2897
 
@@ -2904,11 +2904,11 @@  discard block
 block discarded – undo
2904 2904
 			 * @param string $setting_id    ID for dynamic setting, usually coming from `$_POST['customized']`.
2905 2905
 			 * @param array  $setting_args  WP_Customize_Setting or a subclass.
2906 2906
 			 */
2907
-			$setting_class = apply_filters( 'customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args );
2907
+			$setting_class = apply_filters('customize_dynamic_setting_class', $setting_class, $setting_id, $setting_args);
2908 2908
 
2909
-			$setting = new $setting_class( $this, $setting_id, $setting_args );
2909
+			$setting = new $setting_class($this, $setting_id, $setting_args);
2910 2910
 
2911
-			$this->add_setting( $setting );
2911
+			$this->add_setting($setting);
2912 2912
 			$new_settings[] = $setting;
2913 2913
 		}
2914 2914
 		return $new_settings;
@@ -2922,9 +2922,9 @@  discard block
 block discarded – undo
2922 2922
 	 * @param string $id Customize Setting ID.
2923 2923
 	 * @return WP_Customize_Setting|void The setting, if set.
2924 2924
 	 */
2925
-	public function get_setting( $id ) {
2926
-		if ( isset( $this->settings[ $id ] ) ) {
2927
-			return $this->settings[ $id ];
2925
+	public function get_setting($id) {
2926
+		if (isset($this->settings[$id])) {
2927
+			return $this->settings[$id];
2928 2928
 		}
2929 2929
 	}
2930 2930
 
@@ -2935,8 +2935,8 @@  discard block
 block discarded – undo
2935 2935
 	 *
2936 2936
 	 * @param string $id Customize Setting ID.
2937 2937
 	 */
2938
-	public function remove_setting( $id ) {
2939
-		unset( $this->settings[ $id ] );
2938
+	public function remove_setting($id) {
2939
+		unset($this->settings[$id]);
2940 2940
 	}
2941 2941
 
2942 2942
 	/**
@@ -2959,14 +2959,14 @@  discard block
 block discarded – undo
2959 2959
 	 * }
2960 2960
 	 * @return WP_Customize_Panel             The instance of the panel that was added.
2961 2961
 	 */
2962
-	public function add_panel( $id, $args = array() ) {
2963
-		if ( $id instanceof WP_Customize_Panel ) {
2962
+	public function add_panel($id, $args = array()) {
2963
+		if ($id instanceof WP_Customize_Panel) {
2964 2964
 			$panel = $id;
2965 2965
 		} else {
2966
-			$panel = new WP_Customize_Panel( $this, $id, $args );
2966
+			$panel = new WP_Customize_Panel($this, $id, $args);
2967 2967
 		}
2968 2968
 
2969
-		$this->panels[ $panel->id ] = $panel;
2969
+		$this->panels[$panel->id] = $panel;
2970 2970
 		return $panel;
2971 2971
 	}
2972 2972
 
@@ -2979,9 +2979,9 @@  discard block
 block discarded – undo
2979 2979
 	 * @param string $id Panel ID to get.
2980 2980
 	 * @return WP_Customize_Panel|void Requested panel instance, if set.
2981 2981
 	 */
2982
-	public function get_panel( $id ) {
2983
-		if ( isset( $this->panels[ $id ] ) ) {
2984
-			return $this->panels[ $id ];
2982
+	public function get_panel($id) {
2983
+		if (isset($this->panels[$id])) {
2984
+			return $this->panels[$id];
2985 2985
 		}
2986 2986
 	}
2987 2987
 
@@ -2993,18 +2993,18 @@  discard block
 block discarded – undo
2993 2993
 	 *
2994 2994
 	 * @param string $id Panel ID to remove.
2995 2995
 	 */
2996
-	public function remove_panel( $id ) {
2996
+	public function remove_panel($id) {
2997 2997
 		// Removing core components this way is _doing_it_wrong().
2998
-		if ( in_array( $id, $this->components, true ) ) {
2998
+		if (in_array($id, $this->components, true)) {
2999 2999
 			/* translators: 1: panel id, 2: link to 'customize_loaded_components' filter reference */
3000
-			$message = sprintf( __( 'Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.' ),
3000
+			$message = sprintf(__('Removing %1$s manually will cause PHP warnings. Use the %2$s filter instead.'),
3001 3001
 				$id,
3002
-				'<a href="' . esc_url( 'https://developer.wordpress.org/reference/hooks/customize_loaded_components/' ) . '"><code>customize_loaded_components</code></a>'
3002
+				'<a href="'.esc_url('https://developer.wordpress.org/reference/hooks/customize_loaded_components/').'"><code>customize_loaded_components</code></a>'
3003 3003
 			);
3004 3004
 
3005
-			_doing_it_wrong( __METHOD__, $message, '4.5.0' );
3005
+			_doing_it_wrong(__METHOD__, $message, '4.5.0');
3006 3006
 		}
3007
-		unset( $this->panels[ $id ] );
3007
+		unset($this->panels[$id]);
3008 3008
 	}
3009 3009
 
3010 3010
 	/**
@@ -3019,7 +3019,7 @@  discard block
 block discarded – undo
3019 3019
 	 *
3020 3020
 	 * @param string $panel Name of a custom panel which is a subclass of WP_Customize_Panel.
3021 3021
 	 */
3022
-	public function register_panel_type( $panel ) {
3022
+	public function register_panel_type($panel) {
3023 3023
 		$this->registered_panel_types[] = $panel;
3024 3024
 	}
3025 3025
 
@@ -3030,8 +3030,8 @@  discard block
 block discarded – undo
3030 3030
 	 * @access public
3031 3031
 	 */
3032 3032
 	public function render_panel_templates() {
3033
-		foreach ( $this->registered_panel_types as $panel_type ) {
3034
-			$panel = new $panel_type( $this, 'temp', array() );
3033
+		foreach ($this->registered_panel_types as $panel_type) {
3034
+			$panel = new $panel_type($this, 'temp', array());
3035 3035
 			$panel->print_template();
3036 3036
 		}
3037 3037
 	}
@@ -3059,14 +3059,14 @@  discard block
 block discarded – undo
3059 3059
 	 * }
3060 3060
 	 * @return WP_Customize_Section             The instance of the section that was added.
3061 3061
 	 */
3062
-	public function add_section( $id, $args = array() ) {
3063
-		if ( $id instanceof WP_Customize_Section ) {
3062
+	public function add_section($id, $args = array()) {
3063
+		if ($id instanceof WP_Customize_Section) {
3064 3064
 			$section = $id;
3065 3065
 		} else {
3066
-			$section = new WP_Customize_Section( $this, $id, $args );
3066
+			$section = new WP_Customize_Section($this, $id, $args);
3067 3067
 		}
3068 3068
 
3069
-		$this->sections[ $section->id ] = $section;
3069
+		$this->sections[$section->id] = $section;
3070 3070
 		return $section;
3071 3071
 	}
3072 3072
 
@@ -3078,9 +3078,9 @@  discard block
 block discarded – undo
3078 3078
 	 * @param string $id Section ID.
3079 3079
 	 * @return WP_Customize_Section|void The section, if set.
3080 3080
 	 */
3081
-	public function get_section( $id ) {
3082
-		if ( isset( $this->sections[ $id ] ) )
3083
-			return $this->sections[ $id ];
3081
+	public function get_section($id) {
3082
+		if (isset($this->sections[$id]))
3083
+			return $this->sections[$id];
3084 3084
 	}
3085 3085
 
3086 3086
 	/**
@@ -3090,8 +3090,8 @@  discard block
 block discarded – undo
3090 3090
 	 *
3091 3091
 	 * @param string $id Section ID.
3092 3092
 	 */
3093
-	public function remove_section( $id ) {
3094
-		unset( $this->sections[ $id ] );
3093
+	public function remove_section($id) {
3094
+		unset($this->sections[$id]);
3095 3095
 	}
3096 3096
 
3097 3097
 	/**
@@ -3106,7 +3106,7 @@  discard block
 block discarded – undo
3106 3106
 	 *
3107 3107
 	 * @param string $section Name of a custom section which is a subclass of WP_Customize_Section.
3108 3108
 	 */
3109
-	public function register_section_type( $section ) {
3109
+	public function register_section_type($section) {
3110 3110
 		$this->registered_section_types[] = $section;
3111 3111
 	}
3112 3112
 
@@ -3117,8 +3117,8 @@  discard block
 block discarded – undo
3117 3117
 	 * @access public
3118 3118
 	 */
3119 3119
 	public function render_section_templates() {
3120
-		foreach ( $this->registered_section_types as $section_type ) {
3121
-			$section = new $section_type( $this, 'temp', array() );
3120
+		foreach ($this->registered_section_types as $section_type) {
3121
+			$section = new $section_type($this, 'temp', array());
3122 3122
 			$section->print_template();
3123 3123
 		}
3124 3124
 	}
@@ -3153,14 +3153,14 @@  discard block
 block discarded – undo
3153 3153
 	 * }
3154 3154
 	 * @return WP_Customize_Control             The instance of the control that was added.
3155 3155
 	 */
3156
-	public function add_control( $id, $args = array() ) {
3157
-		if ( $id instanceof WP_Customize_Control ) {
3156
+	public function add_control($id, $args = array()) {
3157
+		if ($id instanceof WP_Customize_Control) {
3158 3158
 			$control = $id;
3159 3159
 		} else {
3160
-			$control = new WP_Customize_Control( $this, $id, $args );
3160
+			$control = new WP_Customize_Control($this, $id, $args);
3161 3161
 		}
3162 3162
 
3163
-		$this->controls[ $control->id ] = $control;
3163
+		$this->controls[$control->id] = $control;
3164 3164
 		return $control;
3165 3165
 	}
3166 3166
 
@@ -3172,9 +3172,9 @@  discard block
 block discarded – undo
3172 3172
 	 * @param string $id ID of the control.
3173 3173
 	 * @return WP_Customize_Control|void The control object, if set.
3174 3174
 	 */
3175
-	public function get_control( $id ) {
3176
-		if ( isset( $this->controls[ $id ] ) )
3177
-			return $this->controls[ $id ];
3175
+	public function get_control($id) {
3176
+		if (isset($this->controls[$id]))
3177
+			return $this->controls[$id];
3178 3178
 	}
3179 3179
 
3180 3180
 	/**
@@ -3184,8 +3184,8 @@  discard block
 block discarded – undo
3184 3184
 	 *
3185 3185
 	 * @param string $id ID of the control.
3186 3186
 	 */
3187
-	public function remove_control( $id ) {
3188
-		unset( $this->controls[ $id ] );
3187
+	public function remove_control($id) {
3188
+		unset($this->controls[$id]);
3189 3189
 	}
3190 3190
 
3191 3191
 	/**
@@ -3199,7 +3199,7 @@  discard block
 block discarded – undo
3199 3199
 	 * @param string $control Name of a custom control which is a subclass of
3200 3200
 	 *                        WP_Customize_Control.
3201 3201
 	 */
3202
-	public function register_control_type( $control ) {
3202
+	public function register_control_type($control) {
3203 3203
 		$this->registered_control_types[] = $control;
3204 3204
 	}
3205 3205
 
@@ -3210,10 +3210,10 @@  discard block
 block discarded – undo
3210 3210
 	 * @access public
3211 3211
 	 */
3212 3212
 	public function render_control_templates() {
3213
-		foreach ( $this->registered_control_types as $control_type ) {
3214
-			$control = new $control_type( $this, 'temp', array(
3213
+		foreach ($this->registered_control_types as $control_type) {
3214
+			$control = new $control_type($this, 'temp', array(
3215 3215
 				'settings' => array(),
3216
-			) );
3216
+			));
3217 3217
 			$control->print_template();
3218 3218
 		}
3219 3219
 		?>
@@ -3237,10 +3237,10 @@  discard block
 block discarded – undo
3237 3237
 	 * @param WP_Customize_Panel|WP_Customize_Section|WP_Customize_Control $b Object B.
3238 3238
 	 * @return int
3239 3239
 	 */
3240
-	protected function _cmp_priority( $a, $b ) {
3241
-		_deprecated_function( __METHOD__, '4.7.0', 'wp_list_sort' );
3240
+	protected function _cmp_priority($a, $b) {
3241
+		_deprecated_function(__METHOD__, '4.7.0', 'wp_list_sort');
3242 3242
 
3243
-		if ( $a->priority === $b->priority ) {
3243
+		if ($a->priority === $b->priority) {
3244 3244
 			return $a->instance_number - $b->instance_number;
3245 3245
 		} else {
3246 3246
 			return $a->priority - $b->priority;
@@ -3259,77 +3259,77 @@  discard block
 block discarded – undo
3259 3259
 	public function prepare_controls() {
3260 3260
 
3261 3261
 		$controls = array();
3262
-		$this->controls = wp_list_sort( $this->controls, array(
3262
+		$this->controls = wp_list_sort($this->controls, array(
3263 3263
 			'priority'        => 'ASC',
3264 3264
 			'instance_number' => 'ASC',
3265
-		), 'ASC', true );
3265
+		), 'ASC', true);
3266 3266
 
3267
-		foreach ( $this->controls as $id => $control ) {
3268
-			if ( ! isset( $this->sections[ $control->section ] ) || ! $control->check_capabilities() ) {
3267
+		foreach ($this->controls as $id => $control) {
3268
+			if ( ! isset($this->sections[$control->section]) || ! $control->check_capabilities()) {
3269 3269
 				continue;
3270 3270
 			}
3271 3271
 
3272
-			$this->sections[ $control->section ]->controls[] = $control;
3273
-			$controls[ $id ] = $control;
3272
+			$this->sections[$control->section]->controls[] = $control;
3273
+			$controls[$id] = $control;
3274 3274
 		}
3275 3275
 		$this->controls = $controls;
3276 3276
 
3277 3277
 		// Prepare sections.
3278
-		$this->sections = wp_list_sort( $this->sections, array(
3278
+		$this->sections = wp_list_sort($this->sections, array(
3279 3279
 			'priority'        => 'ASC',
3280 3280
 			'instance_number' => 'ASC',
3281
-		), 'ASC', true );
3281
+		), 'ASC', true);
3282 3282
 		$sections = array();
3283 3283
 
3284
-		foreach ( $this->sections as $section ) {
3285
-			if ( ! $section->check_capabilities() ) {
3284
+		foreach ($this->sections as $section) {
3285
+			if ( ! $section->check_capabilities()) {
3286 3286
 				continue;
3287 3287
 			}
3288 3288
 
3289 3289
 
3290
-			$section->controls = wp_list_sort( $section->controls, array(
3290
+			$section->controls = wp_list_sort($section->controls, array(
3291 3291
 				'priority'        => 'ASC',
3292 3292
 				'instance_number' => 'ASC',
3293
-			) );
3293
+			));
3294 3294
 
3295
-			if ( ! $section->panel ) {
3295
+			if ( ! $section->panel) {
3296 3296
 				// Top-level section.
3297
-				$sections[ $section->id ] = $section;
3297
+				$sections[$section->id] = $section;
3298 3298
 			} else {
3299 3299
 				// This section belongs to a panel.
3300
-				if ( isset( $this->panels [ $section->panel ] ) ) {
3301
-					$this->panels[ $section->panel ]->sections[ $section->id ] = $section;
3300
+				if (isset($this->panels [$section->panel])) {
3301
+					$this->panels[$section->panel]->sections[$section->id] = $section;
3302 3302
 				}
3303 3303
 			}
3304 3304
 		}
3305 3305
 		$this->sections = $sections;
3306 3306
 
3307 3307
 		// Prepare panels.
3308
-		$this->panels = wp_list_sort( $this->panels, array(
3308
+		$this->panels = wp_list_sort($this->panels, array(
3309 3309
 			'priority'        => 'ASC',
3310 3310
 			'instance_number' => 'ASC',
3311
-		), 'ASC', true );
3311
+		), 'ASC', true);
3312 3312
 		$panels = array();
3313 3313
 
3314
-		foreach ( $this->panels as $panel ) {
3315
-			if ( ! $panel->check_capabilities() ) {
3314
+		foreach ($this->panels as $panel) {
3315
+			if ( ! $panel->check_capabilities()) {
3316 3316
 				continue;
3317 3317
 			}
3318 3318
 
3319
-			$panel->sections = wp_list_sort( $panel->sections, array(
3319
+			$panel->sections = wp_list_sort($panel->sections, array(
3320 3320
 				'priority'        => 'ASC',
3321 3321
 				'instance_number' => 'ASC',
3322
-			), 'ASC', true );
3323
-			$panels[ $panel->id ] = $panel;
3322
+			), 'ASC', true);
3323
+			$panels[$panel->id] = $panel;
3324 3324
 		}
3325 3325
 		$this->panels = $panels;
3326 3326
 
3327 3327
 		// Sort panels and top-level sections together.
3328
-		$this->containers = array_merge( $this->panels, $this->sections );
3329
-		$this->containers = wp_list_sort( $this->containers, array(
3328
+		$this->containers = array_merge($this->panels, $this->sections);
3329
+		$this->containers = wp_list_sort($this->containers, array(
3330 3330
 			'priority'        => 'ASC',
3331 3331
 			'instance_number' => 'ASC',
3332
-		), 'ASC', true );
3332
+		), 'ASC', true);
3333 3333
 	}
3334 3334
 
3335 3335
 	/**
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
 	 * @since 3.4.0
3339 3339
 	 */
3340 3340
 	public function enqueue_control_scripts() {
3341
-		foreach ( $this->controls as $control ) {
3341
+		foreach ($this->controls as $control) {
3342 3342
 			$control->enqueue();
3343 3343
 		}
3344 3344
 	}
@@ -3352,7 +3352,7 @@  discard block
 block discarded – undo
3352 3352
 	 * @return bool Whether the user agent is iOS.
3353 3353
 	 */
3354 3354
 	public function is_ios() {
3355
-		return wp_is_mobile() && preg_match( '/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT'] );
3355
+		return wp_is_mobile() && preg_match('/iPad|iPod|iPhone/', $_SERVER['HTTP_USER_AGENT']);
3356 3356
 	}
3357 3357
 
3358 3358
 	/**
@@ -3364,14 +3364,14 @@  discard block
 block discarded – undo
3364 3364
 	 * @return string The template string for the document title.
3365 3365
 	 */
3366 3366
 	public function get_document_title_template() {
3367
-		if ( $this->is_theme_active() ) {
3367
+		if ($this->is_theme_active()) {
3368 3368
 			/* translators: %s: document title from the preview */
3369
-			$document_title_tmpl = __( 'Customize: %s' );
3369
+			$document_title_tmpl = __('Customize: %s');
3370 3370
 		} else {
3371 3371
 			/* translators: %s: document title from the preview */
3372
-			$document_title_tmpl = __( 'Live Preview: %s' );
3372
+			$document_title_tmpl = __('Live Preview: %s');
3373 3373
 		}
3374
-		$document_title_tmpl = html_entity_decode( $document_title_tmpl, ENT_QUOTES, 'UTF-8' ); // Because exported to JS and assigned to document.title.
3374
+		$document_title_tmpl = html_entity_decode($document_title_tmpl, ENT_QUOTES, 'UTF-8'); // Because exported to JS and assigned to document.title.
3375 3375
 		return $document_title_tmpl;
3376 3376
 	}
3377 3377
 
@@ -3385,9 +3385,9 @@  discard block
 block discarded – undo
3385 3385
 	 *
3386 3386
 	 * @param string $preview_url URL to be previewed.
3387 3387
 	 */
3388
-	public function set_preview_url( $preview_url ) {
3389
-		$preview_url = esc_url_raw( $preview_url );
3390
-		$this->preview_url = wp_validate_redirect( $preview_url, home_url( '/' ) );
3388
+	public function set_preview_url($preview_url) {
3389
+		$preview_url = esc_url_raw($preview_url);
3390
+		$this->preview_url = wp_validate_redirect($preview_url, home_url('/'));
3391 3391
 	}
3392 3392
 
3393 3393
 	/**
@@ -3399,8 +3399,8 @@  discard block
 block discarded – undo
3399 3399
 	 * @return string URL being previewed.
3400 3400
 	 */
3401 3401
 	public function get_preview_url() {
3402
-		if ( empty( $this->preview_url ) ) {
3403
-			$preview_url = home_url( '/' );
3402
+		if (empty($this->preview_url)) {
3403
+			$preview_url = home_url('/');
3404 3404
 		} else {
3405 3405
 			$preview_url = $this->preview_url;
3406 3406
 		}
@@ -3416,9 +3416,9 @@  discard block
 block discarded – undo
3416 3416
 	 * @return bool Whether cross-domain.
3417 3417
 	 */
3418 3418
 	public function is_cross_domain() {
3419
-		$admin_origin = wp_parse_url( admin_url() );
3420
-		$home_origin = wp_parse_url( home_url() );
3421
-		$cross_domain = ( strtolower( $admin_origin['host'] ) !== strtolower( $home_origin['host'] ) );
3419
+		$admin_origin = wp_parse_url(admin_url());
3420
+		$home_origin = wp_parse_url(home_url());
3421
+		$cross_domain = (strtolower($admin_origin['host']) !== strtolower($home_origin['host']));
3422 3422
 		return $cross_domain;
3423 3423
 	}
3424 3424
 
@@ -3438,10 +3438,10 @@  discard block
 block discarded – undo
3438 3438
 	 * @returns array Allowed URLs.
3439 3439
 	 */
3440 3440
 	public function get_allowed_urls() {
3441
-		$allowed_urls = array( home_url( '/' ) );
3441
+		$allowed_urls = array(home_url('/'));
3442 3442
 
3443
-		if ( is_ssl() && ! $this->is_cross_domain() ) {
3444
-			$allowed_urls[] = home_url( '/', 'https' );
3443
+		if (is_ssl() && ! $this->is_cross_domain()) {
3444
+			$allowed_urls[] = home_url('/', 'https');
3445 3445
 		}
3446 3446
 
3447 3447
 		/**
@@ -3451,7 +3451,7 @@  discard block
 block discarded – undo
3451 3451
 		 *
3452 3452
 		 * @param array $allowed_urls An array of allowed URLs.
3453 3453
 		 */
3454
-		$allowed_urls = array_unique( apply_filters( 'customize_allowed_urls', $allowed_urls ) );
3454
+		$allowed_urls = array_unique(apply_filters('customize_allowed_urls', $allowed_urls));
3455 3455
 
3456 3456
 		return $allowed_urls;
3457 3457
 	}
@@ -3478,10 +3478,10 @@  discard block
 block discarded – undo
3478 3478
 	 *
3479 3479
 	 * @param string $return_url URL for return link.
3480 3480
 	 */
3481
-	public function set_return_url( $return_url ) {
3482
-		$return_url = esc_url_raw( $return_url );
3483
-		$return_url = remove_query_arg( wp_removable_query_args(), $return_url );
3484
-		$return_url = wp_validate_redirect( $return_url );
3481
+	public function set_return_url($return_url) {
3482
+		$return_url = esc_url_raw($return_url);
3483
+		$return_url = remove_query_arg(wp_removable_query_args(), $return_url);
3484
+		$return_url = wp_validate_redirect($return_url);
3485 3485
 		$this->return_url = $return_url;
3486 3486
 	}
3487 3487
 
@@ -3495,16 +3495,16 @@  discard block
 block discarded – undo
3495 3495
 	 */
3496 3496
 	public function get_return_url() {
3497 3497
 		$referer = wp_get_referer();
3498
-		$excluded_referer_basenames = array( 'customize.php', 'wp-login.php' );
3498
+		$excluded_referer_basenames = array('customize.php', 'wp-login.php');
3499 3499
 
3500
-		if ( $this->return_url ) {
3500
+		if ($this->return_url) {
3501 3501
 			$return_url = $this->return_url;
3502
-		} else if ( $referer && ! in_array( basename( parse_url( $referer, PHP_URL_PATH ) ), $excluded_referer_basenames, true ) ) {
3502
+		} else if ($referer && ! in_array(basename(parse_url($referer, PHP_URL_PATH)), $excluded_referer_basenames, true)) {
3503 3503
 			$return_url = $referer;
3504
-		} else if ( $this->preview_url ) {
3504
+		} else if ($this->preview_url) {
3505 3505
 			$return_url = $this->preview_url;
3506 3506
 		} else {
3507
-			$return_url = home_url( '/' );
3507
+			$return_url = home_url('/');
3508 3508
 		}
3509 3509
 		return $return_url;
3510 3510
 	}
@@ -3523,8 +3523,8 @@  discard block
 block discarded – undo
3523 3523
 	 *     @type string [$panel]    ID for panel to be autofocused.
3524 3524
 	 * }
3525 3525
 	 */
3526
-	public function set_autofocus( $autofocus ) {
3527
-		$this->autofocus = array_filter( wp_array_slice_assoc( $autofocus, array( 'panel', 'section', 'control' ) ), 'is_string' );
3526
+	public function set_autofocus($autofocus) {
3527
+		$this->autofocus = array_filter(wp_array_slice_assoc($autofocus, array('panel', 'section', 'control')), 'is_string');
3528 3528
 	}
3529 3529
 
3530 3530
 	/**
@@ -3554,8 +3554,8 @@  discard block
 block discarded – undo
3554 3554
 	 */
3555 3555
 	public function get_nonces() {
3556 3556
 		$nonces = array(
3557
-			'save' => wp_create_nonce( 'save-customize_' . $this->get_stylesheet() ),
3558
-			'preview' => wp_create_nonce( 'preview-customize_' . $this->get_stylesheet() ),
3557
+			'save' => wp_create_nonce('save-customize_'.$this->get_stylesheet()),
3558
+			'preview' => wp_create_nonce('preview-customize_'.$this->get_stylesheet()),
3559 3559
 		);
3560 3560
 
3561 3561
 		/**
@@ -3567,7 +3567,7 @@  discard block
 block discarded – undo
3567 3567
 		 *                                     preview actions.
3568 3568
 		 * @param WP_Customize_Manager $this   WP_Customize_Manager instance.
3569 3569
 		 */
3570
-		$nonces = apply_filters( 'customize_refresh_nonces', $nonces, $this );
3570
+		$nonces = apply_filters('customize_refresh_nonces', $nonces, $this);
3571 3571
 
3572 3572
 		return $nonces;
3573 3573
 	}
@@ -3579,15 +3579,15 @@  discard block
 block discarded – undo
3579 3579
 	 */
3580 3580
 	public function customize_pane_settings() {
3581 3581
 
3582
-		$login_url = add_query_arg( array(
3582
+		$login_url = add_query_arg(array(
3583 3583
 			'interim-login' => 1,
3584 3584
 			'customize-login' => 1,
3585
-		), wp_login_url() );
3585
+		), wp_login_url());
3586 3586
 
3587 3587
 		// Ensure dirty flags are set for modified settings.
3588
-		foreach ( array_keys( $this->unsanitized_post_values() ) as $setting_id ) {
3589
-			$setting = $this->get_setting( $setting_id );
3590
-			if ( $setting ) {
3588
+		foreach (array_keys($this->unsanitized_post_values()) as $setting_id) {
3589
+			$setting = $this->get_setting($setting_id);
3590
+			if ($setting) {
3591 3591
 				$setting->dirty = true;
3592 3592
 			}
3593 3593
 		}
@@ -3596,7 +3596,7 @@  discard block
 block discarded – undo
3596 3596
 		$settings = array(
3597 3597
 			'changeset' => array(
3598 3598
 				'uuid' => $this->changeset_uuid(),
3599
-				'status' => $this->changeset_post_id() ? get_post_status( $this->changeset_post_id() ) : '',
3599
+				'status' => $this->changeset_post_id() ? get_post_status($this->changeset_post_id()) : '',
3600 3600
 			),
3601 3601
 			'timeouts' => array(
3602 3602
 				'windowRefresh' => 250,
@@ -3610,14 +3610,14 @@  discard block
 block discarded – undo
3610 3610
 				'active'     => $this->is_theme_active(),
3611 3611
 			),
3612 3612
 			'url'      => array(
3613
-				'preview'       => esc_url_raw( $this->get_preview_url() ),
3614
-				'parent'        => esc_url_raw( admin_url() ),
3615
-				'activated'     => esc_url_raw( home_url( '/' ) ),
3616
-				'ajax'          => esc_url_raw( admin_url( 'admin-ajax.php', 'relative' ) ),
3617
-				'allowed'       => array_map( 'esc_url_raw', $this->get_allowed_urls() ),
3613
+				'preview'       => esc_url_raw($this->get_preview_url()),
3614
+				'parent'        => esc_url_raw(admin_url()),
3615
+				'activated'     => esc_url_raw(home_url('/')),
3616
+				'ajax'          => esc_url_raw(admin_url('admin-ajax.php', 'relative')),
3617
+				'allowed'       => array_map('esc_url_raw', $this->get_allowed_urls()),
3618 3618
 				'isCrossDomain' => $this->is_cross_domain(),
3619
-				'home'          => esc_url_raw( home_url( '/' ) ),
3620
-				'login'         => esc_url_raw( $login_url ),
3619
+				'home'          => esc_url_raw(home_url('/')),
3620
+				'login'         => esc_url_raw($login_url),
3621 3621
 			),
3622 3622
 			'browser'  => array(
3623 3623
 				'mobile' => wp_is_mobile(),
@@ -3632,19 +3632,19 @@  discard block
 block discarded – undo
3632 3632
 		);
3633 3633
 
3634 3634
 		// Prepare Customize Section objects to pass to JavaScript.
3635
-		foreach ( $this->sections() as $id => $section ) {
3636
-			if ( $section->check_capabilities() ) {
3637
-				$settings['sections'][ $id ] = $section->json();
3635
+		foreach ($this->sections() as $id => $section) {
3636
+			if ($section->check_capabilities()) {
3637
+				$settings['sections'][$id] = $section->json();
3638 3638
 			}
3639 3639
 		}
3640 3640
 
3641 3641
 		// Prepare Customize Panel objects to pass to JavaScript.
3642
-		foreach ( $this->panels() as $panel_id => $panel ) {
3643
-			if ( $panel->check_capabilities() ) {
3644
-				$settings['panels'][ $panel_id ] = $panel->json();
3645
-				foreach ( $panel->sections as $section_id => $section ) {
3646
-					if ( $section->check_capabilities() ) {
3647
-						$settings['sections'][ $section_id ] = $section->json();
3642
+		foreach ($this->panels() as $panel_id => $panel) {
3643
+			if ($panel->check_capabilities()) {
3644
+				$settings['panels'][$panel_id] = $panel->json();
3645
+				foreach ($panel->sections as $section_id => $section) {
3646
+					if ($section->check_capabilities()) {
3647
+						$settings['sections'][$section_id] = $section->json();
3648 3648
 					}
3649 3649
 				}
3650 3650
 			}
@@ -3652,19 +3652,19 @@  discard block
 block discarded – undo
3652 3652
 
3653 3653
 		?>
3654 3654
 		<script type="text/javascript">
3655
-			var _wpCustomizeSettings = <?php echo wp_json_encode( $settings ); ?>;
3655
+			var _wpCustomizeSettings = <?php echo wp_json_encode($settings); ?>;
3656 3656
 			_wpCustomizeSettings.controls = {};
3657 3657
 			_wpCustomizeSettings.settings = {};
3658 3658
 			<?php
3659 3659
 
3660 3660
 			// Serialize settings one by one to improve memory usage.
3661 3661
 			echo "(function ( s ){\n";
3662
-			foreach ( $this->settings() as $setting ) {
3663
-				if ( $setting->check_capabilities() ) {
3662
+			foreach ($this->settings() as $setting) {
3663
+				if ($setting->check_capabilities()) {
3664 3664
 					printf(
3665 3665
 						"s[%s] = %s;\n",
3666
-						wp_json_encode( $setting->id ),
3667
-						wp_json_encode( $setting->json() )
3666
+						wp_json_encode($setting->id),
3667
+						wp_json_encode($setting->json())
3668 3668
 					);
3669 3669
 				}
3670 3670
 			}
@@ -3672,12 +3672,12 @@  discard block
 block discarded – undo
3672 3672
 
3673 3673
 			// Serialize controls one by one to improve memory usage.
3674 3674
 			echo "(function ( c ){\n";
3675
-			foreach ( $this->controls() as $control ) {
3676
-				if ( $control->check_capabilities() ) {
3675
+			foreach ($this->controls() as $control) {
3676
+				if ($control->check_capabilities()) {
3677 3677
 					printf(
3678 3678
 						"c[%s] = %s;\n",
3679
-						wp_json_encode( $control->id ),
3680
-						wp_json_encode( $control->json() )
3679
+						wp_json_encode($control->id),
3680
+						wp_json_encode($control->json())
3681 3681
 					);
3682 3682
 				}
3683 3683
 			}
@@ -3697,14 +3697,14 @@  discard block
 block discarded – undo
3697 3697
 	public function get_previewable_devices() {
3698 3698
 		$devices = array(
3699 3699
 			'desktop' => array(
3700
-				'label' => __( 'Enter desktop preview mode' ),
3700
+				'label' => __('Enter desktop preview mode'),
3701 3701
 				'default' => true,
3702 3702
 			),
3703 3703
 			'tablet' => array(
3704
-				'label' => __( 'Enter tablet preview mode' ),
3704
+				'label' => __('Enter tablet preview mode'),
3705 3705
 			),
3706 3706
 			'mobile' => array(
3707
-				'label' => __( 'Enter mobile preview mode' ),
3707
+				'label' => __('Enter mobile preview mode'),
3708 3708
 			),
3709 3709
 		);
3710 3710
 
@@ -3717,7 +3717,7 @@  discard block
 block discarded – undo
3717 3717
 		 *
3718 3718
 		 * @param array $devices List of devices with labels and default setting.
3719 3719
 		 */
3720
-		$devices = apply_filters( 'customize_previewable_devices', $devices );
3720
+		$devices = apply_filters('customize_previewable_devices', $devices);
3721 3721
 
3722 3722
 		return $devices;
3723 3723
 	}
@@ -3730,135 +3730,135 @@  discard block
 block discarded – undo
3730 3730
 	public function register_controls() {
3731 3731
 
3732 3732
 		/* Panel, Section, and Control Types */
3733
-		$this->register_panel_type( 'WP_Customize_Panel' );
3734
-		$this->register_section_type( 'WP_Customize_Section' );
3735
-		$this->register_section_type( 'WP_Customize_Sidebar_Section' );
3736
-		$this->register_control_type( 'WP_Customize_Color_Control' );
3737
-		$this->register_control_type( 'WP_Customize_Media_Control' );
3738
-		$this->register_control_type( 'WP_Customize_Upload_Control' );
3739
-		$this->register_control_type( 'WP_Customize_Image_Control' );
3740
-		$this->register_control_type( 'WP_Customize_Background_Image_Control' );
3741
-		$this->register_control_type( 'WP_Customize_Background_Position_Control' );
3742
-		$this->register_control_type( 'WP_Customize_Cropped_Image_Control' );
3743
-		$this->register_control_type( 'WP_Customize_Site_Icon_Control' );
3744
-		$this->register_control_type( 'WP_Customize_Theme_Control' );
3733
+		$this->register_panel_type('WP_Customize_Panel');
3734
+		$this->register_section_type('WP_Customize_Section');
3735
+		$this->register_section_type('WP_Customize_Sidebar_Section');
3736
+		$this->register_control_type('WP_Customize_Color_Control');
3737
+		$this->register_control_type('WP_Customize_Media_Control');
3738
+		$this->register_control_type('WP_Customize_Upload_Control');
3739
+		$this->register_control_type('WP_Customize_Image_Control');
3740
+		$this->register_control_type('WP_Customize_Background_Image_Control');
3741
+		$this->register_control_type('WP_Customize_Background_Position_Control');
3742
+		$this->register_control_type('WP_Customize_Cropped_Image_Control');
3743
+		$this->register_control_type('WP_Customize_Site_Icon_Control');
3744
+		$this->register_control_type('WP_Customize_Theme_Control');
3745 3745
 
3746 3746
 		/* Themes */
3747 3747
 
3748
-		$this->add_section( new WP_Customize_Themes_Section( $this, 'themes', array(
3749
-			'title'      => $this->theme()->display( 'Name' ),
3748
+		$this->add_section(new WP_Customize_Themes_Section($this, 'themes', array(
3749
+			'title'      => $this->theme()->display('Name'),
3750 3750
 			'capability' => 'switch_themes',
3751 3751
 			'priority'   => 0,
3752
-		) ) );
3752
+		)));
3753 3753
 
3754 3754
 		// Themes Setting (unused - the theme is considerably more fundamental to the Customizer experience).
3755
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'active_theme', array(
3755
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'active_theme', array(
3756 3756
 			'capability' => 'switch_themes',
3757
-		) ) );
3757
+		)));
3758 3758
 
3759
-		require_once( ABSPATH . 'wp-admin/includes/theme.php' );
3759
+		require_once(ABSPATH.'wp-admin/includes/theme.php');
3760 3760
 
3761 3761
 		// Theme Controls.
3762 3762
 
3763 3763
 		// Add a control for the active/original theme.
3764
-		if ( ! $this->is_theme_active() ) {
3765
-			$themes = wp_prepare_themes_for_js( array( wp_get_theme( $this->original_stylesheet ) ) );
3766
-			$active_theme = current( $themes );
3764
+		if ( ! $this->is_theme_active()) {
3765
+			$themes = wp_prepare_themes_for_js(array(wp_get_theme($this->original_stylesheet)));
3766
+			$active_theme = current($themes);
3767 3767
 			$active_theme['isActiveTheme'] = true;
3768
-			$this->add_control( new WP_Customize_Theme_Control( $this, $active_theme['id'], array(
3768
+			$this->add_control(new WP_Customize_Theme_Control($this, $active_theme['id'], array(
3769 3769
 				'theme'    => $active_theme,
3770 3770
 				'section'  => 'themes',
3771 3771
 				'settings' => 'active_theme',
3772
-			) ) );
3772
+			)));
3773 3773
 		}
3774 3774
 
3775 3775
 		$themes = wp_prepare_themes_for_js();
3776
-		foreach ( $themes as $theme ) {
3777
-			if ( $theme['active'] || $theme['id'] === $this->original_stylesheet ) {
3776
+		foreach ($themes as $theme) {
3777
+			if ($theme['active'] || $theme['id'] === $this->original_stylesheet) {
3778 3778
 				continue;
3779 3779
 			}
3780 3780
 
3781
-			$theme_id = 'theme_' . $theme['id'];
3781
+			$theme_id = 'theme_'.$theme['id'];
3782 3782
 			$theme['isActiveTheme'] = false;
3783
-			$this->add_control( new WP_Customize_Theme_Control( $this, $theme_id, array(
3783
+			$this->add_control(new WP_Customize_Theme_Control($this, $theme_id, array(
3784 3784
 				'theme'    => $theme,
3785 3785
 				'section'  => 'themes',
3786 3786
 				'settings' => 'active_theme',
3787
-			) ) );
3787
+			)));
3788 3788
 		}
3789 3789
 
3790 3790
 		/* Site Identity */
3791 3791
 
3792
-		$this->add_section( 'title_tagline', array(
3793
-			'title'    => __( 'Site Identity' ),
3792
+		$this->add_section('title_tagline', array(
3793
+			'title'    => __('Site Identity'),
3794 3794
 			'priority' => 20,
3795
-		) );
3795
+		));
3796 3796
 
3797
-		$this->add_setting( 'blogname', array(
3798
-			'default'    => get_option( 'blogname' ),
3797
+		$this->add_setting('blogname', array(
3798
+			'default'    => get_option('blogname'),
3799 3799
 			'type'       => 'option',
3800 3800
 			'capability' => 'manage_options',
3801
-		) );
3801
+		));
3802 3802
 
3803
-		$this->add_control( 'blogname', array(
3804
-			'label'      => __( 'Site Title' ),
3803
+		$this->add_control('blogname', array(
3804
+			'label'      => __('Site Title'),
3805 3805
 			'section'    => 'title_tagline',
3806
-		) );
3806
+		));
3807 3807
 
3808
-		$this->add_setting( 'blogdescription', array(
3809
-			'default'    => get_option( 'blogdescription' ),
3808
+		$this->add_setting('blogdescription', array(
3809
+			'default'    => get_option('blogdescription'),
3810 3810
 			'type'       => 'option',
3811 3811
 			'capability' => 'manage_options',
3812
-		) );
3812
+		));
3813 3813
 
3814
-		$this->add_control( 'blogdescription', array(
3815
-			'label'      => __( 'Tagline' ),
3814
+		$this->add_control('blogdescription', array(
3815
+			'label'      => __('Tagline'),
3816 3816
 			'section'    => 'title_tagline',
3817
-		) );
3817
+		));
3818 3818
 
3819 3819
 		// Add a setting to hide header text if the theme doesn't support custom headers.
3820
-		if ( ! current_theme_supports( 'custom-header', 'header-text' ) ) {
3821
-			$this->add_setting( 'header_text', array(
3822
-				'theme_supports'    => array( 'custom-logo', 'header-text' ),
3820
+		if ( ! current_theme_supports('custom-header', 'header-text')) {
3821
+			$this->add_setting('header_text', array(
3822
+				'theme_supports'    => array('custom-logo', 'header-text'),
3823 3823
 				'default'           => 1,
3824 3824
 				'sanitize_callback' => 'absint',
3825
-			) );
3825
+			));
3826 3826
 
3827
-			$this->add_control( 'header_text', array(
3828
-				'label'    => __( 'Display Site Title and Tagline' ),
3827
+			$this->add_control('header_text', array(
3828
+				'label'    => __('Display Site Title and Tagline'),
3829 3829
 				'section'  => 'title_tagline',
3830 3830
 				'settings' => 'header_text',
3831 3831
 				'type'     => 'checkbox',
3832
-			) );
3832
+			));
3833 3833
 		}
3834 3834
 
3835
-		$this->add_setting( 'site_icon', array(
3835
+		$this->add_setting('site_icon', array(
3836 3836
 			'type'       => 'option',
3837 3837
 			'capability' => 'manage_options',
3838 3838
 			'transport'  => 'postMessage', // Previewed with JS in the Customizer controls window.
3839
-		) );
3839
+		));
3840 3840
 
3841
-		$this->add_control( new WP_Customize_Site_Icon_Control( $this, 'site_icon', array(
3842
-			'label'       => __( 'Site Icon' ),
3841
+		$this->add_control(new WP_Customize_Site_Icon_Control($this, 'site_icon', array(
3842
+			'label'       => __('Site Icon'),
3843 3843
 			'description' => sprintf(
3844 3844
 				/* translators: %s: site icon size in pixels */
3845
-				__( '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.' ),
3845
+				__('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.'),
3846 3846
 				'<strong>512</strong>'
3847 3847
 			),
3848 3848
 			'section'     => 'title_tagline',
3849 3849
 			'priority'    => 60,
3850 3850
 			'height'      => 512,
3851 3851
 			'width'       => 512,
3852
-		) ) );
3852
+		)));
3853 3853
 
3854
-		$this->add_setting( 'custom_logo', array(
3855
-			'theme_supports' => array( 'custom-logo' ),
3854
+		$this->add_setting('custom_logo', array(
3855
+			'theme_supports' => array('custom-logo'),
3856 3856
 			'transport'      => 'postMessage',
3857
-		) );
3857
+		));
3858 3858
 
3859
-		$custom_logo_args = get_theme_support( 'custom-logo' );
3860
-		$this->add_control( new WP_Customize_Cropped_Image_Control( $this, 'custom_logo', array(
3861
-			'label'         => __( 'Logo' ),
3859
+		$custom_logo_args = get_theme_support('custom-logo');
3860
+		$this->add_control(new WP_Customize_Cropped_Image_Control($this, 'custom_logo', array(
3861
+			'label'         => __('Logo'),
3862 3862
 			'section'       => 'title_tagline',
3863 3863
 			'priority'      => 8,
3864 3864
 			'height'        => $custom_logo_args[0]['height'],
@@ -3866,290 +3866,290 @@  discard block
 block discarded – undo
3866 3866
 			'flex_height'   => $custom_logo_args[0]['flex-height'],
3867 3867
 			'flex_width'    => $custom_logo_args[0]['flex-width'],
3868 3868
 			'button_labels' => array(
3869
-				'select'       => __( 'Select logo' ),
3870
-				'change'       => __( 'Change logo' ),
3871
-				'remove'       => __( 'Remove' ),
3872
-				'default'      => __( 'Default' ),
3873
-				'placeholder'  => __( 'No logo selected' ),
3874
-				'frame_title'  => __( 'Select logo' ),
3875
-				'frame_button' => __( 'Choose logo' ),
3869
+				'select'       => __('Select logo'),
3870
+				'change'       => __('Change logo'),
3871
+				'remove'       => __('Remove'),
3872
+				'default'      => __('Default'),
3873
+				'placeholder'  => __('No logo selected'),
3874
+				'frame_title'  => __('Select logo'),
3875
+				'frame_button' => __('Choose logo'),
3876 3876
 			),
3877
-		) ) );
3877
+		)));
3878 3878
 
3879
-		$this->selective_refresh->add_partial( 'custom_logo', array(
3880
-			'settings'            => array( 'custom_logo' ),
3879
+		$this->selective_refresh->add_partial('custom_logo', array(
3880
+			'settings'            => array('custom_logo'),
3881 3881
 			'selector'            => '.custom-logo-link',
3882
-			'render_callback'     => array( $this, '_render_custom_logo_partial' ),
3882
+			'render_callback'     => array($this, '_render_custom_logo_partial'),
3883 3883
 			'container_inclusive' => true,
3884
-		) );
3884
+		));
3885 3885
 
3886 3886
 		/* Colors */
3887 3887
 
3888
-		$this->add_section( 'colors', array(
3889
-			'title'          => __( 'Colors' ),
3888
+		$this->add_section('colors', array(
3889
+			'title'          => __('Colors'),
3890 3890
 			'priority'       => 40,
3891
-		) );
3891
+		));
3892 3892
 
3893
-		$this->add_setting( 'header_textcolor', array(
3894
-			'theme_supports' => array( 'custom-header', 'header-text' ),
3895
-			'default'        => get_theme_support( 'custom-header', 'default-text-color' ),
3893
+		$this->add_setting('header_textcolor', array(
3894
+			'theme_supports' => array('custom-header', 'header-text'),
3895
+			'default'        => get_theme_support('custom-header', 'default-text-color'),
3896 3896
 
3897
-			'sanitize_callback'    => array( $this, '_sanitize_header_textcolor' ),
3897
+			'sanitize_callback'    => array($this, '_sanitize_header_textcolor'),
3898 3898
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
3899
-		) );
3899
+		));
3900 3900
 
3901 3901
 		// Input type: checkbox
3902 3902
 		// With custom value
3903
-		$this->add_control( 'display_header_text', array(
3903
+		$this->add_control('display_header_text', array(
3904 3904
 			'settings' => 'header_textcolor',
3905
-			'label'    => __( 'Display Site Title and Tagline' ),
3905
+			'label'    => __('Display Site Title and Tagline'),
3906 3906
 			'section'  => 'title_tagline',
3907 3907
 			'type'     => 'checkbox',
3908 3908
 			'priority' => 40,
3909
-		) );
3909
+		));
3910 3910
 
3911
-		$this->add_control( new WP_Customize_Color_Control( $this, 'header_textcolor', array(
3912
-			'label'   => __( 'Header Text Color' ),
3911
+		$this->add_control(new WP_Customize_Color_Control($this, 'header_textcolor', array(
3912
+			'label'   => __('Header Text Color'),
3913 3913
 			'section' => 'colors',
3914
-		) ) );
3914
+		)));
3915 3915
 
3916 3916
 		// Input type: Color
3917 3917
 		// With sanitize_callback
3918
-		$this->add_setting( 'background_color', array(
3919
-			'default'        => get_theme_support( 'custom-background', 'default-color' ),
3918
+		$this->add_setting('background_color', array(
3919
+			'default'        => get_theme_support('custom-background', 'default-color'),
3920 3920
 			'theme_supports' => 'custom-background',
3921 3921
 
3922 3922
 			'sanitize_callback'    => 'sanitize_hex_color_no_hash',
3923 3923
 			'sanitize_js_callback' => 'maybe_hash_hex_color',
3924
-		) );
3924
+		));
3925 3925
 
3926
-		$this->add_control( new WP_Customize_Color_Control( $this, 'background_color', array(
3927
-			'label'   => __( 'Background Color' ),
3926
+		$this->add_control(new WP_Customize_Color_Control($this, 'background_color', array(
3927
+			'label'   => __('Background Color'),
3928 3928
 			'section' => 'colors',
3929
-		) ) );
3929
+		)));
3930 3930
 
3931 3931
 		/* Custom Header */
3932 3932
 
3933
-		if ( current_theme_supports( 'custom-header', 'video' ) ) {
3934
-			$title = __( 'Header Media' );
3935
-			$description = '<p>' . __( 'If you add a video, the image will be used as a fallback while the video loads.' ) . '</p>';
3933
+		if (current_theme_supports('custom-header', 'video')) {
3934
+			$title = __('Header Media');
3935
+			$description = '<p>'.__('If you add a video, the image will be used as a fallback while the video loads.').'</p>';
3936 3936
 
3937 3937
 			// @todo Customizer sections should support having notifications just like controls do. See <https://core.trac.wordpress.org/ticket/38794>.
3938 3938
 			$description .= '<div class="customize-control-notifications-container header-video-not-currently-previewable" style="display: none"><ul>';
3939
-			$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>';
3939
+			$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>';
3940 3940
 			$description .= '</ul></div>';
3941
-			$width = absint( get_theme_support( 'custom-header', 'width' ) );
3942
-			$height = absint( get_theme_support( 'custom-header', 'height' ) );
3943
-			if ( $width && $height ) {
3941
+			$width = absint(get_theme_support('custom-header', 'width'));
3942
+			$height = absint(get_theme_support('custom-header', 'height'));
3943
+			if ($width && $height) {
3944 3944
 				$control_description = sprintf(
3945 3945
 					/* translators: 1: .mp4, 2: header size in pixels */
3946
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.' ),
3946
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends dimensions of %2$s pixels.'),
3947 3947
 					'<code>.mp4</code>',
3948
-					sprintf( '<strong>%s &times; %s</strong>', $width, $height )
3948
+					sprintf('<strong>%s &times; %s</strong>', $width, $height)
3949 3949
 				);
3950
-			} elseif ( $width ) {
3950
+			} elseif ($width) {
3951 3951
 				$control_description = sprintf(
3952 3952
 					/* translators: 1: .mp4, 2: header width in pixels */
3953
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.' ),
3953
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a width of %2$s pixels.'),
3954 3954
 					'<code>.mp4</code>',
3955
-					sprintf( '<strong>%s</strong>', $width )
3955
+					sprintf('<strong>%s</strong>', $width)
3956 3956
 				);
3957 3957
 			} else {
3958 3958
 				$control_description = sprintf(
3959 3959
 					/* translators: 1: .mp4, 2: header height in pixels */
3960
-					__( 'Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.' ),
3960
+					__('Upload your video in %1$s format and minimize its file size for best results. Your theme recommends a height of %2$s pixels.'),
3961 3961
 					'<code>.mp4</code>',
3962
-					sprintf( '<strong>%s</strong>', $height )
3962
+					sprintf('<strong>%s</strong>', $height)
3963 3963
 				);
3964 3964
 			}
3965 3965
 		} else {
3966
-			$title = __( 'Header Image' );
3966
+			$title = __('Header Image');
3967 3967
 			$description = '';
3968 3968
 			$control_description = '';
3969 3969
 		}
3970 3970
 
3971
-		$this->add_section( 'header_image', array(
3971
+		$this->add_section('header_image', array(
3972 3972
 			'title'          => $title,
3973 3973
 			'description'    => $description,
3974 3974
 			'theme_supports' => 'custom-header',
3975 3975
 			'priority'       => 60,
3976
-		) );
3976
+		));
3977 3977
 
3978
-		$this->add_setting( 'header_video', array(
3979
-			'theme_supports'    => array( 'custom-header', 'video' ),
3978
+		$this->add_setting('header_video', array(
3979
+			'theme_supports'    => array('custom-header', 'video'),
3980 3980
 			'transport'         => 'postMessage',
3981 3981
 			'sanitize_callback' => 'absint',
3982
-			'validate_callback' => array( $this, '_validate_header_video' ),
3983
-		) );
3982
+			'validate_callback' => array($this, '_validate_header_video'),
3983
+		));
3984 3984
 
3985
-		$this->add_setting( 'external_header_video', array(
3986
-			'theme_supports'    => array( 'custom-header', 'video' ),
3985
+		$this->add_setting('external_header_video', array(
3986
+			'theme_supports'    => array('custom-header', 'video'),
3987 3987
 			'transport'         => 'postMessage',
3988
-			'sanitize_callback' => array( $this, '_sanitize_external_header_video' ),
3989
-			'validate_callback' => array( $this, '_validate_external_header_video' ),
3990
-		) );
3988
+			'sanitize_callback' => array($this, '_sanitize_external_header_video'),
3989
+			'validate_callback' => array($this, '_validate_external_header_video'),
3990
+		));
3991 3991
 
3992
-		$this->add_setting( new WP_Customize_Filter_Setting( $this, 'header_image', array(
3993
-			'default'        => sprintf( get_theme_support( 'custom-header', 'default-image' ), get_template_directory_uri(), get_stylesheet_directory_uri() ),
3992
+		$this->add_setting(new WP_Customize_Filter_Setting($this, 'header_image', array(
3993
+			'default'        => sprintf(get_theme_support('custom-header', 'default-image'), get_template_directory_uri(), get_stylesheet_directory_uri()),
3994 3994
 			'theme_supports' => 'custom-header',
3995
-		) ) );
3995
+		)));
3996 3996
 
3997
-		$this->add_setting( new WP_Customize_Header_Image_Setting( $this, 'header_image_data', array(
3997
+		$this->add_setting(new WP_Customize_Header_Image_Setting($this, 'header_image_data', array(
3998 3998
 			'theme_supports' => 'custom-header',
3999
-		) ) );
3999
+		)));
4000 4000
 
4001 4001
 		/*
4002 4002
 		 * Switch image settings to postMessage when video support is enabled since
4003 4003
 		 * it entails that the_custom_header_markup() will be used, and thus selective
4004 4004
 		 * refresh can be utilized.
4005 4005
 		 */
4006
-		if ( current_theme_supports( 'custom-header', 'video' ) ) {
4007
-			$this->get_setting( 'header_image' )->transport = 'postMessage';
4008
-			$this->get_setting( 'header_image_data' )->transport = 'postMessage';
4006
+		if (current_theme_supports('custom-header', 'video')) {
4007
+			$this->get_setting('header_image')->transport = 'postMessage';
4008
+			$this->get_setting('header_image_data')->transport = 'postMessage';
4009 4009
 		}
4010 4010
 
4011
-		$this->add_control( new WP_Customize_Media_Control( $this, 'header_video', array(
4012
-			'theme_supports' => array( 'custom-header', 'video' ),
4013
-			'label'          => __( 'Header Video' ),
4011
+		$this->add_control(new WP_Customize_Media_Control($this, 'header_video', array(
4012
+			'theme_supports' => array('custom-header', 'video'),
4013
+			'label'          => __('Header Video'),
4014 4014
 			'description'    => $control_description,
4015 4015
 			'section'        => 'header_image',
4016 4016
 			'mime_type'      => 'video',
4017 4017
 			// @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>.
4018 4018
 			'button_labels'  => array(
4019
-				'select'       => __( 'Select Video' ),
4020
-				'change'       => __( 'Change Video' ),
4021
-				'placeholder'  => __( 'No video selected' ),
4022
-				'frame_title'  => __( 'Select Video' ),
4023
-				'frame_button' => __( 'Choose Video' ),
4019
+				'select'       => __('Select Video'),
4020
+				'change'       => __('Change Video'),
4021
+				'placeholder'  => __('No video selected'),
4022
+				'frame_title'  => __('Select Video'),
4023
+				'frame_button' => __('Choose Video'),
4024 4024
 			),
4025 4025
 			'active_callback' => 'is_header_video_active',
4026
-		) ) );
4026
+		)));
4027 4027
 
4028
-		$this->add_control( 'external_header_video', array(
4029
-			'theme_supports' => array( 'custom-header', 'video' ),
4028
+		$this->add_control('external_header_video', array(
4029
+			'theme_supports' => array('custom-header', 'video'),
4030 4030
 			'type'           => 'url',
4031
-			'description'    => __( 'Or, enter a YouTube URL:' ),
4031
+			'description'    => __('Or, enter a YouTube URL:'),
4032 4032
 			'section'        => 'header_image',
4033 4033
 			'active_callback' => 'is_header_video_active',
4034
-		) );
4034
+		));
4035 4035
 
4036
-		$this->add_control( new WP_Customize_Header_Image_Control( $this ) );
4036
+		$this->add_control(new WP_Customize_Header_Image_Control($this));
4037 4037
 
4038
-		$this->selective_refresh->add_partial( 'custom_header', array(
4038
+		$this->selective_refresh->add_partial('custom_header', array(
4039 4039
 			'selector'            => '#wp-custom-header',
4040 4040
 			'render_callback'     => 'the_custom_header_markup',
4041
-			'settings'            => array( 'header_video', 'external_header_video', 'header_image' ), // The image is used as a video fallback here.
4041
+			'settings'            => array('header_video', 'external_header_video', 'header_image'), // The image is used as a video fallback here.
4042 4042
 			'container_inclusive' => true,
4043
-		) );
4043
+		));
4044 4044
 
4045 4045
 		/* Custom Background */
4046 4046
 
4047
-		$this->add_section( 'background_image', array(
4048
-			'title'          => __( 'Background Image' ),
4047
+		$this->add_section('background_image', array(
4048
+			'title'          => __('Background Image'),
4049 4049
 			'theme_supports' => 'custom-background',
4050 4050
 			'priority'       => 80,
4051
-		) );
4051
+		));
4052 4052
 
4053
-		$this->add_setting( 'background_image', array(
4054
-			'default'        => get_theme_support( 'custom-background', 'default-image' ),
4053
+		$this->add_setting('background_image', array(
4054
+			'default'        => get_theme_support('custom-background', 'default-image'),
4055 4055
 			'theme_supports' => 'custom-background',
4056
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4057
-		) );
4056
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4057
+		));
4058 4058
 
4059
-		$this->add_setting( new WP_Customize_Background_Image_Setting( $this, 'background_image_thumb', array(
4059
+		$this->add_setting(new WP_Customize_Background_Image_Setting($this, 'background_image_thumb', array(
4060 4060
 			'theme_supports' => 'custom-background',
4061
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4062
-		) ) );
4061
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4062
+		)));
4063 4063
 
4064
-		$this->add_control( new WP_Customize_Background_Image_Control( $this ) );
4064
+		$this->add_control(new WP_Customize_Background_Image_Control($this));
4065 4065
 
4066
-		$this->add_setting( 'background_preset', array(
4067
-			'default'        => get_theme_support( 'custom-background', 'default-preset' ),
4066
+		$this->add_setting('background_preset', array(
4067
+			'default'        => get_theme_support('custom-background', 'default-preset'),
4068 4068
 			'theme_supports' => 'custom-background',
4069
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4070
-		) );
4069
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4070
+		));
4071 4071
 
4072
-		$this->add_control( 'background_preset', array(
4073
-			'label'      => _x( 'Preset', 'Background Preset' ),
4072
+		$this->add_control('background_preset', array(
4073
+			'label'      => _x('Preset', 'Background Preset'),
4074 4074
 			'section'    => 'background_image',
4075 4075
 			'type'       => 'select',
4076 4076
 			'choices'    => array(
4077
-				'default' => _x( 'Default', 'Default Preset' ),
4078
-				'fill'    => __( 'Fill Screen' ),
4079
-				'fit'     => __( 'Fit to Screen' ),
4080
-				'repeat'  => _x( 'Repeat', 'Repeat Image' ),
4081
-				'custom'  => _x( 'Custom', 'Custom Preset' ),
4077
+				'default' => _x('Default', 'Default Preset'),
4078
+				'fill'    => __('Fill Screen'),
4079
+				'fit'     => __('Fit to Screen'),
4080
+				'repeat'  => _x('Repeat', 'Repeat Image'),
4081
+				'custom'  => _x('Custom', 'Custom Preset'),
4082 4082
 			),
4083
-		) );
4083
+		));
4084 4084
 
4085
-		$this->add_setting( 'background_position_x', array(
4086
-			'default'        => get_theme_support( 'custom-background', 'default-position-x' ),
4085
+		$this->add_setting('background_position_x', array(
4086
+			'default'        => get_theme_support('custom-background', 'default-position-x'),
4087 4087
 			'theme_supports' => 'custom-background',
4088
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4089
-		) );
4088
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4089
+		));
4090 4090
 
4091
-		$this->add_setting( 'background_position_y', array(
4092
-			'default'        => get_theme_support( 'custom-background', 'default-position-y' ),
4091
+		$this->add_setting('background_position_y', array(
4092
+			'default'        => get_theme_support('custom-background', 'default-position-y'),
4093 4093
 			'theme_supports' => 'custom-background',
4094
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4095
-		) );
4094
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4095
+		));
4096 4096
 
4097
-		$this->add_control( new WP_Customize_Background_Position_Control( $this, 'background_position', array(
4098
-			'label'    => __( 'Image Position' ),
4097
+		$this->add_control(new WP_Customize_Background_Position_Control($this, 'background_position', array(
4098
+			'label'    => __('Image Position'),
4099 4099
 			'section'  => 'background_image',
4100 4100
 			'settings' => array(
4101 4101
 				'x' => 'background_position_x',
4102 4102
 				'y' => 'background_position_y',
4103 4103
 			),
4104
-		) ) );
4104
+		)));
4105 4105
 
4106
-		$this->add_setting( 'background_size', array(
4107
-			'default'        => get_theme_support( 'custom-background', 'default-size' ),
4106
+		$this->add_setting('background_size', array(
4107
+			'default'        => get_theme_support('custom-background', 'default-size'),
4108 4108
 			'theme_supports' => 'custom-background',
4109
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4110
-		) );
4109
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4110
+		));
4111 4111
 
4112
-		$this->add_control( 'background_size', array(
4113
-			'label'      => __( 'Image Size' ),
4112
+		$this->add_control('background_size', array(
4113
+			'label'      => __('Image Size'),
4114 4114
 			'section'    => 'background_image',
4115 4115
 			'type'       => 'select',
4116 4116
 			'choices'    => array(
4117
-				'auto'    => __( 'Original' ),
4118
-				'contain' => __( 'Fit to Screen' ),
4119
-				'cover'   => __( 'Fill Screen' ),
4117
+				'auto'    => __('Original'),
4118
+				'contain' => __('Fit to Screen'),
4119
+				'cover'   => __('Fill Screen'),
4120 4120
 			),
4121
-		) );
4121
+		));
4122 4122
 
4123
-		$this->add_setting( 'background_repeat', array(
4124
-			'default'           => get_theme_support( 'custom-background', 'default-repeat' ),
4125
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4123
+		$this->add_setting('background_repeat', array(
4124
+			'default'           => get_theme_support('custom-background', 'default-repeat'),
4125
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4126 4126
 			'theme_supports'    => 'custom-background',
4127
-		) );
4127
+		));
4128 4128
 
4129
-		$this->add_control( 'background_repeat', array(
4130
-			'label'    => __( 'Repeat Background Image' ),
4129
+		$this->add_control('background_repeat', array(
4130
+			'label'    => __('Repeat Background Image'),
4131 4131
 			'section'  => 'background_image',
4132 4132
 			'type'     => 'checkbox',
4133
-		) );
4133
+		));
4134 4134
 
4135
-		$this->add_setting( 'background_attachment', array(
4136
-			'default'           => get_theme_support( 'custom-background', 'default-attachment' ),
4137
-			'sanitize_callback' => array( $this, '_sanitize_background_setting' ),
4135
+		$this->add_setting('background_attachment', array(
4136
+			'default'           => get_theme_support('custom-background', 'default-attachment'),
4137
+			'sanitize_callback' => array($this, '_sanitize_background_setting'),
4138 4138
 			'theme_supports'    => 'custom-background',
4139
-		) );
4139
+		));
4140 4140
 
4141
-		$this->add_control( 'background_attachment', array(
4142
-			'label'    => __( 'Scroll with Page' ),
4141
+		$this->add_control('background_attachment', array(
4142
+			'label'    => __('Scroll with Page'),
4143 4143
 			'section'  => 'background_image',
4144 4144
 			'type'     => 'checkbox',
4145
-		) );
4145
+		));
4146 4146
 
4147 4147
 
4148 4148
 		// If the theme is using the default background callback, we can update
4149 4149
 		// the background CSS using postMessage.
4150
-		if ( get_theme_support( 'custom-background', 'wp-head-callback' ) === '_custom_background_cb' ) {
4151
-			foreach ( array( 'color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment' ) as $prop ) {
4152
-				$this->get_setting( 'background_' . $prop )->transport = 'postMessage';
4150
+		if (get_theme_support('custom-background', 'wp-head-callback') === '_custom_background_cb') {
4151
+			foreach (array('color', 'image', 'preset', 'position_x', 'position_y', 'size', 'repeat', 'attachment') as $prop) {
4152
+				$this->get_setting('background_'.$prop)->transport = 'postMessage';
4153 4153
 			}
4154 4154
 		}
4155 4155
 
@@ -4159,81 +4159,81 @@  discard block
 block discarded – undo
4159 4159
 		 * The following replicates behavior from options-reading.php.
4160 4160
 		 */
4161 4161
 
4162
-		$this->add_section( 'static_front_page', array(
4163
-			'title' => __( 'Static Front Page' ),
4162
+		$this->add_section('static_front_page', array(
4163
+			'title' => __('Static Front Page'),
4164 4164
 			'priority' => 120,
4165
-			'description' => __( 'Your theme supports a static front page.' ),
4166
-			'active_callback' => array( $this, 'has_published_pages' ),
4167
-		) );
4165
+			'description' => __('Your theme supports a static front page.'),
4166
+			'active_callback' => array($this, 'has_published_pages'),
4167
+		));
4168 4168
 
4169
-		$this->add_setting( 'show_on_front', array(
4170
-			'default' => get_option( 'show_on_front' ),
4169
+		$this->add_setting('show_on_front', array(
4170
+			'default' => get_option('show_on_front'),
4171 4171
 			'capability' => 'manage_options',
4172 4172
 			'type' => 'option',
4173
-		) );
4173
+		));
4174 4174
 
4175
-		$this->add_control( 'show_on_front', array(
4176
-			'label' => __( 'Front page displays' ),
4175
+		$this->add_control('show_on_front', array(
4176
+			'label' => __('Front page displays'),
4177 4177
 			'section' => 'static_front_page',
4178 4178
 			'type' => 'radio',
4179 4179
 			'choices' => array(
4180
-				'posts' => __( 'Your latest posts' ),
4181
-				'page'  => __( 'A static page' ),
4180
+				'posts' => __('Your latest posts'),
4181
+				'page'  => __('A static page'),
4182 4182
 			),
4183
-		) );
4183
+		));
4184 4184
 
4185
-		$this->add_setting( 'page_on_front', array(
4185
+		$this->add_setting('page_on_front', array(
4186 4186
 			'type'       => 'option',
4187 4187
 			'capability' => 'manage_options',
4188
-		) );
4188
+		));
4189 4189
 
4190
-		$this->add_control( 'page_on_front', array(
4191
-			'label' => __( 'Front page' ),
4190
+		$this->add_control('page_on_front', array(
4191
+			'label' => __('Front page'),
4192 4192
 			'section' => 'static_front_page',
4193 4193
 			'type' => 'dropdown-pages',
4194 4194
 			'allow_addition' => true,
4195
-		) );
4195
+		));
4196 4196
 
4197
-		$this->add_setting( 'page_for_posts', array(
4197
+		$this->add_setting('page_for_posts', array(
4198 4198
 			'type' => 'option',
4199 4199
 			'capability' => 'manage_options',
4200
-		) );
4200
+		));
4201 4201
 
4202
-		$this->add_control( 'page_for_posts', array(
4203
-			'label' => __( 'Posts page' ),
4202
+		$this->add_control('page_for_posts', array(
4203
+			'label' => __('Posts page'),
4204 4204
 			'section' => 'static_front_page',
4205 4205
 			'type' => 'dropdown-pages',
4206 4206
 			'allow_addition' => true,
4207
-		) );
4207
+		));
4208 4208
 
4209 4209
 		/* Custom CSS */
4210
-		$this->add_section( 'custom_css', array(
4211
-			'title'              => __( 'Additional CSS' ),
4210
+		$this->add_section('custom_css', array(
4211
+			'title'              => __('Additional CSS'),
4212 4212
 			'priority'           => 200,
4213 4213
 			'description_hidden' => true,
4214
-			'description'        => sprintf( '%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>',
4215
-				__( '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.' ),
4216
-				esc_url( __( 'https://codex.wordpress.org/CSS' ) ),
4217
-				__( 'Learn more about CSS' ),
4214
+			'description'        => sprintf('%s<br /><a href="%s" class="external-link" target="_blank">%s<span class="screen-reader-text">%s</span></a>',
4215
+				__('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.'),
4216
+				esc_url(__('https://codex.wordpress.org/CSS')),
4217
+				__('Learn more about CSS'),
4218 4218
 				/* translators: accessibility text */
4219
-				__( '(opens in a new window)' )
4219
+				__('(opens in a new window)')
4220 4220
 			),
4221
-		) );
4221
+		));
4222 4222
 
4223
-		$custom_css_setting = new WP_Customize_Custom_CSS_Setting( $this, sprintf( 'custom_css[%s]', get_stylesheet() ), array(
4223
+		$custom_css_setting = new WP_Customize_Custom_CSS_Setting($this, sprintf('custom_css[%s]', get_stylesheet()), array(
4224 4224
 			'capability' => 'edit_css',
4225
-			'default' => sprintf( "/*\n%s\n*/", __( "You can add your own CSS here.\n\nClick the help icon above to learn more." ) ),
4226
-		) );
4227
-		$this->add_setting( $custom_css_setting );
4225
+			'default' => sprintf("/*\n%s\n*/", __("You can add your own CSS here.\n\nClick the help icon above to learn more.")),
4226
+		));
4227
+		$this->add_setting($custom_css_setting);
4228 4228
 
4229
-		$this->add_control( 'custom_css', array(
4229
+		$this->add_control('custom_css', array(
4230 4230
 			'type'     => 'textarea',
4231 4231
 			'section'  => 'custom_css',
4232
-			'settings' => array( 'default' => $custom_css_setting->id ),
4232
+			'settings' => array('default' => $custom_css_setting->id),
4233 4233
 			'input_attrs' => array(
4234 4234
 				'class' => 'code', // Ensures contents displayed as LTR instead of RTL.
4235 4235
 			),
4236
-		) );
4236
+		));
4237 4237
 	}
4238 4238
 
4239 4239
 	/**
@@ -4247,15 +4247,15 @@  discard block
 block discarded – undo
4247 4247
 	 */
4248 4248
 	public function has_published_pages() {
4249 4249
 
4250
-		$setting = $this->get_setting( 'nav_menus_created_posts' );
4251
-		if ( $setting ) {
4252
-			foreach ( $setting->value() as $post_id ) {
4253
-				if ( 'page' === get_post_type( $post_id ) ) {
4250
+		$setting = $this->get_setting('nav_menus_created_posts');
4251
+		if ($setting) {
4252
+			foreach ($setting->value() as $post_id) {
4253
+				if ('page' === get_post_type($post_id)) {
4254 4254
 					return true;
4255 4255
 				}
4256 4256
 			}
4257 4257
 		}
4258
-		return 0 !== count( get_pages() );
4258
+		return 0 !== count(get_pages());
4259 4259
 	}
4260 4260
 
4261 4261
 	/**
@@ -4267,8 +4267,8 @@  discard block
 block discarded – undo
4267 4267
 	 * @see add_dynamic_settings()
4268 4268
 	 */
4269 4269
 	public function register_dynamic_settings() {
4270
-		$setting_ids = array_keys( $this->unsanitized_post_values() );
4271
-		$this->add_dynamic_settings( $setting_ids );
4270
+		$setting_ids = array_keys($this->unsanitized_post_values());
4271
+		$this->add_dynamic_settings($setting_ids);
4272 4272
 	}
4273 4273
 
4274 4274
 	/**
@@ -4282,13 +4282,13 @@  discard block
 block discarded – undo
4282 4282
 	 * @param string $color
4283 4283
 	 * @return mixed
4284 4284
 	 */
4285
-	public function _sanitize_header_textcolor( $color ) {
4286
-		if ( 'blank' === $color )
4285
+	public function _sanitize_header_textcolor($color) {
4286
+		if ('blank' === $color)
4287 4287
 			return 'blank';
4288 4288
 
4289
-		$color = sanitize_hex_color_no_hash( $color );
4290
-		if ( empty( $color ) )
4291
-			$color = get_theme_support( 'custom-header', 'default-text-color' );
4289
+		$color = sanitize_hex_color_no_hash($color);
4290
+		if (empty($color))
4291
+			$color = get_theme_support('custom-header', 'default-text-color');
4292 4292
 
4293 4293
 		return $color;
4294 4294
 	}
@@ -4302,35 +4302,35 @@  discard block
 block discarded – undo
4302 4302
 	 * @param WP_Customize_Setting $setting Setting.
4303 4303
 	 * @return string|WP_Error Background value or validation error.
4304 4304
 	 */
4305
-	public function _sanitize_background_setting( $value, $setting ) {
4306
-		if ( 'background_repeat' === $setting->id ) {
4307
-			if ( ! in_array( $value, array( 'repeat-x', 'repeat-y', 'repeat', 'no-repeat' ) ) ) {
4308
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background repeat.' ) );
4305
+	public function _sanitize_background_setting($value, $setting) {
4306
+		if ('background_repeat' === $setting->id) {
4307
+			if ( ! in_array($value, array('repeat-x', 'repeat-y', 'repeat', 'no-repeat'))) {
4308
+				return new WP_Error('invalid_value', __('Invalid value for background repeat.'));
4309 4309
 			}
4310
-		} elseif ( 'background_attachment' === $setting->id ) {
4311
-			if ( ! in_array( $value, array( 'fixed', 'scroll' ) ) ) {
4312
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background attachment.' ) );
4310
+		} elseif ('background_attachment' === $setting->id) {
4311
+			if ( ! in_array($value, array('fixed', 'scroll'))) {
4312
+				return new WP_Error('invalid_value', __('Invalid value for background attachment.'));
4313 4313
 			}
4314
-		} elseif ( 'background_position_x' === $setting->id ) {
4315
-			if ( ! in_array( $value, array( 'left', 'center', 'right' ), true ) ) {
4316
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background position X.' ) );
4314
+		} elseif ('background_position_x' === $setting->id) {
4315
+			if ( ! in_array($value, array('left', 'center', 'right'), true)) {
4316
+				return new WP_Error('invalid_value', __('Invalid value for background position X.'));
4317 4317
 			}
4318
-		} elseif ( 'background_position_y' === $setting->id ) {
4319
-			if ( ! in_array( $value, array( 'top', 'center', 'bottom' ), true ) ) {
4320
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background position Y.' ) );
4318
+		} elseif ('background_position_y' === $setting->id) {
4319
+			if ( ! in_array($value, array('top', 'center', 'bottom'), true)) {
4320
+				return new WP_Error('invalid_value', __('Invalid value for background position Y.'));
4321 4321
 			}
4322
-		} elseif ( 'background_size' === $setting->id ) {
4323
-			if ( ! in_array( $value, array( 'auto', 'contain', 'cover' ), true ) ) {
4324
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
4322
+		} elseif ('background_size' === $setting->id) {
4323
+			if ( ! in_array($value, array('auto', 'contain', 'cover'), true)) {
4324
+				return new WP_Error('invalid_value', __('Invalid value for background size.'));
4325 4325
 			}
4326
-		} elseif ( 'background_preset' === $setting->id ) {
4327
-			if ( ! in_array( $value, array( 'default', 'fill', 'fit', 'repeat', 'custom' ), true ) ) {
4328
-				return new WP_Error( 'invalid_value', __( 'Invalid value for background size.' ) );
4326
+		} elseif ('background_preset' === $setting->id) {
4327
+			if ( ! in_array($value, array('default', 'fill', 'fit', 'repeat', 'custom'), true)) {
4328
+				return new WP_Error('invalid_value', __('Invalid value for background size.'));
4329 4329
 			}
4330
-		} elseif ( 'background_image' === $setting->id || 'background_image_thumb' === $setting->id ) {
4331
-			$value = empty( $value ) ? '' : esc_url_raw( $value );
4330
+		} elseif ('background_image' === $setting->id || 'background_image_thumb' === $setting->id) {
4331
+			$value = empty($value) ? '' : esc_url_raw($value);
4332 4332
 		} else {
4333
-			return new WP_Error( 'unrecognized_setting', __( 'Unrecognized background setting.' ) );
4333
+			return new WP_Error('unrecognized_setting', __('Unrecognized background setting.'));
4334 4334
 		}
4335 4335
 		return $value;
4336 4336
 	}
@@ -4345,8 +4345,8 @@  discard block
 block discarded – undo
4345 4345
 	 * @param array $partials Array of partials.
4346 4346
 	 * @return array
4347 4347
 	 */
4348
-	public function export_header_video_settings( $response, $selective_refresh, $partials ) {
4349
-		if ( isset( $partials['custom_header'] ) ) {
4348
+	public function export_header_video_settings($response, $selective_refresh, $partials) {
4349
+		if (isset($partials['custom_header'])) {
4350 4350
 			$response['custom_header_settings'] = get_header_video_settings();
4351 4351
 		}
4352 4352
 
@@ -4364,22 +4364,22 @@  discard block
 block discarded – undo
4364 4364
 	 * @param mixed $value
4365 4365
 	 * @return mixed
4366 4366
 	 */
4367
-	public function _validate_header_video( $validity, $value ) {
4368
-		$video = get_attached_file( absint( $value ) );
4369
-		if ( $video ) {
4370
-			$size = filesize( $video );
4371
-			if ( 8 < $size / pow( 1024, 2 ) ) { // Check whether the size is larger than 8MB.
4372
-				$validity->add( 'size_too_large',
4373
-					__( '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.' )
4367
+	public function _validate_header_video($validity, $value) {
4368
+		$video = get_attached_file(absint($value));
4369
+		if ($video) {
4370
+			$size = filesize($video);
4371
+			if (8 < $size / pow(1024, 2)) { // Check whether the size is larger than 8MB.
4372
+				$validity->add('size_too_large',
4373
+					__('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.')
4374 4374
 				);
4375 4375
 			}
4376
-			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.
4377
-				$validity->add( 'invalid_file_type', sprintf(
4376
+			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.
4377
+				$validity->add('invalid_file_type', sprintf(
4378 4378
 					/* translators: 1: .mp4, 2: .mov */
4379
-					__( '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.' ),
4379
+					__('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.'),
4380 4380
 					'<code>.mp4</code>',
4381 4381
 					'<code>.mov</code>'
4382
-				) );
4382
+				));
4383 4383
 			}
4384 4384
 		}
4385 4385
 		return $validity;
@@ -4396,11 +4396,11 @@  discard block
 block discarded – undo
4396 4396
 	 * @param mixed $value
4397 4397
 	 * @return mixed
4398 4398
 	 */
4399
-	public function _validate_external_header_video( $validity, $value ) {
4400
-		$video = esc_url_raw( $value );
4401
-		if ( $video ) {
4402
-			if ( ! preg_match( '#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video ) ) {
4403
-				$validity->add( 'invalid_url', __( 'Please enter a valid YouTube URL.' ) );
4399
+	public function _validate_external_header_video($validity, $value) {
4400
+		$video = esc_url_raw($value);
4401
+		if ($video) {
4402
+			if ( ! preg_match('#^https?://(?:www\.)?(?:youtube\.com/watch|youtu\.be/)#', $video)) {
4403
+				$validity->add('invalid_url', __('Please enter a valid YouTube URL.'));
4404 4404
 			}
4405 4405
 		}
4406 4406
 		return $validity;
@@ -4414,8 +4414,8 @@  discard block
 block discarded – undo
4414 4414
 	 * @param string $value URL.
4415 4415
 	 * @return string Sanitized URL.
4416 4416
 	 */
4417
-	public function _sanitize_external_header_video( $value ) {
4418
-		return esc_url_raw( trim( $value ) );
4417
+	public function _sanitize_external_header_video($value) {
4418
+		return esc_url_raw(trim($value));
4419 4419
 	}
4420 4420
 
4421 4421
 	/**
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.