Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/class-wp-post.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -205,7 +205,7 @@
 block discarded – undo
205 205
 	 * @global wpdb $wpdb WordPress database abstraction object.
206 206
 	 *
207 207
 	 * @param int $post_id Post ID.
208
-	 * @return WP_Post|false Post object, false otherwise.
208
+	 * @return string Post object, false otherwise.
209 209
 	 */
210 210
 	public static function get_instance( $post_id ) {
211 211
 		global $wpdb;
Please login to merge, or discard this patch.
Spacing   +46 added lines, -46 removed lines patch added patch discarded remove patch
@@ -207,30 +207,30 @@  discard block
 block discarded – undo
207 207
 	 * @param int $post_id Post ID.
208 208
 	 * @return WP_Post|false Post object, false otherwise.
209 209
 	 */
210
-	public static function get_instance( $post_id ) {
210
+	public static function get_instance($post_id) {
211 211
 		global $wpdb;
212 212
 
213
-		if ( ! is_numeric( $post_id ) || $post_id != floor( $post_id ) || ! $post_id ) {
213
+		if ( ! is_numeric($post_id) || $post_id != floor($post_id) || ! $post_id) {
214 214
 			return false;
215 215
 		}
216 216
 
217 217
 		$post_id = (int) $post_id;
218 218
 
219
-		$_post = wp_cache_get( $post_id, 'posts' );
219
+		$_post = wp_cache_get($post_id, 'posts');
220 220
 
221
-		if ( ! $_post ) {
222
-			$_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
221
+		if ( ! $_post) {
222
+			$_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id));
223 223
 
224
-			if ( ! $_post )
224
+			if ( ! $_post)
225 225
 				return false;
226 226
 
227
-			$_post = sanitize_post( $_post, 'raw' );
228
-			wp_cache_add( $_post->ID, $_post, 'posts' );
229
-		} elseif ( empty( $_post->filter ) ) {
230
-			$_post = sanitize_post( $_post, 'raw' );
227
+			$_post = sanitize_post($_post, 'raw');
228
+			wp_cache_add($_post->ID, $_post, 'posts');
229
+		} elseif (empty($_post->filter)) {
230
+			$_post = sanitize_post($_post, 'raw');
231 231
 		}
232 232
 
233
-		return new WP_Post( $_post );
233
+		return new WP_Post($_post);
234 234
 	}
235 235
 
236 236
 	/**
@@ -238,8 +238,8 @@  discard block
 block discarded – undo
238 238
 	 *
239 239
 	 * @param WP_Post|object $post Post object.
240 240
 	 */
241
-	public function __construct( $post ) {
242
-		foreach ( get_object_vars( $post ) as $key => $value )
241
+	public function __construct($post) {
242
+		foreach (get_object_vars($post) as $key => $value)
243 243
 			$this->$key = $value;
244 244
 	}
245 245
 
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 	 * @param string $key Property to check if set.
250 250
 	 * @return bool
251 251
 	 */
252
-	public function __isset( $key ) {
253
-		if ( 'ancestors' == $key )
252
+	public function __isset($key) {
253
+		if ('ancestors' == $key)
254 254
 			return true;
255 255
 
256
-		if ( 'page_template' == $key )
256
+		if ('page_template' == $key)
257 257
 			return true;
258 258
 
259
-		if ( 'post_category' == $key )
259
+		if ('post_category' == $key)
260 260
 		   return true;
261 261
 
262
-		if ( 'tags_input' == $key )
262
+		if ('tags_input' == $key)
263 263
 		   return true;
264 264
 
265
-		return metadata_exists( 'post', $this->ID, $key );
265
+		return metadata_exists('post', $this->ID, $key);
266 266
 	}
267 267
 
268 268
 	/**
@@ -271,39 +271,39 @@  discard block
 block discarded – undo
271 271
 	 * @param string $key Key to get.
272 272
 	 * @return mixed
273 273
 	 */
274
-	public function __get( $key ) {
275
-		if ( 'page_template' == $key && $this->__isset( $key ) ) {
276
-			return get_post_meta( $this->ID, '_wp_page_template', true );
274
+	public function __get($key) {
275
+		if ('page_template' == $key && $this->__isset($key)) {
276
+			return get_post_meta($this->ID, '_wp_page_template', true);
277 277
 		}
278 278
 
279
-		if ( 'post_category' == $key ) {
280
-			if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
281
-				$terms = get_the_terms( $this, 'category' );
279
+		if ('post_category' == $key) {
280
+			if (is_object_in_taxonomy($this->post_type, 'category'))
281
+				$terms = get_the_terms($this, 'category');
282 282
 
283
-			if ( empty( $terms ) )
283
+			if (empty($terms))
284 284
 				return array();
285 285
 
286
-			return wp_list_pluck( $terms, 'term_id' );
286
+			return wp_list_pluck($terms, 'term_id');
287 287
 		}
288 288
 
289
-		if ( 'tags_input' == $key ) {
290
-			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
291
-				$terms = get_the_terms( $this, 'post_tag' );
289
+		if ('tags_input' == $key) {
290
+			if (is_object_in_taxonomy($this->post_type, 'post_tag'))
291
+				$terms = get_the_terms($this, 'post_tag');
292 292
 
293
-			if ( empty( $terms ) )
293
+			if (empty($terms))
294 294
 				return array();
295 295
 
296
-			return wp_list_pluck( $terms, 'name' );
296
+			return wp_list_pluck($terms, 'name');
297 297
 		}
298 298
 
299 299
 		// Rest of the values need filtering.
300
-		if ( 'ancestors' == $key )
301
-			$value = get_post_ancestors( $this );
300
+		if ('ancestors' == $key)
301
+			$value = get_post_ancestors($this);
302 302
 		else
303
-			$value = get_post_meta( $this->ID, $key, true );
303
+			$value = get_post_meta($this->ID, $key, true);
304 304
 
305
-		if ( $this->filter )
306
-			$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
305
+		if ($this->filter)
306
+			$value = sanitize_post_field($key, $value, $this->ID, $this->filter);
307 307
 
308 308
 		return $value;
309 309
 	}
@@ -314,14 +314,14 @@  discard block
 block discarded – undo
314 314
 	 * @param string $filter Filter.
315 315
 	 * @return self|array|bool|object|WP_Post
316 316
 	 */
317
-	public function filter( $filter ) {
318
-		if ( $this->filter == $filter )
317
+	public function filter($filter) {
318
+		if ($this->filter == $filter)
319 319
 			return $this;
320 320
 
321
-		if ( $filter == 'raw' )
322
-			return self::get_instance( $this->ID );
321
+		if ($filter == 'raw')
322
+			return self::get_instance($this->ID);
323 323
 
324
-		return sanitize_post( $this, $filter );
324
+		return sanitize_post($this, $filter);
325 325
 	}
326 326
 
327 327
 	/**
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 	 * @return array Object as array.
331 331
 	 */
332 332
 	public function to_array() {
333
-		$post = get_object_vars( $this );
333
+		$post = get_object_vars($this);
334 334
 
335
-		foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
336
-			if ( $this->__isset( $key ) )
337
-				$post[ $key ] = $this->__get( $key );
335
+		foreach (array('ancestors', 'page_template', 'post_category', 'tags_input') as $key) {
336
+			if ($this->__isset($key))
337
+				$post[$key] = $this->__get($key);
338 338
 		}
339 339
 
340 340
 		return $post;
Please login to merge, or discard this patch.
Braces   +47 added lines, -32 removed lines patch added patch discarded remove patch
@@ -221,8 +221,9 @@  discard block
 block discarded – undo
221 221
 		if ( ! $_post ) {
222 222
 			$_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
223 223
 
224
-			if ( ! $_post )
225
-				return false;
224
+			if ( ! $_post ) {
225
+							return false;
226
+			}
226 227
 
227 228
 			$_post = sanitize_post( $_post, 'raw' );
228 229
 			wp_cache_add( $_post->ID, $_post, 'posts' );
@@ -239,8 +240,9 @@  discard block
 block discarded – undo
239 240
 	 * @param WP_Post|object $post Post object.
240 241
 	 */
241 242
 	public function __construct( $post ) {
242
-		foreach ( get_object_vars( $post ) as $key => $value )
243
-			$this->$key = $value;
243
+		foreach ( get_object_vars( $post ) as $key => $value ) {
244
+					$this->$key = $value;
245
+		}
244 246
 	}
245 247
 
246 248
 	/**
@@ -250,17 +252,21 @@  discard block
 block discarded – undo
250 252
 	 * @return bool
251 253
 	 */
252 254
 	public function __isset( $key ) {
253
-		if ( 'ancestors' == $key )
254
-			return true;
255
+		if ( 'ancestors' == $key ) {
256
+					return true;
257
+		}
255 258
 
256
-		if ( 'page_template' == $key )
257
-			return true;
259
+		if ( 'page_template' == $key ) {
260
+					return true;
261
+		}
258 262
 
259
-		if ( 'post_category' == $key )
260
-		   return true;
263
+		if ( 'post_category' == $key ) {
264
+				   return true;
265
+		}
261 266
 
262
-		if ( 'tags_input' == $key )
263
-		   return true;
267
+		if ( 'tags_input' == $key ) {
268
+				   return true;
269
+		}
264 270
 
265 271
 		return metadata_exists( 'post', $this->ID, $key );
266 272
 	}
@@ -277,33 +283,39 @@  discard block
 block discarded – undo
277 283
 		}
278 284
 
279 285
 		if ( 'post_category' == $key ) {
280
-			if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
281
-				$terms = get_the_terms( $this, 'category' );
286
+			if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) {
287
+							$terms = get_the_terms( $this, 'category' );
288
+			}
282 289
 
283
-			if ( empty( $terms ) )
284
-				return array();
290
+			if ( empty( $terms ) ) {
291
+							return array();
292
+			}
285 293
 
286 294
 			return wp_list_pluck( $terms, 'term_id' );
287 295
 		}
288 296
 
289 297
 		if ( 'tags_input' == $key ) {
290
-			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
291
-				$terms = get_the_terms( $this, 'post_tag' );
298
+			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) {
299
+							$terms = get_the_terms( $this, 'post_tag' );
300
+			}
292 301
 
293
-			if ( empty( $terms ) )
294
-				return array();
302
+			if ( empty( $terms ) ) {
303
+							return array();
304
+			}
295 305
 
296 306
 			return wp_list_pluck( $terms, 'name' );
297 307
 		}
298 308
 
299 309
 		// Rest of the values need filtering.
300
-		if ( 'ancestors' == $key )
301
-			$value = get_post_ancestors( $this );
302
-		else
303
-			$value = get_post_meta( $this->ID, $key, true );
310
+		if ( 'ancestors' == $key ) {
311
+					$value = get_post_ancestors( $this );
312
+		} else {
313
+					$value = get_post_meta( $this->ID, $key, true );
314
+		}
304 315
 
305
-		if ( $this->filter )
306
-			$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
316
+		if ( $this->filter ) {
317
+					$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
318
+		}
307 319
 
308 320
 		return $value;
309 321
 	}
@@ -315,11 +327,13 @@  discard block
 block discarded – undo
315 327
 	 * @return self|array|bool|object|WP_Post
316 328
 	 */
317 329
 	public function filter( $filter ) {
318
-		if ( $this->filter == $filter )
319
-			return $this;
330
+		if ( $this->filter == $filter ) {
331
+					return $this;
332
+		}
320 333
 
321
-		if ( $filter == 'raw' )
322
-			return self::get_instance( $this->ID );
334
+		if ( $filter == 'raw' ) {
335
+					return self::get_instance( $this->ID );
336
+		}
323 337
 
324 338
 		return sanitize_post( $this, $filter );
325 339
 	}
@@ -333,8 +347,9 @@  discard block
 block discarded – undo
333 347
 		$post = get_object_vars( $this );
334 348
 
335 349
 		foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
336
-			if ( $this->__isset( $key ) )
337
-				$post[ $key ] = $this->__get( $key );
350
+			if ( $this->__isset( $key ) ) {
351
+							$post[ $key ] = $this->__get( $key );
352
+			}
338 353
 		}
339 354
 
340 355
 		return $post;
Please login to merge, or discard this patch.
src/wp-includes/class-wp-user-query.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -183,7 +183,7 @@
 block discarded – undo
183 183
 	 * @access public
184 184
 	 *
185 185
 	 * @param string $name Property to check if set.
186
-	 * @return bool Whether the property is set.
186
+	 * @return boolean|null Whether the property is set.
187 187
 	 */
188 188
 	public function __isset( $name ) {
189 189
 		if ( in_array( $name, $this->compat_fields ) ) {
Please login to merge, or discard this patch.
Braces   +42 added lines, -32 removed lines patch added patch discarded remove patch
@@ -237,8 +237,9 @@  discard block
 block discarded – undo
237 237
 			$this->query_fields = "$wpdb->users.ID";
238 238
 		}
239 239
 
240
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] )
241
-			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
240
+		if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
241
+					$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
242
+		}
242 243
 
243 244
 		$this->query_from = "FROM $wpdb->users";
244 245
 		$this->query_where = "WHERE 1=1";
@@ -432,35 +433,40 @@  discard block
 block discarded – undo
432 433
 		}
433 434
 
434 435
 		$search = '';
435
-		if ( isset( $qv['search'] ) )
436
-			$search = trim( $qv['search'] );
436
+		if ( isset( $qv['search'] ) ) {
437
+					$search = trim( $qv['search'] );
438
+		}
437 439
 
438 440
 		if ( $search ) {
439 441
 			$leading_wild = ( ltrim($search, '*') != $search );
440 442
 			$trailing_wild = ( rtrim($search, '*') != $search );
441
-			if ( $leading_wild && $trailing_wild )
442
-				$wild = 'both';
443
-			elseif ( $leading_wild )
444
-				$wild = 'leading';
445
-			elseif ( $trailing_wild )
446
-				$wild = 'trailing';
447
-			else
448
-				$wild = false;
449
-			if ( $wild )
450
-				$search = trim($search, '*');
443
+			if ( $leading_wild && $trailing_wild ) {
444
+							$wild = 'both';
445
+			} elseif ( $leading_wild ) {
446
+							$wild = 'leading';
447
+			} elseif ( $trailing_wild ) {
448
+							$wild = 'trailing';
449
+			} else {
450
+							$wild = false;
451
+			}
452
+			if ( $wild ) {
453
+							$search = trim($search, '*');
454
+			}
451 455
 
452 456
 			$search_columns = array();
453
-			if ( $qv['search_columns'] )
454
-				$search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) );
457
+			if ( $qv['search_columns'] ) {
458
+							$search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) );
459
+			}
455 460
 			if ( ! $search_columns ) {
456
-				if ( false !== strpos( $search, '@') )
457
-					$search_columns = array('user_email');
458
-				elseif ( is_numeric($search) )
459
-					$search_columns = array('user_login', 'ID');
460
-				elseif ( preg_match('|^https?://|', $search) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) )
461
-					$search_columns = array('user_url');
462
-				else
463
-					$search_columns = array('user_login', 'user_url', 'user_email', 'user_nicename', 'display_name');
461
+				if ( false !== strpos( $search, '@') ) {
462
+									$search_columns = array('user_email');
463
+				} elseif ( is_numeric($search) ) {
464
+									$search_columns = array('user_login', 'ID');
465
+				} elseif ( preg_match('|^https?://|', $search) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) ) {
466
+									$search_columns = array('user_url');
467
+				} else {
468
+									$search_columns = array('user_login', 'user_url', 'user_email', 'user_nicename', 'display_name');
469
+				}
464 470
 			}
465 471
 
466 472
 			/**
@@ -539,18 +545,21 @@  discard block
 block discarded – undo
539 545
 		 *
540 546
 		 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query.
541 547
 		 */
542
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] )
543
-			$this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
548
+		if ( isset( $qv['count_total'] ) && $qv['count_total'] ) {
549
+					$this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
550
+		}
544 551
 
545
-		if ( !$this->results )
546
-			return;
552
+		if ( !$this->results ) {
553
+					return;
554
+		}
547 555
 
548 556
 		if ( 'all_with_meta' == $qv['fields'] ) {
549 557
 			cache_users( $this->results );
550 558
 
551 559
 			$r = array();
552
-			foreach ( $this->results as $userid )
553
-				$r[ $userid ] = new WP_User( $userid, '', $qv['blog_id'] );
560
+			foreach ( $this->results as $userid ) {
561
+							$r[ $userid ] = new WP_User( $userid, '', $qv['blog_id'] );
562
+			}
554 563
 
555 564
 			$this->results = $r;
556 565
 		} elseif ( 'all' == $qv['fields'] ) {
@@ -570,8 +579,9 @@  discard block
 block discarded – undo
570 579
 	 * @return mixed
571 580
 	 */
572 581
 	public function get( $query_var ) {
573
-		if ( isset( $this->query_vars[$query_var] ) )
574
-			return $this->query_vars[$query_var];
582
+		if ( isset( $this->query_vars[$query_var] ) ) {
583
+					return $this->query_vars[$query_var];
584
+		}
575 585
 
576 586
 		return null;
577 587
 	}
Please login to merge, or discard this patch.
Spacing   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 	 */
62 62
 	public $request;
63 63
 
64
-	private $compat_fields = array( 'results', 'total_users' );
64
+	private $compat_fields = array('results', 'total_users');
65 65
 
66 66
 	// SQL clauses
67 67
 	public $query_fields;
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 	 *
78 78
 	 * @param null|string|array $query Optional. The query variables.
79 79
 	 */
80
-	public function __construct( $query = null ) {
81
-		if ( ! empty( $query ) ) {
82
-			$this->prepare_query( $query );
80
+	public function __construct($query = null) {
81
+		if ( ! empty($query)) {
82
+			$this->prepare_query($query);
83 83
 			$this->query();
84 84
 		}
85 85
 	}
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
 	 * @param array $args Query vars, as passed to `WP_User_Query`.
94 94
 	 * @return array Complete query variables with undefined ones filled in with defaults.
95 95
 	 */
96
-	public static function fill_query_vars( $args ) {
96
+	public static function fill_query_vars($args) {
97 97
 		$defaults = array(
98 98
 			'blog_id' => get_current_blog_id(),
99 99
 			'role' => '',
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
 			'login__not_in' => array()
124 124
 		);
125 125
 
126
-		return wp_parse_args( $args, $defaults );
126
+		return wp_parse_args($args, $defaults);
127 127
 	}
128 128
 
129 129
 	/**
@@ -215,12 +215,12 @@  discard block
 block discarded – undo
215 215
 	 *                                             logins will not be included in results. Default empty array.
216 216
 	 * }
217 217
 	 */
218
-	public function prepare_query( $query = array() ) {
218
+	public function prepare_query($query = array()) {
219 219
 		global $wpdb;
220 220
 
221
-		if ( empty( $this->query_vars ) || ! empty( $query ) ) {
221
+		if (empty($this->query_vars) || ! empty($query)) {
222 222
 			$this->query_limit = null;
223
-			$this->query_vars = $this->fill_query_vars( $query );
223
+			$this->query_vars = $this->fill_query_vars($query);
224 224
 		}
225 225
 
226 226
 		/**
@@ -234,101 +234,101 @@  discard block
 block discarded – undo
234 234
 		 * @param WP_User_Query $this The current WP_User_Query instance,
235 235
 		 *                            passed by reference.
236 236
 		 */
237
-		do_action( 'pre_get_users', $this );
237
+		do_action('pre_get_users', $this);
238 238
 
239 239
 		// Ensure that query vars are filled after 'pre_get_users'.
240
-		$qv =& $this->query_vars;
241
-		$qv =  $this->fill_query_vars( $qv );
240
+		$qv = & $this->query_vars;
241
+		$qv = $this->fill_query_vars($qv);
242 242
 
243
-		if ( is_array( $qv['fields'] ) ) {
244
-			$qv['fields'] = array_unique( $qv['fields'] );
243
+		if (is_array($qv['fields'])) {
244
+			$qv['fields'] = array_unique($qv['fields']);
245 245
 
246 246
 			$this->query_fields = array();
247
-			foreach ( $qv['fields'] as $field ) {
248
-				$field = 'ID' === $field ? 'ID' : sanitize_key( $field );
247
+			foreach ($qv['fields'] as $field) {
248
+				$field = 'ID' === $field ? 'ID' : sanitize_key($field);
249 249
 				$this->query_fields[] = "$wpdb->users.$field";
250 250
 			}
251
-			$this->query_fields = implode( ',', $this->query_fields );
252
-		} elseif ( 'all' == $qv['fields'] ) {
251
+			$this->query_fields = implode(',', $this->query_fields);
252
+		} elseif ('all' == $qv['fields']) {
253 253
 			$this->query_fields = "$wpdb->users.*";
254 254
 		} else {
255 255
 			$this->query_fields = "$wpdb->users.ID";
256 256
 		}
257 257
 
258
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] )
259
-			$this->query_fields = 'SQL_CALC_FOUND_ROWS ' . $this->query_fields;
258
+		if (isset($qv['count_total']) && $qv['count_total'])
259
+			$this->query_fields = 'SQL_CALC_FOUND_ROWS '.$this->query_fields;
260 260
 
261 261
 		$this->query_from = "FROM $wpdb->users";
262 262
 		$this->query_where = "WHERE 1=1";
263 263
 
264 264
 		// Parse and sanitize 'include', for use by 'orderby' as well as 'include' below.
265
-		if ( ! empty( $qv['include'] ) ) {
266
-			$include = wp_parse_id_list( $qv['include'] );
265
+		if ( ! empty($qv['include'])) {
266
+			$include = wp_parse_id_list($qv['include']);
267 267
 		} else {
268 268
 			$include = false;
269 269
 		}
270 270
 
271 271
 		$blog_id = 0;
272
-		if ( isset( $qv['blog_id'] ) ) {
273
-			$blog_id = absint( $qv['blog_id'] );
272
+		if (isset($qv['blog_id'])) {
273
+			$blog_id = absint($qv['blog_id']);
274 274
 		}
275 275
 
276
-		if ( $qv['has_published_posts'] && $blog_id ) {
277
-			if ( true === $qv['has_published_posts'] ) {
278
-				$post_types = get_post_types( array( 'public' => true ) );
276
+		if ($qv['has_published_posts'] && $blog_id) {
277
+			if (true === $qv['has_published_posts']) {
278
+				$post_types = get_post_types(array('public' => true));
279 279
 			} else {
280 280
 				$post_types = (array) $qv['has_published_posts'];
281 281
 			}
282 282
 
283
-			foreach ( $post_types as &$post_type ) {
284
-				$post_type = $wpdb->prepare( '%s', $post_type );
283
+			foreach ($post_types as &$post_type) {
284
+				$post_type = $wpdb->prepare('%s', $post_type);
285 285
 			}
286 286
 
287
-			$posts_table = $wpdb->get_blog_prefix( $blog_id ) . 'posts';
288
-			$this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( " . join( ", ", $post_types ) . " ) )";
287
+			$posts_table = $wpdb->get_blog_prefix($blog_id).'posts';
288
+			$this->query_where .= " AND $wpdb->users.ID IN ( SELECT DISTINCT $posts_table.post_author FROM $posts_table WHERE $posts_table.post_status = 'publish' AND $posts_table.post_type IN ( ".join(", ", $post_types)." ) )";
289 289
 		}
290 290
 
291 291
 		// nicename
292
-		if ( '' !== $qv['nicename']) {
293
-			$this->query_where .= $wpdb->prepare( ' AND user_nicename = %s', $qv['nicename'] );
292
+		if ('' !== $qv['nicename']) {
293
+			$this->query_where .= $wpdb->prepare(' AND user_nicename = %s', $qv['nicename']);
294 294
 		}
295 295
 
296
-		if ( ! empty( $qv['nicename__in'] ) ) {
297
-			$sanitized_nicename__in = array_map( 'esc_sql', $qv['nicename__in'] );
298
-			$nicename__in = implode( "','", $sanitized_nicename__in );
296
+		if ( ! empty($qv['nicename__in'])) {
297
+			$sanitized_nicename__in = array_map('esc_sql', $qv['nicename__in']);
298
+			$nicename__in = implode("','", $sanitized_nicename__in);
299 299
 			$this->query_where .= " AND user_nicename IN ( '$nicename__in' )";
300 300
 		}
301 301
 
302
-		if ( ! empty( $qv['nicename__not_in'] ) ) {
303
-			$sanitized_nicename__not_in = array_map( 'esc_sql', $qv['nicename__not_in'] );
304
-			$nicename__not_in = implode( "','", $sanitized_nicename__not_in );
302
+		if ( ! empty($qv['nicename__not_in'])) {
303
+			$sanitized_nicename__not_in = array_map('esc_sql', $qv['nicename__not_in']);
304
+			$nicename__not_in = implode("','", $sanitized_nicename__not_in);
305 305
 			$this->query_where .= " AND user_nicename NOT IN ( '$nicename__not_in' )";
306 306
 		}
307 307
 
308 308
 		// login
309
-		if ( '' !== $qv['login']) {
310
-			$this->query_where .= $wpdb->prepare( ' AND user_login = %s', $qv['login'] );
309
+		if ('' !== $qv['login']) {
310
+			$this->query_where .= $wpdb->prepare(' AND user_login = %s', $qv['login']);
311 311
 		}
312 312
 
313
-		if ( ! empty( $qv['login__in'] ) ) {
314
-			$sanitized_login__in = array_map( 'esc_sql', $qv['login__in'] );
315
-			$login__in = implode( "','", $sanitized_login__in );
313
+		if ( ! empty($qv['login__in'])) {
314
+			$sanitized_login__in = array_map('esc_sql', $qv['login__in']);
315
+			$login__in = implode("','", $sanitized_login__in);
316 316
 			$this->query_where .= " AND user_login IN ( '$login__in' )";
317 317
 		}
318 318
 
319
-		if ( ! empty( $qv['login__not_in'] ) ) {
320
-			$sanitized_login__not_in = array_map( 'esc_sql', $qv['login__not_in'] );
321
-			$login__not_in = implode( "','", $sanitized_login__not_in );
319
+		if ( ! empty($qv['login__not_in'])) {
320
+			$sanitized_login__not_in = array_map('esc_sql', $qv['login__not_in']);
321
+			$login__not_in = implode("','", $sanitized_login__not_in);
322 322
 			$this->query_where .= " AND user_login NOT IN ( '$login__not_in' )";
323 323
 		}
324 324
 
325 325
 		// Meta query.
326 326
 		$this->meta_query = new WP_Meta_Query();
327
-		$this->meta_query->parse_query_vars( $qv );
327
+		$this->meta_query->parse_query_vars($qv);
328 328
 
329
-		if ( isset( $qv['who'] ) && 'authors' == $qv['who'] && $blog_id ) {
329
+		if (isset($qv['who']) && 'authors' == $qv['who'] && $blog_id) {
330 330
 			$who_query = array(
331
-				'key' => $wpdb->get_blog_prefix( $blog_id ) . 'user_level',
331
+				'key' => $wpdb->get_blog_prefix($blog_id).'user_level',
332 332
 				'value' => 0,
333 333
 				'compare' => '!=',
334 334
 			);
@@ -336,47 +336,47 @@  discard block
 block discarded – undo
336 336
 			// Prevent extra meta query.
337 337
 			$qv['blog_id'] = $blog_id = 0;
338 338
 
339
-			if ( empty( $this->meta_query->queries ) ) {
340
-				$this->meta_query->queries = array( $who_query );
339
+			if (empty($this->meta_query->queries)) {
340
+				$this->meta_query->queries = array($who_query);
341 341
 			} else {
342 342
 				// Append the cap query to the original queries and reparse the query.
343 343
 				$this->meta_query->queries = array(
344 344
 					'relation' => 'AND',
345
-					array( $this->meta_query->queries, $who_query ),
345
+					array($this->meta_query->queries, $who_query),
346 346
 				);
347 347
 			}
348 348
 
349
-			$this->meta_query->parse_query_vars( $this->meta_query->queries );
349
+			$this->meta_query->parse_query_vars($this->meta_query->queries);
350 350
 		}
351 351
 
352 352
 		$roles = array();
353
-		if ( isset( $qv['role'] ) ) {
354
-			if ( is_array( $qv['role'] ) ) {
353
+		if (isset($qv['role'])) {
354
+			if (is_array($qv['role'])) {
355 355
 				$roles = $qv['role'];
356
-			} elseif ( is_string( $qv['role'] ) && ! empty( $qv['role'] ) ) {
357
-				$roles = array_map( 'trim', explode( ',', $qv['role'] ) );
356
+			} elseif (is_string($qv['role']) && ! empty($qv['role'])) {
357
+				$roles = array_map('trim', explode(',', $qv['role']));
358 358
 			}
359 359
 		}
360 360
 
361 361
 		$role__in = array();
362
-		if ( isset( $qv['role__in'] ) ) {
362
+		if (isset($qv['role__in'])) {
363 363
 			$role__in = (array) $qv['role__in'];
364 364
 		}
365 365
 
366 366
 		$role__not_in = array();
367
-		if ( isset( $qv['role__not_in'] ) ) {
367
+		if (isset($qv['role__not_in'])) {
368 368
 			$role__not_in = (array) $qv['role__not_in'];
369 369
 		}
370 370
 
371
-		if ( $blog_id && ( ! empty( $roles ) || ! empty( $role__in ) || ! empty( $role__not_in ) || is_multisite() ) ) {
371
+		if ($blog_id && ( ! empty($roles) || ! empty($role__in) || ! empty($role__not_in) || is_multisite())) {
372 372
 			$role_queries  = array();
373 373
 
374
-			$roles_clauses = array( 'relation' => 'AND' );
375
-			if ( ! empty( $roles ) ) {
376
-				foreach ( $roles as $role ) {
374
+			$roles_clauses = array('relation' => 'AND');
375
+			if ( ! empty($roles)) {
376
+				foreach ($roles as $role) {
377 377
 					$roles_clauses[] = array(
378
-						'key'     => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
379
-						'value'   => '"' . $role . '"',
378
+						'key'     => $wpdb->get_blog_prefix($blog_id).'capabilities',
379
+						'value'   => '"'.$role.'"',
380 380
 						'compare' => 'LIKE',
381 381
 					);
382 382
 				}
@@ -384,12 +384,12 @@  discard block
 block discarded – undo
384 384
 				$role_queries[] = $roles_clauses;
385 385
 			}
386 386
 
387
-			$role__in_clauses = array( 'relation' => 'OR' );
388
-			if ( ! empty( $role__in ) ) {
389
-				foreach ( $role__in as $role ) {
387
+			$role__in_clauses = array('relation' => 'OR');
388
+			if ( ! empty($role__in)) {
389
+				foreach ($role__in as $role) {
390 390
 					$role__in_clauses[] = array(
391
-						'key'     => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
392
-						'value'   => '"' . $role . '"',
391
+						'key'     => $wpdb->get_blog_prefix($blog_id).'capabilities',
392
+						'value'   => '"'.$role.'"',
393 393
 						'compare' => 'LIKE',
394 394
 					);
395 395
 				}
@@ -397,12 +397,12 @@  discard block
 block discarded – undo
397 397
 				$role_queries[] = $role__in_clauses;
398 398
 			}
399 399
 
400
-			$role__not_in_clauses = array( 'relation' => 'AND' );
401
-			if ( ! empty( $role__not_in ) ) {
402
-				foreach ( $role__not_in as $role ) {
400
+			$role__not_in_clauses = array('relation' => 'AND');
401
+			if ( ! empty($role__not_in)) {
402
+				foreach ($role__not_in as $role) {
403 403
 					$role__not_in_clauses[] = array(
404
-						'key'     => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
405
-						'value'   => '"' . $role . '"',
404
+						'key'     => $wpdb->get_blog_prefix($blog_id).'capabilities',
405
+						'value'   => '"'.$role.'"',
406 406
 						'compare' => 'NOT LIKE',
407 407
 					);
408 408
 				}
@@ -411,9 +411,9 @@  discard block
 block discarded – undo
411 411
 			}
412 412
 
413 413
 			// If there are no specific roles named, make sure the user is a member of the site.
414
-			if ( empty( $role_queries ) ) {
414
+			if (empty($role_queries)) {
415 415
 				$role_queries[] = array(
416
-					'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',
416
+					'key' => $wpdb->get_blog_prefix($blog_id).'capabilities',
417 417
 					'compare' => 'EXISTS',
418 418
 				);
419 419
 			}
@@ -421,50 +421,50 @@  discard block
 block discarded – undo
421 421
 			// Specify that role queries should be joined with AND.
422 422
 			$role_queries['relation'] = 'AND';
423 423
 
424
-			if ( empty( $this->meta_query->queries ) ) {
424
+			if (empty($this->meta_query->queries)) {
425 425
 				$this->meta_query->queries = $role_queries;
426 426
 			} else {
427 427
 				// Append the cap query to the original queries and reparse the query.
428 428
 				$this->meta_query->queries = array(
429 429
 					'relation' => 'AND',
430
-					array( $this->meta_query->queries, $role_queries ),
430
+					array($this->meta_query->queries, $role_queries),
431 431
 				);
432 432
 			}
433 433
 
434
-			$this->meta_query->parse_query_vars( $this->meta_query->queries );
434
+			$this->meta_query->parse_query_vars($this->meta_query->queries);
435 435
 		}
436 436
 
437
-		if ( ! empty( $this->meta_query->queries ) ) {
438
-			$clauses = $this->meta_query->get_sql( 'user', $wpdb->users, 'ID', $this );
437
+		if ( ! empty($this->meta_query->queries)) {
438
+			$clauses = $this->meta_query->get_sql('user', $wpdb->users, 'ID', $this);
439 439
 			$this->query_from .= $clauses['join'];
440 440
 			$this->query_where .= $clauses['where'];
441 441
 
442
-			if ( $this->meta_query->has_or_relation() ) {
443
-				$this->query_fields = 'DISTINCT ' . $this->query_fields;
442
+			if ($this->meta_query->has_or_relation()) {
443
+				$this->query_fields = 'DISTINCT '.$this->query_fields;
444 444
 			}
445 445
 		}
446 446
 
447 447
 		// sorting
448
-		$qv['order'] = isset( $qv['order'] ) ? strtoupper( $qv['order'] ) : '';
449
-		$order = $this->parse_order( $qv['order'] );
448
+		$qv['order'] = isset($qv['order']) ? strtoupper($qv['order']) : '';
449
+		$order = $this->parse_order($qv['order']);
450 450
 
451
-		if ( empty( $qv['orderby'] ) ) {
451
+		if (empty($qv['orderby'])) {
452 452
 			// Default order is by 'user_login'.
453
-			$ordersby = array( 'user_login' => $order );
454
-		} elseif ( is_array( $qv['orderby'] ) ) {
453
+			$ordersby = array('user_login' => $order);
454
+		} elseif (is_array($qv['orderby'])) {
455 455
 			$ordersby = $qv['orderby'];
456 456
 		} else {
457 457
 			// 'orderby' values may be a comma- or space-separated list.
458
-			$ordersby = preg_split( '/[,\s]+/', $qv['orderby'] );
458
+			$ordersby = preg_split('/[,\s]+/', $qv['orderby']);
459 459
 		}
460 460
 
461 461
 		$orderby_array = array();
462
-		foreach ( $ordersby as $_key => $_value ) {
463
-			if ( ! $_value ) {
462
+		foreach ($ordersby as $_key => $_value) {
463
+			if ( ! $_value) {
464 464
 				continue;
465 465
 			}
466 466
 
467
-			if ( is_int( $_key ) ) {
467
+			if (is_int($_key)) {
468 468
 				// Integer key means this is a flat array of 'orderby' fields.
469 469
 				$_orderby = $_value;
470 470
 				$_order = $order;
@@ -474,62 +474,62 @@  discard block
 block discarded – undo
474 474
 				$_order = $_value;
475 475
 			}
476 476
 
477
-			$parsed = $this->parse_orderby( $_orderby );
477
+			$parsed = $this->parse_orderby($_orderby);
478 478
 
479
-			if ( ! $parsed ) {
479
+			if ( ! $parsed) {
480 480
 				continue;
481 481
 			}
482 482
 
483
-			if ( 'nicename__in' === $_orderby || 'login__in' === $_orderby ) {
483
+			if ('nicename__in' === $_orderby || 'login__in' === $_orderby) {
484 484
 				$orderby_array[] = $parsed;
485 485
 			} else {
486
-				$orderby_array[] = $parsed . ' ' . $this->parse_order( $_order );
486
+				$orderby_array[] = $parsed.' '.$this->parse_order($_order);
487 487
 			}
488 488
 		}
489 489
 
490 490
 		// If no valid clauses were found, order by user_login.
491
-		if ( empty( $orderby_array ) ) {
491
+		if (empty($orderby_array)) {
492 492
 			$orderby_array[] = "user_login $order";
493 493
 		}
494 494
 
495
-		$this->query_orderby = 'ORDER BY ' . implode( ', ', $orderby_array );
495
+		$this->query_orderby = 'ORDER BY '.implode(', ', $orderby_array);
496 496
 
497 497
 		// limit
498
-		if ( isset( $qv['number'] ) && $qv['number'] > 0 ) {
499
-			if ( $qv['offset'] ) {
498
+		if (isset($qv['number']) && $qv['number'] > 0) {
499
+			if ($qv['offset']) {
500 500
 				$this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['offset'], $qv['number']);
501 501
 			} else {
502
-				$this->query_limit = $wpdb->prepare( "LIMIT %d, %d", $qv['number'] * ( $qv['paged'] - 1 ), $qv['number'] );
502
+				$this->query_limit = $wpdb->prepare("LIMIT %d, %d", $qv['number'] * ($qv['paged'] - 1), $qv['number']);
503 503
 			}
504 504
 		}
505 505
 
506 506
 		$search = '';
507
-		if ( isset( $qv['search'] ) )
508
-			$search = trim( $qv['search'] );
507
+		if (isset($qv['search']))
508
+			$search = trim($qv['search']);
509 509
 
510
-		if ( $search ) {
511
-			$leading_wild = ( ltrim($search, '*') != $search );
512
-			$trailing_wild = ( rtrim($search, '*') != $search );
513
-			if ( $leading_wild && $trailing_wild )
510
+		if ($search) {
511
+			$leading_wild = (ltrim($search, '*') != $search);
512
+			$trailing_wild = (rtrim($search, '*') != $search);
513
+			if ($leading_wild && $trailing_wild)
514 514
 				$wild = 'both';
515
-			elseif ( $leading_wild )
515
+			elseif ($leading_wild)
516 516
 				$wild = 'leading';
517
-			elseif ( $trailing_wild )
517
+			elseif ($trailing_wild)
518 518
 				$wild = 'trailing';
519 519
 			else
520 520
 				$wild = false;
521
-			if ( $wild )
521
+			if ($wild)
522 522
 				$search = trim($search, '*');
523 523
 
524 524
 			$search_columns = array();
525
-			if ( $qv['search_columns'] )
526
-				$search_columns = array_intersect( $qv['search_columns'], array( 'ID', 'user_login', 'user_email', 'user_url', 'user_nicename' ) );
527
-			if ( ! $search_columns ) {
528
-				if ( false !== strpos( $search, '@') )
525
+			if ($qv['search_columns'])
526
+				$search_columns = array_intersect($qv['search_columns'], array('ID', 'user_login', 'user_email', 'user_url', 'user_nicename'));
527
+			if ( ! $search_columns) {
528
+				if (false !== strpos($search, '@'))
529 529
 					$search_columns = array('user_email');
530
-				elseif ( is_numeric($search) )
530
+				elseif (is_numeric($search))
531 531
 					$search_columns = array('user_login', 'ID');
532
-				elseif ( preg_match('|^https?://|', $search) && ! ( is_multisite() && wp_is_large_network( 'users' ) ) )
532
+				elseif (preg_match('|^https?://|', $search) && ! (is_multisite() && wp_is_large_network('users')))
533 533
 					$search_columns = array('user_url');
534 534
 				else
535 535
 					$search_columns = array('user_login', 'user_url', 'user_email', 'user_nicename', 'display_name');
@@ -547,23 +547,23 @@  discard block
 block discarded – undo
547 547
 			 * @param string        $search         Text being searched.
548 548
 			 * @param WP_User_Query $this           The current WP_User_Query instance.
549 549
 			 */
550
-			$search_columns = apply_filters( 'user_search_columns', $search_columns, $search, $this );
550
+			$search_columns = apply_filters('user_search_columns', $search_columns, $search, $this);
551 551
 
552
-			$this->query_where .= $this->get_search_sql( $search, $search_columns, $wild );
552
+			$this->query_where .= $this->get_search_sql($search, $search_columns, $wild);
553 553
 		}
554 554
 
555
-		if ( ! empty( $include ) ) {
555
+		if ( ! empty($include)) {
556 556
 			// Sanitized earlier.
557
-			$ids = implode( ',', $include );
557
+			$ids = implode(',', $include);
558 558
 			$this->query_where .= " AND $wpdb->users.ID IN ($ids)";
559
-		} elseif ( ! empty( $qv['exclude'] ) ) {
560
-			$ids = implode( ',', wp_parse_id_list( $qv['exclude'] ) );
559
+		} elseif ( ! empty($qv['exclude'])) {
560
+			$ids = implode(',', wp_parse_id_list($qv['exclude']));
561 561
 			$this->query_where .= " AND $wpdb->users.ID NOT IN ($ids)";
562 562
 		}
563 563
 
564 564
 		// Date queries are allowed for the user_registered field.
565
-		if ( ! empty( $qv['date_query'] ) && is_array( $qv['date_query'] ) ) {
566
-			$date_query = new WP_Date_Query( $qv['date_query'], 'user_registered' );
565
+		if ( ! empty($qv['date_query']) && is_array($qv['date_query'])) {
566
+			$date_query = new WP_Date_Query($qv['date_query'], 'user_registered');
567 567
 			$this->query_where .= $date_query->get_sql();
568 568
 		}
569 569
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 		 * @param WP_User_Query $this The current WP_User_Query instance,
580 580
 		 *                            passed by reference.
581 581
 		 */
582
-		do_action_ref_array( 'pre_user_query', array( &$this ) );
582
+		do_action_ref_array('pre_user_query', array(&$this));
583 583
 	}
584 584
 
585 585
 	/**
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
 	public function query() {
593 593
 		global $wpdb;
594 594
 
595
-		$qv =& $this->query_vars;
595
+		$qv = & $this->query_vars;
596 596
 
597 597
 		$this->request = "SELECT $this->query_fields $this->query_from $this->query_where $this->query_orderby $this->query_limit";
598 598
 
599
-		if ( is_array( $qv['fields'] ) || 'all' == $qv['fields'] ) {
600
-			$this->results = $wpdb->get_results( $this->request );
599
+		if (is_array($qv['fields']) || 'all' == $qv['fields']) {
600
+			$this->results = $wpdb->get_results($this->request);
601 601
 		} else {
602
-			$this->results = $wpdb->get_col( $this->request );
602
+			$this->results = $wpdb->get_col($this->request);
603 603
 		}
604 604
 
605 605
 		/**
@@ -611,23 +611,23 @@  discard block
 block discarded – undo
611 611
 		 *
612 612
 		 * @param string $sql The SELECT FOUND_ROWS() query for the current WP_User_Query.
613 613
 		 */
614
-		if ( isset( $qv['count_total'] ) && $qv['count_total'] )
615
-			$this->total_users = $wpdb->get_var( apply_filters( 'found_users_query', 'SELECT FOUND_ROWS()' ) );
614
+		if (isset($qv['count_total']) && $qv['count_total'])
615
+			$this->total_users = $wpdb->get_var(apply_filters('found_users_query', 'SELECT FOUND_ROWS()'));
616 616
 
617
-		if ( !$this->results )
617
+		if ( ! $this->results)
618 618
 			return;
619 619
 
620
-		if ( 'all_with_meta' == $qv['fields'] ) {
621
-			cache_users( $this->results );
620
+		if ('all_with_meta' == $qv['fields']) {
621
+			cache_users($this->results);
622 622
 
623 623
 			$r = array();
624
-			foreach ( $this->results as $userid )
625
-				$r[ $userid ] = new WP_User( $userid, '', $qv['blog_id'] );
624
+			foreach ($this->results as $userid)
625
+				$r[$userid] = new WP_User($userid, '', $qv['blog_id']);
626 626
 
627 627
 			$this->results = $r;
628
-		} elseif ( 'all' == $qv['fields'] ) {
629
-			foreach ( $this->results as $key => $user ) {
630
-				$this->results[ $key ] = new WP_User( $user, '', $qv['blog_id'] );
628
+		} elseif ('all' == $qv['fields']) {
629
+			foreach ($this->results as $key => $user) {
630
+				$this->results[$key] = new WP_User($user, '', $qv['blog_id']);
631 631
 			}
632 632
 		}
633 633
 	}
@@ -641,8 +641,8 @@  discard block
 block discarded – undo
641 641
 	 * @param string $query_var Query variable key.
642 642
 	 * @return mixed
643 643
 	 */
644
-	public function get( $query_var ) {
645
-		if ( isset( $this->query_vars[$query_var] ) )
644
+	public function get($query_var) {
645
+		if (isset($this->query_vars[$query_var]))
646 646
 			return $this->query_vars[$query_var];
647 647
 
648 648
 		return null;
@@ -657,7 +657,7 @@  discard block
 block discarded – undo
657 657
 	 * @param string $query_var Query variable key.
658 658
 	 * @param mixed $value Query variable value.
659 659
 	 */
660
-	public function set( $query_var, $value ) {
660
+	public function set($query_var, $value) {
661 661
 		$this->query_vars[$query_var] = $value;
662 662
 	}
663 663
 
@@ -675,23 +675,23 @@  discard block
 block discarded – undo
675 675
 	 *                       Single site allows leading and trailing wildcards, Network Admin only trailing.
676 676
 	 * @return string
677 677
 	 */
678
-	protected function get_search_sql( $string, $cols, $wild = false ) {
678
+	protected function get_search_sql($string, $cols, $wild = false) {
679 679
 		global $wpdb;
680 680
 
681 681
 		$searches = array();
682
-		$leading_wild = ( 'leading' == $wild || 'both' == $wild ) ? '%' : '';
683
-		$trailing_wild = ( 'trailing' == $wild || 'both' == $wild ) ? '%' : '';
684
-		$like = $leading_wild . $wpdb->esc_like( $string ) . $trailing_wild;
682
+		$leading_wild = ('leading' == $wild || 'both' == $wild) ? '%' : '';
683
+		$trailing_wild = ('trailing' == $wild || 'both' == $wild) ? '%' : '';
684
+		$like = $leading_wild.$wpdb->esc_like($string).$trailing_wild;
685 685
 
686
-		foreach ( $cols as $col ) {
687
-			if ( 'ID' == $col ) {
688
-				$searches[] = $wpdb->prepare( "$col = %s", $string );
686
+		foreach ($cols as $col) {
687
+			if ('ID' == $col) {
688
+				$searches[] = $wpdb->prepare("$col = %s", $string);
689 689
 			} else {
690
-				$searches[] = $wpdb->prepare( "$col LIKE %s", $like );
690
+				$searches[] = $wpdb->prepare("$col LIKE %s", $like);
691 691
 			}
692 692
 		}
693 693
 
694
-		return ' AND (' . implode(' OR ', $searches) . ')';
694
+		return ' AND ('.implode(' OR ', $searches).')';
695 695
 	}
696 696
 
697 697
 	/**
@@ -729,21 +729,21 @@  discard block
 block discarded – undo
729 729
 	 * @param string $orderby Alias for the field to order by.
730 730
 	 * @return string Value to used in the ORDER clause, if `$orderby` is valid.
731 731
 	 */
732
-	protected function parse_orderby( $orderby ) {
732
+	protected function parse_orderby($orderby) {
733 733
 		global $wpdb;
734 734
 
735 735
 		$meta_query_clauses = $this->meta_query->get_clauses();
736 736
 
737 737
 		$_orderby = '';
738
-		if ( in_array( $orderby, array( 'login', 'nicename', 'email', 'url', 'registered' ) ) ) {
739
-			$_orderby = 'user_' . $orderby;
740
-		} elseif ( in_array( $orderby, array( 'user_login', 'user_nicename', 'user_email', 'user_url', 'user_registered' ) ) ) {
738
+		if (in_array($orderby, array('login', 'nicename', 'email', 'url', 'registered'))) {
739
+			$_orderby = 'user_'.$orderby;
740
+		} elseif (in_array($orderby, array('user_login', 'user_nicename', 'user_email', 'user_url', 'user_registered'))) {
741 741
 			$_orderby = $orderby;
742
-		} elseif ( 'name' == $orderby || 'display_name' == $orderby ) {
742
+		} elseif ('name' == $orderby || 'display_name' == $orderby) {
743 743
 			$_orderby = 'display_name';
744
-		} elseif ( 'post_count' == $orderby ) {
744
+		} elseif ('post_count' == $orderby) {
745 745
 			// todo: avoid the JOIN
746
-			$where = get_posts_by_author_sql( 'post' );
746
+			$where = get_posts_by_author_sql('post');
747 747
 			$this->query_from .= " LEFT OUTER JOIN (
748 748
 				SELECT post_author, COUNT(*) as post_count
749 749
 				FROM $wpdb->posts
@@ -752,27 +752,27 @@  discard block
 block discarded – undo
752 752
 			) p ON ({$wpdb->users}.ID = p.post_author)
753 753
 			";
754 754
 			$_orderby = 'post_count';
755
-		} elseif ( 'ID' == $orderby || 'id' == $orderby ) {
755
+		} elseif ('ID' == $orderby || 'id' == $orderby) {
756 756
 			$_orderby = 'ID';
757
-		} elseif ( 'meta_value' == $orderby || $this->get( 'meta_key' ) == $orderby ) {
757
+		} elseif ('meta_value' == $orderby || $this->get('meta_key') == $orderby) {
758 758
 			$_orderby = "$wpdb->usermeta.meta_value";
759
-		} elseif ( 'meta_value_num' == $orderby ) {
759
+		} elseif ('meta_value_num' == $orderby) {
760 760
 			$_orderby = "$wpdb->usermeta.meta_value+0";
761
-		} elseif ( 'include' === $orderby && ! empty( $this->query_vars['include'] ) ) {
762
-			$include = wp_parse_id_list( $this->query_vars['include'] );
763
-			$include_sql = implode( ',', $include );
761
+		} elseif ('include' === $orderby && ! empty($this->query_vars['include'])) {
762
+			$include = wp_parse_id_list($this->query_vars['include']);
763
+			$include_sql = implode(',', $include);
764 764
 			$_orderby = "FIELD( $wpdb->users.ID, $include_sql )";
765
-		} elseif ( 'nicename__in' === $orderby ) {
766
-			$sanitized_nicename__in = array_map( 'esc_sql', $this->query_vars['nicename__in'] );
767
-			$nicename__in = implode( "','", $sanitized_nicename__in );
765
+		} elseif ('nicename__in' === $orderby) {
766
+			$sanitized_nicename__in = array_map('esc_sql', $this->query_vars['nicename__in']);
767
+			$nicename__in = implode("','", $sanitized_nicename__in);
768 768
 			$_orderby = "FIELD( user_nicename, '$nicename__in' )";
769
-		} elseif ( 'login__in' === $orderby ) {
770
-			$sanitized_login__in = array_map( 'esc_sql', $this->query_vars['login__in'] );
771
-			$login__in = implode( "','", $sanitized_login__in );
769
+		} elseif ('login__in' === $orderby) {
770
+			$sanitized_login__in = array_map('esc_sql', $this->query_vars['login__in']);
771
+			$login__in = implode("','", $sanitized_login__in);
772 772
 			$_orderby = "FIELD( user_login, '$login__in' )";
773
-		} elseif ( isset( $meta_query_clauses[ $orderby ] ) ) {
774
-			$meta_clause = $meta_query_clauses[ $orderby ];
775
-			$_orderby = sprintf( "CAST(%s.meta_value AS %s)", esc_sql( $meta_clause['alias'] ), esc_sql( $meta_clause['cast'] ) );
773
+		} elseif (isset($meta_query_clauses[$orderby])) {
774
+			$meta_clause = $meta_query_clauses[$orderby];
775
+			$_orderby = sprintf("CAST(%s.meta_value AS %s)", esc_sql($meta_clause['alias']), esc_sql($meta_clause['cast']));
776 776
 		}
777 777
 
778 778
 		return $_orderby;
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
 	 * @param string $order The 'order' query variable.
788 788
 	 * @return string The sanitized 'order' query variable.
789 789
 	 */
790
-	protected function parse_order( $order ) {
791
-		if ( ! is_string( $order ) || empty( $order ) ) {
790
+	protected function parse_order($order) {
791
+		if ( ! is_string($order) || empty($order)) {
792 792
 			return 'DESC';
793 793
 		}
794 794
 
795
-		if ( 'ASC' === strtoupper( $order ) ) {
795
+		if ('ASC' === strtoupper($order)) {
796 796
 			return 'ASC';
797 797
 		} else {
798 798
 			return 'DESC';
@@ -808,8 +808,8 @@  discard block
 block discarded – undo
808 808
 	 * @param string $name Property to get.
809 809
 	 * @return mixed Property.
810 810
 	 */
811
-	public function __get( $name ) {
812
-		if ( in_array( $name, $this->compat_fields ) ) {
811
+	public function __get($name) {
812
+		if (in_array($name, $this->compat_fields)) {
813 813
 			return $this->$name;
814 814
 		}
815 815
 	}
@@ -824,8 +824,8 @@  discard block
 block discarded – undo
824 824
 	 * @param mixed  $value Property value.
825 825
 	 * @return mixed Newly-set property.
826 826
 	 */
827
-	public function __set( $name, $value ) {
828
-		if ( in_array( $name, $this->compat_fields ) ) {
827
+	public function __set($name, $value) {
828
+		if (in_array($name, $this->compat_fields)) {
829 829
 			return $this->$name = $value;
830 830
 		}
831 831
 	}
@@ -839,9 +839,9 @@  discard block
 block discarded – undo
839 839
 	 * @param string $name Property to check if set.
840 840
 	 * @return bool Whether the property is set.
841 841
 	 */
842
-	public function __isset( $name ) {
843
-		if ( in_array( $name, $this->compat_fields ) ) {
844
-			return isset( $this->$name );
842
+	public function __isset($name) {
843
+		if (in_array($name, $this->compat_fields)) {
844
+			return isset($this->$name);
845 845
 		}
846 846
 	}
847 847
 
@@ -853,9 +853,9 @@  discard block
 block discarded – undo
853 853
 	 *
854 854
 	 * @param string $name Property to unset.
855 855
 	 */
856
-	public function __unset( $name ) {
857
-		if ( in_array( $name, $this->compat_fields ) ) {
858
-			unset( $this->$name );
856
+	public function __unset($name) {
857
+		if (in_array($name, $this->compat_fields)) {
858
+			unset($this->$name);
859 859
 		}
860 860
 	}
861 861
 
@@ -869,9 +869,9 @@  discard block
 block discarded – undo
869 869
 	 * @param array    $arguments Arguments to pass when calling.
870 870
 	 * @return mixed Return value of the callback, false otherwise.
871 871
 	 */
872
-	public function __call( $name, $arguments ) {
873
-		if ( 'get_search_sql' === $name ) {
874
-			return call_user_func_array( array( $this, $name ), $arguments );
872
+	public function __call($name, $arguments) {
873
+		if ('get_search_sql' === $name) {
874
+			return call_user_func_array(array($this, $name), $arguments);
875 875
 		}
876 876
 		return false;
877 877
 	}
Please login to merge, or discard this patch.
src/wp-includes/class-wp-user.php 3 patches
Doc Comments   +1 added lines, -6 removed lines patch added patch discarded remove patch
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 	 *
112 112
 	 * @global wpdb $wpdb WordPress database abstraction object.
113 113
 	 *
114
-	 * @param int|string|stdClass|WP_User $id User's ID, a WP_User object, or a user object from the DB.
114
+	 * @param integer $id User's ID, a WP_User object, or a user object from the DB.
115 115
 	 * @param string $name Optional. User's username
116 116
 	 * @param int $blog_id Optional Site ID, defaults to current site.
117 117
 	 */
@@ -702,11 +702,6 @@  discard block
 block discarded – undo
702 702
 	 * @see map_meta_cap()
703 703
 	 *
704 704
 	 * @param string $cap           Capability name.
705
-	 * @param int    $object_id,... Optional. ID of the specific object to check against if `$cap` is a "meta" cap.
706
-	 *                              "Meta" capabilities, e.g. 'edit_post', 'edit_user', etc., are capabilities used
707
-	 *                              by map_meta_cap() to map to other "primitive" capabilities, e.g. 'edit_posts',
708
-	 *                              'edit_others_posts', etc. The parameter is accessed via func_get_args() and passed
709
-	 *                              to map_meta_cap().
710 705
 	 * @return bool Whether the current user has the given capability. If `$cap` is a meta cap and `$object_id` is
711 706
 	 *              passed, whether the current user has the given meta capability for the given object.
712 707
 	 */
Please login to merge, or discard this patch.
Braces   +55 added lines, -38 removed lines patch added patch discarded remove patch
@@ -192,17 +192,20 @@  discard block
 block discarded – undo
192 192
 		if ( 'id' == $field ) {
193 193
 			// Make sure the value is numeric to avoid casting objects, for example,
194 194
 			// to int 1.
195
-			if ( ! is_numeric( $value ) )
196
-				return false;
195
+			if ( ! is_numeric( $value ) ) {
196
+							return false;
197
+			}
197 198
 			$value = intval( $value );
198
-			if ( $value < 1 )
199
-				return false;
199
+			if ( $value < 1 ) {
200
+							return false;
201
+			}
200 202
 		} else {
201 203
 			$value = trim( $value );
202 204
 		}
203 205
 
204
-		if ( !$value )
205
-			return false;
206
+		if ( !$value ) {
207
+					return false;
208
+		}
206 209
 
207 210
 		switch ( $field ) {
208 211
 			case 'id':
@@ -227,14 +230,16 @@  discard block
 block discarded – undo
227 230
 		}
228 231
 
229 232
 		if ( false !== $user_id ) {
230
-			if ( $user = wp_cache_get( $user_id, 'users' ) )
231
-				return $user;
233
+			if ( $user = wp_cache_get( $user_id, 'users' ) ) {
234
+							return $user;
235
+			}
232 236
 		}
233 237
 
234 238
 		if ( !$user = $wpdb->get_row( $wpdb->prepare(
235 239
 			"SELECT * FROM $wpdb->users WHERE $db_field = %s", $value
236
-		) ) )
237
-			return false;
240
+		) ) ) {
241
+					return false;
242
+		}
238 243
 
239 244
 		update_user_caches( $user );
240 245
 
@@ -279,11 +284,13 @@  discard block
 block discarded – undo
279 284
 			$key = 'ID';
280 285
 		}
281 286
 
282
-		if ( isset( $this->data->$key ) )
283
-			return true;
287
+		if ( isset( $this->data->$key ) ) {
288
+					return true;
289
+		}
284 290
 
285
-		if ( isset( self::$back_compat_keys[ $key ] ) )
286
-			$key = self::$back_compat_keys[ $key ];
291
+		if ( isset( self::$back_compat_keys[ $key ] ) ) {
292
+					$key = self::$back_compat_keys[ $key ];
293
+		}
287 294
 
288 295
 		return metadata_exists( 'user', $this->ID, $key );
289 296
 	}
@@ -312,8 +319,9 @@  discard block
 block discarded – undo
312 319
 		if ( isset( $this->data->$key ) ) {
313 320
 			$value = $this->data->$key;
314 321
 		} else {
315
-			if ( isset( self::$back_compat_keys[ $key ] ) )
316
-				$key = self::$back_compat_keys[ $key ];
322
+			if ( isset( self::$back_compat_keys[ $key ] ) ) {
323
+							$key = self::$back_compat_keys[ $key ];
324
+			}
317 325
 			$value = get_user_meta( $this->ID, $key, true );
318 326
 		}
319 327
 
@@ -449,15 +457,17 @@  discard block
 block discarded – undo
449 457
 	protected function _init_caps( $cap_key = '' ) {
450 458
 		global $wpdb;
451 459
 
452
-		if ( empty($cap_key) )
453
-			$this->cap_key = $wpdb->get_blog_prefix() . 'capabilities';
454
-		else
455
-			$this->cap_key = $cap_key;
460
+		if ( empty($cap_key) ) {
461
+					$this->cap_key = $wpdb->get_blog_prefix() . 'capabilities';
462
+		} else {
463
+					$this->cap_key = $cap_key;
464
+		}
456 465
 
457 466
 		$this->caps = get_user_meta( $this->ID, $this->cap_key, true );
458 467
 
459
-		if ( ! is_array( $this->caps ) )
460
-			$this->caps = array();
468
+		if ( ! is_array( $this->caps ) ) {
469
+					$this->caps = array();
470
+		}
461 471
 
462 472
 		$this->get_role_caps();
463 473
 	}
@@ -479,8 +489,9 @@  discard block
 block discarded – undo
479 489
 		$wp_roles = wp_roles();
480 490
 
481 491
 		//Filter out caps that are not role names and assign to $this->roles
482
-		if ( is_array( $this->caps ) )
483
-			$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
492
+		if ( is_array( $this->caps ) ) {
493
+					$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
494
+		}
484 495
 
485 496
 		//Build $allcaps from role caps, overlay user's $caps
486 497
 		$this->allcaps = array();
@@ -533,8 +544,9 @@  discard block
 block discarded – undo
533 544
 	 * @param string $role Role name.
534 545
 	 */
535 546
 	public function remove_role( $role ) {
536
-		if ( !in_array($role, $this->roles) )
537
-			return;
547
+		if ( !in_array($role, $this->roles) ) {
548
+					return;
549
+		}
538 550
 		unset( $this->caps[$role] );
539 551
 		update_user_meta( $this->ID, $this->cap_key, $this->caps );
540 552
 		$this->get_role_caps();
@@ -564,11 +576,13 @@  discard block
 block discarded – undo
564 576
 	 * @param string $role Role name.
565 577
 	 */
566 578
 	public function set_role( $role ) {
567
-		if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
568
-			return;
579
+		if ( 1 == count( $this->roles ) && $role == current( $this->roles ) ) {
580
+					return;
581
+		}
569 582
 
570
-		foreach ( (array) $this->roles as $oldrole )
571
-			unset( $this->caps[$oldrole] );
583
+		foreach ( (array) $this->roles as $oldrole ) {
584
+					unset( $this->caps[$oldrole] );
585
+		}
572 586
 
573 587
 		$old_roles = $this->roles;
574 588
 		if ( !empty( $role ) ) {
@@ -722,8 +736,9 @@  discard block
 block discarded – undo
722 736
 
723 737
 		// Multisite super admin has all caps by definition, Unless specifically denied.
724 738
 		if ( is_multisite() && is_super_admin( $this->ID ) ) {
725
-			if ( in_array('do_not_allow', $caps) )
726
-				return false;
739
+			if ( in_array('do_not_allow', $caps) ) {
740
+							return false;
741
+			}
727 742
 			return true;
728 743
 		}
729 744
 
@@ -745,8 +760,9 @@  discard block
 block discarded – undo
745 760
 
746 761
 		// Must have ALL requested caps.
747 762
 		foreach ( (array) $caps as $cap ) {
748
-			if ( empty( $capabilities[ $cap ] ) )
749
-				return false;
763
+			if ( empty( $capabilities[ $cap ] ) ) {
764
+							return false;
765
+			}
750 766
 		}
751 767
 
752 768
 		return true;
@@ -778,10 +794,11 @@  discard block
 block discarded – undo
778 794
 	 */
779 795
 	public function for_blog( $blog_id = '' ) {
780 796
 		global $wpdb;
781
-		if ( ! empty( $blog_id ) )
782
-			$cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
783
-		else
784
-			$cap_key = '';
797
+		if ( ! empty( $blog_id ) ) {
798
+					$cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
799
+		} else {
800
+					$cap_key = '';
801
+		}
785 802
 		$this->_init_caps( $cap_key );
786 803
 	}
787 804
 }
Please login to merge, or discard this patch.
Spacing   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -115,40 +115,40 @@  discard block
 block discarded – undo
115 115
 	 * @param string $name Optional. User's username
116 116
 	 * @param int $blog_id Optional Site ID, defaults to current site.
117 117
 	 */
118
-	public function __construct( $id = 0, $name = '', $blog_id = '' ) {
119
-		if ( ! isset( self::$back_compat_keys ) ) {
118
+	public function __construct($id = 0, $name = '', $blog_id = '') {
119
+		if ( ! isset(self::$back_compat_keys)) {
120 120
 			$prefix = $GLOBALS['wpdb']->prefix;
121 121
 			self::$back_compat_keys = array(
122 122
 				'user_firstname' => 'first_name',
123 123
 				'user_lastname' => 'last_name',
124 124
 				'user_description' => 'description',
125
-				'user_level' => $prefix . 'user_level',
126
-				$prefix . 'usersettings' => $prefix . 'user-settings',
127
-				$prefix . 'usersettingstime' => $prefix . 'user-settings-time',
125
+				'user_level' => $prefix.'user_level',
126
+				$prefix.'usersettings' => $prefix.'user-settings',
127
+				$prefix.'usersettingstime' => $prefix.'user-settings-time',
128 128
 			);
129 129
 		}
130 130
 
131
-		if ( $id instanceof WP_User ) {
132
-			$this->init( $id->data, $blog_id );
131
+		if ($id instanceof WP_User) {
132
+			$this->init($id->data, $blog_id);
133 133
 			return;
134
-		} elseif ( is_object( $id ) ) {
135
-			$this->init( $id, $blog_id );
134
+		} elseif (is_object($id)) {
135
+			$this->init($id, $blog_id);
136 136
 			return;
137 137
 		}
138 138
 
139
-		if ( ! empty( $id ) && ! is_numeric( $id ) ) {
139
+		if ( ! empty($id) && ! is_numeric($id)) {
140 140
 			$name = $id;
141 141
 			$id = 0;
142 142
 		}
143 143
 
144
-		if ( $id ) {
145
-			$data = self::get_data_by( 'id', $id );
144
+		if ($id) {
145
+			$data = self::get_data_by('id', $id);
146 146
 		} else {
147
-			$data = self::get_data_by( 'login', $name );
147
+			$data = self::get_data_by('login', $name);
148 148
 		}
149 149
 
150
-		if ( $data ) {
151
-			$this->init( $data, $blog_id );
150
+		if ($data) {
151
+			$this->init($data, $blog_id);
152 152
 		} else {
153 153
 			$this->data = new stdClass;
154 154
 		}
@@ -160,11 +160,11 @@  discard block
 block discarded – undo
160 160
 	 * @param object $data    User DB row object.
161 161
 	 * @param int    $blog_id Optional. The site ID to initialize for.
162 162
 	 */
163
-	public function init( $data, $blog_id = '' ) {
163
+	public function init($data, $blog_id = '') {
164 164
 		$this->data = $data;
165 165
 		$this->ID = (int) $data->ID;
166 166
 
167
-		$this->for_blog( $blog_id );
167
+		$this->for_blog($blog_id);
168 168
 	}
169 169
 
170 170
 	/**
@@ -181,30 +181,30 @@  discard block
 block discarded – undo
181 181
 	 * @param string|int $value The field value
182 182
 	 * @return object|false Raw user object
183 183
 	 */
184
-	public static function get_data_by( $field, $value ) {
184
+	public static function get_data_by($field, $value) {
185 185
 		global $wpdb;
186 186
 
187 187
 		// 'ID' is an alias of 'id'.
188
-		if ( 'ID' === $field ) {
188
+		if ('ID' === $field) {
189 189
 			$field = 'id';
190 190
 		}
191 191
 
192
-		if ( 'id' == $field ) {
192
+		if ('id' == $field) {
193 193
 			// Make sure the value is numeric to avoid casting objects, for example,
194 194
 			// to int 1.
195
-			if ( ! is_numeric( $value ) )
195
+			if ( ! is_numeric($value))
196 196
 				return false;
197
-			$value = intval( $value );
198
-			if ( $value < 1 )
197
+			$value = intval($value);
198
+			if ($value < 1)
199 199
 				return false;
200 200
 		} else {
201
-			$value = trim( $value );
201
+			$value = trim($value);
202 202
 		}
203 203
 
204
-		if ( !$value )
204
+		if ( ! $value)
205 205
 			return false;
206 206
 
207
-		switch ( $field ) {
207
+		switch ($field) {
208 208
 			case 'id':
209 209
 				$user_id = $value;
210 210
 				$db_field = 'ID';
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
 				$db_field = 'user_email';
219 219
 				break;
220 220
 			case 'login':
221
-				$value = sanitize_user( $value );
221
+				$value = sanitize_user($value);
222 222
 				$user_id = wp_cache_get($value, 'userlogins');
223 223
 				$db_field = 'user_login';
224 224
 				break;
@@ -226,17 +226,17 @@  discard block
 block discarded – undo
226 226
 				return false;
227 227
 		}
228 228
 
229
-		if ( false !== $user_id ) {
230
-			if ( $user = wp_cache_get( $user_id, 'users' ) )
229
+		if (false !== $user_id) {
230
+			if ($user = wp_cache_get($user_id, 'users'))
231 231
 				return $user;
232 232
 		}
233 233
 
234
-		if ( !$user = $wpdb->get_row( $wpdb->prepare(
234
+		if ( ! $user = $wpdb->get_row($wpdb->prepare(
235 235
 			"SELECT * FROM $wpdb->users WHERE $db_field = %s", $value
236
-		) ) )
236
+		)))
237 237
 			return false;
238 238
 
239
-		update_user_caches( $user );
239
+		update_user_caches($user);
240 240
 
241 241
 		return $user;
242 242
 	}
@@ -251,9 +251,9 @@  discard block
 block discarded – undo
251 251
 	 * @param array    $arguments Arguments to pass when calling.
252 252
 	 * @return mixed|false Return value of the callback, false otherwise.
253 253
 	 */
254
-	public function __call( $name, $arguments ) {
255
-		if ( '_init_caps' === $name ) {
256
-			return call_user_func_array( array( $this, $name ), $arguments );
254
+	public function __call($name, $arguments) {
255
+		if ('_init_caps' === $name) {
256
+			return call_user_func_array(array($this, $name), $arguments);
257 257
 		}
258 258
 		return false;
259 259
 	}
@@ -267,25 +267,25 @@  discard block
 block discarded – undo
267 267
 	 * @param string $key User meta key to check if set.
268 268
 	 * @return bool Whether the given user meta key is set.
269 269
 	 */
270
-	public function __isset( $key ) {
271
-		if ( 'id' == $key ) {
272
-			_deprecated_argument( 'WP_User->id', '2.1.0',
270
+	public function __isset($key) {
271
+		if ('id' == $key) {
272
+			_deprecated_argument('WP_User->id', '2.1.0',
273 273
 				sprintf(
274 274
 					/* translators: %s: WP_User->ID */
275
-					__( 'Use %s instead.' ),
275
+					__('Use %s instead.'),
276 276
 					'<code>WP_User->ID</code>'
277 277
 				)
278 278
 			);
279 279
 			$key = 'ID';
280 280
 		}
281 281
 
282
-		if ( isset( $this->data->$key ) )
282
+		if (isset($this->data->$key))
283 283
 			return true;
284 284
 
285
-		if ( isset( self::$back_compat_keys[ $key ] ) )
286
-			$key = self::$back_compat_keys[ $key ];
285
+		if (isset(self::$back_compat_keys[$key]))
286
+			$key = self::$back_compat_keys[$key];
287 287
 
288
-		return metadata_exists( 'user', $this->ID, $key );
288
+		return metadata_exists('user', $this->ID, $key);
289 289
 	}
290 290
 
291 291
 	/**
@@ -297,28 +297,28 @@  discard block
 block discarded – undo
297 297
 	 * @param string $key User meta key to retrieve.
298 298
 	 * @return mixed Value of the given user meta key (if set). If `$key` is 'id', the user ID.
299 299
 	 */
300
-	public function __get( $key ) {
301
-		if ( 'id' == $key ) {
302
-			_deprecated_argument( 'WP_User->id', '2.1.0',
300
+	public function __get($key) {
301
+		if ('id' == $key) {
302
+			_deprecated_argument('WP_User->id', '2.1.0',
303 303
 				sprintf(
304 304
 					/* translators: %s: WP_User->ID */
305
-					__( 'Use %s instead.' ),
305
+					__('Use %s instead.'),
306 306
 					'<code>WP_User->ID</code>'
307 307
 				)
308 308
 			);
309 309
 			return $this->ID;
310 310
 		}
311 311
 
312
-		if ( isset( $this->data->$key ) ) {
312
+		if (isset($this->data->$key)) {
313 313
 			$value = $this->data->$key;
314 314
 		} else {
315
-			if ( isset( self::$back_compat_keys[ $key ] ) )
316
-				$key = self::$back_compat_keys[ $key ];
317
-			$value = get_user_meta( $this->ID, $key, true );
315
+			if (isset(self::$back_compat_keys[$key]))
316
+				$key = self::$back_compat_keys[$key];
317
+			$value = get_user_meta($this->ID, $key, true);
318 318
 		}
319 319
 
320
-		if ( $this->filter ) {
321
-			$value = sanitize_user_field( $key, $value, $this->ID, $this->filter );
320
+		if ($this->filter) {
321
+			$value = sanitize_user_field($key, $value, $this->ID, $this->filter);
322 322
 		}
323 323
 
324 324
 		return $value;
@@ -336,12 +336,12 @@  discard block
 block discarded – undo
336 336
 	 * @param string $key   User meta key.
337 337
 	 * @param mixed  $value User meta value.
338 338
 	 */
339
-	public function __set( $key, $value ) {
340
-		if ( 'id' == $key ) {
341
-			_deprecated_argument( 'WP_User->id', '2.1.0',
339
+	public function __set($key, $value) {
340
+		if ('id' == $key) {
341
+			_deprecated_argument('WP_User->id', '2.1.0',
342 342
 				sprintf(
343 343
 					/* translators: %s: WP_User->ID */
344
-					__( 'Use %s instead.' ),
344
+					__('Use %s instead.'),
345 345
 					'<code>WP_User->ID</code>'
346 346
 				)
347 347
 			);
@@ -360,23 +360,23 @@  discard block
 block discarded – undo
360 360
 	 *
361 361
 	 * @param string $key User meta key to unset.
362 362
 	 */
363
-	public function __unset( $key ) {
364
-		if ( 'id' == $key ) {
365
-			_deprecated_argument( 'WP_User->id', '2.1.0',
363
+	public function __unset($key) {
364
+		if ('id' == $key) {
365
+			_deprecated_argument('WP_User->id', '2.1.0',
366 366
 				sprintf(
367 367
 					/* translators: %s: WP_User->ID */
368
-					__( 'Use %s instead.' ),
368
+					__('Use %s instead.'),
369 369
 					'<code>WP_User->ID</code>'
370 370
 				)
371 371
 			);
372 372
 		}
373 373
 
374
-		if ( isset( $this->data->$key ) ) {
375
-			unset( $this->data->$key );
374
+		if (isset($this->data->$key)) {
375
+			unset($this->data->$key);
376 376
 		}
377 377
 
378
-		if ( isset( self::$back_compat_keys[ $key ] ) ) {
379
-			unset( self::$back_compat_keys[ $key ] );
378
+		if (isset(self::$back_compat_keys[$key])) {
379
+			unset(self::$back_compat_keys[$key]);
380 380
 		}
381 381
 	}
382 382
 
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 * @return bool True if user exists in the database, false if not.
390 390
 	 */
391 391
 	public function exists() {
392
-		return ! empty( $this->ID );
392
+		return ! empty($this->ID);
393 393
 	}
394 394
 
395 395
 	/**
@@ -402,8 +402,8 @@  discard block
 block discarded – undo
402 402
 	 * @param string $key Property
403 403
 	 * @return mixed
404 404
 	 */
405
-	public function get( $key ) {
406
-		return $this->__get( $key );
405
+	public function get($key) {
406
+		return $this->__get($key);
407 407
 	}
408 408
 
409 409
 	/**
@@ -416,8 +416,8 @@  discard block
 block discarded – undo
416 416
 	 * @param string $key Property
417 417
 	 * @return bool
418 418
 	 */
419
-	public function has_prop( $key ) {
420
-		return $this->__isset( $key );
419
+	public function has_prop($key) {
420
+		return $this->__isset($key);
421 421
 	}
422 422
 
423 423
 	/**
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 * @return array Array representation.
429 429
 	 */
430 430
 	public function to_array() {
431
-		return get_object_vars( $this->data );
431
+		return get_object_vars($this->data);
432 432
 	}
433 433
 
434 434
 	/**
@@ -446,17 +446,17 @@  discard block
 block discarded – undo
446 446
 	 *
447 447
 	 * @param string $cap_key Optional capability key
448 448
 	 */
449
-	protected function _init_caps( $cap_key = '' ) {
449
+	protected function _init_caps($cap_key = '') {
450 450
 		global $wpdb;
451 451
 
452
-		if ( empty($cap_key) )
453
-			$this->cap_key = $wpdb->get_blog_prefix() . 'capabilities';
452
+		if (empty($cap_key))
453
+			$this->cap_key = $wpdb->get_blog_prefix().'capabilities';
454 454
 		else
455 455
 			$this->cap_key = $cap_key;
456 456
 
457
-		$this->caps = get_user_meta( $this->ID, $this->cap_key, true );
457
+		$this->caps = get_user_meta($this->ID, $this->cap_key, true);
458 458
 
459
-		if ( ! is_array( $this->caps ) )
459
+		if ( ! is_array($this->caps))
460 460
 			$this->caps = array();
461 461
 
462 462
 		$this->get_role_caps();
@@ -479,16 +479,16 @@  discard block
 block discarded – undo
479 479
 		$wp_roles = wp_roles();
480 480
 
481 481
 		//Filter out caps that are not role names and assign to $this->roles
482
-		if ( is_array( $this->caps ) )
483
-			$this->roles = array_filter( array_keys( $this->caps ), array( $wp_roles, 'is_role' ) );
482
+		if (is_array($this->caps))
483
+			$this->roles = array_filter(array_keys($this->caps), array($wp_roles, 'is_role'));
484 484
 
485 485
 		//Build $allcaps from role caps, overlay user's $caps
486 486
 		$this->allcaps = array();
487
-		foreach ( (array) $this->roles as $role ) {
488
-			$the_role = $wp_roles->get_role( $role );
489
-			$this->allcaps = array_merge( (array) $this->allcaps, (array) $the_role->capabilities );
487
+		foreach ((array) $this->roles as $role) {
488
+			$the_role = $wp_roles->get_role($role);
489
+			$this->allcaps = array_merge((array) $this->allcaps, (array) $the_role->capabilities);
490 490
 		}
491
-		$this->allcaps = array_merge( (array) $this->allcaps, (array) $this->caps );
491
+		$this->allcaps = array_merge((array) $this->allcaps, (array) $this->caps);
492 492
 
493 493
 		return $this->allcaps;
494 494
 	}
@@ -503,13 +503,13 @@  discard block
 block discarded – undo
503 503
 	 *
504 504
 	 * @param string $role Role name.
505 505
 	 */
506
-	public function add_role( $role ) {
507
-		if ( empty( $role ) ) {
506
+	public function add_role($role) {
507
+		if (empty($role)) {
508 508
 			return;
509 509
 		}
510 510
 
511 511
 		$this->caps[$role] = true;
512
-		update_user_meta( $this->ID, $this->cap_key, $this->caps );
512
+		update_user_meta($this->ID, $this->cap_key, $this->caps);
513 513
 		$this->get_role_caps();
514 514
 		$this->update_user_level_from_caps();
515 515
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 		 * @param int    $user_id The user ID.
522 522
 		 * @param string $role    The new role.
523 523
 		 */
524
-		do_action( 'add_user_role', $this->ID, $role );
524
+		do_action('add_user_role', $this->ID, $role);
525 525
 	}
526 526
 
527 527
 	/**
@@ -532,11 +532,11 @@  discard block
 block discarded – undo
532 532
 	 *
533 533
 	 * @param string $role Role name.
534 534
 	 */
535
-	public function remove_role( $role ) {
536
-		if ( !in_array($role, $this->roles) )
535
+	public function remove_role($role) {
536
+		if ( ! in_array($role, $this->roles))
537 537
 			return;
538
-		unset( $this->caps[$role] );
539
-		update_user_meta( $this->ID, $this->cap_key, $this->caps );
538
+		unset($this->caps[$role]);
539
+		update_user_meta($this->ID, $this->cap_key, $this->caps);
540 540
 		$this->get_role_caps();
541 541
 		$this->update_user_level_from_caps();
542 542
 
@@ -548,7 +548,7 @@  discard block
 block discarded – undo
548 548
 		 * @param int    $user_id The user ID.
549 549
 		 * @param string $role    The removed role.
550 550
 		 */
551
-		do_action( 'remove_user_role', $this->ID, $role );
551
+		do_action('remove_user_role', $this->ID, $role);
552 552
 	}
553 553
 
554 554
 	/**
@@ -563,21 +563,21 @@  discard block
 block discarded – undo
563 563
 	 *
564 564
 	 * @param string $role Role name.
565 565
 	 */
566
-	public function set_role( $role ) {
567
-		if ( 1 == count( $this->roles ) && $role == current( $this->roles ) )
566
+	public function set_role($role) {
567
+		if (1 == count($this->roles) && $role == current($this->roles))
568 568
 			return;
569 569
 
570
-		foreach ( (array) $this->roles as $oldrole )
571
-			unset( $this->caps[$oldrole] );
570
+		foreach ((array) $this->roles as $oldrole)
571
+			unset($this->caps[$oldrole]);
572 572
 
573 573
 		$old_roles = $this->roles;
574
-		if ( !empty( $role ) ) {
574
+		if ( ! empty($role)) {
575 575
 			$this->caps[$role] = true;
576
-			$this->roles = array( $role => true );
576
+			$this->roles = array($role => true);
577 577
 		} else {
578 578
 			$this->roles = false;
579 579
 		}
580
-		update_user_meta( $this->ID, $this->cap_key, $this->caps );
580
+		update_user_meta($this->ID, $this->cap_key, $this->caps);
581 581
 		$this->get_role_caps();
582 582
 		$this->update_user_level_from_caps();
583 583
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 		 * @param string $role      The new role.
592 592
 		 * @param array  $old_roles An array of the user's previous roles.
593 593
 		 */
594
-		do_action( 'set_user_role', $this->ID, $role, $old_roles );
594
+		do_action('set_user_role', $this->ID, $role, $old_roles);
595 595
 	}
596 596
 
597 597
 	/**
@@ -613,10 +613,10 @@  discard block
 block discarded – undo
613 613
 	 * @param string $item Level capability name.
614 614
 	 * @return int Max Level.
615 615
 	 */
616
-	public function level_reduction( $max, $item ) {
617
-		if ( preg_match( '/^level_(10|[0-9])$/i', $item, $matches ) ) {
618
-			$level = intval( $matches[1] );
619
-			return max( $max, $level );
616
+	public function level_reduction($max, $item) {
617
+		if (preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
618
+			$level = intval($matches[1]);
619
+			return max($max, $level);
620 620
 		} else {
621 621
 			return $max;
622 622
 		}
@@ -636,8 +636,8 @@  discard block
 block discarded – undo
636 636
 	 */
637 637
 	public function update_user_level_from_caps() {
638 638
 		global $wpdb;
639
-		$this->user_level = array_reduce( array_keys( $this->allcaps ), array( $this, 'level_reduction' ), 0 );
640
-		update_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level', $this->user_level );
639
+		$this->user_level = array_reduce(array_keys($this->allcaps), array($this, 'level_reduction'), 0);
640
+		update_user_meta($this->ID, $wpdb->get_blog_prefix().'user_level', $this->user_level);
641 641
 	}
642 642
 
643 643
 	/**
@@ -649,9 +649,9 @@  discard block
 block discarded – undo
649 649
 	 * @param string $cap Capability name.
650 650
 	 * @param bool $grant Whether to grant capability to user.
651 651
 	 */
652
-	public function add_cap( $cap, $grant = true ) {
652
+	public function add_cap($cap, $grant = true) {
653 653
 		$this->caps[$cap] = $grant;
654
-		update_user_meta( $this->ID, $this->cap_key, $this->caps );
654
+		update_user_meta($this->ID, $this->cap_key, $this->caps);
655 655
 		$this->get_role_caps();
656 656
 		$this->update_user_level_from_caps();
657 657
 	}
@@ -664,12 +664,12 @@  discard block
 block discarded – undo
664 664
 	 *
665 665
 	 * @param string $cap Capability name.
666 666
 	 */
667
-	public function remove_cap( $cap ) {
668
-		if ( ! isset( $this->caps[ $cap ] ) ) {
667
+	public function remove_cap($cap) {
668
+		if ( ! isset($this->caps[$cap])) {
669 669
 			return;
670 670
 		}
671
-		unset( $this->caps[ $cap ] );
672
-		update_user_meta( $this->ID, $this->cap_key, $this->caps );
671
+		unset($this->caps[$cap]);
672
+		update_user_meta($this->ID, $this->cap_key, $this->caps);
673 673
 		$this->get_role_caps();
674 674
 		$this->update_user_level_from_caps();
675 675
 	}
@@ -685,8 +685,8 @@  discard block
 block discarded – undo
685 685
 	public function remove_all_caps() {
686 686
 		global $wpdb;
687 687
 		$this->caps = array();
688
-		delete_user_meta( $this->ID, $this->cap_key );
689
-		delete_user_meta( $this->ID, $wpdb->get_blog_prefix() . 'user_level' );
688
+		delete_user_meta($this->ID, $this->cap_key);
689
+		delete_user_meta($this->ID, $wpdb->get_blog_prefix().'user_level');
690 690
 		$this->get_role_caps();
691 691
 	}
692 692
 
@@ -710,19 +710,19 @@  discard block
 block discarded – undo
710 710
 	 * @return bool Whether the current user has the given capability. If `$cap` is a meta cap and `$object_id` is
711 711
 	 *              passed, whether the current user has the given meta capability for the given object.
712 712
 	 */
713
-	public function has_cap( $cap ) {
714
-		if ( is_numeric( $cap ) ) {
715
-			_deprecated_argument( __FUNCTION__, '2.0.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.') );
716
-			$cap = $this->translate_level_to_cap( $cap );
713
+	public function has_cap($cap) {
714
+		if (is_numeric($cap)) {
715
+			_deprecated_argument(__FUNCTION__, '2.0.0', __('Usage of user levels by plugins and themes is deprecated. Use roles and capabilities instead.'));
716
+			$cap = $this->translate_level_to_cap($cap);
717 717
 		}
718 718
 
719
-		$args = array_slice( func_get_args(), 1 );
720
-		$args = array_merge( array( $cap, $this->ID ), $args );
721
-		$caps = call_user_func_array( 'map_meta_cap', $args );
719
+		$args = array_slice(func_get_args(), 1);
720
+		$args = array_merge(array($cap, $this->ID), $args);
721
+		$caps = call_user_func_array('map_meta_cap', $args);
722 722
 
723 723
 		// Multisite super admin has all caps by definition, Unless specifically denied.
724
-		if ( is_multisite() && is_super_admin( $this->ID ) ) {
725
-			if ( in_array('do_not_allow', $caps) )
724
+		if (is_multisite() && is_super_admin($this->ID)) {
725
+			if (in_array('do_not_allow', $caps))
726 726
 				return false;
727 727
 			return true;
728 728
 		}
@@ -738,14 +738,14 @@  discard block
 block discarded – undo
738 738
 		 * @param array   $args    Optional parameters passed to has_cap(), typically object ID.
739 739
 		 * @param WP_User $user    The user object.
740 740
 		 */
741
-		$capabilities = apply_filters( 'user_has_cap', $this->allcaps, $caps, $args, $this );
741
+		$capabilities = apply_filters('user_has_cap', $this->allcaps, $caps, $args, $this);
742 742
 
743 743
 		// Everyone is allowed to exist.
744 744
 		$capabilities['exist'] = true;
745 745
 
746 746
 		// Must have ALL requested caps.
747
-		foreach ( (array) $caps as $cap ) {
748
-			if ( empty( $capabilities[ $cap ] ) )
747
+		foreach ((array) $caps as $cap) {
748
+			if (empty($capabilities[$cap]))
749 749
 				return false;
750 750
 		}
751 751
 
@@ -763,8 +763,8 @@  discard block
 block discarded – undo
763 763
 	 * @param int $level Level number, 1 to 10.
764 764
 	 * @return string
765 765
 	 */
766
-	public function translate_level_to_cap( $level ) {
767
-		return 'level_' . $level;
766
+	public function translate_level_to_cap($level) {
767
+		return 'level_'.$level;
768 768
 	}
769 769
 
770 770
 	/**
@@ -776,12 +776,12 @@  discard block
 block discarded – undo
776 776
 	 *
777 777
 	 * @param int $blog_id Optional. Site ID, defaults to current site.
778 778
 	 */
779
-	public function for_blog( $blog_id = '' ) {
779
+	public function for_blog($blog_id = '') {
780 780
 		global $wpdb;
781
-		if ( ! empty( $blog_id ) )
782
-			$cap_key = $wpdb->get_blog_prefix( $blog_id ) . 'capabilities';
781
+		if ( ! empty($blog_id))
782
+			$cap_key = $wpdb->get_blog_prefix($blog_id).'capabilities';
783 783
 		else
784 784
 			$cap_key = '';
785
-		$this->_init_caps( $cap_key );
785
+		$this->_init_caps($cap_key);
786 786
 	}
787 787
 }
Please login to merge, or discard this patch.
src/wp-includes/customize/class-wp-customize-selective-refresh.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 	 * @since 4.5.0
79 79
 	 * @access public
80 80
 	 *
81
-	 * @return array Partials.
81
+	 * @return WP_Customize_Partial[] Partials.
82 82
 	 */
83 83
 	public function partials() {
84 84
 		return $this->partials;
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
 	 * @param string $errstr  Error string.
284 284
 	 * @param string $errfile Error file.
285 285
 	 * @param string $errline Error line.
286
-	 * @return true Always true.
286
+	 * @return boolean Always true.
287 287
 	 */
288 288
 	public function handle_error( $errno, $errstr, $errfile = null, $errline = null ) {
289 289
 		$this->triggered_errors[] = array(
Please login to merge, or discard this patch.
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -65,11 +65,11 @@  discard block
 block discarded – undo
65 65
 	 *
66 66
 	 * @param WP_Customize_Manager $manager Manager instance.
67 67
 	 */
68
-	public function __construct( WP_Customize_Manager $manager ) {
68
+	public function __construct(WP_Customize_Manager $manager) {
69 69
 		$this->manager = $manager;
70
-		require_once( ABSPATH . WPINC . '/customize/class-wp-customize-partial.php' );
70
+		require_once(ABSPATH.WPINC.'/customize/class-wp-customize-partial.php');
71 71
 
72
-		add_action( 'customize_preview_init', array( $this, 'init_preview' ) );
72
+		add_action('customize_preview_init', array($this, 'init_preview'));
73 73
 	}
74 74
 
75 75
 	/**
@@ -94,22 +94,22 @@  discard block
 block discarded – undo
94 94
 	 * @param array                       $args Optional. Partial arguments. Default empty array.
95 95
 	 * @return WP_Customize_Partial             The instance of the panel that was added.
96 96
 	 */
97
-	public function add_partial( $id, $args = array() ) {
98
-		if ( $id instanceof WP_Customize_Partial ) {
97
+	public function add_partial($id, $args = array()) {
98
+		if ($id instanceof WP_Customize_Partial) {
99 99
 			$partial = $id;
100 100
 		} else {
101 101
 			$class = 'WP_Customize_Partial';
102 102
 
103 103
 			/** This filter (will be) documented in wp-includes/class-wp-customize-manager.php */
104
-			$args = apply_filters( 'customize_dynamic_partial_args', $args, $id );
104
+			$args = apply_filters('customize_dynamic_partial_args', $args, $id);
105 105
 
106 106
 			/** This filter (will be) documented in wp-includes/class-wp-customize-manager.php */
107
-			$class = apply_filters( 'customize_dynamic_partial_class', $class, $id, $args );
107
+			$class = apply_filters('customize_dynamic_partial_class', $class, $id, $args);
108 108
 
109
-			$partial = new $class( $this, $id, $args );
109
+			$partial = new $class($this, $id, $args);
110 110
 		}
111 111
 
112
-		$this->partials[ $partial->id ] = $partial;
112
+		$this->partials[$partial->id] = $partial;
113 113
 		return $partial;
114 114
 	}
115 115
 
@@ -122,9 +122,9 @@  discard block
 block discarded – undo
122 122
 	 * @param string $id Customize Partial ID.
123 123
 	 * @return WP_Customize_Partial|null The partial, if set. Otherwise null.
124 124
 	 */
125
-	public function get_partial( $id ) {
126
-		if ( isset( $this->partials[ $id ] ) ) {
127
-			return $this->partials[ $id ];
125
+	public function get_partial($id) {
126
+		if (isset($this->partials[$id])) {
127
+			return $this->partials[$id];
128 128
 		} else {
129 129
 			return null;
130 130
 		}
@@ -138,8 +138,8 @@  discard block
 block discarded – undo
138 138
 	 *
139 139
 	 * @param string $id Customize Partial ID.
140 140
 	 */
141
-	public function remove_partial( $id ) {
142
-		unset( $this->partials[ $id ] );
141
+	public function remove_partial($id) {
142
+		unset($this->partials[$id]);
143 143
 	}
144 144
 
145 145
 	/**
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
 	 * @access public
150 150
 	 */
151 151
 	public function init_preview() {
152
-		add_action( 'template_redirect', array( $this, 'handle_render_partials_request' ) );
153
-		add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_preview_scripts' ) );
152
+		add_action('template_redirect', array($this, 'handle_render_partials_request'));
153
+		add_action('wp_enqueue_scripts', array($this, 'enqueue_preview_scripts'));
154 154
 	}
155 155
 
156 156
 	/**
@@ -160,8 +160,8 @@  discard block
 block discarded – undo
160 160
 	 * @access public
161 161
 	 */
162 162
 	public function enqueue_preview_scripts() {
163
-		wp_enqueue_script( 'customize-selective-refresh' );
164
-		add_action( 'wp_footer', array( $this, 'export_preview_data' ), 1000 );
163
+		wp_enqueue_script('customize-selective-refresh');
164
+		add_action('wp_footer', array($this, 'export_preview_data'), 1000);
165 165
 	}
166 166
 
167 167
 	/**
@@ -173,23 +173,23 @@  discard block
 block discarded – undo
173 173
 	public function export_preview_data() {
174 174
 		$partials = array();
175 175
 
176
-		foreach ( $this->partials() as $partial ) {
177
-			if ( $partial->check_capabilities() ) {
178
-				$partials[ $partial->id ] = $partial->json();
176
+		foreach ($this->partials() as $partial) {
177
+			if ($partial->check_capabilities()) {
178
+				$partials[$partial->id] = $partial->json();
179 179
 			}
180 180
 		}
181 181
 
182
-		$switched_locale = switch_to_locale( get_user_locale() );
182
+		$switched_locale = switch_to_locale(get_user_locale());
183 183
 		$l10n = array(
184
-			'shiftClickToEdit' => __( 'Shift-click to edit this element.' ),
185
-			'clickEditMenu' => __( 'Click to edit this menu.' ),
186
-			'clickEditWidget' => __( 'Click to edit this widget.' ),
187
-			'clickEditTitle' => __( 'Click to edit the site title.' ),
188
-			'clickEditMisc' => __( 'Click to edit this element.' ),
184
+			'shiftClickToEdit' => __('Shift-click to edit this element.'),
185
+			'clickEditMenu' => __('Click to edit this menu.'),
186
+			'clickEditWidget' => __('Click to edit this widget.'),
187
+			'clickEditTitle' => __('Click to edit the site title.'),
188
+			'clickEditMisc' => __('Click to edit this element.'),
189 189
 			/* translators: %s: document.write() */
190
-			'badDocumentWrite' => sprintf( __( '%s is forbidden' ), 'document.write()' ),
190
+			'badDocumentWrite' => sprintf(__('%s is forbidden'), 'document.write()'),
191 191
 		);
192
-		if ( $switched_locale ) {
192
+		if ($switched_locale) {
193 193
 			restore_previous_locale();
194 194
 		}
195 195
 
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 		);
201 201
 
202 202
 		// Export data to JS.
203
-		echo sprintf( '<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode( $exports ) );
203
+		echo sprintf('<script>var _customizePartialRefreshExports = %s;</script>', wp_json_encode($exports));
204 204
 	}
205 205
 
206 206
 	/**
@@ -214,14 +214,14 @@  discard block
 block discarded – undo
214 214
 	 * @param array $partial_ids The partial ID to add.
215 215
 	 * @return array Added WP_Customize_Partial instances.
216 216
 	 */
217
-	public function add_dynamic_partials( $partial_ids ) {
217
+	public function add_dynamic_partials($partial_ids) {
218 218
 		$new_partials = array();
219 219
 
220
-		foreach ( $partial_ids as $partial_id ) {
220
+		foreach ($partial_ids as $partial_id) {
221 221
 
222 222
 			// Skip partials already created.
223
-			$partial = $this->get_partial( $partial_id );
224
-			if ( $partial ) {
223
+			$partial = $this->get_partial($partial_id);
224
+			if ($partial) {
225 225
 				continue;
226 226
 			}
227 227
 
@@ -240,8 +240,8 @@  discard block
 block discarded – undo
240 240
 			 * @param false|array $partial_args The arguments to the WP_Customize_Partial constructor.
241 241
 			 * @param string      $partial_id   ID for dynamic partial.
242 242
 			 */
243
-			$partial_args = apply_filters( 'customize_dynamic_partial_args', $partial_args, $partial_id );
244
-			if ( false === $partial_args ) {
243
+			$partial_args = apply_filters('customize_dynamic_partial_args', $partial_args, $partial_id);
244
+			if (false === $partial_args) {
245 245
 				continue;
246 246
 			}
247 247
 
@@ -256,11 +256,11 @@  discard block
 block discarded – undo
256 256
 			 * @param string $partial_id    ID for dynamic partial.
257 257
 			 * @param array  $partial_args  The arguments to the WP_Customize_Partial constructor.
258 258
 			 */
259
-			$partial_class = apply_filters( 'customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args );
259
+			$partial_class = apply_filters('customize_dynamic_partial_class', $partial_class, $partial_id, $partial_args);
260 260
 
261
-			$partial = new $partial_class( $this, $partial_id, $partial_args );
261
+			$partial = new $partial_class($this, $partial_id, $partial_args);
262 262
 
263
-			$this->add_partial( $partial );
263
+			$this->add_partial($partial);
264 264
 			$new_partials[] = $partial;
265 265
 		}
266 266
 		return $new_partials;
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 	 * @return bool Whether the request is for rendering partials.
279 279
 	 */
280 280
 	public function is_render_partials_request() {
281
-		return ! empty( $_POST[ self::RENDER_QUERY_VAR ] );
281
+		return ! empty($_POST[self::RENDER_QUERY_VAR]);
282 282
 	}
283 283
 
284 284
 	/**
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 	 * @param string $errline Error line.
296 296
 	 * @return true Always true.
297 297
 	 */
298
-	public function handle_error( $errno, $errstr, $errfile = null, $errline = null ) {
298
+	public function handle_error($errno, $errstr, $errfile = null, $errline = null) {
299 299
 		$this->triggered_errors[] = array(
300 300
 			'partial'      => $this->current_partial_id,
301 301
 			'error_number' => $errno,
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 	 * @access public
314 314
 	 */
315 315
 	public function handle_render_partials_request() {
316
-		if ( ! $this->is_render_partials_request() ) {
316
+		if ( ! $this->is_render_partials_request()) {
317 317
 			return;
318 318
 		}
319 319
 
@@ -322,19 +322,19 @@  discard block
 block discarded – undo
322 322
 		 * user passed the 'customize' capability check and the nonce check, since
323 323
 		 * WP_Customize_Manager::setup_theme() is where the previewing flag is set.
324 324
 		 */
325
-		if ( ! is_customize_preview() ) {
326
-			wp_send_json_error( 'expected_customize_preview', 403 );
327
-		} else if ( ! isset( $_POST['partials'] ) ) {
328
-			wp_send_json_error( 'missing_partials', 400 );
325
+		if ( ! is_customize_preview()) {
326
+			wp_send_json_error('expected_customize_preview', 403);
327
+		} else if ( ! isset($_POST['partials'])) {
328
+			wp_send_json_error('missing_partials', 400);
329 329
 		}
330 330
 
331
-		$partials = json_decode( wp_unslash( $_POST['partials'] ), true );
331
+		$partials = json_decode(wp_unslash($_POST['partials']), true);
332 332
 
333
-		if ( ! is_array( $partials ) ) {
334
-			wp_send_json_error( 'malformed_partials' );
333
+		if ( ! is_array($partials)) {
334
+			wp_send_json_error('malformed_partials');
335 335
 		}
336 336
 
337
-		$this->add_dynamic_partials( array_keys( $partials ) );
337
+		$this->add_dynamic_partials(array_keys($partials));
338 338
 
339 339
 		/**
340 340
 		 * Fires immediately before partials are rendered.
@@ -349,35 +349,35 @@  discard block
 block discarded – undo
349 349
 		 *                                                 The array is keyed by partial ID, with each item being an array of
350 350
 		 *                                                 the placements' context data.
351 351
 		 */
352
-		do_action( 'customize_render_partials_before', $this, $partials );
352
+		do_action('customize_render_partials_before', $this, $partials);
353 353
 
354
-		set_error_handler( array( $this, 'handle_error' ), error_reporting() );
354
+		set_error_handler(array($this, 'handle_error'), error_reporting());
355 355
 
356 356
 		$contents = array();
357 357
 
358
-		foreach ( $partials as $partial_id => $container_contexts ) {
358
+		foreach ($partials as $partial_id => $container_contexts) {
359 359
 			$this->current_partial_id = $partial_id;
360 360
 
361
-			if ( ! is_array( $container_contexts ) ) {
362
-				wp_send_json_error( 'malformed_container_contexts' );
361
+			if ( ! is_array($container_contexts)) {
362
+				wp_send_json_error('malformed_container_contexts');
363 363
 			}
364 364
 
365
-			$partial = $this->get_partial( $partial_id );
365
+			$partial = $this->get_partial($partial_id);
366 366
 
367
-			if ( ! $partial || ! $partial->check_capabilities() ) {
368
-				$contents[ $partial_id ] = null;
367
+			if ( ! $partial || ! $partial->check_capabilities()) {
368
+				$contents[$partial_id] = null;
369 369
 				continue;
370 370
 			}
371 371
 
372
-			$contents[ $partial_id ] = array();
372
+			$contents[$partial_id] = array();
373 373
 
374 374
 			// @todo The array should include not only the contents, but also whether the container is included?
375
-			if ( empty( $container_contexts ) ) {
375
+			if (empty($container_contexts)) {
376 376
 				// Since there are no container contexts, render just once.
377
-				$contents[ $partial_id ][] = $partial->render( null );
377
+				$contents[$partial_id][] = $partial->render(null);
378 378
 			} else {
379
-				foreach ( $container_contexts as $container_context ) {
380
-					$contents[ $partial_id ][] = $partial->render( $container_context );
379
+				foreach ($container_contexts as $container_context) {
380
+					$contents[$partial_id][] = $partial->render($container_context);
381 381
 				}
382 382
 			}
383 383
 		}
@@ -398,18 +398,18 @@  discard block
 block discarded – undo
398 398
 		 *                                                 The array is keyed by partial ID, with each item being an array of
399 399
 		 *                                                 the placements' context data.
400 400
 		 */
401
-		do_action( 'customize_render_partials_after', $this, $partials );
401
+		do_action('customize_render_partials_after', $this, $partials);
402 402
 
403 403
 		$response = array(
404 404
 			'contents' => $contents,
405 405
 		);
406 406
 
407
-		if ( defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG_DISPLAY ) {
407
+		if (defined('WP_DEBUG_DISPLAY') && WP_DEBUG_DISPLAY) {
408 408
 			$response['errors'] = $this->triggered_errors;
409 409
 		}
410 410
 
411
-		$setting_validities = $this->manager->validate_setting_values( $this->manager->unsanitized_post_values() );
412
-		$exported_setting_validities = array_map( array( $this->manager, 'prepare_setting_validity_for_js' ), $setting_validities );
411
+		$setting_validities = $this->manager->validate_setting_values($this->manager->unsanitized_post_values());
412
+		$exported_setting_validities = array_map(array($this->manager, 'prepare_setting_validity_for_js'), $setting_validities);
413 413
 		$response['setting_validities'] = $exported_setting_validities;
414 414
 
415 415
 		/**
@@ -442,8 +442,8 @@  discard block
 block discarded – undo
442 442
 		 *                                                 The array is keyed by partial ID, with each item being an array of
443 443
 		 *                                                 the placements' context data.
444 444
 		 */
445
-		$response = apply_filters( 'customize_render_partials_response', $response, $this, $partials );
445
+		$response = apply_filters('customize_render_partials_response', $response, $this, $partials);
446 446
 
447
-		wp_send_json_success( $response );
447
+		wp_send_json_success($response);
448 448
 	}
449 449
 }
Please login to merge, or discard this patch.
src/wp-includes/general-template.php 4 patches
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
  * @since 1.5.0
1848 1848
  *
1849 1849
  * @param int $num Number of day.
1850
- * @return int Days since the start of the week.
1850
+ * @return double Days since the start of the week.
1851 1851
  */
1852 1852
 function calendar_week_mod($num) {
1853 1853
 	$base = 7;
@@ -3029,7 +3029,7 @@  discard block
 block discarded – undo
3029 3029
  *     @type string $before_page_number A string to appear before the page number. Default empty.
3030 3030
  *     @type string $after_page_number  A string to append after the page number. Default empty.
3031 3031
  * }
3032
- * @return array|string|void String of page links or array of page links.
3032
+ * @return string String of page links or array of page links.
3033 3033
  */
3034 3034
 function paginate_links( $args = '' ) {
3035 3035
 	global $wp_query, $wp_rewrite;
@@ -3190,7 +3190,7 @@  discard block
 block discarded – undo
3190 3190
  * @param string $key    The unique key for this theme.
3191 3191
  * @param string $name   The name of the theme.
3192 3192
  * @param string $url    The URL of the CSS file containing the color scheme.
3193
- * @param array  $colors Optional. An array of CSS color definition strings which are used
3193
+ * @param string[]  $colors Optional. An array of CSS color definition strings which are used
3194 3194
  *                       to give the user a feel for the theme.
3195 3195
  * @param array  $icons {
3196 3196
  *     Optional. CSS color definitions used to color any SVG icons.
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -2908,7 +2908,7 @@
 block discarded – undo
2908 2908
 
2909 2909
 			foreach ( $atts as $attr => $value ) {
2910 2910
 				if ( ! is_scalar( $value ) ||
2911
-				     ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ))
2911
+					 ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ))
2912 2912
 				) {
2913 2913
 					continue;
2914 2914
 				}
Please login to merge, or discard this patch.
Spacing   +776 added lines, -776 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
  *
20 20
  * @param string $name The name of the specialised header.
21 21
  */
22
-function get_header( $name = null ) {
22
+function get_header($name = null) {
23 23
 	/**
24 24
 	 * Fires before the header template file is loaded.
25 25
 	 *
@@ -32,17 +32,17 @@  discard block
 block discarded – undo
32 32
 	 *
33 33
 	 * @param string|null $name Name of the specific header file to use. null for the default header.
34 34
 	 */
35
-	do_action( 'get_header', $name );
35
+	do_action('get_header', $name);
36 36
 
37 37
 	$templates = array();
38 38
 	$name = (string) $name;
39
-	if ( '' !== $name ) {
39
+	if ('' !== $name) {
40 40
 		$templates[] = "header-{$name}.php";
41 41
 	}
42 42
 
43 43
 	$templates[] = 'header.php';
44 44
 
45
-	locate_template( $templates, true );
45
+	locate_template($templates, true);
46 46
 }
47 47
 
48 48
 /**
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
  *
59 59
  * @param string $name The name of the specialised footer.
60 60
  */
61
-function get_footer( $name = null ) {
61
+function get_footer($name = null) {
62 62
 	/**
63 63
 	 * Fires before the footer template file is loaded.
64 64
 	 *
@@ -71,17 +71,17 @@  discard block
 block discarded – undo
71 71
 	 *
72 72
 	 * @param string|null $name Name of the specific footer file to use. null for the default footer.
73 73
 	 */
74
-	do_action( 'get_footer', $name );
74
+	do_action('get_footer', $name);
75 75
 
76 76
 	$templates = array();
77 77
 	$name = (string) $name;
78
-	if ( '' !== $name ) {
78
+	if ('' !== $name) {
79 79
 		$templates[] = "footer-{$name}.php";
80 80
 	}
81 81
 
82
-	$templates[]    = 'footer.php';
82
+	$templates[] = 'footer.php';
83 83
 
84
-	locate_template( $templates, true );
84
+	locate_template($templates, true);
85 85
 }
86 86
 
87 87
 /**
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
  *
98 98
  * @param string $name The name of the specialised sidebar.
99 99
  */
100
-function get_sidebar( $name = null ) {
100
+function get_sidebar($name = null) {
101 101
 	/**
102 102
 	 * Fires before the sidebar template file is loaded.
103 103
 	 *
@@ -110,16 +110,16 @@  discard block
 block discarded – undo
110 110
 	 *
111 111
 	 * @param string|null $name Name of the specific sidebar file to use. null for the default sidebar.
112 112
 	 */
113
-	do_action( 'get_sidebar', $name );
113
+	do_action('get_sidebar', $name);
114 114
 
115 115
 	$templates = array();
116 116
 	$name = (string) $name;
117
-	if ( '' !== $name )
117
+	if ('' !== $name)
118 118
 		$templates[] = "sidebar-{$name}.php";
119 119
 
120 120
 	$templates[] = 'sidebar.php';
121 121
 
122
-	locate_template( $templates, true );
122
+	locate_template($templates, true);
123 123
 }
124 124
 
125 125
 /**
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
  * @param string $slug The slug name for the generic template.
144 144
  * @param string $name The name of the specialised template.
145 145
  */
146
-function get_template_part( $slug, $name = null ) {
146
+function get_template_part($slug, $name = null) {
147 147
 	/**
148 148
 	 * Fires before the specified template part file is loaded.
149 149
 	 *
@@ -155,11 +155,11 @@  discard block
 block discarded – undo
155 155
 	 * @param string      $slug The slug name for the generic template.
156 156
 	 * @param string|null $name The name of the specialized template.
157 157
 	 */
158
-	do_action( "get_template_part_{$slug}", $slug, $name );
158
+	do_action("get_template_part_{$slug}", $slug, $name);
159 159
 
160 160
 	$templates = array();
161 161
 	$name = (string) $name;
162
-	if ( '' !== $name )
162
+	if ('' !== $name)
163 163
 		$templates[] = "{$slug}-{$name}.php";
164 164
 
165 165
 	$templates[] = "{$slug}.php";
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
  * @param bool $echo Default to echo and not return the form.
190 190
  * @return string|void String when $echo is false.
191 191
  */
192
-function get_search_form( $echo = true ) {
192
+function get_search_form($echo = true) {
193 193
 	/**
194 194
 	 * Fires before the search form is retrieved, at the start of get_search_form().
195 195
 	 *
@@ -198,9 +198,9 @@  discard block
 block discarded – undo
198 198
 	 *
199 199
 	 * @link https://core.trac.wordpress.org/ticket/19321
200 200
 	 */
201
-	do_action( 'pre_get_search_form' );
201
+	do_action('pre_get_search_form');
202 202
 
203
-	$format = current_theme_supports( 'html5', 'search-form' ) ? 'html5' : 'xhtml';
203
+	$format = current_theme_supports('html5', 'search-form') ? 'html5' : 'xhtml';
204 204
 
205 205
 	/**
206 206
 	 * Filters the HTML format of the search form.
@@ -210,28 +210,28 @@  discard block
 block discarded – undo
210 210
 	 * @param string $format The type of markup to use in the search form.
211 211
 	 *                       Accepts 'html5', 'xhtml'.
212 212
 	 */
213
-	$format = apply_filters( 'search_form_format', $format );
213
+	$format = apply_filters('search_form_format', $format);
214 214
 
215
-	$search_form_template = locate_template( 'searchform.php' );
216
-	if ( '' != $search_form_template ) {
215
+	$search_form_template = locate_template('searchform.php');
216
+	if ('' != $search_form_template) {
217 217
 		ob_start();
218
-		require( $search_form_template );
218
+		require($search_form_template);
219 219
 		$form = ob_get_clean();
220 220
 	} else {
221
-		if ( 'html5' == $format ) {
222
-			$form = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
221
+		if ('html5' == $format) {
222
+			$form = '<form role="search" method="get" class="search-form" action="'.esc_url(home_url('/')).'">
223 223
 				<label>
224
-					<span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
225
-					<input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />
224
+					<span class="screen-reader-text">' . _x('Search for:', 'label').'</span>
225
+					<input type="search" class="search-field" placeholder="' . esc_attr_x('Search &hellip;', 'placeholder').'" value="'.get_search_query().'" name="s" />
226 226
 				</label>
227
-				<input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
227
+				<input type="submit" class="search-submit" value="'. esc_attr_x('Search', 'submit button').'" />
228 228
 			</form>';
229 229
 		} else {
230
-			$form = '<form role="search" method="get" id="searchform" class="searchform" action="' . esc_url( home_url( '/' ) ) . '">
230
+			$form = '<form role="search" method="get" id="searchform" class="searchform" action="'.esc_url(home_url('/')).'">
231 231
 				<div>
232
-					<label class="screen-reader-text" for="s">' . _x( 'Search for:', 'label' ) . '</label>
233
-					<input type="text" value="' . get_search_query() . '" name="s" id="s" />
234
-					<input type="submit" id="searchsubmit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
232
+					<label class="screen-reader-text" for="s">' . _x('Search for:', 'label').'</label>
233
+					<input type="text" value="' . get_search_query().'" name="s" id="s" />
234
+					<input type="submit" id="searchsubmit" value="'. esc_attr_x('Search', 'submit button').'" />
235 235
 				</div>
236 236
 			</form>';
237 237
 		}
@@ -244,12 +244,12 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @param string $form The search form HTML output.
246 246
 	 */
247
-	$result = apply_filters( 'get_search_form', $form );
247
+	$result = apply_filters('get_search_form', $form);
248 248
 
249
-	if ( null === $result )
249
+	if (null === $result)
250 250
 		$result = $form;
251 251
 
252
-	if ( $echo )
252
+	if ($echo)
253 253
 		echo $result;
254 254
 	else
255 255
 		return $result;
@@ -268,12 +268,12 @@  discard block
 block discarded – undo
268 268
  * @return string|void String when retrieving.
269 269
  */
270 270
 function wp_loginout($redirect = '', $echo = true) {
271
-	if ( ! is_user_logged_in() )
272
-		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
271
+	if ( ! is_user_logged_in())
272
+		$link = '<a href="'.esc_url(wp_login_url($redirect)).'">'.__('Log in').'</a>';
273 273
 	else
274
-		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
274
+		$link = '<a href="'.esc_url(wp_logout_url($redirect)).'">'.__('Log out').'</a>';
275 275
 
276
-	if ( $echo ) {
276
+	if ($echo) {
277 277
 		/**
278 278
 		 * Filters the HTML output for the Log In/Log Out link.
279 279
 		 *
@@ -281,10 +281,10 @@  discard block
 block discarded – undo
281 281
 		 *
282 282
 		 * @param string $link The HTML link content.
283 283
 		 */
284
-		echo apply_filters( 'loginout', $link );
284
+		echo apply_filters('loginout', $link);
285 285
 	} else {
286 286
 		/** This filter is documented in wp-includes/general-template.php */
287
-		return apply_filters( 'loginout', $link );
287
+		return apply_filters('loginout', $link);
288 288
 	}
289 289
 }
290 290
 
@@ -299,13 +299,13 @@  discard block
 block discarded – undo
299 299
  * @return string The logout URL. Note: HTML-encoded via esc_html() in wp_nonce_url().
300 300
  */
301 301
 function wp_logout_url($redirect = '') {
302
-	$args = array( 'action' => 'logout' );
303
-	if ( !empty($redirect) ) {
304
-		$args['redirect_to'] = urlencode( $redirect );
302
+	$args = array('action' => 'logout');
303
+	if ( ! empty($redirect)) {
304
+		$args['redirect_to'] = urlencode($redirect);
305 305
 	}
306 306
 
307 307
 	$logout_url = add_query_arg($args, site_url('wp-login.php', 'login'));
308
-	$logout_url = wp_nonce_url( $logout_url, 'log-out' );
308
+	$logout_url = wp_nonce_url($logout_url, 'log-out');
309 309
 
310 310
 	/**
311 311
 	 * Filters the logout URL.
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 	 * @param string $logout_url The HTML-encoded logout URL.
316 316
 	 * @param string $redirect   Path to redirect to on logout.
317 317
 	 */
318
-	return apply_filters( 'logout_url', $logout_url, $redirect );
318
+	return apply_filters('logout_url', $logout_url, $redirect);
319 319
 }
320 320
 
321 321
 /**
@@ -331,10 +331,10 @@  discard block
 block discarded – undo
331 331
 function wp_login_url($redirect = '', $force_reauth = false) {
332 332
 	$login_url = site_url('wp-login.php', 'login');
333 333
 
334
-	if ( !empty($redirect) )
334
+	if ( ! empty($redirect))
335 335
 		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
336 336
 
337
-	if ( $force_reauth )
337
+	if ($force_reauth)
338 338
 		$login_url = add_query_arg('reauth', '1', $login_url);
339 339
 
340 340
 	/**
@@ -347,7 +347,7 @@  discard block
 block discarded – undo
347 347
 	 * @param string $redirect     The path to redirect to on login, if supplied.
348 348
 	 * @param bool   $force_reauth Whether to force reauthorization, even if a cookie is present.
349 349
 	 */
350
-	return apply_filters( 'login_url', $login_url, $redirect, $force_reauth );
350
+	return apply_filters('login_url', $login_url, $redirect, $force_reauth);
351 351
 }
352 352
 
353 353
 /**
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 	 *
366 366
 	 * @param string $register The user registration URL.
367 367
 	 */
368
-	return apply_filters( 'register_url', site_url( 'wp-login.php?action=register', 'login' ) );
368
+	return apply_filters('register_url', site_url('wp-login.php?action=register', 'login'));
369 369
 }
370 370
 
371 371
 /**
@@ -399,16 +399,16 @@  discard block
 block discarded – undo
399 399
  * }
400 400
  * @return string|void String when retrieving.
401 401
  */
402
-function wp_login_form( $args = array() ) {
402
+function wp_login_form($args = array()) {
403 403
 	$defaults = array(
404 404
 		'echo' => true,
405 405
 		// Default 'redirect' value takes the user back to the request URI.
406
-		'redirect' => ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'],
406
+		'redirect' => (is_ssl() ? 'https://' : 'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'],
407 407
 		'form_id' => 'loginform',
408
-		'label_username' => __( 'Username or Email Address' ),
409
-		'label_password' => __( 'Password' ),
410
-		'label_remember' => __( 'Remember Me' ),
411
-		'label_log_in' => __( 'Log In' ),
408
+		'label_username' => __('Username or Email Address'),
409
+		'label_password' => __('Password'),
410
+		'label_remember' => __('Remember Me'),
411
+		'label_log_in' => __('Log In'),
412 412
 		'id_username' => 'user_login',
413 413
 		'id_password' => 'user_pass',
414 414
 		'id_remember' => 'rememberme',
@@ -428,7 +428,7 @@  discard block
 block discarded – undo
428 428
 	 *
429 429
 	 * @param array $defaults An array of default login form arguments.
430 430
 	 */
431
-	$args = wp_parse_args( $args, apply_filters( 'login_form_defaults', $defaults ) );
431
+	$args = wp_parse_args($args, apply_filters('login_form_defaults', $defaults));
432 432
 
433 433
 	/**
434 434
 	 * Filters content to display at the top of the login form.
@@ -440,7 +440,7 @@  discard block
 block discarded – undo
440 440
 	 * @param string $content Content to display. Default empty.
441 441
 	 * @param array  $args    Array of login form arguments.
442 442
 	 */
443
-	$login_form_top = apply_filters( 'login_form_top', '', $args );
443
+	$login_form_top = apply_filters('login_form_top', '', $args);
444 444
 
445 445
 	/**
446 446
 	 * Filters content to display in the middle of the login form.
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
 	 * @param string $content Content to display. Default empty.
454 454
 	 * @param array  $args    Array of login form arguments.
455 455
 	 */
456
-	$login_form_middle = apply_filters( 'login_form_middle', '', $args );
456
+	$login_form_middle = apply_filters('login_form_middle', '', $args);
457 457
 
458 458
 	/**
459 459
 	 * Filters content to display at the bottom of the login form.
@@ -465,29 +465,29 @@  discard block
 block discarded – undo
465 465
 	 * @param string $content Content to display. Default empty.
466 466
 	 * @param array  $args    Array of login form arguments.
467 467
 	 */
468
-	$login_form_bottom = apply_filters( 'login_form_bottom', '', $args );
468
+	$login_form_bottom = apply_filters('login_form_bottom', '', $args);
469 469
 
470 470
 	$form = '
471
-		<form name="' . $args['form_id'] . '" id="' . $args['form_id'] . '" action="' . esc_url( site_url( 'wp-login.php', 'login_post' ) ) . '" method="post">
472
-			' . $login_form_top . '
471
+		<form name="' . $args['form_id'].'" id="'.$args['form_id'].'" action="'.esc_url(site_url('wp-login.php', 'login_post')).'" method="post">
472
+			' . $login_form_top.'
473 473
 			<p class="login-username">
474
-				<label for="' . esc_attr( $args['id_username'] ) . '">' . esc_html( $args['label_username'] ) . '</label>
475
-				<input type="text" name="log" id="' . esc_attr( $args['id_username'] ) . '" class="input" value="' . esc_attr( $args['value_username'] ) . '" size="20" />
474
+				<label for="' . esc_attr($args['id_username']).'">'.esc_html($args['label_username']).'</label>
475
+				<input type="text" name="log" id="' . esc_attr($args['id_username']).'" class="input" value="'.esc_attr($args['value_username']).'" size="20" />
476 476
 			</p>
477 477
 			<p class="login-password">
478
-				<label for="' . esc_attr( $args['id_password'] ) . '">' . esc_html( $args['label_password'] ) . '</label>
479
-				<input type="password" name="pwd" id="' . esc_attr( $args['id_password'] ) . '" class="input" value="" size="20" />
478
+				<label for="' . esc_attr($args['id_password']).'">'.esc_html($args['label_password']).'</label>
479
+				<input type="password" name="pwd" id="' . esc_attr($args['id_password']).'" class="input" value="" size="20" />
480 480
 			</p>
481
-			' . $login_form_middle . '
482
-			' . ( $args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="' . esc_attr( $args['id_remember'] ) . '" value="forever"' . ( $args['value_remember'] ? ' checked="checked"' : '' ) . ' /> ' . esc_html( $args['label_remember'] ) . '</label></p>' : '' ) . '
481
+			' . $login_form_middle.'
482
+			' . ($args['remember'] ? '<p class="login-remember"><label><input name="rememberme" type="checkbox" id="'.esc_attr($args['id_remember']).'" value="forever"'.($args['value_remember'] ? ' checked="checked"' : '').' /> '.esc_html($args['label_remember']).'</label></p>' : '').'
483 483
 			<p class="login-submit">
484
-				<input type="submit" name="wp-submit" id="' . esc_attr( $args['id_submit'] ) . '" class="button button-primary" value="' . esc_attr( $args['label_log_in'] ) . '" />
485
-				<input type="hidden" name="redirect_to" value="' . esc_url( $args['redirect'] ) . '" />
484
+				<input type="submit" name="wp-submit" id="' . esc_attr($args['id_submit']).'" class="button button-primary" value="'.esc_attr($args['label_log_in']).'" />
485
+				<input type="hidden" name="redirect_to" value="' . esc_url($args['redirect']).'" />
486 486
 			</p>
487
-			' . $login_form_bottom . '
487
+			' . $login_form_bottom.'
488 488
 		</form>';
489 489
 
490
-	if ( $args['echo'] )
490
+	if ($args['echo'])
491 491
 		echo $form;
492 492
 	else
493 493
 		return $form;
@@ -501,13 +501,13 @@  discard block
 block discarded – undo
501 501
  * @param string $redirect Path to redirect to on login.
502 502
  * @return string Lost password URL.
503 503
  */
504
-function wp_lostpassword_url( $redirect = '' ) {
505
-	$args = array( 'action' => 'lostpassword' );
506
-	if ( !empty($redirect) ) {
504
+function wp_lostpassword_url($redirect = '') {
505
+	$args = array('action' => 'lostpassword');
506
+	if ( ! empty($redirect)) {
507 507
 		$args['redirect_to'] = $redirect;
508 508
 	}
509 509
 
510
-	$lostpassword_url = add_query_arg( $args, network_site_url('wp-login.php', 'login') );
510
+	$lostpassword_url = add_query_arg($args, network_site_url('wp-login.php', 'login'));
511 511
 
512 512
 	/**
513 513
 	 * Filters the Lost Password URL.
@@ -517,7 +517,7 @@  discard block
 block discarded – undo
517 517
 	 * @param string $lostpassword_url The lost password page URL.
518 518
 	 * @param string $redirect         The path to redirect to on login.
519 519
 	 */
520
-	return apply_filters( 'lostpassword_url', $lostpassword_url, $redirect );
520
+	return apply_filters('lostpassword_url', $lostpassword_url, $redirect);
521 521
 }
522 522
 
523 523
 /**
@@ -533,14 +533,14 @@  discard block
 block discarded – undo
533 533
  * @param bool   $echo   Default to echo and not return the link.
534 534
  * @return string|void String when retrieving.
535 535
  */
536
-function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
537
-	if ( ! is_user_logged_in() ) {
538
-		if ( get_option('users_can_register') )
539
-			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
536
+function wp_register($before = '<li>', $after = '</li>', $echo = true) {
537
+	if ( ! is_user_logged_in()) {
538
+		if (get_option('users_can_register'))
539
+			$link = $before.'<a href="'.esc_url(wp_registration_url()).'">'.__('Register').'</a>'.$after;
540 540
 		else
541 541
 			$link = '';
542
-	} elseif ( current_user_can( 'read' ) ) {
543
-		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
542
+	} elseif (current_user_can('read')) {
543
+		$link = $before.'<a href="'.admin_url().'">'.__('Site Admin').'</a>'.$after;
544 544
 	} else {
545 545
 		$link = '';
546 546
 	}
@@ -555,9 +555,9 @@  discard block
 block discarded – undo
555 555
 	 *
556 556
 	 * @param string $link The HTML code for the link to the Registration or Admin page.
557 557
 	 */
558
-	$link = apply_filters( 'register', $link );
558
+	$link = apply_filters('register', $link);
559 559
 
560
-	if ( $echo ) {
560
+	if ($echo) {
561 561
 		echo $link;
562 562
 	} else {
563 563
 		return $link;
@@ -580,7 +580,7 @@  discard block
 block discarded – undo
580 580
 	 *
581 581
 	 * @since 1.5.0
582 582
 	 */
583
-	do_action( 'wp_meta' );
583
+	do_action('wp_meta');
584 584
 }
585 585
 
586 586
 /**
@@ -592,8 +592,8 @@  discard block
 block discarded – undo
592 592
  *
593 593
  * @param string $show Optional. Site information to display. Default empty.
594 594
  */
595
-function bloginfo( $show = '' ) {
596
-	echo get_bloginfo( $show, 'display' );
595
+function bloginfo($show = '') {
596
+	echo get_bloginfo($show, 'display');
597 597
 }
598 598
 
599 599
 /**
@@ -643,17 +643,17 @@  discard block
 block discarded – undo
643 643
  * @param string $filter Optional. How to filter what is retrieved. Default 'raw'.
644 644
  * @return string Mostly string values, might be empty.
645 645
  */
646
-function get_bloginfo( $show = '', $filter = 'raw' ) {
647
-	switch( $show ) {
646
+function get_bloginfo($show = '', $filter = 'raw') {
647
+	switch ($show) {
648 648
 		case 'home' : // DEPRECATED
649 649
 		case 'siteurl' : // DEPRECATED
650
-			_deprecated_argument( __FUNCTION__, '2.2.0', sprintf(
650
+			_deprecated_argument(__FUNCTION__, '2.2.0', sprintf(
651 651
 				/* translators: 1: 'siteurl'/'home' argument, 2: bloginfo() function name, 3: 'url' argument */
652
-				__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.' ),
653
-				'<code>' . $show . '</code>',
652
+				__('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s option instead.'),
653
+				'<code>'.$show.'</code>',
654 654
 				'<code>bloginfo()</code>',
655 655
 				'<code>url</code>'
656
-			) );
656
+			));
657 657
 		case 'url' :
658 658
 			$output = home_url();
659 659
 			break;
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
 			$output = get_feed_link('comments_rss2');
683 683
 			break;
684 684
 		case 'pingback_url':
685
-			$output = site_url( 'xmlrpc.php' );
685
+			$output = site_url('xmlrpc.php');
686 686
 			break;
687 687
 		case 'stylesheet_url':
688 688
 			$output = get_stylesheet_uri();
@@ -713,21 +713,21 @@  discard block
 block discarded – undo
713 713
 			 * see https://www.w3.org/International/articles/language-tags/ for reference.
714 714
 			 * Do not translate into your own language.
715 715
 			 */
716
-			$output = __( 'html_lang_attribute' );
717
-			if ( 'html_lang_attribute' === $output || preg_match( '/[^a-zA-Z0-9-]/', $output ) ) {
716
+			$output = __('html_lang_attribute');
717
+			if ('html_lang_attribute' === $output || preg_match('/[^a-zA-Z0-9-]/', $output)) {
718 718
 				$output = get_locale();
719
-				$output = str_replace( '_', '-', $output );
719
+				$output = str_replace('_', '-', $output);
720 720
 			}
721 721
 			break;
722 722
 		case 'text_direction':
723
-			_deprecated_argument( __FUNCTION__, '2.2.0', sprintf(
723
+			_deprecated_argument(__FUNCTION__, '2.2.0', sprintf(
724 724
 				/* translators: 1: 'text_direction' argument, 2: bloginfo() function name, 3: is_rtl() function name */
725
-				__( 'The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.' ),
726
-				'<code>' . $show . '</code>',
725
+				__('The %1$s option is deprecated for the family of %2$s functions. Use the %3$s function instead.'),
726
+				'<code>'.$show.'</code>',
727 727
 				'<code>bloginfo()</code>',
728 728
 				'<code>is_rtl()</code>'
729
-			) );
730
-			if ( function_exists( 'is_rtl' ) ) {
729
+			));
730
+			if (function_exists('is_rtl')) {
731 731
 				$output = is_rtl() ? 'rtl' : 'ltr';
732 732
 			} else {
733 733
 				$output = 'ltr';
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
 		strpos($show, 'home') === false)
746 746
 		$url = false;
747 747
 
748
-	if ( 'display' == $filter ) {
749
-		if ( $url ) {
748
+	if ('display' == $filter) {
749
+		if ($url) {
750 750
 			/**
751 751
 			 * Filters the URL returned by get_bloginfo().
752 752
 			 *
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
 			 * @param mixed $output The URL returned by bloginfo().
756 756
 			 * @param mixed $show   Type of information requested.
757 757
 			 */
758
-			$output = apply_filters( 'bloginfo_url', $output, $show );
758
+			$output = apply_filters('bloginfo_url', $output, $show);
759 759
 		} else {
760 760
 			/**
761 761
 			 * Filters the site information returned by get_bloginfo().
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 			 * @param mixed $output The requested non-URL site information.
766 766
 			 * @param mixed $show   Type of information requested.
767 767
 			 */
768
-			$output = apply_filters( 'bloginfo', $output, $show );
768
+			$output = apply_filters('bloginfo', $output, $show);
769 769
 		}
770 770
 	}
771 771
 
@@ -782,26 +782,26 @@  discard block
 block discarded – undo
782 782
  * @param int    $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
783 783
  * @return string Site Icon URL.
784 784
  */
785
-function get_site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
785
+function get_site_icon_url($size = 512, $url = '', $blog_id = 0) {
786 786
 	$switched_blog = false;
787 787
 
788
-	if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
789
-		switch_to_blog( $blog_id );
788
+	if (is_multisite() && ! empty($blog_id) && (int) $blog_id !== get_current_blog_id()) {
789
+		switch_to_blog($blog_id);
790 790
 		$switched_blog = true;
791 791
 	}
792 792
 
793
-	$site_icon_id = get_option( 'site_icon' );
793
+	$site_icon_id = get_option('site_icon');
794 794
 
795
-	if ( $site_icon_id ) {
796
-		if ( $size >= 512 ) {
795
+	if ($site_icon_id) {
796
+		if ($size >= 512) {
797 797
 			$size_data = 'full';
798 798
 		} else {
799
-			$size_data = array( $size, $size );
799
+			$size_data = array($size, $size);
800 800
 		}
801
-		$url = wp_get_attachment_image_url( $site_icon_id, $size_data );
801
+		$url = wp_get_attachment_image_url($site_icon_id, $size_data);
802 802
 	}
803 803
 
804
-	if ( $switched_blog ) {
804
+	if ($switched_blog) {
805 805
 		restore_current_blog();
806 806
 	}
807 807
 
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 	 * @param int    $size    Size of the site icon.
815 815
 	 * @param int    $blog_id ID of the blog to get the site icon for.
816 816
 	 */
817
-	return apply_filters( 'get_site_icon_url', $url, $size, $blog_id );
817
+	return apply_filters('get_site_icon_url', $url, $size, $blog_id);
818 818
 }
819 819
 
820 820
 /**
@@ -826,8 +826,8 @@  discard block
 block discarded – undo
826 826
  * @param string $url     Optional. Fallback url if no site icon is found. Default empty.
827 827
  * @param int    $blog_id Optional. ID of the blog to get the site icon for. Default current blog.
828 828
  */
829
-function site_icon_url( $size = 512, $url = '', $blog_id = 0 ) {
830
-	echo esc_url( get_site_icon_url( $size, $url, $blog_id ) );
829
+function site_icon_url($size = 512, $url = '', $blog_id = 0) {
830
+	echo esc_url(get_site_icon_url($size, $url, $blog_id));
831 831
 }
832 832
 
833 833
 /**
@@ -838,8 +838,8 @@  discard block
 block discarded – undo
838 838
  * @param int $blog_id Optional. ID of the blog in question. Default current blog.
839 839
  * @return bool Whether the site has a site icon or not.
840 840
  */
841
-function has_site_icon( $blog_id = 0 ) {
842
-	return (bool) get_site_icon_url( 512, '', $blog_id );
841
+function has_site_icon($blog_id = 0) {
842
+	return (bool) get_site_icon_url(512, '', $blog_id);
843 843
 }
844 844
 
845 845
 /**
@@ -850,17 +850,17 @@  discard block
 block discarded – undo
850 850
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
851 851
  * @return bool Whether the site has a custom logo or not.
852 852
  */
853
-function has_custom_logo( $blog_id = 0 ) {
853
+function has_custom_logo($blog_id = 0) {
854 854
 	$switched_blog = false;
855 855
 
856
-	if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
857
-		switch_to_blog( $blog_id );
856
+	if (is_multisite() && ! empty($blog_id) && (int) $blog_id !== get_current_blog_id()) {
857
+		switch_to_blog($blog_id);
858 858
 		$switched_blog = true;
859 859
 	}
860 860
 
861
-	$custom_logo_id = get_theme_mod( 'custom_logo' );
861
+	$custom_logo_id = get_theme_mod('custom_logo');
862 862
 
863
-	if ( $switched_blog ) {
863
+	if ($switched_blog) {
864 864
 		restore_current_blog();
865 865
 	}
866 866
 
@@ -875,36 +875,36 @@  discard block
 block discarded – undo
875 875
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
876 876
  * @return string Custom logo markup.
877 877
  */
878
-function get_custom_logo( $blog_id = 0 ) {
878
+function get_custom_logo($blog_id = 0) {
879 879
 	$html = '';
880 880
 	$switched_blog = false;
881 881
 
882
-	if ( is_multisite() && ! empty( $blog_id ) && (int) $blog_id !== get_current_blog_id() ) {
883
-		switch_to_blog( $blog_id );
882
+	if (is_multisite() && ! empty($blog_id) && (int) $blog_id !== get_current_blog_id()) {
883
+		switch_to_blog($blog_id);
884 884
 		$switched_blog = true;
885 885
 	}
886 886
 
887
-	$custom_logo_id = get_theme_mod( 'custom_logo' );
887
+	$custom_logo_id = get_theme_mod('custom_logo');
888 888
 
889 889
 	// We have a logo. Logo is go.
890
-	if ( $custom_logo_id ) {
891
-		$html = sprintf( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
892
-			esc_url( home_url( '/' ) ),
893
-			wp_get_attachment_image( $custom_logo_id, 'full', false, array(
890
+	if ($custom_logo_id) {
891
+		$html = sprintf('<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>',
892
+			esc_url(home_url('/')),
893
+			wp_get_attachment_image($custom_logo_id, 'full', false, array(
894 894
 				'class'    => 'custom-logo',
895 895
 				'itemprop' => 'logo',
896
-			) )
896
+			))
897 897
 		);
898 898
 	}
899 899
 
900 900
 	// If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview).
901
-	elseif ( is_customize_preview() ) {
902
-		$html = sprintf( '<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>',
903
-			esc_url( home_url( '/' ) )
901
+	elseif (is_customize_preview()) {
902
+		$html = sprintf('<a href="%1$s" class="custom-logo-link" style="display:none;"><img class="custom-logo"/></a>',
903
+			esc_url(home_url('/'))
904 904
 		);
905 905
 	}
906 906
 
907
-	if ( $switched_blog ) {
907
+	if ($switched_blog) {
908 908
 		restore_current_blog();
909 909
 	}
910 910
 
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * @param string $html    Custom logo HTML output.
918 918
 	 * @param int    $blog_id ID of the blog to get the custom logo for.
919 919
 	 */
920
-	return apply_filters( 'get_custom_logo', $html, $blog_id );
920
+	return apply_filters('get_custom_logo', $html, $blog_id);
921 921
 }
922 922
 
923 923
 /**
@@ -927,8 +927,8 @@  discard block
 block discarded – undo
927 927
  *
928 928
  * @param int $blog_id Optional. ID of the blog in question. Default is the ID of the current blog.
929 929
  */
930
-function the_custom_logo( $blog_id = 0 ) {
931
-	echo get_custom_logo( $blog_id );
930
+function the_custom_logo($blog_id = 0) {
931
+	echo get_custom_logo($blog_id);
932 932
 }
933 933
 
934 934
 /**
@@ -953,8 +953,8 @@  discard block
 block discarded – undo
953 953
 	 *
954 954
 	 * @param string $title The document title. Default empty string.
955 955
 	 */
956
-	$title = apply_filters( 'pre_get_document_title', '' );
957
-	if ( ! empty( $title ) ) {
956
+	$title = apply_filters('pre_get_document_title', '');
957
+	if ( ! empty($title)) {
958 958
 		return $title;
959 959
 	}
960 960
 
@@ -965,62 +965,62 @@  discard block
 block discarded – undo
965 965
 	);
966 966
 
967 967
 	// If it's a 404 page, use a "Page not found" title.
968
-	if ( is_404() ) {
969
-		$title['title'] = __( 'Page not found' );
968
+	if (is_404()) {
969
+		$title['title'] = __('Page not found');
970 970
 
971 971
 	// If it's a search, use a dynamic search results title.
972
-	} elseif ( is_search() ) {
972
+	} elseif (is_search()) {
973 973
 		/* translators: %s: search phrase */
974
-		$title['title'] = sprintf( __( 'Search Results for &#8220;%s&#8221;' ), get_search_query() );
974
+		$title['title'] = sprintf(__('Search Results for &#8220;%s&#8221;'), get_search_query());
975 975
 
976 976
 	// If on the front page, use the site title.
977
-	} elseif ( is_front_page() ) {
978
-		$title['title'] = get_bloginfo( 'name', 'display' );
977
+	} elseif (is_front_page()) {
978
+		$title['title'] = get_bloginfo('name', 'display');
979 979
 
980 980
 	// If on a post type archive, use the post type archive title.
981
-	} elseif ( is_post_type_archive() ) {
982
-		$title['title'] = post_type_archive_title( '', false );
981
+	} elseif (is_post_type_archive()) {
982
+		$title['title'] = post_type_archive_title('', false);
983 983
 
984 984
 	// If on a taxonomy archive, use the term title.
985
-	} elseif ( is_tax() ) {
986
-		$title['title'] = single_term_title( '', false );
985
+	} elseif (is_tax()) {
986
+		$title['title'] = single_term_title('', false);
987 987
 
988 988
 	/*
989 989
 	 * If we're on the blog page that is not the homepage or
990 990
 	 * a single post of any post type, use the post title.
991 991
 	 */
992
-	} elseif ( is_home() || is_singular() ) {
993
-		$title['title'] = single_post_title( '', false );
992
+	} elseif (is_home() || is_singular()) {
993
+		$title['title'] = single_post_title('', false);
994 994
 
995 995
 	// If on a category or tag archive, use the term title.
996
-	} elseif ( is_category() || is_tag() ) {
997
-		$title['title'] = single_term_title( '', false );
996
+	} elseif (is_category() || is_tag()) {
997
+		$title['title'] = single_term_title('', false);
998 998
 
999 999
 	// If on an author archive, use the author's display name.
1000
-	} elseif ( is_author() && $author = get_queried_object() ) {
1000
+	} elseif (is_author() && $author = get_queried_object()) {
1001 1001
 		$title['title'] = $author->display_name;
1002 1002
 
1003 1003
 	// If it's a date archive, use the date as the title.
1004
-	} elseif ( is_year() ) {
1005
-		$title['title'] = get_the_date( _x( 'Y', 'yearly archives date format' ) );
1004
+	} elseif (is_year()) {
1005
+		$title['title'] = get_the_date(_x('Y', 'yearly archives date format'));
1006 1006
 
1007
-	} elseif ( is_month() ) {
1008
-		$title['title'] = get_the_date( _x( 'F Y', 'monthly archives date format' ) );
1007
+	} elseif (is_month()) {
1008
+		$title['title'] = get_the_date(_x('F Y', 'monthly archives date format'));
1009 1009
 
1010
-	} elseif ( is_day() ) {
1010
+	} elseif (is_day()) {
1011 1011
 		$title['title'] = get_the_date();
1012 1012
 	}
1013 1013
 
1014 1014
 	// Add a page number if necessary.
1015
-	if ( ( $paged >= 2 || $page >= 2 ) && ! is_404() ) {
1016
-		$title['page'] = sprintf( __( 'Page %s' ), max( $paged, $page ) );
1015
+	if (($paged >= 2 || $page >= 2) && ! is_404()) {
1016
+		$title['page'] = sprintf(__('Page %s'), max($paged, $page));
1017 1017
 	}
1018 1018
 
1019 1019
 	// Append the description or site title to give context.
1020
-	if ( is_front_page() ) {
1021
-		$title['tagline'] = get_bloginfo( 'description', 'display' );
1020
+	if (is_front_page()) {
1021
+		$title['tagline'] = get_bloginfo('description', 'display');
1022 1022
 	} else {
1023
-		$title['site'] = get_bloginfo( 'name', 'display' );
1023
+		$title['site'] = get_bloginfo('name', 'display');
1024 1024
 	}
1025 1025
 
1026 1026
 	/**
@@ -1030,7 +1030,7 @@  discard block
 block discarded – undo
1030 1030
 	 *
1031 1031
 	 * @param string $sep Document title separator. Default '-'.
1032 1032
 	 */
1033
-	$sep = apply_filters( 'document_title_separator', '-' );
1033
+	$sep = apply_filters('document_title_separator', '-');
1034 1034
 
1035 1035
 	/**
1036 1036
 	 * Filters the parts of the document title.
@@ -1046,13 +1046,13 @@  discard block
 block discarded – undo
1046 1046
 	 *     @type string $site    Optional. Site title when not on home page.
1047 1047
 	 * }
1048 1048
 	 */
1049
-	$title = apply_filters( 'document_title_parts', $title );
1049
+	$title = apply_filters('document_title_parts', $title);
1050 1050
 
1051
-	$title = implode( " $sep ", array_filter( $title ) );
1052
-	$title = wptexturize( $title );
1053
-	$title = convert_chars( $title );
1054
-	$title = esc_html( $title );
1055
-	$title = capital_P_dangit( $title );
1051
+	$title = implode(" $sep ", array_filter($title));
1052
+	$title = wptexturize($title);
1053
+	$title = convert_chars($title);
1054
+	$title = esc_html($title);
1055
+	$title = capital_P_dangit($title);
1056 1056
 
1057 1057
 	return $title;
1058 1058
 }
@@ -1066,11 +1066,11 @@  discard block
 block discarded – undo
1066 1066
  * @access private
1067 1067
  */
1068 1068
 function _wp_render_title_tag() {
1069
-	if ( ! current_theme_supports( 'title-tag' ) ) {
1069
+	if ( ! current_theme_supports('title-tag')) {
1070 1070
 		return;
1071 1071
 	}
1072 1072
 
1073
-	echo '<title>' . wp_get_document_title() . '</title>' . "\n";
1073
+	echo '<title>'.wp_get_document_title().'</title>'."\n";
1074 1074
 }
1075 1075
 
1076 1076
 /**
@@ -1098,94 +1098,94 @@  discard block
 block discarded – undo
1098 1098
  * @param string $seplocation Optional. Direction to display title, 'right'.
1099 1099
  * @return string|null String on retrieve, null when displaying.
1100 1100
  */
1101
-function wp_title( $sep = '&raquo;', $display = true, $seplocation = '' ) {
1101
+function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
1102 1102
 	global $wp_locale;
1103 1103
 
1104
-	$m        = get_query_var( 'm' );
1105
-	$year     = get_query_var( 'year' );
1106
-	$monthnum = get_query_var( 'monthnum' );
1107
-	$day      = get_query_var( 'day' );
1108
-	$search   = get_query_var( 's' );
1104
+	$m        = get_query_var('m');
1105
+	$year     = get_query_var('year');
1106
+	$monthnum = get_query_var('monthnum');
1107
+	$day      = get_query_var('day');
1108
+	$search   = get_query_var('s');
1109 1109
 	$title    = '';
1110 1110
 
1111 1111
 	$t_sep = '%WP_TITLE_SEP%'; // Temporary separator, for accurate flipping, if necessary
1112 1112
 
1113 1113
 	// If there is a post
1114
-	if ( is_single() || ( is_home() && ! is_front_page() ) || ( is_page() && ! is_front_page() ) ) {
1115
-		$title = single_post_title( '', false );
1114
+	if (is_single() || (is_home() && ! is_front_page()) || (is_page() && ! is_front_page())) {
1115
+		$title = single_post_title('', false);
1116 1116
 	}
1117 1117
 
1118 1118
 	// If there's a post type archive
1119
-	if ( is_post_type_archive() ) {
1120
-		$post_type = get_query_var( 'post_type' );
1121
-		if ( is_array( $post_type ) ) {
1122
-			$post_type = reset( $post_type );
1119
+	if (is_post_type_archive()) {
1120
+		$post_type = get_query_var('post_type');
1121
+		if (is_array($post_type)) {
1122
+			$post_type = reset($post_type);
1123 1123
 		}
1124
-		$post_type_object = get_post_type_object( $post_type );
1125
-		if ( ! $post_type_object->has_archive ) {
1126
-			$title = post_type_archive_title( '', false );
1124
+		$post_type_object = get_post_type_object($post_type);
1125
+		if ( ! $post_type_object->has_archive) {
1126
+			$title = post_type_archive_title('', false);
1127 1127
 		}
1128 1128
 	}
1129 1129
 
1130 1130
 	// If there's a category or tag
1131
-	if ( is_category() || is_tag() ) {
1132
-		$title = single_term_title( '', false );
1131
+	if (is_category() || is_tag()) {
1132
+		$title = single_term_title('', false);
1133 1133
 	}
1134 1134
 
1135 1135
 	// If there's a taxonomy
1136
-	if ( is_tax() ) {
1136
+	if (is_tax()) {
1137 1137
 		$term = get_queried_object();
1138
-		if ( $term ) {
1139
-			$tax   = get_taxonomy( $term->taxonomy );
1140
-			$title = single_term_title( $tax->labels->name . $t_sep, false );
1138
+		if ($term) {
1139
+			$tax   = get_taxonomy($term->taxonomy);
1140
+			$title = single_term_title($tax->labels->name.$t_sep, false);
1141 1141
 		}
1142 1142
 	}
1143 1143
 
1144 1144
 	// If there's an author
1145
-	if ( is_author() && ! is_post_type_archive() ) {
1145
+	if (is_author() && ! is_post_type_archive()) {
1146 1146
 		$author = get_queried_object();
1147
-		if ( $author ) {
1147
+		if ($author) {
1148 1148
 			$title = $author->display_name;
1149 1149
 		}
1150 1150
 	}
1151 1151
 
1152 1152
 	// Post type archives with has_archive should override terms.
1153
-	if ( is_post_type_archive() && $post_type_object->has_archive ) {
1154
-		$title = post_type_archive_title( '', false );
1153
+	if (is_post_type_archive() && $post_type_object->has_archive) {
1154
+		$title = post_type_archive_title('', false);
1155 1155
 	}
1156 1156
 
1157 1157
 	// If there's a month
1158
-	if ( is_archive() && ! empty( $m ) ) {
1159
-		$my_year  = substr( $m, 0, 4 );
1160
-		$my_month = $wp_locale->get_month( substr( $m, 4, 2 ) );
1161
-		$my_day   = intval( substr( $m, 6, 2 ) );
1162
-		$title    = $my_year . ( $my_month ? $t_sep . $my_month : '' ) . ( $my_day ? $t_sep . $my_day : '' );
1158
+	if (is_archive() && ! empty($m)) {
1159
+		$my_year  = substr($m, 0, 4);
1160
+		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1161
+		$my_day   = intval(substr($m, 6, 2));
1162
+		$title    = $my_year.($my_month ? $t_sep.$my_month : '').($my_day ? $t_sep.$my_day : '');
1163 1163
 	}
1164 1164
 
1165 1165
 	// If there's a year
1166
-	if ( is_archive() && ! empty( $year ) ) {
1166
+	if (is_archive() && ! empty($year)) {
1167 1167
 		$title = $year;
1168
-		if ( ! empty( $monthnum ) ) {
1169
-			$title .= $t_sep . $wp_locale->get_month( $monthnum );
1168
+		if ( ! empty($monthnum)) {
1169
+			$title .= $t_sep.$wp_locale->get_month($monthnum);
1170 1170
 		}
1171
-		if ( ! empty( $day ) ) {
1172
-			$title .= $t_sep . zeroise( $day, 2 );
1171
+		if ( ! empty($day)) {
1172
+			$title .= $t_sep.zeroise($day, 2);
1173 1173
 		}
1174 1174
 	}
1175 1175
 
1176 1176
 	// If it's a search
1177
-	if ( is_search() ) {
1177
+	if (is_search()) {
1178 1178
 		/* translators: 1: separator, 2: search phrase */
1179
-		$title = sprintf( __( 'Search Results %1$s %2$s' ), $t_sep, strip_tags( $search ) );
1179
+		$title = sprintf(__('Search Results %1$s %2$s'), $t_sep, strip_tags($search));
1180 1180
 	}
1181 1181
 
1182 1182
 	// If it's a 404 page
1183
-	if ( is_404() ) {
1184
-		$title = __( 'Page not found' );
1183
+	if (is_404()) {
1184
+		$title = __('Page not found');
1185 1185
 	}
1186 1186
 
1187 1187
 	$prefix = '';
1188
-	if ( ! empty( $title ) ) {
1188
+	if ( ! empty($title)) {
1189 1189
 		$prefix = " $sep ";
1190 1190
 	}
1191 1191
 
@@ -1196,14 +1196,14 @@  discard block
 block discarded – undo
1196 1196
 	 *
1197 1197
 	 * @param array $title_array Parts of the page title.
1198 1198
 	 */
1199
-	$title_array = apply_filters( 'wp_title_parts', explode( $t_sep, $title ) );
1199
+	$title_array = apply_filters('wp_title_parts', explode($t_sep, $title));
1200 1200
 
1201 1201
 	// Determines position of the separator and direction of the breadcrumb
1202
-	if ( 'right' == $seplocation ) { // sep on right, so reverse the order
1203
-		$title_array = array_reverse( $title_array );
1204
-		$title       = implode( " $sep ", $title_array ) . $prefix;
1202
+	if ('right' == $seplocation) { // sep on right, so reverse the order
1203
+		$title_array = array_reverse($title_array);
1204
+		$title       = implode(" $sep ", $title_array).$prefix;
1205 1205
 	} else {
1206
-		$title = $prefix . implode( " $sep ", $title_array );
1206
+		$title = $prefix.implode(" $sep ", $title_array);
1207 1207
 	}
1208 1208
 
1209 1209
 	/**
@@ -1215,10 +1215,10 @@  discard block
 block discarded – undo
1215 1215
 	 * @param string $sep Title separator.
1216 1216
 	 * @param string $seplocation Location of the separator (left or right).
1217 1217
 	 */
1218
-	$title = apply_filters( 'wp_title', $title, $sep, $seplocation );
1218
+	$title = apply_filters('wp_title', $title, $sep, $seplocation);
1219 1219
 
1220 1220
 	// Send it out
1221
-	if ( $display ) {
1221
+	if ($display) {
1222 1222
 		echo $title;
1223 1223
 	} else {
1224 1224
 		return $title;
@@ -1241,10 +1241,10 @@  discard block
 block discarded – undo
1241 1241
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1242 1242
  * @return string|void Title when retrieving.
1243 1243
  */
1244
-function single_post_title( $prefix = '', $display = true ) {
1244
+function single_post_title($prefix = '', $display = true) {
1245 1245
 	$_post = get_queried_object();
1246 1246
 
1247
-	if ( !isset($_post->post_title) )
1247
+	if ( ! isset($_post->post_title))
1248 1248
 		return;
1249 1249
 
1250 1250
 	/**
@@ -1255,11 +1255,11 @@  discard block
 block discarded – undo
1255 1255
 	 * @param string $_post_title The single post page title.
1256 1256
 	 * @param object $_post       The current queried object as returned by get_queried_object().
1257 1257
 	 */
1258
-	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
1259
-	if ( $display )
1260
-		echo $prefix . $title;
1258
+	$title = apply_filters('single_post_title', $_post->post_title, $_post);
1259
+	if ($display)
1260
+		echo $prefix.$title;
1261 1261
 	else
1262
-		return $prefix . $title;
1262
+		return $prefix.$title;
1263 1263
 }
1264 1264
 
1265 1265
 /**
@@ -1274,15 +1274,15 @@  discard block
 block discarded – undo
1274 1274
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1275 1275
  * @return string|void Title when retrieving, null when displaying or failure.
1276 1276
  */
1277
-function post_type_archive_title( $prefix = '', $display = true ) {
1278
-	if ( ! is_post_type_archive() )
1277
+function post_type_archive_title($prefix = '', $display = true) {
1278
+	if ( ! is_post_type_archive())
1279 1279
 		return;
1280 1280
 
1281
-	$post_type = get_query_var( 'post_type' );
1282
-	if ( is_array( $post_type ) )
1283
-		$post_type = reset( $post_type );
1281
+	$post_type = get_query_var('post_type');
1282
+	if (is_array($post_type))
1283
+		$post_type = reset($post_type);
1284 1284
 
1285
-	$post_type_obj = get_post_type_object( $post_type );
1285
+	$post_type_obj = get_post_type_object($post_type);
1286 1286
 
1287 1287
 	/**
1288 1288
 	 * Filters the post type archive title.
@@ -1292,12 +1292,12 @@  discard block
 block discarded – undo
1292 1292
 	 * @param string $post_type_name Post type 'name' label.
1293 1293
 	 * @param string $post_type      Post type.
1294 1294
 	 */
1295
-	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
1295
+	$title = apply_filters('post_type_archive_title', $post_type_obj->labels->name, $post_type);
1296 1296
 
1297
-	if ( $display )
1298
-		echo $prefix . $title;
1297
+	if ($display)
1298
+		echo $prefix.$title;
1299 1299
 	else
1300
-		return $prefix . $title;
1300
+		return $prefix.$title;
1301 1301
 }
1302 1302
 
1303 1303
 /**
@@ -1313,8 +1313,8 @@  discard block
 block discarded – undo
1313 1313
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1314 1314
  * @return string|void Title when retrieving.
1315 1315
  */
1316
-function single_cat_title( $prefix = '', $display = true ) {
1317
-	return single_term_title( $prefix, $display );
1316
+function single_cat_title($prefix = '', $display = true) {
1317
+	return single_term_title($prefix, $display);
1318 1318
 }
1319 1319
 
1320 1320
 /**
@@ -1330,8 +1330,8 @@  discard block
 block discarded – undo
1330 1330
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1331 1331
  * @return string|void Title when retrieving.
1332 1332
  */
1333
-function single_tag_title( $prefix = '', $display = true ) {
1334
-	return single_term_title( $prefix, $display );
1333
+function single_tag_title($prefix = '', $display = true) {
1334
+	return single_term_title($prefix, $display);
1335 1335
 }
1336 1336
 
1337 1337
 /**
@@ -1347,13 +1347,13 @@  discard block
 block discarded – undo
1347 1347
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1348 1348
  * @return string|void Title when retrieving.
1349 1349
  */
1350
-function single_term_title( $prefix = '', $display = true ) {
1350
+function single_term_title($prefix = '', $display = true) {
1351 1351
 	$term = get_queried_object();
1352 1352
 
1353
-	if ( !$term )
1353
+	if ( ! $term)
1354 1354
 		return;
1355 1355
 
1356
-	if ( is_category() ) {
1356
+	if (is_category()) {
1357 1357
 		/**
1358 1358
 		 * Filters the category archive page title.
1359 1359
 		 *
@@ -1361,8 +1361,8 @@  discard block
 block discarded – undo
1361 1361
 		 *
1362 1362
 		 * @param string $term_name Category name for archive being displayed.
1363 1363
 		 */
1364
-		$term_name = apply_filters( 'single_cat_title', $term->name );
1365
-	} elseif ( is_tag() ) {
1364
+		$term_name = apply_filters('single_cat_title', $term->name);
1365
+	} elseif (is_tag()) {
1366 1366
 		/**
1367 1367
 		 * Filters the tag archive page title.
1368 1368
 		 *
@@ -1370,8 +1370,8 @@  discard block
 block discarded – undo
1370 1370
 		 *
1371 1371
 		 * @param string $term_name Tag name for archive being displayed.
1372 1372
 		 */
1373
-		$term_name = apply_filters( 'single_tag_title', $term->name );
1374
-	} elseif ( is_tax() ) {
1373
+		$term_name = apply_filters('single_tag_title', $term->name);
1374
+	} elseif (is_tax()) {
1375 1375
 		/**
1376 1376
 		 * Filters the custom taxonomy archive page title.
1377 1377
 		 *
@@ -1379,18 +1379,18 @@  discard block
 block discarded – undo
1379 1379
 		 *
1380 1380
 		 * @param string $term_name Term name for archive being displayed.
1381 1381
 		 */
1382
-		$term_name = apply_filters( 'single_term_title', $term->name );
1382
+		$term_name = apply_filters('single_term_title', $term->name);
1383 1383
 	} else {
1384 1384
 		return;
1385 1385
 	}
1386 1386
 
1387
-	if ( empty( $term_name ) )
1387
+	if (empty($term_name))
1388 1388
 		return;
1389 1389
 
1390
-	if ( $display )
1391
-		echo $prefix . $term_name;
1390
+	if ($display)
1391
+		echo $prefix.$term_name;
1392 1392
 	else
1393
-		return $prefix . $term_name;
1393
+		return $prefix.$term_name;
1394 1394
 }
1395 1395
 
1396 1396
 /**
@@ -1409,27 +1409,27 @@  discard block
 block discarded – undo
1409 1409
  * @param bool   $display Optional, default is true. Whether to display or retrieve title.
1410 1410
  * @return string|void Title when retrieving.
1411 1411
  */
1412
-function single_month_title($prefix = '', $display = true ) {
1412
+function single_month_title($prefix = '', $display = true) {
1413 1413
 	global $wp_locale;
1414 1414
 
1415 1415
 	$m = get_query_var('m');
1416 1416
 	$year = get_query_var('year');
1417 1417
 	$monthnum = get_query_var('monthnum');
1418 1418
 
1419
-	if ( !empty($monthnum) && !empty($year) ) {
1419
+	if ( ! empty($monthnum) && ! empty($year)) {
1420 1420
 		$my_year = $year;
1421 1421
 		$my_month = $wp_locale->get_month($monthnum);
1422
-	} elseif ( !empty($m) ) {
1422
+	} elseif ( ! empty($m)) {
1423 1423
 		$my_year = substr($m, 0, 4);
1424 1424
 		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1425 1425
 	}
1426 1426
 
1427
-	if ( empty($my_month) )
1427
+	if (empty($my_month))
1428 1428
 		return false;
1429 1429
 
1430
-	$result = $prefix . $my_month . $prefix . $my_year;
1430
+	$result = $prefix.$my_month.$prefix.$my_year;
1431 1431
 
1432
-	if ( !$display )
1432
+	if ( ! $display)
1433 1433
 		return $result;
1434 1434
 	echo $result;
1435 1435
 }
@@ -1444,11 +1444,11 @@  discard block
 block discarded – undo
1444 1444
  * @param string $before Optional. Content to prepend to the title. Default empty.
1445 1445
  * @param string $after  Optional. Content to append to the title. Default empty.
1446 1446
  */
1447
-function the_archive_title( $before = '', $after = '' ) {
1447
+function the_archive_title($before = '', $after = '') {
1448 1448
 	$title = get_the_archive_title();
1449 1449
 
1450
-	if ( ! empty( $title ) ) {
1451
-		echo $before . $title . $after;
1450
+	if ( ! empty($title)) {
1451
+		echo $before.$title.$after;
1452 1452
 	}
1453 1453
 }
1454 1454
 
@@ -1460,53 +1460,53 @@  discard block
 block discarded – undo
1460 1460
  * @return string Archive title.
1461 1461
  */
1462 1462
 function get_the_archive_title() {
1463
-	if ( is_category() ) {
1463
+	if (is_category()) {
1464 1464
 		/* translators: Category archive title. 1: Category name */
1465
-		$title = sprintf( __( 'Category: %s' ), single_cat_title( '', false ) );
1466
-	} elseif ( is_tag() ) {
1465
+		$title = sprintf(__('Category: %s'), single_cat_title('', false));
1466
+	} elseif (is_tag()) {
1467 1467
 		/* translators: Tag archive title. 1: Tag name */
1468
-		$title = sprintf( __( 'Tag: %s' ), single_tag_title( '', false ) );
1469
-	} elseif ( is_author() ) {
1468
+		$title = sprintf(__('Tag: %s'), single_tag_title('', false));
1469
+	} elseif (is_author()) {
1470 1470
 		/* translators: Author archive title. 1: Author name */
1471
-		$title = sprintf( __( 'Author: %s' ), '<span class="vcard">' . get_the_author() . '</span>' );
1472
-	} elseif ( is_year() ) {
1471
+		$title = sprintf(__('Author: %s'), '<span class="vcard">'.get_the_author().'</span>');
1472
+	} elseif (is_year()) {
1473 1473
 		/* translators: Yearly archive title. 1: Year */
1474
-		$title = sprintf( __( 'Year: %s' ), get_the_date( _x( 'Y', 'yearly archives date format' ) ) );
1475
-	} elseif ( is_month() ) {
1474
+		$title = sprintf(__('Year: %s'), get_the_date(_x('Y', 'yearly archives date format')));
1475
+	} elseif (is_month()) {
1476 1476
 		/* translators: Monthly archive title. 1: Month name and year */
1477
-		$title = sprintf( __( 'Month: %s' ), get_the_date( _x( 'F Y', 'monthly archives date format' ) ) );
1478
-	} elseif ( is_day() ) {
1477
+		$title = sprintf(__('Month: %s'), get_the_date(_x('F Y', 'monthly archives date format')));
1478
+	} elseif (is_day()) {
1479 1479
 		/* translators: Daily archive title. 1: Date */
1480
-		$title = sprintf( __( 'Day: %s' ), get_the_date( _x( 'F j, Y', 'daily archives date format' ) ) );
1481
-	} elseif ( is_tax( 'post_format' ) ) {
1482
-		if ( is_tax( 'post_format', 'post-format-aside' ) ) {
1483
-			$title = _x( 'Asides', 'post format archive title' );
1484
-		} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
1485
-			$title = _x( 'Galleries', 'post format archive title' );
1486
-		} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
1487
-			$title = _x( 'Images', 'post format archive title' );
1488
-		} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
1489
-			$title = _x( 'Videos', 'post format archive title' );
1490
-		} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
1491
-			$title = _x( 'Quotes', 'post format archive title' );
1492
-		} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
1493
-			$title = _x( 'Links', 'post format archive title' );
1494
-		} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
1495
-			$title = _x( 'Statuses', 'post format archive title' );
1496
-		} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
1497
-			$title = _x( 'Audio', 'post format archive title' );
1498
-		} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
1499
-			$title = _x( 'Chats', 'post format archive title' );
1480
+		$title = sprintf(__('Day: %s'), get_the_date(_x('F j, Y', 'daily archives date format')));
1481
+	} elseif (is_tax('post_format')) {
1482
+		if (is_tax('post_format', 'post-format-aside')) {
1483
+			$title = _x('Asides', 'post format archive title');
1484
+		} elseif (is_tax('post_format', 'post-format-gallery')) {
1485
+			$title = _x('Galleries', 'post format archive title');
1486
+		} elseif (is_tax('post_format', 'post-format-image')) {
1487
+			$title = _x('Images', 'post format archive title');
1488
+		} elseif (is_tax('post_format', 'post-format-video')) {
1489
+			$title = _x('Videos', 'post format archive title');
1490
+		} elseif (is_tax('post_format', 'post-format-quote')) {
1491
+			$title = _x('Quotes', 'post format archive title');
1492
+		} elseif (is_tax('post_format', 'post-format-link')) {
1493
+			$title = _x('Links', 'post format archive title');
1494
+		} elseif (is_tax('post_format', 'post-format-status')) {
1495
+			$title = _x('Statuses', 'post format archive title');
1496
+		} elseif (is_tax('post_format', 'post-format-audio')) {
1497
+			$title = _x('Audio', 'post format archive title');
1498
+		} elseif (is_tax('post_format', 'post-format-chat')) {
1499
+			$title = _x('Chats', 'post format archive title');
1500 1500
 		}
1501
-	} elseif ( is_post_type_archive() ) {
1501
+	} elseif (is_post_type_archive()) {
1502 1502
 		/* translators: Post type archive title. 1: Post type name */
1503
-		$title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
1504
-	} elseif ( is_tax() ) {
1505
-		$tax = get_taxonomy( get_queried_object()->taxonomy );
1503
+		$title = sprintf(__('Archives: %s'), post_type_archive_title('', false));
1504
+	} elseif (is_tax()) {
1505
+		$tax = get_taxonomy(get_queried_object()->taxonomy);
1506 1506
 		/* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */
1507
-		$title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
1507
+		$title = sprintf(__('%1$s: %2$s'), $tax->labels->singular_name, single_term_title('', false));
1508 1508
 	} else {
1509
-		$title = __( 'Archives' );
1509
+		$title = __('Archives');
1510 1510
 	}
1511 1511
 
1512 1512
 	/**
@@ -1516,7 +1516,7 @@  discard block
 block discarded – undo
1516 1516
 	 *
1517 1517
 	 * @param string $title Archive title to be displayed.
1518 1518
 	 */
1519
-	return apply_filters( 'get_the_archive_title', $title );
1519
+	return apply_filters('get_the_archive_title', $title);
1520 1520
 }
1521 1521
 
1522 1522
 /**
@@ -1529,10 +1529,10 @@  discard block
 block discarded – undo
1529 1529
  * @param string $before Optional. Content to prepend to the description. Default empty.
1530 1530
  * @param string $after  Optional. Content to append to the description. Default empty.
1531 1531
  */
1532
-function the_archive_description( $before = '', $after = '' ) {
1532
+function the_archive_description($before = '', $after = '') {
1533 1533
 	$description = get_the_archive_description();
1534
-	if ( $description ) {
1535
-		echo $before . $description . $after;
1534
+	if ($description) {
1535
+		echo $before.$description.$after;
1536 1536
 	}
1537 1537
 }
1538 1538
 
@@ -1547,8 +1547,8 @@  discard block
 block discarded – undo
1547 1547
  * @return string Archive description.
1548 1548
  */
1549 1549
 function get_the_archive_description() {
1550
-	if ( is_author() ) {
1551
-		$description = get_the_author_meta( 'description' );
1550
+	if (is_author()) {
1551
+		$description = get_the_author_meta('description');
1552 1552
 	} else {
1553 1553
 		$description = term_description();
1554 1554
 	}
@@ -1560,7 +1560,7 @@  discard block
 block discarded – undo
1560 1560
 	 *
1561 1561
 	 * @param string $description Archive description to be displayed.
1562 1562
 	 */
1563
-	return apply_filters( 'get_the_archive_description', $description );
1563
+	return apply_filters('get_the_archive_description', $description);
1564 1564
 }
1565 1565
 
1566 1566
 /**
@@ -1601,7 +1601,7 @@  discard block
 block discarded – undo
1601 1601
 	$url = esc_url($url);
1602 1602
 
1603 1603
 	if ('link' == $format)
1604
-		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1604
+		$link_html = "\t<link rel='archives' title='".esc_attr($text)."' href='$url' />\n";
1605 1605
 	elseif ('option' == $format)
1606 1606
 		$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1607 1607
 	elseif ('html' == $format)
@@ -1622,7 +1622,7 @@  discard block
 block discarded – undo
1622 1622
 	 * @param string $before    Content to prepend to the description.
1623 1623
 	 * @param string $after     Content to append to the description.
1624 1624
 	 */
1625
-	return apply_filters( 'get_archives_link', $link_html, $url, $text, $format, $before, $after );
1625
+	return apply_filters('get_archives_link', $link_html, $url, $text, $format, $before, $after);
1626 1626
 }
1627 1627
 
1628 1628
 /**
@@ -1660,7 +1660,7 @@  discard block
 block discarded – undo
1660 1660
  * }
1661 1661
  * @return string|void String when retrieving.
1662 1662
  */
1663
-function wp_get_archives( $args = '' ) {
1663
+function wp_get_archives($args = '') {
1664 1664
 	global $wpdb, $wp_locale;
1665 1665
 
1666 1666
 	$defaults = array(
@@ -1671,32 +1671,32 @@  discard block
 block discarded – undo
1671 1671
 		'post_type' => 'post'
1672 1672
 	);
1673 1673
 
1674
-	$r = wp_parse_args( $args, $defaults );
1674
+	$r = wp_parse_args($args, $defaults);
1675 1675
 
1676
-	$post_type_object = get_post_type_object( $r['post_type'] );
1677
-	if ( ! is_post_type_viewable( $post_type_object ) ) {
1676
+	$post_type_object = get_post_type_object($r['post_type']);
1677
+	if ( ! is_post_type_viewable($post_type_object)) {
1678 1678
 		return;
1679 1679
 	}
1680 1680
 	$r['post_type'] = $post_type_object->name;
1681 1681
 
1682
-	if ( '' == $r['type'] ) {
1682
+	if ('' == $r['type']) {
1683 1683
 		$r['type'] = 'monthly';
1684 1684
 	}
1685 1685
 
1686
-	if ( ! empty( $r['limit'] ) ) {
1687
-		$r['limit'] = absint( $r['limit'] );
1688
-		$r['limit'] = ' LIMIT ' . $r['limit'];
1686
+	if ( ! empty($r['limit'])) {
1687
+		$r['limit'] = absint($r['limit']);
1688
+		$r['limit'] = ' LIMIT '.$r['limit'];
1689 1689
 	}
1690 1690
 
1691
-	$order = strtoupper( $r['order'] );
1692
-	if ( $order !== 'ASC' ) {
1691
+	$order = strtoupper($r['order']);
1692
+	if ($order !== 'ASC') {
1693 1693
 		$order = 'DESC';
1694 1694
 	}
1695 1695
 
1696 1696
 	// this is what will separate dates on weekly archive links
1697 1697
 	$archive_week_separator = '&#8211;';
1698 1698
 
1699
-	$sql_where = $wpdb->prepare( "WHERE post_type = %s AND post_status = 'publish'", $r['post_type'] );
1699
+	$sql_where = $wpdb->prepare("WHERE post_type = %s AND post_status = 'publish'", $r['post_type']);
1700 1700
 
1701 1701
 	/**
1702 1702
 	 * Filters the SQL WHERE clause for retrieving archives.
@@ -1706,7 +1706,7 @@  discard block
 block discarded – undo
1706 1706
 	 * @param string $sql_where Portion of SQL query containing the WHERE clause.
1707 1707
 	 * @param array  $r         An array of default arguments.
1708 1708
 	 */
1709
-	$where = apply_filters( 'getarchives_where', $sql_where, $r );
1709
+	$where = apply_filters('getarchives_where', $sql_where, $r);
1710 1710
 
1711 1711
 	/**
1712 1712
 	 * Filters the SQL JOIN clause for retrieving archives.
@@ -1716,138 +1716,138 @@  discard block
 block discarded – undo
1716 1716
 	 * @param string $sql_join Portion of SQL query containing JOIN clause.
1717 1717
 	 * @param array  $r        An array of default arguments.
1718 1718
 	 */
1719
-	$join = apply_filters( 'getarchives_join', '', $r );
1719
+	$join = apply_filters('getarchives_join', '', $r);
1720 1720
 
1721 1721
 	$output = '';
1722 1722
 
1723
-	$last_changed = wp_cache_get_last_changed( 'posts' );
1723
+	$last_changed = wp_cache_get_last_changed('posts');
1724 1724
 
1725 1725
 	$limit = $r['limit'];
1726 1726
 
1727
-	if ( 'monthly' == $r['type'] ) {
1727
+	if ('monthly' == $r['type']) {
1728 1728
 		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date $order $limit";
1729
-		$key = md5( $query );
1729
+		$key = md5($query);
1730 1730
 		$key = "wp_get_archives:$key:$last_changed";
1731
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1732
-			$results = $wpdb->get_results( $query );
1733
-			wp_cache_set( $key, $results, 'posts' );
1731
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1732
+			$results = $wpdb->get_results($query);
1733
+			wp_cache_set($key, $results, 'posts');
1734 1734
 		}
1735
-		if ( $results ) {
1735
+		if ($results) {
1736 1736
 			$after = $r['after'];
1737
-			foreach ( (array) $results as $result ) {
1738
-				$url = get_month_link( $result->year, $result->month );
1739
-				if ( 'post' !== $r['post_type'] ) {
1740
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1737
+			foreach ((array) $results as $result) {
1738
+				$url = get_month_link($result->year, $result->month);
1739
+				if ('post' !== $r['post_type']) {
1740
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1741 1741
 				}
1742 1742
 				/* translators: 1: month name, 2: 4-digit year */
1743
-				$text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $result->month ), $result->year );
1744
-				if ( $r['show_post_count'] ) {
1745
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1743
+				$text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($result->month), $result->year);
1744
+				if ($r['show_post_count']) {
1745
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1746 1746
 				}
1747
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1747
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1748 1748
 			}
1749 1749
 		}
1750
-	} elseif ( 'yearly' == $r['type'] ) {
1750
+	} elseif ('yearly' == $r['type']) {
1751 1751
 		$query = "SELECT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date) ORDER BY post_date $order $limit";
1752
-		$key = md5( $query );
1752
+		$key = md5($query);
1753 1753
 		$key = "wp_get_archives:$key:$last_changed";
1754
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1755
-			$results = $wpdb->get_results( $query );
1756
-			wp_cache_set( $key, $results, 'posts' );
1754
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1755
+			$results = $wpdb->get_results($query);
1756
+			wp_cache_set($key, $results, 'posts');
1757 1757
 		}
1758
-		if ( $results ) {
1758
+		if ($results) {
1759 1759
 			$after = $r['after'];
1760
-			foreach ( (array) $results as $result) {
1761
-				$url = get_year_link( $result->year );
1762
-				if ( 'post' !== $r['post_type'] ) {
1763
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1760
+			foreach ((array) $results as $result) {
1761
+				$url = get_year_link($result->year);
1762
+				if ('post' !== $r['post_type']) {
1763
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1764 1764
 				}
1765
-				$text = sprintf( '%d', $result->year );
1766
-				if ( $r['show_post_count'] ) {
1767
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1765
+				$text = sprintf('%d', $result->year);
1766
+				if ($r['show_post_count']) {
1767
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1768 1768
 				}
1769
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1769
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1770 1770
 			}
1771 1771
 		}
1772
-	} elseif ( 'daily' == $r['type'] ) {
1772
+	} elseif ('daily' == $r['type']) {
1773 1773
 		$query = "SELECT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts $join $where GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date $order $limit";
1774
-		$key = md5( $query );
1774
+		$key = md5($query);
1775 1775
 		$key = "wp_get_archives:$key:$last_changed";
1776
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1777
-			$results = $wpdb->get_results( $query );
1778
-			wp_cache_set( $key, $results, 'posts' );
1776
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1777
+			$results = $wpdb->get_results($query);
1778
+			wp_cache_set($key, $results, 'posts');
1779 1779
 		}
1780
-		if ( $results ) {
1780
+		if ($results) {
1781 1781
 			$after = $r['after'];
1782
-			foreach ( (array) $results as $result ) {
1783
-				$url  = get_day_link( $result->year, $result->month, $result->dayofmonth );
1784
-				if ( 'post' !== $r['post_type'] ) {
1785
-					$url = add_query_arg( 'post_type', $r['post_type'], $url );
1782
+			foreach ((array) $results as $result) {
1783
+				$url  = get_day_link($result->year, $result->month, $result->dayofmonth);
1784
+				if ('post' !== $r['post_type']) {
1785
+					$url = add_query_arg('post_type', $r['post_type'], $url);
1786 1786
 				}
1787
-				$date = sprintf( '%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth );
1788
-				$text = mysql2date( get_option( 'date_format' ), $date );
1789
-				if ( $r['show_post_count'] ) {
1790
-					$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1787
+				$date = sprintf('%1$d-%2$02d-%3$02d 00:00:00', $result->year, $result->month, $result->dayofmonth);
1788
+				$text = mysql2date(get_option('date_format'), $date);
1789
+				if ($r['show_post_count']) {
1790
+					$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1791 1791
 				}
1792
-				$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1792
+				$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1793 1793
 			}
1794 1794
 		}
1795
-	} elseif ( 'weekly' == $r['type'] ) {
1796
-		$week = _wp_mysql_week( '`post_date`' );
1795
+	} elseif ('weekly' == $r['type']) {
1796
+		$week = _wp_mysql_week('`post_date`');
1797 1797
 		$query = "SELECT DISTINCT $week AS `week`, YEAR( `post_date` ) AS `yr`, DATE_FORMAT( `post_date`, '%Y-%m-%d' ) AS `yyyymmdd`, count( `ID` ) AS `posts` FROM `$wpdb->posts` $join $where GROUP BY $week, YEAR( `post_date` ) ORDER BY `post_date` $order $limit";
1798
-		$key = md5( $query );
1798
+		$key = md5($query);
1799 1799
 		$key = "wp_get_archives:$key:$last_changed";
1800
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1801
-			$results = $wpdb->get_results( $query );
1802
-			wp_cache_set( $key, $results, 'posts' );
1800
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1801
+			$results = $wpdb->get_results($query);
1802
+			wp_cache_set($key, $results, 'posts');
1803 1803
 		}
1804 1804
 		$arc_w_last = '';
1805
-		if ( $results ) {
1805
+		if ($results) {
1806 1806
 			$after = $r['after'];
1807
-			foreach ( (array) $results as $result ) {
1808
-				if ( $result->week != $arc_w_last ) {
1807
+			foreach ((array) $results as $result) {
1808
+				if ($result->week != $arc_w_last) {
1809 1809
 					$arc_year       = $result->yr;
1810 1810
 					$arc_w_last     = $result->week;
1811
-					$arc_week       = get_weekstartend( $result->yyyymmdd, get_option( 'start_of_week' ) );
1812
-					$arc_week_start = date_i18n( get_option( 'date_format' ), $arc_week['start'] );
1813
-					$arc_week_end   = date_i18n( get_option( 'date_format' ), $arc_week['end'] );
1814
-					$url            = add_query_arg( array( 'm' => $arc_year, 'w' => $result->week, ), home_url( '/' ) );
1815
-					if ( 'post' !== $r['post_type'] ) {
1816
-						$url = add_query_arg( 'post_type', $r['post_type'], $url );
1811
+					$arc_week       = get_weekstartend($result->yyyymmdd, get_option('start_of_week'));
1812
+					$arc_week_start = date_i18n(get_option('date_format'), $arc_week['start']);
1813
+					$arc_week_end   = date_i18n(get_option('date_format'), $arc_week['end']);
1814
+					$url            = add_query_arg(array('m' => $arc_year, 'w' => $result->week,), home_url('/'));
1815
+					if ('post' !== $r['post_type']) {
1816
+						$url = add_query_arg('post_type', $r['post_type'], $url);
1817 1817
 					}
1818
-					$text           = $arc_week_start . $archive_week_separator . $arc_week_end;
1819
-					if ( $r['show_post_count'] ) {
1820
-						$r['after'] = '&nbsp;(' . $result->posts . ')' . $after;
1818
+					$text = $arc_week_start.$archive_week_separator.$arc_week_end;
1819
+					if ($r['show_post_count']) {
1820
+						$r['after'] = '&nbsp;('.$result->posts.')'.$after;
1821 1821
 					}
1822
-					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1822
+					$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1823 1823
 				}
1824 1824
 			}
1825 1825
 		}
1826
-	} elseif ( ( 'postbypost' == $r['type'] ) || ('alpha' == $r['type'] ) ) {
1827
-		$orderby = ( 'alpha' == $r['type'] ) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
1826
+	} elseif (('postbypost' == $r['type']) || ('alpha' == $r['type'])) {
1827
+		$orderby = ('alpha' == $r['type']) ? 'post_title ASC ' : 'post_date DESC, ID DESC ';
1828 1828
 		$query = "SELECT * FROM $wpdb->posts $join $where ORDER BY $orderby $limit";
1829
-		$key = md5( $query );
1829
+		$key = md5($query);
1830 1830
 		$key = "wp_get_archives:$key:$last_changed";
1831
-		if ( ! $results = wp_cache_get( $key, 'posts' ) ) {
1832
-			$results = $wpdb->get_results( $query );
1833
-			wp_cache_set( $key, $results, 'posts' );
1831
+		if ( ! $results = wp_cache_get($key, 'posts')) {
1832
+			$results = $wpdb->get_results($query);
1833
+			wp_cache_set($key, $results, 'posts');
1834 1834
 		}
1835
-		if ( $results ) {
1836
-			foreach ( (array) $results as $result ) {
1837
-				if ( $result->post_date != '0000-00-00 00:00:00' ) {
1838
-					$url = get_permalink( $result );
1839
-					if ( $result->post_title ) {
1835
+		if ($results) {
1836
+			foreach ((array) $results as $result) {
1837
+				if ($result->post_date != '0000-00-00 00:00:00') {
1838
+					$url = get_permalink($result);
1839
+					if ($result->post_title) {
1840 1840
 						/** This filter is documented in wp-includes/post-template.php */
1841
-						$text = strip_tags( apply_filters( 'the_title', $result->post_title, $result->ID ) );
1841
+						$text = strip_tags(apply_filters('the_title', $result->post_title, $result->ID));
1842 1842
 					} else {
1843 1843
 						$text = $result->ID;
1844 1844
 					}
1845
-					$output .= get_archives_link( $url, $text, $r['format'], $r['before'], $r['after'] );
1845
+					$output .= get_archives_link($url, $text, $r['format'], $r['before'], $r['after']);
1846 1846
 				}
1847 1847
 			}
1848 1848
 		}
1849 1849
 	}
1850
-	if ( $r['echo'] ) {
1850
+	if ($r['echo']) {
1851 1851
 		echo $output;
1852 1852
 	} else {
1853 1853
 		return $output;
@@ -1864,7 +1864,7 @@  discard block
 block discarded – undo
1864 1864
  */
1865 1865
 function calendar_week_mod($num) {
1866 1866
 	$base = 7;
1867
-	return ($num - $base*floor($num/$base));
1867
+	return ($num - $base * floor($num / $base));
1868 1868
 }
1869 1869
 
1870 1870
 /**
@@ -1886,17 +1886,17 @@  discard block
 block discarded – undo
1886 1886
  * @param bool $echo    Optional, default is true. Set to false for return.
1887 1887
  * @return string|void String when retrieving.
1888 1888
  */
1889
-function get_calendar( $initial = true, $echo = true ) {
1889
+function get_calendar($initial = true, $echo = true) {
1890 1890
 	global $wpdb, $m, $monthnum, $year, $wp_locale, $posts;
1891 1891
 
1892
-	$key = md5( $m . $monthnum . $year );
1893
-	$cache = wp_cache_get( 'get_calendar', 'calendar' );
1892
+	$key = md5($m.$monthnum.$year);
1893
+	$cache = wp_cache_get('get_calendar', 'calendar');
1894 1894
 
1895
-	if ( $cache && is_array( $cache ) && isset( $cache[ $key ] ) ) {
1895
+	if ($cache && is_array($cache) && isset($cache[$key])) {
1896 1896
 		/** This filter is documented in wp-includes/general-template.php */
1897
-		$output = apply_filters( 'get_calendar', $cache[ $key ] );
1897
+		$output = apply_filters('get_calendar', $cache[$key]);
1898 1898
 
1899
-		if ( $echo ) {
1899
+		if ($echo) {
1900 1900
 			echo $output;
1901 1901
 			return;
1902 1902
 		}
@@ -1904,51 +1904,51 @@  discard block
 block discarded – undo
1904 1904
 		return $output;
1905 1905
 	}
1906 1906
 
1907
-	if ( ! is_array( $cache ) ) {
1907
+	if ( ! is_array($cache)) {
1908 1908
 		$cache = array();
1909 1909
 	}
1910 1910
 
1911 1911
 	// Quick check. If we have no posts at all, abort!
1912
-	if ( ! $posts ) {
1912
+	if ( ! $posts) {
1913 1913
 		$gotsome = $wpdb->get_var("SELECT 1 as test FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 1");
1914
-		if ( ! $gotsome ) {
1915
-			$cache[ $key ] = '';
1916
-			wp_cache_set( 'get_calendar', $cache, 'calendar' );
1914
+		if ( ! $gotsome) {
1915
+			$cache[$key] = '';
1916
+			wp_cache_set('get_calendar', $cache, 'calendar');
1917 1917
 			return;
1918 1918
 		}
1919 1919
 	}
1920 1920
 
1921
-	if ( isset( $_GET['w'] ) ) {
1921
+	if (isset($_GET['w'])) {
1922 1922
 		$w = (int) $_GET['w'];
1923 1923
 	}
1924 1924
 	// week_begins = 0 stands for Sunday
1925
-	$week_begins = (int) get_option( 'start_of_week' );
1926
-	$ts = current_time( 'timestamp' );
1925
+	$week_begins = (int) get_option('start_of_week');
1926
+	$ts = current_time('timestamp');
1927 1927
 
1928 1928
 	// Let's figure out when we are
1929
-	if ( ! empty( $monthnum ) && ! empty( $year ) ) {
1930
-		$thismonth = zeroise( intval( $monthnum ), 2 );
1929
+	if ( ! empty($monthnum) && ! empty($year)) {
1930
+		$thismonth = zeroise(intval($monthnum), 2);
1931 1931
 		$thisyear = (int) $year;
1932
-	} elseif ( ! empty( $w ) ) {
1932
+	} elseif ( ! empty($w)) {
1933 1933
 		// We need to get the month from MySQL
1934
-		$thisyear = (int) substr( $m, 0, 4 );
1934
+		$thisyear = (int) substr($m, 0, 4);
1935 1935
 		//it seems MySQL's weeks disagree with PHP's
1936
-		$d = ( ( $w - 1 ) * 7 ) + 6;
1936
+		$d = (($w - 1) * 7) + 6;
1937 1937
 		$thismonth = $wpdb->get_var("SELECT DATE_FORMAT((DATE_ADD('{$thisyear}0101', INTERVAL $d DAY) ), '%m')");
1938
-	} elseif ( ! empty( $m ) ) {
1939
-		$thisyear = (int) substr( $m, 0, 4 );
1940
-		if ( strlen( $m ) < 6 ) {
1938
+	} elseif ( ! empty($m)) {
1939
+		$thisyear = (int) substr($m, 0, 4);
1940
+		if (strlen($m) < 6) {
1941 1941
 			$thismonth = '01';
1942 1942
 		} else {
1943
-			$thismonth = zeroise( (int) substr( $m, 4, 2 ), 2 );
1943
+			$thismonth = zeroise((int) substr($m, 4, 2), 2);
1944 1944
 		}
1945 1945
 	} else {
1946
-		$thisyear = gmdate( 'Y', $ts );
1947
-		$thismonth = gmdate( 'm', $ts );
1946
+		$thisyear = gmdate('Y', $ts);
1947
+		$thismonth = gmdate('m', $ts);
1948 1948
 	}
1949 1949
 
1950
-	$unixmonth = mktime( 0, 0 , 0, $thismonth, 1, $thisyear );
1951
-	$last_day = date( 't', $unixmonth );
1950
+	$unixmonth = mktime(0, 0, 0, $thismonth, 1, $thisyear);
1951
+	$last_day = date('t', $unixmonth);
1952 1952
 
1953 1953
 	// Get the next and previous month and year with at least one post
1954 1954
 	$previous = $wpdb->get_row("SELECT MONTH(post_date) AS month, YEAR(post_date) AS year
@@ -1969,21 +1969,21 @@  discard block
 block discarded – undo
1969 1969
 	$calendar_output = '<table id="wp-calendar">
1970 1970
 	<caption>' . sprintf(
1971 1971
 		$calendar_caption,
1972
-		$wp_locale->get_month( $thismonth ),
1973
-		date( 'Y', $unixmonth )
1974
-	) . '</caption>
1972
+		$wp_locale->get_month($thismonth),
1973
+		date('Y', $unixmonth)
1974
+	).'</caption>
1975 1975
 	<thead>
1976 1976
 	<tr>';
1977 1977
 
1978 1978
 	$myweek = array();
1979 1979
 
1980
-	for ( $wdcount = 0; $wdcount <= 6; $wdcount++ ) {
1981
-		$myweek[] = $wp_locale->get_weekday( ( $wdcount + $week_begins ) % 7 );
1980
+	for ($wdcount = 0; $wdcount <= 6; $wdcount++) {
1981
+		$myweek[] = $wp_locale->get_weekday(($wdcount + $week_begins) % 7);
1982 1982
 	}
1983 1983
 
1984
-	foreach ( $myweek as $wd ) {
1985
-		$day_name = $initial ? $wp_locale->get_weekday_initial( $wd ) : $wp_locale->get_weekday_abbrev( $wd );
1986
-		$wd = esc_attr( $wd );
1984
+	foreach ($myweek as $wd) {
1985
+		$day_name = $initial ? $wp_locale->get_weekday_initial($wd) : $wp_locale->get_weekday_abbrev($wd);
1986
+		$wd = esc_attr($wd);
1987 1987
 		$calendar_output .= "\n\t\t<th scope=\"col\" title=\"$wd\">$day_name</th>";
1988 1988
 	}
1989 1989
 
@@ -1994,9 +1994,9 @@  discard block
 block discarded – undo
1994 1994
 	<tfoot>
1995 1995
 	<tr>';
1996 1996
 
1997
-	if ( $previous ) {
1998
-		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="' . get_month_link( $previous->year, $previous->month ) . '">&laquo; ' .
1999
-			$wp_locale->get_month_abbrev( $wp_locale->get_month( $previous->month ) ) .
1997
+	if ($previous) {
1998
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev"><a href="'.get_month_link($previous->year, $previous->month).'">&laquo; '.
1999
+			$wp_locale->get_month_abbrev($wp_locale->get_month($previous->month)).
2000 2000
 		'</a></td>';
2001 2001
 	} else {
2002 2002
 		$calendar_output .= "\n\t\t".'<td colspan="3" id="prev" class="pad">&nbsp;</td>';
@@ -2004,9 +2004,9 @@  discard block
 block discarded – undo
2004 2004
 
2005 2005
 	$calendar_output .= "\n\t\t".'<td class="pad">&nbsp;</td>';
2006 2006
 
2007
-	if ( $next ) {
2008
-		$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="' . get_month_link( $next->year, $next->month ) . '">' .
2009
-			$wp_locale->get_month_abbrev( $wp_locale->get_month( $next->month ) ) .
2007
+	if ($next) {
2008
+		$calendar_output .= "\n\t\t".'<td colspan="3" id="next"><a href="'.get_month_link($next->year, $next->month).'">'.
2009
+			$wp_locale->get_month_abbrev($wp_locale->get_month($next->month)).
2010 2010
 		' &raquo;</a></td>';
2011 2011
 	} else {
2012 2012
 		$calendar_output .= "\n\t\t".'<td colspan="3" id="next" class="pad">&nbsp;</td>';
@@ -2026,44 +2026,44 @@  discard block
 block discarded – undo
2026 2026
 		FROM $wpdb->posts WHERE post_date >= '{$thisyear}-{$thismonth}-01 00:00:00'
2027 2027
 		AND post_type = 'post' AND post_status = 'publish'
2028 2028
 		AND post_date <= '{$thisyear}-{$thismonth}-{$last_day} 23:59:59'", ARRAY_N);
2029
-	if ( $dayswithposts ) {
2030
-		foreach ( (array) $dayswithposts as $daywith ) {
2029
+	if ($dayswithposts) {
2030
+		foreach ((array) $dayswithposts as $daywith) {
2031 2031
 			$daywithpost[] = $daywith[0];
2032 2032
 		}
2033 2033
 	}
2034 2034
 
2035 2035
 	// See how much we should pad in the beginning
2036
-	$pad = calendar_week_mod( date( 'w', $unixmonth ) - $week_begins );
2037
-	if ( 0 != $pad ) {
2038
-		$calendar_output .= "\n\t\t".'<td colspan="'. esc_attr( $pad ) .'" class="pad">&nbsp;</td>';
2036
+	$pad = calendar_week_mod(date('w', $unixmonth) - $week_begins);
2037
+	if (0 != $pad) {
2038
+		$calendar_output .= "\n\t\t".'<td colspan="'.esc_attr($pad).'" class="pad">&nbsp;</td>';
2039 2039
 	}
2040 2040
 
2041 2041
 	$newrow = false;
2042
-	$daysinmonth = (int) date( 't', $unixmonth );
2042
+	$daysinmonth = (int) date('t', $unixmonth);
2043 2043
 
2044
-	for ( $day = 1; $day <= $daysinmonth; ++$day ) {
2045
-		if ( isset($newrow) && $newrow ) {
2044
+	for ($day = 1; $day <= $daysinmonth; ++$day) {
2045
+		if (isset($newrow) && $newrow) {
2046 2046
 			$calendar_output .= "\n\t</tr>\n\t<tr>\n\t\t";
2047 2047
 		}
2048 2048
 		$newrow = false;
2049 2049
 
2050
-		if ( $day == gmdate( 'j', $ts ) &&
2051
-			$thismonth == gmdate( 'm', $ts ) &&
2052
-			$thisyear == gmdate( 'Y', $ts ) ) {
2050
+		if ($day == gmdate('j', $ts) &&
2051
+			$thismonth == gmdate('m', $ts) &&
2052
+			$thisyear == gmdate('Y', $ts)) {
2053 2053
 			$calendar_output .= '<td id="today">';
2054 2054
 		} else {
2055 2055
 			$calendar_output .= '<td>';
2056 2056
 		}
2057 2057
 
2058
-		if ( in_array( $day, $daywithpost ) ) {
2058
+		if (in_array($day, $daywithpost)) {
2059 2059
 			// any posts today?
2060
-			$date_format = date( _x( 'F j, Y', 'daily archives date format' ), strtotime( "{$thisyear}-{$thismonth}-{$day}" ) );
2060
+			$date_format = date(_x('F j, Y', 'daily archives date format'), strtotime("{$thisyear}-{$thismonth}-{$day}"));
2061 2061
 			/* translators: Post calendar label. 1: Date */
2062
-			$label = sprintf( __( 'Posts published on %s' ), $date_format );
2062
+			$label = sprintf(__('Posts published on %s'), $date_format);
2063 2063
 			$calendar_output .= sprintf(
2064 2064
 				'<a href="%s" aria-label="%s">%s</a>',
2065
-				get_day_link( $thisyear, $thismonth, $day ),
2066
-				esc_attr( $label ),
2065
+				get_day_link($thisyear, $thismonth, $day),
2066
+				esc_attr($label),
2067 2067
 				$day
2068 2068
 			);
2069 2069
 		} else {
@@ -2071,21 +2071,21 @@  discard block
 block discarded – undo
2071 2071
 		}
2072 2072
 		$calendar_output .= '</td>';
2073 2073
 
2074
-		if ( 6 == calendar_week_mod( date( 'w', mktime(0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins ) ) {
2074
+		if (6 == calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins)) {
2075 2075
 			$newrow = true;
2076 2076
 		}
2077 2077
 	}
2078 2078
 
2079
-	$pad = 7 - calendar_week_mod( date( 'w', mktime( 0, 0 , 0, $thismonth, $day, $thisyear ) ) - $week_begins );
2080
-	if ( $pad != 0 && $pad != 7 ) {
2081
-		$calendar_output .= "\n\t\t".'<td class="pad" colspan="'. esc_attr( $pad ) .'">&nbsp;</td>';
2079
+	$pad = 7 - calendar_week_mod(date('w', mktime(0, 0, 0, $thismonth, $day, $thisyear)) - $week_begins);
2080
+	if ($pad != 0 && $pad != 7) {
2081
+		$calendar_output .= "\n\t\t".'<td class="pad" colspan="'.esc_attr($pad).'">&nbsp;</td>';
2082 2082
 	}
2083 2083
 	$calendar_output .= "\n\t</tr>\n\t</tbody>\n\t</table>";
2084 2084
 
2085
-	$cache[ $key ] = $calendar_output;
2086
-	wp_cache_set( 'get_calendar', $cache, 'calendar' );
2085
+	$cache[$key] = $calendar_output;
2086
+	wp_cache_set('get_calendar', $cache, 'calendar');
2087 2087
 
2088
-	if ( $echo ) {
2088
+	if ($echo) {
2089 2089
 		/**
2090 2090
 		 * Filters the HTML calendar output.
2091 2091
 		 *
@@ -2093,11 +2093,11 @@  discard block
 block discarded – undo
2093 2093
 		 *
2094 2094
 		 * @param string $calendar_output HTML output of the calendar.
2095 2095
 		 */
2096
-		echo apply_filters( 'get_calendar', $calendar_output );
2096
+		echo apply_filters('get_calendar', $calendar_output);
2097 2097
 		return;
2098 2098
 	}
2099 2099
 	/** This filter is documented in wp-includes/general-template.php */
2100
-	return apply_filters( 'get_calendar', $calendar_output );
2100
+	return apply_filters('get_calendar', $calendar_output);
2101 2101
 }
2102 2102
 
2103 2103
 /**
@@ -2107,7 +2107,7 @@  discard block
 block discarded – undo
2107 2107
  * @since 2.1.0
2108 2108
  */
2109 2109
 function delete_get_calendar_cache() {
2110
-	wp_cache_delete( 'get_calendar', 'calendar' );
2110
+	wp_cache_delete('get_calendar', 'calendar');
2111 2111
 }
2112 2112
 
2113 2113
 /**
@@ -2125,16 +2125,16 @@  discard block
 block discarded – undo
2125 2125
 function allowed_tags() {
2126 2126
 	global $allowedtags;
2127 2127
 	$allowed = '';
2128
-	foreach ( (array) $allowedtags as $tag => $attributes ) {
2128
+	foreach ((array) $allowedtags as $tag => $attributes) {
2129 2129
 		$allowed .= '<'.$tag;
2130
-		if ( 0 < count($attributes) ) {
2131
-			foreach ( $attributes as $attribute => $limits ) {
2130
+		if (0 < count($attributes)) {
2131
+			foreach ($attributes as $attribute => $limits) {
2132 2132
 				$allowed .= ' '.$attribute.'=""';
2133 2133
 			}
2134 2134
 		}
2135 2135
 		$allowed .= '> ';
2136 2136
 	}
2137
-	return htmlentities( $allowed );
2137
+	return htmlentities($allowed);
2138 2138
 }
2139 2139
 
2140 2140
 /***** Date/Time tags *****/
@@ -2145,7 +2145,7 @@  discard block
 block discarded – undo
2145 2145
  * @since 1.0.0
2146 2146
  */
2147 2147
 function the_date_xml() {
2148
-	echo mysql2date( 'Y-m-d', get_post()->post_date, false );
2148
+	echo mysql2date('Y-m-d', get_post()->post_date, false);
2149 2149
 }
2150 2150
 
2151 2151
 /**
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
  * @param bool   $echo   Optional, default is display. Whether to echo the date or return it.
2172 2172
  * @return string|void String if retrieving.
2173 2173
  */
2174
-function the_date( $d = '', $before = '', $after = '', $echo = true ) {
2174
+function the_date($d = '', $before = '', $after = '', $echo = true) {
2175 2175
 	global $currentday, $previousday;
2176 2176
 
2177
-	if ( is_new_day() ) {
2178
-		$the_date = $before . get_the_date( $d ) . $after;
2177
+	if (is_new_day()) {
2178
+		$the_date = $before.get_the_date($d).$after;
2179 2179
 		$previousday = $currentday;
2180 2180
 
2181 2181
 		/**
@@ -2189,9 +2189,9 @@  discard block
 block discarded – undo
2189 2189
 		 * @param string $before   HTML output before the date.
2190 2190
 		 * @param string $after    HTML output after the date.
2191 2191
 		 */
2192
-		$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
2192
+		$the_date = apply_filters('the_date', $the_date, $d, $before, $after);
2193 2193
 
2194
-		if ( $echo )
2194
+		if ($echo)
2195 2195
 			echo $the_date;
2196 2196
 		else
2197 2197
 			return $the_date;
@@ -2210,17 +2210,17 @@  discard block
 block discarded – undo
2210 2210
  * @param  int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
2211 2211
  * @return false|string Date the current post was written. False on failure.
2212 2212
  */
2213
-function get_the_date( $d = '', $post = null ) {
2214
-	$post = get_post( $post );
2213
+function get_the_date($d = '', $post = null) {
2214
+	$post = get_post($post);
2215 2215
 
2216
-	if ( ! $post ) {
2216
+	if ( ! $post) {
2217 2217
 		return false;
2218 2218
 	}
2219 2219
 
2220
-	if ( '' == $d ) {
2221
-		$the_date = mysql2date( get_option( 'date_format' ), $post->post_date );
2220
+	if ('' == $d) {
2221
+		$the_date = mysql2date(get_option('date_format'), $post->post_date);
2222 2222
 	} else {
2223
-		$the_date = mysql2date( $d, $post->post_date );
2223
+		$the_date = mysql2date($d, $post->post_date);
2224 2224
 	}
2225 2225
 
2226 2226
 	/**
@@ -2233,7 +2233,7 @@  discard block
 block discarded – undo
2233 2233
 	 *                              if not specified.
2234 2234
 	 * @param int|WP_Post $post     The post object or ID.
2235 2235
 	 */
2236
-	return apply_filters( 'get_the_date', $the_date, $d, $post );
2236
+	return apply_filters('get_the_date', $the_date, $d, $post);
2237 2237
 }
2238 2238
 
2239 2239
 /**
@@ -2247,8 +2247,8 @@  discard block
 block discarded – undo
2247 2247
  * @param bool   $echo   Optional, default is display. Whether to echo the date or return it.
2248 2248
  * @return string|void String if retrieving.
2249 2249
  */
2250
-function the_modified_date( $d = '', $before = '', $after = '', $echo = true ) {
2251
-	$the_modified_date = $before . get_the_modified_date($d) . $after;
2250
+function the_modified_date($d = '', $before = '', $after = '', $echo = true) {
2251
+	$the_modified_date = $before.get_the_modified_date($d).$after;
2252 2252
 
2253 2253
 	/**
2254 2254
 	 * Filters the date a post was last modified for display.
@@ -2261,9 +2261,9 @@  discard block
 block discarded – undo
2261 2261
 	 * @param string $before            HTML output before the date.
2262 2262
 	 * @param string $after             HTML output after the date.
2263 2263
 	 */
2264
-	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );
2264
+	$the_modified_date = apply_filters('the_modified_date', $the_modified_date, $d, $before, $after);
2265 2265
 
2266
-	if ( $echo )
2266
+	if ($echo)
2267 2267
 		echo $the_modified_date;
2268 2268
 	else
2269 2269
 		return $the_modified_date;
@@ -2280,16 +2280,16 @@  discard block
 block discarded – undo
2280 2280
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default current post.
2281 2281
  * @return false|string Date the current post was modified. False on failure.
2282 2282
  */
2283
-function get_the_modified_date( $d = '', $post = null ) {
2284
-	$post = get_post( $post );
2283
+function get_the_modified_date($d = '', $post = null) {
2284
+	$post = get_post($post);
2285 2285
 
2286
-	if ( ! $post ) {
2286
+	if ( ! $post) {
2287 2287
 		// For backward compatibility, failures go through the filter below.
2288 2288
 		$the_time = false;
2289
-	} elseif ( empty( $d ) ) {
2290
-		$the_time = get_post_modified_time( get_option( 'date_format' ), false, $post, true );
2289
+	} elseif (empty($d)) {
2290
+		$the_time = get_post_modified_time(get_option('date_format'), false, $post, true);
2291 2291
 	} else {
2292
-		$the_time = get_post_modified_time( $d, false, $post, true );
2292
+		$the_time = get_post_modified_time($d, false, $post, true);
2293 2293
 	}
2294 2294
 
2295 2295
 	/**
@@ -2303,7 +2303,7 @@  discard block
 block discarded – undo
2303 2303
 	 *                          'date_format' option.
2304 2304
 	 * @param WP_Post $post     WP_Post object.
2305 2305
 	 */
2306
-	return apply_filters( 'get_the_modified_date', $the_time, $d, $post );
2306
+	return apply_filters('get_the_modified_date', $the_time, $d, $post);
2307 2307
 }
2308 2308
 
2309 2309
 /**
@@ -2313,7 +2313,7 @@  discard block
 block discarded – undo
2313 2313
  *
2314 2314
  * @param string $d Either 'G', 'U', or php date format.
2315 2315
  */
2316
-function the_time( $d = '' ) {
2316
+function the_time($d = '') {
2317 2317
 	/**
2318 2318
 	 * Filters the time a post was written for display.
2319 2319
 	 *
@@ -2323,7 +2323,7 @@  discard block
 block discarded – undo
2323 2323
 	 * @param string $d            The time format. Accepts 'G', 'U',
2324 2324
 	 *                             or php date format.
2325 2325
 	 */
2326
-	echo apply_filters( 'the_time', get_the_time( $d ), $d );
2326
+	echo apply_filters('the_time', get_the_time($d), $d);
2327 2327
 }
2328 2328
 
2329 2329
 /**
@@ -2337,14 +2337,14 @@  discard block
 block discarded – undo
2337 2337
  * @param int|WP_Post $post WP_Post object or ID. Default is global $post object.
2338 2338
  * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure.
2339 2339
  */
2340
-function get_the_time( $d = '', $post = null ) {
2340
+function get_the_time($d = '', $post = null) {
2341 2341
 	$post = get_post($post);
2342 2342
 
2343
-	if ( ! $post ) {
2343
+	if ( ! $post) {
2344 2344
 		return false;
2345 2345
 	}
2346 2346
 
2347
-	if ( '' == $d )
2347
+	if ('' == $d)
2348 2348
 		$the_time = get_post_time(get_option('time_format'), false, $post, true);
2349 2349
 	else
2350 2350
 		$the_time = get_post_time($d, false, $post, true);
@@ -2360,7 +2360,7 @@  discard block
 block discarded – undo
2360 2360
 	 *                              in 'time_format' option. Default empty.
2361 2361
 	 * @param int|WP_Post $post     WP_Post object or ID.
2362 2362
 	 */
2363
-	return apply_filters( 'get_the_time', $the_time, $d, $post );
2363
+	return apply_filters('get_the_time', $the_time, $d, $post);
2364 2364
 }
2365 2365
 
2366 2366
 /**
@@ -2375,14 +2375,14 @@  discard block
 block discarded – undo
2375 2375
  * @param bool        $translate Whether to translate the time string. Default false.
2376 2376
  * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure.
2377 2377
  */
2378
-function get_post_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
2378
+function get_post_time($d = 'U', $gmt = false, $post = null, $translate = false) {
2379 2379
 	$post = get_post($post);
2380 2380
 
2381
-	if ( ! $post ) {
2381
+	if ( ! $post) {
2382 2382
 		return false;
2383 2383
 	}
2384 2384
 
2385
-	if ( $gmt )
2385
+	if ($gmt)
2386 2386
 		$time = $post->post_date_gmt;
2387 2387
 	else
2388 2388
 		$time = $post->post_date;
@@ -2399,7 +2399,7 @@  discard block
 block discarded – undo
2399 2399
 	 *                     Accepts 'G', 'U', or php date format. Default 'U'.
2400 2400
 	 * @param bool   $gmt  Whether to retrieve the GMT time. Default false.
2401 2401
 	 */
2402
-	return apply_filters( 'get_post_time', $time, $d, $gmt );
2402
+	return apply_filters('get_post_time', $time, $d, $gmt);
2403 2403
 }
2404 2404
 
2405 2405
 /**
@@ -2420,7 +2420,7 @@  discard block
 block discarded – undo
2420 2420
 	 *                                      or php date format. Defaults to value
2421 2421
 	 *                                      specified in 'time_format' option.
2422 2422
 	 */
2423
-	echo apply_filters( 'the_modified_time', get_the_modified_time($d), $d );
2423
+	echo apply_filters('the_modified_time', get_the_modified_time($d), $d);
2424 2424
 }
2425 2425
 
2426 2426
 /**
@@ -2435,16 +2435,16 @@  discard block
 block discarded – undo
2435 2435
  * @param int|WP_Post $post  Optional. Post ID or WP_Post object. Default current post.
2436 2436
  * @return false|string Formatted date string or Unix timestamp. False on failure.
2437 2437
  */
2438
-function get_the_modified_time( $d = '', $post = null ) {
2439
-	$post = get_post( $post );
2438
+function get_the_modified_time($d = '', $post = null) {
2439
+	$post = get_post($post);
2440 2440
 
2441
-	if ( ! $post ) {
2441
+	if ( ! $post) {
2442 2442
 		// For backward compatibility, failures go through the filter below.
2443 2443
 		$the_time = false;
2444
-	} elseif ( empty( $d ) ) {
2445
-		$the_time = get_post_modified_time( get_option( 'time_format' ), false, $post, true );
2444
+	} elseif (empty($d)) {
2445
+		$the_time = get_post_modified_time(get_option('time_format'), false, $post, true);
2446 2446
 	} else {
2447
-		$the_time = get_post_modified_time( $d, false, $post, true );
2447
+		$the_time = get_post_modified_time($d, false, $post, true);
2448 2448
 	}
2449 2449
 
2450 2450
 	/**
@@ -2459,7 +2459,7 @@  discard block
 block discarded – undo
2459 2459
 	 *                         to value specified in 'time_format' option.
2460 2460
 	 * @param WP_Post $post    WP_Post object.
2461 2461
 	 */
2462
-	return apply_filters( 'get_the_modified_time', $the_time, $d, $post );
2462
+	return apply_filters('get_the_modified_time', $the_time, $d, $post);
2463 2463
 }
2464 2464
 
2465 2465
 /**
@@ -2474,14 +2474,14 @@  discard block
 block discarded – undo
2474 2474
  * @param bool        $translate Whether to translate the time string. Default false.
2475 2475
  * @return string|int|false Formatted date string or Unix timestamp if `$id` is 'U' or 'G'. False on failure.
2476 2476
  */
2477
-function get_post_modified_time( $d = 'U', $gmt = false, $post = null, $translate = false ) {
2477
+function get_post_modified_time($d = 'U', $gmt = false, $post = null, $translate = false) {
2478 2478
 	$post = get_post($post);
2479 2479
 
2480
-	if ( ! $post ) {
2480
+	if ( ! $post) {
2481 2481
 		return false;
2482 2482
 	}
2483 2483
 
2484
-	if ( $gmt )
2484
+	if ($gmt)
2485 2485
 		$time = $post->post_modified_gmt;
2486 2486
 	else
2487 2487
 		$time = $post->post_modified;
@@ -2496,7 +2496,7 @@  discard block
 block discarded – undo
2496 2496
 	 * @param string $d    The date format. Accepts 'G', 'U', or php date format. Default 'U'.
2497 2497
 	 * @param bool   $gmt  Whether to return the GMT time. Default false.
2498 2498
 	 */
2499
-	return apply_filters( 'get_post_modified_time', $time, $d, $gmt );
2499
+	return apply_filters('get_post_modified_time', $time, $d, $gmt);
2500 2500
 }
2501 2501
 
2502 2502
 /**
@@ -2508,7 +2508,7 @@  discard block
 block discarded – undo
2508 2508
  */
2509 2509
 function the_weekday() {
2510 2510
 	global $wp_locale;
2511
-	$the_weekday = $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
2511
+	$the_weekday = $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false));
2512 2512
 
2513 2513
 	/**
2514 2514
 	 * Filters the weekday on which the post was written, for display.
@@ -2517,7 +2517,7 @@  discard block
 block discarded – undo
2517 2517
 	 *
2518 2518
 	 * @param string $the_weekday
2519 2519
 	 */
2520
-	echo apply_filters( 'the_weekday', $the_weekday );
2520
+	echo apply_filters('the_weekday', $the_weekday);
2521 2521
 }
2522 2522
 
2523 2523
 /**
@@ -2535,12 +2535,12 @@  discard block
 block discarded – undo
2535 2535
  * @param string $before Optional Output before the date.
2536 2536
  * @param string $after Optional Output after the date.
2537 2537
  */
2538
-function the_weekday_date($before='',$after='') {
2538
+function the_weekday_date($before = '', $after = '') {
2539 2539
 	global $wp_locale, $currentday, $previousweekday;
2540 2540
 	$the_weekday_date = '';
2541
-	if ( $currentday != $previousweekday ) {
2541
+	if ($currentday != $previousweekday) {
2542 2542
 		$the_weekday_date .= $before;
2543
-		$the_weekday_date .= $wp_locale->get_weekday( mysql2date( 'w', get_post()->post_date, false ) );
2543
+		$the_weekday_date .= $wp_locale->get_weekday(mysql2date('w', get_post()->post_date, false));
2544 2544
 		$the_weekday_date .= $after;
2545 2545
 		$previousweekday = $currentday;
2546 2546
 	}
@@ -2554,7 +2554,7 @@  discard block
 block discarded – undo
2554 2554
 	 * @param string $before           The HTML to output before the date.
2555 2555
 	 * @param string $after            The HTML to output after the date.
2556 2556
 	 */
2557
-	$the_weekday_date = apply_filters( 'the_weekday_date', $the_weekday_date, $before, $after );
2557
+	$the_weekday_date = apply_filters('the_weekday_date', $the_weekday_date, $before, $after);
2558 2558
 	echo $the_weekday_date;
2559 2559
 }
2560 2560
 
@@ -2571,7 +2571,7 @@  discard block
 block discarded – undo
2571 2571
 	 *
2572 2572
 	 * @since 1.5.0
2573 2573
 	 */
2574
-	do_action( 'wp_head' );
2574
+	do_action('wp_head');
2575 2575
 }
2576 2576
 
2577 2577
 /**
@@ -2587,7 +2587,7 @@  discard block
 block discarded – undo
2587 2587
 	 *
2588 2588
 	 * @since 1.5.1
2589 2589
 	 */
2590
-	do_action( 'wp_footer' );
2590
+	do_action('wp_footer');
2591 2591
 }
2592 2592
 
2593 2593
 /**
@@ -2597,8 +2597,8 @@  discard block
 block discarded – undo
2597 2597
  *
2598 2598
  * @param array $args Optional arguments.
2599 2599
  */
2600
-function feed_links( $args = array() ) {
2601
-	if ( !current_theme_supports('automatic-feed-links') )
2600
+function feed_links($args = array()) {
2601
+	if ( ! current_theme_supports('automatic-feed-links'))
2602 2602
 		return;
2603 2603
 
2604 2604
 	$defaults = array(
@@ -2610,7 +2610,7 @@  discard block
 block discarded – undo
2610 2610
 		'comstitle'	=> __('%1$s %2$s Comments Feed'),
2611 2611
 	);
2612 2612
 
2613
-	$args = wp_parse_args( $args, $defaults );
2613
+	$args = wp_parse_args($args, $defaults);
2614 2614
 
2615 2615
 	/**
2616 2616
 	 * Filters whether to display the posts feed link.
@@ -2619,8 +2619,8 @@  discard block
 block discarded – undo
2619 2619
 	 *
2620 2620
 	 * @param bool $show Whether to display the posts feed link. Default true.
2621 2621
 	 */
2622
-	if ( apply_filters( 'feed_links_show_posts_feed', true ) ) {
2623
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['feedtitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link() ) . "\" />\n";
2622
+	if (apply_filters('feed_links_show_posts_feed', true)) {
2623
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['feedtitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link())."\" />\n";
2624 2624
 	}
2625 2625
 
2626 2626
 	/**
@@ -2630,8 +2630,8 @@  discard block
 block discarded – undo
2630 2630
 	 *
2631 2631
 	 * @param bool $show Whether to display the comments feed link. Default true.
2632 2632
 	 */
2633
-	if ( apply_filters( 'feed_links_show_comments_feed', true ) ) {
2634
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( sprintf( $args['comstitle'], get_bloginfo( 'name' ), $args['separator'] ) ) . '" href="' . esc_url( get_feed_link( 'comments_' . get_default_feed() ) ) . "\" />\n";
2633
+	if (apply_filters('feed_links_show_comments_feed', true)) {
2634
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr(sprintf($args['comstitle'], get_bloginfo('name'), $args['separator'])).'" href="'.esc_url(get_feed_link('comments_'.get_default_feed()))."\" />\n";
2635 2635
 	}
2636 2636
 }
2637 2637
 
@@ -2642,7 +2642,7 @@  discard block
 block discarded – undo
2642 2642
  *
2643 2643
  * @param array $args Optional arguments.
2644 2644
  */
2645
-function feed_links_extra( $args = array() ) {
2645
+function feed_links_extra($args = array()) {
2646 2646
 	$defaults = array(
2647 2647
 		/* translators: Separator between blog name and feed type in feed links */
2648 2648
 		'separator'   => _x('&raquo;', 'feed link'),
@@ -2662,60 +2662,60 @@  discard block
 block discarded – undo
2662 2662
 		'posttypetitle' => __('%1$s %2$s %3$s Feed'),
2663 2663
 	);
2664 2664
 
2665
-	$args = wp_parse_args( $args, $defaults );
2665
+	$args = wp_parse_args($args, $defaults);
2666 2666
 
2667
-	if ( is_singular() ) {
2667
+	if (is_singular()) {
2668 2668
 		$id = 0;
2669
-		$post = get_post( $id );
2669
+		$post = get_post($id);
2670 2670
 
2671
-		if ( comments_open() || pings_open() || $post->comment_count > 0 ) {
2672
-			$title = sprintf( $args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute( array( 'echo' => false ) ) );
2673
-			$href = get_post_comments_feed_link( $post->ID );
2671
+		if (comments_open() || pings_open() || $post->comment_count > 0) {
2672
+			$title = sprintf($args['singletitle'], get_bloginfo('name'), $args['separator'], the_title_attribute(array('echo' => false)));
2673
+			$href = get_post_comments_feed_link($post->ID);
2674 2674
 		}
2675
-	} elseif ( is_post_type_archive() ) {
2676
-		$post_type = get_query_var( 'post_type' );
2677
-		if ( is_array( $post_type ) )
2678
-			$post_type = reset( $post_type );
2679
-
2680
-		$post_type_obj = get_post_type_object( $post_type );
2681
-		$title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );
2682
-		$href = get_post_type_archive_feed_link( $post_type_obj->name );
2683
-	} elseif ( is_category() ) {
2675
+	} elseif (is_post_type_archive()) {
2676
+		$post_type = get_query_var('post_type');
2677
+		if (is_array($post_type))
2678
+			$post_type = reset($post_type);
2679
+
2680
+		$post_type_obj = get_post_type_object($post_type);
2681
+		$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], $post_type_obj->labels->name);
2682
+		$href = get_post_type_archive_feed_link($post_type_obj->name);
2683
+	} elseif (is_category()) {
2684 2684
 		$term = get_queried_object();
2685 2685
 
2686
-		if ( $term ) {
2687
-			$title = sprintf( $args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name );
2688
-			$href = get_category_feed_link( $term->term_id );
2686
+		if ($term) {
2687
+			$title = sprintf($args['cattitle'], get_bloginfo('name'), $args['separator'], $term->name);
2688
+			$href = get_category_feed_link($term->term_id);
2689 2689
 		}
2690
-	} elseif ( is_tag() ) {
2690
+	} elseif (is_tag()) {
2691 2691
 		$term = get_queried_object();
2692 2692
 
2693
-		if ( $term ) {
2694
-			$title = sprintf( $args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name );
2695
-			$href = get_tag_feed_link( $term->term_id );
2693
+		if ($term) {
2694
+			$title = sprintf($args['tagtitle'], get_bloginfo('name'), $args['separator'], $term->name);
2695
+			$href = get_tag_feed_link($term->term_id);
2696 2696
 		}
2697
-	} elseif ( is_tax() ) {
2697
+	} elseif (is_tax()) {
2698 2698
  		$term = get_queried_object();
2699
- 		$tax = get_taxonomy( $term->taxonomy );
2700
- 		$title = sprintf( $args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name );
2701
- 		$href = get_term_feed_link( $term->term_id, $term->taxonomy );
2702
-	} elseif ( is_author() ) {
2703
-		$author_id = intval( get_query_var('author') );
2704
-
2705
-		$title = sprintf( $args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta( 'display_name', $author_id ) );
2706
-		$href = get_author_feed_link( $author_id );
2707
-	} elseif ( is_search() ) {
2708
-		$title = sprintf( $args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query( false ) );
2699
+ 		$tax = get_taxonomy($term->taxonomy);
2700
+ 		$title = sprintf($args['taxtitle'], get_bloginfo('name'), $args['separator'], $term->name, $tax->labels->singular_name);
2701
+ 		$href = get_term_feed_link($term->term_id, $term->taxonomy);
2702
+	} elseif (is_author()) {
2703
+		$author_id = intval(get_query_var('author'));
2704
+
2705
+		$title = sprintf($args['authortitle'], get_bloginfo('name'), $args['separator'], get_the_author_meta('display_name', $author_id));
2706
+		$href = get_author_feed_link($author_id);
2707
+	} elseif (is_search()) {
2708
+		$title = sprintf($args['searchtitle'], get_bloginfo('name'), $args['separator'], get_search_query(false));
2709 2709
 		$href = get_search_feed_link();
2710
-	} elseif ( is_post_type_archive() ) {
2711
-		$title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );
2710
+	} elseif (is_post_type_archive()) {
2711
+		$title = sprintf($args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title('', false));
2712 2712
 		$post_type_obj = get_queried_object();
2713
-		if ( $post_type_obj )
2714
-			$href = get_post_type_archive_feed_link( $post_type_obj->name );
2713
+		if ($post_type_obj)
2714
+			$href = get_post_type_archive_feed_link($post_type_obj->name);
2715 2715
 	}
2716 2716
 
2717
-	if ( isset($title) && isset($href) )
2718
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2717
+	if (isset($title) && isset($href))
2718
+		echo '<link rel="alternate" type="'.feed_content_type().'" title="'.esc_attr($title).'" href="'.esc_url($href).'" />'."\n";
2719 2719
 }
2720 2720
 
2721 2721
 /**
@@ -2725,7 +2725,7 @@  discard block
 block discarded – undo
2725 2725
  * @since 2.0.0
2726 2726
  */
2727 2727
 function rsd_link() {
2728
-	echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="' . esc_url( site_url( 'xmlrpc.php?rsd', 'rpc' ) ) . '" />' . "\n";
2728
+	echo '<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.esc_url(site_url('xmlrpc.php?rsd', 'rpc')).'" />'."\n";
2729 2729
 }
2730 2730
 
2731 2731
 /**
@@ -2736,7 +2736,7 @@  discard block
 block discarded – undo
2736 2736
  */
2737 2737
 function wlwmanifest_link() {
2738 2738
 	echo '<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="',
2739
-		includes_url( 'wlwmanifest.xml' ), '" /> ', "\n";
2739
+		includes_url('wlwmanifest.xml'), '" /> ', "\n";
2740 2740
 }
2741 2741
 
2742 2742
 /**
@@ -2756,7 +2756,7 @@  discard block
 block discarded – undo
2756 2756
  */
2757 2757
 function noindex() {
2758 2758
 	// If the blog is not public, tell robots to go away.
2759
-	if ( '0' == get_option('blog_public') )
2759
+	if ('0' == get_option('blog_public'))
2760 2760
 		wp_no_robots();
2761 2761
 }
2762 2762
 
@@ -2780,29 +2780,29 @@  discard block
 block discarded – undo
2780 2780
  * @link https://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#rel-icon HTML5 specification link icon.
2781 2781
  */
2782 2782
 function wp_site_icon() {
2783
-	if ( ! has_site_icon() && ! is_customize_preview() ) {
2783
+	if ( ! has_site_icon() && ! is_customize_preview()) {
2784 2784
 		return;
2785 2785
 	}
2786 2786
 
2787 2787
 	$meta_tags = array();
2788
-	$icon_32 = get_site_icon_url( 32 );
2789
-	if ( empty( $icon_32 ) && is_customize_preview() ) {
2788
+	$icon_32 = get_site_icon_url(32);
2789
+	if (empty($icon_32) && is_customize_preview()) {
2790 2790
 		$icon_32 = '/favicon.ico'; // Serve default favicon URL in customizer so element can be updated for preview.
2791 2791
 	}
2792
-	if ( $icon_32 ) {
2793
-		$meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="32x32" />', esc_url( $icon_32 ) );
2792
+	if ($icon_32) {
2793
+		$meta_tags[] = sprintf('<link rel="icon" href="%s" sizes="32x32" />', esc_url($icon_32));
2794 2794
 	}
2795
-	$icon_192 = get_site_icon_url( 192 );
2796
-	if ( $icon_192 ) {
2797
-		$meta_tags[] = sprintf( '<link rel="icon" href="%s" sizes="192x192" />', esc_url( $icon_192 ) );
2795
+	$icon_192 = get_site_icon_url(192);
2796
+	if ($icon_192) {
2797
+		$meta_tags[] = sprintf('<link rel="icon" href="%s" sizes="192x192" />', esc_url($icon_192));
2798 2798
 	}
2799
-	$icon_180 = get_site_icon_url( 180 );
2800
-	if ( $icon_180 ) {
2801
-		$meta_tags[] = sprintf( '<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url( $icon_180 ) );
2799
+	$icon_180 = get_site_icon_url(180);
2800
+	if ($icon_180) {
2801
+		$meta_tags[] = sprintf('<link rel="apple-touch-icon-precomposed" href="%s" />', esc_url($icon_180));
2802 2802
 	}
2803
-	$icon_270 = get_site_icon_url( 270 );
2804
-	if ( $icon_270 ) {
2805
-		$meta_tags[] = sprintf( '<meta name="msapplication-TileImage" content="%s" />', esc_url( $icon_270 ) );
2803
+	$icon_270 = get_site_icon_url(270);
2804
+	if ($icon_270) {
2805
+		$meta_tags[] = sprintf('<meta name="msapplication-TileImage" content="%s" />', esc_url($icon_270));
2806 2806
 	}
2807 2807
 
2808 2808
 	/**
@@ -2812,10 +2812,10 @@  discard block
 block discarded – undo
2812 2812
 	 *
2813 2813
 	 * @param array $meta_tags Site Icon meta elements.
2814 2814
 	 */
2815
-	$meta_tags = apply_filters( 'site_icon_meta_tags', $meta_tags );
2816
-	$meta_tags = array_filter( $meta_tags );
2815
+	$meta_tags = apply_filters('site_icon_meta_tags', $meta_tags);
2816
+	$meta_tags = array_filter($meta_tags);
2817 2817
 
2818
-	foreach ( $meta_tags as $meta_tag ) {
2818
+	foreach ($meta_tags as $meta_tag) {
2819 2819
 		echo "$meta_tag\n";
2820 2820
 	}
2821 2821
 }
@@ -2845,9 +2845,9 @@  discard block
 block discarded – undo
2845 2845
 	 * The path is removed in the foreach loop below.
2846 2846
 	 */
2847 2847
 	/** This filter is documented in wp-includes/formatting.php */
2848
-	$hints['dns-prefetch'][] = apply_filters( 'emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/' );
2848
+	$hints['dns-prefetch'][] = apply_filters('emoji_svg_url', 'https://s.w.org/images/core/emoji/2.2.1/svg/');
2849 2849
 
2850
-	foreach ( $hints as $relation_type => $urls ) {
2850
+	foreach ($hints as $relation_type => $urls) {
2851 2851
 		$unique_urls = array();
2852 2852
 
2853 2853
 		/**
@@ -2858,13 +2858,13 @@  discard block
 block discarded – undo
2858 2858
 		 * @param array  $urls          URLs to print for resource hints.
2859 2859
 		 * @param string $relation_type The relation type the URLs are printed for, e.g. 'preconnect' or 'prerender'.
2860 2860
 		 */
2861
-		$urls = apply_filters( 'wp_resource_hints', $urls, $relation_type );
2861
+		$urls = apply_filters('wp_resource_hints', $urls, $relation_type);
2862 2862
 
2863
-		foreach ( $urls as $key => $url ) {
2863
+		foreach ($urls as $key => $url) {
2864 2864
 			$atts = array();
2865 2865
 
2866
-			if ( is_array( $url ) ) {
2867
-				if ( isset( $url['href'] ) ) {
2866
+			if (is_array($url)) {
2867
+				if (isset($url['href'])) {
2868 2868
 					$atts = $url;
2869 2869
 					$url  = $url['href'];
2870 2870
 				} else {
@@ -2872,57 +2872,57 @@  discard block
 block discarded – undo
2872 2872
 				}
2873 2873
 			}
2874 2874
 
2875
-			$url = esc_url( $url, array( 'http', 'https' ) );
2875
+			$url = esc_url($url, array('http', 'https'));
2876 2876
 
2877
-			if ( ! $url ) {
2877
+			if ( ! $url) {
2878 2878
 				continue;
2879 2879
 			}
2880 2880
 
2881
-			if ( isset( $unique_urls[ $url ] ) ) {
2881
+			if (isset($unique_urls[$url])) {
2882 2882
 				continue;
2883 2883
 			}
2884 2884
 
2885
-			if ( in_array( $relation_type, array( 'preconnect', 'dns-prefetch' ) ) ) {
2886
-				$parsed = wp_parse_url( $url );
2885
+			if (in_array($relation_type, array('preconnect', 'dns-prefetch'))) {
2886
+				$parsed = wp_parse_url($url);
2887 2887
 
2888
-				if ( empty( $parsed['host'] ) ) {
2888
+				if (empty($parsed['host'])) {
2889 2889
 					continue;
2890 2890
 				}
2891 2891
 
2892
-				if ( 'preconnect' === $relation_type && ! empty( $parsed['scheme'] ) ) {
2893
-					$url = $parsed['scheme'] . '://' . $parsed['host'];
2892
+				if ('preconnect' === $relation_type && ! empty($parsed['scheme'])) {
2893
+					$url = $parsed['scheme'].'://'.$parsed['host'];
2894 2894
 				} else {
2895 2895
 					// Use protocol-relative URLs for dns-prefetch or if scheme is missing.
2896
-					$url = '//' . $parsed['host'];
2896
+					$url = '//'.$parsed['host'];
2897 2897
 				}
2898 2898
 			}
2899 2899
 
2900 2900
 			$atts['rel'] = $relation_type;
2901 2901
 			$atts['href'] = $url;
2902 2902
 
2903
-			$unique_urls[ $url ] = $atts;
2903
+			$unique_urls[$url] = $atts;
2904 2904
 		}
2905 2905
 
2906
-		foreach ( $unique_urls as $atts ) {
2906
+		foreach ($unique_urls as $atts) {
2907 2907
 			$html = '';
2908 2908
 
2909
-			foreach ( $atts as $attr => $value ) {
2910
-				if ( ! is_scalar( $value ) ||
2911
-				     ( ! in_array( $attr, array( 'as', 'crossorigin', 'href', 'pr', 'rel', 'type' ), true ) && ! is_numeric( $attr ))
2909
+			foreach ($atts as $attr => $value) {
2910
+				if ( ! is_scalar($value) ||
2911
+				     ( ! in_array($attr, array('as', 'crossorigin', 'href', 'pr', 'rel', 'type'), true) && ! is_numeric($attr))
2912 2912
 				) {
2913 2913
 					continue;
2914 2914
 				}
2915 2915
 
2916
-				$value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value );
2916
+				$value = ('href' === $attr) ? esc_url($value) : esc_attr($value);
2917 2917
 
2918
-				if ( ! is_string( $attr ) ) {
2918
+				if ( ! is_string($attr)) {
2919 2919
 					$html .= " $value";
2920 2920
 				} else {
2921 2921
 					$html .= " $attr='$value'";
2922 2922
 				}
2923 2923
 			}
2924 2924
 
2925
-			$html = trim( $html );
2925
+			$html = trim($html);
2926 2926
 
2927 2927
 			echo "<link $html />\n";
2928 2928
 		}
@@ -2941,18 +2941,18 @@  discard block
 block discarded – undo
2941 2941
 
2942 2942
 	$unique_hosts = array();
2943 2943
 
2944
-	foreach ( array( $wp_scripts, $wp_styles ) as $dependencies ) {
2945
-		if ( $dependencies instanceof WP_Dependencies && ! empty( $dependencies->queue ) ) {
2946
-			foreach ( $dependencies->queue as $handle ) {
2947
-				if ( ! isset( $dependencies->registered[ $handle ] ) ) {
2944
+	foreach (array($wp_scripts, $wp_styles) as $dependencies) {
2945
+		if ($dependencies instanceof WP_Dependencies && ! empty($dependencies->queue)) {
2946
+			foreach ($dependencies->queue as $handle) {
2947
+				if ( ! isset($dependencies->registered[$handle])) {
2948 2948
 					continue;
2949 2949
 				}
2950 2950
 
2951 2951
 				/* @var _WP_Dependency $dependency */
2952
-				$dependency = $dependencies->registered[ $handle ];
2953
-				$parsed     = wp_parse_url( $dependency->src );
2952
+				$dependency = $dependencies->registered[$handle];
2953
+				$parsed     = wp_parse_url($dependency->src);
2954 2954
 
2955
-				if ( ! empty( $parsed['host'] ) && ! in_array( $parsed['host'], $unique_hosts ) && $parsed['host'] !== $_SERVER['SERVER_NAME'] ) {
2955
+				if ( ! empty($parsed['host']) && ! in_array($parsed['host'], $unique_hosts) && $parsed['host'] !== $_SERVER['SERVER_NAME']) {
2956 2956
 					$unique_hosts[] = $parsed['host'];
2957 2957
 				}
2958 2958
 			}
@@ -2982,13 +2982,13 @@  discard block
 block discarded – undo
2982 2982
 function user_can_richedit() {
2983 2983
 	global $wp_rich_edit, $is_gecko, $is_opera, $is_safari, $is_chrome, $is_IE, $is_edge;
2984 2984
 
2985
-	if ( !isset($wp_rich_edit) ) {
2985
+	if ( ! isset($wp_rich_edit)) {
2986 2986
 		$wp_rich_edit = false;
2987 2987
 
2988
-		if ( get_user_option( 'rich_editing' ) == 'true' || ! is_user_logged_in() ) { // default to 'true' for logged out users
2989
-			if ( $is_safari ) {
2990
-				$wp_rich_edit = ! wp_is_mobile() || ( preg_match( '!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match ) && intval( $match[1] ) >= 534 );
2991
-			} elseif ( $is_gecko || $is_chrome || $is_IE || $is_edge || ( $is_opera && !wp_is_mobile() ) ) {
2988
+		if (get_user_option('rich_editing') == 'true' || ! is_user_logged_in()) { // default to 'true' for logged out users
2989
+			if ($is_safari) {
2990
+				$wp_rich_edit = ! wp_is_mobile() || (preg_match('!AppleWebKit/(\d+)!', $_SERVER['HTTP_USER_AGENT'], $match) && intval($match[1]) >= 534);
2991
+			} elseif ($is_gecko || $is_chrome || $is_IE || $is_edge || ($is_opera && ! wp_is_mobile())) {
2992 2992
 				$wp_rich_edit = true;
2993 2993
 			}
2994 2994
 		}
@@ -3001,7 +3001,7 @@  discard block
 block discarded – undo
3001 3001
 	 *
3002 3002
 	 * @param bool $wp_rich_edit Whether the user can access the visual editor.
3003 3003
 	 */
3004
-	return apply_filters( 'user_can_richedit', $wp_rich_edit );
3004
+	return apply_filters('user_can_richedit', $wp_rich_edit);
3005 3005
 }
3006 3006
 
3007 3007
 /**
@@ -3016,9 +3016,9 @@  discard block
 block discarded – undo
3016 3016
  */
3017 3017
 function wp_default_editor() {
3018 3018
 	$r = user_can_richedit() ? 'tinymce' : 'html'; // defaults
3019
-	if ( wp_get_current_user() ) { // look for cookie
3019
+	if (wp_get_current_user()) { // look for cookie
3020 3020
 		$ed = get_user_setting('editor', 'tinymce');
3021
-		$r = ( in_array($ed, array('tinymce', 'html', 'test') ) ) ? $ed : $r;
3021
+		$r = (in_array($ed, array('tinymce', 'html', 'test'))) ? $ed : $r;
3022 3022
 	}
3023 3023
 
3024 3024
 	/**
@@ -3028,7 +3028,7 @@  discard block
 block discarded – undo
3028 3028
 	 *
3029 3029
 	 * @param string $r Which editor should be displayed by default. Either 'tinymce', 'html', or 'test'.
3030 3030
 	 */
3031
-	return apply_filters( 'wp_default_editor', $r );
3031
+	return apply_filters('wp_default_editor', $r);
3032 3032
 }
3033 3033
 
3034 3034
 /**
@@ -3050,9 +3050,9 @@  discard block
 block discarded – undo
3050 3050
  * @param string $editor_id HTML ID attribute value for the textarea and TinyMCE. Can only be /[a-z]+/.
3051 3051
  * @param array  $settings  See _WP_Editors::editor().
3052 3052
  */
3053
-function wp_editor( $content, $editor_id, $settings = array() ) {
3054
-	if ( ! class_exists( '_WP_Editors', false ) )
3055
-		require( ABSPATH . WPINC . '/class-wp-editor.php' );
3053
+function wp_editor($content, $editor_id, $settings = array()) {
3054
+	if ( ! class_exists('_WP_Editors', false))
3055
+		require(ABSPATH.WPINC.'/class-wp-editor.php');
3056 3056
 	_WP_Editors::editor($content, $editor_id, $settings);
3057 3057
 }
3058 3058
 
@@ -3068,7 +3068,7 @@  discard block
 block discarded – undo
3068 3068
  * 	                    Only use when you are later escaping it. Do not use unescaped.
3069 3069
  * @return string
3070 3070
  */
3071
-function get_search_query( $escaped = true ) {
3071
+function get_search_query($escaped = true) {
3072 3072
 	/**
3073 3073
 	 * Filters the contents of the search query variable.
3074 3074
 	 *
@@ -3076,10 +3076,10 @@  discard block
 block discarded – undo
3076 3076
 	 *
3077 3077
 	 * @param mixed $search Contents of the search query variable.
3078 3078
 	 */
3079
-	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
3079
+	$query = apply_filters('get_search_query', get_query_var('s'));
3080 3080
 
3081
-	if ( $escaped )
3082
-		$query = esc_attr( $query );
3081
+	if ($escaped)
3082
+		$query = esc_attr($query);
3083 3083
 	return $query;
3084 3084
 }
3085 3085
 
@@ -3099,7 +3099,7 @@  discard block
 block discarded – undo
3099 3099
 	 *
3100 3100
 	 * @param mixed $search Contents of the search query variable.
3101 3101
 	 */
3102
-	echo esc_attr( apply_filters( 'the_search_query', get_search_query( false ) ) );
3102
+	echo esc_attr(apply_filters('the_search_query', get_search_query(false)));
3103 3103
 }
3104 3104
 
3105 3105
 /**
@@ -3112,17 +3112,17 @@  discard block
 block discarded – undo
3112 3112
  *
3113 3113
  * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
3114 3114
  */
3115
-function get_language_attributes( $doctype = 'html' ) {
3115
+function get_language_attributes($doctype = 'html') {
3116 3116
 	$attributes = array();
3117 3117
 
3118
-	if ( function_exists( 'is_rtl' ) && is_rtl() )
3118
+	if (function_exists('is_rtl') && is_rtl())
3119 3119
 		$attributes[] = 'dir="rtl"';
3120 3120
 
3121
-	if ( $lang = get_bloginfo('language') ) {
3122
-		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
3121
+	if ($lang = get_bloginfo('language')) {
3122
+		if (get_option('html_type') == 'text/html' || $doctype == 'html')
3123 3123
 			$attributes[] = "lang=\"$lang\"";
3124 3124
 
3125
-		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
3125
+		if (get_option('html_type') != 'text/html' || $doctype == 'xhtml')
3126 3126
 			$attributes[] = "xml:lang=\"$lang\"";
3127 3127
 	}
3128 3128
 
@@ -3137,7 +3137,7 @@  discard block
 block discarded – undo
3137 3137
 	 * @param string $output A space-separated list of language attributes.
3138 3138
 	 * @param string $doctype The type of html document (xhtml|html).
3139 3139
 	 */
3140
-	return apply_filters( 'language_attributes', $output, $doctype );
3140
+	return apply_filters('language_attributes', $output, $doctype);
3141 3141
 }
3142 3142
 
3143 3143
 /**
@@ -3151,8 +3151,8 @@  discard block
 block discarded – undo
3151 3151
  *
3152 3152
  * @param string $doctype Optional. The type of html document. Accepts 'xhtml' or 'html'. Default 'html'.
3153 3153
  */
3154
-function language_attributes( $doctype = 'html' ) {
3155
-	echo get_language_attributes( $doctype );
3154
+function language_attributes($doctype = 'html') {
3155
+	echo get_language_attributes($doctype);
3156 3156
 }
3157 3157
 
3158 3158
 /**
@@ -3230,23 +3230,23 @@  discard block
 block discarded – undo
3230 3230
  * }
3231 3231
  * @return array|string|void String of page links or array of page links.
3232 3232
  */
3233
-function paginate_links( $args = '' ) {
3233
+function paginate_links($args = '') {
3234 3234
 	global $wp_query, $wp_rewrite;
3235 3235
 
3236 3236
 	// Setting up default values based on the current URL.
3237
-	$pagenum_link = html_entity_decode( get_pagenum_link() );
3238
-	$url_parts    = explode( '?', $pagenum_link );
3237
+	$pagenum_link = html_entity_decode(get_pagenum_link());
3238
+	$url_parts    = explode('?', $pagenum_link);
3239 3239
 
3240 3240
 	// Get max pages and current page out of the current query, if available.
3241
-	$total   = isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1;
3242
-	$current = get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1;
3241
+	$total   = isset($wp_query->max_num_pages) ? $wp_query->max_num_pages : 1;
3242
+	$current = get_query_var('paged') ? intval(get_query_var('paged')) : 1;
3243 3243
 
3244 3244
 	// Append the format placeholder to the base URL.
3245
-	$pagenum_link = trailingslashit( $url_parts[0] ) . '%_%';
3245
+	$pagenum_link = trailingslashit($url_parts[0]).'%_%';
3246 3246
 
3247 3247
 	// URL base depends on permalink settings.
3248
-	$format  = $wp_rewrite->using_index_permalinks() && ! strpos( $pagenum_link, 'index.php' ) ? 'index.php/' : '';
3249
-	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit( $wp_rewrite->pagination_base . '/%#%', 'paged' ) : '?paged=%#%';
3248
+	$format  = $wp_rewrite->using_index_permalinks() && ! strpos($pagenum_link, 'index.php') ? 'index.php/' : '';
3249
+	$format .= $wp_rewrite->using_permalinks() ? user_trailingslashit($wp_rewrite->pagination_base.'/%#%', 'paged') : '?paged=%#%';
3250 3250
 
3251 3251
 	$defaults = array(
3252 3252
 		'base' => $pagenum_link, // http://example.com/all_posts.php%_% : %_% is replaced by format (below)
@@ -3266,42 +3266,42 @@  discard block
 block discarded – undo
3266 3266
 		'after_page_number' => ''
3267 3267
 	);
3268 3268
 
3269
-	$args = wp_parse_args( $args, $defaults );
3269
+	$args = wp_parse_args($args, $defaults);
3270 3270
 
3271
-	if ( ! is_array( $args['add_args'] ) ) {
3271
+	if ( ! is_array($args['add_args'])) {
3272 3272
 		$args['add_args'] = array();
3273 3273
 	}
3274 3274
 
3275 3275
 	// Merge additional query vars found in the original URL into 'add_args' array.
3276
-	if ( isset( $url_parts[1] ) ) {
3276
+	if (isset($url_parts[1])) {
3277 3277
 		// Find the format argument.
3278
-		$format = explode( '?', str_replace( '%_%', $args['format'], $args['base'] ) );
3279
-		$format_query = isset( $format[1] ) ? $format[1] : '';
3280
-		wp_parse_str( $format_query, $format_args );
3278
+		$format = explode('?', str_replace('%_%', $args['format'], $args['base']));
3279
+		$format_query = isset($format[1]) ? $format[1] : '';
3280
+		wp_parse_str($format_query, $format_args);
3281 3281
 
3282 3282
 		// Find the query args of the requested URL.
3283
-		wp_parse_str( $url_parts[1], $url_query_args );
3283
+		wp_parse_str($url_parts[1], $url_query_args);
3284 3284
 
3285 3285
 		// Remove the format argument from the array of query arguments, to avoid overwriting custom format.
3286
-		foreach ( $format_args as $format_arg => $format_arg_value ) {
3287
-			unset( $url_query_args[ $format_arg ] );
3286
+		foreach ($format_args as $format_arg => $format_arg_value) {
3287
+			unset($url_query_args[$format_arg]);
3288 3288
 		}
3289 3289
 
3290
-		$args['add_args'] = array_merge( $args['add_args'], urlencode_deep( $url_query_args ) );
3290
+		$args['add_args'] = array_merge($args['add_args'], urlencode_deep($url_query_args));
3291 3291
 	}
3292 3292
 
3293 3293
 	// Who knows what else people pass in $args
3294 3294
 	$total = (int) $args['total'];
3295
-	if ( $total < 2 ) {
3295
+	if ($total < 2) {
3296 3296
 		return;
3297 3297
 	}
3298 3298
 	$current  = (int) $args['current'];
3299 3299
 	$end_size = (int) $args['end_size']; // Out of bounds?  Make it the default.
3300
-	if ( $end_size < 1 ) {
3300
+	if ($end_size < 1) {
3301 3301
 		$end_size = 1;
3302 3302
 	}
3303 3303
 	$mid_size = (int) $args['mid_size'];
3304
-	if ( $mid_size < 0 ) {
3304
+	if ($mid_size < 0) {
3305 3305
 		$mid_size = 2;
3306 3306
 	}
3307 3307
 	$add_args = $args['add_args'];
@@ -3309,11 +3309,11 @@  discard block
 block discarded – undo
3309 3309
 	$page_links = array();
3310 3310
 	$dots = false;
3311 3311
 
3312
-	if ( $args['prev_next'] && $current && 1 < $current ) :
3313
-		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
3314
-		$link = str_replace( '%#%', $current - 1, $link );
3315
-		if ( $add_args )
3316
-			$link = add_query_arg( $add_args, $link );
3312
+	if ($args['prev_next'] && $current && 1 < $current) :
3313
+		$link = str_replace('%_%', 2 == $current ? '' : $args['format'], $args['base']);
3314
+		$link = str_replace('%#%', $current - 1, $link);
3315
+		if ($add_args)
3316
+			$link = add_query_arg($add_args, $link);
3317 3317
 		$link .= $args['add_fragment'];
3318 3318
 
3319 3319
 		/**
@@ -3323,40 +3323,40 @@  discard block
 block discarded – undo
3323 3323
 		 *
3324 3324
 		 * @param string $link The paginated link URL.
3325 3325
 		 */
3326
-		$page_links[] = '<a class="prev page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['prev_text'] . '</a>';
3326
+		$page_links[] = '<a class="prev page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['prev_text'].'</a>';
3327 3327
 	endif;
3328
-	for ( $n = 1; $n <= $total; $n++ ) :
3329
-		if ( $n == $current ) :
3330
-			$page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";
3328
+	for ($n = 1; $n <= $total; $n++) :
3329
+		if ($n == $current) :
3330
+			$page_links[] = "<span class='page-numbers current'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</span>";
3331 3331
 			$dots = true;
3332 3332
 		else :
3333
-			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
3334
-				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
3335
-				$link = str_replace( '%#%', $n, $link );
3336
-				if ( $add_args )
3337
-					$link = add_query_arg( $add_args, $link );
3333
+			if ($args['show_all'] || ($n <= $end_size || ($current && $n >= $current - $mid_size && $n <= $current + $mid_size) || $n > $total - $end_size)) :
3334
+				$link = str_replace('%_%', 1 == $n ? '' : $args['format'], $args['base']);
3335
+				$link = str_replace('%#%', $n, $link);
3336
+				if ($add_args)
3337
+					$link = add_query_arg($add_args, $link);
3338 3338
 				$link .= $args['add_fragment'];
3339 3339
 
3340 3340
 				/** This filter is documented in wp-includes/general-template.php */
3341
-				$page_links[] = "<a class='page-numbers' href='" . esc_url( apply_filters( 'paginate_links', $link ) ) . "'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</a>";
3341
+				$page_links[] = "<a class='page-numbers' href='".esc_url(apply_filters('paginate_links', $link))."'>".$args['before_page_number'].number_format_i18n($n).$args['after_page_number']."</a>";
3342 3342
 				$dots = true;
3343
-			elseif ( $dots && ! $args['show_all'] ) :
3344
-				$page_links[] = '<span class="page-numbers dots">' . __( '&hellip;' ) . '</span>';
3343
+			elseif ($dots && ! $args['show_all']) :
3344
+				$page_links[] = '<span class="page-numbers dots">'.__('&hellip;').'</span>';
3345 3345
 				$dots = false;
3346 3346
 			endif;
3347 3347
 		endif;
3348 3348
 	endfor;
3349
-	if ( $args['prev_next'] && $current && $current < $total ) :
3350
-		$link = str_replace( '%_%', $args['format'], $args['base'] );
3351
-		$link = str_replace( '%#%', $current + 1, $link );
3352
-		if ( $add_args )
3353
-			$link = add_query_arg( $add_args, $link );
3349
+	if ($args['prev_next'] && $current && $current < $total) :
3350
+		$link = str_replace('%_%', $args['format'], $args['base']);
3351
+		$link = str_replace('%#%', $current + 1, $link);
3352
+		if ($add_args)
3353
+			$link = add_query_arg($add_args, $link);
3354 3354
 		$link .= $args['add_fragment'];
3355 3355
 
3356 3356
 		/** This filter is documented in wp-includes/general-template.php */
3357
-		$page_links[] = '<a class="next page-numbers" href="' . esc_url( apply_filters( 'paginate_links', $link ) ) . '">' . $args['next_text'] . '</a>';
3357
+		$page_links[] = '<a class="next page-numbers" href="'.esc_url(apply_filters('paginate_links', $link)).'">'.$args['next_text'].'</a>';
3358 3358
 	endif;
3359
-	switch ( $args['type'] ) {
3359
+	switch ($args['type']) {
3360 3360
 		case 'array' :
3361 3361
 			return $page_links;
3362 3362
 
@@ -3399,10 +3399,10 @@  discard block
 block discarded – undo
3399 3399
  *     @type string $current SVG icon color of current admin menu link.
3400 3400
  * }
3401 3401
  */
3402
-function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
3402
+function wp_admin_css_color($key, $name, $url, $colors = array(), $icons = array()) {
3403 3403
 	global $_wp_admin_css_colors;
3404 3404
 
3405
-	if ( !isset($_wp_admin_css_colors) )
3405
+	if ( ! isset($_wp_admin_css_colors))
3406 3406
 		$_wp_admin_css_colors = array();
3407 3407
 
3408 3408
 	$_wp_admin_css_colors[$key] = (object) array(
@@ -3422,57 +3422,57 @@  discard block
 block discarded – undo
3422 3422
 	$suffix = is_rtl() ? '-rtl' : '';
3423 3423
 	$suffix .= SCRIPT_DEBUG ? '' : '.min';
3424 3424
 
3425
-	wp_admin_css_color( 'fresh', _x( 'Default', 'admin color scheme' ),
3425
+	wp_admin_css_color('fresh', _x('Default', 'admin color scheme'),
3426 3426
 		false,
3427
-		array( '#222', '#333', '#0073aa', '#00a0d2' ),
3428
-		array( 'base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff' )
3427
+		array('#222', '#333', '#0073aa', '#00a0d2'),
3428
+		array('base' => '#82878c', 'focus' => '#00a0d2', 'current' => '#fff')
3429 3429
 	);
3430 3430
 
3431 3431
 	// Other color schemes are not available when running out of src
3432
-	if ( false !== strpos( get_bloginfo( 'version' ), '-src' ) ) {
3432
+	if (false !== strpos(get_bloginfo('version'), '-src')) {
3433 3433
 		return;
3434 3434
 	}
3435 3435
 
3436
-	wp_admin_css_color( 'light', _x( 'Light', 'admin color scheme' ),
3437
-		admin_url( "css/colors/light/colors$suffix.css" ),
3438
-		array( '#e5e5e5', '#999', '#d64e07', '#04a4cc' ),
3439
-		array( 'base' => '#999', 'focus' => '#ccc', 'current' => '#ccc' )
3436
+	wp_admin_css_color('light', _x('Light', 'admin color scheme'),
3437
+		admin_url("css/colors/light/colors$suffix.css"),
3438
+		array('#e5e5e5', '#999', '#d64e07', '#04a4cc'),
3439
+		array('base' => '#999', 'focus' => '#ccc', 'current' => '#ccc')
3440 3440
 	);
3441 3441
 
3442
-	wp_admin_css_color( 'blue', _x( 'Blue', 'admin color scheme' ),
3443
-		admin_url( "css/colors/blue/colors$suffix.css" ),
3444
-		array( '#096484', '#4796b3', '#52accc', '#74B6CE' ),
3445
-		array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' )
3442
+	wp_admin_css_color('blue', _x('Blue', 'admin color scheme'),
3443
+		admin_url("css/colors/blue/colors$suffix.css"),
3444
+		array('#096484', '#4796b3', '#52accc', '#74B6CE'),
3445
+		array('base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff')
3446 3446
 	);
3447 3447
 
3448
-	wp_admin_css_color( 'midnight', _x( 'Midnight', 'admin color scheme' ),
3449
-		admin_url( "css/colors/midnight/colors$suffix.css" ),
3450
-		array( '#25282b', '#363b3f', '#69a8bb', '#e14d43' ),
3451
-		array( 'base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff' )
3448
+	wp_admin_css_color('midnight', _x('Midnight', 'admin color scheme'),
3449
+		admin_url("css/colors/midnight/colors$suffix.css"),
3450
+		array('#25282b', '#363b3f', '#69a8bb', '#e14d43'),
3451
+		array('base' => '#f1f2f3', 'focus' => '#fff', 'current' => '#fff')
3452 3452
 	);
3453 3453
 
3454
-	wp_admin_css_color( 'sunrise', _x( 'Sunrise', 'admin color scheme' ),
3455
-		admin_url( "css/colors/sunrise/colors$suffix.css" ),
3456
-		array( '#b43c38', '#cf4944', '#dd823b', '#ccaf0b' ),
3457
-		array( 'base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff' )
3454
+	wp_admin_css_color('sunrise', _x('Sunrise', 'admin color scheme'),
3455
+		admin_url("css/colors/sunrise/colors$suffix.css"),
3456
+		array('#b43c38', '#cf4944', '#dd823b', '#ccaf0b'),
3457
+		array('base' => '#f3f1f1', 'focus' => '#fff', 'current' => '#fff')
3458 3458
 	);
3459 3459
 
3460
-	wp_admin_css_color( 'ectoplasm', _x( 'Ectoplasm', 'admin color scheme' ),
3461
-		admin_url( "css/colors/ectoplasm/colors$suffix.css" ),
3462
-		array( '#413256', '#523f6d', '#a3b745', '#d46f15' ),
3463
-		array( 'base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff' )
3460
+	wp_admin_css_color('ectoplasm', _x('Ectoplasm', 'admin color scheme'),
3461
+		admin_url("css/colors/ectoplasm/colors$suffix.css"),
3462
+		array('#413256', '#523f6d', '#a3b745', '#d46f15'),
3463
+		array('base' => '#ece6f6', 'focus' => '#fff', 'current' => '#fff')
3464 3464
 	);
3465 3465
 
3466
-	wp_admin_css_color( 'ocean', _x( 'Ocean', 'admin color scheme' ),
3467
-		admin_url( "css/colors/ocean/colors$suffix.css" ),
3468
-		array( '#627c83', '#738e96', '#9ebaa0', '#aa9d88' ),
3469
-		array( 'base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff' )
3466
+	wp_admin_css_color('ocean', _x('Ocean', 'admin color scheme'),
3467
+		admin_url("css/colors/ocean/colors$suffix.css"),
3468
+		array('#627c83', '#738e96', '#9ebaa0', '#aa9d88'),
3469
+		array('base' => '#f2fcff', 'focus' => '#fff', 'current' => '#fff')
3470 3470
 	);
3471 3471
 
3472
-	wp_admin_css_color( 'coffee', _x( 'Coffee', 'admin color scheme' ),
3473
-		admin_url( "css/colors/coffee/colors$suffix.css" ),
3474
-		array( '#46403c', '#59524c', '#c7a589', '#9ea476' ),
3475
-		array( 'base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff' )
3472
+	wp_admin_css_color('coffee', _x('Coffee', 'admin color scheme'),
3473
+		admin_url("css/colors/coffee/colors$suffix.css"),
3474
+		array('#46403c', '#59524c', '#c7a589', '#9ea476'),
3475
+		array('base' => '#f3f2f1', 'focus' => '#fff', 'current' => '#fff')
3476 3476
 	);
3477 3477
 
3478 3478
 }
@@ -3487,13 +3487,13 @@  discard block
 block discarded – undo
3487 3487
  * @param string $file file relative to wp-admin/ without its ".css" extension.
3488 3488
  * @return string
3489 3489
  */
3490
-function wp_admin_css_uri( $file = 'wp-admin' ) {
3491
-	if ( defined('WP_INSTALLING') ) {
3490
+function wp_admin_css_uri($file = 'wp-admin') {
3491
+	if (defined('WP_INSTALLING')) {
3492 3492
 		$_file = "./$file.css";
3493 3493
 	} else {
3494 3494
 		$_file = admin_url("$file.css");
3495 3495
 	}
3496
-	$_file = add_query_arg( 'version', get_bloginfo( 'version' ),  $_file );
3496
+	$_file = add_query_arg('version', get_bloginfo('version'), $_file);
3497 3497
 
3498 3498
 	/**
3499 3499
 	 * Filters the URI of a WordPress admin CSS file.
@@ -3503,7 +3503,7 @@  discard block
 block discarded – undo
3503 3503
 	 * @param string $_file Relative path to the file with query arguments attached.
3504 3504
 	 * @param string $file  Relative path to the file, minus its ".css" extension.
3505 3505
 	 */
3506
-	return apply_filters( 'wp_admin_css_uri', $_file, $file );
3506
+	return apply_filters('wp_admin_css_uri', $_file, $file);
3507 3507
 }
3508 3508
 
3509 3509
 /**
@@ -3526,15 +3526,15 @@  discard block
 block discarded – undo
3526 3526
  * 	                         to wp-admin/. Defaults to 'wp-admin'.
3527 3527
  * @param bool   $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
3528 3528
  */
3529
-function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
3529
+function wp_admin_css($file = 'wp-admin', $force_echo = false) {
3530 3530
 	// For backward compatibility
3531
-	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
3531
+	$handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file;
3532 3532
 
3533
-	if ( wp_styles()->query( $handle ) ) {
3534
-		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
3535
-			wp_print_styles( $handle );
3533
+	if (wp_styles()->query($handle)) {
3534
+		if ($force_echo || did_action('wp_print_styles')) // we already printed the style queue. Print this one immediately
3535
+			wp_print_styles($handle);
3536 3536
 		else // Add to style queue
3537
-			wp_enqueue_style( $handle );
3537
+			wp_enqueue_style($handle);
3538 3538
 		return;
3539 3539
 	}
3540 3540
 
@@ -3549,11 +3549,11 @@  discard block
 block discarded – undo
3549 3549
 	 * @param string $file            Style handle name or filename (without ".css" extension)
3550 3550
 	 *                                relative to wp-admin/. Defaults to 'wp-admin'.
3551 3551
 	 */
3552
-	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
3552
+	echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri($file))."' type='text/css' />\n", $file);
3553 3553
 
3554
-	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
3554
+	if (function_exists('is_rtl') && is_rtl()) {
3555 3555
 		/** This filter is documented in wp-includes/general-template.php */
3556
-		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . esc_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
3556
+		echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='".esc_url(wp_admin_css_uri("$file-rtl"))."' type='text/css' />\n", "$file-rtl");
3557 3557
 	}
3558 3558
 }
3559 3559
 
@@ -3567,11 +3567,11 @@  discard block
 block discarded – undo
3567 3567
  * @since 2.5.0
3568 3568
  */
3569 3569
 function add_thickbox() {
3570
-	wp_enqueue_script( 'thickbox' );
3571
-	wp_enqueue_style( 'thickbox' );
3570
+	wp_enqueue_script('thickbox');
3571
+	wp_enqueue_style('thickbox');
3572 3572
 
3573
-	if ( is_network_admin() )
3574
-		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3573
+	if (is_network_admin())
3574
+		add_action('admin_head', '_thickbox_path_admin_subfolder');
3575 3575
 }
3576 3576
 
3577 3577
 /**
@@ -3589,7 +3589,7 @@  discard block
 block discarded – undo
3589 3589
 	 *
3590 3590
 	 * @param string $generator_type The XHTML generator.
3591 3591
 	 */
3592
-	the_generator( apply_filters( 'wp_generator_type', 'xhtml' ) );
3592
+	the_generator(apply_filters('wp_generator_type', 'xhtml'));
3593 3593
 }
3594 3594
 
3595 3595
 /**
@@ -3602,7 +3602,7 @@  discard block
 block discarded – undo
3602 3602
  *
3603 3603
  * @param string $type The type of generator to output - (html|xhtml|atom|rss2|rdf|comment|export).
3604 3604
  */
3605
-function the_generator( $type ) {
3605
+function the_generator($type) {
3606 3606
 	/**
3607 3607
 	 * Filters the output of the XHTML generator tag for display.
3608 3608
 	 *
@@ -3612,7 +3612,7 @@  discard block
 block discarded – undo
3612 3612
 	 * @param string $type           The type of generator to output. Accepts 'html',
3613 3613
 	 *                               'xhtml', 'atom', 'rss2', 'rdf', 'comment', 'export'.
3614 3614
 	 */
3615
-	echo apply_filters( 'the_generator', get_the_generator($type), $type ) . "\n";
3615
+	echo apply_filters('the_generator', get_the_generator($type), $type)."\n";
3616 3616
 }
3617 3617
 
3618 3618
 /**
@@ -3627,14 +3627,14 @@  discard block
 block discarded – undo
3627 3627
  * @param string $type The type of generator to return - (html|xhtml|atom|rss2|rdf|comment|export).
3628 3628
  * @return string|void The HTML content for the generator.
3629 3629
  */
3630
-function get_the_generator( $type = '' ) {
3631
-	if ( empty( $type ) ) {
3630
+function get_the_generator($type = '') {
3631
+	if (empty($type)) {
3632 3632
 
3633 3633
 		$current_filter = current_filter();
3634
-		if ( empty( $current_filter ) )
3634
+		if (empty($current_filter))
3635 3635
 			return;
3636 3636
 
3637
-		switch ( $current_filter ) {
3637
+		switch ($current_filter) {
3638 3638
 			case 'rss2_head' :
3639 3639
 			case 'commentsrss2_head' :
3640 3640
 				$type = 'rss2';
@@ -3654,27 +3654,27 @@  discard block
 block discarded – undo
3654 3654
 		}
3655 3655
 	}
3656 3656
 
3657
-	switch ( $type ) {
3657
+	switch ($type) {
3658 3658
 		case 'html':
3659
-			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '">';
3659
+			$gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'">';
3660 3660
 			break;
3661 3661
 		case 'xhtml':
3662
-			$gen = '<meta name="generator" content="WordPress ' . get_bloginfo( 'version' ) . '" />';
3662
+			$gen = '<meta name="generator" content="WordPress '.get_bloginfo('version').'" />';
3663 3663
 			break;
3664 3664
 		case 'atom':
3665
-			$gen = '<generator uri="https://wordpress.org/" version="' . get_bloginfo_rss( 'version' ) . '">WordPress</generator>';
3665
+			$gen = '<generator uri="https://wordpress.org/" version="'.get_bloginfo_rss('version').'">WordPress</generator>';
3666 3666
 			break;
3667 3667
 		case 'rss2':
3668
-			$gen = '<generator>https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '</generator>';
3668
+			$gen = '<generator>https://wordpress.org/?v='.get_bloginfo_rss('version').'</generator>';
3669 3669
 			break;
3670 3670
 		case 'rdf':
3671
-			$gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v=' . get_bloginfo_rss( 'version' ) . '" />';
3671
+			$gen = '<admin:generatorAgent rdf:resource="https://wordpress.org/?v='.get_bloginfo_rss('version').'" />';
3672 3672
 			break;
3673 3673
 		case 'comment':
3674
-			$gen = '<!-- generator="WordPress/' . get_bloginfo( 'version' ) . '" -->';
3674
+			$gen = '<!-- generator="WordPress/'.get_bloginfo('version').'" -->';
3675 3675
 			break;
3676 3676
 		case 'export':
3677
-			$gen = '<!-- generator="WordPress/' . get_bloginfo_rss('version') . '" created="'. date('Y-m-d H:i') . '" -->';
3677
+			$gen = '<!-- generator="WordPress/'.get_bloginfo_rss('version').'" created="'.date('Y-m-d H:i').'" -->';
3678 3678
 			break;
3679 3679
 	}
3680 3680
 
@@ -3689,7 +3689,7 @@  discard block
 block discarded – undo
3689 3689
 	 * @param string $type The type of generator. Accepts 'html', 'xhtml', 'atom',
3690 3690
 	 *                     'rss2', 'rdf', 'comment', 'export'.
3691 3691
 	 */
3692
-	return apply_filters( "get_the_generator_{$type}", $gen, $type );
3692
+	return apply_filters("get_the_generator_{$type}", $gen, $type);
3693 3693
 }
3694 3694
 
3695 3695
 /**
@@ -3704,8 +3704,8 @@  discard block
 block discarded – undo
3704 3704
  * @param bool  $echo    Whether to echo or just return the string
3705 3705
  * @return string html attribute or empty string
3706 3706
  */
3707
-function checked( $checked, $current = true, $echo = true ) {
3708
-	return __checked_selected_helper( $checked, $current, $echo, 'checked' );
3707
+function checked($checked, $current = true, $echo = true) {
3708
+	return __checked_selected_helper($checked, $current, $echo, 'checked');
3709 3709
 }
3710 3710
 
3711 3711
 /**
@@ -3720,8 +3720,8 @@  discard block
 block discarded – undo
3720 3720
  * @param bool  $echo     Whether to echo or just return the string
3721 3721
  * @return string html attribute or empty string
3722 3722
  */
3723
-function selected( $selected, $current = true, $echo = true ) {
3724
-	return __checked_selected_helper( $selected, $current, $echo, 'selected' );
3723
+function selected($selected, $current = true, $echo = true) {
3724
+	return __checked_selected_helper($selected, $current, $echo, 'selected');
3725 3725
 }
3726 3726
 
3727 3727
 /**
@@ -3736,8 +3736,8 @@  discard block
 block discarded – undo
3736 3736
  * @param bool  $echo     Whether to echo or just return the string
3737 3737
  * @return string html attribute or empty string
3738 3738
  */
3739
-function disabled( $disabled, $current = true, $echo = true ) {
3740
-	return __checked_selected_helper( $disabled, $current, $echo, 'disabled' );
3739
+function disabled($disabled, $current = true, $echo = true) {
3740
+	return __checked_selected_helper($disabled, $current, $echo, 'disabled');
3741 3741
 }
3742 3742
 
3743 3743
 /**
@@ -3754,13 +3754,13 @@  discard block
 block discarded – undo
3754 3754
  * @param string $type    The type of checked|selected|disabled we are doing
3755 3755
  * @return string html attribute or empty string
3756 3756
  */
3757
-function __checked_selected_helper( $helper, $current, $echo, $type ) {
3758
-	if ( (string) $helper === (string) $current )
3757
+function __checked_selected_helper($helper, $current, $echo, $type) {
3758
+	if ((string) $helper === (string) $current)
3759 3759
 		$result = " $type='$type'";
3760 3760
 	else
3761 3761
 		$result = '';
3762 3762
 
3763
-	if ( $echo )
3763
+	if ($echo)
3764 3764
 		echo $result;
3765 3765
 
3766 3766
 	return $result;
@@ -3776,12 +3776,12 @@  discard block
 block discarded – undo
3776 3776
  * @param array $settings
3777 3777
  * @return array $settings
3778 3778
  */
3779
-function wp_heartbeat_settings( $settings ) {
3780
-	if ( ! is_admin() )
3781
-		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3779
+function wp_heartbeat_settings($settings) {
3780
+	if ( ! is_admin())
3781
+		$settings['ajaxurl'] = admin_url('admin-ajax.php', 'relative');
3782 3782
 
3783
-	if ( is_user_logged_in() )
3784
-		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3783
+	if (is_user_logged_in())
3784
+		$settings['nonce'] = wp_create_nonce('heartbeat-nonce');
3785 3785
 
3786 3786
 	return $settings;
3787 3787
 }
Please login to merge, or discard this patch.
Braces   +189 added lines, -135 removed lines patch added patch discarded remove patch
@@ -114,8 +114,9 @@  discard block
 block discarded – undo
114 114
 
115 115
 	$templates = array();
116 116
 	$name = (string) $name;
117
-	if ( '' !== $name )
118
-		$templates[] = "sidebar-{$name}.php";
117
+	if ( '' !== $name ) {
118
+			$templates[] = "sidebar-{$name}.php";
119
+	}
119 120
 
120 121
 	$templates[] = 'sidebar.php';
121 122
 
@@ -159,8 +160,9 @@  discard block
 block discarded – undo
159 160
 
160 161
 	$templates = array();
161 162
 	$name = (string) $name;
162
-	if ( '' !== $name )
163
-		$templates[] = "{$slug}-{$name}.php";
163
+	if ( '' !== $name ) {
164
+			$templates[] = "{$slug}-{$name}.php";
165
+	}
164 166
 
165 167
 	$templates[] = "{$slug}.php";
166 168
 
@@ -246,14 +248,16 @@  discard block
 block discarded – undo
246 248
 	 */
247 249
 	$result = apply_filters( 'get_search_form', $form );
248 250
 
249
-	if ( null === $result )
250
-		$result = $form;
251
+	if ( null === $result ) {
252
+			$result = $form;
253
+	}
251 254
 
252
-	if ( $echo )
253
-		echo $result;
254
-	else
255
-		return $result;
256
-}
255
+	if ( $echo ) {
256
+			echo $result;
257
+	} else {
258
+			return $result;
259
+	}
260
+	}
257 261
 
258 262
 /**
259 263
  * Display the Log In/Out link.
@@ -268,10 +272,11 @@  discard block
 block discarded – undo
268 272
  * @return string|void String when retrieving.
269 273
  */
270 274
 function wp_loginout($redirect = '', $echo = true) {
271
-	if ( ! is_user_logged_in() )
272
-		$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
273
-	else
274
-		$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
275
+	if ( ! is_user_logged_in() ) {
276
+			$link = '<a href="' . esc_url( wp_login_url($redirect) ) . '">' . __('Log in') . '</a>';
277
+	} else {
278
+			$link = '<a href="' . esc_url( wp_logout_url($redirect) ) . '">' . __('Log out') . '</a>';
279
+	}
275 280
 
276 281
 	if ( $echo ) {
277 282
 		/**
@@ -331,11 +336,13 @@  discard block
 block discarded – undo
331 336
 function wp_login_url($redirect = '', $force_reauth = false) {
332 337
 	$login_url = site_url('wp-login.php', 'login');
333 338
 
334
-	if ( !empty($redirect) )
335
-		$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
339
+	if ( !empty($redirect) ) {
340
+			$login_url = add_query_arg('redirect_to', urlencode($redirect), $login_url);
341
+	}
336 342
 
337
-	if ( $force_reauth )
338
-		$login_url = add_query_arg('reauth', '1', $login_url);
343
+	if ( $force_reauth ) {
344
+			$login_url = add_query_arg('reauth', '1', $login_url);
345
+	}
339 346
 
340 347
 	/**
341 348
 	 * Filters the login URL.
@@ -487,11 +494,12 @@  discard block
 block discarded – undo
487 494
 			' . $login_form_bottom . '
488 495
 		</form>';
489 496
 
490
-	if ( $args['echo'] )
491
-		echo $form;
492
-	else
493
-		return $form;
494
-}
497
+	if ( $args['echo'] ) {
498
+			echo $form;
499
+	} else {
500
+			return $form;
501
+	}
502
+	}
495 503
 
496 504
 /**
497 505
  * Returns the URL that allows the user to retrieve the lost password
@@ -535,10 +543,11 @@  discard block
 block discarded – undo
535 543
  */
536 544
 function wp_register( $before = '<li>', $after = '</li>', $echo = true ) {
537 545
 	if ( ! is_user_logged_in() ) {
538
-		if ( get_option('users_can_register') )
539
-			$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
540
-		else
541
-			$link = '';
546
+		if ( get_option('users_can_register') ) {
547
+					$link = $before . '<a href="' . esc_url( wp_registration_url() ) . '">' . __('Register') . '</a>' . $after;
548
+		} else {
549
+					$link = '';
550
+		}
542 551
 	} elseif ( current_user_can( 'read' ) ) {
543 552
 		$link = $before . '<a href="' . admin_url() . '">' . __('Site Admin') . '</a>' . $after;
544 553
 	} else {
@@ -699,7 +708,9 @@  discard block
 block discarded – undo
699 708
 			break;
700 709
 		case 'charset':
701 710
 			$output = get_option('blog_charset');
702
-			if ('' == $output) $output = 'UTF-8';
711
+			if ('' == $output) {
712
+				$output = 'UTF-8';
713
+			}
703 714
 			break;
704 715
 		case 'html_type' :
705 716
 			$output = get_option('html_type');
@@ -742,8 +753,9 @@  discard block
 block discarded – undo
742 753
 	$url = true;
743 754
 	if (strpos($show, 'url') === false &&
744 755
 		strpos($show, 'directory') === false &&
745
-		strpos($show, 'home') === false)
746
-		$url = false;
756
+		strpos($show, 'home') === false) {
757
+			$url = false;
758
+	}
747 759
 
748 760
 	if ( 'display' == $filter ) {
749 761
 		if ( $url ) {
@@ -1244,8 +1256,9 @@  discard block
 block discarded – undo
1244 1256
 function single_post_title( $prefix = '', $display = true ) {
1245 1257
 	$_post = get_queried_object();
1246 1258
 
1247
-	if ( !isset($_post->post_title) )
1248
-		return;
1259
+	if ( !isset($_post->post_title) ) {
1260
+			return;
1261
+	}
1249 1262
 
1250 1263
 	/**
1251 1264
 	 * Filters the page title for a single post.
@@ -1256,11 +1269,12 @@  discard block
 block discarded – undo
1256 1269
 	 * @param object $_post       The current queried object as returned by get_queried_object().
1257 1270
 	 */
1258 1271
 	$title = apply_filters( 'single_post_title', $_post->post_title, $_post );
1259
-	if ( $display )
1260
-		echo $prefix . $title;
1261
-	else
1262
-		return $prefix . $title;
1263
-}
1272
+	if ( $display ) {
1273
+			echo $prefix . $title;
1274
+	} else {
1275
+			return $prefix . $title;
1276
+	}
1277
+	}
1264 1278
 
1265 1279
 /**
1266 1280
  * Display or retrieve title for a post type archive.
@@ -1275,12 +1289,14 @@  discard block
 block discarded – undo
1275 1289
  * @return string|void Title when retrieving, null when displaying or failure.
1276 1290
  */
1277 1291
 function post_type_archive_title( $prefix = '', $display = true ) {
1278
-	if ( ! is_post_type_archive() )
1279
-		return;
1292
+	if ( ! is_post_type_archive() ) {
1293
+			return;
1294
+	}
1280 1295
 
1281 1296
 	$post_type = get_query_var( 'post_type' );
1282
-	if ( is_array( $post_type ) )
1283
-		$post_type = reset( $post_type );
1297
+	if ( is_array( $post_type ) ) {
1298
+			$post_type = reset( $post_type );
1299
+	}
1284 1300
 
1285 1301
 	$post_type_obj = get_post_type_object( $post_type );
1286 1302
 
@@ -1294,11 +1310,12 @@  discard block
 block discarded – undo
1294 1310
 	 */
1295 1311
 	$title = apply_filters( 'post_type_archive_title', $post_type_obj->labels->name, $post_type );
1296 1312
 
1297
-	if ( $display )
1298
-		echo $prefix . $title;
1299
-	else
1300
-		return $prefix . $title;
1301
-}
1313
+	if ( $display ) {
1314
+			echo $prefix . $title;
1315
+	} else {
1316
+			return $prefix . $title;
1317
+	}
1318
+	}
1302 1319
 
1303 1320
 /**
1304 1321
  * Display or retrieve page title for category archive.
@@ -1350,8 +1367,9 @@  discard block
 block discarded – undo
1350 1367
 function single_term_title( $prefix = '', $display = true ) {
1351 1368
 	$term = get_queried_object();
1352 1369
 
1353
-	if ( !$term )
1354
-		return;
1370
+	if ( !$term ) {
1371
+			return;
1372
+	}
1355 1373
 
1356 1374
 	if ( is_category() ) {
1357 1375
 		/**
@@ -1384,14 +1402,16 @@  discard block
 block discarded – undo
1384 1402
 		return;
1385 1403
 	}
1386 1404
 
1387
-	if ( empty( $term_name ) )
1388
-		return;
1405
+	if ( empty( $term_name ) ) {
1406
+			return;
1407
+	}
1389 1408
 
1390
-	if ( $display )
1391
-		echo $prefix . $term_name;
1392
-	else
1393
-		return $prefix . $term_name;
1394
-}
1409
+	if ( $display ) {
1410
+			echo $prefix . $term_name;
1411
+	} else {
1412
+			return $prefix . $term_name;
1413
+	}
1414
+	}
1395 1415
 
1396 1416
 /**
1397 1417
  * Display or retrieve page title for post archive based on date.
@@ -1424,13 +1444,15 @@  discard block
 block discarded – undo
1424 1444
 		$my_month = $wp_locale->get_month(substr($m, 4, 2));
1425 1445
 	}
1426 1446
 
1427
-	if ( empty($my_month) )
1428
-		return false;
1447
+	if ( empty($my_month) ) {
1448
+			return false;
1449
+	}
1429 1450
 
1430 1451
 	$result = $prefix . $my_month . $prefix . $my_year;
1431 1452
 
1432
-	if ( !$display )
1433
-		return $result;
1453
+	if ( !$display ) {
1454
+			return $result;
1455
+	}
1434 1456
 	echo $result;
1435 1457
 }
1436 1458
 
@@ -1600,14 +1622,16 @@  discard block
 block discarded – undo
1600 1622
 	$text = wptexturize($text);
1601 1623
 	$url = esc_url($url);
1602 1624
 
1603
-	if ('link' == $format)
1604
-		$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1605
-	elseif ('option' == $format)
1606
-		$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1607
-	elseif ('html' == $format)
1608
-		$link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n";
1609
-	else // custom
1625
+	if ('link' == $format) {
1626
+			$link_html = "\t<link rel='archives' title='" . esc_attr( $text ) . "' href='$url' />\n";
1627
+	} elseif ('option' == $format) {
1628
+			$link_html = "\t<option value='$url'>$before $text $after</option>\n";
1629
+	} elseif ('html' == $format) {
1630
+			$link_html = "\t<li>$before<a href='$url'>$text</a>$after</li>\n";
1631
+	} else {
1632
+		// custom
1610 1633
 		$link_html = "\t$before<a href='$url'>$text</a>$after\n";
1634
+	}
1611 1635
 
1612 1636
 	/**
1613 1637
 	 * Filters the archive link content.
@@ -2191,10 +2215,11 @@  discard block
 block discarded – undo
2191 2215
 		 */
2192 2216
 		$the_date = apply_filters( 'the_date', $the_date, $d, $before, $after );
2193 2217
 
2194
-		if ( $echo )
2195
-			echo $the_date;
2196
-		else
2197
-			return $the_date;
2218
+		if ( $echo ) {
2219
+					echo $the_date;
2220
+		} else {
2221
+					return $the_date;
2222
+		}
2198 2223
 	}
2199 2224
 }
2200 2225
 
@@ -2263,10 +2288,11 @@  discard block
 block discarded – undo
2263 2288
 	 */
2264 2289
 	$the_modified_date = apply_filters( 'the_modified_date', $the_modified_date, $d, $before, $after );
2265 2290
 
2266
-	if ( $echo )
2267
-		echo $the_modified_date;
2268
-	else
2269
-		return $the_modified_date;
2291
+	if ( $echo ) {
2292
+			echo $the_modified_date;
2293
+	} else {
2294
+			return $the_modified_date;
2295
+	}
2270 2296
 
2271 2297
 }
2272 2298
 
@@ -2344,10 +2370,11 @@  discard block
 block discarded – undo
2344 2370
 		return false;
2345 2371
 	}
2346 2372
 
2347
-	if ( '' == $d )
2348
-		$the_time = get_post_time(get_option('time_format'), false, $post, true);
2349
-	else
2350
-		$the_time = get_post_time($d, false, $post, true);
2373
+	if ( '' == $d ) {
2374
+			$the_time = get_post_time(get_option('time_format'), false, $post, true);
2375
+	} else {
2376
+			$the_time = get_post_time($d, false, $post, true);
2377
+	}
2351 2378
 
2352 2379
 	/**
2353 2380
 	 * Filters the time a post was written.
@@ -2382,10 +2409,11 @@  discard block
 block discarded – undo
2382 2409
 		return false;
2383 2410
 	}
2384 2411
 
2385
-	if ( $gmt )
2386
-		$time = $post->post_date_gmt;
2387
-	else
2388
-		$time = $post->post_date;
2412
+	if ( $gmt ) {
2413
+			$time = $post->post_date_gmt;
2414
+	} else {
2415
+			$time = $post->post_date;
2416
+	}
2389 2417
 
2390 2418
 	$time = mysql2date($d, $time, $translate);
2391 2419
 
@@ -2481,10 +2509,11 @@  discard block
 block discarded – undo
2481 2509
 		return false;
2482 2510
 	}
2483 2511
 
2484
-	if ( $gmt )
2485
-		$time = $post->post_modified_gmt;
2486
-	else
2487
-		$time = $post->post_modified;
2512
+	if ( $gmt ) {
2513
+			$time = $post->post_modified_gmt;
2514
+	} else {
2515
+			$time = $post->post_modified;
2516
+	}
2488 2517
 	$time = mysql2date($d, $time, $translate);
2489 2518
 
2490 2519
 	/**
@@ -2598,8 +2627,9 @@  discard block
 block discarded – undo
2598 2627
  * @param array $args Optional arguments.
2599 2628
  */
2600 2629
 function feed_links( $args = array() ) {
2601
-	if ( !current_theme_supports('automatic-feed-links') )
2602
-		return;
2630
+	if ( !current_theme_supports('automatic-feed-links') ) {
2631
+			return;
2632
+	}
2603 2633
 
2604 2634
 	$defaults = array(
2605 2635
 		/* translators: Separator between blog name and feed type in feed links */
@@ -2674,8 +2704,9 @@  discard block
 block discarded – undo
2674 2704
 		}
2675 2705
 	} elseif ( is_post_type_archive() ) {
2676 2706
 		$post_type = get_query_var( 'post_type' );
2677
-		if ( is_array( $post_type ) )
2678
-			$post_type = reset( $post_type );
2707
+		if ( is_array( $post_type ) ) {
2708
+					$post_type = reset( $post_type );
2709
+		}
2679 2710
 
2680 2711
 		$post_type_obj = get_post_type_object( $post_type );
2681 2712
 		$title = sprintf( $args['posttypetitle'], get_bloginfo( 'name' ), $args['separator'], $post_type_obj->labels->name );
@@ -2710,13 +2741,15 @@  discard block
 block discarded – undo
2710 2741
 	} elseif ( is_post_type_archive() ) {
2711 2742
 		$title = sprintf( $args['posttypetitle'], get_bloginfo('name'), $args['separator'], post_type_archive_title( '', false ) );
2712 2743
 		$post_type_obj = get_queried_object();
2713
-		if ( $post_type_obj )
2714
-			$href = get_post_type_archive_feed_link( $post_type_obj->name );
2744
+		if ( $post_type_obj ) {
2745
+					$href = get_post_type_archive_feed_link( $post_type_obj->name );
2746
+		}
2715 2747
 	}
2716 2748
 
2717
-	if ( isset($title) && isset($href) )
2718
-		echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2719
-}
2749
+	if ( isset($title) && isset($href) ) {
2750
+			echo '<link rel="alternate" type="' . feed_content_type() . '" title="' . esc_attr( $title ) . '" href="' . esc_url( $href ) . '" />' . "\n";
2751
+	}
2752
+	}
2720 2753
 
2721 2754
 /**
2722 2755
  * Display the link to the Really Simple Discovery service endpoint.
@@ -2756,9 +2789,10 @@  discard block
 block discarded – undo
2756 2789
  */
2757 2790
 function noindex() {
2758 2791
 	// If the blog is not public, tell robots to go away.
2759
-	if ( '0' == get_option('blog_public') )
2760
-		wp_no_robots();
2761
-}
2792
+	if ( '0' == get_option('blog_public') ) {
2793
+			wp_no_robots();
2794
+	}
2795
+	}
2762 2796
 
2763 2797
 /**
2764 2798
  * Display a noindex meta tag.
@@ -3051,8 +3085,9 @@  discard block
 block discarded – undo
3051 3085
  * @param array  $settings  See _WP_Editors::editor().
3052 3086
  */
3053 3087
 function wp_editor( $content, $editor_id, $settings = array() ) {
3054
-	if ( ! class_exists( '_WP_Editors', false ) )
3055
-		require( ABSPATH . WPINC . '/class-wp-editor.php' );
3088
+	if ( ! class_exists( '_WP_Editors', false ) ) {
3089
+			require( ABSPATH . WPINC . '/class-wp-editor.php' );
3090
+	}
3056 3091
 	_WP_Editors::editor($content, $editor_id, $settings);
3057 3092
 }
3058 3093
 
@@ -3078,8 +3113,9 @@  discard block
 block discarded – undo
3078 3113
 	 */
3079 3114
 	$query = apply_filters( 'get_search_query', get_query_var( 's' ) );
3080 3115
 
3081
-	if ( $escaped )
3082
-		$query = esc_attr( $query );
3116
+	if ( $escaped ) {
3117
+			$query = esc_attr( $query );
3118
+	}
3083 3119
 	return $query;
3084 3120
 }
3085 3121
 
@@ -3115,15 +3151,18 @@  discard block
 block discarded – undo
3115 3151
 function get_language_attributes( $doctype = 'html' ) {
3116 3152
 	$attributes = array();
3117 3153
 
3118
-	if ( function_exists( 'is_rtl' ) && is_rtl() )
3119
-		$attributes[] = 'dir="rtl"';
3154
+	if ( function_exists( 'is_rtl' ) && is_rtl() ) {
3155
+			$attributes[] = 'dir="rtl"';
3156
+	}
3120 3157
 
3121 3158
 	if ( $lang = get_bloginfo('language') ) {
3122
-		if ( get_option('html_type') == 'text/html' || $doctype == 'html' )
3123
-			$attributes[] = "lang=\"$lang\"";
3159
+		if ( get_option('html_type') == 'text/html' || $doctype == 'html' ) {
3160
+					$attributes[] = "lang=\"$lang\"";
3161
+		}
3124 3162
 
3125
-		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' )
3126
-			$attributes[] = "xml:lang=\"$lang\"";
3163
+		if ( get_option('html_type') != 'text/html' || $doctype == 'xhtml' ) {
3164
+					$attributes[] = "xml:lang=\"$lang\"";
3165
+		}
3127 3166
 	}
3128 3167
 
3129 3168
 	$output = implode(' ', $attributes);
@@ -3312,8 +3351,9 @@  discard block
 block discarded – undo
3312 3351
 	if ( $args['prev_next'] && $current && 1 < $current ) :
3313 3352
 		$link = str_replace( '%_%', 2 == $current ? '' : $args['format'], $args['base'] );
3314 3353
 		$link = str_replace( '%#%', $current - 1, $link );
3315
-		if ( $add_args )
3316
-			$link = add_query_arg( $add_args, $link );
3354
+		if ( $add_args ) {
3355
+					$link = add_query_arg( $add_args, $link );
3356
+		}
3317 3357
 		$link .= $args['add_fragment'];
3318 3358
 
3319 3359
 		/**
@@ -3329,12 +3369,15 @@  discard block
 block discarded – undo
3329 3369
 		if ( $n == $current ) :
3330 3370
 			$page_links[] = "<span class='page-numbers current'>" . $args['before_page_number'] . number_format_i18n( $n ) . $args['after_page_number'] . "</span>";
3331 3371
 			$dots = true;
3332
-		else :
3372
+		else {
3373
+			:
3333 3374
 			if ( $args['show_all'] || ( $n <= $end_size || ( $current && $n >= $current - $mid_size && $n <= $current + $mid_size ) || $n > $total - $end_size ) ) :
3334 3375
 				$link = str_replace( '%_%', 1 == $n ? '' : $args['format'], $args['base'] );
3376
+		}
3335 3377
 				$link = str_replace( '%#%', $n, $link );
3336
-				if ( $add_args )
3337
-					$link = add_query_arg( $add_args, $link );
3378
+				if ( $add_args ) {
3379
+									$link = add_query_arg( $add_args, $link );
3380
+				}
3338 3381
 				$link .= $args['add_fragment'];
3339 3382
 
3340 3383
 				/** This filter is documented in wp-includes/general-template.php */
@@ -3349,8 +3392,9 @@  discard block
 block discarded – undo
3349 3392
 	if ( $args['prev_next'] && $current && $current < $total ) :
3350 3393
 		$link = str_replace( '%_%', $args['format'], $args['base'] );
3351 3394
 		$link = str_replace( '%#%', $current + 1, $link );
3352
-		if ( $add_args )
3353
-			$link = add_query_arg( $add_args, $link );
3395
+		if ( $add_args ) {
3396
+					$link = add_query_arg( $add_args, $link );
3397
+		}
3354 3398
 		$link .= $args['add_fragment'];
3355 3399
 
3356 3400
 		/** This filter is documented in wp-includes/general-template.php */
@@ -3402,8 +3446,9 @@  discard block
 block discarded – undo
3402 3446
 function wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() ) {
3403 3447
 	global $_wp_admin_css_colors;
3404 3448
 
3405
-	if ( !isset($_wp_admin_css_colors) )
3406
-		$_wp_admin_css_colors = array();
3449
+	if ( !isset($_wp_admin_css_colors) ) {
3450
+			$_wp_admin_css_colors = array();
3451
+	}
3407 3452
 
3408 3453
 	$_wp_admin_css_colors[$key] = (object) array(
3409 3454
 		'name' => $name,
@@ -3531,10 +3576,13 @@  discard block
 block discarded – undo
3531 3576
 	$handle = 0 === strpos( $file, 'css/' ) ? substr( $file, 4 ) : $file;
3532 3577
 
3533 3578
 	if ( wp_styles()->query( $handle ) ) {
3534
-		if ( $force_echo || did_action( 'wp_print_styles' ) ) // we already printed the style queue. Print this one immediately
3579
+		if ( $force_echo || did_action( 'wp_print_styles' ) ) {
3580
+			// we already printed the style queue. Print this one immediately
3535 3581
 			wp_print_styles( $handle );
3536
-		else // Add to style queue
3582
+		} else {
3583
+			// Add to style queue
3537 3584
 			wp_enqueue_style( $handle );
3585
+		}
3538 3586
 		return;
3539 3587
 	}
3540 3588
 
@@ -3570,9 +3618,10 @@  discard block
 block discarded – undo
3570 3618
 	wp_enqueue_script( 'thickbox' );
3571 3619
 	wp_enqueue_style( 'thickbox' );
3572 3620
 
3573
-	if ( is_network_admin() )
3574
-		add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3575
-}
3621
+	if ( is_network_admin() ) {
3622
+			add_action( 'admin_head', '_thickbox_path_admin_subfolder' );
3623
+	}
3624
+	}
3576 3625
 
3577 3626
 /**
3578 3627
  * Displays the XHTML generator that is generated on the wp_head hook.
@@ -3631,8 +3680,9 @@  discard block
 block discarded – undo
3631 3680
 	if ( empty( $type ) ) {
3632 3681
 
3633 3682
 		$current_filter = current_filter();
3634
-		if ( empty( $current_filter ) )
3635
-			return;
3683
+		if ( empty( $current_filter ) ) {
3684
+					return;
3685
+		}
3636 3686
 
3637 3687
 		switch ( $current_filter ) {
3638 3688
 			case 'rss2_head' :
@@ -3755,13 +3805,15 @@  discard block
 block discarded – undo
3755 3805
  * @return string html attribute or empty string
3756 3806
  */
3757 3807
 function __checked_selected_helper( $helper, $current, $echo, $type ) {
3758
-	if ( (string) $helper === (string) $current )
3759
-		$result = " $type='$type'";
3760
-	else
3761
-		$result = '';
3808
+	if ( (string) $helper === (string) $current ) {
3809
+			$result = " $type='$type'";
3810
+	} else {
3811
+			$result = '';
3812
+	}
3762 3813
 
3763
-	if ( $echo )
3764
-		echo $result;
3814
+	if ( $echo ) {
3815
+			echo $result;
3816
+	}
3765 3817
 
3766 3818
 	return $result;
3767 3819
 }
@@ -3777,11 +3829,13 @@  discard block
 block discarded – undo
3777 3829
  * @return array $settings
3778 3830
  */
3779 3831
 function wp_heartbeat_settings( $settings ) {
3780
-	if ( ! is_admin() )
3781
-		$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3832
+	if ( ! is_admin() ) {
3833
+			$settings['ajaxurl'] = admin_url( 'admin-ajax.php', 'relative' );
3834
+	}
3782 3835
 
3783
-	if ( is_user_logged_in() )
3784
-		$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3836
+	if ( is_user_logged_in() ) {
3837
+			$settings['nonce'] = wp_create_nonce( 'heartbeat-nonce' );
3838
+	}
3785 3839
 
3786 3840
 	return $settings;
3787 3841
 }
Please login to merge, or discard this patch.
src/wp-includes/media.php 3 patches
Doc Comments   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
  *
300 300
  * @param int        $width  Image width in pixels.
301 301
  * @param int        $height Image height in pixels.
302
- * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
302
+ * @param boolean $crop   Optional. Whether to crop images to specified width and height or resize.
303 303
  *                           An array can specify positioning of the crop area. Default false.
304 304
  */
305 305
 function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
  *                                    width and height values in pixels (in that order). Default 'medium'.
944 944
  * @param array        $image_meta    Optional. The image meta data as returned by 'wp_get_attachment_metadata()'.
945 945
  *                                    Default null.
946
- * @return string|bool A 'srcset' value string or false.
946
+ * @return false|string A 'srcset' value string or false.
947 947
  */
948 948
 function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) {
949 949
 	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
@@ -972,7 +972,7 @@  discard block
 block discarded – undo
972 972
  * @param string $image_src     The 'src' of the image.
973 973
  * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
974 974
  * @param int    $attachment_id Optional. The image attachment ID to pass to the filter. Default 0.
975
- * @return string|bool          The 'srcset' attribute value. False on error or when only one source exists.
975
+ * @return false|string          The 'srcset' attribute value. False on error or when only one source exists.
976 976
  */
977 977
 function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) {
978 978
 	/**
@@ -3495,7 +3495,7 @@  discard block
 block discarded – undo
3495 3495
  * @since 3.6.0
3496 3496
  *
3497 3497
  * @param string      $type Mime type.
3498
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3498
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
3499 3499
  * @return array Found attachments.
3500 3500
  */
3501 3501
 function get_attached_media( $type, $post = 0 ) {
@@ -3634,7 +3634,7 @@  discard block
 block discarded – undo
3634 3634
  *
3635 3635
  * @since 3.6.0
3636 3636
  *
3637
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3637
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global $post.
3638 3638
  * @param bool        $html Optional. Whether to return HTML or data. Default is true.
3639 3639
  * @return string|array Gallery data and srcs parsed from the expanded shortcode.
3640 3640
  */
@@ -3661,7 +3661,7 @@  discard block
 block discarded – undo
3661 3661
  *
3662 3662
  * @see get_post_galleries()
3663 3663
  *
3664
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3664
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global `$post`.
3665 3665
  * @return array A list of lists, each containing image srcs parsed.
3666 3666
  *               from an expanded shortcode
3667 3667
  */
@@ -3677,7 +3677,7 @@  discard block
 block discarded – undo
3677 3677
  *
3678 3678
  * @see get_post_gallery()
3679 3679
  *
3680
- * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3680
+ * @param integer $post Optional. Post ID or WP_Post object. Default is global `$post`.
3681 3681
  * @return array A list of a gallery's image srcs in order.
3682 3682
  */
3683 3683
 function get_post_gallery_images( $post = 0 ) {
@@ -3762,7 +3762,7 @@  discard block
 block discarded – undo
3762 3762
  *
3763 3763
  * @global string $wp_version
3764 3764
  *
3765
- * @return array The relevant CSS file URLs.
3765
+ * @return string[] The relevant CSS file URLs.
3766 3766
  */
3767 3767
 function wpview_media_sandbox_styles() {
3768 3768
  	$version = 'ver=' . $GLOBALS['wp_version'];
Please login to merge, or discard this patch.
Spacing   +907 added lines, -907 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
  */
18 18
 function wp_get_additional_image_sizes() {
19 19
 	global $_wp_additional_image_sizes;
20
-	if ( ! $_wp_additional_image_sizes ) {
20
+	if ( ! $_wp_additional_image_sizes) {
21 21
 		$_wp_additional_image_sizes = array();
22 22
 	}
23 23
 	return $_wp_additional_image_sizes;
@@ -54,41 +54,41 @@  discard block
 block discarded – undo
54 54
  *                              (like inserting into an editor). Default null.
55 55
  * @return array Width and height of what the result image should resize to.
56 56
  */
57
-function image_constrain_size_for_editor( $width, $height, $size = 'medium', $context = null ) {
57
+function image_constrain_size_for_editor($width, $height, $size = 'medium', $context = null) {
58 58
 	global $content_width;
59 59
 
60 60
 	$_wp_additional_image_sizes = wp_get_additional_image_sizes();
61 61
 
62
-	if ( ! $context )
62
+	if ( ! $context)
63 63
 		$context = is_admin() ? 'edit' : 'display';
64 64
 
65
-	if ( is_array($size) ) {
65
+	if (is_array($size)) {
66 66
 		$max_width = $size[0];
67 67
 		$max_height = $size[1];
68 68
 	}
69
-	elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
69
+	elseif ($size == 'thumb' || $size == 'thumbnail') {
70 70
 		$max_width = intval(get_option('thumbnail_size_w'));
71 71
 		$max_height = intval(get_option('thumbnail_size_h'));
72 72
 		// last chance thumbnail size defaults
73
-		if ( !$max_width && !$max_height ) {
73
+		if ( ! $max_width && ! $max_height) {
74 74
 			$max_width = 128;
75 75
 			$max_height = 96;
76 76
 		}
77 77
 	}
78
-	elseif ( $size == 'medium' ) {
78
+	elseif ($size == 'medium') {
79 79
 		$max_width = intval(get_option('medium_size_w'));
80 80
 		$max_height = intval(get_option('medium_size_h'));
81 81
 
82 82
 	}
83
-	elseif ( $size == 'medium_large' ) {
84
-		$max_width = intval( get_option( 'medium_large_size_w' ) );
85
-		$max_height = intval( get_option( 'medium_large_size_h' ) );
83
+	elseif ($size == 'medium_large') {
84
+		$max_width = intval(get_option('medium_large_size_w'));
85
+		$max_height = intval(get_option('medium_large_size_h'));
86 86
 
87
-		if ( intval( $content_width ) > 0 ) {
88
-			$max_width = min( intval( $content_width ), $max_width );
87
+		if (intval($content_width) > 0) {
88
+			$max_width = min(intval($content_width), $max_width);
89 89
 		}
90 90
 	}
91
-	elseif ( $size == 'large' ) {
91
+	elseif ($size == 'large') {
92 92
 		/*
93 93
 		 * We're inserting a large size image into the editor. If it's a really
94 94
 		 * big image we'll scale it down to fit reasonably within the editor
@@ -97,15 +97,15 @@  discard block
 block discarded – undo
97 97
 		 */
98 98
 		$max_width = intval(get_option('large_size_w'));
99 99
 		$max_height = intval(get_option('large_size_h'));
100
-		if ( intval($content_width) > 0 ) {
101
-			$max_width = min( intval($content_width), $max_width );
100
+		if (intval($content_width) > 0) {
101
+			$max_width = min(intval($content_width), $max_width);
102 102
 		}
103
-	} elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ) ) ) {
104
-		$max_width = intval( $_wp_additional_image_sizes[$size]['width'] );
105
-		$max_height = intval( $_wp_additional_image_sizes[$size]['height'] );
103
+	} elseif ( ! empty($_wp_additional_image_sizes) && in_array($size, array_keys($_wp_additional_image_sizes))) {
104
+		$max_width = intval($_wp_additional_image_sizes[$size]['width']);
105
+		$max_height = intval($_wp_additional_image_sizes[$size]['height']);
106 106
 		// Only in admin. Assume that theme authors know what they're doing.
107
-		if ( intval( $content_width ) > 0 && 'edit' === $context ) {
108
-			$max_width = min( intval( $content_width ), $max_width );
107
+		if (intval($content_width) > 0 && 'edit' === $context) {
108
+			$max_width = min(intval($content_width), $max_width);
109 109
 		}
110 110
 	}
111 111
 	// $size == 'full' has no constraint
@@ -126,9 +126,9 @@  discard block
 block discarded – undo
126 126
 	 *                                     Possible values are 'display' (like in a theme)
127 127
 	 *                                     or 'edit' (like inserting into an editor).
128 128
 	 */
129
-	list( $max_width, $max_height ) = apply_filters( 'editor_max_image_size', array( $max_width, $max_height ), $size, $context );
129
+	list($max_width, $max_height) = apply_filters('editor_max_image_size', array($max_width, $max_height), $size, $context);
130 130
 
131
-	return wp_constrain_dimensions( $width, $height, $max_width, $max_height );
131
+	return wp_constrain_dimensions($width, $height, $max_width, $max_height);
132 132
 }
133 133
 
134 134
 /**
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
  * @param int|string $height Image height in pixels.
149 149
  * @return string HTML attributes for width and, or height.
150 150
  */
151
-function image_hwstring( $width, $height ) {
151
+function image_hwstring($width, $height) {
152 152
 	$out = '';
153 153
 	if ($width)
154 154
 		$out .= 'width="'.intval($width).'" ';
@@ -182,8 +182,8 @@  discard block
 block discarded – undo
182 182
  * @return false|array Array containing the image URL, width, height, and boolean for whether
183 183
  *                     the image is an intermediate size. False on failure.
184 184
  */
185
-function image_downsize( $id, $size = 'medium' ) {
186
-	$is_image = wp_attachment_is_image( $id );
185
+function image_downsize($id, $size = 'medium') {
186
+	$is_image = wp_attachment_is_image($id);
187 187
 
188 188
 	/**
189 189
 	 * Filters whether to preempt the output of image_downsize().
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	 * @param array|string $size     Size of image. Image size or array of width and height values (in that order).
199 199
 	 *                               Default 'medium'.
200 200
 	 */
201
-	if ( $out = apply_filters( 'image_downsize', false, $id, $size ) ) {
201
+	if ($out = apply_filters('image_downsize', false, $id, $size)) {
202 202
 		return $out;
203 203
 	}
204 204
 
@@ -210,9 +210,9 @@  discard block
 block discarded – undo
210 210
 
211 211
 	// If the file isn't an image, attempt to replace its URL with a rendered image from its meta.
212 212
 	// Otherwise, a non-image type could be returned.
213
-	if ( ! $is_image ) {
214
-		if ( ! empty( $meta['sizes'] ) ) {
215
-			$img_url = str_replace( $img_url_basename, $meta['sizes']['full']['file'], $img_url );
213
+	if ( ! $is_image) {
214
+		if ( ! empty($meta['sizes'])) {
215
+			$img_url = str_replace($img_url_basename, $meta['sizes']['full']['file'], $img_url);
216 216
 			$img_url_basename = $meta['sizes']['full']['file'];
217 217
 			$width = $meta['sizes']['full']['width'];
218 218
 			$height = $meta['sizes']['full']['height'];
@@ -222,32 +222,32 @@  discard block
 block discarded – undo
222 222
 	}
223 223
 
224 224
 	// try for a new style intermediate size
225
-	if ( $intermediate = image_get_intermediate_size($id, $size) ) {
225
+	if ($intermediate = image_get_intermediate_size($id, $size)) {
226 226
 		$img_url = str_replace($img_url_basename, $intermediate['file'], $img_url);
227 227
 		$width = $intermediate['width'];
228 228
 		$height = $intermediate['height'];
229 229
 		$is_intermediate = true;
230 230
 	}
231
-	elseif ( $size == 'thumbnail' ) {
231
+	elseif ($size == 'thumbnail') {
232 232
 		// fall back to the old thumbnail
233
-		if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
233
+		if (($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file)) {
234 234
 			$img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
235 235
 			$width = $info[0];
236 236
 			$height = $info[1];
237 237
 			$is_intermediate = true;
238 238
 		}
239 239
 	}
240
-	if ( !$width && !$height && isset( $meta['width'], $meta['height'] ) ) {
240
+	if ( ! $width && ! $height && isset($meta['width'], $meta['height'])) {
241 241
 		// any other type: use the real image
242 242
 		$width = $meta['width'];
243 243
 		$height = $meta['height'];
244 244
 	}
245 245
 
246
-	if ( $img_url) {
246
+	if ($img_url) {
247 247
 		// we have the actual image size, but might need to further constrain it if content_width is narrower
248
-		list( $width, $height ) = image_constrain_size_for_editor( $width, $height, $size );
248
+		list($width, $height) = image_constrain_size_for_editor($width, $height, $size);
249 249
 
250
-		return array( $img_url, $width, $height, $is_intermediate );
250
+		return array($img_url, $width, $height, $is_intermediate);
251 251
 	}
252 252
 	return false;
253 253
 
@@ -274,12 +274,12 @@  discard block
 block discarded – undo
274 274
  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
275 275
  *                           An array can specify positioning of the crop area. Default false.
276 276
  */
277
-function add_image_size( $name, $width = 0, $height = 0, $crop = false ) {
277
+function add_image_size($name, $width = 0, $height = 0, $crop = false) {
278 278
 	global $_wp_additional_image_sizes;
279 279
 
280
-	$_wp_additional_image_sizes[ $name ] = array(
281
-		'width'  => absint( $width ),
282
-		'height' => absint( $height ),
280
+	$_wp_additional_image_sizes[$name] = array(
281
+		'width'  => absint($width),
282
+		'height' => absint($height),
283 283
 		'crop'   => $crop,
284 284
 	);
285 285
 }
@@ -292,9 +292,9 @@  discard block
 block discarded – undo
292 292
  * @param string $name The image size to check.
293 293
  * @return bool True if the image size exists, false if not.
294 294
  */
295
-function has_image_size( $name ) {
295
+function has_image_size($name) {
296 296
 	$sizes = wp_get_additional_image_sizes();
297
-	return isset( $sizes[ $name ] );
297
+	return isset($sizes[$name]);
298 298
 }
299 299
 
300 300
 /**
@@ -307,11 +307,11 @@  discard block
 block discarded – undo
307 307
  * @param string $name The image size to remove.
308 308
  * @return bool True if the image size was successfully removed, false on failure.
309 309
  */
310
-function remove_image_size( $name ) {
310
+function remove_image_size($name) {
311 311
 	global $_wp_additional_image_sizes;
312 312
 
313
-	if ( isset( $_wp_additional_image_sizes[ $name ] ) ) {
314
-		unset( $_wp_additional_image_sizes[ $name ] );
313
+	if (isset($_wp_additional_image_sizes[$name])) {
314
+		unset($_wp_additional_image_sizes[$name]);
315 315
 		return true;
316 316
 	}
317 317
 
@@ -330,8 +330,8 @@  discard block
 block discarded – undo
330 330
  * @param bool|array $crop   Optional. Whether to crop images to specified width and height or resize.
331 331
  *                           An array can specify positioning of the crop area. Default false.
332 332
  */
333
-function set_post_thumbnail_size( $width = 0, $height = 0, $crop = false ) {
334
-	add_image_size( 'post-thumbnail', $width, $height, $crop );
333
+function set_post_thumbnail_size($width = 0, $height = 0, $crop = false) {
334
+	add_image_size('post-thumbnail', $width, $height, $crop);
335 335
 }
336 336
 
337 337
 /**
@@ -357,14 +357,14 @@  discard block
 block discarded – undo
357 357
  *                            (in that order). Default 'medium'.
358 358
  * @return string HTML IMG element for given image attachment
359 359
  */
360
-function get_image_tag( $id, $alt, $title, $align, $size = 'medium' ) {
360
+function get_image_tag($id, $alt, $title, $align, $size = 'medium') {
361 361
 
362
-	list( $img_src, $width, $height ) = image_downsize($id, $size);
362
+	list($img_src, $width, $height) = image_downsize($id, $size);
363 363
 	$hwstring = image_hwstring($width, $height);
364 364
 
365
-	$title = $title ? 'title="' . esc_attr( $title ) . '" ' : '';
365
+	$title = $title ? 'title="'.esc_attr($title).'" ' : '';
366 366
 
367
-	$class = 'align' . esc_attr($align) .' size-' . esc_attr($size) . ' wp-image-' . $id;
367
+	$class = 'align'.esc_attr($align).' size-'.esc_attr($size).' wp-image-'.$id;
368 368
 
369 369
 	/**
370 370
 	 * Filters the value of the attachment's image tag class attribute.
@@ -377,9 +377,9 @@  discard block
 block discarded – undo
377 377
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
378 378
 	 *                            Default 'medium'.
379 379
 	 */
380
-	$class = apply_filters( 'get_image_tag_class', $class, $id, $align, $size );
380
+	$class = apply_filters('get_image_tag_class', $class, $id, $align, $size);
381 381
 
382
-	$html = '<img src="' . esc_attr($img_src) . '" alt="' . esc_attr($alt) . '" ' . $title . $hwstring . 'class="' . $class . '" />';
382
+	$html = '<img src="'.esc_attr($img_src).'" alt="'.esc_attr($alt).'" '.$title.$hwstring.'class="'.$class.'" />';
383 383
 
384 384
 	/**
385 385
 	 * Filters the HTML content for the image tag.
@@ -394,7 +394,7 @@  discard block
 block discarded – undo
394 394
 	 * @param string|array $size  Size of image. Image size or array of width and height values (in that order).
395 395
 	 *                            Default 'medium'.
396 396
 	 */
397
-	return apply_filters( 'get_image_tag', $html, $id, $alt, $title, $align, $size );
397
+	return apply_filters('get_image_tag', $html, $id, $alt, $title, $align, $size);
398 398
 }
399 399
 
400 400
 /**
@@ -411,28 +411,28 @@  discard block
 block discarded – undo
411 411
  * @param int $max_height     Optional. Max height in pixels to constrain to. Default 0.
412 412
  * @return array First item is the width, the second item is the height.
413 413
  */
414
-function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) {
415
-	if ( !$max_width && !$max_height )
416
-		return array( $current_width, $current_height );
414
+function wp_constrain_dimensions($current_width, $current_height, $max_width = 0, $max_height = 0) {
415
+	if ( ! $max_width && ! $max_height)
416
+		return array($current_width, $current_height);
417 417
 
418 418
 	$width_ratio = $height_ratio = 1.0;
419 419
 	$did_width = $did_height = false;
420 420
 
421
-	if ( $max_width > 0 && $current_width > 0 && $current_width > $max_width ) {
421
+	if ($max_width > 0 && $current_width > 0 && $current_width > $max_width) {
422 422
 		$width_ratio = $max_width / $current_width;
423 423
 		$did_width = true;
424 424
 	}
425 425
 
426
-	if ( $max_height > 0 && $current_height > 0 && $current_height > $max_height ) {
426
+	if ($max_height > 0 && $current_height > 0 && $current_height > $max_height) {
427 427
 		$height_ratio = $max_height / $current_height;
428 428
 		$did_height = true;
429 429
 	}
430 430
 
431 431
 	// Calculate the larger/smaller ratios
432
-	$smaller_ratio = min( $width_ratio, $height_ratio );
433
-	$larger_ratio  = max( $width_ratio, $height_ratio );
432
+	$smaller_ratio = min($width_ratio, $height_ratio);
433
+	$larger_ratio  = max($width_ratio, $height_ratio);
434 434
 
435
-	if ( (int) round( $current_width * $larger_ratio ) > $max_width || (int) round( $current_height * $larger_ratio ) > $max_height ) {
435
+	if ((int) round($current_width * $larger_ratio) > $max_width || (int) round($current_height * $larger_ratio) > $max_height) {
436 436
  		// The larger ratio is too big. It would result in an overflow.
437 437
 		$ratio = $smaller_ratio;
438 438
 	} else {
@@ -441,20 +441,20 @@  discard block
 block discarded – undo
441 441
 	}
442 442
 
443 443
 	// Very small dimensions may result in 0, 1 should be the minimum.
444
-	$w = max ( 1, (int) round( $current_width  * $ratio ) );
445
-	$h = max ( 1, (int) round( $current_height * $ratio ) );
444
+	$w = max(1, (int) round($current_width * $ratio));
445
+	$h = max(1, (int) round($current_height * $ratio));
446 446
 
447 447
 	// Sometimes, due to rounding, we'll end up with a result like this: 465x700 in a 177x177 box is 117x176... a pixel short
448 448
 	// We also have issues with recursive calls resulting in an ever-changing result. Constraining to the result of a constraint should yield the original result.
449 449
 	// Thus we look for dimensions that are one pixel shy of the max value and bump them up
450 450
 
451 451
 	// Note: $did_width means it is possible $smaller_ratio == $width_ratio.
452
-	if ( $did_width && $w == $max_width - 1 ) {
452
+	if ($did_width && $w == $max_width - 1) {
453 453
 		$w = $max_width; // Round it up
454 454
 	}
455 455
 
456 456
 	// Note: $did_height means it is possible $smaller_ratio == $height_ratio.
457
-	if ( $did_height && $h == $max_height - 1 ) {
457
+	if ($did_height && $h == $max_height - 1) {
458 458
 		$h = $max_height; // Round it up
459 459
 	}
460 460
 
@@ -469,7 +469,7 @@  discard block
 block discarded – undo
469 469
 	 * @param int 	$max_width      The maximum width permitted.
470 470
 	 * @param int 	$max_height     The maximum height permitted.
471 471
 	 */
472
-	return apply_filters( 'wp_constrain_dimensions', array( $w, $h ), $current_width, $current_height, $max_width, $max_height );
472
+	return apply_filters('wp_constrain_dimensions', array($w, $h), $current_width, $current_height, $max_width, $max_height);
473 473
 }
474 474
 
475 475
 /**
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
  *                           An array can specify positioning of the crop area. Default false.
497 497
  * @return false|array False on failure. Returned array matches parameters for `imagecopyresampled()`.
498 498
  */
499
-function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
499
+function image_resize_dimensions($orig_w, $orig_h, $dest_w, $dest_h, $crop = false) {
500 500
 
501 501
 	if ($orig_w <= 0 || $orig_h <= 0)
502 502
 		return false;
@@ -520,22 +520,22 @@  discard block
 block discarded – undo
520 520
 	 * @param bool|array $crop   Whether to crop image to specified width and height or resize.
521 521
 	 *                           An array can specify positioning of the crop area. Default false.
522 522
 	 */
523
-	$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
524
-	if ( null !== $output )
523
+	$output = apply_filters('image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop);
524
+	if (null !== $output)
525 525
 		return $output;
526 526
 
527
-	if ( $crop ) {
527
+	if ($crop) {
528 528
 		// crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
529 529
 		$aspect_ratio = $orig_w / $orig_h;
530 530
 		$new_w = min($dest_w, $orig_w);
531 531
 		$new_h = min($dest_h, $orig_h);
532 532
 
533
-		if ( ! $new_w ) {
534
-			$new_w = (int) round( $new_h * $aspect_ratio );
533
+		if ( ! $new_w) {
534
+			$new_w = (int) round($new_h * $aspect_ratio);
535 535
 		}
536 536
 
537
-		if ( ! $new_h ) {
538
-			$new_h = (int) round( $new_w / $aspect_ratio );
537
+		if ( ! $new_h) {
538
+			$new_h = (int) round($new_w / $aspect_ratio);
539 539
 		}
540 540
 
541 541
 		$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
@@ -543,26 +543,26 @@  discard block
 block discarded – undo
543 543
 		$crop_w = round($new_w / $size_ratio);
544 544
 		$crop_h = round($new_h / $size_ratio);
545 545
 
546
-		if ( ! is_array( $crop ) || count( $crop ) !== 2 ) {
547
-			$crop = array( 'center', 'center' );
546
+		if ( ! is_array($crop) || count($crop) !== 2) {
547
+			$crop = array('center', 'center');
548 548
 		}
549 549
 
550
-		list( $x, $y ) = $crop;
550
+		list($x, $y) = $crop;
551 551
 
552
-		if ( 'left' === $x ) {
552
+		if ('left' === $x) {
553 553
 			$s_x = 0;
554
-		} elseif ( 'right' === $x ) {
554
+		} elseif ('right' === $x) {
555 555
 			$s_x = $orig_w - $crop_w;
556 556
 		} else {
557
-			$s_x = floor( ( $orig_w - $crop_w ) / 2 );
557
+			$s_x = floor(($orig_w - $crop_w) / 2);
558 558
 		}
559 559
 
560
-		if ( 'top' === $y ) {
560
+		if ('top' === $y) {
561 561
 			$s_y = 0;
562
-		} elseif ( 'bottom' === $y ) {
562
+		} elseif ('bottom' === $y) {
563 563
 			$s_y = $orig_h - $crop_h;
564 564
 		} else {
565
-			$s_y = floor( ( $orig_h - $crop_h ) / 2 );
565
+			$s_y = floor(($orig_h - $crop_h) / 2);
566 566
 		}
567 567
 	} else {
568 568
 		// don't crop, just resize using $dest_w x $dest_h as a maximum bounding box
@@ -572,17 +572,17 @@  discard block
 block discarded – undo
572 572
 		$s_x = 0;
573 573
 		$s_y = 0;
574 574
 
575
-		list( $new_w, $new_h ) = wp_constrain_dimensions( $orig_w, $orig_h, $dest_w, $dest_h );
575
+		list($new_w, $new_h) = wp_constrain_dimensions($orig_w, $orig_h, $dest_w, $dest_h);
576 576
 	}
577 577
 
578 578
 	// if the resulting image would be the same size or larger we don't want to resize it
579
-	if ( $new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h ) {
579
+	if ($new_w >= $orig_w && $new_h >= $orig_h && $dest_w != $orig_w && $dest_h != $orig_h) {
580 580
 		return false;
581 581
 	}
582 582
 
583 583
 	// the return array matches the parameters to imagecopyresampled()
584 584
 	// int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
585
-	return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
585
+	return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
586 586
 
587 587
 }
588 588
 
@@ -602,17 +602,17 @@  discard block
 block discarded – undo
602 602
  *                       Default false.
603 603
  * @return false|array False, if no image was created. Metadata array on success.
604 604
  */
605
-function image_make_intermediate_size( $file, $width, $height, $crop = false ) {
606
-	if ( $width || $height ) {
607
-		$editor = wp_get_image_editor( $file );
605
+function image_make_intermediate_size($file, $width, $height, $crop = false) {
606
+	if ($width || $height) {
607
+		$editor = wp_get_image_editor($file);
608 608
 
609
-		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
609
+		if (is_wp_error($editor) || is_wp_error($editor->resize($width, $height, $crop)))
610 610
 			return false;
611 611
 
612 612
 		$resized_file = $editor->save();
613 613
 
614
-		if ( ! is_wp_error( $resized_file ) && $resized_file ) {
615
-			unset( $resized_file['path'] );
614
+		if ( ! is_wp_error($resized_file) && $resized_file) {
615
+			unset($resized_file['path']);
616 616
 			return $resized_file;
617 617
 		}
618 618
 	}
@@ -630,21 +630,21 @@  discard block
 block discarded – undo
630 630
  * @param int $target_height Height of the second image in pixels.
631 631
  * @return bool True if aspect ratios match within 1px. False if not.
632 632
  */
633
-function wp_image_matches_ratio( $source_width, $source_height, $target_width, $target_height ) {
633
+function wp_image_matches_ratio($source_width, $source_height, $target_width, $target_height) {
634 634
 	/*
635 635
 	 * To test for varying crops, we constrain the dimensions of the larger image
636 636
 	 * to the dimensions of the smaller image and see if they match.
637 637
 	 */
638
-	if ( $source_width > $target_width ) {
639
-		$constrained_size = wp_constrain_dimensions( $source_width, $source_height, $target_width );
640
-		$expected_size = array( $target_width, $target_height );
638
+	if ($source_width > $target_width) {
639
+		$constrained_size = wp_constrain_dimensions($source_width, $source_height, $target_width);
640
+		$expected_size = array($target_width, $target_height);
641 641
 	} else {
642
-		$constrained_size = wp_constrain_dimensions( $target_width, $target_height, $source_width );
643
-		$expected_size = array( $source_width, $source_height );
642
+		$constrained_size = wp_constrain_dimensions($target_width, $target_height, $source_width);
643
+		$expected_size = array($source_width, $source_height);
644 644
 	}
645 645
 
646 646
 	// If the image dimensions are within 1px of the expected size, we consider it a match.
647
-	$matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 );
647
+	$matched = (abs($constrained_size[0] - $expected_size[0]) <= 1 && abs($constrained_size[1] - $expected_size[1]) <= 1);
648 648
 
649 649
 	return $matched;
650 650
 }
@@ -685,79 +685,79 @@  discard block
 block discarded – undo
685 685
  *     @type string $url    Image's URL.
686 686
  * }
687 687
  */
688
-function image_get_intermediate_size( $post_id, $size = 'thumbnail' ) {
689
-	if ( ! $size || ! is_array( $imagedata = wp_get_attachment_metadata( $post_id ) ) || empty( $imagedata['sizes'] )  ) {
688
+function image_get_intermediate_size($post_id, $size = 'thumbnail') {
689
+	if ( ! $size || ! is_array($imagedata = wp_get_attachment_metadata($post_id)) || empty($imagedata['sizes'])) {
690 690
 		return false;
691 691
 	}
692 692
 
693 693
 	$data = array();
694 694
 
695 695
 	// Find the best match when '$size' is an array.
696
-	if ( is_array( $size ) ) {
696
+	if (is_array($size)) {
697 697
 		$candidates = array();
698 698
 
699
-		if ( ! isset( $imagedata['file'] ) && isset( $imagedata['sizes']['full'] ) ) {
699
+		if ( ! isset($imagedata['file']) && isset($imagedata['sizes']['full'])) {
700 700
 			$imagedata['height'] = $imagedata['sizes']['full']['height'];
701 701
 			$imagedata['width']  = $imagedata['sizes']['full']['width'];
702 702
 		}
703 703
 
704
-		foreach ( $imagedata['sizes'] as $_size => $data ) {
704
+		foreach ($imagedata['sizes'] as $_size => $data) {
705 705
 			// If there's an exact match to an existing image size, short circuit.
706
-			if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) {
707
-				$candidates[ $data['width'] * $data['height'] ] = $data;
706
+			if ($data['width'] == $size[0] && $data['height'] == $size[1]) {
707
+				$candidates[$data['width'] * $data['height']] = $data;
708 708
 				break;
709 709
 			}
710 710
 
711 711
 			// If it's not an exact match, consider larger sizes with the same aspect ratio.
712
-			if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
712
+			if ($data['width'] >= $size[0] && $data['height'] >= $size[1]) {
713 713
 				// If '0' is passed to either size, we test ratios against the original file.
714
-				if ( 0 === $size[0] || 0 === $size[1] ) {
715
-					$same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $imagedata['width'], $imagedata['height'] );
714
+				if (0 === $size[0] || 0 === $size[1]) {
715
+					$same_ratio = wp_image_matches_ratio($data['width'], $data['height'], $imagedata['width'], $imagedata['height']);
716 716
 				} else {
717
-					$same_ratio = wp_image_matches_ratio( $data['width'], $data['height'], $size[0], $size[1] );
717
+					$same_ratio = wp_image_matches_ratio($data['width'], $data['height'], $size[0], $size[1]);
718 718
 				}
719 719
 
720
-				if ( $same_ratio ) {
721
-					$candidates[ $data['width'] * $data['height'] ] = $data;
720
+				if ($same_ratio) {
721
+					$candidates[$data['width'] * $data['height']] = $data;
722 722
 				}
723 723
 			}
724 724
 		}
725 725
 
726
-		if ( ! empty( $candidates ) ) {
726
+		if ( ! empty($candidates)) {
727 727
 			// Sort the array by size if we have more than one candidate.
728
-			if ( 1 < count( $candidates ) ) {
729
-				ksort( $candidates );
728
+			if (1 < count($candidates)) {
729
+				ksort($candidates);
730 730
 			}
731 731
 
732
-			$data = array_shift( $candidates );
732
+			$data = array_shift($candidates);
733 733
 		/*
734 734
 		 * When the size requested is smaller than the thumbnail dimensions, we
735 735
 		 * fall back to the thumbnail size to maintain backwards compatibility with
736 736
 		 * pre 4.6 versions of WordPress.
737 737
 		 */
738
-		} elseif ( ! empty( $imagedata['sizes']['thumbnail'] ) && $imagedata['sizes']['thumbnail']['width'] >= $size[0] && $imagedata['sizes']['thumbnail']['width'] >= $size[1] ) {
738
+		} elseif ( ! empty($imagedata['sizes']['thumbnail']) && $imagedata['sizes']['thumbnail']['width'] >= $size[0] && $imagedata['sizes']['thumbnail']['width'] >= $size[1]) {
739 739
 			$data = $imagedata['sizes']['thumbnail'];
740 740
 		} else {
741 741
 			return false;
742 742
 		}
743 743
 
744 744
 		// Constrain the width and height attributes to the requested values.
745
-		list( $data['width'], $data['height'] ) = image_constrain_size_for_editor( $data['width'], $data['height'], $size );
745
+		list($data['width'], $data['height']) = image_constrain_size_for_editor($data['width'], $data['height'], $size);
746 746
 
747
-	} elseif ( ! empty( $imagedata['sizes'][ $size ] ) ) {
748
-		$data = $imagedata['sizes'][ $size ];
747
+	} elseif ( ! empty($imagedata['sizes'][$size])) {
748
+		$data = $imagedata['sizes'][$size];
749 749
 	}
750 750
 
751 751
 	// If we still don't have a match at this point, return false.
752
-	if ( empty( $data ) ) {
752
+	if (empty($data)) {
753 753
 		return false;
754 754
 	}
755 755
 
756 756
 	// include the full filesystem path of the intermediate file
757
-	if ( empty( $data['path'] ) && ! empty( $data['file'] ) && ! empty( $imagedata['file'] ) ) {
757
+	if (empty($data['path']) && ! empty($data['file']) && ! empty($imagedata['file'])) {
758 758
 		$file_url = wp_get_attachment_url($post_id);
759
-		$data['path'] = path_join( dirname($imagedata['file']), $data['file'] );
760
-		$data['url'] = path_join( dirname($file_url), $data['file'] );
759
+		$data['path'] = path_join(dirname($imagedata['file']), $data['file']);
760
+		$data['url'] = path_join(dirname($file_url), $data['file']);
761 761
 	}
762 762
 
763 763
 	/**
@@ -773,7 +773,7 @@  discard block
 block discarded – undo
773 773
 	 * @param string|array $size    Registered image size or flat array of initially-requested height and width
774 774
 	 *                              dimensions (in that order).
775 775
 	 */
776
-	return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
776
+	return apply_filters('image_get_intermediate_size', $data, $post_id, $size);
777 777
 }
778 778
 
779 779
 /**
@@ -786,8 +786,8 @@  discard block
 block discarded – undo
786 786
 function get_intermediate_image_sizes() {
787 787
 	$_wp_additional_image_sizes = wp_get_additional_image_sizes();
788 788
 	$image_sizes = array('thumbnail', 'medium', 'medium_large', 'large'); // Standard sizes
789
-	if ( ! empty( $_wp_additional_image_sizes ) ) {
790
-		$image_sizes = array_merge( $image_sizes, array_keys( $_wp_additional_image_sizes ) );
789
+	if ( ! empty($_wp_additional_image_sizes)) {
790
+		$image_sizes = array_merge($image_sizes, array_keys($_wp_additional_image_sizes));
791 791
 	}
792 792
 
793 793
 	/**
@@ -798,7 +798,7 @@  discard block
 block discarded – undo
798 798
 	 * @param array $image_sizes An array of intermediate image sizes. Defaults
799 799
 	 *                           are 'thumbnail', 'medium', 'medium_large', 'large'.
800 800
 	 */
801
-	return apply_filters( 'intermediate_image_sizes', $image_sizes );
801
+	return apply_filters('intermediate_image_sizes', $image_sizes);
802 802
 }
803 803
 
804 804
 /**
@@ -819,22 +819,22 @@  discard block
 block discarded – undo
819 819
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
820 820
  * @return false|array Returns an array (url, width, height, is_intermediate), or false, if no image is available.
821 821
  */
822
-function wp_get_attachment_image_src( $attachment_id, $size = 'thumbnail', $icon = false ) {
822
+function wp_get_attachment_image_src($attachment_id, $size = 'thumbnail', $icon = false) {
823 823
 	// get a thumbnail or intermediate image if there is one
824
-	$image = image_downsize( $attachment_id, $size );
825
-	if ( ! $image ) {
824
+	$image = image_downsize($attachment_id, $size);
825
+	if ( ! $image) {
826 826
 		$src = false;
827 827
 
828
-		if ( $icon && $src = wp_mime_type_icon( $attachment_id ) ) {
828
+		if ($icon && $src = wp_mime_type_icon($attachment_id)) {
829 829
 			/** This filter is documented in wp-includes/post.php */
830
-			$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
830
+			$icon_dir = apply_filters('icon_dir', ABSPATH.WPINC.'/images/media');
831 831
 
832
-			$src_file = $icon_dir . '/' . wp_basename( $src );
833
-			@list( $width, $height ) = getimagesize( $src_file );
832
+			$src_file = $icon_dir.'/'.wp_basename($src);
833
+			@list($width, $height) = getimagesize($src_file);
834 834
 		}
835 835
 
836
-		if ( $src && $width && $height ) {
837
-			$image = array( $src, $width, $height );
836
+		if ($src && $width && $height) {
837
+			$image = array($src, $width, $height);
838 838
 		}
839 839
 	}
840 840
 	/**
@@ -848,7 +848,7 @@  discard block
 block discarded – undo
848 848
 	 *                                    (in that order). Default 'thumbnail'.
849 849
 	 * @param bool         $icon          Whether the image should be treated as an icon. Default false.
850 850
 	 */
851
-	return apply_filters( 'wp_get_attachment_image_src', $image, $attachment_id, $size, $icon );
851
+	return apply_filters('wp_get_attachment_image_src', $image, $attachment_id, $size, $icon);
852 852
 }
853 853
 
854 854
 /**
@@ -871,35 +871,35 @@  discard block
 block discarded – undo
871 871
 function wp_get_attachment_image($attachment_id, $size = 'thumbnail', $icon = false, $attr = '') {
872 872
 	$html = '';
873 873
 	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
874
-	if ( $image ) {
874
+	if ($image) {
875 875
 		list($src, $width, $height) = $image;
876 876
 		$hwstring = image_hwstring($width, $height);
877 877
 		$size_class = $size;
878
-		if ( is_array( $size_class ) ) {
879
-			$size_class = join( 'x', $size_class );
878
+		if (is_array($size_class)) {
879
+			$size_class = join('x', $size_class);
880 880
 		}
881 881
 		$attachment = get_post($attachment_id);
882 882
 		$default_attr = array(
883 883
 			'src'	=> $src,
884 884
 			'class'	=> "attachment-$size_class size-$size_class",
885
-			'alt'	=> trim( strip_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ),
885
+			'alt'	=> trim(strip_tags(get_post_meta($attachment_id, '_wp_attachment_image_alt', true))),
886 886
 		);
887 887
 
888
-		$attr = wp_parse_args( $attr, $default_attr );
888
+		$attr = wp_parse_args($attr, $default_attr);
889 889
 
890 890
 		// Generate 'srcset' and 'sizes' if not already present.
891
-		if ( empty( $attr['srcset'] ) ) {
892
-			$image_meta = wp_get_attachment_metadata( $attachment_id );
891
+		if (empty($attr['srcset'])) {
892
+			$image_meta = wp_get_attachment_metadata($attachment_id);
893 893
 
894
-			if ( is_array( $image_meta ) ) {
895
-				$size_array = array( absint( $width ), absint( $height ) );
896
-				$srcset = wp_calculate_image_srcset( $size_array, $src, $image_meta, $attachment_id );
897
-				$sizes = wp_calculate_image_sizes( $size_array, $src, $image_meta, $attachment_id );
894
+			if (is_array($image_meta)) {
895
+				$size_array = array(absint($width), absint($height));
896
+				$srcset = wp_calculate_image_srcset($size_array, $src, $image_meta, $attachment_id);
897
+				$sizes = wp_calculate_image_sizes($size_array, $src, $image_meta, $attachment_id);
898 898
 
899
-				if ( $srcset && ( $sizes || ! empty( $attr['sizes'] ) ) ) {
899
+				if ($srcset && ($sizes || ! empty($attr['sizes']))) {
900 900
 					$attr['srcset'] = $srcset;
901 901
 
902
-					if ( empty( $attr['sizes'] ) ) {
902
+					if (empty($attr['sizes'])) {
903 903
 						$attr['sizes'] = $sizes;
904 904
 					}
905 905
 				}
@@ -916,11 +916,11 @@  discard block
 block discarded – undo
916 916
 		 * @param string|array $size       Requested size. Image size or array of width and height values
917 917
 		 *                                 (in that order). Default 'thumbnail'.
918 918
 		 */
919
-		$attr = apply_filters( 'wp_get_attachment_image_attributes', $attr, $attachment, $size );
920
-		$attr = array_map( 'esc_attr', $attr );
919
+		$attr = apply_filters('wp_get_attachment_image_attributes', $attr, $attachment, $size);
920
+		$attr = array_map('esc_attr', $attr);
921 921
 		$html = rtrim("<img $hwstring");
922
-		foreach ( $attr as $name => $value ) {
923
-			$html .= " $name=" . '"' . $value . '"';
922
+		foreach ($attr as $name => $value) {
923
+			$html .= " $name=".'"'.$value.'"';
924 924
 		}
925 925
 		$html .= ' />';
926 926
 	}
@@ -939,9 +939,9 @@  discard block
 block discarded – undo
939 939
  * @param bool         $icon          Optional. Whether the image should be treated as an icon. Default false.
940 940
  * @return string|false Attachment URL or false if no image is available.
941 941
  */
942
-function wp_get_attachment_image_url( $attachment_id, $size = 'thumbnail', $icon = false ) {
943
-	$image = wp_get_attachment_image_src( $attachment_id, $size, $icon );
944
-	return isset( $image['0'] ) ? $image['0'] : false;
942
+function wp_get_attachment_image_url($attachment_id, $size = 'thumbnail', $icon = false) {
943
+	$image = wp_get_attachment_image_src($attachment_id, $size, $icon);
944
+	return isset($image['0']) ? $image['0'] : false;
945 945
 }
946 946
 
947 947
 /**
@@ -953,17 +953,17 @@  discard block
 block discarded – undo
953 953
  * @param string $file Attachment file name.
954 954
  * @return string Attachment path relative to the upload directory.
955 955
  */
956
-function _wp_get_attachment_relative_path( $file ) {
957
-	$dirname = dirname( $file );
956
+function _wp_get_attachment_relative_path($file) {
957
+	$dirname = dirname($file);
958 958
 
959
-	if ( '.' === $dirname ) {
959
+	if ('.' === $dirname) {
960 960
 		return '';
961 961
 	}
962 962
 
963
-	if ( false !== strpos( $dirname, 'wp-content/uploads' ) ) {
963
+	if (false !== strpos($dirname, 'wp-content/uploads')) {
964 964
 		// Get the directory name relative to the upload directory (back compat for pre-2.7 uploads)
965
-		$dirname = substr( $dirname, strpos( $dirname, 'wp-content/uploads' ) + 18 );
966
-		$dirname = ltrim( $dirname, '/' );
965
+		$dirname = substr($dirname, strpos($dirname, 'wp-content/uploads') + 18);
966
+		$dirname = ltrim($dirname, '/');
967 967
 	}
968 968
 
969 969
 	return $dirname;
@@ -982,16 +982,16 @@  discard block
 block discarded – undo
982 982
  * @return array|bool Array of width and height values in pixels (in that order)
983 983
  *                    or false if the size doesn't exist.
984 984
  */
985
-function _wp_get_image_size_from_meta( $size_name, $image_meta ) {
986
-	if ( $size_name === 'full' ) {
985
+function _wp_get_image_size_from_meta($size_name, $image_meta) {
986
+	if ($size_name === 'full') {
987 987
 		return array(
988
-			absint( $image_meta['width'] ),
989
-			absint( $image_meta['height'] ),
988
+			absint($image_meta['width']),
989
+			absint($image_meta['height']),
990 990
 		);
991
-	} elseif ( ! empty( $image_meta['sizes'][$size_name] ) ) {
991
+	} elseif ( ! empty($image_meta['sizes'][$size_name])) {
992 992
 		return array(
993
-			absint( $image_meta['sizes'][$size_name]['width'] ),
994
-			absint( $image_meta['sizes'][$size_name]['height'] ),
993
+			absint($image_meta['sizes'][$size_name]['width']),
994
+			absint($image_meta['sizes'][$size_name]['height']),
995 995
 		);
996 996
 	}
997 997
 
@@ -1012,22 +1012,22 @@  discard block
 block discarded – undo
1012 1012
  *                                    Default null.
1013 1013
  * @return string|bool A 'srcset' value string or false.
1014 1014
  */
1015
-function wp_get_attachment_image_srcset( $attachment_id, $size = 'medium', $image_meta = null ) {
1016
-	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
1015
+function wp_get_attachment_image_srcset($attachment_id, $size = 'medium', $image_meta = null) {
1016
+	if ( ! $image = wp_get_attachment_image_src($attachment_id, $size)) {
1017 1017
 		return false;
1018 1018
 	}
1019 1019
 
1020
-	if ( ! is_array( $image_meta ) ) {
1021
-		$image_meta = wp_get_attachment_metadata( $attachment_id );
1020
+	if ( ! is_array($image_meta)) {
1021
+		$image_meta = wp_get_attachment_metadata($attachment_id);
1022 1022
 	}
1023 1023
 
1024 1024
 	$image_src = $image[0];
1025 1025
 	$size_array = array(
1026
-		absint( $image[1] ),
1027
-		absint( $image[2] )
1026
+		absint($image[1]),
1027
+		absint($image[2])
1028 1028
 	);
1029 1029
 
1030
-	return wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
1030
+	return wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id);
1031 1031
 }
1032 1032
 
1033 1033
 /**
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
  * @param int    $attachment_id Optional. The image attachment ID to pass to the filter. Default 0.
1042 1042
  * @return string|bool          The 'srcset' attribute value. False on error or when only one source exists.
1043 1043
  */
1044
-function wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id = 0 ) {
1044
+function wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id = 0) {
1045 1045
 	/**
1046 1046
 	 * Let plugins pre-filter the image meta to be able to fix inconsistencies in the stored data.
1047 1047
 	 *
@@ -1052,9 +1052,9 @@  discard block
 block discarded – undo
1052 1052
 	 * @param string $image_src     The 'src' of the image.
1053 1053
 	 * @param int    $attachment_id The image attachment ID or 0 if not supplied.
1054 1054
 	 */
1055
-	$image_meta = apply_filters( 'wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id );
1055
+	$image_meta = apply_filters('wp_calculate_image_srcset_meta', $image_meta, $size_array, $image_src, $attachment_id);
1056 1056
 
1057
-	if ( empty( $image_meta['sizes'] ) || ! isset( $image_meta['file'] ) || strlen( $image_meta['file'] ) < 4 ) {
1057
+	if (empty($image_meta['sizes']) || ! isset($image_meta['file']) || strlen($image_meta['file']) < 4) {
1058 1058
 		return false;
1059 1059
 	}
1060 1060
 
@@ -1065,43 +1065,43 @@  discard block
 block discarded – undo
1065 1065
 	$image_height = (int) $size_array[1];
1066 1066
 
1067 1067
 	// Bail early if error/no width.
1068
-	if ( $image_width < 1 ) {
1068
+	if ($image_width < 1) {
1069 1069
 		return false;
1070 1070
 	}
1071 1071
 
1072
-	$image_basename = wp_basename( $image_meta['file'] );
1072
+	$image_basename = wp_basename($image_meta['file']);
1073 1073
 
1074 1074
 	/*
1075 1075
 	 * WordPress flattens animated GIFs into one frame when generating intermediate sizes.
1076 1076
 	 * To avoid hiding animation in user content, if src is a full size GIF, a srcset attribute is not generated.
1077 1077
 	 * If src is an intermediate size GIF, the full size is excluded from srcset to keep a flattened GIF from becoming animated.
1078 1078
 	 */
1079
-	if ( ! isset( $image_sizes['thumbnail']['mime-type'] ) || 'image/gif' !== $image_sizes['thumbnail']['mime-type'] ) {
1079
+	if ( ! isset($image_sizes['thumbnail']['mime-type']) || 'image/gif' !== $image_sizes['thumbnail']['mime-type']) {
1080 1080
 		$image_sizes[] = array(
1081 1081
 			'width'  => $image_meta['width'],
1082 1082
 			'height' => $image_meta['height'],
1083 1083
 			'file'   => $image_basename,
1084 1084
 		);
1085
-	} elseif ( strpos( $image_src, $image_meta['file'] ) ) {
1085
+	} elseif (strpos($image_src, $image_meta['file'])) {
1086 1086
 		return false;
1087 1087
 	}
1088 1088
 
1089 1089
 	// Retrieve the uploads sub-directory from the full size image.
1090
-	$dirname = _wp_get_attachment_relative_path( $image_meta['file'] );
1090
+	$dirname = _wp_get_attachment_relative_path($image_meta['file']);
1091 1091
 
1092
-	if ( $dirname ) {
1093
-		$dirname = trailingslashit( $dirname );
1092
+	if ($dirname) {
1093
+		$dirname = trailingslashit($dirname);
1094 1094
 	}
1095 1095
 
1096 1096
 	$upload_dir = wp_get_upload_dir();
1097
-	$image_baseurl = trailingslashit( $upload_dir['baseurl'] ) . $dirname;
1097
+	$image_baseurl = trailingslashit($upload_dir['baseurl']).$dirname;
1098 1098
 
1099 1099
 	/*
1100 1100
 	 * If currently on HTTPS, prefer HTTPS URLs when we know they're supported by the domain
1101 1101
 	 * (which is to say, when they share the domain name of the current request).
1102 1102
 	 */
1103
-	if ( is_ssl() && 'https' !== substr( $image_baseurl, 0, 5 ) && parse_url( $image_baseurl, PHP_URL_HOST ) === $_SERVER['HTTP_HOST'] ) {
1104
-		$image_baseurl = set_url_scheme( $image_baseurl, 'https' );
1103
+	if (is_ssl() && 'https' !== substr($image_baseurl, 0, 5) && parse_url($image_baseurl, PHP_URL_HOST) === $_SERVER['HTTP_HOST']) {
1104
+		$image_baseurl = set_url_scheme($image_baseurl, 'https');
1105 1105
 	}
1106 1106
 
1107 1107
 	/*
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
 	 * contain a unique hash. Look for that hash and use it later to filter
1110 1110
 	 * out images that are leftovers from previous versions.
1111 1111
 	 */
1112
-	$image_edited = preg_match( '/-e[0-9]{13}/', wp_basename( $image_src ), $image_edit_hash );
1112
+	$image_edited = preg_match('/-e[0-9]{13}/', wp_basename($image_src), $image_edit_hash);
1113 1113
 
1114 1114
 	/**
1115 1115
 	 * Filters the maximum image width to be included in a 'srcset' attribute.
@@ -1119,7 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 	 * @param int   $max_width  The maximum image width to be included in the 'srcset'. Default '1600'.
1120 1120
 	 * @param array $size_array Array of width and height values in pixels (in that order).
1121 1121
 	 */
1122
-	$max_srcset_image_width = apply_filters( 'max_srcset_image_width', 1600, $size_array );
1122
+	$max_srcset_image_width = apply_filters('max_srcset_image_width', 1600, $size_array);
1123 1123
 
1124 1124
 	// Array to hold URL candidates.
1125 1125
 	$sources = array();
@@ -1135,21 +1135,21 @@  discard block
 block discarded – undo
1135 1135
 	 * Loop through available images. Only use images that are resized
1136 1136
 	 * versions of the same edit.
1137 1137
 	 */
1138
-	foreach ( $image_sizes as $image ) {
1138
+	foreach ($image_sizes as $image) {
1139 1139
 		$is_src = false;
1140 1140
 
1141 1141
 		// Check if image meta isn't corrupted.
1142
-		if ( ! is_array( $image ) ) {
1142
+		if ( ! is_array($image)) {
1143 1143
 			continue;
1144 1144
 		}
1145 1145
 
1146 1146
 		// If the file name is part of the `src`, we've confirmed a match.
1147
-		if ( ! $src_matched && false !== strpos( $image_src, $dirname . $image['file'] ) ) {
1147
+		if ( ! $src_matched && false !== strpos($image_src, $dirname.$image['file'])) {
1148 1148
 			$src_matched = $is_src = true;
1149 1149
 		}
1150 1150
 
1151 1151
 		// Filter out images that are from previous edits.
1152
-		if ( $image_edited && ! strpos( $image['file'], $image_edit_hash[0] ) ) {
1152
+		if ($image_edited && ! strpos($image['file'], $image_edit_hash[0])) {
1153 1153
 			continue;
1154 1154
 		}
1155 1155
 
@@ -1157,24 +1157,24 @@  discard block
 block discarded – undo
1157 1157
 		 * Filters out images that are wider than '$max_srcset_image_width' unless
1158 1158
 		 * that file is in the 'src' attribute.
1159 1159
 		 */
1160
-		if ( $max_srcset_image_width && $image['width'] > $max_srcset_image_width && ! $is_src ) {
1160
+		if ($max_srcset_image_width && $image['width'] > $max_srcset_image_width && ! $is_src) {
1161 1161
 			continue;
1162 1162
 		}
1163 1163
 
1164 1164
 		// If the image dimensions are within 1px of the expected size, use it.
1165
-		if ( wp_image_matches_ratio( $image_width, $image_height, $image['width'], $image['height'] ) ) {
1165
+		if (wp_image_matches_ratio($image_width, $image_height, $image['width'], $image['height'])) {
1166 1166
 			// Add the URL, descriptor, and value to the sources array to be returned.
1167 1167
 			$source = array(
1168
-				'url'        => $image_baseurl . $image['file'],
1168
+				'url'        => $image_baseurl.$image['file'],
1169 1169
 				'descriptor' => 'w',
1170 1170
 				'value'      => $image['width'],
1171 1171
 			);
1172 1172
 
1173 1173
 			// The 'src' image has to be the first in the 'srcset', because of a bug in iOS8. See #35030.
1174
-			if ( $is_src ) {
1175
-				$sources = array( $image['width'] => $source ) + $sources;
1174
+			if ($is_src) {
1175
+				$sources = array($image['width'] => $source) + $sources;
1176 1176
 			} else {
1177
-				$sources[ $image['width'] ] = $source;
1177
+				$sources[$image['width']] = $source;
1178 1178
 			}
1179 1179
 		}
1180 1180
 	}
@@ -1200,20 +1200,20 @@  discard block
 block discarded – undo
1200 1200
 	 * @param array  $image_meta    The image meta data as returned by 'wp_get_attachment_metadata()'.
1201 1201
 	 * @param int    $attachment_id Image attachment ID or 0.
1202 1202
 	 */
1203
-	$sources = apply_filters( 'wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id );
1203
+	$sources = apply_filters('wp_calculate_image_srcset', $sources, $size_array, $image_src, $image_meta, $attachment_id);
1204 1204
 
1205 1205
 	// Only return a 'srcset' value if there is more than one source.
1206
-	if ( ! $src_matched || count( $sources ) < 2 ) {
1206
+	if ( ! $src_matched || count($sources) < 2) {
1207 1207
 		return false;
1208 1208
 	}
1209 1209
 
1210 1210
 	$srcset = '';
1211 1211
 
1212
-	foreach ( $sources as $source ) {
1213
-		$srcset .= str_replace( ' ', '%20', $source['url'] ) . ' ' . $source['value'] . $source['descriptor'] . ', ';
1212
+	foreach ($sources as $source) {
1213
+		$srcset .= str_replace(' ', '%20', $source['url']).' '.$source['value'].$source['descriptor'].', ';
1214 1214
 	}
1215 1215
 
1216
-	return rtrim( $srcset, ', ' );
1216
+	return rtrim($srcset, ', ');
1217 1217
 }
1218 1218
 
1219 1219
 /**
@@ -1230,22 +1230,22 @@  discard block
 block discarded – undo
1230 1230
  *                                    Default null.
1231 1231
  * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
1232 1232
  */
1233
-function wp_get_attachment_image_sizes( $attachment_id, $size = 'medium', $image_meta = null ) {
1234
-	if ( ! $image = wp_get_attachment_image_src( $attachment_id, $size ) ) {
1233
+function wp_get_attachment_image_sizes($attachment_id, $size = 'medium', $image_meta = null) {
1234
+	if ( ! $image = wp_get_attachment_image_src($attachment_id, $size)) {
1235 1235
 		return false;
1236 1236
 	}
1237 1237
 
1238
-	if ( ! is_array( $image_meta ) ) {
1239
-		$image_meta = wp_get_attachment_metadata( $attachment_id );
1238
+	if ( ! is_array($image_meta)) {
1239
+		$image_meta = wp_get_attachment_metadata($attachment_id);
1240 1240
 	}
1241 1241
 
1242 1242
 	$image_src = $image[0];
1243 1243
 	$size_array = array(
1244
-		absint( $image[1] ),
1245
-		absint( $image[2] )
1244
+		absint($image[1]),
1245
+		absint($image[2])
1246 1246
 	);
1247 1247
 
1248
-	return wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
1248
+	return wp_calculate_image_sizes($size_array, $image_src, $image_meta, $attachment_id);
1249 1249
 }
1250 1250
 
1251 1251
 /**
@@ -1262,30 +1262,30 @@  discard block
 block discarded – undo
1262 1262
  *                                    is needed when using the image size name as argument for `$size`. Default 0.
1263 1263
  * @return string|bool A valid source size value for use in a 'sizes' attribute or false.
1264 1264
  */
1265
-function wp_calculate_image_sizes( $size, $image_src = null, $image_meta = null, $attachment_id = 0 ) {
1265
+function wp_calculate_image_sizes($size, $image_src = null, $image_meta = null, $attachment_id = 0) {
1266 1266
 	$width = 0;
1267 1267
 
1268
-	if ( is_array( $size ) ) {
1269
-		$width = absint( $size[0] );
1270
-	} elseif ( is_string( $size ) ) {
1271
-		if ( ! $image_meta && $attachment_id ) {
1272
-			$image_meta = wp_get_attachment_metadata( $attachment_id );
1268
+	if (is_array($size)) {
1269
+		$width = absint($size[0]);
1270
+	} elseif (is_string($size)) {
1271
+		if ( ! $image_meta && $attachment_id) {
1272
+			$image_meta = wp_get_attachment_metadata($attachment_id);
1273 1273
 		}
1274 1274
 
1275
-		if ( is_array( $image_meta ) ) {
1276
-			$size_array = _wp_get_image_size_from_meta( $size, $image_meta );
1277
-			if ( $size_array ) {
1278
-				$width = absint( $size_array[0] );
1275
+		if (is_array($image_meta)) {
1276
+			$size_array = _wp_get_image_size_from_meta($size, $image_meta);
1277
+			if ($size_array) {
1278
+				$width = absint($size_array[0]);
1279 1279
 			}
1280 1280
 		}
1281 1281
 	}
1282 1282
 
1283
-	if ( ! $width ) {
1283
+	if ( ! $width) {
1284 1284
 		return false;
1285 1285
 	}
1286 1286
 
1287 1287
 	// Setup the default 'sizes' attribute.
1288
-	$sizes = sprintf( '(max-width: %1$dpx) 100vw, %1$dpx', $width );
1288
+	$sizes = sprintf('(max-width: %1$dpx) 100vw, %1$dpx', $width);
1289 1289
 
1290 1290
 	/**
1291 1291
 	 * Filters the output of 'wp_calculate_image_sizes()'.
@@ -1299,7 +1299,7 @@  discard block
 block discarded – undo
1299 1299
 	 * @param array|null   $image_meta    The image meta data as returned by wp_get_attachment_metadata() or null.
1300 1300
 	 * @param int          $attachment_id Image attachment ID of the original image or 0.
1301 1301
 	 */
1302
-	return apply_filters( 'wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id );
1302
+	return apply_filters('wp_calculate_image_sizes', $sizes, $size, $image_src, $image_meta, $attachment_id);
1303 1303
 }
1304 1304
 
1305 1305
 /**
@@ -1312,40 +1312,40 @@  discard block
 block discarded – undo
1312 1312
  * @param string $content The raw post content to be filtered.
1313 1313
  * @return string Converted content with 'srcset' and 'sizes' attributes added to images.
1314 1314
  */
1315
-function wp_make_content_images_responsive( $content ) {
1316
-	if ( ! preg_match_all( '/<img [^>]+>/', $content, $matches ) ) {
1315
+function wp_make_content_images_responsive($content) {
1316
+	if ( ! preg_match_all('/<img [^>]+>/', $content, $matches)) {
1317 1317
 		return $content;
1318 1318
 	}
1319 1319
 
1320 1320
 	$selected_images = $attachment_ids = array();
1321 1321
 
1322
-	foreach( $matches[0] as $image ) {
1323
-		if ( false === strpos( $image, ' srcset=' ) && preg_match( '/wp-image-([0-9]+)/i', $image, $class_id ) &&
1324
-			( $attachment_id = absint( $class_id[1] ) ) ) {
1322
+	foreach ($matches[0] as $image) {
1323
+		if (false === strpos($image, ' srcset=') && preg_match('/wp-image-([0-9]+)/i', $image, $class_id) &&
1324
+			($attachment_id = absint($class_id[1]))) {
1325 1325
 
1326 1326
 			/*
1327 1327
 			 * If exactly the same image tag is used more than once, overwrite it.
1328 1328
 			 * All identical tags will be replaced later with 'str_replace()'.
1329 1329
 			 */
1330
-			$selected_images[ $image ] = $attachment_id;
1330
+			$selected_images[$image] = $attachment_id;
1331 1331
 			// Overwrite the ID when the same image is included more than once.
1332
-			$attachment_ids[ $attachment_id ] = true;
1332
+			$attachment_ids[$attachment_id] = true;
1333 1333
 		}
1334 1334
 	}
1335 1335
 
1336
-	if ( count( $attachment_ids ) > 1 ) {
1336
+	if (count($attachment_ids) > 1) {
1337 1337
 		/*
1338 1338
 		 * Warm object cache for use with 'get_post_meta()'.
1339 1339
 		 *
1340 1340
 		 * To avoid making a database call for each image, a single query
1341 1341
 		 * warms the object cache with the meta information for all images.
1342 1342
 		 */
1343
-		update_meta_cache( 'post', array_keys( $attachment_ids ) );
1343
+		update_meta_cache('post', array_keys($attachment_ids));
1344 1344
 	}
1345 1345
 
1346
-	foreach ( $selected_images as $image => $attachment_id ) {
1347
-		$image_meta = wp_get_attachment_metadata( $attachment_id );
1348
-		$content = str_replace( $image, wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ), $content );
1346
+	foreach ($selected_images as $image => $attachment_id) {
1347
+		$image_meta = wp_get_attachment_metadata($attachment_id);
1348
+		$content = str_replace($image, wp_image_add_srcset_and_sizes($image, $image_meta, $attachment_id), $content);
1349 1349
 	}
1350 1350
 
1351 1351
 	return $content;
@@ -1364,43 +1364,43 @@  discard block
 block discarded – undo
1364 1364
  * @param int    $attachment_id Image attachment ID.
1365 1365
  * @return string Converted 'img' element with 'srcset' and 'sizes' attributes added.
1366 1366
  */
1367
-function wp_image_add_srcset_and_sizes( $image, $image_meta, $attachment_id ) {
1367
+function wp_image_add_srcset_and_sizes($image, $image_meta, $attachment_id) {
1368 1368
 	// Ensure the image meta exists.
1369
-	if ( empty( $image_meta['sizes'] ) ) {
1369
+	if (empty($image_meta['sizes'])) {
1370 1370
 		return $image;
1371 1371
 	}
1372 1372
 
1373
-	$image_src = preg_match( '/src="([^"]+)"/', $image, $match_src ) ? $match_src[1] : '';
1374
-	list( $image_src ) = explode( '?', $image_src );
1373
+	$image_src = preg_match('/src="([^"]+)"/', $image, $match_src) ? $match_src[1] : '';
1374
+	list($image_src) = explode('?', $image_src);
1375 1375
 
1376 1376
 	// Return early if we couldn't get the image source.
1377
-	if ( ! $image_src ) {
1377
+	if ( ! $image_src) {
1378 1378
 		return $image;
1379 1379
 	}
1380 1380
 
1381 1381
 	// Bail early if an image has been inserted and later edited.
1382
-	if ( preg_match( '/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash ) &&
1383
-		strpos( wp_basename( $image_src ), $img_edit_hash[0] ) === false ) {
1382
+	if (preg_match('/-e[0-9]{13}/', $image_meta['file'], $img_edit_hash) &&
1383
+		strpos(wp_basename($image_src), $img_edit_hash[0]) === false) {
1384 1384
 
1385 1385
 		return $image;
1386 1386
 	}
1387 1387
 
1388
-	$width  = preg_match( '/ width="([0-9]+)"/',  $image, $match_width  ) ? (int) $match_width[1]  : 0;
1389
-	$height = preg_match( '/ height="([0-9]+)"/', $image, $match_height ) ? (int) $match_height[1] : 0;
1388
+	$width  = preg_match('/ width="([0-9]+)"/', $image, $match_width) ? (int) $match_width[1] : 0;
1389
+	$height = preg_match('/ height="([0-9]+)"/', $image, $match_height) ? (int) $match_height[1] : 0;
1390 1390
 
1391
-	if ( ! $width || ! $height ) {
1391
+	if ( ! $width || ! $height) {
1392 1392
 		/*
1393 1393
 		 * If attempts to parse the size value failed, attempt to use the image meta data to match
1394 1394
 		 * the image file name from 'src' against the available sizes for an attachment.
1395 1395
 		 */
1396
-		$image_filename = wp_basename( $image_src );
1396
+		$image_filename = wp_basename($image_src);
1397 1397
 
1398
-		if ( $image_filename === wp_basename( $image_meta['file'] ) ) {
1398
+		if ($image_filename === wp_basename($image_meta['file'])) {
1399 1399
 			$width = (int) $image_meta['width'];
1400 1400
 			$height = (int) $image_meta['height'];
1401 1401
 		} else {
1402
-			foreach( $image_meta['sizes'] as $image_size_data ) {
1403
-				if ( $image_filename === $image_size_data['file'] ) {
1402
+			foreach ($image_meta['sizes'] as $image_size_data) {
1403
+				if ($image_filename === $image_size_data['file']) {
1404 1404
 					$width = (int) $image_size_data['width'];
1405 1405
 					$height = (int) $image_size_data['height'];
1406 1406
 					break;
@@ -1409,32 +1409,32 @@  discard block
 block discarded – undo
1409 1409
 		}
1410 1410
 	}
1411 1411
 
1412
-	if ( ! $width || ! $height ) {
1412
+	if ( ! $width || ! $height) {
1413 1413
 		return $image;
1414 1414
 	}
1415 1415
 
1416
-	$size_array = array( $width, $height );
1417
-	$srcset = wp_calculate_image_srcset( $size_array, $image_src, $image_meta, $attachment_id );
1416
+	$size_array = array($width, $height);
1417
+	$srcset = wp_calculate_image_srcset($size_array, $image_src, $image_meta, $attachment_id);
1418 1418
 
1419
-	if ( $srcset ) {
1419
+	if ($srcset) {
1420 1420
 		// Check if there is already a 'sizes' attribute.
1421
-		$sizes = strpos( $image, ' sizes=' );
1421
+		$sizes = strpos($image, ' sizes=');
1422 1422
 
1423
-		if ( ! $sizes ) {
1424
-			$sizes = wp_calculate_image_sizes( $size_array, $image_src, $image_meta, $attachment_id );
1423
+		if ( ! $sizes) {
1424
+			$sizes = wp_calculate_image_sizes($size_array, $image_src, $image_meta, $attachment_id);
1425 1425
 		}
1426 1426
 	}
1427 1427
 
1428
-	if ( $srcset && $sizes ) {
1428
+	if ($srcset && $sizes) {
1429 1429
 		// Format the 'srcset' and 'sizes' string and escape attributes.
1430
-		$attr = sprintf( ' srcset="%s"', esc_attr( $srcset ) );
1430
+		$attr = sprintf(' srcset="%s"', esc_attr($srcset));
1431 1431
 
1432
-		if ( is_string( $sizes ) ) {
1433
-			$attr .= sprintf( ' sizes="%s"', esc_attr( $sizes ) );
1432
+		if (is_string($sizes)) {
1433
+			$attr .= sprintf(' sizes="%s"', esc_attr($sizes));
1434 1434
 		}
1435 1435
 
1436 1436
 		// Add 'srcset' and 'sizes' attributes to the image markup.
1437
-		$image = preg_replace( '/<img ([^>]+?)[\/ ]*>/', '<img $1' . $attr . ' />', $image );
1437
+		$image = preg_replace('/<img ([^>]+?)[\/ ]*>/', '<img $1'.$attr.' />', $image);
1438 1438
 	}
1439 1439
 
1440 1440
 	return $image;
@@ -1452,7 +1452,7 @@  discard block
 block discarded – undo
1452 1452
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1453 1453
  * @return array Modified array of attributes including the new 'wp-post-image' class.
1454 1454
  */
1455
-function _wp_post_thumbnail_class_filter( $attr ) {
1455
+function _wp_post_thumbnail_class_filter($attr) {
1456 1456
 	$attr['class'] .= ' wp-post-image';
1457 1457
 	return $attr;
1458 1458
 }
@@ -1466,8 +1466,8 @@  discard block
 block discarded – undo
1466 1466
  *
1467 1467
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1468 1468
  */
1469
-function _wp_post_thumbnail_class_filter_add( $attr ) {
1470
-	add_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' );
1469
+function _wp_post_thumbnail_class_filter_add($attr) {
1470
+	add_filter('wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter');
1471 1471
 }
1472 1472
 
1473 1473
 /**
@@ -1479,8 +1479,8 @@  discard block
 block discarded – undo
1479 1479
  *
1480 1480
  * @param array $attr Thumbnail attributes including src, class, alt, title.
1481 1481
  */
1482
-function _wp_post_thumbnail_class_filter_remove( $attr ) {
1483
-	remove_filter( 'wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter' );
1482
+function _wp_post_thumbnail_class_filter_remove($attr) {
1483
+	remove_filter('wp_get_attachment_image_attributes', '_wp_post_thumbnail_class_filter');
1484 1484
 }
1485 1485
 
1486 1486
 add_shortcode('wp_caption', 'img_caption_shortcode');
@@ -1511,15 +1511,15 @@  discard block
 block discarded – undo
1511 1511
  * @param string $content Shortcode content.
1512 1512
  * @return string HTML content to display the caption.
1513 1513
  */
1514
-function img_caption_shortcode( $attr, $content = null ) {
1514
+function img_caption_shortcode($attr, $content = null) {
1515 1515
 	// New-style shortcode with the caption inside the shortcode with the link and image tags.
1516
-	if ( ! isset( $attr['caption'] ) ) {
1517
-		if ( preg_match( '#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches ) ) {
1516
+	if ( ! isset($attr['caption'])) {
1517
+		if (preg_match('#((?:<a [^>]+>\s*)?<img [^>]+>(?:\s*</a>)?)(.*)#is', $content, $matches)) {
1518 1518
 			$content = $matches[1];
1519
-			$attr['caption'] = trim( $matches[2] );
1519
+			$attr['caption'] = trim($matches[2]);
1520 1520
 		}
1521
-	} elseif ( strpos( $attr['caption'], '<' ) !== false ) {
1522
-		$attr['caption'] = wp_kses( $attr['caption'], 'post' );
1521
+	} elseif (strpos($attr['caption'], '<') !== false) {
1522
+		$attr['caption'] = wp_kses($attr['caption'], 'post');
1523 1523
 	}
1524 1524
 
1525 1525
 	/**
@@ -1536,30 +1536,30 @@  discard block
 block discarded – undo
1536 1536
 	 * @param array  $attr    Attributes of the caption shortcode.
1537 1537
 	 * @param string $content The image element, possibly wrapped in a hyperlink.
1538 1538
 	 */
1539
-	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
1540
-	if ( $output != '' )
1539
+	$output = apply_filters('img_caption_shortcode', '', $attr, $content);
1540
+	if ($output != '')
1541 1541
 		return $output;
1542 1542
 
1543
-	$atts = shortcode_atts( array(
1543
+	$atts = shortcode_atts(array(
1544 1544
 		'id'	  => '',
1545 1545
 		'align'	  => 'alignnone',
1546 1546
 		'width'	  => '',
1547 1547
 		'caption' => '',
1548 1548
 		'class'   => '',
1549
-	), $attr, 'caption' );
1549
+	), $attr, 'caption');
1550 1550
 
1551 1551
 	$atts['width'] = (int) $atts['width'];
1552
-	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
1552
+	if ($atts['width'] < 1 || empty($atts['caption']))
1553 1553
 		return $content;
1554 1554
 
1555
-	if ( ! empty( $atts['id'] ) )
1556
-		$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1555
+	if ( ! empty($atts['id']))
1556
+		$atts['id'] = 'id="'.esc_attr(sanitize_html_class($atts['id'])).'" ';
1557 1557
 
1558
-	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
1558
+	$class = trim('wp-caption '.$atts['align'].' '.$atts['class']);
1559 1559
 
1560
-	$html5 = current_theme_supports( 'html5', 'caption' );
1560
+	$html5 = current_theme_supports('html5', 'caption');
1561 1561
 	// HTML5 captions never added the extra 10px to the image width
1562
-	$width = $html5 ? $atts['width'] : ( 10 + $atts['width'] );
1562
+	$width = $html5 ? $atts['width'] : (10 + $atts['width']);
1563 1563
 
1564 1564
 	/**
1565 1565
 	 * Filters the width of an image's caption.
@@ -1576,19 +1576,19 @@  discard block
 block discarded – undo
1576 1576
 	 * @param array  $atts     Attributes of the caption shortcode.
1577 1577
 	 * @param string $content  The image element, possibly wrapped in a hyperlink.
1578 1578
 	 */
1579
-	$caption_width = apply_filters( 'img_caption_shortcode_width', $width, $atts, $content );
1579
+	$caption_width = apply_filters('img_caption_shortcode_width', $width, $atts, $content);
1580 1580
 
1581 1581
 	$style = '';
1582
-	if ( $caption_width ) {
1583
-		$style = 'style="width: ' . (int) $caption_width . 'px" ';
1582
+	if ($caption_width) {
1583
+		$style = 'style="width: '.(int) $caption_width.'px" ';
1584 1584
 	}
1585 1585
 
1586
-	if ( $html5 ) {
1587
-		$html = '<figure ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
1588
-		. do_shortcode( $content ) . '<figcaption class="wp-caption-text">' . $atts['caption'] . '</figcaption></figure>';
1586
+	if ($html5) {
1587
+		$html = '<figure '.$atts['id'].$style.'class="'.esc_attr($class).'">'
1588
+		. do_shortcode($content).'<figcaption class="wp-caption-text">'.$atts['caption'].'</figcaption></figure>';
1589 1589
 	} else {
1590
-		$html = '<div ' . $atts['id'] . $style . 'class="' . esc_attr( $class ) . '">'
1591
-		. do_shortcode( $content ) . '<p class="wp-caption-text">' . $atts['caption'] . '</p></div>';
1590
+		$html = '<div '.$atts['id'].$style.'class="'.esc_attr($class).'">'
1591
+		. do_shortcode($content).'<p class="wp-caption-text">'.$atts['caption'].'</p></div>';
1592 1592
 	}
1593 1593
 
1594 1594
 	return $html;
@@ -1630,15 +1630,15 @@  discard block
 block discarded – undo
1630 1630
  * }
1631 1631
  * @return string HTML content to display gallery.
1632 1632
  */
1633
-function gallery_shortcode( $attr ) {
1633
+function gallery_shortcode($attr) {
1634 1634
 	$post = get_post();
1635 1635
 
1636 1636
 	static $instance = 0;
1637 1637
 	$instance++;
1638 1638
 
1639
-	if ( ! empty( $attr['ids'] ) ) {
1639
+	if ( ! empty($attr['ids'])) {
1640 1640
 		// 'ids' is explicitly ordered, unless you specify otherwise.
1641
-		if ( empty( $attr['orderby'] ) ) {
1641
+		if (empty($attr['orderby'])) {
1642 1642
 			$attr['orderby'] = 'post__in';
1643 1643
 		}
1644 1644
 		$attr['include'] = $attr['ids'];
@@ -1659,69 +1659,69 @@  discard block
 block discarded – undo
1659 1659
 	 * @param array  $attr     Attributes of the gallery shortcode.
1660 1660
 	 * @param int    $instance Unique numeric ID of this gallery shortcode instance.
1661 1661
 	 */
1662
-	$output = apply_filters( 'post_gallery', '', $attr, $instance );
1663
-	if ( $output != '' ) {
1662
+	$output = apply_filters('post_gallery', '', $attr, $instance);
1663
+	if ($output != '') {
1664 1664
 		return $output;
1665 1665
 	}
1666 1666
 
1667
-	$html5 = current_theme_supports( 'html5', 'gallery' );
1668
-	$atts = shortcode_atts( array(
1667
+	$html5 = current_theme_supports('html5', 'gallery');
1668
+	$atts = shortcode_atts(array(
1669 1669
 		'order'      => 'ASC',
1670 1670
 		'orderby'    => 'menu_order ID',
1671 1671
 		'id'         => $post ? $post->ID : 0,
1672
-		'itemtag'    => $html5 ? 'figure'     : 'dl',
1673
-		'icontag'    => $html5 ? 'div'        : 'dt',
1672
+		'itemtag'    => $html5 ? 'figure' : 'dl',
1673
+		'icontag'    => $html5 ? 'div' : 'dt',
1674 1674
 		'captiontag' => $html5 ? 'figcaption' : 'dd',
1675 1675
 		'columns'    => 3,
1676 1676
 		'size'       => 'thumbnail',
1677 1677
 		'include'    => '',
1678 1678
 		'exclude'    => '',
1679 1679
 		'link'       => ''
1680
-	), $attr, 'gallery' );
1680
+	), $attr, 'gallery');
1681 1681
 
1682
-	$id = intval( $atts['id'] );
1682
+	$id = intval($atts['id']);
1683 1683
 
1684
-	if ( ! empty( $atts['include'] ) ) {
1685
-		$_attachments = get_posts( array( 'include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1684
+	if ( ! empty($atts['include'])) {
1685
+		$_attachments = get_posts(array('include' => $atts['include'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1686 1686
 
1687 1687
 		$attachments = array();
1688
-		foreach ( $_attachments as $key => $val ) {
1688
+		foreach ($_attachments as $key => $val) {
1689 1689
 			$attachments[$val->ID] = $_attachments[$key];
1690 1690
 		}
1691
-	} elseif ( ! empty( $atts['exclude'] ) ) {
1692
-		$attachments = get_children( array( 'post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1691
+	} elseif ( ! empty($atts['exclude'])) {
1692
+		$attachments = get_children(array('post_parent' => $id, 'exclude' => $atts['exclude'], 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1693 1693
 	} else {
1694
-		$attachments = get_children( array( 'post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby'] ) );
1694
+		$attachments = get_children(array('post_parent' => $id, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => $atts['order'], 'orderby' => $atts['orderby']));
1695 1695
 	}
1696 1696
 
1697
-	if ( empty( $attachments ) ) {
1697
+	if (empty($attachments)) {
1698 1698
 		return '';
1699 1699
 	}
1700 1700
 
1701
-	if ( is_feed() ) {
1701
+	if (is_feed()) {
1702 1702
 		$output = "\n";
1703
-		foreach ( $attachments as $att_id => $attachment ) {
1704
-			$output .= wp_get_attachment_link( $att_id, $atts['size'], true ) . "\n";
1703
+		foreach ($attachments as $att_id => $attachment) {
1704
+			$output .= wp_get_attachment_link($att_id, $atts['size'], true)."\n";
1705 1705
 		}
1706 1706
 		return $output;
1707 1707
 	}
1708 1708
 
1709
-	$itemtag = tag_escape( $atts['itemtag'] );
1710
-	$captiontag = tag_escape( $atts['captiontag'] );
1711
-	$icontag = tag_escape( $atts['icontag'] );
1712
-	$valid_tags = wp_kses_allowed_html( 'post' );
1713
-	if ( ! isset( $valid_tags[ $itemtag ] ) ) {
1709
+	$itemtag = tag_escape($atts['itemtag']);
1710
+	$captiontag = tag_escape($atts['captiontag']);
1711
+	$icontag = tag_escape($atts['icontag']);
1712
+	$valid_tags = wp_kses_allowed_html('post');
1713
+	if ( ! isset($valid_tags[$itemtag])) {
1714 1714
 		$itemtag = 'dl';
1715 1715
 	}
1716
-	if ( ! isset( $valid_tags[ $captiontag ] ) ) {
1716
+	if ( ! isset($valid_tags[$captiontag])) {
1717 1717
 		$captiontag = 'dd';
1718 1718
 	}
1719
-	if ( ! isset( $valid_tags[ $icontag ] ) ) {
1719
+	if ( ! isset($valid_tags[$icontag])) {
1720 1720
 		$icontag = 'dt';
1721 1721
 	}
1722 1722
 
1723
-	$columns = intval( $atts['columns'] );
1724
-	$itemwidth = $columns > 0 ? floor(100/$columns) : 100;
1723
+	$columns = intval($atts['columns']);
1724
+	$itemwidth = $columns > 0 ? floor(100 / $columns) : 100;
1725 1725
 	$float = is_rtl() ? 'right' : 'left';
1726 1726
 
1727 1727
 	$selector = "gallery-{$instance}";
@@ -1737,7 +1737,7 @@  discard block
 block discarded – undo
1737 1737
 	 *                    Defaults to false if the theme supports HTML5 galleries.
1738 1738
 	 *                    Otherwise, defaults to true.
1739 1739
 	 */
1740
-	if ( apply_filters( 'use_default_gallery_style', ! $html5 ) ) {
1740
+	if (apply_filters('use_default_gallery_style', ! $html5)) {
1741 1741
 		$gallery_style = "
1742 1742
 		<style type='text/css'>
1743 1743
 			#{$selector} {
@@ -1759,7 +1759,7 @@  discard block
 block discarded – undo
1759 1759
 		</style>\n\t\t";
1760 1760
 	}
1761 1761
 
1762
-	$size_class = sanitize_html_class( $atts['size'] );
1762
+	$size_class = sanitize_html_class($atts['size']);
1763 1763
 	$gallery_div = "<div id='$selector' class='gallery galleryid-{$id} gallery-columns-{$columns} gallery-size-{$size_class}'>";
1764 1764
 
1765 1765
 	/**
@@ -1770,43 +1770,43 @@  discard block
 block discarded – undo
1770 1770
 	 * @param string $gallery_style Default CSS styles and opening HTML div container
1771 1771
 	 *                              for the gallery shortcode output.
1772 1772
 	 */
1773
-	$output = apply_filters( 'gallery_style', $gallery_style . $gallery_div );
1773
+	$output = apply_filters('gallery_style', $gallery_style.$gallery_div);
1774 1774
 
1775 1775
 	$i = 0;
1776
-	foreach ( $attachments as $id => $attachment ) {
1776
+	foreach ($attachments as $id => $attachment) {
1777 1777
 
1778
-		$attr = ( trim( $attachment->post_excerpt ) ) ? array( 'aria-describedby' => "$selector-$id" ) : '';
1779
-		if ( ! empty( $atts['link'] ) && 'file' === $atts['link'] ) {
1780
-			$image_output = wp_get_attachment_link( $id, $atts['size'], false, false, false, $attr );
1781
-		} elseif ( ! empty( $atts['link'] ) && 'none' === $atts['link'] ) {
1782
-			$image_output = wp_get_attachment_image( $id, $atts['size'], false, $attr );
1778
+		$attr = (trim($attachment->post_excerpt)) ? array('aria-describedby' => "$selector-$id") : '';
1779
+		if ( ! empty($atts['link']) && 'file' === $atts['link']) {
1780
+			$image_output = wp_get_attachment_link($id, $atts['size'], false, false, false, $attr);
1781
+		} elseif ( ! empty($atts['link']) && 'none' === $atts['link']) {
1782
+			$image_output = wp_get_attachment_image($id, $atts['size'], false, $attr);
1783 1783
 		} else {
1784
-			$image_output = wp_get_attachment_link( $id, $atts['size'], true, false, false, $attr );
1784
+			$image_output = wp_get_attachment_link($id, $atts['size'], true, false, false, $attr);
1785 1785
 		}
1786
-		$image_meta  = wp_get_attachment_metadata( $id );
1786
+		$image_meta  = wp_get_attachment_metadata($id);
1787 1787
 
1788 1788
 		$orientation = '';
1789
-		if ( isset( $image_meta['height'], $image_meta['width'] ) ) {
1790
-			$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
1789
+		if (isset($image_meta['height'], $image_meta['width'])) {
1790
+			$orientation = ($image_meta['height'] > $image_meta['width']) ? 'portrait' : 'landscape';
1791 1791
 		}
1792 1792
 		$output .= "<{$itemtag} class='gallery-item'>";
1793 1793
 		$output .= "
1794 1794
 			<{$icontag} class='gallery-icon {$orientation}'>
1795 1795
 				$image_output
1796 1796
 			</{$icontag}>";
1797
-		if ( $captiontag && trim($attachment->post_excerpt) ) {
1797
+		if ($captiontag && trim($attachment->post_excerpt)) {
1798 1798
 			$output .= "
1799 1799
 				<{$captiontag} class='wp-caption-text gallery-caption' id='$selector-$id'>
1800
-				" . wptexturize($attachment->post_excerpt) . "
1800
+				".wptexturize($attachment->post_excerpt)."
1801 1801
 				</{$captiontag}>";
1802 1802
 		}
1803 1803
 		$output .= "</{$itemtag}>";
1804
-		if ( ! $html5 && $columns > 0 && ++$i % $columns == 0 ) {
1804
+		if ( ! $html5 && $columns > 0 && ++$i % $columns == 0) {
1805 1805
 			$output .= '<br style="clear: both" />';
1806 1806
 		}
1807 1807
 	}
1808 1808
 
1809
-	if ( ! $html5 && $columns > 0 && $i % $columns !== 0 ) {
1809
+	if ( ! $html5 && $columns > 0 && $i % $columns !== 0) {
1810 1810
 		$output .= "
1811 1811
 			<br style='clear: both' />";
1812 1812
 	}
@@ -1831,7 +1831,7 @@  discard block
 block discarded – undo
1831 1831
 	<div class="wp-playlist-caption">
1832 1832
 		<span class="wp-playlist-item-meta wp-playlist-item-title"><?php
1833 1833
 			/* translators: playlist item title */
1834
-			printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{ data.title }}' );
1834
+			printf(_x('&#8220;%s&#8221;', 'playlist item title'), '{{ data.title }}');
1835 1835
 		?></span>
1836 1836
 		<# if ( data.meta.album ) { #><span class="wp-playlist-item-meta wp-playlist-item-album">{{ data.meta.album }}</span><# } #>
1837 1837
 		<# if ( data.meta.artist ) { #><span class="wp-playlist-item-meta wp-playlist-item-artist">{{ data.meta.artist }}</span><# } #>
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
 			<# } else { #>
1847 1847
 				<span class="wp-playlist-item-title"><?php
1848 1848
 					/* translators: playlist item title */
1849
-					printf( _x( '&#8220;%s&#8221;', 'playlist item title' ), '{{{ data.title }}}' );
1849
+					printf(_x('&#8220;%s&#8221;', 'playlist item title'), '{{{ data.title }}}');
1850 1850
 				?></span>
1851 1851
 				<# if ( data.artists && data.meta.artist ) { #>
1852 1852
 				<span class="wp-playlist-item-artist"> &mdash; {{ data.meta.artist }}</span>
@@ -1868,14 +1868,14 @@  discard block
 block discarded – undo
1868 1868
  *
1869 1869
  * @param string $type Type of playlist. Accepts 'audio' or 'video'.
1870 1870
  */
1871
-function wp_playlist_scripts( $type ) {
1872
-	wp_enqueue_style( 'wp-mediaelement' );
1873
-	wp_enqueue_script( 'wp-playlist' );
1871
+function wp_playlist_scripts($type) {
1872
+	wp_enqueue_style('wp-mediaelement');
1873
+	wp_enqueue_script('wp-playlist');
1874 1874
 ?>
1875
-<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js( $type ) ?>');</script><![endif]-->
1875
+<!--[if lt IE 9]><script>document.createElement('<?php echo esc_js($type) ?>');</script><![endif]-->
1876 1876
 <?php
1877
-	add_action( 'wp_footer', 'wp_underscore_playlist_templates', 0 );
1878
-	add_action( 'admin_footer', 'wp_underscore_playlist_templates', 0 );
1877
+	add_action('wp_footer', 'wp_underscore_playlist_templates', 0);
1878
+	add_action('admin_footer', 'wp_underscore_playlist_templates', 0);
1879 1879
 }
1880 1880
 
1881 1881
 /**
@@ -1915,16 +1915,16 @@  discard block
 block discarded – undo
1915 1915
  *
1916 1916
  * @return string Playlist output. Empty string if the passed type is unsupported.
1917 1917
  */
1918
-function wp_playlist_shortcode( $attr ) {
1918
+function wp_playlist_shortcode($attr) {
1919 1919
 	global $content_width;
1920 1920
 	$post = get_post();
1921 1921
 
1922 1922
 	static $instance = 0;
1923 1923
 	$instance++;
1924 1924
 
1925
-	if ( ! empty( $attr['ids'] ) ) {
1925
+	if ( ! empty($attr['ids'])) {
1926 1926
 		// 'ids' is explicitly ordered, unless you specify otherwise.
1927
-		if ( empty( $attr['orderby'] ) ) {
1927
+		if (empty($attr['orderby'])) {
1928 1928
 			$attr['orderby'] = 'post__in';
1929 1929
 		}
1930 1930
 		$attr['include'] = $attr['ids'];
@@ -1943,12 +1943,12 @@  discard block
 block discarded – undo
1943 1943
 	 * @param array  $attr     An array of shortcode attributes.
1944 1944
 	 * @param int    $instance Unique numeric ID of this playlist shortcode instance.
1945 1945
 	 */
1946
-	$output = apply_filters( 'post_playlist', '', $attr, $instance );
1947
-	if ( $output != '' ) {
1946
+	$output = apply_filters('post_playlist', '', $attr, $instance);
1947
+	if ($output != '') {
1948 1948
 		return $output;
1949 1949
 	}
1950 1950
 
1951
-	$atts = shortcode_atts( array(
1951
+	$atts = shortcode_atts(array(
1952 1952
 		'type'		=> 'audio',
1953 1953
 		'order'		=> 'ASC',
1954 1954
 		'orderby'	=> 'menu_order ID',
@@ -1960,11 +1960,11 @@  discard block
 block discarded – undo
1960 1960
 		'tracknumbers' => true,
1961 1961
 		'images'	=> true,
1962 1962
 		'artists'	=> true
1963
-	), $attr, 'playlist' );
1963
+	), $attr, 'playlist');
1964 1964
 
1965
-	$id = intval( $atts['id'] );
1965
+	$id = intval($atts['id']);
1966 1966
 
1967
-	if ( $atts['type'] !== 'audio' ) {
1967
+	if ($atts['type'] !== 'audio') {
1968 1968
 		$atts['type'] = 'video';
1969 1969
 	}
1970 1970
 
@@ -1976,31 +1976,31 @@  discard block
 block discarded – undo
1976 1976
 		'orderby' => $atts['orderby']
1977 1977
 	);
1978 1978
 
1979
-	if ( ! empty( $atts['include'] ) ) {
1979
+	if ( ! empty($atts['include'])) {
1980 1980
 		$args['include'] = $atts['include'];
1981
-		$_attachments = get_posts( $args );
1981
+		$_attachments = get_posts($args);
1982 1982
 
1983 1983
 		$attachments = array();
1984
-		foreach ( $_attachments as $key => $val ) {
1984
+		foreach ($_attachments as $key => $val) {
1985 1985
 			$attachments[$val->ID] = $_attachments[$key];
1986 1986
 		}
1987
-	} elseif ( ! empty( $atts['exclude'] ) ) {
1987
+	} elseif ( ! empty($atts['exclude'])) {
1988 1988
 		$args['post_parent'] = $id;
1989 1989
 		$args['exclude'] = $atts['exclude'];
1990
-		$attachments = get_children( $args );
1990
+		$attachments = get_children($args);
1991 1991
 	} else {
1992 1992
 		$args['post_parent'] = $id;
1993
-		$attachments = get_children( $args );
1993
+		$attachments = get_children($args);
1994 1994
 	}
1995 1995
 
1996
-	if ( empty( $attachments ) ) {
1996
+	if (empty($attachments)) {
1997 1997
 		return '';
1998 1998
 	}
1999 1999
 
2000
-	if ( is_feed() ) {
2000
+	if (is_feed()) {
2001 2001
 		$output = "\n";
2002
-		foreach ( $attachments as $att_id => $attachment ) {
2003
-			$output .= wp_get_attachment_link( $att_id ) . "\n";
2002
+		foreach ($attachments as $att_id => $attachment) {
2003
+			$output .= wp_get_attachment_link($att_id)."\n";
2004 2004
 		}
2005 2005
 		return $output;
2006 2006
 	}
@@ -2010,22 +2010,22 @@  discard block
 block discarded – undo
2010 2010
 	$default_width = 640;
2011 2011
 	$default_height = 360;
2012 2012
 
2013
-	$theme_width = empty( $content_width ) ? $default_width : ( $content_width - $outer );
2014
-	$theme_height = empty( $content_width ) ? $default_height : round( ( $default_height * $theme_width ) / $default_width );
2013
+	$theme_width = empty($content_width) ? $default_width : ($content_width - $outer);
2014
+	$theme_height = empty($content_width) ? $default_height : round(($default_height * $theme_width) / $default_width);
2015 2015
 
2016 2016
 	$data = array(
2017 2017
 		'type' => $atts['type'],
2018 2018
 		// don't pass strings to JSON, will be truthy in JS
2019
-		'tracklist' => wp_validate_boolean( $atts['tracklist'] ),
2020
-		'tracknumbers' => wp_validate_boolean( $atts['tracknumbers'] ),
2021
-		'images' => wp_validate_boolean( $atts['images'] ),
2022
-		'artists' => wp_validate_boolean( $atts['artists'] ),
2019
+		'tracklist' => wp_validate_boolean($atts['tracklist']),
2020
+		'tracknumbers' => wp_validate_boolean($atts['tracknumbers']),
2021
+		'images' => wp_validate_boolean($atts['images']),
2022
+		'artists' => wp_validate_boolean($atts['artists']),
2023 2023
 	);
2024 2024
 
2025 2025
 	$tracks = array();
2026
-	foreach ( $attachments as $attachment ) {
2027
-		$url = wp_get_attachment_url( $attachment->ID );
2028
-		$ftype = wp_check_filetype( $url, wp_get_mime_types() );
2026
+	foreach ($attachments as $attachment) {
2027
+		$url = wp_get_attachment_url($attachment->ID);
2028
+		$ftype = wp_check_filetype($url, wp_get_mime_types());
2029 2029
 		$track = array(
2030 2030
 			'src' => $url,
2031 2031
 			'type' => $ftype['type'],
@@ -2035,27 +2035,27 @@  discard block
 block discarded – undo
2035 2035
 		);
2036 2036
 
2037 2037
 		$track['meta'] = array();
2038
-		$meta = wp_get_attachment_metadata( $attachment->ID );
2039
-		if ( ! empty( $meta ) ) {
2038
+		$meta = wp_get_attachment_metadata($attachment->ID);
2039
+		if ( ! empty($meta)) {
2040 2040
 
2041
-			foreach ( wp_get_attachment_id3_keys( $attachment ) as $key => $label ) {
2042
-				if ( ! empty( $meta[ $key ] ) ) {
2043
-					$track['meta'][ $key ] = $meta[ $key ];
2041
+			foreach (wp_get_attachment_id3_keys($attachment) as $key => $label) {
2042
+				if ( ! empty($meta[$key])) {
2043
+					$track['meta'][$key] = $meta[$key];
2044 2044
 				}
2045 2045
 			}
2046 2046
 
2047
-			if ( 'video' === $atts['type'] ) {
2048
-				if ( ! empty( $meta['width'] ) && ! empty( $meta['height'] ) ) {
2047
+			if ('video' === $atts['type']) {
2048
+				if ( ! empty($meta['width']) && ! empty($meta['height'])) {
2049 2049
 					$width = $meta['width'];
2050 2050
 					$height = $meta['height'];
2051
-					$theme_height = round( ( $height * $theme_width ) / $width );
2051
+					$theme_height = round(($height * $theme_width) / $width);
2052 2052
 				} else {
2053 2053
 					$width = $default_width;
2054 2054
 					$height = $default_height;
2055 2055
 				}
2056 2056
 
2057 2057
 				$track['dimensions'] = array(
2058
-					'original' => compact( 'width', 'height' ),
2058
+					'original' => compact('width', 'height'),
2059 2059
 					'resized' => array(
2060 2060
 						'width' => $theme_width,
2061 2061
 						'height' => $theme_height
@@ -2064,19 +2064,19 @@  discard block
 block discarded – undo
2064 2064
 			}
2065 2065
 		}
2066 2066
 
2067
-		if ( $atts['images'] ) {
2068
-			$thumb_id = get_post_thumbnail_id( $attachment->ID );
2069
-			if ( ! empty( $thumb_id ) ) {
2070
-				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'full' );
2071
-				$track['image'] = compact( 'src', 'width', 'height' );
2072
-				list( $src, $width, $height ) = wp_get_attachment_image_src( $thumb_id, 'thumbnail' );
2073
-				$track['thumb'] = compact( 'src', 'width', 'height' );
2067
+		if ($atts['images']) {
2068
+			$thumb_id = get_post_thumbnail_id($attachment->ID);
2069
+			if ( ! empty($thumb_id)) {
2070
+				list($src, $width, $height) = wp_get_attachment_image_src($thumb_id, 'full');
2071
+				$track['image'] = compact('src', 'width', 'height');
2072
+				list($src, $width, $height) = wp_get_attachment_image_src($thumb_id, 'thumbnail');
2073
+				$track['thumb'] = compact('src', 'width', 'height');
2074 2074
 			} else {
2075
-				$src = wp_mime_type_icon( $attachment->ID );
2075
+				$src = wp_mime_type_icon($attachment->ID);
2076 2076
 				$width = 48;
2077 2077
 				$height = 64;
2078
-				$track['image'] = compact( 'src', 'width', 'height' );
2079
-				$track['thumb'] = compact( 'src', 'width', 'height' );
2078
+				$track['image'] = compact('src', 'width', 'height');
2079
+				$track['thumb'] = compact('src', 'width', 'height');
2080 2080
 			}
2081 2081
 		}
2082 2082
 
@@ -2084,12 +2084,12 @@  discard block
 block discarded – undo
2084 2084
 	}
2085 2085
 	$data['tracks'] = $tracks;
2086 2086
 
2087
-	$safe_type = esc_attr( $atts['type'] );
2088
-	$safe_style = esc_attr( $atts['style'] );
2087
+	$safe_type = esc_attr($atts['type']);
2088
+	$safe_style = esc_attr($atts['style']);
2089 2089
 
2090 2090
 	ob_start();
2091 2091
 
2092
-	if ( 1 === $instance ) {
2092
+	if (1 === $instance) {
2093 2093
 		/**
2094 2094
 		 * Prints and enqueues playlist scripts, styles, and JavaScript templates.
2095 2095
 		 *
@@ -2098,32 +2098,32 @@  discard block
 block discarded – undo
2098 2098
 		 * @param string $type  Type of playlist. Possible values are 'audio' or 'video'.
2099 2099
 		 * @param string $style The 'theme' for the playlist. Core provides 'light' and 'dark'.
2100 2100
 		 */
2101
-		do_action( 'wp_playlist_scripts', $atts['type'], $atts['style'] );
2101
+		do_action('wp_playlist_scripts', $atts['type'], $atts['style']);
2102 2102
 	} ?>
2103 2103
 <div class="wp-playlist wp-<?php echo $safe_type ?>-playlist wp-playlist-<?php echo $safe_style ?>">
2104
-	<?php if ( 'audio' === $atts['type'] ): ?>
2104
+	<?php if ('audio' === $atts['type']): ?>
2105 2105
 	<div class="wp-playlist-current-item"></div>
2106 2106
 	<?php endif ?>
2107 2107
 	<<?php echo $safe_type ?> controls="controls" preload="none" width="<?php
2108 2108
 		echo (int) $theme_width;
2109
-	?>"<?php if ( 'video' === $safe_type ):
2109
+	?>"<?php if ('video' === $safe_type):
2110 2110
 		echo ' height="', (int) $theme_height, '"';
2111 2111
 	endif; ?>></<?php echo $safe_type ?>>
2112 2112
 	<div class="wp-playlist-next"></div>
2113 2113
 	<div class="wp-playlist-prev"></div>
2114 2114
 	<noscript>
2115 2115
 	<ol><?php
2116
-	foreach ( $attachments as $att_id => $attachment ) {
2117
-		printf( '<li>%s</li>', wp_get_attachment_link( $att_id ) );
2116
+	foreach ($attachments as $att_id => $attachment) {
2117
+		printf('<li>%s</li>', wp_get_attachment_link($att_id));
2118 2118
 	}
2119 2119
 	?></ol>
2120 2120
 	</noscript>
2121
-	<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode( $data ) ?></script>
2121
+	<script type="application/json" class="wp-playlist-script"><?php echo wp_json_encode($data) ?></script>
2122 2122
 </div>
2123 2123
 	<?php
2124 2124
 	return ob_get_clean();
2125 2125
 }
2126
-add_shortcode( 'playlist', 'wp_playlist_shortcode' );
2126
+add_shortcode('playlist', 'wp_playlist_shortcode');
2127 2127
 
2128 2128
 /**
2129 2129
  * Provides a No-JS Flash fallback as a last resort for audio / video.
@@ -2133,7 +2133,7 @@  discard block
 block discarded – undo
2133 2133
  * @param string $url The media element URL.
2134 2134
  * @return string Fallback HTML.
2135 2135
  */
2136
-function wp_mediaelement_fallback( $url ) {
2136
+function wp_mediaelement_fallback($url) {
2137 2137
 	/**
2138 2138
 	 * Filters the Mediaelement fallback output for no-JS.
2139 2139
 	 *
@@ -2142,7 +2142,7 @@  discard block
 block discarded – undo
2142 2142
 	 * @param string $output Fallback output for no-JS.
2143 2143
 	 * @param string $url    Media file URL.
2144 2144
 	 */
2145
-	return apply_filters( 'wp_mediaelement_fallback', sprintf( '<a href="%1$s">%1$s</a>', esc_url( $url ) ), $url );
2145
+	return apply_filters('wp_mediaelement_fallback', sprintf('<a href="%1$s">%1$s</a>', esc_url($url)), $url);
2146 2146
 }
2147 2147
 
2148 2148
 /**
@@ -2161,7 +2161,7 @@  discard block
 block discarded – undo
2161 2161
 	 * @param array $extensions An array of support audio formats. Defaults are
2162 2162
 	 *                          'mp3', 'ogg', 'wma', 'm4a', 'wav'.
2163 2163
 	 */
2164
-	return apply_filters( 'wp_audio_extensions', array( 'mp3', 'ogg', 'wma', 'm4a', 'wav' ) );
2164
+	return apply_filters('wp_audio_extensions', array('mp3', 'ogg', 'wma', 'm4a', 'wav'));
2165 2165
 }
2166 2166
 
2167 2167
 /**
@@ -2173,19 +2173,19 @@  discard block
 block discarded – undo
2173 2173
  * @param string  $context    Optional. The context. Accepts 'edit', 'display'. Default 'display'.
2174 2174
  * @return array Key/value pairs of field keys to labels.
2175 2175
  */
2176
-function wp_get_attachment_id3_keys( $attachment, $context = 'display' ) {
2176
+function wp_get_attachment_id3_keys($attachment, $context = 'display') {
2177 2177
 	$fields = array(
2178
-		'artist' => __( 'Artist' ),
2179
-		'album' => __( 'Album' ),
2178
+		'artist' => __('Artist'),
2179
+		'album' => __('Album'),
2180 2180
 	);
2181 2181
 
2182
-	if ( 'display' === $context ) {
2183
-		$fields['genre']            = __( 'Genre' );
2184
-		$fields['year']             = __( 'Year' );
2185
-		$fields['length_formatted'] = _x( 'Length', 'video or audio' );
2186
-	} elseif ( 'js' === $context ) {
2187
-		$fields['bitrate']          = __( 'Bitrate' );
2188
-		$fields['bitrate_mode']     = __( 'Bitrate Mode' );
2182
+	if ('display' === $context) {
2183
+		$fields['genre']            = __('Genre');
2184
+		$fields['year']             = __('Year');
2185
+		$fields['length_formatted'] = _x('Length', 'video or audio');
2186
+	} elseif ('js' === $context) {
2187
+		$fields['bitrate']          = __('Bitrate');
2188
+		$fields['bitrate_mode']     = __('Bitrate Mode');
2189 2189
 	}
2190 2190
 
2191 2191
 	/**
@@ -2197,7 +2197,7 @@  discard block
 block discarded – undo
2197 2197
 	 * @param WP_Post $attachment Attachment object.
2198 2198
 	 * @param string  $context    The context. Accepts 'edit', 'display'. Default 'display'.
2199 2199
 	 */
2200
-	return apply_filters( 'wp_get_attachment_id3_keys', $fields, $attachment, $context );
2200
+	return apply_filters('wp_get_attachment_id3_keys', $fields, $attachment, $context);
2201 2201
 }
2202 2202
 /**
2203 2203
  * Builds the Audio shortcode output.
@@ -2222,7 +2222,7 @@  discard block
 block discarded – undo
2222 2222
  * @param string $content Shortcode content.
2223 2223
  * @return string|void HTML content to display audio.
2224 2224
  */
2225
-function wp_audio_shortcode( $attr, $content = '' ) {
2225
+function wp_audio_shortcode($attr, $content = '') {
2226 2226
 	$post_id = get_post() ? get_the_ID() : 0;
2227 2227
 
2228 2228
 	static $instance = 0;
@@ -2240,8 +2240,8 @@  discard block
 block discarded – undo
2240 2240
 	 * @param string $content  Shortcode content.
2241 2241
 	 * @param int    $instance Unique numeric ID of this audio shortcode instance.
2242 2242
 	 */
2243
-	$override = apply_filters( 'wp_audio_shortcode_override', '', $attr, $content, $instance );
2244
-	if ( '' !== $override ) {
2243
+	$override = apply_filters('wp_audio_shortcode_override', '', $attr, $content, $instance);
2244
+	if ('' !== $override) {
2245 2245
 		return $override;
2246 2246
 	}
2247 2247
 
@@ -2256,44 +2256,44 @@  discard block
 block discarded – undo
2256 2256
 		'class'    => 'wp-audio-shortcode',
2257 2257
 		'style'    => 'width: 100%;'
2258 2258
 	);
2259
-	foreach ( $default_types as $type ) {
2259
+	foreach ($default_types as $type) {
2260 2260
 		$defaults_atts[$type] = '';
2261 2261
 	}
2262 2262
 
2263
-	$atts = shortcode_atts( $defaults_atts, $attr, 'audio' );
2263
+	$atts = shortcode_atts($defaults_atts, $attr, 'audio');
2264 2264
 
2265 2265
 	$primary = false;
2266
-	if ( ! empty( $atts['src'] ) ) {
2267
-		$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
2268
-		if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
2269
-			return sprintf( '<a class="wp-embedded-audio" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
2266
+	if ( ! empty($atts['src'])) {
2267
+		$type = wp_check_filetype($atts['src'], wp_get_mime_types());
2268
+		if ( ! in_array(strtolower($type['ext']), $default_types)) {
2269
+			return sprintf('<a class="wp-embedded-audio" href="%s">%s</a>', esc_url($atts['src']), esc_html($atts['src']));
2270 2270
 		}
2271 2271
 		$primary = true;
2272
-		array_unshift( $default_types, 'src' );
2272
+		array_unshift($default_types, 'src');
2273 2273
 	} else {
2274
-		foreach ( $default_types as $ext ) {
2275
-			if ( ! empty( $atts[ $ext ] ) ) {
2276
-				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
2277
-				if ( strtolower( $type['ext'] ) === $ext ) {
2274
+		foreach ($default_types as $ext) {
2275
+			if ( ! empty($atts[$ext])) {
2276
+				$type = wp_check_filetype($atts[$ext], wp_get_mime_types());
2277
+				if (strtolower($type['ext']) === $ext) {
2278 2278
 					$primary = true;
2279 2279
 				}
2280 2280
 			}
2281 2281
 		}
2282 2282
 	}
2283 2283
 
2284
-	if ( ! $primary ) {
2285
-		$audios = get_attached_media( 'audio', $post_id );
2286
-		if ( empty( $audios ) ) {
2284
+	if ( ! $primary) {
2285
+		$audios = get_attached_media('audio', $post_id);
2286
+		if (empty($audios)) {
2287 2287
 			return;
2288 2288
 		}
2289 2289
 
2290
-		$audio = reset( $audios );
2291
-		$atts['src'] = wp_get_attachment_url( $audio->ID );
2292
-		if ( empty( $atts['src'] ) ) {
2290
+		$audio = reset($audios);
2291
+		$atts['src'] = wp_get_attachment_url($audio->ID);
2292
+		if (empty($atts['src'])) {
2293 2293
 			return;
2294 2294
 		}
2295 2295
 
2296
-		array_unshift( $default_types, 'src' );
2296
+		array_unshift($default_types, 'src');
2297 2297
 	}
2298 2298
 
2299 2299
 	/**
@@ -2303,10 +2303,10 @@  discard block
 block discarded – undo
2303 2303
 	 *
2304 2304
 	 * @param string $library Media library used for the audio shortcode.
2305 2305
 	 */
2306
-	$library = apply_filters( 'wp_audio_shortcode_library', 'mediaelement' );
2307
-	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
2308
-		wp_enqueue_style( 'wp-mediaelement' );
2309
-		wp_enqueue_script( 'wp-mediaelement' );
2306
+	$library = apply_filters('wp_audio_shortcode_library', 'mediaelement');
2307
+	if ('mediaelement' === $library && did_action('init')) {
2308
+		wp_enqueue_style('wp-mediaelement');
2309
+		wp_enqueue_script('wp-mediaelement');
2310 2310
 	}
2311 2311
 
2312 2312
 	/**
@@ -2316,50 +2316,50 @@  discard block
 block discarded – undo
2316 2316
 	 *
2317 2317
 	 * @param string $class CSS class or list of space-separated classes.
2318 2318
 	 */
2319
-	$atts['class'] = apply_filters( 'wp_audio_shortcode_class', $atts['class'] );
2319
+	$atts['class'] = apply_filters('wp_audio_shortcode_class', $atts['class']);
2320 2320
 
2321 2321
 	$html_atts = array(
2322 2322
 		'class'    => $atts['class'],
2323
-		'id'       => sprintf( 'audio-%d-%d', $post_id, $instance ),
2324
-		'loop'     => wp_validate_boolean( $atts['loop'] ),
2325
-		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
2323
+		'id'       => sprintf('audio-%d-%d', $post_id, $instance),
2324
+		'loop'     => wp_validate_boolean($atts['loop']),
2325
+		'autoplay' => wp_validate_boolean($atts['autoplay']),
2326 2326
 		'preload'  => $atts['preload'],
2327 2327
 		'style'    => $atts['style'],
2328 2328
 	);
2329 2329
 
2330 2330
 	// These ones should just be omitted altogether if they are blank
2331
-	foreach ( array( 'loop', 'autoplay', 'preload' ) as $a ) {
2332
-		if ( empty( $html_atts[$a] ) ) {
2333
-			unset( $html_atts[$a] );
2331
+	foreach (array('loop', 'autoplay', 'preload') as $a) {
2332
+		if (empty($html_atts[$a])) {
2333
+			unset($html_atts[$a]);
2334 2334
 		}
2335 2335
 	}
2336 2336
 
2337 2337
 	$attr_strings = array();
2338
-	foreach ( $html_atts as $k => $v ) {
2339
-		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
2338
+	foreach ($html_atts as $k => $v) {
2339
+		$attr_strings[] = $k.'="'.esc_attr($v).'"';
2340 2340
 	}
2341 2341
 
2342 2342
 	$html = '';
2343
-	if ( 'mediaelement' === $library && 1 === $instance ) {
2343
+	if ('mediaelement' === $library && 1 === $instance) {
2344 2344
 		$html .= "<!--[if lt IE 9]><script>document.createElement('audio');</script><![endif]-->\n";
2345 2345
 	}
2346
-	$html .= sprintf( '<audio %s controls="controls">', join( ' ', $attr_strings ) );
2346
+	$html .= sprintf('<audio %s controls="controls">', join(' ', $attr_strings));
2347 2347
 
2348 2348
 	$fileurl = '';
2349 2349
 	$source = '<source type="%s" src="%s" />';
2350
-	foreach ( $default_types as $fallback ) {
2351
-		if ( ! empty( $atts[ $fallback ] ) ) {
2352
-			if ( empty( $fileurl ) ) {
2353
-				$fileurl = $atts[ $fallback ];
2350
+	foreach ($default_types as $fallback) {
2351
+		if ( ! empty($atts[$fallback])) {
2352
+			if (empty($fileurl)) {
2353
+				$fileurl = $atts[$fallback];
2354 2354
 			}
2355
-			$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
2356
-			$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
2357
-			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
2355
+			$type = wp_check_filetype($atts[$fallback], wp_get_mime_types());
2356
+			$url = add_query_arg('_', $instance, $atts[$fallback]);
2357
+			$html .= sprintf($source, $type['type'], esc_url($url));
2358 2358
 		}
2359 2359
 	}
2360 2360
 
2361
-	if ( 'mediaelement' === $library ) {
2362
-		$html .= wp_mediaelement_fallback( $fileurl );
2361
+	if ('mediaelement' === $library) {
2362
+		$html .= wp_mediaelement_fallback($fileurl);
2363 2363
 	}
2364 2364
 	$html .= '</audio>';
2365 2365
 
@@ -2374,9 +2374,9 @@  discard block
 block discarded – undo
2374 2374
 	 * @param int    $post_id Post ID.
2375 2375
 	 * @param string $library Media library used for the audio shortcode.
2376 2376
 	 */
2377
-	return apply_filters( 'wp_audio_shortcode', $html, $atts, $audio, $post_id, $library );
2377
+	return apply_filters('wp_audio_shortcode', $html, $atts, $audio, $post_id, $library);
2378 2378
 }
2379
-add_shortcode( 'audio', 'wp_audio_shortcode' );
2379
+add_shortcode('audio', 'wp_audio_shortcode');
2380 2380
 
2381 2381
 /**
2382 2382
  * Returns a filtered list of WP-supported video formats.
@@ -2394,7 +2394,7 @@  discard block
 block discarded – undo
2394 2394
 	 * @param array $extensions An array of support video formats. Defaults are
2395 2395
 	 *                          'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'.
2396 2396
 	 */
2397
-	return apply_filters( 'wp_video_extensions', array( 'mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv' ) );
2397
+	return apply_filters('wp_video_extensions', array('mp4', 'm4v', 'webm', 'ogv', 'wmv', 'flv'));
2398 2398
 }
2399 2399
 
2400 2400
 /**
@@ -2425,7 +2425,7 @@  discard block
 block discarded – undo
2425 2425
  * @param string $content Shortcode content.
2426 2426
  * @return string|void HTML content to display video.
2427 2427
  */
2428
-function wp_video_shortcode( $attr, $content = '' ) {
2428
+function wp_video_shortcode($attr, $content = '') {
2429 2429
 	global $content_width;
2430 2430
 	$post_id = get_post() ? get_the_ID() : 0;
2431 2431
 
@@ -2447,8 +2447,8 @@  discard block
 block discarded – undo
2447 2447
 	 * @param string $content  Video shortcode content.
2448 2448
 	 * @param int    $instance Unique numeric ID of this video shortcode instance.
2449 2449
 	 */
2450
-	$override = apply_filters( 'wp_video_shortcode_override', '', $attr, $content, $instance );
2451
-	if ( '' !== $override ) {
2450
+	$override = apply_filters('wp_video_shortcode_override', '', $attr, $content, $instance);
2451
+	if ('' !== $override) {
2452 2452
 		return $override;
2453 2453
 	}
2454 2454
 
@@ -2466,22 +2466,22 @@  discard block
 block discarded – undo
2466 2466
 		'class'    => 'wp-video-shortcode',
2467 2467
 	);
2468 2468
 
2469
-	foreach ( $default_types as $type ) {
2469
+	foreach ($default_types as $type) {
2470 2470
 		$defaults_atts[$type] = '';
2471 2471
 	}
2472 2472
 
2473
-	$atts = shortcode_atts( $defaults_atts, $attr, 'video' );
2473
+	$atts = shortcode_atts($defaults_atts, $attr, 'video');
2474 2474
 
2475
-	if ( is_admin() ) {
2475
+	if (is_admin()) {
2476 2476
 		// shrink the video so it isn't huge in the admin
2477
-		if ( $atts['width'] > $defaults_atts['width'] ) {
2478
-			$atts['height'] = round( ( $atts['height'] * $defaults_atts['width'] ) / $atts['width'] );
2477
+		if ($atts['width'] > $defaults_atts['width']) {
2478
+			$atts['height'] = round(($atts['height'] * $defaults_atts['width']) / $atts['width']);
2479 2479
 			$atts['width'] = $defaults_atts['width'];
2480 2480
 		}
2481 2481
 	} else {
2482 2482
 		// if the video is bigger than the theme
2483
-		if ( ! empty( $content_width ) && $atts['width'] > $content_width ) {
2484
-			$atts['height'] = round( ( $atts['height'] * $content_width ) / $atts['width'] );
2483
+		if ( ! empty($content_width) && $atts['width'] > $content_width) {
2484
+			$atts['height'] = round(($atts['height'] * $content_width) / $atts['width']);
2485 2485
 			$atts['width'] = $content_width;
2486 2486
 		}
2487 2487
 	}
@@ -2491,46 +2491,46 @@  discard block
 block discarded – undo
2491 2491
 	$vimeo_pattern = '#^https?://(.+\.)?vimeo\.com/.*#';
2492 2492
 
2493 2493
 	$primary = false;
2494
-	if ( ! empty( $atts['src'] ) ) {
2495
-		$is_vimeo = ( preg_match( $vimeo_pattern, $atts['src'] ) );
2496
-		$is_youtube = (  preg_match( $yt_pattern, $atts['src'] ) );
2497
-		if ( ! $is_youtube && ! $is_vimeo ) {
2498
-			$type = wp_check_filetype( $atts['src'], wp_get_mime_types() );
2499
-			if ( ! in_array( strtolower( $type['ext'] ), $default_types ) ) {
2500
-				return sprintf( '<a class="wp-embedded-video" href="%s">%s</a>', esc_url( $atts['src'] ), esc_html( $atts['src'] ) );
2494
+	if ( ! empty($atts['src'])) {
2495
+		$is_vimeo = (preg_match($vimeo_pattern, $atts['src']));
2496
+		$is_youtube = (preg_match($yt_pattern, $atts['src']));
2497
+		if ( ! $is_youtube && ! $is_vimeo) {
2498
+			$type = wp_check_filetype($atts['src'], wp_get_mime_types());
2499
+			if ( ! in_array(strtolower($type['ext']), $default_types)) {
2500
+				return sprintf('<a class="wp-embedded-video" href="%s">%s</a>', esc_url($atts['src']), esc_html($atts['src']));
2501 2501
 			}
2502 2502
 		}
2503 2503
 
2504
-		if ( $is_vimeo ) {
2505
-			wp_enqueue_script( 'froogaloop' );
2504
+		if ($is_vimeo) {
2505
+			wp_enqueue_script('froogaloop');
2506 2506
 		}
2507 2507
 
2508 2508
 		$primary = true;
2509
-		array_unshift( $default_types, 'src' );
2509
+		array_unshift($default_types, 'src');
2510 2510
 	} else {
2511
-		foreach ( $default_types as $ext ) {
2512
-			if ( ! empty( $atts[ $ext ] ) ) {
2513
-				$type = wp_check_filetype( $atts[ $ext ], wp_get_mime_types() );
2514
-				if ( strtolower( $type['ext'] ) === $ext ) {
2511
+		foreach ($default_types as $ext) {
2512
+			if ( ! empty($atts[$ext])) {
2513
+				$type = wp_check_filetype($atts[$ext], wp_get_mime_types());
2514
+				if (strtolower($type['ext']) === $ext) {
2515 2515
 					$primary = true;
2516 2516
 				}
2517 2517
 			}
2518 2518
 		}
2519 2519
 	}
2520 2520
 
2521
-	if ( ! $primary ) {
2522
-		$videos = get_attached_media( 'video', $post_id );
2523
-		if ( empty( $videos ) ) {
2521
+	if ( ! $primary) {
2522
+		$videos = get_attached_media('video', $post_id);
2523
+		if (empty($videos)) {
2524 2524
 			return;
2525 2525
 		}
2526 2526
 
2527
-		$video = reset( $videos );
2528
-		$atts['src'] = wp_get_attachment_url( $video->ID );
2529
-		if ( empty( $atts['src'] ) ) {
2527
+		$video = reset($videos);
2528
+		$atts['src'] = wp_get_attachment_url($video->ID);
2529
+		if (empty($atts['src'])) {
2530 2530
 			return;
2531 2531
 		}
2532 2532
 
2533
-		array_unshift( $default_types, 'src' );
2533
+		array_unshift($default_types, 'src');
2534 2534
 	}
2535 2535
 
2536 2536
 	/**
@@ -2540,10 +2540,10 @@  discard block
 block discarded – undo
2540 2540
 	 *
2541 2541
 	 * @param string $library Media library used for the video shortcode.
2542 2542
 	 */
2543
-	$library = apply_filters( 'wp_video_shortcode_library', 'mediaelement' );
2544
-	if ( 'mediaelement' === $library && did_action( 'init' ) ) {
2545
-		wp_enqueue_style( 'wp-mediaelement' );
2546
-		wp_enqueue_script( 'wp-mediaelement' );
2543
+	$library = apply_filters('wp_video_shortcode_library', 'mediaelement');
2544
+	if ('mediaelement' === $library && did_action('init')) {
2545
+		wp_enqueue_style('wp-mediaelement');
2546
+		wp_enqueue_script('wp-mediaelement');
2547 2547
 	}
2548 2548
 
2549 2549
 	/**
@@ -2553,73 +2553,73 @@  discard block
 block discarded – undo
2553 2553
 	 *
2554 2554
 	 * @param string $class CSS class or list of space-separated classes.
2555 2555
 	 */
2556
-	$atts['class'] = apply_filters( 'wp_video_shortcode_class', $atts['class'] );
2556
+	$atts['class'] = apply_filters('wp_video_shortcode_class', $atts['class']);
2557 2557
 
2558 2558
 	$html_atts = array(
2559 2559
 		'class'    => $atts['class'],
2560
-		'id'       => sprintf( 'video-%d-%d', $post_id, $instance ),
2561
-		'width'    => absint( $atts['width'] ),
2562
-		'height'   => absint( $atts['height'] ),
2563
-		'poster'   => esc_url( $atts['poster'] ),
2564
-		'loop'     => wp_validate_boolean( $atts['loop'] ),
2565
-		'autoplay' => wp_validate_boolean( $atts['autoplay'] ),
2560
+		'id'       => sprintf('video-%d-%d', $post_id, $instance),
2561
+		'width'    => absint($atts['width']),
2562
+		'height'   => absint($atts['height']),
2563
+		'poster'   => esc_url($atts['poster']),
2564
+		'loop'     => wp_validate_boolean($atts['loop']),
2565
+		'autoplay' => wp_validate_boolean($atts['autoplay']),
2566 2566
 		'preload'  => $atts['preload'],
2567 2567
 	);
2568 2568
 
2569 2569
 	// These ones should just be omitted altogether if they are blank
2570
-	foreach ( array( 'poster', 'loop', 'autoplay', 'preload' ) as $a ) {
2571
-		if ( empty( $html_atts[$a] ) ) {
2572
-			unset( $html_atts[$a] );
2570
+	foreach (array('poster', 'loop', 'autoplay', 'preload') as $a) {
2571
+		if (empty($html_atts[$a])) {
2572
+			unset($html_atts[$a]);
2573 2573
 		}
2574 2574
 	}
2575 2575
 
2576 2576
 	$attr_strings = array();
2577
-	foreach ( $html_atts as $k => $v ) {
2578
-		$attr_strings[] = $k . '="' . esc_attr( $v ) . '"';
2577
+	foreach ($html_atts as $k => $v) {
2578
+		$attr_strings[] = $k.'="'.esc_attr($v).'"';
2579 2579
 	}
2580 2580
 
2581 2581
 	$html = '';
2582
-	if ( 'mediaelement' === $library && 1 === $instance ) {
2582
+	if ('mediaelement' === $library && 1 === $instance) {
2583 2583
 		$html .= "<!--[if lt IE 9]><script>document.createElement('video');</script><![endif]-->\n";
2584 2584
 	}
2585
-	$html .= sprintf( '<video %s controls="controls">', join( ' ', $attr_strings ) );
2585
+	$html .= sprintf('<video %s controls="controls">', join(' ', $attr_strings));
2586 2586
 
2587 2587
 	$fileurl = '';
2588 2588
 	$source = '<source type="%s" src="%s" />';
2589
-	foreach ( $default_types as $fallback ) {
2590
-		if ( ! empty( $atts[ $fallback ] ) ) {
2591
-			if ( empty( $fileurl ) ) {
2592
-				$fileurl = $atts[ $fallback ];
2589
+	foreach ($default_types as $fallback) {
2590
+		if ( ! empty($atts[$fallback])) {
2591
+			if (empty($fileurl)) {
2592
+				$fileurl = $atts[$fallback];
2593 2593
 			}
2594
-			if ( 'src' === $fallback && $is_youtube ) {
2595
-				$type = array( 'type' => 'video/youtube' );
2596
-			} elseif ( 'src' === $fallback && $is_vimeo ) {
2597
-				$type = array( 'type' => 'video/vimeo' );
2594
+			if ('src' === $fallback && $is_youtube) {
2595
+				$type = array('type' => 'video/youtube');
2596
+			} elseif ('src' === $fallback && $is_vimeo) {
2597
+				$type = array('type' => 'video/vimeo');
2598 2598
 			} else {
2599
-				$type = wp_check_filetype( $atts[ $fallback ], wp_get_mime_types() );
2599
+				$type = wp_check_filetype($atts[$fallback], wp_get_mime_types());
2600 2600
 			}
2601
-			$url = add_query_arg( '_', $instance, $atts[ $fallback ] );
2602
-			$html .= sprintf( $source, $type['type'], esc_url( $url ) );
2601
+			$url = add_query_arg('_', $instance, $atts[$fallback]);
2602
+			$html .= sprintf($source, $type['type'], esc_url($url));
2603 2603
 		}
2604 2604
 	}
2605 2605
 
2606
-	if ( ! empty( $content ) ) {
2607
-		if ( false !== strpos( $content, "\n" ) ) {
2608
-			$content = str_replace( array( "\r\n", "\n", "\t" ), '', $content );
2606
+	if ( ! empty($content)) {
2607
+		if (false !== strpos($content, "\n")) {
2608
+			$content = str_replace(array("\r\n", "\n", "\t"), '', $content);
2609 2609
 		}
2610
-		$html .= trim( $content );
2610
+		$html .= trim($content);
2611 2611
 	}
2612 2612
 
2613
-	if ( 'mediaelement' === $library ) {
2614
-		$html .= wp_mediaelement_fallback( $fileurl );
2613
+	if ('mediaelement' === $library) {
2614
+		$html .= wp_mediaelement_fallback($fileurl);
2615 2615
 	}
2616 2616
 	$html .= '</video>';
2617 2617
 
2618 2618
 	$width_rule = '';
2619
-	if ( ! empty( $atts['width'] ) ) {
2620
-		$width_rule = sprintf( 'width: %dpx;', $atts['width'] );
2619
+	if ( ! empty($atts['width'])) {
2620
+		$width_rule = sprintf('width: %dpx;', $atts['width']);
2621 2621
 	}
2622
-	$output = sprintf( '<div style="%s" class="wp-video">%s</div>', $width_rule, $html );
2622
+	$output = sprintf('<div style="%s" class="wp-video">%s</div>', $width_rule, $html);
2623 2623
 
2624 2624
 	/**
2625 2625
 	 * Filters the output of the video shortcode.
@@ -2632,9 +2632,9 @@  discard block
 block discarded – undo
2632 2632
 	 * @param int    $post_id Post ID.
2633 2633
 	 * @param string $library Media library used for the video shortcode.
2634 2634
 	 */
2635
-	return apply_filters( 'wp_video_shortcode', $output, $atts, $video, $post_id, $library );
2635
+	return apply_filters('wp_video_shortcode', $output, $atts, $video, $post_id, $library);
2636 2636
 }
2637
-add_shortcode( 'video', 'wp_video_shortcode' );
2637
+add_shortcode('video', 'wp_video_shortcode');
2638 2638
 
2639 2639
 /**
2640 2640
  * Displays previous image link that has the same post parent.
@@ -2648,7 +2648,7 @@  discard block
 block discarded – undo
2648 2648
  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
2649 2649
  * @param string       $text Optional. Link text. Default false.
2650 2650
  */
2651
-function previous_image_link( $size = 'thumbnail', $text = false ) {
2651
+function previous_image_link($size = 'thumbnail', $text = false) {
2652 2652
 	adjacent_image_link(true, $size, $text);
2653 2653
 }
2654 2654
 
@@ -2664,7 +2664,7 @@  discard block
 block discarded – undo
2664 2664
  *                           default to 'post_title' or `$text`. Default 'thumbnail'.
2665 2665
  * @param string       $text Optional. Link text. Default false.
2666 2666
  */
2667
-function next_image_link( $size = 'thumbnail', $text = false ) {
2667
+function next_image_link($size = 'thumbnail', $text = false) {
2668 2668
 	adjacent_image_link(false, $size, $text);
2669 2669
 }
2670 2670
 
@@ -2680,12 +2680,12 @@  discard block
 block discarded – undo
2680 2680
  *                           values in pixels (in that order). Default 'thumbnail'.
2681 2681
  * @param bool         $text Optional. Link text. Default false.
2682 2682
  */
2683
-function adjacent_image_link( $prev = true, $size = 'thumbnail', $text = false ) {
2683
+function adjacent_image_link($prev = true, $size = 'thumbnail', $text = false) {
2684 2684
 	$post = get_post();
2685
-	$attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
2685
+	$attachments = array_values(get_children(array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID')));
2686 2686
 
2687
-	foreach ( $attachments as $k => $attachment ) {
2688
-		if ( $attachment->ID == $post->ID ) {
2687
+	foreach ($attachments as $k => $attachment) {
2688
+		if ($attachment->ID == $post->ID) {
2689 2689
 			break;
2690 2690
 		}
2691 2691
 	}
@@ -2693,12 +2693,12 @@  discard block
 block discarded – undo
2693 2693
 	$output = '';
2694 2694
 	$attachment_id = 0;
2695 2695
 
2696
-	if ( $attachments ) {
2696
+	if ($attachments) {
2697 2697
 		$k = $prev ? $k - 1 : $k + 1;
2698 2698
 
2699
-		if ( isset( $attachments[ $k ] ) ) {
2700
-			$attachment_id = $attachments[ $k ]->ID;
2701
-			$output = wp_get_attachment_link( $attachment_id, $size, true, false, $text );
2699
+		if (isset($attachments[$k])) {
2700
+			$attachment_id = $attachments[$k]->ID;
2701
+			$output = wp_get_attachment_link($attachment_id, $size, true, false, $text);
2702 2702
 		}
2703 2703
 	}
2704 2704
 
@@ -2717,7 +2717,7 @@  discard block
 block discarded – undo
2717 2717
 	 * @param string $size          Image size.
2718 2718
 	 * @param string $text          Link text.
2719 2719
 	 */
2720
-	echo apply_filters( "{$adjacent}_image_link", $output, $attachment_id, $size, $text );
2720
+	echo apply_filters("{$adjacent}_image_link", $output, $attachment_id, $size, $text);
2721 2721
 }
2722 2722
 
2723 2723
 /**
@@ -2732,39 +2732,39 @@  discard block
 block discarded – undo
2732 2732
  *                                     Default is 'names'.
2733 2733
  * @return array Empty array on failure. List of taxonomies on success.
2734 2734
  */
2735
-function get_attachment_taxonomies( $attachment, $output = 'names' ) {
2736
-	if ( is_int( $attachment ) ) {
2737
-		$attachment = get_post( $attachment );
2738
-	} elseif ( is_array( $attachment ) ) {
2735
+function get_attachment_taxonomies($attachment, $output = 'names') {
2736
+	if (is_int($attachment)) {
2737
+		$attachment = get_post($attachment);
2738
+	} elseif (is_array($attachment)) {
2739 2739
 		$attachment = (object) $attachment;
2740 2740
 	}
2741
-	if ( ! is_object($attachment) )
2741
+	if ( ! is_object($attachment))
2742 2742
 		return array();
2743 2743
 
2744
-	$file = get_attached_file( $attachment->ID );
2745
-	$filename = basename( $file );
2744
+	$file = get_attached_file($attachment->ID);
2745
+	$filename = basename($file);
2746 2746
 
2747 2747
 	$objects = array('attachment');
2748 2748
 
2749
-	if ( false !== strpos($filename, '.') )
2750
-		$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2751
-	if ( !empty($attachment->post_mime_type) ) {
2752
-		$objects[] = 'attachment:' . $attachment->post_mime_type;
2753
-		if ( false !== strpos($attachment->post_mime_type, '/') )
2754
-			foreach ( explode('/', $attachment->post_mime_type) as $token )
2755
-				if ( !empty($token) )
2749
+	if (false !== strpos($filename, '.'))
2750
+		$objects[] = 'attachment:'.substr($filename, strrpos($filename, '.') + 1);
2751
+	if ( ! empty($attachment->post_mime_type)) {
2752
+		$objects[] = 'attachment:'.$attachment->post_mime_type;
2753
+		if (false !== strpos($attachment->post_mime_type, '/'))
2754
+			foreach (explode('/', $attachment->post_mime_type) as $token)
2755
+				if ( ! empty($token))
2756 2756
 					$objects[] = "attachment:$token";
2757 2757
 	}
2758 2758
 
2759 2759
 	$taxonomies = array();
2760
-	foreach ( $objects as $object ) {
2761
-		if ( $taxes = get_object_taxonomies( $object, $output ) ) {
2762
-			$taxonomies = array_merge( $taxonomies, $taxes );
2760
+	foreach ($objects as $object) {
2761
+		if ($taxes = get_object_taxonomies($object, $output)) {
2762
+			$taxonomies = array_merge($taxonomies, $taxes);
2763 2763
 		}
2764 2764
 	}
2765 2765
 
2766
-	if ( 'names' === $output ) {
2767
-		$taxonomies = array_unique( $taxonomies );
2766
+	if ('names' === $output) {
2767
+		$taxonomies = array_unique($taxonomies);
2768 2768
 	}
2769 2769
 
2770 2770
 	return $taxonomies;
@@ -2783,15 +2783,15 @@  discard block
 block discarded – undo
2783 2783
  *                       Default 'names'.
2784 2784
  * @return array The names of all taxonomy of $object_type.
2785 2785
  */
2786
-function get_taxonomies_for_attachments( $output = 'names' ) {
2786
+function get_taxonomies_for_attachments($output = 'names') {
2787 2787
 	$taxonomies = array();
2788
-	foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
2789
-		foreach ( $taxonomy->object_type as $object_type ) {
2790
-			if ( 'attachment' == $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
2791
-				if ( 'names' == $output )
2788
+	foreach (get_taxonomies(array(), 'objects') as $taxonomy) {
2789
+		foreach ($taxonomy->object_type as $object_type) {
2790
+			if ('attachment' == $object_type || 0 === strpos($object_type, 'attachment:')) {
2791
+				if ('names' == $output)
2792 2792
 					$taxonomies[] = $taxonomy->name;
2793 2793
 				else
2794
-					$taxonomies[ $taxonomy->name ] = $taxonomy;
2794
+					$taxonomies[$taxonomy->name] = $taxonomy;
2795 2795
 				break;
2796 2796
 			}
2797 2797
 		}
@@ -2813,7 +2813,7 @@  discard block
 block discarded – undo
2813 2813
  */
2814 2814
 function wp_imagecreatetruecolor($width, $height) {
2815 2815
 	$img = imagecreatetruecolor($width, $height);
2816
-	if ( is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
2816
+	if (is_resource($img) && function_exists('imagealphablending') && function_exists('imagesavealpha')) {
2817 2817
 		imagealphablending($img, false);
2818 2818
 		imagesavealpha($img, true);
2819 2819
 	}
@@ -2833,13 +2833,13 @@  discard block
 block discarded – undo
2833 2833
  * @param int $max_height     The maximum allowed height.
2834 2834
  * @return array The maximum possible width and height based on the example ratio.
2835 2835
  */
2836
-function wp_expand_dimensions( $example_width, $example_height, $max_width, $max_height ) {
2836
+function wp_expand_dimensions($example_width, $example_height, $max_width, $max_height) {
2837 2837
 	$example_width  = (int) $example_width;
2838 2838
 	$example_height = (int) $example_height;
2839 2839
 	$max_width      = (int) $max_width;
2840 2840
 	$max_height     = (int) $max_height;
2841 2841
 
2842
-	return wp_constrain_dimensions( $example_width * 1000000, $example_height * 1000000, $max_width, $max_height );
2842
+	return wp_constrain_dimensions($example_width * 1000000, $example_height * 1000000, $max_width, $max_height);
2843 2843
 }
2844 2844
 
2845 2845
 /**
@@ -2850,8 +2850,8 @@  discard block
 block discarded – undo
2850 2850
  * @return int Allowed upload size.
2851 2851
  */
2852 2852
 function wp_max_upload_size() {
2853
-	$u_bytes = wp_convert_hr_to_bytes( ini_get( 'upload_max_filesize' ) );
2854
-	$p_bytes = wp_convert_hr_to_bytes( ini_get( 'post_max_size' ) );
2853
+	$u_bytes = wp_convert_hr_to_bytes(ini_get('upload_max_filesize'));
2854
+	$p_bytes = wp_convert_hr_to_bytes(ini_get('post_max_size'));
2855 2855
 
2856 2856
 	/**
2857 2857
 	 * Filters the maximum upload size allowed in php.ini.
@@ -2862,7 +2862,7 @@  discard block
 block discarded – undo
2862 2862
 	 * @param int $u_bytes Maximum upload filesize in bytes.
2863 2863
 	 * @param int $p_bytes Maximum size of POST data in bytes.
2864 2864
 	 */
2865
-	return apply_filters( 'upload_size_limit', min( $u_bytes, $p_bytes ), $u_bytes, $p_bytes );
2865
+	return apply_filters('upload_size_limit', min($u_bytes, $p_bytes), $u_bytes, $p_bytes);
2866 2866
 }
2867 2867
 
2868 2868
 /**
@@ -2876,31 +2876,31 @@  discard block
 block discarded – undo
2876 2876
  * @return WP_Image_Editor|WP_Error The WP_Image_Editor object if successful, an WP_Error
2877 2877
  *                                  object otherwise.
2878 2878
  */
2879
-function wp_get_image_editor( $path, $args = array() ) {
2879
+function wp_get_image_editor($path, $args = array()) {
2880 2880
 	$args['path'] = $path;
2881 2881
 
2882
-	if ( ! isset( $args['mime_type'] ) ) {
2883
-		$file_info = wp_check_filetype( $args['path'] );
2882
+	if ( ! isset($args['mime_type'])) {
2883
+		$file_info = wp_check_filetype($args['path']);
2884 2884
 
2885 2885
 		// If $file_info['type'] is false, then we let the editor attempt to
2886 2886
 		// figure out the file type, rather than forcing a failure based on extension.
2887
-		if ( isset( $file_info ) && $file_info['type'] )
2887
+		if (isset($file_info) && $file_info['type'])
2888 2888
 			$args['mime_type'] = $file_info['type'];
2889 2889
 	}
2890 2890
 
2891
-	$implementation = _wp_image_editor_choose( $args );
2891
+	$implementation = _wp_image_editor_choose($args);
2892 2892
 
2893
-	if ( $implementation ) {
2894
-		$editor = new $implementation( $path );
2893
+	if ($implementation) {
2894
+		$editor = new $implementation($path);
2895 2895
 		$loaded = $editor->load();
2896 2896
 
2897
-		if ( is_wp_error( $loaded ) )
2897
+		if (is_wp_error($loaded))
2898 2898
 			return $loaded;
2899 2899
 
2900 2900
 		return $editor;
2901 2901
 	}
2902 2902
 
2903
-	return new WP_Error( 'image_no_editor', __('No editor could be selected.') );
2903
+	return new WP_Error('image_no_editor', __('No editor could be selected.'));
2904 2904
 }
2905 2905
 
2906 2906
 /**
@@ -2912,8 +2912,8 @@  discard block
 block discarded – undo
2912 2912
  *                           Default empty array.
2913 2913
  * @return bool True if an eligible editor is found; false otherwise.
2914 2914
  */
2915
-function wp_image_editor_supports( $args = array() ) {
2916
-	return (bool) _wp_image_editor_choose( $args );
2915
+function wp_image_editor_supports($args = array()) {
2916
+	return (bool) _wp_image_editor_choose($args);
2917 2917
 }
2918 2918
 
2919 2919
 /**
@@ -2926,10 +2926,10 @@  discard block
 block discarded – undo
2926 2926
  * @return string|false Class name for the first editor that claims to support the request. False if no
2927 2927
  *                     editor claims to support the request.
2928 2928
  */
2929
-function _wp_image_editor_choose( $args = array() ) {
2930
-	require_once ABSPATH . WPINC . '/class-wp-image-editor.php';
2931
-	require_once ABSPATH . WPINC . '/class-wp-image-editor-gd.php';
2932
-	require_once ABSPATH . WPINC . '/class-wp-image-editor-imagick.php';
2929
+function _wp_image_editor_choose($args = array()) {
2930
+	require_once ABSPATH.WPINC.'/class-wp-image-editor.php';
2931
+	require_once ABSPATH.WPINC.'/class-wp-image-editor-gd.php';
2932
+	require_once ABSPATH.WPINC.'/class-wp-image-editor-imagick.php';
2933 2933
 	/**
2934 2934
 	 * Filters the list of image editing library classes.
2935 2935
 	 *
@@ -2938,21 +2938,21 @@  discard block
 block discarded – undo
2938 2938
 	 * @param array $image_editors List of available image editors. Defaults are
2939 2939
 	 *                             'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'.
2940 2940
 	 */
2941
-	$implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
2941
+	$implementations = apply_filters('wp_image_editors', array('WP_Image_Editor_Imagick', 'WP_Image_Editor_GD'));
2942 2942
 
2943
-	foreach ( $implementations as $implementation ) {
2944
-		if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
2943
+	foreach ($implementations as $implementation) {
2944
+		if ( ! call_user_func(array($implementation, 'test'), $args))
2945 2945
 			continue;
2946 2946
 
2947
-		if ( isset( $args['mime_type'] ) &&
2947
+		if (isset($args['mime_type']) &&
2948 2948
 			! call_user_func(
2949
-				array( $implementation, 'supports_mime_type' ),
2950
-				$args['mime_type'] ) ) {
2949
+				array($implementation, 'supports_mime_type'),
2950
+				$args['mime_type'] )) {
2951 2951
 			continue;
2952 2952
 		}
2953 2953
 
2954
-		if ( isset( $args['methods'] ) &&
2955
-			 array_diff( $args['methods'], get_class_methods( $implementation ) ) ) {
2954
+		if (isset($args['methods']) &&
2955
+			 array_diff($args['methods'], get_class_methods($implementation))) {
2956 2956
 			continue;
2957 2957
 		}
2958 2958
 
@@ -2970,33 +2970,33 @@  discard block
 block discarded – undo
2970 2970
 function wp_plupload_default_settings() {
2971 2971
 	$wp_scripts = wp_scripts();
2972 2972
 
2973
-	$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
2974
-	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
2973
+	$data = $wp_scripts->get_data('wp-plupload', 'data');
2974
+	if ($data && false !== strpos($data, '_wpPluploadSettings'))
2975 2975
 		return;
2976 2976
 
2977 2977
 	$max_upload_size = wp_max_upload_size();
2978
-	$allowed_extensions = array_keys( get_allowed_mime_types() );
2978
+	$allowed_extensions = array_keys(get_allowed_mime_types());
2979 2979
 	$extensions = array();
2980
-	foreach ( $allowed_extensions as $extension ) {
2981
-		$extensions = array_merge( $extensions, explode( '|', $extension ) );
2980
+	foreach ($allowed_extensions as $extension) {
2981
+		$extensions = array_merge($extensions, explode('|', $extension));
2982 2982
 	}
2983 2983
 
2984 2984
 	$defaults = array(
2985 2985
 		'runtimes'            => 'html5,flash,silverlight,html4',
2986 2986
 		'file_data_name'      => 'async-upload', // key passed to $_FILE.
2987
-		'url'                 => admin_url( 'async-upload.php', 'relative' ),
2988
-		'flash_swf_url'       => includes_url( 'js/plupload/plupload.flash.swf' ),
2989
-		'silverlight_xap_url' => includes_url( 'js/plupload/plupload.silverlight.xap' ),
2987
+		'url'                 => admin_url('async-upload.php', 'relative'),
2988
+		'flash_swf_url'       => includes_url('js/plupload/plupload.flash.swf'),
2989
+		'silverlight_xap_url' => includes_url('js/plupload/plupload.silverlight.xap'),
2990 2990
 		'filters' => array(
2991
-			'max_file_size'   => $max_upload_size . 'b',
2992
-			'mime_types'      => array( array( 'extensions' => implode( ',', $extensions ) ) ),
2991
+			'max_file_size'   => $max_upload_size.'b',
2992
+			'mime_types'      => array(array('extensions' => implode(',', $extensions))),
2993 2993
 		),
2994 2994
 	);
2995 2995
 
2996 2996
 	// Currently only iOS Safari supports multiple files uploading but iOS 7.x has a bug that prevents uploading of videos
2997 2997
 	// when enabled. See #29602.
2998
-	if ( wp_is_mobile() && strpos( $_SERVER['HTTP_USER_AGENT'], 'OS 7_' ) !== false &&
2999
-		strpos( $_SERVER['HTTP_USER_AGENT'], 'like Mac OS X' ) !== false ) {
2998
+	if (wp_is_mobile() && strpos($_SERVER['HTTP_USER_AGENT'], 'OS 7_') !== false &&
2999
+		strpos($_SERVER['HTTP_USER_AGENT'], 'like Mac OS X') !== false) {
3000 3000
 
3001 3001
 		$defaults['multi_selection'] = false;
3002 3002
 	}
@@ -3008,7 +3008,7 @@  discard block
 block discarded – undo
3008 3008
 	 *
3009 3009
 	 * @param array $defaults Default Plupload settings array.
3010 3010
 	 */
3011
-	$defaults = apply_filters( 'plupload_default_settings', $defaults );
3011
+	$defaults = apply_filters('plupload_default_settings', $defaults);
3012 3012
 
3013 3013
 	$params = array(
3014 3014
 		'action' => 'upload-attachment',
@@ -3021,8 +3021,8 @@  discard block
 block discarded – undo
3021 3021
 	 *
3022 3022
 	 * @param array $params Default Plupload parameters array.
3023 3023
 	 */
3024
-	$params = apply_filters( 'plupload_default_params', $params );
3025
-	$params['_wpnonce'] = wp_create_nonce( 'media-form' );
3024
+	$params = apply_filters('plupload_default_params', $params);
3025
+	$params['_wpnonce'] = wp_create_nonce('media-form');
3026 3026
 	$defaults['multipart_params'] = $params;
3027 3027
 
3028 3028
 	$settings = array(
@@ -3034,12 +3034,12 @@  discard block
 block discarded – undo
3034 3034
 		'limitExceeded' => is_multisite() && ! is_upload_space_available()
3035 3035
 	);
3036 3036
 
3037
-	$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
3037
+	$script = 'var _wpPluploadSettings = '.wp_json_encode($settings).';';
3038 3038
 
3039
-	if ( $data )
3039
+	if ($data)
3040 3040
 		$script = "$data\n$script";
3041 3041
 
3042
-	$wp_scripts->add_data( 'wp-plupload', 'data', $script );
3042
+	$wp_scripts->add_data('wp-plupload', 'data', $script);
3043 3043
 }
3044 3044
 
3045 3045
 /**
@@ -3051,43 +3051,43 @@  discard block
 block discarded – undo
3051 3051
  * @param mixed $attachment Attachment ID or object.
3052 3052
  * @return array|void Array of attachment details.
3053 3053
  */
3054
-function wp_prepare_attachment_for_js( $attachment ) {
3055
-	if ( ! $attachment = get_post( $attachment ) )
3054
+function wp_prepare_attachment_for_js($attachment) {
3055
+	if ( ! $attachment = get_post($attachment))
3056 3056
 		return;
3057 3057
 
3058
-	if ( 'attachment' != $attachment->post_type )
3058
+	if ('attachment' != $attachment->post_type)
3059 3059
 		return;
3060 3060
 
3061
-	$meta = wp_get_attachment_metadata( $attachment->ID );
3062
-	if ( false !== strpos( $attachment->post_mime_type, '/' ) )
3063
-		list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
3061
+	$meta = wp_get_attachment_metadata($attachment->ID);
3062
+	if (false !== strpos($attachment->post_mime_type, '/'))
3063
+		list($type, $subtype) = explode('/', $attachment->post_mime_type);
3064 3064
 	else
3065
-		list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3065
+		list($type, $subtype) = array($attachment->post_mime_type, '');
3066 3066
 
3067
-	$attachment_url = wp_get_attachment_url( $attachment->ID );
3068
-	$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
3067
+	$attachment_url = wp_get_attachment_url($attachment->ID);
3068
+	$base_url = str_replace(wp_basename($attachment_url), '', $attachment_url);
3069 3069
 
3070 3070
 	$response = array(
3071 3071
 		'id'          => $attachment->ID,
3072 3072
 		'title'       => $attachment->post_title,
3073
-		'filename'    => wp_basename( get_attached_file( $attachment->ID ) ),
3073
+		'filename'    => wp_basename(get_attached_file($attachment->ID)),
3074 3074
 		'url'         => $attachment_url,
3075
-		'link'        => get_attachment_link( $attachment->ID ),
3076
-		'alt'         => get_post_meta( $attachment->ID, '_wp_attachment_image_alt', true ),
3075
+		'link'        => get_attachment_link($attachment->ID),
3076
+		'alt'         => get_post_meta($attachment->ID, '_wp_attachment_image_alt', true),
3077 3077
 		'author'      => $attachment->post_author,
3078 3078
 		'description' => $attachment->post_content,
3079 3079
 		'caption'     => $attachment->post_excerpt,
3080 3080
 		'name'        => $attachment->post_name,
3081 3081
 		'status'      => $attachment->post_status,
3082 3082
 		'uploadedTo'  => $attachment->post_parent,
3083
-		'date'        => strtotime( $attachment->post_date_gmt ) * 1000,
3084
-		'modified'    => strtotime( $attachment->post_modified_gmt ) * 1000,
3083
+		'date'        => strtotime($attachment->post_date_gmt) * 1000,
3084
+		'modified'    => strtotime($attachment->post_modified_gmt) * 1000,
3085 3085
 		'menuOrder'   => $attachment->menu_order,
3086 3086
 		'mime'        => $attachment->post_mime_type,
3087 3087
 		'type'        => $type,
3088 3088
 		'subtype'     => $subtype,
3089
-		'icon'        => wp_mime_type_icon( $attachment->ID ),
3090
-		'dateFormatted' => mysql2date( __( 'F j, Y' ), $attachment->post_date ),
3089
+		'icon'        => wp_mime_type_icon($attachment->ID),
3090
+		'dateFormatted' => mysql2date(__('F j, Y'), $attachment->post_date),
3091 3091
 		'nonces'      => array(
3092 3092
 			'update' => false,
3093 3093
 			'delete' => false,
@@ -3097,157 +3097,157 @@  discard block
 block discarded – undo
3097 3097
 		'meta'       => false,
3098 3098
 	);
3099 3099
 
3100
-	$author = new WP_User( $attachment->post_author );
3100
+	$author = new WP_User($attachment->post_author);
3101 3101
 	$response['authorName'] = $author->display_name;
3102 3102
 
3103
-	if ( $attachment->post_parent ) {
3104
-		$post_parent = get_post( $attachment->post_parent );
3103
+	if ($attachment->post_parent) {
3104
+		$post_parent = get_post($attachment->post_parent);
3105 3105
 	} else {
3106 3106
 		$post_parent = false;
3107 3107
 	}
3108 3108
 
3109
-	if ( $post_parent ) {
3110
-		$parent_type = get_post_type_object( $post_parent->post_type );
3109
+	if ($post_parent) {
3110
+		$parent_type = get_post_type_object($post_parent->post_type);
3111 3111
 
3112
-		if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $attachment->post_parent ) ) {
3113
-			$response['uploadedToLink'] = get_edit_post_link( $attachment->post_parent, 'raw' );
3112
+		if ($parent_type && $parent_type->show_ui && current_user_can('edit_post', $attachment->post_parent)) {
3113
+			$response['uploadedToLink'] = get_edit_post_link($attachment->post_parent, 'raw');
3114 3114
 		}
3115 3115
 
3116
-		if ( $parent_type && current_user_can( 'read_post', $attachment->post_parent ) ) {
3117
-			$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __( '(no title)' );
3116
+		if ($parent_type && current_user_can('read_post', $attachment->post_parent)) {
3117
+			$response['uploadedToTitle'] = $post_parent->post_title ? $post_parent->post_title : __('(no title)');
3118 3118
 		}
3119 3119
 	}
3120 3120
 
3121
-	$attached_file = get_attached_file( $attachment->ID );
3121
+	$attached_file = get_attached_file($attachment->ID);
3122 3122
 
3123
-	if ( isset( $meta['filesize'] ) ) {
3123
+	if (isset($meta['filesize'])) {
3124 3124
 		$bytes = $meta['filesize'];
3125
-	} elseif ( file_exists( $attached_file ) ) {
3126
-		$bytes = filesize( $attached_file );
3125
+	} elseif (file_exists($attached_file)) {
3126
+		$bytes = filesize($attached_file);
3127 3127
 	} else {
3128 3128
 		$bytes = '';
3129 3129
 	}
3130 3130
 
3131
-	if ( $bytes ) {
3131
+	if ($bytes) {
3132 3132
 		$response['filesizeInBytes'] = $bytes;
3133
-		$response['filesizeHumanReadable'] = size_format( $bytes );
3133
+		$response['filesizeHumanReadable'] = size_format($bytes);
3134 3134
 	}
3135 3135
 
3136
-	if ( current_user_can( 'edit_post', $attachment->ID ) ) {
3137
-		$response['nonces']['update'] = wp_create_nonce( 'update-post_' . $attachment->ID );
3138
-		$response['nonces']['edit'] = wp_create_nonce( 'image_editor-' . $attachment->ID );
3139
-		$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
3136
+	if (current_user_can('edit_post', $attachment->ID)) {
3137
+		$response['nonces']['update'] = wp_create_nonce('update-post_'.$attachment->ID);
3138
+		$response['nonces']['edit'] = wp_create_nonce('image_editor-'.$attachment->ID);
3139
+		$response['editLink'] = get_edit_post_link($attachment->ID, 'raw');
3140 3140
 	}
3141 3141
 
3142
-	if ( current_user_can( 'delete_post', $attachment->ID ) )
3143
-		$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3142
+	if (current_user_can('delete_post', $attachment->ID))
3143
+		$response['nonces']['delete'] = wp_create_nonce('delete-post_'.$attachment->ID);
3144 3144
 
3145
-	if ( $meta && ( 'image' === $type || ! empty( $meta['sizes'] ) ) ) {
3145
+	if ($meta && ('image' === $type || ! empty($meta['sizes']))) {
3146 3146
 		$sizes = array();
3147 3147
 
3148 3148
 		/** This filter is documented in wp-admin/includes/media.php */
3149
-		$possible_sizes = apply_filters( 'image_size_names_choose', array(
3149
+		$possible_sizes = apply_filters('image_size_names_choose', array(
3150 3150
 			'thumbnail' => __('Thumbnail'),
3151 3151
 			'medium'    => __('Medium'),
3152 3152
 			'large'     => __('Large'),
3153 3153
 			'full'      => __('Full Size'),
3154
-		) );
3155
-		unset( $possible_sizes['full'] );
3154
+		));
3155
+		unset($possible_sizes['full']);
3156 3156
 
3157 3157
 		// Loop through all potential sizes that may be chosen. Try to do this with some efficiency.
3158 3158
 		// First: run the image_downsize filter. If it returns something, we can use its data.
3159 3159
 		// If the filter does not return something, then image_downsize() is just an expensive
3160 3160
 		// way to check the image metadata, which we do second.
3161
-		foreach ( $possible_sizes as $size => $label ) {
3161
+		foreach ($possible_sizes as $size => $label) {
3162 3162
 
3163 3163
 			/** This filter is documented in wp-includes/media.php */
3164
-			if ( $downsize = apply_filters( 'image_downsize', false, $attachment->ID, $size ) ) {
3165
-				if ( empty( $downsize[3] ) ) {
3164
+			if ($downsize = apply_filters('image_downsize', false, $attachment->ID, $size)) {
3165
+				if (empty($downsize[3])) {
3166 3166
 					continue;
3167 3167
 				}
3168 3168
 
3169
-				$sizes[ $size ] = array(
3169
+				$sizes[$size] = array(
3170 3170
 					'height'      => $downsize[2],
3171 3171
 					'width'       => $downsize[1],
3172 3172
 					'url'         => $downsize[0],
3173 3173
 					'orientation' => $downsize[2] > $downsize[1] ? 'portrait' : 'landscape',
3174 3174
 				);
3175
-			} elseif ( isset( $meta['sizes'][ $size ] ) ) {
3175
+			} elseif (isset($meta['sizes'][$size])) {
3176 3176
 				// Nothing from the filter, so consult image metadata if we have it.
3177
-				$size_meta = $meta['sizes'][ $size ];
3177
+				$size_meta = $meta['sizes'][$size];
3178 3178
 
3179 3179
 				// We have the actual image size, but might need to further constrain it if content_width is narrower.
3180 3180
 				// Thumbnail, medium, and full sizes are also checked against the site's height/width options.
3181
-				list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
3181
+				list($width, $height) = image_constrain_size_for_editor($size_meta['width'], $size_meta['height'], $size, 'edit');
3182 3182
 
3183
-				$sizes[ $size ] = array(
3183
+				$sizes[$size] = array(
3184 3184
 					'height'      => $height,
3185 3185
 					'width'       => $width,
3186
-					'url'         => $base_url . $size_meta['file'],
3186
+					'url'         => $base_url.$size_meta['file'],
3187 3187
 					'orientation' => $height > $width ? 'portrait' : 'landscape',
3188 3188
 				);
3189 3189
 			}
3190 3190
 		}
3191 3191
 
3192
-		if ( 'image' === $type ) {
3193
-			$sizes['full'] = array( 'url' => $attachment_url );
3192
+		if ('image' === $type) {
3193
+			$sizes['full'] = array('url' => $attachment_url);
3194 3194
 
3195
-			if ( isset( $meta['height'], $meta['width'] ) ) {
3195
+			if (isset($meta['height'], $meta['width'])) {
3196 3196
 				$sizes['full']['height'] = $meta['height'];
3197 3197
 				$sizes['full']['width'] = $meta['width'];
3198 3198
 				$sizes['full']['orientation'] = $meta['height'] > $meta['width'] ? 'portrait' : 'landscape';
3199 3199
 			}
3200 3200
 
3201
-			$response = array_merge( $response, $sizes['full'] );
3202
-		} elseif ( $meta['sizes']['full']['file'] ) {
3201
+			$response = array_merge($response, $sizes['full']);
3202
+		} elseif ($meta['sizes']['full']['file']) {
3203 3203
 			$sizes['full'] = array(
3204
-				'url'         => $base_url . $meta['sizes']['full']['file'],
3204
+				'url'         => $base_url.$meta['sizes']['full']['file'],
3205 3205
 				'height'      => $meta['sizes']['full']['height'],
3206 3206
 				'width'       => $meta['sizes']['full']['width'],
3207 3207
 				'orientation' => $meta['sizes']['full']['height'] > $meta['sizes']['full']['width'] ? 'portrait' : 'landscape'
3208 3208
 			);
3209 3209
 		}
3210 3210
 
3211
-		$response = array_merge( $response, array( 'sizes' => $sizes ) );
3211
+		$response = array_merge($response, array('sizes' => $sizes));
3212 3212
 	}
3213 3213
 
3214
-	if ( $meta && 'video' === $type ) {
3215
-		if ( isset( $meta['width'] ) )
3214
+	if ($meta && 'video' === $type) {
3215
+		if (isset($meta['width']))
3216 3216
 			$response['width'] = (int) $meta['width'];
3217
-		if ( isset( $meta['height'] ) )
3217
+		if (isset($meta['height']))
3218 3218
 			$response['height'] = (int) $meta['height'];
3219 3219
 	}
3220 3220
 
3221
-	if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
3222
-		if ( isset( $meta['length_formatted'] ) )
3221
+	if ($meta && ('audio' === $type || 'video' === $type)) {
3222
+		if (isset($meta['length_formatted']))
3223 3223
 			$response['fileLength'] = $meta['length_formatted'];
3224 3224
 
3225 3225
 		$response['meta'] = array();
3226
-		foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
3227
-			$response['meta'][ $key ] = false;
3226
+		foreach (wp_get_attachment_id3_keys($attachment, 'js') as $key => $label) {
3227
+			$response['meta'][$key] = false;
3228 3228
 
3229
-			if ( ! empty( $meta[ $key ] ) ) {
3230
-				$response['meta'][ $key ] = $meta[ $key ];
3229
+			if ( ! empty($meta[$key])) {
3230
+				$response['meta'][$key] = $meta[$key];
3231 3231
 			}
3232 3232
 		}
3233 3233
 
3234
-		$id = get_post_thumbnail_id( $attachment->ID );
3235
-		if ( ! empty( $id ) ) {
3236
-			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
3237
-			$response['image'] = compact( 'src', 'width', 'height' );
3238
-			list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
3239
-			$response['thumb'] = compact( 'src', 'width', 'height' );
3234
+		$id = get_post_thumbnail_id($attachment->ID);
3235
+		if ( ! empty($id)) {
3236
+			list($src, $width, $height) = wp_get_attachment_image_src($id, 'full');
3237
+			$response['image'] = compact('src', 'width', 'height');
3238
+			list($src, $width, $height) = wp_get_attachment_image_src($id, 'thumbnail');
3239
+			$response['thumb'] = compact('src', 'width', 'height');
3240 3240
 		} else {
3241
-			$src = wp_mime_type_icon( $attachment->ID );
3241
+			$src = wp_mime_type_icon($attachment->ID);
3242 3242
 			$width = 48;
3243 3243
 			$height = 64;
3244
-			$response['image'] = compact( 'src', 'width', 'height' );
3245
-			$response['thumb'] = compact( 'src', 'width', 'height' );
3244
+			$response['image'] = compact('src', 'width', 'height');
3245
+			$response['thumb'] = compact('src', 'width', 'height');
3246 3246
 		}
3247 3247
 	}
3248 3248
 
3249
-	if ( function_exists('get_compat_media_markup') )
3250
-		$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3249
+	if (function_exists('get_compat_media_markup'))
3250
+		$response['compat'] = get_compat_media_markup($attachment->ID, array('in_modal' => true));
3251 3251
 
3252 3252
 	/**
3253 3253
 	 * Filters the attachment data prepared for JavaScript.
@@ -3258,7 +3258,7 @@  discard block
 block discarded – undo
3258 3258
 	 * @param int|object $attachment Attachment ID or object.
3259 3259
 	 * @param array      $meta       Array of attachment meta data.
3260 3260
 	 */
3261
-	return apply_filters( 'wp_prepare_attachment_for_js', $response, $attachment, $meta );
3261
+	return apply_filters('wp_prepare_attachment_for_js', $response, $attachment, $meta);
3262 3262
 }
3263 3263
 
3264 3264
 /**
@@ -3277,9 +3277,9 @@  discard block
 block discarded – undo
3277 3277
  *     @type int|WP_Post A post object or ID.
3278 3278
  * }
3279 3279
  */
3280
-function wp_enqueue_media( $args = array() ) {
3280
+function wp_enqueue_media($args = array()) {
3281 3281
 	// Enqueue me just once per page, please.
3282
-	if ( did_action( 'wp_enqueue_media' ) )
3282
+	if (did_action('wp_enqueue_media'))
3283 3283
 		return;
3284 3284
 
3285 3285
 	global $content_width, $wpdb, $wp_locale;
@@ -3287,7 +3287,7 @@  discard block
 block discarded – undo
3287 3287
 	$defaults = array(
3288 3288
 		'post' => null,
3289 3289
 	);
3290
-	$args = wp_parse_args( $args, $defaults );
3290
+	$args = wp_parse_args($args, $defaults);
3291 3291
 
3292 3292
 	// We're going to pass the old thickbox media tabs to `media_upload_tabs`
3293 3293
 	// to ensure plugins will work. We will then unset those tabs.
@@ -3300,67 +3300,67 @@  discard block
 block discarded – undo
3300 3300
 	);
3301 3301
 
3302 3302
 	/** This filter is documented in wp-admin/includes/media.php */
3303
-	$tabs = apply_filters( 'media_upload_tabs', $tabs );
3304
-	unset( $tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library'] );
3303
+	$tabs = apply_filters('media_upload_tabs', $tabs);
3304
+	unset($tabs['type'], $tabs['type_url'], $tabs['gallery'], $tabs['library']);
3305 3305
 
3306 3306
 	$props = array(
3307
-		'link'  => get_option( 'image_default_link_type' ), // db default is 'file'
3308
-		'align' => get_option( 'image_default_align' ), // empty default
3309
-		'size'  => get_option( 'image_default_size' ),  // empty default
3307
+		'link'  => get_option('image_default_link_type'), // db default is 'file'
3308
+		'align' => get_option('image_default_align'), // empty default
3309
+		'size'  => get_option('image_default_size'), // empty default
3310 3310
 	);
3311 3311
 
3312
-	$exts = array_merge( wp_get_audio_extensions(), wp_get_video_extensions() );
3312
+	$exts = array_merge(wp_get_audio_extensions(), wp_get_video_extensions());
3313 3313
 	$mimes = get_allowed_mime_types();
3314 3314
 	$ext_mimes = array();
3315
-	foreach ( $exts as $ext ) {
3316
-		foreach ( $mimes as $ext_preg => $mime_match ) {
3317
-			if ( preg_match( '#' . $ext . '#i', $ext_preg ) ) {
3318
-				$ext_mimes[ $ext ] = $mime_match;
3315
+	foreach ($exts as $ext) {
3316
+		foreach ($mimes as $ext_preg => $mime_match) {
3317
+			if (preg_match('#'.$ext.'#i', $ext_preg)) {
3318
+				$ext_mimes[$ext] = $mime_match;
3319 3319
 				break;
3320 3320
 			}
3321 3321
 		}
3322 3322
 	}
3323 3323
 
3324
-	$has_audio = $wpdb->get_var( "
3324
+	$has_audio = $wpdb->get_var("
3325 3325
 		SELECT ID
3326 3326
 		FROM $wpdb->posts
3327 3327
 		WHERE post_type = 'attachment'
3328 3328
 		AND post_mime_type LIKE 'audio%'
3329 3329
 		LIMIT 1
3330
-	" );
3331
-	$has_video = $wpdb->get_var( "
3330
+	");
3331
+	$has_video = $wpdb->get_var("
3332 3332
 		SELECT ID
3333 3333
 		FROM $wpdb->posts
3334 3334
 		WHERE post_type = 'attachment'
3335 3335
 		AND post_mime_type LIKE 'video%'
3336 3336
 		LIMIT 1
3337
-	" );
3338
-	$months = $wpdb->get_results( $wpdb->prepare( "
3337
+	");
3338
+	$months = $wpdb->get_results($wpdb->prepare("
3339 3339
 		SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
3340 3340
 		FROM $wpdb->posts
3341 3341
 		WHERE post_type = %s
3342 3342
 		ORDER BY post_date DESC
3343
-	", 'attachment' ) );
3344
-	foreach ( $months as $month_year ) {
3345
-		$month_year->text = sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month_year->month ), $month_year->year );
3343
+	", 'attachment'));
3344
+	foreach ($months as $month_year) {
3345
+		$month_year->text = sprintf(__('%1$s %2$d'), $wp_locale->get_month($month_year->month), $month_year->year);
3346 3346
 	}
3347 3347
 
3348 3348
 	$settings = array(
3349 3349
 		'tabs'      => $tabs,
3350
-		'tabUrl'    => add_query_arg( array( 'chromeless' => true ), admin_url('media-upload.php') ),
3351
-		'mimeTypes' => wp_list_pluck( get_post_mime_types(), 0 ),
3350
+		'tabUrl'    => add_query_arg(array('chromeless' => true), admin_url('media-upload.php')),
3351
+		'mimeTypes' => wp_list_pluck(get_post_mime_types(), 0),
3352 3352
 		/** This filter is documented in wp-admin/includes/media.php */
3353
-		'captions'  => ! apply_filters( 'disable_captions', '' ),
3353
+		'captions'  => ! apply_filters('disable_captions', ''),
3354 3354
 		'nonce'     => array(
3355
-			'sendToEditor' => wp_create_nonce( 'media-send-to-editor' ),
3355
+			'sendToEditor' => wp_create_nonce('media-send-to-editor'),
3356 3356
 		),
3357 3357
 		'post'    => array(
3358 3358
 			'id' => 0,
3359 3359
 		),
3360 3360
 		'defaultProps' => $props,
3361 3361
 		'attachmentCounts' => array(
3362
-			'audio' => ( $has_audio ) ? 1 : 0,
3363
-			'video' => ( $has_video ) ? 1 : 0
3362
+			'audio' => ($has_audio) ? 1 : 0,
3363
+			'video' => ($has_video) ? 1 : 0
3364 3364
 		),
3365 3365
 		'embedExts'    => $exts,
3366 3366
 		'embedMimes'   => $ext_mimes,
@@ -3370,155 +3370,155 @@  discard block
 block discarded – undo
3370 3370
 	);
3371 3371
 
3372 3372
 	$post = null;
3373
-	if ( isset( $args['post'] ) ) {
3374
-		$post = get_post( $args['post'] );
3373
+	if (isset($args['post'])) {
3374
+		$post = get_post($args['post']);
3375 3375
 		$settings['post'] = array(
3376 3376
 			'id' => $post->ID,
3377
-			'nonce' => wp_create_nonce( 'update-post_' . $post->ID ),
3377
+			'nonce' => wp_create_nonce('update-post_'.$post->ID),
3378 3378
 		);
3379 3379
 
3380
-		$thumbnail_support = current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail' );
3381
-		if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type ) {
3382
-			if ( wp_attachment_is( 'audio', $post ) ) {
3383
-				$thumbnail_support = post_type_supports( 'attachment:audio', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:audio' );
3384
-			} elseif ( wp_attachment_is( 'video', $post ) ) {
3385
-				$thumbnail_support = post_type_supports( 'attachment:video', 'thumbnail' ) || current_theme_supports( 'post-thumbnails', 'attachment:video' );
3380
+		$thumbnail_support = current_theme_supports('post-thumbnails', $post->post_type) && post_type_supports($post->post_type, 'thumbnail');
3381
+		if ( ! $thumbnail_support && 'attachment' === $post->post_type && $post->post_mime_type) {
3382
+			if (wp_attachment_is('audio', $post)) {
3383
+				$thumbnail_support = post_type_supports('attachment:audio', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:audio');
3384
+			} elseif (wp_attachment_is('video', $post)) {
3385
+				$thumbnail_support = post_type_supports('attachment:video', 'thumbnail') || current_theme_supports('post-thumbnails', 'attachment:video');
3386 3386
 			}
3387 3387
 		}
3388 3388
 
3389
-		if ( $thumbnail_support ) {
3390
-			$featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true );
3389
+		if ($thumbnail_support) {
3390
+			$featured_image_id = get_post_meta($post->ID, '_thumbnail_id', true);
3391 3391
 			$settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1;
3392 3392
 		}
3393 3393
 	}
3394 3394
 
3395
-	if ( $post ) {
3396
-		$post_type_object = get_post_type_object( $post->post_type );
3395
+	if ($post) {
3396
+		$post_type_object = get_post_type_object($post->post_type);
3397 3397
 	} else {
3398
-		$post_type_object = get_post_type_object( 'post' );
3398
+		$post_type_object = get_post_type_object('post');
3399 3399
 	}
3400 3400
 
3401 3401
 	$strings = array(
3402 3402
 		// Generic
3403
-		'url'         => __( 'URL' ),
3404
-		'addMedia'    => __( 'Add Media' ),
3405
-		'search'      => __( 'Search' ),
3406
-		'select'      => __( 'Select' ),
3407
-		'cancel'      => __( 'Cancel' ),
3408
-		'update'      => __( 'Update' ),
3409
-		'replace'     => __( 'Replace' ),
3410
-		'remove'      => __( 'Remove' ),
3411
-		'back'        => __( 'Back' ),
3403
+		'url'         => __('URL'),
3404
+		'addMedia'    => __('Add Media'),
3405
+		'search'      => __('Search'),
3406
+		'select'      => __('Select'),
3407
+		'cancel'      => __('Cancel'),
3408
+		'update'      => __('Update'),
3409
+		'replace'     => __('Replace'),
3410
+		'remove'      => __('Remove'),
3411
+		'back'        => __('Back'),
3412 3412
 		/* translators: This is a would-be plural string used in the media manager.
3413 3413
 		   If there is not a word you can use in your language to avoid issues with the
3414 3414
 		   lack of plural support here, turn it into "selected: %d" then translate it.
3415 3415
 		 */
3416
-		'selected'    => __( '%d selected' ),
3417
-		'dragInfo'    => __( 'Drag and drop to reorder media files.' ),
3416
+		'selected'    => __('%d selected'),
3417
+		'dragInfo'    => __('Drag and drop to reorder media files.'),
3418 3418
 
3419 3419
 		// Upload
3420
-		'uploadFilesTitle'  => __( 'Upload Files' ),
3421
-		'uploadImagesTitle' => __( 'Upload Images' ),
3420
+		'uploadFilesTitle'  => __('Upload Files'),
3421
+		'uploadImagesTitle' => __('Upload Images'),
3422 3422
 
3423 3423
 		// Library
3424
-		'mediaLibraryTitle'      => __( 'Media Library' ),
3425
-		'insertMediaTitle'       => __( 'Insert Media' ),
3426
-		'createNewGallery'       => __( 'Create a new gallery' ),
3427
-		'createNewPlaylist'      => __( 'Create a new playlist' ),
3428
-		'createNewVideoPlaylist' => __( 'Create a new video playlist' ),
3429
-		'returnToLibrary'        => __( '&#8592; Return to library' ),
3430
-		'allMediaItems'          => __( 'All media items' ),
3431
-		'allDates'               => __( 'All dates' ),
3432
-		'noItemsFound'           => __( 'No items found.' ),
3424
+		'mediaLibraryTitle'      => __('Media Library'),
3425
+		'insertMediaTitle'       => __('Insert Media'),
3426
+		'createNewGallery'       => __('Create a new gallery'),
3427
+		'createNewPlaylist'      => __('Create a new playlist'),
3428
+		'createNewVideoPlaylist' => __('Create a new video playlist'),
3429
+		'returnToLibrary'        => __('&#8592; Return to library'),
3430
+		'allMediaItems'          => __('All media items'),
3431
+		'allDates'               => __('All dates'),
3432
+		'noItemsFound'           => __('No items found.'),
3433 3433
 		'insertIntoPost'         => $post_type_object->labels->insert_into_item,
3434
-		'unattached'             => __( 'Unattached' ),
3435
-		'trash'                  => _x( 'Trash', 'noun' ),
3434
+		'unattached'             => __('Unattached'),
3435
+		'trash'                  => _x('Trash', 'noun'),
3436 3436
 		'uploadedToThisPost'     => $post_type_object->labels->uploaded_to_this_item,
3437
-		'warnDelete'             => __( "You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete." ),
3438
-		'warnBulkDelete'         => __( "You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete." ),
3439
-		'warnBulkTrash'          => __( "You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete." ),
3440
-		'bulkSelect'             => __( 'Bulk Select' ),
3441
-		'cancelSelection'        => __( 'Cancel Selection' ),
3442
-		'trashSelected'          => __( 'Trash Selected' ),
3443
-		'untrashSelected'        => __( 'Untrash Selected' ),
3444
-		'deleteSelected'         => __( 'Delete Selected' ),
3445
-		'deletePermanently'      => __( 'Delete Permanently' ),
3446
-		'apply'                  => __( 'Apply' ),
3447
-		'filterByDate'           => __( 'Filter by date' ),
3448
-		'filterByType'           => __( 'Filter by type' ),
3449
-		'searchMediaLabel'       => __( 'Search Media' ),
3450
-		'searchMediaPlaceholder' => __( 'Search media items...' ), // placeholder (no ellipsis)
3451
-		'noMedia'                => __( 'No media files found.' ),
3437
+		'warnDelete'             => __("You are about to permanently delete this item.\n  'Cancel' to stop, 'OK' to delete."),
3438
+		'warnBulkDelete'         => __("You are about to permanently delete these items.\n  'Cancel' to stop, 'OK' to delete."),
3439
+		'warnBulkTrash'          => __("You are about to trash these items.\n  'Cancel' to stop, 'OK' to delete."),
3440
+		'bulkSelect'             => __('Bulk Select'),
3441
+		'cancelSelection'        => __('Cancel Selection'),
3442
+		'trashSelected'          => __('Trash Selected'),
3443
+		'untrashSelected'        => __('Untrash Selected'),
3444
+		'deleteSelected'         => __('Delete Selected'),
3445
+		'deletePermanently'      => __('Delete Permanently'),
3446
+		'apply'                  => __('Apply'),
3447
+		'filterByDate'           => __('Filter by date'),
3448
+		'filterByType'           => __('Filter by type'),
3449
+		'searchMediaLabel'       => __('Search Media'),
3450
+		'searchMediaPlaceholder' => __('Search media items...'), // placeholder (no ellipsis)
3451
+		'noMedia'                => __('No media files found.'),
3452 3452
 
3453 3453
 		// Library Details
3454
-		'attachmentDetails'  => __( 'Attachment Details' ),
3454
+		'attachmentDetails'  => __('Attachment Details'),
3455 3455
 
3456 3456
 		// From URL
3457
-		'insertFromUrlTitle' => __( 'Insert from URL' ),
3457
+		'insertFromUrlTitle' => __('Insert from URL'),
3458 3458
 
3459 3459
 		// Featured Images
3460 3460
 		'setFeaturedImageTitle' => $post_type_object->labels->featured_image,
3461 3461
 		'setFeaturedImage'      => $post_type_object->labels->set_featured_image,
3462 3462
 
3463 3463
 		// Gallery
3464
-		'createGalleryTitle' => __( 'Create Gallery' ),
3465
-		'editGalleryTitle'   => __( 'Edit Gallery' ),
3466
-		'cancelGalleryTitle' => __( '&#8592; Cancel Gallery' ),
3467
-		'insertGallery'      => __( 'Insert gallery' ),
3468
-		'updateGallery'      => __( 'Update gallery' ),
3469
-		'addToGallery'       => __( 'Add to gallery' ),
3470
-		'addToGalleryTitle'  => __( 'Add to Gallery' ),
3471
-		'reverseOrder'       => __( 'Reverse order' ),
3464
+		'createGalleryTitle' => __('Create Gallery'),
3465
+		'editGalleryTitle'   => __('Edit Gallery'),
3466
+		'cancelGalleryTitle' => __('&#8592; Cancel Gallery'),
3467
+		'insertGallery'      => __('Insert gallery'),
3468
+		'updateGallery'      => __('Update gallery'),
3469
+		'addToGallery'       => __('Add to gallery'),
3470
+		'addToGalleryTitle'  => __('Add to Gallery'),
3471
+		'reverseOrder'       => __('Reverse order'),
3472 3472
 
3473 3473
 		// Edit Image
3474
-		'imageDetailsTitle'     => __( 'Image Details' ),
3475
-		'imageReplaceTitle'     => __( 'Replace Image' ),
3476
-		'imageDetailsCancel'    => __( 'Cancel Edit' ),
3477
-		'editImage'             => __( 'Edit Image' ),
3474
+		'imageDetailsTitle'     => __('Image Details'),
3475
+		'imageReplaceTitle'     => __('Replace Image'),
3476
+		'imageDetailsCancel'    => __('Cancel Edit'),
3477
+		'editImage'             => __('Edit Image'),
3478 3478
 
3479 3479
 		// Crop Image
3480
-		'chooseImage' => __( 'Choose Image' ),
3481
-		'selectAndCrop' => __( 'Select and Crop' ),
3482
-		'skipCropping' => __( 'Skip Cropping' ),
3483
-		'cropImage' => __( 'Crop Image' ),
3484
-		'cropYourImage' => __( 'Crop your image' ),
3485
-		'cropping' => __( 'Cropping&hellip;' ),
3486
-		'suggestedDimensions' => __( 'Suggested image dimensions:' ),
3487
-		'cropError' => __( 'There has been an error cropping your image.' ),
3480
+		'chooseImage' => __('Choose Image'),
3481
+		'selectAndCrop' => __('Select and Crop'),
3482
+		'skipCropping' => __('Skip Cropping'),
3483
+		'cropImage' => __('Crop Image'),
3484
+		'cropYourImage' => __('Crop your image'),
3485
+		'cropping' => __('Cropping&hellip;'),
3486
+		'suggestedDimensions' => __('Suggested image dimensions:'),
3487
+		'cropError' => __('There has been an error cropping your image.'),
3488 3488
 
3489 3489
 		// Edit Audio
3490
-		'audioDetailsTitle'     => __( 'Audio Details' ),
3491
-		'audioReplaceTitle'     => __( 'Replace Audio' ),
3492
-		'audioAddSourceTitle'   => __( 'Add Audio Source' ),
3493
-		'audioDetailsCancel'    => __( 'Cancel Edit' ),
3490
+		'audioDetailsTitle'     => __('Audio Details'),
3491
+		'audioReplaceTitle'     => __('Replace Audio'),
3492
+		'audioAddSourceTitle'   => __('Add Audio Source'),
3493
+		'audioDetailsCancel'    => __('Cancel Edit'),
3494 3494
 
3495 3495
 		// Edit Video
3496
-		'videoDetailsTitle'     => __( 'Video Details' ),
3497
-		'videoReplaceTitle'     => __( 'Replace Video' ),
3498
-		'videoAddSourceTitle'   => __( 'Add Video Source' ),
3499
-		'videoDetailsCancel'    => __( 'Cancel Edit' ),
3500
-		'videoSelectPosterImageTitle' => __( 'Select Poster Image' ),
3501
-		'videoAddTrackTitle'	=> __( 'Add Subtitles' ),
3496
+		'videoDetailsTitle'     => __('Video Details'),
3497
+		'videoReplaceTitle'     => __('Replace Video'),
3498
+		'videoAddSourceTitle'   => __('Add Video Source'),
3499
+		'videoDetailsCancel'    => __('Cancel Edit'),
3500
+		'videoSelectPosterImageTitle' => __('Select Poster Image'),
3501
+		'videoAddTrackTitle'	=> __('Add Subtitles'),
3502 3502
 
3503 3503
  		// Playlist
3504
- 		'playlistDragInfo'    => __( 'Drag and drop to reorder tracks.' ),
3505
- 		'createPlaylistTitle' => __( 'Create Audio Playlist' ),
3506
- 		'editPlaylistTitle'   => __( 'Edit Audio Playlist' ),
3507
- 		'cancelPlaylistTitle' => __( '&#8592; Cancel Audio Playlist' ),
3508
- 		'insertPlaylist'      => __( 'Insert audio playlist' ),
3509
- 		'updatePlaylist'      => __( 'Update audio playlist' ),
3510
- 		'addToPlaylist'       => __( 'Add to audio playlist' ),
3511
- 		'addToPlaylistTitle'  => __( 'Add to Audio Playlist' ),
3504
+ 		'playlistDragInfo'    => __('Drag and drop to reorder tracks.'),
3505
+ 		'createPlaylistTitle' => __('Create Audio Playlist'),
3506
+ 		'editPlaylistTitle'   => __('Edit Audio Playlist'),
3507
+ 		'cancelPlaylistTitle' => __('&#8592; Cancel Audio Playlist'),
3508
+ 		'insertPlaylist'      => __('Insert audio playlist'),
3509
+ 		'updatePlaylist'      => __('Update audio playlist'),
3510
+ 		'addToPlaylist'       => __('Add to audio playlist'),
3511
+ 		'addToPlaylistTitle'  => __('Add to Audio Playlist'),
3512 3512
 
3513 3513
  		// Video Playlist
3514
- 		'videoPlaylistDragInfo'    => __( 'Drag and drop to reorder videos.' ),
3515
- 		'createVideoPlaylistTitle' => __( 'Create Video Playlist' ),
3516
- 		'editVideoPlaylistTitle'   => __( 'Edit Video Playlist' ),
3517
- 		'cancelVideoPlaylistTitle' => __( '&#8592; Cancel Video Playlist' ),
3518
- 		'insertVideoPlaylist'      => __( 'Insert video playlist' ),
3519
- 		'updateVideoPlaylist'      => __( 'Update video playlist' ),
3520
- 		'addToVideoPlaylist'       => __( 'Add to video playlist' ),
3521
- 		'addToVideoPlaylistTitle'  => __( 'Add to Video Playlist' ),
3514
+ 		'videoPlaylistDragInfo'    => __('Drag and drop to reorder videos.'),
3515
+ 		'createVideoPlaylistTitle' => __('Create Video Playlist'),
3516
+ 		'editVideoPlaylistTitle'   => __('Edit Video Playlist'),
3517
+ 		'cancelVideoPlaylistTitle' => __('&#8592; Cancel Video Playlist'),
3518
+ 		'insertVideoPlaylist'      => __('Insert video playlist'),
3519
+ 		'updateVideoPlaylist'      => __('Update video playlist'),
3520
+ 		'addToVideoPlaylist'       => __('Add to video playlist'),
3521
+ 		'addToVideoPlaylistTitle'  => __('Add to Video Playlist'),
3522 3522
 	);
3523 3523
 
3524 3524
 	/**
@@ -3529,7 +3529,7 @@  discard block
 block discarded – undo
3529 3529
 	 * @param array   $settings List of media view settings.
3530 3530
 	 * @param WP_Post $post     Post object.
3531 3531
 	 */
3532
-	$settings = apply_filters( 'media_view_settings', $settings, $post );
3532
+	$settings = apply_filters('media_view_settings', $settings, $post);
3533 3533
 
3534 3534
 	/**
3535 3535
 	 * Filters the media view strings.
@@ -3539,35 +3539,35 @@  discard block
 block discarded – undo
3539 3539
 	 * @param array   $strings List of media view strings.
3540 3540
 	 * @param WP_Post $post    Post object.
3541 3541
 	 */
3542
-	$strings = apply_filters( 'media_view_strings', $strings,  $post );
3542
+	$strings = apply_filters('media_view_strings', $strings, $post);
3543 3543
 
3544 3544
 	$strings['settings'] = $settings;
3545 3545
 
3546 3546
 	// Ensure we enqueue media-editor first, that way media-views is
3547 3547
 	// registered internally before we try to localize it. see #24724.
3548
-	wp_enqueue_script( 'media-editor' );
3549
-	wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
3548
+	wp_enqueue_script('media-editor');
3549
+	wp_localize_script('media-views', '_wpMediaViewsL10n', $strings);
3550 3550
 
3551
-	wp_enqueue_script( 'media-audiovideo' );
3552
-	wp_enqueue_style( 'media-views' );
3553
-	if ( is_admin() ) {
3554
-		wp_enqueue_script( 'mce-view' );
3555
-		wp_enqueue_script( 'image-edit' );
3551
+	wp_enqueue_script('media-audiovideo');
3552
+	wp_enqueue_style('media-views');
3553
+	if (is_admin()) {
3554
+		wp_enqueue_script('mce-view');
3555
+		wp_enqueue_script('image-edit');
3556 3556
 	}
3557
-	wp_enqueue_style( 'imgareaselect' );
3557
+	wp_enqueue_style('imgareaselect');
3558 3558
 	wp_plupload_default_settings();
3559 3559
 
3560
-	require_once ABSPATH . WPINC . '/media-template.php';
3561
-	add_action( 'admin_footer', 'wp_print_media_templates' );
3562
-	add_action( 'wp_footer', 'wp_print_media_templates' );
3563
-	add_action( 'customize_controls_print_footer_scripts', 'wp_print_media_templates' );
3560
+	require_once ABSPATH.WPINC.'/media-template.php';
3561
+	add_action('admin_footer', 'wp_print_media_templates');
3562
+	add_action('wp_footer', 'wp_print_media_templates');
3563
+	add_action('customize_controls_print_footer_scripts', 'wp_print_media_templates');
3564 3564
 
3565 3565
 	/**
3566 3566
 	 * Fires at the conclusion of wp_enqueue_media().
3567 3567
 	 *
3568 3568
 	 * @since 3.5.0
3569 3569
 	 */
3570
-	do_action( 'wp_enqueue_media' );
3570
+	do_action('wp_enqueue_media');
3571 3571
 }
3572 3572
 
3573 3573
 /**
@@ -3579,8 +3579,8 @@  discard block
 block discarded – undo
3579 3579
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
3580 3580
  * @return array Found attachments.
3581 3581
  */
3582
-function get_attached_media( $type, $post = 0 ) {
3583
-	if ( ! $post = get_post( $post ) )
3582
+function get_attached_media($type, $post = 0) {
3583
+	if ( ! $post = get_post($post))
3584 3584
 		return array();
3585 3585
 
3586 3586
 	$args = array(
@@ -3601,9 +3601,9 @@  discard block
 block discarded – undo
3601 3601
 	 * @param string $type Mime type of the desired media.
3602 3602
 	 * @param mixed  $post Post ID or object.
3603 3603
 	 */
3604
-	$args = apply_filters( 'get_attached_media_args', $args, $type, $post );
3604
+	$args = apply_filters('get_attached_media_args', $args, $type, $post);
3605 3605
 
3606
-	$children = get_children( $args );
3606
+	$children = get_children($args);
3607 3607
 
3608 3608
 	/**
3609 3609
 	 * Filters the list of media attached to the given post.
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 	 * @param string $type     Mime type of the media desired.
3615 3615
 	 * @param mixed  $post     Post ID or object.
3616 3616
 	 */
3617
-	return (array) apply_filters( 'get_attached_media', $children, $type, $post );
3617
+	return (array) apply_filters('get_attached_media', $children, $type, $post);
3618 3618
 }
3619 3619
 
3620 3620
 /**
@@ -3626,7 +3626,7 @@  discard block
 block discarded – undo
3626 3626
  * @param array  $types   An array of media types: 'audio', 'video', 'object', 'embed', or 'iframe'.
3627 3627
  * @return array A list of found HTML media embeds.
3628 3628
  */
3629
-function get_media_embedded_in_content( $content, $types = null ) {
3629
+function get_media_embedded_in_content($content, $types = null) {
3630 3630
 	$html = array();
3631 3631
 
3632 3632
 	/**
@@ -3637,20 +3637,20 @@  discard block
 block discarded – undo
3637 3637
 	 * @param array $allowed_media_types An array of allowed media types. Default media types are
3638 3638
 	 *                                   'audio', 'video', 'object', 'embed', and 'iframe'.
3639 3639
 	 */
3640
-	$allowed_media_types = apply_filters( 'media_embedded_in_content_allowed_types', array( 'audio', 'video', 'object', 'embed', 'iframe' ) );
3640
+	$allowed_media_types = apply_filters('media_embedded_in_content_allowed_types', array('audio', 'video', 'object', 'embed', 'iframe'));
3641 3641
 
3642
-	if ( ! empty( $types ) ) {
3643
-		if ( ! is_array( $types ) ) {
3644
-			$types = array( $types );
3642
+	if ( ! empty($types)) {
3643
+		if ( ! is_array($types)) {
3644
+			$types = array($types);
3645 3645
 		}
3646 3646
 
3647
-		$allowed_media_types = array_intersect( $allowed_media_types, $types );
3647
+		$allowed_media_types = array_intersect($allowed_media_types, $types);
3648 3648
 	}
3649 3649
 
3650
-	$tags = implode( '|', $allowed_media_types );
3650
+	$tags = implode('|', $allowed_media_types);
3651 3651
 
3652
-	if ( preg_match_all( '#<(?P<tag>' . $tags . ')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches ) ) {
3653
-		foreach ( $matches[0] as $match ) {
3652
+	if (preg_match_all('#<(?P<tag>'.$tags.')[^<]*?(?:>[\s\S]*?<\/(?P=tag)>|\s*\/>)#', $content, $matches)) {
3653
+		foreach ($matches[0] as $match) {
3654 3654
 			$html[] = $match;
3655 3655
 		}
3656 3656
 	}
@@ -3668,31 +3668,31 @@  discard block
 block discarded – undo
3668 3668
  * @return array A list of arrays, each containing gallery data and srcs parsed
3669 3669
  *               from the expanded shortcode.
3670 3670
  */
3671
-function get_post_galleries( $post, $html = true ) {
3672
-	if ( ! $post = get_post( $post ) )
3671
+function get_post_galleries($post, $html = true) {
3672
+	if ( ! $post = get_post($post))
3673 3673
 		return array();
3674 3674
 
3675
-	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
3675
+	if ( ! has_shortcode($post->post_content, 'gallery'))
3676 3676
 		return array();
3677 3677
 
3678 3678
 	$galleries = array();
3679
-	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
3680
-		foreach ( $matches as $shortcode ) {
3681
-			if ( 'gallery' === $shortcode[2] ) {
3679
+	if (preg_match_all('/'.get_shortcode_regex().'/s', $post->post_content, $matches, PREG_SET_ORDER)) {
3680
+		foreach ($matches as $shortcode) {
3681
+			if ('gallery' === $shortcode[2]) {
3682 3682
 				$srcs = array();
3683 3683
 
3684
-				$gallery = do_shortcode_tag( $shortcode );
3685
-				if ( $html ) {
3684
+				$gallery = do_shortcode_tag($shortcode);
3685
+				if ($html) {
3686 3686
 					$galleries[] = $gallery;
3687 3687
 				} else {
3688
-					preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
3689
-					if ( ! empty( $src ) ) {
3690
-						foreach ( $src as $s )
3688
+					preg_match_all('#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER);
3689
+					if ( ! empty($src)) {
3690
+						foreach ($src as $s)
3691 3691
 							$srcs[] = $s[2];
3692 3692
 					}
3693 3693
 
3694
-					$data = shortcode_parse_atts( $shortcode[3] );
3695
-					$data['src'] = array_values( array_unique( $srcs ) );
3694
+					$data = shortcode_parse_atts($shortcode[3]);
3695
+					$data['src'] = array_values(array_unique($srcs));
3696 3696
 					$galleries[] = $data;
3697 3697
 				}
3698 3698
 			}
@@ -3707,7 +3707,7 @@  discard block
 block discarded – undo
3707 3707
 	 * @param array   $galleries Associative array of all found post galleries.
3708 3708
 	 * @param WP_Post $post      Post object.
3709 3709
 	 */
3710
-	return apply_filters( 'get_post_galleries', $galleries, $post );
3710
+	return apply_filters('get_post_galleries', $galleries, $post);
3711 3711
 }
3712 3712
 
3713 3713
 /**
@@ -3719,9 +3719,9 @@  discard block
 block discarded – undo
3719 3719
  * @param bool        $html Optional. Whether to return HTML or data. Default is true.
3720 3720
  * @return string|array Gallery data and srcs parsed from the expanded shortcode.
3721 3721
  */
3722
-function get_post_gallery( $post = 0, $html = true ) {
3723
-	$galleries = get_post_galleries( $post, $html );
3724
-	$gallery = reset( $galleries );
3722
+function get_post_gallery($post = 0, $html = true) {
3723
+	$galleries = get_post_galleries($post, $html);
3724
+	$gallery = reset($galleries);
3725 3725
 
3726 3726
 	/**
3727 3727
 	 * Filters the first-found post gallery.
@@ -3732,7 +3732,7 @@  discard block
 block discarded – undo
3732 3732
 	 * @param int|WP_Post $post      Post ID or object.
3733 3733
 	 * @param array       $galleries Associative array of all found post galleries.
3734 3734
 	 */
3735
-	return apply_filters( 'get_post_gallery', $gallery, $post, $galleries );
3735
+	return apply_filters('get_post_gallery', $gallery, $post, $galleries);
3736 3736
 }
3737 3737
 
3738 3738
 /**
@@ -3746,9 +3746,9 @@  discard block
 block discarded – undo
3746 3746
  * @return array A list of lists, each containing image srcs parsed.
3747 3747
  *               from an expanded shortcode
3748 3748
  */
3749
-function get_post_galleries_images( $post = 0 ) {
3750
-	$galleries = get_post_galleries( $post, false );
3751
-	return wp_list_pluck( $galleries, 'src' );
3749
+function get_post_galleries_images($post = 0) {
3750
+	$galleries = get_post_galleries($post, false);
3751
+	return wp_list_pluck($galleries, 'src');
3752 3752
 }
3753 3753
 
3754 3754
 /**
@@ -3761,9 +3761,9 @@  discard block
 block discarded – undo
3761 3761
  * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global `$post`.
3762 3762
  * @return array A list of a gallery's image srcs in order.
3763 3763
  */
3764
-function get_post_gallery_images( $post = 0 ) {
3765
-	$gallery = get_post_gallery( $post, false );
3766
-	return empty( $gallery['src'] ) ? array() : $gallery['src'];
3764
+function get_post_gallery_images($post = 0) {
3765
+	$gallery = get_post_gallery($post, false);
3766
+	return empty($gallery['src']) ? array() : $gallery['src'];
3767 3767
 }
3768 3768
 
3769 3769
 /**
@@ -3773,20 +3773,20 @@  discard block
 block discarded – undo
3773 3773
  *
3774 3774
  * @param WP_Post $attachment Attachment object.
3775 3775
  */
3776
-function wp_maybe_generate_attachment_metadata( $attachment ) {
3777
-	if ( empty( $attachment ) || ( empty( $attachment->ID ) || ! $attachment_id = (int) $attachment->ID ) ) {
3776
+function wp_maybe_generate_attachment_metadata($attachment) {
3777
+	if (empty($attachment) || (empty($attachment->ID) || ! $attachment_id = (int) $attachment->ID)) {
3778 3778
 		return;
3779 3779
 	}
3780 3780
 
3781
-	$file = get_attached_file( $attachment_id );
3782
-	$meta = wp_get_attachment_metadata( $attachment_id );
3783
-	if ( empty( $meta ) && file_exists( $file ) ) {
3784
-		$_meta = get_post_meta( $attachment_id );
3785
-		$regeneration_lock = 'wp_generating_att_' . $attachment_id;
3786
-		if ( ! array_key_exists( '_wp_attachment_metadata', $_meta ) && ! get_transient( $regeneration_lock ) ) {
3787
-			set_transient( $regeneration_lock, $file );
3788
-			wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
3789
-			delete_transient( $regeneration_lock );
3781
+	$file = get_attached_file($attachment_id);
3782
+	$meta = wp_get_attachment_metadata($attachment_id);
3783
+	if (empty($meta) && file_exists($file)) {
3784
+		$_meta = get_post_meta($attachment_id);
3785
+		$regeneration_lock = 'wp_generating_att_'.$attachment_id;
3786
+		if ( ! array_key_exists('_wp_attachment_metadata', $_meta) && ! get_transient($regeneration_lock)) {
3787
+			set_transient($regeneration_lock, $file);
3788
+			wp_update_attachment_metadata($attachment_id, wp_generate_attachment_metadata($attachment_id, $file));
3789
+			delete_transient($regeneration_lock);
3790 3790
 		}
3791 3791
 	}
3792 3792
 }
@@ -3801,29 +3801,29 @@  discard block
 block discarded – undo
3801 3801
  * @param string $url The URL to resolve.
3802 3802
  * @return int The found post ID, or 0 on failure.
3803 3803
  */
3804
-function attachment_url_to_postid( $url ) {
3804
+function attachment_url_to_postid($url) {
3805 3805
 	global $wpdb;
3806 3806
 
3807 3807
 	$dir = wp_get_upload_dir();
3808 3808
 	$path = $url;
3809 3809
 
3810
-	$site_url = parse_url( $dir['url'] );
3811
-	$image_path = parse_url( $path );
3810
+	$site_url = parse_url($dir['url']);
3811
+	$image_path = parse_url($path);
3812 3812
 
3813 3813
 	//force the protocols to match if needed
3814
-	if ( isset( $image_path['scheme'] ) && ( $image_path['scheme'] !== $site_url['scheme'] ) ) {
3815
-		$path = str_replace( $image_path['scheme'], $site_url['scheme'], $path );
3814
+	if (isset($image_path['scheme']) && ($image_path['scheme'] !== $site_url['scheme'])) {
3815
+		$path = str_replace($image_path['scheme'], $site_url['scheme'], $path);
3816 3816
 	}
3817 3817
 
3818
-	if ( 0 === strpos( $path, $dir['baseurl'] . '/' ) ) {
3819
-		$path = substr( $path, strlen( $dir['baseurl'] . '/' ) );
3818
+	if (0 === strpos($path, $dir['baseurl'].'/')) {
3819
+		$path = substr($path, strlen($dir['baseurl'].'/'));
3820 3820
 	}
3821 3821
 
3822 3822
 	$sql = $wpdb->prepare(
3823 3823
 		"SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attached_file' AND meta_value = %s",
3824 3824
 		$path
3825 3825
 	);
3826
-	$post_id = $wpdb->get_var( $sql );
3826
+	$post_id = $wpdb->get_var($sql);
3827 3827
 
3828 3828
 	/**
3829 3829
 	 * Filters an attachment id found by URL.
@@ -3833,7 +3833,7 @@  discard block
 block discarded – undo
3833 3833
 	 * @param int|null $post_id The post_id (if any) found by the function.
3834 3834
 	 * @param string   $url     The URL being looked up.
3835 3835
 	 */
3836
-	return (int) apply_filters( 'attachment_url_to_postid', $post_id, $url );
3836
+	return (int) apply_filters('attachment_url_to_postid', $post_id, $url);
3837 3837
 }
3838 3838
 
3839 3839
 /**
@@ -3844,9 +3844,9 @@  discard block
 block discarded – undo
3844 3844
  * @return array The relevant CSS file URLs.
3845 3845
  */
3846 3846
 function wpview_media_sandbox_styles() {
3847
- 	$version = 'ver=' . get_bloginfo( 'version' );
3848
- 	$mediaelement = includes_url( "js/mediaelement/mediaelementplayer.min.css?$version" );
3849
- 	$wpmediaelement = includes_url( "js/mediaelement/wp-mediaelement.css?$version" );
3847
+ 	$version = 'ver='.get_bloginfo('version');
3848
+ 	$mediaelement = includes_url("js/mediaelement/mediaelementplayer.min.css?$version");
3849
+ 	$wpmediaelement = includes_url("js/mediaelement/wp-mediaelement.css?$version");
3850 3850
 
3851
-	return array( $mediaelement, $wpmediaelement );
3851
+	return array($mediaelement, $wpmediaelement);
3852 3852
 }
Please login to merge, or discard this patch.
Braces   +108 added lines, -80 removed lines patch added patch discarded remove patch
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 
60 60
 	$_wp_additional_image_sizes = wp_get_additional_image_sizes();
61 61
 
62
-	if ( ! $context )
63
-		$context = is_admin() ? 'edit' : 'display';
62
+	if ( ! $context ) {
63
+			$context = is_admin() ? 'edit' : 'display';
64
+	}
64 65
 
65 66
 	if ( is_array($size) ) {
66 67
 		$max_width = $size[0];
67 68
 		$max_height = $size[1];
68
-	}
69
-	elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
69
+	} elseif ( $size == 'thumb' || $size == 'thumbnail' ) {
70 70
 		$max_width = intval(get_option('thumbnail_size_w'));
71 71
 		$max_height = intval(get_option('thumbnail_size_h'));
72 72
 		// last chance thumbnail size defaults
@@ -74,21 +74,18 @@  discard block
 block discarded – undo
74 74
 			$max_width = 128;
75 75
 			$max_height = 96;
76 76
 		}
77
-	}
78
-	elseif ( $size == 'medium' ) {
77
+	} elseif ( $size == 'medium' ) {
79 78
 		$max_width = intval(get_option('medium_size_w'));
80 79
 		$max_height = intval(get_option('medium_size_h'));
81 80
 
82
-	}
83
-	elseif ( $size == 'medium_large' ) {
81
+	} elseif ( $size == 'medium_large' ) {
84 82
 		$max_width = intval( get_option( 'medium_large_size_w' ) );
85 83
 		$max_height = intval( get_option( 'medium_large_size_h' ) );
86 84
 
87 85
 		if ( intval( $content_width ) > 0 ) {
88 86
 			$max_width = min( intval( $content_width ), $max_width );
89 87
 		}
90
-	}
91
-	elseif ( $size == 'large' ) {
88
+	} elseif ( $size == 'large' ) {
92 89
 		/*
93 90
 		 * We're inserting a large size image into the editor. If it's a really
94 91
 		 * big image we'll scale it down to fit reasonably within the editor
@@ -150,10 +147,12 @@  discard block
 block discarded – undo
150 147
  */
151 148
 function image_hwstring( $width, $height ) {
152 149
 	$out = '';
153
-	if ($width)
154
-		$out .= 'width="'.intval($width).'" ';
155
-	if ($height)
156
-		$out .= 'height="'.intval($height).'" ';
150
+	if ($width) {
151
+			$out .= 'width="'.intval($width).'" ';
152
+	}
153
+	if ($height) {
154
+			$out .= 'height="'.intval($height).'" ';
155
+	}
157 156
 	return $out;
158 157
 }
159 158
 
@@ -227,8 +226,7 @@  discard block
 block discarded – undo
227 226
 		$width = $intermediate['width'];
228 227
 		$height = $intermediate['height'];
229 228
 		$is_intermediate = true;
230
-	}
231
-	elseif ( $size == 'thumbnail' ) {
229
+	} elseif ( $size == 'thumbnail' ) {
232 230
 		// fall back to the old thumbnail
233 231
 		if ( ($thumb_file = wp_get_attachment_thumb_file($id)) && $info = getimagesize($thumb_file) ) {
234 232
 			$img_url = str_replace($img_url_basename, wp_basename($thumb_file), $img_url);
@@ -412,8 +410,9 @@  discard block
 block discarded – undo
412 410
  * @return array First item is the width, the second item is the height.
413 411
  */
414 412
 function wp_constrain_dimensions( $current_width, $current_height, $max_width = 0, $max_height = 0 ) {
415
-	if ( !$max_width && !$max_height )
416
-		return array( $current_width, $current_height );
413
+	if ( !$max_width && !$max_height ) {
414
+			return array( $current_width, $current_height );
415
+	}
417 416
 
418 417
 	$width_ratio = $height_ratio = 1.0;
419 418
 	$did_width = $did_height = false;
@@ -498,11 +497,13 @@  discard block
 block discarded – undo
498 497
  */
499 498
 function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) {
500 499
 
501
-	if ($orig_w <= 0 || $orig_h <= 0)
502
-		return false;
500
+	if ($orig_w <= 0 || $orig_h <= 0) {
501
+			return false;
502
+	}
503 503
 	// at least one of dest_w or dest_h must be specific
504
-	if ($dest_w <= 0 && $dest_h <= 0)
505
-		return false;
504
+	if ($dest_w <= 0 && $dest_h <= 0) {
505
+			return false;
506
+	}
506 507
 
507 508
 	/**
508 509
 	 * Filters whether to preempt calculating the image resize dimensions.
@@ -521,8 +522,9 @@  discard block
 block discarded – undo
521 522
 	 *                           An array can specify positioning of the crop area. Default false.
522 523
 	 */
523 524
 	$output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
524
-	if ( null !== $output )
525
-		return $output;
525
+	if ( null !== $output ) {
526
+			return $output;
527
+	}
526 528
 
527 529
 	if ( $crop ) {
528 530
 		// crop the largest possible portion of the original image that we can size to $dest_w x $dest_h
@@ -606,8 +608,9 @@  discard block
 block discarded – undo
606 608
 	if ( $width || $height ) {
607 609
 		$editor = wp_get_image_editor( $file );
608 610
 
609
-		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
610
-			return false;
611
+		if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) ) {
612
+					return false;
613
+		}
611 614
 
612 615
 		$resized_file = $editor->save();
613 616
 
@@ -1537,8 +1540,9 @@  discard block
 block discarded – undo
1537 1540
 	 * @param string $content The image element, possibly wrapped in a hyperlink.
1538 1541
 	 */
1539 1542
 	$output = apply_filters( 'img_caption_shortcode', '', $attr, $content );
1540
-	if ( $output != '' )
1541
-		return $output;
1543
+	if ( $output != '' ) {
1544
+			return $output;
1545
+	}
1542 1546
 
1543 1547
 	$atts = shortcode_atts( array(
1544 1548
 		'id'	  => '',
@@ -1549,11 +1553,13 @@  discard block
 block discarded – undo
1549 1553
 	), $attr, 'caption' );
1550 1554
 
1551 1555
 	$atts['width'] = (int) $atts['width'];
1552
-	if ( $atts['width'] < 1 || empty( $atts['caption'] ) )
1553
-		return $content;
1556
+	if ( $atts['width'] < 1 || empty( $atts['caption'] ) ) {
1557
+			return $content;
1558
+	}
1554 1559
 
1555
-	if ( ! empty( $atts['id'] ) )
1556
-		$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1560
+	if ( ! empty( $atts['id'] ) ) {
1561
+			$atts['id'] = 'id="' . esc_attr( sanitize_html_class( $atts['id'] ) ) . '" ';
1562
+	}
1557 1563
 
1558 1564
 	$class = trim( 'wp-caption ' . $atts['align'] . ' ' . $atts['class'] );
1559 1565
 
@@ -2738,22 +2744,25 @@  discard block
 block discarded – undo
2738 2744
 	} elseif ( is_array( $attachment ) ) {
2739 2745
 		$attachment = (object) $attachment;
2740 2746
 	}
2741
-	if ( ! is_object($attachment) )
2742
-		return array();
2747
+	if ( ! is_object($attachment) ) {
2748
+			return array();
2749
+	}
2743 2750
 
2744 2751
 	$file = get_attached_file( $attachment->ID );
2745 2752
 	$filename = basename( $file );
2746 2753
 
2747 2754
 	$objects = array('attachment');
2748 2755
 
2749
-	if ( false !== strpos($filename, '.') )
2750
-		$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2756
+	if ( false !== strpos($filename, '.') ) {
2757
+			$objects[] = 'attachment:' . substr($filename, strrpos($filename, '.') + 1);
2758
+	}
2751 2759
 	if ( !empty($attachment->post_mime_type) ) {
2752 2760
 		$objects[] = 'attachment:' . $attachment->post_mime_type;
2753
-		if ( false !== strpos($attachment->post_mime_type, '/') )
2754
-			foreach ( explode('/', $attachment->post_mime_type) as $token )
2761
+		if ( false !== strpos($attachment->post_mime_type, '/') ) {
2762
+					foreach ( explode('/', $attachment->post_mime_type) as $token )
2755 2763
 				if ( !empty($token) )
2756 2764
 					$objects[] = "attachment:$token";
2765
+		}
2757 2766
 	}
2758 2767
 
2759 2768
 	$taxonomies = array();
@@ -2788,10 +2797,11 @@  discard block
 block discarded – undo
2788 2797
 	foreach ( get_taxonomies( array(), 'objects' ) as $taxonomy ) {
2789 2798
 		foreach ( $taxonomy->object_type as $object_type ) {
2790 2799
 			if ( 'attachment' == $object_type || 0 === strpos( $object_type, 'attachment:' ) ) {
2791
-				if ( 'names' == $output )
2792
-					$taxonomies[] = $taxonomy->name;
2793
-				else
2794
-					$taxonomies[ $taxonomy->name ] = $taxonomy;
2800
+				if ( 'names' == $output ) {
2801
+									$taxonomies[] = $taxonomy->name;
2802
+				} else {
2803
+									$taxonomies[ $taxonomy->name ] = $taxonomy;
2804
+				}
2795 2805
 				break;
2796 2806
 			}
2797 2807
 		}
@@ -2884,8 +2894,9 @@  discard block
 block discarded – undo
2884 2894
 
2885 2895
 		// If $file_info['type'] is false, then we let the editor attempt to
2886 2896
 		// figure out the file type, rather than forcing a failure based on extension.
2887
-		if ( isset( $file_info ) && $file_info['type'] )
2888
-			$args['mime_type'] = $file_info['type'];
2897
+		if ( isset( $file_info ) && $file_info['type'] ) {
2898
+					$args['mime_type'] = $file_info['type'];
2899
+		}
2889 2900
 	}
2890 2901
 
2891 2902
 	$implementation = _wp_image_editor_choose( $args );
@@ -2894,8 +2905,9 @@  discard block
 block discarded – undo
2894 2905
 		$editor = new $implementation( $path );
2895 2906
 		$loaded = $editor->load();
2896 2907
 
2897
-		if ( is_wp_error( $loaded ) )
2898
-			return $loaded;
2908
+		if ( is_wp_error( $loaded ) ) {
2909
+					return $loaded;
2910
+		}
2899 2911
 
2900 2912
 		return $editor;
2901 2913
 	}
@@ -2941,8 +2953,9 @@  discard block
 block discarded – undo
2941 2953
 	$implementations = apply_filters( 'wp_image_editors', array( 'WP_Image_Editor_Imagick', 'WP_Image_Editor_GD' ) );
2942 2954
 
2943 2955
 	foreach ( $implementations as $implementation ) {
2944
-		if ( ! call_user_func( array( $implementation, 'test' ), $args ) )
2945
-			continue;
2956
+		if ( ! call_user_func( array( $implementation, 'test' ), $args ) ) {
2957
+					continue;
2958
+		}
2946 2959
 
2947 2960
 		if ( isset( $args['mime_type'] ) &&
2948 2961
 			! call_user_func(
@@ -2971,8 +2984,9 @@  discard block
 block discarded – undo
2971 2984
 	$wp_scripts = wp_scripts();
2972 2985
 
2973 2986
 	$data = $wp_scripts->get_data( 'wp-plupload', 'data' );
2974
-	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) )
2975
-		return;
2987
+	if ( $data && false !== strpos( $data, '_wpPluploadSettings' ) ) {
2988
+			return;
2989
+	}
2976 2990
 
2977 2991
 	$max_upload_size = wp_max_upload_size();
2978 2992
 	$allowed_extensions = array_keys( get_allowed_mime_types() );
@@ -3036,8 +3050,9 @@  discard block
 block discarded – undo
3036 3050
 
3037 3051
 	$script = 'var _wpPluploadSettings = ' . wp_json_encode( $settings ) . ';';
3038 3052
 
3039
-	if ( $data )
3040
-		$script = "$data\n$script";
3053
+	if ( $data ) {
3054
+			$script = "$data\n$script";
3055
+	}
3041 3056
 
3042 3057
 	$wp_scripts->add_data( 'wp-plupload', 'data', $script );
3043 3058
 }
@@ -3052,17 +3067,20 @@  discard block
 block discarded – undo
3052 3067
  * @return array|void Array of attachment details.
3053 3068
  */
3054 3069
 function wp_prepare_attachment_for_js( $attachment ) {
3055
-	if ( ! $attachment = get_post( $attachment ) )
3056
-		return;
3070
+	if ( ! $attachment = get_post( $attachment ) ) {
3071
+			return;
3072
+	}
3057 3073
 
3058
-	if ( 'attachment' != $attachment->post_type )
3059
-		return;
3074
+	if ( 'attachment' != $attachment->post_type ) {
3075
+			return;
3076
+	}
3060 3077
 
3061 3078
 	$meta = wp_get_attachment_metadata( $attachment->ID );
3062
-	if ( false !== strpos( $attachment->post_mime_type, '/' ) )
3063
-		list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
3064
-	else
3065
-		list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3079
+	if ( false !== strpos( $attachment->post_mime_type, '/' ) ) {
3080
+			list( $type, $subtype ) = explode( '/', $attachment->post_mime_type );
3081
+	} else {
3082
+			list( $type, $subtype ) = array( $attachment->post_mime_type, '' );
3083
+	}
3066 3084
 
3067 3085
 	$attachment_url = wp_get_attachment_url( $attachment->ID );
3068 3086
 	$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
@@ -3139,8 +3157,9 @@  discard block
 block discarded – undo
3139 3157
 		$response['editLink'] = get_edit_post_link( $attachment->ID, 'raw' );
3140 3158
 	}
3141 3159
 
3142
-	if ( current_user_can( 'delete_post', $attachment->ID ) )
3143
-		$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3160
+	if ( current_user_can( 'delete_post', $attachment->ID ) ) {
3161
+			$response['nonces']['delete'] = wp_create_nonce( 'delete-post_' . $attachment->ID );
3162
+	}
3144 3163
 
3145 3164
 	if ( $meta && ( 'image' === $type || ! empty( $meta['sizes'] ) ) ) {
3146 3165
 		$sizes = array();
@@ -3212,15 +3231,18 @@  discard block
 block discarded – undo
3212 3231
 	}
3213 3232
 
3214 3233
 	if ( $meta && 'video' === $type ) {
3215
-		if ( isset( $meta['width'] ) )
3216
-			$response['width'] = (int) $meta['width'];
3217
-		if ( isset( $meta['height'] ) )
3218
-			$response['height'] = (int) $meta['height'];
3234
+		if ( isset( $meta['width'] ) ) {
3235
+					$response['width'] = (int) $meta['width'];
3236
+		}
3237
+		if ( isset( $meta['height'] ) ) {
3238
+					$response['height'] = (int) $meta['height'];
3239
+		}
3219 3240
 	}
3220 3241
 
3221 3242
 	if ( $meta && ( 'audio' === $type || 'video' === $type ) ) {
3222
-		if ( isset( $meta['length_formatted'] ) )
3223
-			$response['fileLength'] = $meta['length_formatted'];
3243
+		if ( isset( $meta['length_formatted'] ) ) {
3244
+					$response['fileLength'] = $meta['length_formatted'];
3245
+		}
3224 3246
 
3225 3247
 		$response['meta'] = array();
3226 3248
 		foreach ( wp_get_attachment_id3_keys( $attachment, 'js' ) as $key => $label ) {
@@ -3246,8 +3268,9 @@  discard block
 block discarded – undo
3246 3268
 		}
3247 3269
 	}
3248 3270
 
3249
-	if ( function_exists('get_compat_media_markup') )
3250
-		$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3271
+	if ( function_exists('get_compat_media_markup') ) {
3272
+			$response['compat'] = get_compat_media_markup( $attachment->ID, array( 'in_modal' => true ) );
3273
+	}
3251 3274
 
3252 3275
 	/**
3253 3276
 	 * Filters the attachment data prepared for JavaScript.
@@ -3279,8 +3302,9 @@  discard block
 block discarded – undo
3279 3302
  */
3280 3303
 function wp_enqueue_media( $args = array() ) {
3281 3304
 	// Enqueue me just once per page, please.
3282
-	if ( did_action( 'wp_enqueue_media' ) )
3283
-		return;
3305
+	if ( did_action( 'wp_enqueue_media' ) ) {
3306
+			return;
3307
+	}
3284 3308
 
3285 3309
 	global $content_width, $wpdb, $wp_locale;
3286 3310
 
@@ -3580,8 +3604,9 @@  discard block
 block discarded – undo
3580 3604
  * @return array Found attachments.
3581 3605
  */
3582 3606
 function get_attached_media( $type, $post = 0 ) {
3583
-	if ( ! $post = get_post( $post ) )
3584
-		return array();
3607
+	if ( ! $post = get_post( $post ) ) {
3608
+			return array();
3609
+	}
3585 3610
 
3586 3611
 	$args = array(
3587 3612
 		'post_parent' => $post->ID,
@@ -3669,11 +3694,13 @@  discard block
 block discarded – undo
3669 3694
  *               from the expanded shortcode.
3670 3695
  */
3671 3696
 function get_post_galleries( $post, $html = true ) {
3672
-	if ( ! $post = get_post( $post ) )
3673
-		return array();
3697
+	if ( ! $post = get_post( $post ) ) {
3698
+			return array();
3699
+	}
3674 3700
 
3675
-	if ( ! has_shortcode( $post->post_content, 'gallery' ) )
3676
-		return array();
3701
+	if ( ! has_shortcode( $post->post_content, 'gallery' ) ) {
3702
+			return array();
3703
+	}
3677 3704
 
3678 3705
 	$galleries = array();
3679 3706
 	if ( preg_match_all( '/' . get_shortcode_regex() . '/s', $post->post_content, $matches, PREG_SET_ORDER ) ) {
@@ -3687,8 +3714,9 @@  discard block
 block discarded – undo
3687 3714
 				} else {
3688 3715
 					preg_match_all( '#src=([\'"])(.+?)\1#is', $gallery, $src, PREG_SET_ORDER );
3689 3716
 					if ( ! empty( $src ) ) {
3690
-						foreach ( $src as $s )
3691
-							$srcs[] = $s[2];
3717
+						foreach ( $src as $s ) {
3718
+													$srcs[] = $s[2];
3719
+						}
3692 3720
 					}
3693 3721
 
3694 3722
 					$data = shortcode_parse_atts( $shortcode[3] );
Please login to merge, or discard this patch.
src/wp-includes/pluggable.php 4 patches
Doc Comments   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -742,7 +742,7 @@  discard block
 block discarded – undo
742 742
  *
743 743
  * @param string $cookie
744 744
  * @param string $scheme Optional. The cookie scheme to use: auth, secure_auth, or logged_in
745
- * @return array|false Authentication cookie components
745
+ * @return string Authentication cookie components
746 746
  */
747 747
 function wp_parse_auth_cookie($cookie = '', $scheme = '') {
748 748
 	if ( empty($cookie) ) {
@@ -1041,7 +1041,7 @@  discard block
 block discarded – undo
1041 1041
  *
1042 1042
  * @since 1.2.0
1043 1043
  *
1044
- * @param int|string $action    Action nonce.
1044
+ * @param integer $action    Action nonce.
1045 1045
  * @param string     $query_arg Optional. Key to check for nonce in `$_REQUEST` (since 2.5).
1046 1046
  *                              Default '_wpnonce'.
1047 1047
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
@@ -1081,7 +1081,7 @@  discard block
 block discarded – undo
1081 1081
  *
1082 1082
  * @since 2.0.3
1083 1083
  *
1084
- * @param int|string   $action    Action nonce.
1084
+ * @param integer   $action    Action nonce.
1085 1085
  * @param false|string $query_arg Optional. Key to check for the nonce in `$_REQUEST` (since 2.5). If false,
1086 1086
  *                                `$_REQUEST` values will be evaluated for '_ajax_nonce', and '_wpnonce'
1087 1087
  *                                (in that order). Default false.
@@ -1531,7 +1531,7 @@  discard block
 block discarded – undo
1531 1531
  * should be notified, overriding the site setting.
1532 1532
  *
1533 1533
  * @param int $comment_id Comment ID.
1534
- * @return true Always returns true.
1534
+ * @return boolean Always returns true.
1535 1535
  */
1536 1536
 function wp_notify_moderator($comment_id) {
1537 1537
 	global $wpdb;
@@ -1782,8 +1782,8 @@  discard block
 block discarded – undo
1782 1782
  * @since 2.0.3
1783 1783
  *
1784 1784
  * @param string     $nonce  Nonce that was used in the form to verify
1785
- * @param string|int $action Should give context to what is taking place and be the same when nonce was created.
1786
- * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1785
+ * @param integer $action Should give context to what is taking place and be the same when nonce was created.
1786
+ * @return string False if the nonce is invalid, 1 if the nonce is valid and generated between
1787 1787
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1788 1788
  */
1789 1789
 function wp_verify_nonce( $nonce, $action = -1 ) {
@@ -1846,7 +1846,7 @@  discard block
 block discarded – undo
1846 1846
  * @since 2.0.3
1847 1847
  * @since 4.0.0 Session tokens were integrated with nonce creation
1848 1848
  *
1849
- * @param string|int $action Scalar value to add context to the nonce.
1849
+ * @param integer $action Scalar value to add context to the nonce.
1850 1850
  * @return string The token.
1851 1851
  */
1852 1852
 function wp_create_nonce($action = -1) {
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -764,7 +764,7 @@
 block discarded – undo
764 764
 					$cookie_name = AUTH_COOKIE;
765 765
 					$scheme = 'auth';
766 766
 				}
767
-	    }
767
+		}
768 768
 
769 769
 		if ( empty($_COOKIE[$cookie_name]) )
770 770
 			return false;
Please login to merge, or discard this patch.
Spacing   +528 added lines, -528 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @package WordPress
7 7
  */
8 8
 
9
-if ( !function_exists('wp_set_current_user') ) :
9
+if ( ! function_exists('wp_set_current_user')) :
10 10
 /**
11 11
  * Changes the current user by ID or name.
12 12
  *
@@ -27,30 +27,30 @@  discard block
 block discarded – undo
27 27
 	global $current_user;
28 28
 
29 29
 	// If `$id` matches the user who's already current, there's nothing to do.
30
-	if ( isset( $current_user )
31
-		&& ( $current_user instanceof WP_User )
32
-		&& ( $id == $current_user->ID )
33
-		&& ( null !== $id )
30
+	if (isset($current_user)
31
+		&& ($current_user instanceof WP_User)
32
+		&& ($id == $current_user->ID)
33
+		&& (null !== $id)
34 34
 	) {
35 35
 		return $current_user;
36 36
 	}
37 37
 
38
-	$current_user = new WP_User( $id, $name );
38
+	$current_user = new WP_User($id, $name);
39 39
 
40
-	setup_userdata( $current_user->ID );
40
+	setup_userdata($current_user->ID);
41 41
 
42 42
 	/**
43 43
 	 * Fires after the current user is set.
44 44
 	 *
45 45
 	 * @since 2.0.1
46 46
 	 */
47
-	do_action( 'set_current_user' );
47
+	do_action('set_current_user');
48 48
 
49 49
 	return $current_user;
50 50
 }
51 51
 endif;
52 52
 
53
-if ( !function_exists('wp_get_current_user') ) :
53
+if ( ! function_exists('wp_get_current_user')) :
54 54
 /**
55 55
  * Retrieve the current user object.
56 56
  *
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
 }
71 71
 endif;
72 72
 
73
-if ( !function_exists('get_userdata') ) :
73
+if ( ! function_exists('get_userdata')) :
74 74
 /**
75 75
  * Retrieve user info by user ID.
76 76
  *
@@ -79,12 +79,12 @@  discard block
 block discarded – undo
79 79
  * @param int $user_id User ID
80 80
  * @return WP_User|false WP_User object on success, false on failure.
81 81
  */
82
-function get_userdata( $user_id ) {
83
-	return get_user_by( 'id', $user_id );
82
+function get_userdata($user_id) {
83
+	return get_user_by('id', $user_id);
84 84
 }
85 85
 endif;
86 86
 
87
-if ( !function_exists('get_user_by') ) :
87
+if ( ! function_exists('get_user_by')) :
88 88
 /**
89 89
  * Retrieve user info by a given field
90 90
  *
@@ -95,20 +95,20 @@  discard block
 block discarded – undo
95 95
  * @param int|string $value A value for $field. A user ID, slug, email address, or login name.
96 96
  * @return WP_User|false WP_User object on success, false on failure.
97 97
  */
98
-function get_user_by( $field, $value ) {
99
-	$userdata = WP_User::get_data_by( $field, $value );
98
+function get_user_by($field, $value) {
99
+	$userdata = WP_User::get_data_by($field, $value);
100 100
 
101
-	if ( !$userdata )
101
+	if ( ! $userdata)
102 102
 		return false;
103 103
 
104 104
 	$user = new WP_User;
105
-	$user->init( $userdata );
105
+	$user->init($userdata);
106 106
 
107 107
 	return $user;
108 108
 }
109 109
 endif;
110 110
 
111
-if ( !function_exists('cache_users') ) :
111
+if ( ! function_exists('cache_users')) :
112 112
 /**
113 113
  * Retrieve info for user lists to prevent multiple queries by get_userdata()
114 114
  *
@@ -118,28 +118,28 @@  discard block
 block discarded – undo
118 118
  *
119 119
  * @param array $user_ids User ID numbers list
120 120
  */
121
-function cache_users( $user_ids ) {
121
+function cache_users($user_ids) {
122 122
 	global $wpdb;
123 123
 
124
-	$clean = _get_non_cached_ids( $user_ids, 'users' );
124
+	$clean = _get_non_cached_ids($user_ids, 'users');
125 125
 
126
-	if ( empty( $clean ) )
126
+	if (empty($clean))
127 127
 		return;
128 128
 
129
-	$list = implode( ',', $clean );
129
+	$list = implode(',', $clean);
130 130
 
131
-	$users = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($list)" );
131
+	$users = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($list)");
132 132
 
133 133
 	$ids = array();
134
-	foreach ( $users as $user ) {
135
-		update_user_caches( $user );
134
+	foreach ($users as $user) {
135
+		update_user_caches($user);
136 136
 		$ids[] = $user->ID;
137 137
 	}
138
-	update_meta_cache( 'user', $ids );
138
+	update_meta_cache('user', $ids);
139 139
 }
140 140
 endif;
141 141
 
142
-if ( !function_exists( 'wp_mail' ) ) :
142
+if ( ! function_exists('wp_mail')) :
143 143
 /**
144 144
  * Send mail, similar to PHP's mail
145 145
  *
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
  * @param string|array $attachments Optional. Files to attach.
171 171
  * @return bool Whether the email contents were sent successfully.
172 172
  */
173
-function wp_mail( $to, $subject, $message, $headers = '', $attachments = array() ) {
173
+function wp_mail($to, $subject, $message, $headers = '', $attachments = array()) {
174 174
 	// Compact the input, apply the filters, and extract them back out
175 175
 
176 176
 	/**
@@ -181,126 +181,126 @@  discard block
 block discarded – undo
181 181
 	 * @param array $args A compacted array of wp_mail() arguments, including the "to" email,
182 182
 	 *                    subject, message, headers, and attachments values.
183 183
 	 */
184
-	$atts = apply_filters( 'wp_mail', compact( 'to', 'subject', 'message', 'headers', 'attachments' ) );
184
+	$atts = apply_filters('wp_mail', compact('to', 'subject', 'message', 'headers', 'attachments'));
185 185
 
186
-	if ( isset( $atts['to'] ) ) {
186
+	if (isset($atts['to'])) {
187 187
 		$to = $atts['to'];
188 188
 	}
189 189
 
190
-	if ( !is_array( $to ) ) {
191
-		$to = explode( ',', $to );
190
+	if ( ! is_array($to)) {
191
+		$to = explode(',', $to);
192 192
 	}
193 193
 
194
-	if ( isset( $atts['subject'] ) ) {
194
+	if (isset($atts['subject'])) {
195 195
 		$subject = $atts['subject'];
196 196
 	}
197 197
 
198
-	if ( isset( $atts['message'] ) ) {
198
+	if (isset($atts['message'])) {
199 199
 		$message = $atts['message'];
200 200
 	}
201 201
 
202
-	if ( isset( $atts['headers'] ) ) {
202
+	if (isset($atts['headers'])) {
203 203
 		$headers = $atts['headers'];
204 204
 	}
205 205
 
206
-	if ( isset( $atts['attachments'] ) ) {
206
+	if (isset($atts['attachments'])) {
207 207
 		$attachments = $atts['attachments'];
208 208
 	}
209 209
 
210
-	if ( ! is_array( $attachments ) ) {
211
-		$attachments = explode( "\n", str_replace( "\r\n", "\n", $attachments ) );
210
+	if ( ! is_array($attachments)) {
211
+		$attachments = explode("\n", str_replace("\r\n", "\n", $attachments));
212 212
 	}
213 213
 	global $phpmailer;
214 214
 
215 215
 	// (Re)create it, if it's gone missing
216
-	if ( ! ( $phpmailer instanceof PHPMailer ) ) {
217
-		require_once ABSPATH . WPINC . '/class-phpmailer.php';
218
-		require_once ABSPATH . WPINC . '/class-smtp.php';
219
-		$phpmailer = new PHPMailer( true );
216
+	if ( ! ($phpmailer instanceof PHPMailer)) {
217
+		require_once ABSPATH.WPINC.'/class-phpmailer.php';
218
+		require_once ABSPATH.WPINC.'/class-smtp.php';
219
+		$phpmailer = new PHPMailer(true);
220 220
 	}
221 221
 
222 222
 	// Headers
223 223
 	$cc = $bcc = $reply_to = array();
224 224
 
225
-	if ( empty( $headers ) ) {
225
+	if (empty($headers)) {
226 226
 		$headers = array();
227 227
 	} else {
228
-		if ( !is_array( $headers ) ) {
228
+		if ( ! is_array($headers)) {
229 229
 			// Explode the headers out, so this function can take both
230 230
 			// string headers and an array of headers.
231
-			$tempheaders = explode( "\n", str_replace( "\r\n", "\n", $headers ) );
231
+			$tempheaders = explode("\n", str_replace("\r\n", "\n", $headers));
232 232
 		} else {
233 233
 			$tempheaders = $headers;
234 234
 		}
235 235
 		$headers = array();
236 236
 
237 237
 		// If it's actually got contents
238
-		if ( !empty( $tempheaders ) ) {
238
+		if ( ! empty($tempheaders)) {
239 239
 			// Iterate through the raw headers
240
-			foreach ( (array) $tempheaders as $header ) {
241
-				if ( strpos($header, ':') === false ) {
242
-					if ( false !== stripos( $header, 'boundary=' ) ) {
243
-						$parts = preg_split('/boundary=/i', trim( $header ) );
244
-						$boundary = trim( str_replace( array( "'", '"' ), '', $parts[1] ) );
240
+			foreach ((array) $tempheaders as $header) {
241
+				if (strpos($header, ':') === false) {
242
+					if (false !== stripos($header, 'boundary=')) {
243
+						$parts = preg_split('/boundary=/i', trim($header));
244
+						$boundary = trim(str_replace(array("'", '"'), '', $parts[1]));
245 245
 					}
246 246
 					continue;
247 247
 				}
248 248
 				// Explode them out
249
-				list( $name, $content ) = explode( ':', trim( $header ), 2 );
249
+				list($name, $content) = explode(':', trim($header), 2);
250 250
 
251 251
 				// Cleanup crew
252
-				$name    = trim( $name    );
253
-				$content = trim( $content );
252
+				$name    = trim($name);
253
+				$content = trim($content);
254 254
 
255
-				switch ( strtolower( $name ) ) {
255
+				switch (strtolower($name)) {
256 256
 					// Mainly for legacy -- process a From: header if it's there
257 257
 					case 'from':
258
-						$bracket_pos = strpos( $content, '<' );
259
-						if ( $bracket_pos !== false ) {
258
+						$bracket_pos = strpos($content, '<');
259
+						if ($bracket_pos !== false) {
260 260
 							// Text before the bracketed email is the "From" name.
261
-							if ( $bracket_pos > 0 ) {
262
-								$from_name = substr( $content, 0, $bracket_pos - 1 );
263
-								$from_name = str_replace( '"', '', $from_name );
264
-								$from_name = trim( $from_name );
261
+							if ($bracket_pos > 0) {
262
+								$from_name = substr($content, 0, $bracket_pos - 1);
263
+								$from_name = str_replace('"', '', $from_name);
264
+								$from_name = trim($from_name);
265 265
 							}
266 266
 
267
-							$from_email = substr( $content, $bracket_pos + 1 );
268
-							$from_email = str_replace( '>', '', $from_email );
269
-							$from_email = trim( $from_email );
267
+							$from_email = substr($content, $bracket_pos + 1);
268
+							$from_email = str_replace('>', '', $from_email);
269
+							$from_email = trim($from_email);
270 270
 
271 271
 						// Avoid setting an empty $from_email.
272
-						} elseif ( '' !== trim( $content ) ) {
273
-							$from_email = trim( $content );
272
+						} elseif ('' !== trim($content)) {
273
+							$from_email = trim($content);
274 274
 						}
275 275
 						break;
276 276
 					case 'content-type':
277
-						if ( strpos( $content, ';' ) !== false ) {
278
-							list( $type, $charset_content ) = explode( ';', $content );
279
-							$content_type = trim( $type );
280
-							if ( false !== stripos( $charset_content, 'charset=' ) ) {
281
-								$charset = trim( str_replace( array( 'charset=', '"' ), '', $charset_content ) );
282
-							} elseif ( false !== stripos( $charset_content, 'boundary=' ) ) {
283
-								$boundary = trim( str_replace( array( 'BOUNDARY=', 'boundary=', '"' ), '', $charset_content ) );
277
+						if (strpos($content, ';') !== false) {
278
+							list($type, $charset_content) = explode(';', $content);
279
+							$content_type = trim($type);
280
+							if (false !== stripos($charset_content, 'charset=')) {
281
+								$charset = trim(str_replace(array('charset=', '"'), '', $charset_content));
282
+							} elseif (false !== stripos($charset_content, 'boundary=')) {
283
+								$boundary = trim(str_replace(array('BOUNDARY=', 'boundary=', '"'), '', $charset_content));
284 284
 								$charset = '';
285 285
 							}
286 286
 
287 287
 						// Avoid setting an empty $content_type.
288
-						} elseif ( '' !== trim( $content ) ) {
289
-							$content_type = trim( $content );
288
+						} elseif ('' !== trim($content)) {
289
+							$content_type = trim($content);
290 290
 						}
291 291
 						break;
292 292
 					case 'cc':
293
-						$cc = array_merge( (array) $cc, explode( ',', $content ) );
293
+						$cc = array_merge((array) $cc, explode(',', $content));
294 294
 						break;
295 295
 					case 'bcc':
296
-						$bcc = array_merge( (array) $bcc, explode( ',', $content ) );
296
+						$bcc = array_merge((array) $bcc, explode(',', $content));
297 297
 						break;
298 298
 					case 'reply-to':
299
-						$reply_to = array_merge( (array) $reply_to, explode( ',', $content ) );
299
+						$reply_to = array_merge((array) $reply_to, explode(',', $content));
300 300
 						break;
301 301
 					default:
302 302
 						// Add it to our grand headers array
303
-						$headers[trim( $name )] = trim( $content );
303
+						$headers[trim($name)] = trim($content);
304 304
 						break;
305 305
 				}
306 306
 			}
@@ -315,7 +315,7 @@  discard block
 block discarded – undo
315 315
 
316 316
 	// From email and name
317 317
 	// If we don't have a name from the input headers
318
-	if ( !isset( $from_name ) )
318
+	if ( ! isset($from_name))
319 319
 		$from_name = 'WordPress';
320 320
 
321 321
 	/* If we don't have an email from the input headers default to wordpress@$sitename
@@ -325,14 +325,14 @@  discard block
 block discarded – undo
325 325
 	 * https://core.trac.wordpress.org/ticket/5007.
326 326
 	 */
327 327
 
328
-	if ( !isset( $from_email ) ) {
328
+	if ( ! isset($from_email)) {
329 329
 		// Get the site domain and get rid of www.
330
-		$sitename = strtolower( $_SERVER['SERVER_NAME'] );
331
-		if ( substr( $sitename, 0, 4 ) == 'www.' ) {
332
-			$sitename = substr( $sitename, 4 );
330
+		$sitename = strtolower($_SERVER['SERVER_NAME']);
331
+		if (substr($sitename, 0, 4) == 'www.') {
332
+			$sitename = substr($sitename, 4);
333 333
 		}
334 334
 
335
-		$from_email = 'wordpress@' . $sitename;
335
+		$from_email = 'wordpress@'.$sitename;
336 336
 	}
337 337
 
338 338
 	/**
@@ -342,7 +342,7 @@  discard block
 block discarded – undo
342 342
 	 *
343 343
 	 * @param string $from_email Email address to send from.
344 344
 	 */
345
-	$from_email = apply_filters( 'wp_mail_from', $from_email );
345
+	$from_email = apply_filters('wp_mail_from', $from_email);
346 346
 
347 347
 	/**
348 348
 	 * Filters the name to associate with the "from" email address.
@@ -351,16 +351,16 @@  discard block
 block discarded – undo
351 351
 	 *
352 352
 	 * @param string $from_name Name associated with the "from" email address.
353 353
 	 */
354
-	$from_name = apply_filters( 'wp_mail_from_name', $from_name );
354
+	$from_name = apply_filters('wp_mail_from_name', $from_name);
355 355
 
356 356
 	try {
357
-		$phpmailer->setFrom( $from_email, $from_name, false );
358
-	} catch ( phpmailerException $e ) {
359
-		$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
357
+		$phpmailer->setFrom($from_email, $from_name, false);
358
+	} catch (phpmailerException $e) {
359
+		$mail_error_data = compact('to', 'subject', 'message', 'headers', 'attachments');
360 360
 		$mail_error_data['phpmailer_exception_code'] = $e->getCode();
361 361
 
362 362
 		/** This filter is documented in wp-includes/pluggable.php */
363
-		do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
363
+		do_action('wp_mail_failed', new WP_Error('wp_mail_failed', $e->getMessage(), $mail_error_data));
364 364
 
365 365
 		return false;
366 366
 	}
@@ -370,40 +370,40 @@  discard block
 block discarded – undo
370 370
 	$phpmailer->Body    = $message;
371 371
 
372 372
 	// Set destination addresses, using appropriate methods for handling addresses
373
-	$address_headers = compact( 'to', 'cc', 'bcc', 'reply_to' );
373
+	$address_headers = compact('to', 'cc', 'bcc', 'reply_to');
374 374
 
375
-	foreach ( $address_headers as $address_header => $addresses ) {
376
-		if ( empty( $addresses ) ) {
375
+	foreach ($address_headers as $address_header => $addresses) {
376
+		if (empty($addresses)) {
377 377
 			continue;
378 378
 		}
379 379
 
380
-		foreach ( (array) $addresses as $address ) {
380
+		foreach ((array) $addresses as $address) {
381 381
 			try {
382 382
 				// Break $recipient into name and address parts if in the format "Foo <[email protected]>"
383 383
 				$recipient_name = '';
384 384
 
385
-				if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
386
-					if ( count( $matches ) == 3 ) {
385
+				if (preg_match('/(.*)<(.+)>/', $address, $matches)) {
386
+					if (count($matches) == 3) {
387 387
 						$recipient_name = $matches[1];
388 388
 						$address        = $matches[2];
389 389
 					}
390 390
 				}
391 391
 
392
-				switch ( $address_header ) {
392
+				switch ($address_header) {
393 393
 					case 'to':
394
-						$phpmailer->addAddress( $address, $recipient_name );
394
+						$phpmailer->addAddress($address, $recipient_name);
395 395
 						break;
396 396
 					case 'cc':
397
-						$phpmailer->addCc( $address, $recipient_name );
397
+						$phpmailer->addCc($address, $recipient_name);
398 398
 						break;
399 399
 					case 'bcc':
400
-						$phpmailer->addBcc( $address, $recipient_name );
400
+						$phpmailer->addBcc($address, $recipient_name);
401 401
 						break;
402 402
 					case 'reply_to':
403
-						$phpmailer->addReplyTo( $address, $recipient_name );
403
+						$phpmailer->addReplyTo($address, $recipient_name);
404 404
 						break;
405 405
 				}
406
-			} catch ( phpmailerException $e ) {
406
+			} catch (phpmailerException $e) {
407 407
 				continue;
408 408
 			}
409 409
 		}
@@ -414,7 +414,7 @@  discard block
 block discarded – undo
414 414
 
415 415
 	// Set Content-Type and charset
416 416
 	// If we don't have a content-type from the input headers
417
-	if ( !isset( $content_type ) )
417
+	if ( ! isset($content_type))
418 418
 		$content_type = 'text/plain';
419 419
 
420 420
 	/**
@@ -424,17 +424,17 @@  discard block
 block discarded – undo
424 424
 	 *
425 425
 	 * @param string $content_type Default wp_mail() content type.
426 426
 	 */
427
-	$content_type = apply_filters( 'wp_mail_content_type', $content_type );
427
+	$content_type = apply_filters('wp_mail_content_type', $content_type);
428 428
 
429 429
 	$phpmailer->ContentType = $content_type;
430 430
 
431 431
 	// Set whether it's plaintext, depending on $content_type
432
-	if ( 'text/html' == $content_type )
433
-		$phpmailer->IsHTML( true );
432
+	if ('text/html' == $content_type)
433
+		$phpmailer->IsHTML(true);
434 434
 
435 435
 	// If we don't have a charset from the input headers
436
-	if ( !isset( $charset ) )
437
-		$charset = get_bloginfo( 'charset' );
436
+	if ( ! isset($charset))
437
+		$charset = get_bloginfo('charset');
438 438
 
439 439
 	// Set the content-type and charset
440 440
 
@@ -445,23 +445,23 @@  discard block
 block discarded – undo
445 445
 	 *
446 446
 	 * @param string $charset Default email charset.
447 447
 	 */
448
-	$phpmailer->CharSet = apply_filters( 'wp_mail_charset', $charset );
448
+	$phpmailer->CharSet = apply_filters('wp_mail_charset', $charset);
449 449
 
450 450
 	// Set custom headers
451
-	if ( !empty( $headers ) ) {
452
-		foreach ( (array) $headers as $name => $content ) {
453
-			$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
451
+	if ( ! empty($headers)) {
452
+		foreach ((array) $headers as $name => $content) {
453
+			$phpmailer->AddCustomHeader(sprintf('%1$s: %2$s', $name, $content));
454 454
 		}
455 455
 
456
-		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
457
-			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
456
+		if (false !== stripos($content_type, 'multipart') && ! empty($boundary))
457
+			$phpmailer->AddCustomHeader(sprintf("Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary));
458 458
 	}
459 459
 
460
-	if ( !empty( $attachments ) ) {
461
-		foreach ( $attachments as $attachment ) {
460
+	if ( ! empty($attachments)) {
461
+		foreach ($attachments as $attachment) {
462 462
 			try {
463 463
 				$phpmailer->AddAttachment($attachment);
464
-			} catch ( phpmailerException $e ) {
464
+			} catch (phpmailerException $e) {
465 465
 				continue;
466 466
 			}
467 467
 		}
@@ -474,14 +474,14 @@  discard block
 block discarded – undo
474 474
 	 *
475 475
 	 * @param PHPMailer &$phpmailer The PHPMailer instance, passed by reference.
476 476
 	 */
477
-	do_action_ref_array( 'phpmailer_init', array( &$phpmailer ) );
477
+	do_action_ref_array('phpmailer_init', array(&$phpmailer));
478 478
 
479 479
 	// Send!
480 480
 	try {
481 481
 		return $phpmailer->send();
482
-	} catch ( phpmailerException $e ) {
482
+	} catch (phpmailerException $e) {
483 483
 
484
-		$mail_error_data = compact( 'to', 'subject', 'message', 'headers', 'attachments' );
484
+		$mail_error_data = compact('to', 'subject', 'message', 'headers', 'attachments');
485 485
 		$mail_error_data['phpmailer_exception_code'] = $e->getCode();
486 486
 
487 487
 		/**
@@ -492,14 +492,14 @@  discard block
 block discarded – undo
492 492
 		 * @param WP_Error $error A WP_Error object with the phpmailerException message, and an array
493 493
 		 *                        containing the mail recipient, subject, message, headers, and attachments.
494 494
 		 */
495
-		do_action( 'wp_mail_failed', new WP_Error( 'wp_mail_failed', $e->getMessage(), $mail_error_data ) );
495
+		do_action('wp_mail_failed', new WP_Error('wp_mail_failed', $e->getMessage(), $mail_error_data));
496 496
 
497 497
 		return false;
498 498
 	}
499 499
 }
500 500
 endif;
501 501
 
502
-if ( !function_exists('wp_authenticate') ) :
502
+if ( ! function_exists('wp_authenticate')) :
503 503
 /**
504 504
  * Authenticate a user, confirming the login credentials are valid.
505 505
  *
@@ -529,17 +529,17 @@  discard block
 block discarded – undo
529 529
 	 * @param string                $username Username or email address.
530 530
 	 * @param string                $password User password
531 531
 	 */
532
-	$user = apply_filters( 'authenticate', null, $username, $password );
532
+	$user = apply_filters('authenticate', null, $username, $password);
533 533
 
534
-	if ( $user == null ) {
534
+	if ($user == null) {
535 535
 		// TODO what should the error message be? (Or would these even happen?)
536 536
 		// Only needed if all authentication handlers fail to return anything.
537
-		$user = new WP_Error( 'authentication_failed', __( '<strong>ERROR</strong>: Invalid username, email address or incorrect password.' ) );
537
+		$user = new WP_Error('authentication_failed', __('<strong>ERROR</strong>: Invalid username, email address or incorrect password.'));
538 538
 	}
539 539
 
540 540
 	$ignore_codes = array('empty_username', 'empty_password');
541 541
 
542
-	if (is_wp_error($user) && !in_array($user->get_error_code(), $ignore_codes) ) {
542
+	if (is_wp_error($user) && ! in_array($user->get_error_code(), $ignore_codes)) {
543 543
 		/**
544 544
 		 * Fires after a user login has failed.
545 545
 		 *
@@ -548,14 +548,14 @@  discard block
 block discarded – undo
548 548
 		 *
549 549
 		 * @param string $username Username or email address.
550 550
 		 */
551
-		do_action( 'wp_login_failed', $username );
551
+		do_action('wp_login_failed', $username);
552 552
 	}
553 553
 
554 554
 	return $user;
555 555
 }
556 556
 endif;
557 557
 
558
-if ( !function_exists('wp_logout') ) :
558
+if ( ! function_exists('wp_logout')) :
559 559
 /**
560 560
  * Log the current user out.
561 561
  *
@@ -570,11 +570,11 @@  discard block
 block discarded – undo
570 570
 	 *
571 571
 	 * @since 1.5.0
572 572
 	 */
573
-	do_action( 'wp_logout' );
573
+	do_action('wp_logout');
574 574
 }
575 575
 endif;
576 576
 
577
-if ( !function_exists('wp_validate_auth_cookie') ) :
577
+if ( ! function_exists('wp_validate_auth_cookie')) :
578 578
 /**
579 579
  * Validates authentication cookie.
580 580
  *
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
  * @return false|int False if invalid cookie, User ID if valid.
594 594
  */
595 595
 function wp_validate_auth_cookie($cookie = '', $scheme = '') {
596
-	if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme) ) {
596
+	if ( ! $cookie_elements = wp_parse_auth_cookie($cookie, $scheme)) {
597 597
 		/**
598 598
 		 * Fires if an authentication cookie is malformed.
599 599
 		 *
@@ -603,7 +603,7 @@  discard block
 block discarded – undo
603 603
 		 * @param string $scheme Authentication scheme. Values include 'auth', 'secure_auth',
604 604
 		 *                       or 'logged_in'.
605 605
 		 */
606
-		do_action( 'auth_cookie_malformed', $cookie, $scheme );
606
+		do_action('auth_cookie_malformed', $cookie, $scheme);
607 607
 		return false;
608 608
 	}
609 609
 
@@ -614,12 +614,12 @@  discard block
 block discarded – undo
614 614
 	$expired = $expiration = $cookie_elements['expiration'];
615 615
 
616 616
 	// Allow a grace period for POST and Ajax requests
617
-	if ( wp_doing_ajax() || 'POST' == $_SERVER['REQUEST_METHOD'] ) {
617
+	if (wp_doing_ajax() || 'POST' == $_SERVER['REQUEST_METHOD']) {
618 618
 		$expired += HOUR_IN_SECONDS;
619 619
 	}
620 620
 
621 621
 	// Quick check to see if an honest cookie has expired
622
-	if ( $expired < time() ) {
622
+	if ($expired < time()) {
623 623
 		/**
624 624
 		 * Fires once an authentication cookie has expired.
625 625
 		 *
@@ -627,12 +627,12 @@  discard block
 block discarded – undo
627 627
 		 *
628 628
 		 * @param array $cookie_elements An array of data for the authentication cookie.
629 629
 		 */
630
-		do_action( 'auth_cookie_expired', $cookie_elements );
630
+		do_action('auth_cookie_expired', $cookie_elements);
631 631
 		return false;
632 632
 	}
633 633
 
634 634
 	$user = get_user_by('login', $username);
635
-	if ( ! $user ) {
635
+	if ( ! $user) {
636 636
 		/**
637 637
 		 * Fires if a bad username is entered in the user authentication process.
638 638
 		 *
@@ -640,19 +640,19 @@  discard block
 block discarded – undo
640 640
 		 *
641 641
 		 * @param array $cookie_elements An array of data for the authentication cookie.
642 642
 		 */
643
-		do_action( 'auth_cookie_bad_username', $cookie_elements );
643
+		do_action('auth_cookie_bad_username', $cookie_elements);
644 644
 		return false;
645 645
 	}
646 646
 
647 647
 	$pass_frag = substr($user->user_pass, 8, 4);
648 648
 
649
-	$key = wp_hash( $username . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
649
+	$key = wp_hash($username.'|'.$pass_frag.'|'.$expiration.'|'.$token, $scheme);
650 650
 
651 651
 	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
652
-	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
653
-	$hash = hash_hmac( $algo, $username . '|' . $expiration . '|' . $token, $key );
652
+	$algo = function_exists('hash') ? 'sha256' : 'sha1';
653
+	$hash = hash_hmac($algo, $username.'|'.$expiration.'|'.$token, $key);
654 654
 
655
-	if ( ! hash_equals( $hash, $hmac ) ) {
655
+	if ( ! hash_equals($hash, $hmac)) {
656 656
 		/**
657 657
 		 * Fires if a bad authentication cookie hash is encountered.
658 658
 		 *
@@ -660,18 +660,18 @@  discard block
 block discarded – undo
660 660
 		 *
661 661
 		 * @param array $cookie_elements An array of data for the authentication cookie.
662 662
 		 */
663
-		do_action( 'auth_cookie_bad_hash', $cookie_elements );
663
+		do_action('auth_cookie_bad_hash', $cookie_elements);
664 664
 		return false;
665 665
 	}
666 666
 
667
-	$manager = WP_Session_Tokens::get_instance( $user->ID );
668
-	if ( ! $manager->verify( $token ) ) {
669
-		do_action( 'auth_cookie_bad_session_token', $cookie_elements );
667
+	$manager = WP_Session_Tokens::get_instance($user->ID);
668
+	if ( ! $manager->verify($token)) {
669
+		do_action('auth_cookie_bad_session_token', $cookie_elements);
670 670
 		return false;
671 671
 	}
672 672
 
673 673
 	// Ajax/POST grace period set above
674
-	if ( $expiration < time() ) {
674
+	if ($expiration < time()) {
675 675
 		$GLOBALS['login_grace_period'] = 1;
676 676
 	}
677 677
 
@@ -683,13 +683,13 @@  discard block
 block discarded – undo
683 683
 	 * @param array   $cookie_elements An array of data for the authentication cookie.
684 684
 	 * @param WP_User $user            User object.
685 685
 	 */
686
-	do_action( 'auth_cookie_valid', $cookie_elements, $user );
686
+	do_action('auth_cookie_valid', $cookie_elements, $user);
687 687
 
688 688
 	return $user->ID;
689 689
 }
690 690
 endif;
691 691
 
692
-if ( !function_exists('wp_generate_auth_cookie') ) :
692
+if ( ! function_exists('wp_generate_auth_cookie')) :
693 693
 /**
694 694
  * Generate authentication cookie contents.
695 695
  *
@@ -701,26 +701,26 @@  discard block
 block discarded – undo
701 701
  * @param string $token      User's session token to use for this cookie
702 702
  * @return string Authentication cookie contents. Empty string if user does not exist.
703 703
  */
704
-function wp_generate_auth_cookie( $user_id, $expiration, $scheme = 'auth', $token = '' ) {
704
+function wp_generate_auth_cookie($user_id, $expiration, $scheme = 'auth', $token = '') {
705 705
 	$user = get_userdata($user_id);
706
-	if ( ! $user ) {
706
+	if ( ! $user) {
707 707
 		return '';
708 708
 	}
709 709
 
710
-	if ( ! $token ) {
711
-		$manager = WP_Session_Tokens::get_instance( $user_id );
712
-		$token = $manager->create( $expiration );
710
+	if ( ! $token) {
711
+		$manager = WP_Session_Tokens::get_instance($user_id);
712
+		$token = $manager->create($expiration);
713 713
 	}
714 714
 
715 715
 	$pass_frag = substr($user->user_pass, 8, 4);
716 716
 
717
-	$key = wp_hash( $user->user_login . '|' . $pass_frag . '|' . $expiration . '|' . $token, $scheme );
717
+	$key = wp_hash($user->user_login.'|'.$pass_frag.'|'.$expiration.'|'.$token, $scheme);
718 718
 
719 719
 	// If ext/hash is not present, compat.php's hash_hmac() does not support sha256.
720
-	$algo = function_exists( 'hash' ) ? 'sha256' : 'sha1';
721
-	$hash = hash_hmac( $algo, $user->user_login . '|' . $expiration . '|' . $token, $key );
720
+	$algo = function_exists('hash') ? 'sha256' : 'sha1';
721
+	$hash = hash_hmac($algo, $user->user_login.'|'.$expiration.'|'.$token, $key);
722 722
 
723
-	$cookie = $user->user_login . '|' . $expiration . '|' . $token . '|' . $hash;
723
+	$cookie = $user->user_login.'|'.$expiration.'|'.$token.'|'.$hash;
724 724
 
725 725
 	/**
726 726
 	 * Filters the authentication cookie.
@@ -733,11 +733,11 @@  discard block
 block discarded – undo
733 733
 	 * @param string $scheme     Cookie scheme used. Accepts 'auth', 'secure_auth', or 'logged_in'.
734 734
 	 * @param string $token      User's session token used.
735 735
 	 */
736
-	return apply_filters( 'auth_cookie', $cookie, $user_id, $expiration, $scheme, $token );
736
+	return apply_filters('auth_cookie', $cookie, $user_id, $expiration, $scheme, $token);
737 737
 }
738 738
 endif;
739 739
 
740
-if ( !function_exists('wp_parse_auth_cookie') ) :
740
+if ( ! function_exists('wp_parse_auth_cookie')) :
741 741
 /**
742 742
  * Parse a cookie into its components
743 743
  *
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
748 748
  * @return array|false Authentication cookie components
749 749
  */
750 750
 function wp_parse_auth_cookie($cookie = '', $scheme = '') {
751
-	if ( empty($cookie) ) {
752
-		switch ($scheme){
751
+	if (empty($cookie)) {
752
+		switch ($scheme) {
753 753
 			case 'auth':
754 754
 				$cookie_name = AUTH_COOKIE;
755 755
 				break;
@@ -760,7 +760,7 @@  discard block
 block discarded – undo
760 760
 				$cookie_name = LOGGED_IN_COOKIE;
761 761
 				break;
762 762
 			default:
763
-				if ( is_ssl() ) {
763
+				if (is_ssl()) {
764 764
 					$cookie_name = SECURE_AUTH_COOKIE;
765 765
 					$scheme = 'secure_auth';
766 766
 				} else {
@@ -769,23 +769,23 @@  discard block
 block discarded – undo
769 769
 				}
770 770
 	    }
771 771
 
772
-		if ( empty($_COOKIE[$cookie_name]) )
772
+		if (empty($_COOKIE[$cookie_name]))
773 773
 			return false;
774 774
 		$cookie = $_COOKIE[$cookie_name];
775 775
 	}
776 776
 
777 777
 	$cookie_elements = explode('|', $cookie);
778
-	if ( count( $cookie_elements ) !== 4 ) {
778
+	if (count($cookie_elements) !== 4) {
779 779
 		return false;
780 780
 	}
781 781
 
782
-	list( $username, $expiration, $token, $hmac ) = $cookie_elements;
782
+	list($username, $expiration, $token, $hmac) = $cookie_elements;
783 783
 
784
-	return compact( 'username', 'expiration', 'token', 'hmac', 'scheme' );
784
+	return compact('username', 'expiration', 'token', 'hmac', 'scheme');
785 785
 }
786 786
 endif;
787 787
 
788
-if ( !function_exists('wp_set_auth_cookie') ) :
788
+if ( ! function_exists('wp_set_auth_cookie')) :
789 789
 /**
790 790
  * Log in a user by setting authentication cookies.
791 791
  *
@@ -802,8 +802,8 @@  discard block
 block discarded – undo
802 802
  *                         Default is_ssl().
803 803
  * @param string $token    Optional. User's session token to use for this cookie.
804 804
  */
805
-function wp_set_auth_cookie( $user_id, $remember = false, $secure = '', $token = '' ) {
806
-	if ( $remember ) {
805
+function wp_set_auth_cookie($user_id, $remember = false, $secure = '', $token = '') {
806
+	if ($remember) {
807 807
 		/**
808 808
 		 * Filters the duration of the authentication cookie expiration period.
809 809
 		 *
@@ -813,25 +813,25 @@  discard block
 block discarded – undo
813 813
 		 * @param int  $user_id  User ID.
814 814
 		 * @param bool $remember Whether to remember the user login. Default false.
815 815
 		 */
816
-		$expiration = time() + apply_filters( 'auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember );
816
+		$expiration = time() + apply_filters('auth_cookie_expiration', 14 * DAY_IN_SECONDS, $user_id, $remember);
817 817
 
818 818
 		/*
819 819
 		 * Ensure the browser will continue to send the cookie after the expiration time is reached.
820 820
 		 * Needed for the login grace period in wp_validate_auth_cookie().
821 821
 		 */
822
-		$expire = $expiration + ( 12 * HOUR_IN_SECONDS );
822
+		$expire = $expiration + (12 * HOUR_IN_SECONDS);
823 823
 	} else {
824 824
 		/** This filter is documented in wp-includes/pluggable.php */
825
-		$expiration = time() + apply_filters( 'auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember );
825
+		$expiration = time() + apply_filters('auth_cookie_expiration', 2 * DAY_IN_SECONDS, $user_id, $remember);
826 826
 		$expire = 0;
827 827
 	}
828 828
 
829
-	if ( '' === $secure ) {
829
+	if ('' === $secure) {
830 830
 		$secure = is_ssl();
831 831
 	}
832 832
 
833 833
 	// Front-end cookie is secure when the auth cookie is secure and the site's home URL is forced HTTPS.
834
-	$secure_logged_in_cookie = $secure && 'https' === parse_url( get_option( 'home' ), PHP_URL_SCHEME );
834
+	$secure_logged_in_cookie = $secure && 'https' === parse_url(get_option('home'), PHP_URL_SCHEME);
835 835
 
836 836
 	/**
837 837
 	 * Filters whether the connection is secure.
@@ -841,7 +841,7 @@  discard block
 block discarded – undo
841 841
 	 * @param bool $secure  Whether the connection is secure.
842 842
 	 * @param int  $user_id User ID.
843 843
 	 */
844
-	$secure = apply_filters( 'secure_auth_cookie', $secure, $user_id );
844
+	$secure = apply_filters('secure_auth_cookie', $secure, $user_id);
845 845
 
846 846
 	/**
847 847
 	 * Filters whether to use a secure cookie when logged-in.
@@ -852,9 +852,9 @@  discard block
 block discarded – undo
852 852
 	 * @param int  $user_id                 User ID.
853 853
 	 * @param bool $secure                  Whether the connection is secure.
854 854
 	 */
855
-	$secure_logged_in_cookie = apply_filters( 'secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure );
855
+	$secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', $secure_logged_in_cookie, $user_id, $secure);
856 856
 
857
-	if ( $secure ) {
857
+	if ($secure) {
858 858
 		$auth_cookie_name = SECURE_AUTH_COOKIE;
859 859
 		$scheme = 'secure_auth';
860 860
 	} else {
@@ -862,13 +862,13 @@  discard block
 block discarded – undo
862 862
 		$scheme = 'auth';
863 863
 	}
864 864
 
865
-	if ( '' === $token ) {
866
-		$manager = WP_Session_Tokens::get_instance( $user_id );
867
-		$token   = $manager->create( $expiration );
865
+	if ('' === $token) {
866
+		$manager = WP_Session_Tokens::get_instance($user_id);
867
+		$token   = $manager->create($expiration);
868 868
 	}
869 869
 
870
-	$auth_cookie = wp_generate_auth_cookie( $user_id, $expiration, $scheme, $token );
871
-	$logged_in_cookie = wp_generate_auth_cookie( $user_id, $expiration, 'logged_in', $token );
870
+	$auth_cookie = wp_generate_auth_cookie($user_id, $expiration, $scheme, $token);
871
+	$logged_in_cookie = wp_generate_auth_cookie($user_id, $expiration, 'logged_in', $token);
872 872
 
873 873
 	/**
874 874
 	 * Fires immediately before the authentication cookie is set.
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 	 * @param int    $user_id     User ID.
884 884
 	 * @param string $scheme      Authentication scheme. Values include 'auth', 'secure_auth', or 'logged_in'.
885 885
 	 */
886
-	do_action( 'set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme );
886
+	do_action('set_auth_cookie', $auth_cookie, $expire, $expiration, $user_id, $scheme);
887 887
 
888 888
 	/**
889 889
 	 * Fires immediately before the logged-in authentication cookie is set.
@@ -898,17 +898,17 @@  discard block
 block discarded – undo
898 898
 	 * @param int    $user_id          User ID.
899 899
 	 * @param string $scheme           Authentication scheme. Default 'logged_in'.
900 900
 	 */
901
-	do_action( 'set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in' );
901
+	do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in');
902 902
 
903 903
 	setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
904 904
 	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
905 905
 	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
906
-	if ( COOKIEPATH != SITECOOKIEPATH )
906
+	if (COOKIEPATH != SITECOOKIEPATH)
907 907
 		setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
908 908
 }
909 909
 endif;
910 910
 
911
-if ( !function_exists('wp_clear_auth_cookie') ) :
911
+if ( ! function_exists('wp_clear_auth_cookie')) :
912 912
 /**
913 913
  * Removes all of the cookies associated with authentication.
914 914
  *
@@ -920,30 +920,30 @@  discard block
 block discarded – undo
920 920
 	 *
921 921
 	 * @since 2.7.0
922 922
 	 */
923
-	do_action( 'clear_auth_cookie' );
923
+	do_action('clear_auth_cookie');
924 924
 
925
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
926
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH,   COOKIE_DOMAIN );
927
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
928
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN );
929
-	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,          COOKIE_DOMAIN );
930
-	setcookie( LOGGED_IN_COOKIE,   ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH,      COOKIE_DOMAIN );
925
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
926
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN);
927
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
928
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN);
929
+	setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
930
+	setcookie(LOGGED_IN_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
931 931
 
932 932
 	// Old cookies
933
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
934
-	setcookie( AUTH_COOKIE,        ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
935
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
936
-	setcookie( SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
933
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
934
+	setcookie(AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
935
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
936
+	setcookie(SECURE_AUTH_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
937 937
 
938 938
 	// Even older cookies
939
-	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
940
-	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH,     COOKIE_DOMAIN );
941
-	setcookie( USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
942
-	setcookie( PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN );
939
+	setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
940
+	setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, COOKIEPATH, COOKIE_DOMAIN);
941
+	setcookie(USER_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
942
+	setcookie(PASS_COOKIE, ' ', time() - YEAR_IN_SECONDS, SITECOOKIEPATH, COOKIE_DOMAIN);
943 943
 }
944 944
 endif;
945 945
 
946
-if ( !function_exists('is_user_logged_in') ) :
946
+if ( ! function_exists('is_user_logged_in')) :
947 947
 /**
948 948
  * Checks if the current visitor is a logged in user.
949 949
  *
@@ -958,7 +958,7 @@  discard block
 block discarded – undo
958 958
 }
959 959
 endif;
960 960
 
961
-if ( !function_exists('auth_redirect') ) :
961
+if ( ! function_exists('auth_redirect')) :
962 962
 /**
963 963
  * Checks if a user is logged in, if not it redirects them to the login page.
964 964
  *
@@ -967,7 +967,7 @@  discard block
 block discarded – undo
967 967
 function auth_redirect() {
968 968
 	// Checks if a user is logged in, if not redirects them to the login page
969 969
 
970
-	$secure = ( is_ssl() || force_ssl_admin() );
970
+	$secure = (is_ssl() || force_ssl_admin());
971 971
 
972 972
 	/**
973 973
 	 * Filters whether to use a secure authentication redirect.
@@ -976,15 +976,15 @@  discard block
 block discarded – undo
976 976
 	 *
977 977
 	 * @param bool $secure Whether to use a secure authentication redirect. Default false.
978 978
 	 */
979
-	$secure = apply_filters( 'secure_auth_redirect', $secure );
979
+	$secure = apply_filters('secure_auth_redirect', $secure);
980 980
 
981 981
 	// If https is required and request is http, redirect
982
-	if ( $secure && !is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
983
-		if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
984
-			wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
982
+	if ($secure && ! is_ssl() && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
983
+		if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
984
+			wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
985 985
 			exit();
986 986
 		} else {
987
-			wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
987
+			wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
988 988
 			exit();
989 989
 		}
990 990
 	}
@@ -996,9 +996,9 @@  discard block
 block discarded – undo
996 996
 	 *
997 997
 	 * @param string $scheme Authentication redirect scheme. Default empty.
998 998
 	 */
999
-	$scheme = apply_filters( 'auth_redirect_scheme', '' );
999
+	$scheme = apply_filters('auth_redirect_scheme', '');
1000 1000
 
1001
-	if ( $user_id = wp_validate_auth_cookie( '',  $scheme) ) {
1001
+	if ($user_id = wp_validate_auth_cookie('', $scheme)) {
1002 1002
 		/**
1003 1003
 		 * Fires before the authentication redirect.
1004 1004
 		 *
@@ -1006,26 +1006,26 @@  discard block
 block discarded – undo
1006 1006
 		 *
1007 1007
 		 * @param int $user_id User ID.
1008 1008
 		 */
1009
-		do_action( 'auth_redirect', $user_id );
1009
+		do_action('auth_redirect', $user_id);
1010 1010
 
1011 1011
 		// If the user wants ssl but the session is not ssl, redirect.
1012
-		if ( !$secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin') ) {
1013
-			if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) {
1014
-				wp_redirect( set_url_scheme( $_SERVER['REQUEST_URI'], 'https' ) );
1012
+		if ( ! $secure && get_user_option('use_ssl', $user_id) && false !== strpos($_SERVER['REQUEST_URI'], 'wp-admin')) {
1013
+			if (0 === strpos($_SERVER['REQUEST_URI'], 'http')) {
1014
+				wp_redirect(set_url_scheme($_SERVER['REQUEST_URI'], 'https'));
1015 1015
 				exit();
1016 1016
 			} else {
1017
-				wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1017
+				wp_redirect('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
1018 1018
 				exit();
1019 1019
 			}
1020 1020
 		}
1021 1021
 
1022
-		return;  // The cookie is good so we're done
1022
+		return; // The cookie is good so we're done
1023 1023
 	}
1024 1024
 
1025 1025
 	// The cookie is no good so force login
1026 1026
 	nocache_headers();
1027 1027
 
1028
-	$redirect = ( strpos( $_SERVER['REQUEST_URI'], '/options.php' ) && wp_get_referer() ) ? wp_get_referer() : set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
1028
+	$redirect = (strpos($_SERVER['REQUEST_URI'], '/options.php') && wp_get_referer()) ? wp_get_referer() : set_url_scheme('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
1029 1029
 
1030 1030
 	$login_url = wp_login_url($redirect, true);
1031 1031
 
@@ -1034,7 +1034,7 @@  discard block
 block discarded – undo
1034 1034
 }
1035 1035
 endif;
1036 1036
 
1037
-if ( !function_exists('check_admin_referer') ) :
1037
+if ( ! function_exists('check_admin_referer')) :
1038 1038
 /**
1039 1039
  * Makes sure that a user was referred from another admin page.
1040 1040
  *
@@ -1048,9 +1048,9 @@  discard block
 block discarded – undo
1048 1048
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1049 1049
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1050 1050
  */
1051
-function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
1051
+function check_admin_referer($action = -1, $query_arg = '_wpnonce') {
1052 1052
 	if ( -1 == $action )
1053
-		_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
1053
+		_doing_it_wrong(__FUNCTION__, __('You should specify a nonce action to be verified by using the first parameter.'), '3.2.0');
1054 1054
 
1055 1055
 	$adminurl = strtolower(admin_url());
1056 1056
 	$referer = strtolower(wp_get_referer());
@@ -1065,10 +1065,10 @@  discard block
 block discarded – undo
1065 1065
 	 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
1066 1066
 	 *                          0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1067 1067
 	 */
1068
-	do_action( 'check_admin_referer', $action, $result );
1068
+	do_action('check_admin_referer', $action, $result);
1069 1069
 
1070
-	if ( ! $result && ! ( -1 == $action && strpos( $referer, $adminurl ) === 0 ) ) {
1071
-		wp_nonce_ays( $action );
1070
+	if ( ! $result && ! ( -1 == $action && strpos($referer, $adminurl) === 0 )) {
1071
+		wp_nonce_ays($action);
1072 1072
 		die();
1073 1073
 	}
1074 1074
 
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 }
1077 1077
 endif;
1078 1078
 
1079
-if ( !function_exists('check_ajax_referer') ) :
1079
+if ( ! function_exists('check_ajax_referer')) :
1080 1080
 /**
1081 1081
  * Verifies the Ajax request to prevent processing requests external of the blog.
1082 1082
  *
@@ -1091,21 +1091,21 @@  discard block
 block discarded – undo
1091 1091
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1092 1092
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1093 1093
  */
1094
-function check_ajax_referer( $action = -1, $query_arg = false, $die = true ) {
1094
+function check_ajax_referer($action = -1, $query_arg = false, $die = true) {
1095 1095
 	if ( -1 == $action ) {
1096
-		_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '4.7' );
1096
+		_doing_it_wrong(__FUNCTION__, __('You should specify a nonce action to be verified by using the first parameter.'), '4.7');
1097 1097
 	}
1098 1098
 
1099 1099
 	$nonce = '';
1100 1100
 
1101
-	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
1102
-		$nonce = $_REQUEST[ $query_arg ];
1103
-	elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
1101
+	if ($query_arg && isset($_REQUEST[$query_arg]))
1102
+		$nonce = $_REQUEST[$query_arg];
1103
+	elseif (isset($_REQUEST['_ajax_nonce']))
1104 1104
 		$nonce = $_REQUEST['_ajax_nonce'];
1105
-	elseif ( isset( $_REQUEST['_wpnonce'] ) )
1105
+	elseif (isset($_REQUEST['_wpnonce']))
1106 1106
 		$nonce = $_REQUEST['_wpnonce'];
1107 1107
 
1108
-	$result = wp_verify_nonce( $nonce, $action );
1108
+	$result = wp_verify_nonce($nonce, $action);
1109 1109
 
1110 1110
 	/**
1111 1111
 	 * Fires once the Ajax request has been validated or not.
@@ -1116,13 +1116,13 @@  discard block
 block discarded – undo
1116 1116
 	 * @param false|int $result False if the nonce is invalid, 1 if the nonce is valid and generated between
1117 1117
 	 *                          0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1118 1118
 	 */
1119
-	do_action( 'check_ajax_referer', $action, $result );
1119
+	do_action('check_ajax_referer', $action, $result);
1120 1120
 
1121
-	if ( $die && false === $result ) {
1122
-		if ( wp_doing_ajax() ) {
1121
+	if ($die && false === $result) {
1122
+		if (wp_doing_ajax()) {
1123 1123
 			wp_die( -1, 403 );
1124 1124
 		} else {
1125
-			die( '-1' );
1125
+			die('-1');
1126 1126
 		}
1127 1127
 	}
1128 1128
 
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
 }
1131 1131
 endif;
1132 1132
 
1133
-if ( !function_exists('wp_redirect') ) :
1133
+if ( ! function_exists('wp_redirect')) :
1134 1134
 /**
1135 1135
  * Redirects to another page.
1136 1136
  *
@@ -1166,7 +1166,7 @@  discard block
 block discarded – undo
1166 1166
 	 * @param string $location The path to redirect to.
1167 1167
 	 * @param int    $status   Status code to use.
1168 1168
 	 */
1169
-	$location = apply_filters( 'wp_redirect', $location, $status );
1169
+	$location = apply_filters('wp_redirect', $location, $status);
1170 1170
 
1171 1171
 	/**
1172 1172
 	 * Filters the redirect status code.
@@ -1176,14 +1176,14 @@  discard block
 block discarded – undo
1176 1176
 	 * @param int    $status   Status code to use.
1177 1177
 	 * @param string $location The path to redirect to.
1178 1178
 	 */
1179
-	$status = apply_filters( 'wp_redirect_status', $status, $location );
1179
+	$status = apply_filters('wp_redirect_status', $status, $location);
1180 1180
 
1181
-	if ( ! $location )
1181
+	if ( ! $location)
1182 1182
 		return false;
1183 1183
 
1184 1184
 	$location = wp_sanitize_redirect($location);
1185 1185
 
1186
-	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
1186
+	if ( ! $is_IIS && PHP_SAPI != 'cgi-fcgi')
1187 1187
 		status_header($status); // This causes problems on IIS and some FastCGI setups
1188 1188
 
1189 1189
 	header("Location: $location", true, $status);
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 }
1193 1193
 endif;
1194 1194
 
1195
-if ( !function_exists('wp_sanitize_redirect') ) :
1195
+if ( ! function_exists('wp_sanitize_redirect')) :
1196 1196
 /**
1197 1197
  * Sanitizes a URL for use in a redirect.
1198 1198
  *
@@ -1214,13 +1214,13 @@  discard block
 block discarded – undo
1214 1214
 			|   \xF4[\x80-\x8F][\x80-\xBF]{2}
1215 1215
 		){1,40}                              # ...one or more times
1216 1216
 		)/x';
1217
-	$location = preg_replace_callback( $regex, '_wp_sanitize_utf8_in_redirect', $location );
1217
+	$location = preg_replace_callback($regex, '_wp_sanitize_utf8_in_redirect', $location);
1218 1218
 	$location = preg_replace('|[^a-z0-9-~+_.?#=&;,/:%!*\[\]()@]|i', '', $location);
1219 1219
 	$location = wp_kses_no_null($location);
1220 1220
 
1221 1221
 	// remove %0d and %0a from location
1222 1222
 	$strip = array('%0d', '%0a', '%0D', '%0A');
1223
-	return _deep_replace( $strip, $location );
1223
+	return _deep_replace($strip, $location);
1224 1224
 }
1225 1225
 
1226 1226
 /**
@@ -1235,12 +1235,12 @@  discard block
 block discarded – undo
1235 1235
  * @param array $matches RegEx matches against the redirect location.
1236 1236
  * @return string URL-encoded version of the first RegEx match.
1237 1237
  */
1238
-function _wp_sanitize_utf8_in_redirect( $matches ) {
1239
-	return urlencode( $matches[0] );
1238
+function _wp_sanitize_utf8_in_redirect($matches) {
1239
+	return urlencode($matches[0]);
1240 1240
 }
1241 1241
 endif;
1242 1242
 
1243
-if ( !function_exists('wp_safe_redirect') ) :
1243
+if ( ! function_exists('wp_safe_redirect')) :
1244 1244
 /**
1245 1245
  * Performs a safe (local) redirect, using wp_redirect().
1246 1246
  *
@@ -1270,13 +1270,13 @@  discard block
 block discarded – undo
1270 1270
 	 * @param string $fallback_url The fallback URL to use by default.
1271 1271
 	 * @param int    $status       The redirect status.
1272 1272
 	 */
1273
-	$location = wp_validate_redirect( $location, apply_filters( 'wp_safe_redirect_fallback', admin_url(), $status ) );
1273
+	$location = wp_validate_redirect($location, apply_filters('wp_safe_redirect_fallback', admin_url(), $status));
1274 1274
 
1275 1275
 	wp_redirect($location, $status);
1276 1276
 }
1277 1277
 endif;
1278 1278
 
1279
-if ( !function_exists('wp_validate_redirect') ) :
1279
+if ( ! function_exists('wp_validate_redirect')) :
1280 1280
 /**
1281 1281
  * Validates a URL for use in a redirect.
1282 1282
  *
@@ -1293,33 +1293,33 @@  discard block
 block discarded – undo
1293 1293
  * @return string redirect-sanitized URL
1294 1294
  **/
1295 1295
 function wp_validate_redirect($location, $default = '') {
1296
-	$location = trim( $location );
1296
+	$location = trim($location);
1297 1297
 	// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
1298
-	if ( substr($location, 0, 2) == '//' )
1299
-		$location = 'http:' . $location;
1298
+	if (substr($location, 0, 2) == '//')
1299
+		$location = 'http:'.$location;
1300 1300
 
1301 1301
 	// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
1302
-	$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
1302
+	$test = ($cut = strpos($location, '?')) ? substr($location, 0, $cut) : $location;
1303 1303
 
1304 1304
 	// @-operator is used to prevent possible warnings in PHP < 5.3.3.
1305 1305
 	$lp = @parse_url($test);
1306 1306
 
1307 1307
 	// Give up if malformed URL
1308
-	if ( false === $lp )
1308
+	if (false === $lp)
1309 1309
 		return $default;
1310 1310
 
1311 1311
 	// Allow only http and https schemes. No data:, etc.
1312
-	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
1312
+	if (isset($lp['scheme']) && ! ('http' == $lp['scheme'] || 'https' == $lp['scheme']))
1313 1313
 		return $default;
1314 1314
 
1315 1315
 	// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
1316
-	if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
1316
+	if ( ! isset($lp['host']) && (isset($lp['scheme']) || isset($lp['user']) || isset($lp['pass']) || isset($lp['port']))) {
1317 1317
 		return $default;
1318 1318
 	}
1319 1319
 
1320 1320
 	// Reject malformed components parse_url() can return on odd inputs.
1321
-	foreach ( array( 'user', 'pass', 'host' ) as $component ) {
1322
-		if ( isset( $lp[ $component ] ) && strpbrk( $lp[ $component ], ':/?#@' ) ) {
1321
+	foreach (array('user', 'pass', 'host') as $component) {
1322
+		if (isset($lp[$component]) && strpbrk($lp[$component], ':/?#@')) {
1323 1323
 			return $default;
1324 1324
 		}
1325 1325
 	}
@@ -1334,16 +1334,16 @@  discard block
 block discarded – undo
1334 1334
 	 * @param array       $hosts An array of allowed hosts.
1335 1335
 	 * @param bool|string $host  The parsed host; empty if not isset.
1336 1336
 	 */
1337
-	$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
1337
+	$allowed_hosts = (array) apply_filters('allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '');
1338 1338
 
1339
-	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
1339
+	if (isset($lp['host']) && ( ! in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])))
1340 1340
 		$location = $default;
1341 1341
 
1342 1342
 	return $location;
1343 1343
 }
1344 1344
 endif;
1345 1345
 
1346
-if ( ! function_exists('wp_notify_postauthor') ) :
1346
+if ( ! function_exists('wp_notify_postauthor')) :
1347 1347
 /**
1348 1348
  * Notify an author (and/or others) of a comment/trackback/pingback on a post.
1349 1349
  *
@@ -1353,21 +1353,21 @@  discard block
 block discarded – undo
1353 1353
  * @param string          $deprecated Not used
1354 1354
  * @return bool True on completion. False if no email addresses were specified.
1355 1355
  */
1356
-function wp_notify_postauthor( $comment_id, $deprecated = null ) {
1357
-	if ( null !== $deprecated ) {
1358
-		_deprecated_argument( __FUNCTION__, '3.8.0' );
1356
+function wp_notify_postauthor($comment_id, $deprecated = null) {
1357
+	if (null !== $deprecated) {
1358
+		_deprecated_argument(__FUNCTION__, '3.8.0');
1359 1359
 	}
1360 1360
 
1361
-	$comment = get_comment( $comment_id );
1362
-	if ( empty( $comment ) || empty( $comment->comment_post_ID ) )
1361
+	$comment = get_comment($comment_id);
1362
+	if (empty($comment) || empty($comment->comment_post_ID))
1363 1363
 		return false;
1364 1364
 
1365
-	$post    = get_post( $comment->comment_post_ID );
1366
-	$author  = get_userdata( $post->post_author );
1365
+	$post    = get_post($comment->comment_post_ID);
1366
+	$author  = get_userdata($post->post_author);
1367 1367
 
1368 1368
 	// Who to notify? By default, just the post author, but others can be added.
1369 1369
 	$emails = array();
1370
-	if ( $author ) {
1370
+	if ($author) {
1371 1371
 		$emails[] = $author->user_email;
1372 1372
 	}
1373 1373
 
@@ -1382,16 +1382,16 @@  discard block
 block discarded – undo
1382 1382
 	 * @param array $emails     An array of email addresses to receive a comment notification.
1383 1383
 	 * @param int   $comment_id The comment ID.
1384 1384
 	 */
1385
-	$emails = apply_filters( 'comment_notification_recipients', $emails, $comment->comment_ID );
1386
-	$emails = array_filter( $emails );
1385
+	$emails = apply_filters('comment_notification_recipients', $emails, $comment->comment_ID);
1386
+	$emails = array_filter($emails);
1387 1387
 
1388 1388
 	// If there are no addresses to send the comment to, bail.
1389
-	if ( ! count( $emails ) ) {
1389
+	if ( ! count($emails)) {
1390 1390
 		return false;
1391 1391
 	}
1392 1392
 
1393 1393
 	// Facilitate unsetting below without knowing the keys.
1394
-	$emails = array_flip( $emails );
1394
+	$emails = array_flip($emails);
1395 1395
 
1396 1396
 	/**
1397 1397
 	 * Filters whether to notify comment authors of their comments on their own posts.
@@ -1405,103 +1405,103 @@  discard block
 block discarded – undo
1405 1405
 	 *                         Default false.
1406 1406
 	 * @param int  $comment_id The comment ID.
1407 1407
 	 */
1408
-	$notify_author = apply_filters( 'comment_notification_notify_author', false, $comment->comment_ID );
1408
+	$notify_author = apply_filters('comment_notification_notify_author', false, $comment->comment_ID);
1409 1409
 
1410 1410
 	// The comment was left by the author
1411
-	if ( $author && ! $notify_author && $comment->user_id == $post->post_author ) {
1412
-		unset( $emails[ $author->user_email ] );
1411
+	if ($author && ! $notify_author && $comment->user_id == $post->post_author) {
1412
+		unset($emails[$author->user_email]);
1413 1413
 	}
1414 1414
 
1415 1415
 	// The author moderated a comment on their own post
1416
-	if ( $author && ! $notify_author && $post->post_author == get_current_user_id() ) {
1417
-		unset( $emails[ $author->user_email ] );
1416
+	if ($author && ! $notify_author && $post->post_author == get_current_user_id()) {
1417
+		unset($emails[$author->user_email]);
1418 1418
 	}
1419 1419
 
1420 1420
 	// The post author is no longer a member of the blog
1421
-	if ( $author && ! $notify_author && ! user_can( $post->post_author, 'read_post', $post->ID ) ) {
1422
-		unset( $emails[ $author->user_email ] );
1421
+	if ($author && ! $notify_author && ! user_can($post->post_author, 'read_post', $post->ID)) {
1422
+		unset($emails[$author->user_email]);
1423 1423
 	}
1424 1424
 
1425 1425
 	// If there's no email to send the comment to, bail, otherwise flip array back around for use below
1426
-	if ( ! count( $emails ) ) {
1426
+	if ( ! count($emails)) {
1427 1427
 		return false;
1428 1428
 	} else {
1429
-		$emails = array_flip( $emails );
1429
+		$emails = array_flip($emails);
1430 1430
 	}
1431 1431
 
1432
-	$switched_locale = switch_to_locale( get_locale() );
1432
+	$switched_locale = switch_to_locale(get_locale());
1433 1433
 
1434 1434
 	$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
1435 1435
 
1436 1436
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1437 1437
 	// we want to reverse this for the plain text arena of emails.
1438 1438
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1439
-	$comment_content = wp_specialchars_decode( $comment->comment_content );
1439
+	$comment_content = wp_specialchars_decode($comment->comment_content);
1440 1440
 
1441
-	switch ( $comment->comment_type ) {
1441
+	switch ($comment->comment_type) {
1442 1442
 		case 'trackback':
1443 1443
 			/* translators: 1: Post title */
1444
-			$notify_message  = sprintf( __( 'New trackback on your post "%s"' ), $post->post_title ) . "\r\n";
1444
+			$notify_message  = sprintf(__('New trackback on your post "%s"'), $post->post_title)."\r\n";
1445 1445
 			/* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
1446
-			$notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1447
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1448
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1449
-			$notify_message .= __( 'You can see all trackbacks on this post here:' ) . "\r\n";
1446
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1447
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1448
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1449
+			$notify_message .= __('You can see all trackbacks on this post here:')."\r\n";
1450 1450
 			/* translators: 1: blog name, 2: post title */
1451
-			$subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
1451
+			$subject = sprintf(__('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title);
1452 1452
 			break;
1453 1453
 		case 'pingback':
1454 1454
 			/* translators: 1: Post title */
1455
-			$notify_message  = sprintf( __( 'New pingback on your post "%s"' ), $post->post_title ) . "\r\n";
1455
+			$notify_message  = sprintf(__('New pingback on your post "%s"'), $post->post_title)."\r\n";
1456 1456
 			/* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
1457
-			$notify_message .= sprintf( __('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1458
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1459
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1460
-			$notify_message .= __( 'You can see all pingbacks on this post here:' ) . "\r\n";
1457
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1458
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1459
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1460
+			$notify_message .= __('You can see all pingbacks on this post here:')."\r\n";
1461 1461
 			/* translators: 1: blog name, 2: post title */
1462
-			$subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
1462
+			$subject = sprintf(__('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title);
1463 1463
 			break;
1464 1464
 		default: // Comments
1465
-			$notify_message  = sprintf( __( 'New comment on your post "%s"' ), $post->post_title ) . "\r\n";
1465
+			$notify_message  = sprintf(__('New comment on your post "%s"'), $post->post_title)."\r\n";
1466 1466
 			/* translators: 1: comment author, 2: author IP, 3: author domain */
1467
-			$notify_message .= sprintf( __( 'Author: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1468
-			$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
1469
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1470
-			$notify_message .= sprintf( __('Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1471
-			$notify_message .= __( 'You can see all comments on this post here:' ) . "\r\n";
1467
+			$notify_message .= sprintf(__('Author: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1468
+			$notify_message .= sprintf(__('Email: %s'), $comment->comment_author_email)."\r\n";
1469
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1470
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1471
+			$notify_message .= __('You can see all comments on this post here:')."\r\n";
1472 1472
 			/* translators: 1: blog name, 2: post title */
1473
-			$subject = sprintf( __('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title );
1473
+			$subject = sprintf(__('[%1$s] Comment: "%2$s"'), $blogname, $post->post_title);
1474 1474
 			break;
1475 1475
 	}
1476
-	$notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
1477
-	$notify_message .= sprintf( __('Permalink: %s'), get_comment_link( $comment ) ) . "\r\n";
1476
+	$notify_message .= get_permalink($comment->comment_post_ID)."#comments\r\n\r\n";
1477
+	$notify_message .= sprintf(__('Permalink: %s'), get_comment_link($comment))."\r\n";
1478 1478
 
1479
-	if ( user_can( $post->post_author, 'edit_comment', $comment->comment_ID ) ) {
1480
-		if ( EMPTY_TRASH_DAYS ) {
1481
-			$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1479
+	if (user_can($post->post_author, 'edit_comment', $comment->comment_ID)) {
1480
+		if (EMPTY_TRASH_DAYS) {
1481
+			$notify_message .= sprintf(__('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1482 1482
 		} else {
1483
-			$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1483
+			$notify_message .= sprintf(__('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1484 1484
 		}
1485
-		$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
1485
+		$notify_message .= sprintf(__('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment->comment_ID}#wpbody-content"))."\r\n";
1486 1486
 	}
1487 1487
 
1488
-	$wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
1488
+	$wp_email = 'wordpress@'.preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
1489 1489
 
1490
-	if ( '' == $comment->comment_author ) {
1490
+	if ('' == $comment->comment_author) {
1491 1491
 		$from = "From: \"$blogname\" <$wp_email>";
1492
-		if ( '' != $comment->comment_author_email )
1492
+		if ('' != $comment->comment_author_email)
1493 1493
 			$reply_to = "Reply-To: $comment->comment_author_email";
1494 1494
 	} else {
1495 1495
 		$from = "From: \"$comment->comment_author\" <$wp_email>";
1496
-		if ( '' != $comment->comment_author_email )
1496
+		if ('' != $comment->comment_author_email)
1497 1497
 			$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1498 1498
 	}
1499 1499
 
1500 1500
 	$message_headers = "$from\n"
1501
-		. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1501
+		. "Content-Type: text/plain; charset=\"".get_option('blog_charset')."\"\n";
1502 1502
 
1503
-	if ( isset($reply_to) )
1504
-		$message_headers .= $reply_to . "\n";
1503
+	if (isset($reply_to))
1504
+		$message_headers .= $reply_to."\n";
1505 1505
 
1506 1506
 	/**
1507 1507
 	 * Filters the comment notification email text.
@@ -1511,7 +1511,7 @@  discard block
 block discarded – undo
1511 1511
 	 * @param string $notify_message The comment notification email text.
1512 1512
 	 * @param int    $comment_id     Comment ID.
1513 1513
 	 */
1514
-	$notify_message = apply_filters( 'comment_notification_text', $notify_message, $comment->comment_ID );
1514
+	$notify_message = apply_filters('comment_notification_text', $notify_message, $comment->comment_ID);
1515 1515
 
1516 1516
 	/**
1517 1517
 	 * Filters the comment notification email subject.
@@ -1521,7 +1521,7 @@  discard block
 block discarded – undo
1521 1521
 	 * @param string $subject    The comment notification email subject.
1522 1522
 	 * @param int    $comment_id Comment ID.
1523 1523
 	 */
1524
-	$subject = apply_filters( 'comment_notification_subject', $subject, $comment->comment_ID );
1524
+	$subject = apply_filters('comment_notification_subject', $subject, $comment->comment_ID);
1525 1525
 
1526 1526
 	/**
1527 1527
 	 * Filters the comment notification email headers.
@@ -1531,13 +1531,13 @@  discard block
 block discarded – undo
1531 1531
 	 * @param string $message_headers Headers for the comment notification email.
1532 1532
 	 * @param int    $comment_id      Comment ID.
1533 1533
 	 */
1534
-	$message_headers = apply_filters( 'comment_notification_headers', $message_headers, $comment->comment_ID );
1534
+	$message_headers = apply_filters('comment_notification_headers', $message_headers, $comment->comment_ID);
1535 1535
 
1536
-	foreach ( $emails as $email ) {
1537
-		@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
1536
+	foreach ($emails as $email) {
1537
+		@wp_mail($email, wp_specialchars_decode($subject), $notify_message, $message_headers);
1538 1538
 	}
1539 1539
 
1540
-	if ( $switched_locale ) {
1540
+	if ($switched_locale) {
1541 1541
 		restore_previous_locale();
1542 1542
 	}
1543 1543
 
@@ -1545,7 +1545,7 @@  discard block
 block discarded – undo
1545 1545
 }
1546 1546
 endif;
1547 1547
 
1548
-if ( !function_exists('wp_notify_moderator') ) :
1548
+if ( ! function_exists('wp_notify_moderator')) :
1549 1549
 /**
1550 1550
  * Notifies the moderator of the site about a new comment that is awaiting approval.
1551 1551
  *
@@ -1562,7 +1562,7 @@  discard block
 block discarded – undo
1562 1562
 function wp_notify_moderator($comment_id) {
1563 1563
 	global $wpdb;
1564 1564
 
1565
-	$maybe_notify = get_option( 'moderation_notify' );
1565
+	$maybe_notify = get_option('moderation_notify');
1566 1566
 
1567 1567
 	/**
1568 1568
 	 * Filters whether to send the site moderator email notifications, overriding the site setting.
@@ -1572,23 +1572,23 @@  discard block
 block discarded – undo
1572 1572
 	 * @param bool $maybe_notify Whether to notify blog moderator.
1573 1573
 	 * @param int  $comment_ID   The id of the comment for the notification.
1574 1574
 	 */
1575
-	$maybe_notify = apply_filters( 'notify_moderator', $maybe_notify, $comment_id );
1575
+	$maybe_notify = apply_filters('notify_moderator', $maybe_notify, $comment_id);
1576 1576
 
1577
-	if ( ! $maybe_notify ) {
1577
+	if ( ! $maybe_notify) {
1578 1578
 		return true;
1579 1579
 	}
1580 1580
 
1581 1581
 	$comment = get_comment($comment_id);
1582 1582
 	$post = get_post($comment->comment_post_ID);
1583
-	$user = get_userdata( $post->post_author );
1583
+	$user = get_userdata($post->post_author);
1584 1584
 	// Send to the administration and to the post author if the author can modify the comment.
1585
-	$emails = array( get_option( 'admin_email' ) );
1586
-	if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
1587
-		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) )
1585
+	$emails = array(get_option('admin_email'));
1586
+	if ($user && user_can($user->ID, 'edit_comment', $comment_id) && ! empty($user->user_email)) {
1587
+		if (0 !== strcasecmp($user->user_email, get_option('admin_email')))
1588 1588
 			$emails[] = $user->user_email;
1589 1589
 	}
1590 1590
 
1591
-	$switched_locale = switch_to_locale( get_locale() );
1591
+	$switched_locale = switch_to_locale(get_locale());
1592 1592
 
1593 1593
 	$comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
1594 1594
 	$comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
@@ -1596,65 +1596,65 @@  discard block
 block discarded – undo
1596 1596
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1597 1597
 	// we want to reverse this for the plain text arena of emails.
1598 1598
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1599
-	$comment_content = wp_specialchars_decode( $comment->comment_content );
1599
+	$comment_content = wp_specialchars_decode($comment->comment_content);
1600 1600
 
1601
-	switch ( $comment->comment_type ) {
1601
+	switch ($comment->comment_type) {
1602 1602
 		case 'trackback':
1603 1603
 			/* translators: 1: Post title */
1604
-			$notify_message  = sprintf( __('A new trackback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1605
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1604
+			$notify_message  = sprintf(__('A new trackback on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1605
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1606 1606
 			/* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
1607
-			$notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1607
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1608 1608
 			/* translators: 1: Trackback/pingback/comment author URL */
1609
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1610
-			$notify_message .= __('Trackback excerpt: ') . "\r\n" . $comment_content . "\r\n\r\n";
1609
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1610
+			$notify_message .= __('Trackback excerpt: ')."\r\n".$comment_content."\r\n\r\n";
1611 1611
 			break;
1612 1612
 		case 'pingback':
1613 1613
 			/* translators: 1: Post title */
1614
-			$notify_message  = sprintf( __('A new pingback on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1615
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1614
+			$notify_message  = sprintf(__('A new pingback on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1615
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1616 1616
 			/* translators: 1: Trackback/pingback website name, 2: website IP, 3: website hostname */
1617
-			$notify_message .= sprintf( __( 'Website: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1617
+			$notify_message .= sprintf(__('Website: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1618 1618
 			/* translators: 1: Trackback/pingback/comment author URL */
1619
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1620
-			$notify_message .= __('Pingback excerpt: ') . "\r\n" . $comment_content . "\r\n\r\n";
1619
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1620
+			$notify_message .= __('Pingback excerpt: ')."\r\n".$comment_content."\r\n\r\n";
1621 1621
 			break;
1622 1622
 		default: // Comments
1623 1623
 			/* translators: 1: Post title */
1624
-			$notify_message  = sprintf( __('A new comment on the post "%s" is waiting for your approval'), $post->post_title ) . "\r\n";
1625
-			$notify_message .= get_permalink($comment->comment_post_ID) . "\r\n\r\n";
1624
+			$notify_message  = sprintf(__('A new comment on the post "%s" is waiting for your approval'), $post->post_title)."\r\n";
1625
+			$notify_message .= get_permalink($comment->comment_post_ID)."\r\n\r\n";
1626 1626
 			/* translators: 1: Comment author name, 2: comment author's IP, 3: comment author IP's hostname */
1627
-			$notify_message .= sprintf( __( 'Author: %1$s (IP: %2$s, %3$s)' ), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain ) . "\r\n";
1627
+			$notify_message .= sprintf(__('Author: %1$s (IP: %2$s, %3$s)'), $comment->comment_author, $comment->comment_author_IP, $comment_author_domain)."\r\n";
1628 1628
 			/* translators: 1: Comment author URL */
1629
-			$notify_message .= sprintf( __( 'Email: %s' ), $comment->comment_author_email ) . "\r\n";
1629
+			$notify_message .= sprintf(__('Email: %s'), $comment->comment_author_email)."\r\n";
1630 1630
 			/* translators: 1: Trackback/pingback/comment author URL */
1631
-			$notify_message .= sprintf( __( 'URL: %s' ), $comment->comment_author_url ) . "\r\n";
1631
+			$notify_message .= sprintf(__('URL: %s'), $comment->comment_author_url)."\r\n";
1632 1632
 			/* translators: 1: Comment text */
1633
-			$notify_message .= sprintf( __( 'Comment: %s' ), "\r\n" . $comment_content ) . "\r\n\r\n";
1633
+			$notify_message .= sprintf(__('Comment: %s'), "\r\n".$comment_content)."\r\n\r\n";
1634 1634
 			break;
1635 1635
 	}
1636 1636
 
1637 1637
 	/* translators: Comment moderation. 1: Comment action URL */
1638
-	$notify_message .= sprintf( __( 'Approve it: %s' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1638
+	$notify_message .= sprintf(__('Approve it: %s'), admin_url("comment.php?action=approve&c={$comment_id}#wpbody-content"))."\r\n";
1639 1639
 
1640
-	if ( EMPTY_TRASH_DAYS ) {
1640
+	if (EMPTY_TRASH_DAYS) {
1641 1641
 		/* translators: Comment moderation. 1: Comment action URL */
1642
-		$notify_message .= sprintf( __( 'Trash it: %s' ), admin_url( "comment.php?action=trash&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1642
+		$notify_message .= sprintf(__('Trash it: %s'), admin_url("comment.php?action=trash&c={$comment_id}#wpbody-content"))."\r\n";
1643 1643
 	} else {
1644 1644
 		/* translators: Comment moderation. 1: Comment action URL */
1645
-		$notify_message .= sprintf( __( 'Delete it: %s' ), admin_url( "comment.php?action=delete&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1645
+		$notify_message .= sprintf(__('Delete it: %s'), admin_url("comment.php?action=delete&c={$comment_id}#wpbody-content"))."\r\n";
1646 1646
 	}
1647 1647
 
1648 1648
 	/* translators: Comment moderation. 1: Comment action URL */
1649
-	$notify_message .= sprintf( __( 'Spam it: %s' ), admin_url( "comment.php?action=spam&c={$comment_id}#wpbody-content" ) ) . "\r\n";
1649
+	$notify_message .= sprintf(__('Spam it: %s'), admin_url("comment.php?action=spam&c={$comment_id}#wpbody-content"))."\r\n";
1650 1650
 
1651 1651
 	/* translators: Comment moderation. 1: Number of comments awaiting approval */
1652
-	$notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
1653
- 		'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
1654
-	$notify_message .= admin_url( "edit-comments.php?comment_status=moderated#wpbody-content" ) . "\r\n";
1652
+	$notify_message .= sprintf(_n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
1653
+ 		'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting))."\r\n";
1654
+	$notify_message .= admin_url("edit-comments.php?comment_status=moderated#wpbody-content")."\r\n";
1655 1655
 
1656 1656
 	/* translators: Comment moderation notification email subject. 1: Site name, 2: Post title */
1657
-	$subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
1657
+	$subject = sprintf(__('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title);
1658 1658
 	$message_headers = '';
1659 1659
 
1660 1660
 	/**
@@ -1665,7 +1665,7 @@  discard block
 block discarded – undo
1665 1665
 	 * @param array $emails     List of email addresses to notify for comment moderation.
1666 1666
 	 * @param int   $comment_id Comment ID.
1667 1667
 	 */
1668
-	$emails = apply_filters( 'comment_moderation_recipients', $emails, $comment_id );
1668
+	$emails = apply_filters('comment_moderation_recipients', $emails, $comment_id);
1669 1669
 
1670 1670
 	/**
1671 1671
 	 * Filters the comment moderation email text.
@@ -1675,7 +1675,7 @@  discard block
 block discarded – undo
1675 1675
 	 * @param string $notify_message Text of the comment moderation email.
1676 1676
 	 * @param int    $comment_id     Comment ID.
1677 1677
 	 */
1678
-	$notify_message = apply_filters( 'comment_moderation_text', $notify_message, $comment_id );
1678
+	$notify_message = apply_filters('comment_moderation_text', $notify_message, $comment_id);
1679 1679
 
1680 1680
 	/**
1681 1681
 	 * Filters the comment moderation email subject.
@@ -1685,7 +1685,7 @@  discard block
 block discarded – undo
1685 1685
 	 * @param string $subject    Subject of the comment moderation email.
1686 1686
 	 * @param int    $comment_id Comment ID.
1687 1687
 	 */
1688
-	$subject = apply_filters( 'comment_moderation_subject', $subject, $comment_id );
1688
+	$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
1689 1689
 
1690 1690
 	/**
1691 1691
 	 * Filters the comment moderation email headers.
@@ -1695,13 +1695,13 @@  discard block
 block discarded – undo
1695 1695
 	 * @param string $message_headers Headers for the comment moderation email.
1696 1696
 	 * @param int    $comment_id      Comment ID.
1697 1697
 	 */
1698
-	$message_headers = apply_filters( 'comment_moderation_headers', $message_headers, $comment_id );
1698
+	$message_headers = apply_filters('comment_moderation_headers', $message_headers, $comment_id);
1699 1699
 
1700
-	foreach ( $emails as $email ) {
1701
-		@wp_mail( $email, wp_specialchars_decode( $subject ), $notify_message, $message_headers );
1700
+	foreach ($emails as $email) {
1701
+		@wp_mail($email, wp_specialchars_decode($subject), $notify_message, $message_headers);
1702 1702
 	}
1703 1703
 
1704
-	if ( $switched_locale ) {
1704
+	if ($switched_locale) {
1705 1705
 		restore_previous_locale();
1706 1706
 	}
1707 1707
 
@@ -1709,7 +1709,7 @@  discard block
 block discarded – undo
1709 1709
 }
1710 1710
 endif;
1711 1711
 
1712
-if ( !function_exists('wp_password_change_notification') ) :
1712
+if ( ! function_exists('wp_password_change_notification')) :
1713 1713
 /**
1714 1714
  * Notify the blog admin of a user changing password, normally via email.
1715 1715
  *
@@ -1717,22 +1717,22 @@  discard block
 block discarded – undo
1717 1717
  *
1718 1718
  * @param WP_User $user User object.
1719 1719
  */
1720
-function wp_password_change_notification( $user ) {
1720
+function wp_password_change_notification($user) {
1721 1721
 	// send a copy of password change notification to the admin
1722 1722
 	// but check to see if it's the admin whose password we're changing, and skip this
1723
-	if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
1723
+	if (0 !== strcasecmp($user->user_email, get_option('admin_email'))) {
1724 1724
 		/* translators: %s: user name */
1725
-		$message = sprintf( __( 'Password changed for user: %s' ), $user->user_login ) . "\r\n";
1725
+		$message = sprintf(__('Password changed for user: %s'), $user->user_login)."\r\n";
1726 1726
 		// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1727 1727
 		// we want to reverse this for the plain text arena of emails.
1728 1728
 		$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1729 1729
 		/* translators: %s: site title */
1730
-		wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] Password Changed' ), $blogname ), $message );
1730
+		wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Changed'), $blogname), $message);
1731 1731
 	}
1732 1732
 }
1733 1733
 endif;
1734 1734
 
1735
-if ( !function_exists('wp_new_user_notification') ) :
1735
+if ( ! function_exists('wp_new_user_notification')) :
1736 1736
 /**
1737 1737
  * Email login credentials to a newly-registered user.
1738 1738
  *
@@ -1751,66 +1751,66 @@  discard block
 block discarded – undo
1751 1751
  * @param string $notify     Optional. Type of notification that should happen. Accepts 'admin' or an empty
1752 1752
  *                           string (admin only), 'user', or 'both' (admin and user). Default empty.
1753 1753
  */
1754
-function wp_new_user_notification( $user_id, $deprecated = null, $notify = '' ) {
1755
-	if ( $deprecated !== null ) {
1756
-		_deprecated_argument( __FUNCTION__, '4.3.1' );
1754
+function wp_new_user_notification($user_id, $deprecated = null, $notify = '') {
1755
+	if ($deprecated !== null) {
1756
+		_deprecated_argument(__FUNCTION__, '4.3.1');
1757 1757
 	}
1758 1758
 
1759 1759
 	global $wpdb, $wp_hasher;
1760
-	$user = get_userdata( $user_id );
1760
+	$user = get_userdata($user_id);
1761 1761
 
1762 1762
 	// The blogname option is escaped with esc_html on the way into the database in sanitize_option
1763 1763
 	// we want to reverse this for the plain text arena of emails.
1764 1764
 	$blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1765 1765
 
1766
-	if ( 'user' !== $notify ) {
1767
-		$switched_locale = switch_to_locale( get_locale() );
1768
-		$message  = sprintf( __( 'New user registration on your site %s:' ), $blogname ) . "\r\n\r\n";
1769
-		$message .= sprintf( __( 'Username: %s' ), $user->user_login ) . "\r\n\r\n";
1770
-		$message .= sprintf( __( 'Email: %s' ), $user->user_email ) . "\r\n";
1766
+	if ('user' !== $notify) {
1767
+		$switched_locale = switch_to_locale(get_locale());
1768
+		$message  = sprintf(__('New user registration on your site %s:'), $blogname)."\r\n\r\n";
1769
+		$message .= sprintf(__('Username: %s'), $user->user_login)."\r\n\r\n";
1770
+		$message .= sprintf(__('Email: %s'), $user->user_email)."\r\n";
1771 1771
 
1772
-		@wp_mail( get_option( 'admin_email' ), sprintf( __( '[%s] New User Registration' ), $blogname ), $message );
1772
+		@wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
1773 1773
 
1774
-		if ( $switched_locale ) {
1774
+		if ($switched_locale) {
1775 1775
 			restore_previous_locale();
1776 1776
 		}
1777 1777
 	}
1778 1778
 
1779 1779
 	// `$deprecated was pre-4.3 `$plaintext_pass`. An empty `$plaintext_pass` didn't sent a user notification.
1780
-	if ( 'admin' === $notify || ( empty( $deprecated ) && empty( $notify ) ) ) {
1780
+	if ('admin' === $notify || (empty($deprecated) && empty($notify))) {
1781 1781
 		return;
1782 1782
 	}
1783 1783
 
1784 1784
 	// Generate something random for a password reset key.
1785
-	$key = wp_generate_password( 20, false );
1785
+	$key = wp_generate_password(20, false);
1786 1786
 
1787 1787
 	/** This action is documented in wp-login.php */
1788
-	do_action( 'retrieve_password_key', $user->user_login, $key );
1788
+	do_action('retrieve_password_key', $user->user_login, $key);
1789 1789
 
1790 1790
 	// Now insert the key, hashed, into the DB.
1791
-	if ( empty( $wp_hasher ) ) {
1792
-		$wp_hasher = new PasswordHash( 8, true );
1791
+	if (empty($wp_hasher)) {
1792
+		$wp_hasher = new PasswordHash(8, true);
1793 1793
 	}
1794
-	$hashed = time() . ':' . $wp_hasher->HashPassword( $key );
1795
-	$wpdb->update( $wpdb->users, array( 'user_activation_key' => $hashed ), array( 'user_login' => $user->user_login ) );
1794
+	$hashed = time().':'.$wp_hasher->HashPassword($key);
1795
+	$wpdb->update($wpdb->users, array('user_activation_key' => $hashed), array('user_login' => $user->user_login));
1796 1796
 
1797
-	$switched_locale = switch_to_locale( get_user_locale( $user ) );
1797
+	$switched_locale = switch_to_locale(get_user_locale($user));
1798 1798
 
1799
-	$message = sprintf(__('Username: %s'), $user->user_login) . "\r\n\r\n";
1800
-	$message .= __('To set your password, visit the following address:') . "\r\n\r\n";
1801
-	$message .= '<' . network_site_url("wp-login.php?action=rp&key=$key&login=" . rawurlencode($user->user_login), 'login') . ">\r\n\r\n";
1799
+	$message = sprintf(__('Username: %s'), $user->user_login)."\r\n\r\n";
1800
+	$message .= __('To set your password, visit the following address:')."\r\n\r\n";
1801
+	$message .= '<'.network_site_url("wp-login.php?action=rp&key=$key&login=".rawurlencode($user->user_login), 'login').">\r\n\r\n";
1802 1802
 
1803
-	$message .= wp_login_url() . "\r\n";
1803
+	$message .= wp_login_url()."\r\n";
1804 1804
 
1805 1805
 	wp_mail($user->user_email, sprintf(__('[%s] Your username and password info'), $blogname), $message);
1806 1806
 
1807
-	if ( $switched_locale ) {
1807
+	if ($switched_locale) {
1808 1808
 		restore_previous_locale();
1809 1809
 	}
1810 1810
 }
1811 1811
 endif;
1812 1812
 
1813
-if ( !function_exists('wp_nonce_tick') ) :
1813
+if ( ! function_exists('wp_nonce_tick')) :
1814 1814
 /**
1815 1815
  * Get the time-dependent variable for nonce creation.
1816 1816
  *
@@ -1829,13 +1829,13 @@  discard block
 block discarded – undo
1829 1829
 	 *
1830 1830
 	 * @param int $lifespan Lifespan of nonces in seconds. Default 86,400 seconds, or one day.
1831 1831
 	 */
1832
-	$nonce_life = apply_filters( 'nonce_life', DAY_IN_SECONDS );
1832
+	$nonce_life = apply_filters('nonce_life', DAY_IN_SECONDS);
1833 1833
 
1834
-	return ceil(time() / ( $nonce_life / 2 ));
1834
+	return ceil(time() / ($nonce_life / 2));
1835 1835
 }
1836 1836
 endif;
1837 1837
 
1838
-if ( !function_exists('wp_verify_nonce') ) :
1838
+if ( ! function_exists('wp_verify_nonce')) :
1839 1839
 /**
1840 1840
  * Verify that correct nonce was used with time limit.
1841 1841
  *
@@ -1849,11 +1849,11 @@  discard block
 block discarded – undo
1849 1849
  * @return false|int False if the nonce is invalid, 1 if the nonce is valid and generated between
1850 1850
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1851 1851
  */
1852
-function wp_verify_nonce( $nonce, $action = -1 ) {
1852
+function wp_verify_nonce($nonce, $action = -1) {
1853 1853
 	$nonce = (string) $nonce;
1854 1854
 	$user = wp_get_current_user();
1855 1855
 	$uid = (int) $user->ID;
1856
-	if ( ! $uid ) {
1856
+	if ( ! $uid) {
1857 1857
 		/**
1858 1858
 		 * Filters whether the user who generated the nonce is logged out.
1859 1859
 		 *
@@ -1862,10 +1862,10 @@  discard block
 block discarded – undo
1862 1862
 		 * @param int    $uid    ID of the nonce-owning user.
1863 1863
 		 * @param string $action The nonce action.
1864 1864
 		 */
1865
-		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1865
+		$uid = apply_filters('nonce_user_logged_out', $uid, $action);
1866 1866
 	}
1867 1867
 
1868
-	if ( empty( $nonce ) ) {
1868
+	if (empty($nonce)) {
1869 1869
 		return false;
1870 1870
 	}
1871 1871
 
@@ -1873,14 +1873,14 @@  discard block
 block discarded – undo
1873 1873
 	$i = wp_nonce_tick();
1874 1874
 
1875 1875
 	// Nonce generated 0-12 hours ago
1876
-	$expected = substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce'), -12, 10 );
1877
-	if ( hash_equals( $expected, $nonce ) ) {
1876
+	$expected = substr(wp_hash($i.'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1877
+	if (hash_equals($expected, $nonce)) {
1878 1878
 		return 1;
1879 1879
 	}
1880 1880
 
1881 1881
 	// Nonce generated 12-24 hours ago
1882
-	$expected = substr( wp_hash( ( $i - 1 ) . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1883
-	if ( hash_equals( $expected, $nonce ) ) {
1882
+	$expected = substr(wp_hash(($i - 1).'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1883
+	if (hash_equals($expected, $nonce)) {
1884 1884
 		return 2;
1885 1885
 	}
1886 1886
 
@@ -1894,14 +1894,14 @@  discard block
 block discarded – undo
1894 1894
 	 * @param WP_User    $user   The current user object.
1895 1895
 	 * @param string     $token  The user's session token.
1896 1896
 	 */
1897
-	do_action( 'wp_verify_nonce_failed', $nonce, $action, $user, $token );
1897
+	do_action('wp_verify_nonce_failed', $nonce, $action, $user, $token);
1898 1898
 
1899 1899
 	// Invalid nonce
1900 1900
 	return false;
1901 1901
 }
1902 1902
 endif;
1903 1903
 
1904
-if ( !function_exists('wp_create_nonce') ) :
1904
+if ( ! function_exists('wp_create_nonce')) :
1905 1905
 /**
1906 1906
  * Creates a cryptographic token tied to a specific action, user, user session,
1907 1907
  * and window of time.
@@ -1915,19 +1915,19 @@  discard block
 block discarded – undo
1915 1915
 function wp_create_nonce($action = -1) {
1916 1916
 	$user = wp_get_current_user();
1917 1917
 	$uid = (int) $user->ID;
1918
-	if ( ! $uid ) {
1918
+	if ( ! $uid) {
1919 1919
 		/** This filter is documented in wp-includes/pluggable.php */
1920
-		$uid = apply_filters( 'nonce_user_logged_out', $uid, $action );
1920
+		$uid = apply_filters('nonce_user_logged_out', $uid, $action);
1921 1921
 	}
1922 1922
 
1923 1923
 	$token = wp_get_session_token();
1924 1924
 	$i = wp_nonce_tick();
1925 1925
 
1926
-	return substr( wp_hash( $i . '|' . $action . '|' . $uid . '|' . $token, 'nonce' ), -12, 10 );
1926
+	return substr(wp_hash($i.'|'.$action.'|'.$uid.'|'.$token, 'nonce'), -12, 10);
1927 1927
 }
1928 1928
 endif;
1929 1929
 
1930
-if ( !function_exists('wp_salt') ) :
1930
+if ( ! function_exists('wp_salt')) :
1931 1931
 /**
1932 1932
  * Get salt to add to hashes.
1933 1933
  *
@@ -1963,9 +1963,9 @@  discard block
 block discarded – undo
1963 1963
  * @param string $scheme Authentication scheme (auth, secure_auth, logged_in, nonce)
1964 1964
  * @return string Salt value
1965 1965
  */
1966
-function wp_salt( $scheme = 'auth' ) {
1966
+function wp_salt($scheme = 'auth') {
1967 1967
 	static $cached_salts = array();
1968
-	if ( isset( $cached_salts[ $scheme ] ) ) {
1968
+	if (isset($cached_salts[$scheme])) {
1969 1969
 		/**
1970 1970
 		 * Filters the WordPress salt.
1971 1971
 		 *
@@ -1975,19 +1975,19 @@  discard block
 block discarded – undo
1975 1975
 		 * @param string $scheme      Authentication scheme. Values include 'auth',
1976 1976
 		 *                            'secure_auth', 'logged_in', and 'nonce'.
1977 1977
 		 */
1978
-		return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
1978
+		return apply_filters('salt', $cached_salts[$scheme], $scheme);
1979 1979
 	}
1980 1980
 
1981 1981
 	static $duplicated_keys;
1982
-	if ( null === $duplicated_keys ) {
1983
-		$duplicated_keys = array( 'put your unique phrase here' => true );
1984
-		foreach ( array( 'AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET' ) as $first ) {
1985
-			foreach ( array( 'KEY', 'SALT' ) as $second ) {
1986
-				if ( ! defined( "{$first}_{$second}" ) ) {
1982
+	if (null === $duplicated_keys) {
1983
+		$duplicated_keys = array('put your unique phrase here' => true);
1984
+		foreach (array('AUTH', 'SECURE_AUTH', 'LOGGED_IN', 'NONCE', 'SECRET') as $first) {
1985
+			foreach (array('KEY', 'SALT') as $second) {
1986
+				if ( ! defined("{$first}_{$second}")) {
1987 1987
 					continue;
1988 1988
 				}
1989
-				$value = constant( "{$first}_{$second}" );
1990
-				$duplicated_keys[ $value ] = isset( $duplicated_keys[ $value ] );
1989
+				$value = constant("{$first}_{$second}");
1990
+				$duplicated_keys[$value] = isset($duplicated_keys[$value]);
1991 1991
 			}
1992 1992
 		}
1993 1993
 	}
@@ -1996,45 +1996,45 @@  discard block
 block discarded – undo
1996 1996
 		'key' => '',
1997 1997
 		'salt' => ''
1998 1998
 	);
1999
-	if ( defined( 'SECRET_KEY' ) && SECRET_KEY && empty( $duplicated_keys[ SECRET_KEY ] ) ) {
1999
+	if (defined('SECRET_KEY') && SECRET_KEY && empty($duplicated_keys[SECRET_KEY])) {
2000 2000
 		$values['key'] = SECRET_KEY;
2001 2001
 	}
2002
-	if ( 'auth' == $scheme && defined( 'SECRET_SALT' ) && SECRET_SALT && empty( $duplicated_keys[ SECRET_SALT ] ) ) {
2002
+	if ('auth' == $scheme && defined('SECRET_SALT') && SECRET_SALT && empty($duplicated_keys[SECRET_SALT])) {
2003 2003
 		$values['salt'] = SECRET_SALT;
2004 2004
 	}
2005 2005
 
2006
-	if ( in_array( $scheme, array( 'auth', 'secure_auth', 'logged_in', 'nonce' ) ) ) {
2007
-		foreach ( array( 'key', 'salt' ) as $type ) {
2008
-			$const = strtoupper( "{$scheme}_{$type}" );
2009
-			if ( defined( $const ) && constant( $const ) && empty( $duplicated_keys[ constant( $const ) ] ) ) {
2010
-				$values[ $type ] = constant( $const );
2011
-			} elseif ( ! $values[ $type ] ) {
2012
-				$values[ $type ] = get_site_option( "{$scheme}_{$type}" );
2013
-				if ( ! $values[ $type ] ) {
2014
-					$values[ $type ] = wp_generate_password( 64, true, true );
2015
-					update_site_option( "{$scheme}_{$type}", $values[ $type ] );
2006
+	if (in_array($scheme, array('auth', 'secure_auth', 'logged_in', 'nonce'))) {
2007
+		foreach (array('key', 'salt') as $type) {
2008
+			$const = strtoupper("{$scheme}_{$type}");
2009
+			if (defined($const) && constant($const) && empty($duplicated_keys[constant($const)])) {
2010
+				$values[$type] = constant($const);
2011
+			} elseif ( ! $values[$type]) {
2012
+				$values[$type] = get_site_option("{$scheme}_{$type}");
2013
+				if ( ! $values[$type]) {
2014
+					$values[$type] = wp_generate_password(64, true, true);
2015
+					update_site_option("{$scheme}_{$type}", $values[$type]);
2016 2016
 				}
2017 2017
 			}
2018 2018
 		}
2019 2019
 	} else {
2020
-		if ( ! $values['key'] ) {
2021
-			$values['key'] = get_site_option( 'secret_key' );
2022
-			if ( ! $values['key'] ) {
2023
-				$values['key'] = wp_generate_password( 64, true, true );
2024
-				update_site_option( 'secret_key', $values['key'] );
2020
+		if ( ! $values['key']) {
2021
+			$values['key'] = get_site_option('secret_key');
2022
+			if ( ! $values['key']) {
2023
+				$values['key'] = wp_generate_password(64, true, true);
2024
+				update_site_option('secret_key', $values['key']);
2025 2025
 			}
2026 2026
 		}
2027
-		$values['salt'] = hash_hmac( 'md5', $scheme, $values['key'] );
2027
+		$values['salt'] = hash_hmac('md5', $scheme, $values['key']);
2028 2028
 	}
2029 2029
 
2030
-	$cached_salts[ $scheme ] = $values['key'] . $values['salt'];
2030
+	$cached_salts[$scheme] = $values['key'].$values['salt'];
2031 2031
 
2032 2032
 	/** This filter is documented in wp-includes/pluggable.php */
2033
-	return apply_filters( 'salt', $cached_salts[ $scheme ], $scheme );
2033
+	return apply_filters('salt', $cached_salts[$scheme], $scheme);
2034 2034
 }
2035 2035
 endif;
2036 2036
 
2037
-if ( !function_exists('wp_hash') ) :
2037
+if ( ! function_exists('wp_hash')) :
2038 2038
 /**
2039 2039
  * Get hash of given string.
2040 2040
  *
@@ -2051,7 +2051,7 @@  discard block
 block discarded – undo
2051 2051
 }
2052 2052
 endif;
2053 2053
 
2054
-if ( !function_exists('wp_hash_password') ) :
2054
+if ( ! function_exists('wp_hash_password')) :
2055 2055
 /**
2056 2056
  * Create a hash (encrypt) of a plain text password.
2057 2057
  *
@@ -2068,16 +2068,16 @@  discard block
 block discarded – undo
2068 2068
 function wp_hash_password($password) {
2069 2069
 	global $wp_hasher;
2070 2070
 
2071
-	if ( empty($wp_hasher) ) {
2071
+	if (empty($wp_hasher)) {
2072 2072
 		// By default, use the portable hash from phpass
2073 2073
 		$wp_hasher = new PasswordHash(8, true);
2074 2074
 	}
2075 2075
 
2076
-	return $wp_hasher->HashPassword( trim( $password ) );
2076
+	return $wp_hasher->HashPassword(trim($password));
2077 2077
 }
2078 2078
 endif;
2079 2079
 
2080
-if ( !function_exists('wp_check_password') ) :
2080
+if ( ! function_exists('wp_check_password')) :
2081 2081
 /**
2082 2082
  * Checks the plaintext password against the encrypted Password.
2083 2083
  *
@@ -2104,9 +2104,9 @@  discard block
 block discarded – undo
2104 2104
 	global $wp_hasher;
2105 2105
 
2106 2106
 	// If the hash is still md5...
2107
-	if ( strlen($hash) <= 32 ) {
2108
-		$check = hash_equals( $hash, md5( $password ) );
2109
-		if ( $check && $user_id ) {
2107
+	if (strlen($hash) <= 32) {
2108
+		$check = hash_equals($hash, md5($password));
2109
+		if ($check && $user_id) {
2110 2110
 			// Rehash using new hash.
2111 2111
 			wp_set_password($password, $user_id);
2112 2112
 			$hash = wp_hash_password($password);
@@ -2122,12 +2122,12 @@  discard block
 block discarded – undo
2122 2122
 		 * @param string     $hash     The hashed password.
2123 2123
 		 * @param string|int $user_id  User ID. Can be empty.
2124 2124
 		 */
2125
-		return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2125
+		return apply_filters('check_password', $check, $password, $hash, $user_id);
2126 2126
 	}
2127 2127
 
2128 2128
 	// If the stored hash is longer than an MD5, presume the
2129 2129
 	// new style phpass portable hash.
2130
-	if ( empty($wp_hasher) ) {
2130
+	if (empty($wp_hasher)) {
2131 2131
 		// By default, use the portable hash from phpass
2132 2132
 		$wp_hasher = new PasswordHash(8, true);
2133 2133
 	}
@@ -2135,11 +2135,11 @@  discard block
 block discarded – undo
2135 2135
 	$check = $wp_hasher->CheckPassword($password, $hash);
2136 2136
 
2137 2137
 	/** This filter is documented in wp-includes/pluggable.php */
2138
-	return apply_filters( 'check_password', $check, $password, $hash, $user_id );
2138
+	return apply_filters('check_password', $check, $password, $hash, $user_id);
2139 2139
 }
2140 2140
 endif;
2141 2141
 
2142
-if ( !function_exists('wp_generate_password') ) :
2142
+if ( ! function_exists('wp_generate_password')) :
2143 2143
 /**
2144 2144
  * Generates a random password drawn from the defined set of characters.
2145 2145
  *
@@ -2152,15 +2152,15 @@  discard block
 block discarded – undo
2152 2152
  *                                  Used when generating secret keys and salts. Default false.
2153 2153
  * @return string The random password.
2154 2154
  */
2155
-function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
2155
+function wp_generate_password($length = 12, $special_chars = true, $extra_special_chars = false) {
2156 2156
 	$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
2157
-	if ( $special_chars )
2157
+	if ($special_chars)
2158 2158
 		$chars .= '!@#$%^&*()';
2159
-	if ( $extra_special_chars )
2159
+	if ($extra_special_chars)
2160 2160
 		$chars .= '-_ []{}<>~`+=,.;:/?|';
2161 2161
 
2162 2162
 	$password = '';
2163
-	for ( $i = 0; $i < $length; $i++ ) {
2163
+	for ($i = 0; $i < $length; $i++) {
2164 2164
 		$password .= substr($chars, wp_rand(0, strlen($chars) - 1), 1);
2165 2165
 	}
2166 2166
 
@@ -2171,11 +2171,11 @@  discard block
 block discarded – undo
2171 2171
 	 *
2172 2172
 	 * @param string $password The generated password.
2173 2173
 	 */
2174
-	return apply_filters( 'random_password', $password );
2174
+	return apply_filters('random_password', $password);
2175 2175
 }
2176 2176
 endif;
2177 2177
 
2178
-if ( !function_exists('wp_rand') ) :
2178
+if ( ! function_exists('wp_rand')) :
2179 2179
 /**
2180 2180
  * Generates a random number
2181 2181
  *
@@ -2190,7 +2190,7 @@  discard block
 block discarded – undo
2190 2190
  * @param int $max Upper limit for the generated number
2191 2191
  * @return int A random number between min and max
2192 2192
  */
2193
-function wp_rand( $min = 0, $max = 0 ) {
2193
+function wp_rand($min = 0, $max = 0) {
2194 2194
 	global $rnd_value;
2195 2195
 
2196 2196
 	// Some misconfigured 32bit environments (Entropy PHP, for example) truncate integers larger than PHP_INT_MAX to PHP_INT_MAX rather than overflowing them to floats.
@@ -2202,38 +2202,38 @@  discard block
 block discarded – undo
2202 2202
 
2203 2203
 	// Use PHP's CSPRNG, or a compatible method
2204 2204
 	static $use_random_int_functionality = true;
2205
-	if ( $use_random_int_functionality ) {
2205
+	if ($use_random_int_functionality) {
2206 2206
 		try {
2207
-			$_max = ( 0 != $max ) ? $max : $max_random_number;
2207
+			$_max = (0 != $max) ? $max : $max_random_number;
2208 2208
 			// wp_rand() can accept arguments in either order, PHP cannot.
2209
-			$_max = max( $min, $_max );
2210
-			$_min = min( $min, $_max );
2211
-			$val = random_int( $_min, $_max );
2212
-			if ( false !== $val ) {
2213
-				return absint( $val );
2209
+			$_max = max($min, $_max);
2210
+			$_min = min($min, $_max);
2211
+			$val = random_int($_min, $_max);
2212
+			if (false !== $val) {
2213
+				return absint($val);
2214 2214
 			} else {
2215 2215
 				$use_random_int_functionality = false;
2216 2216
 			}
2217
-		} catch ( Error $e ) {
2217
+		} catch (Error $e) {
2218 2218
 			$use_random_int_functionality = false;
2219
-		} catch ( Exception $e ) {
2219
+		} catch (Exception $e) {
2220 2220
 			$use_random_int_functionality = false;
2221 2221
 		}
2222 2222
 	}
2223 2223
 
2224 2224
 	// Reset $rnd_value after 14 uses
2225 2225
 	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
2226
-	if ( strlen($rnd_value) < 8 ) {
2227
-		if ( defined( 'WP_SETUP_CONFIG' ) )
2226
+	if (strlen($rnd_value) < 8) {
2227
+		if (defined('WP_SETUP_CONFIG'))
2228 2228
 			static $seed = '';
2229 2229
 		else
2230 2230
 			$seed = get_transient('random_seed');
2231
-		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
2231
+		$rnd_value = md5(uniqid(microtime().mt_rand(), true).$seed);
2232 2232
 		$rnd_value .= sha1($rnd_value);
2233
-		$rnd_value .= sha1($rnd_value . $seed);
2234
-		$seed = md5($seed . $rnd_value);
2235
-		if ( ! defined( 'WP_SETUP_CONFIG' ) && ! defined( 'WP_INSTALLING' ) ) {
2236
-			set_transient( 'random_seed', $seed );
2233
+		$rnd_value .= sha1($rnd_value.$seed);
2234
+		$seed = md5($seed.$rnd_value);
2235
+		if ( ! defined('WP_SETUP_CONFIG') && ! defined('WP_INSTALLING')) {
2236
+			set_transient('random_seed', $seed);
2237 2237
 		}
2238 2238
 	}
2239 2239
 
@@ -2246,14 +2246,14 @@  discard block
 block discarded – undo
2246 2246
 	$value = abs(hexdec($value));
2247 2247
 
2248 2248
 	// Reduce the value to be within the min - max range
2249
-	if ( $max != 0 )
2250
-		$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2249
+	if ($max != 0)
2250
+		$value = $min + ($max - $min + 1) * $value / ($max_random_number + 1);
2251 2251
 
2252 2252
 	return abs(intval($value));
2253 2253
 }
2254 2254
 endif;
2255 2255
 
2256
-if ( !function_exists('wp_set_password') ) :
2256
+if ( ! function_exists('wp_set_password')) :
2257 2257
 /**
2258 2258
  * Updates the user's password with a new encrypted one.
2259 2259
  *
@@ -2271,17 +2271,17 @@  discard block
 block discarded – undo
2271 2271
  * @param string $password The plaintext new user password
2272 2272
  * @param int    $user_id  User ID
2273 2273
  */
2274
-function wp_set_password( $password, $user_id ) {
2274
+function wp_set_password($password, $user_id) {
2275 2275
 	global $wpdb;
2276 2276
 
2277
-	$hash = wp_hash_password( $password );
2278
-	$wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) );
2277
+	$hash = wp_hash_password($password);
2278
+	$wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id));
2279 2279
 
2280 2280
 	wp_cache_delete($user_id, 'users');
2281 2281
 }
2282 2282
 endif;
2283 2283
 
2284
-if ( !function_exists( 'get_avatar' ) ) :
2284
+if ( ! function_exists('get_avatar')) :
2285 2285
 /**
2286 2286
  * Retrieve the avatar `<img>` tag for a user, email address, MD5 hash, comment, or post.
2287 2287
  *
@@ -2316,15 +2316,15 @@  discard block
 block discarded – undo
2316 2316
  * }
2317 2317
  * @return false|string `<img>` tag for the user's avatar. False on failure.
2318 2318
  */
2319
-function get_avatar( $id_or_email, $size = 96, $default = '', $alt = '', $args = null ) {
2319
+function get_avatar($id_or_email, $size = 96, $default = '', $alt = '', $args = null) {
2320 2320
 	$defaults = array(
2321 2321
 		// get_avatar_data() args.
2322 2322
 		'size'          => 96,
2323 2323
 		'height'        => null,
2324 2324
 		'width'         => null,
2325
-		'default'       => get_option( 'avatar_default', 'mystery' ),
2325
+		'default'       => get_option('avatar_default', 'mystery'),
2326 2326
 		'force_default' => false,
2327
-		'rating'        => get_option( 'avatar_rating' ),
2327
+		'rating'        => get_option('avatar_rating'),
2328 2328
 		'scheme'        => null,
2329 2329
 		'alt'           => '',
2330 2330
 		'class'         => null,
@@ -2332,7 +2332,7 @@  discard block
 block discarded – undo
2332 2332
 		'extra_attr'    => '',
2333 2333
 	);
2334 2334
 
2335
-	if ( empty( $args ) ) {
2335
+	if (empty($args)) {
2336 2336
 		$args = array();
2337 2337
 	}
2338 2338
 
@@ -2340,17 +2340,17 @@  discard block
 block discarded – undo
2340 2340
 	$args['default'] = $default;
2341 2341
 	$args['alt']     = $alt;
2342 2342
 
2343
-	$args = wp_parse_args( $args, $defaults );
2343
+	$args = wp_parse_args($args, $defaults);
2344 2344
 
2345
-	if ( empty( $args['height'] ) ) {
2345
+	if (empty($args['height'])) {
2346 2346
 		$args['height'] = $args['size'];
2347 2347
 	}
2348
-	if ( empty( $args['width'] ) ) {
2348
+	if (empty($args['width'])) {
2349 2349
 		$args['width'] = $args['size'];
2350 2350
 	}
2351 2351
 
2352
-	if ( is_object( $id_or_email ) && isset( $id_or_email->comment_ID ) ) {
2353
-		$id_or_email = get_comment( $id_or_email );
2352
+	if (is_object($id_or_email) && isset($id_or_email->comment_ID)) {
2353
+		$id_or_email = get_comment($id_or_email);
2354 2354
 	}
2355 2355
 
2356 2356
 	/**
@@ -2366,36 +2366,36 @@  discard block
 block discarded – undo
2366 2366
 	 *                            user email, WP_User object, WP_Post object, or WP_Comment object.
2367 2367
 	 * @param array  $args        Arguments passed to get_avatar_url(), after processing.
2368 2368
 	 */
2369
-	$avatar = apply_filters( 'pre_get_avatar', null, $id_or_email, $args );
2369
+	$avatar = apply_filters('pre_get_avatar', null, $id_or_email, $args);
2370 2370
 
2371
-	if ( ! is_null( $avatar ) ) {
2371
+	if ( ! is_null($avatar)) {
2372 2372
 		/** This filter is documented in wp-includes/pluggable.php */
2373
-		return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
2373
+		return apply_filters('get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
2374 2374
 	}
2375 2375
 
2376
-	if ( ! $args['force_display'] && ! get_option( 'show_avatars' ) ) {
2376
+	if ( ! $args['force_display'] && ! get_option('show_avatars')) {
2377 2377
 		return false;
2378 2378
 	}
2379 2379
 
2380
-	$url2x = get_avatar_url( $id_or_email, array_merge( $args, array( 'size' => $args['size'] * 2 ) ) );
2380
+	$url2x = get_avatar_url($id_or_email, array_merge($args, array('size' => $args['size'] * 2)));
2381 2381
 
2382
-	$args = get_avatar_data( $id_or_email, $args );
2382
+	$args = get_avatar_data($id_or_email, $args);
2383 2383
 
2384 2384
 	$url = $args['url'];
2385 2385
 
2386
-	if ( ! $url || is_wp_error( $url ) ) {
2386
+	if ( ! $url || is_wp_error($url)) {
2387 2387
 		return false;
2388 2388
 	}
2389 2389
 
2390
-	$class = array( 'avatar', 'avatar-' . (int) $args['size'], 'photo' );
2390
+	$class = array('avatar', 'avatar-'.(int) $args['size'], 'photo');
2391 2391
 
2392
-	if ( ! $args['found_avatar'] || $args['force_default'] ) {
2392
+	if ( ! $args['found_avatar'] || $args['force_default']) {
2393 2393
 		$class[] = 'avatar-default';
2394 2394
 	}
2395 2395
 
2396
-	if ( $args['class'] ) {
2397
-		if ( is_array( $args['class'] ) ) {
2398
-			$class = array_merge( $class, $args['class'] );
2396
+	if ($args['class']) {
2397
+		if (is_array($args['class'])) {
2398
+			$class = array_merge($class, $args['class']);
2399 2399
 		} else {
2400 2400
 			$class[] = $args['class'];
2401 2401
 		}
@@ -2403,10 +2403,10 @@  discard block
 block discarded – undo
2403 2403
 
2404 2404
 	$avatar = sprintf(
2405 2405
 		"<img alt='%s' src='%s' srcset='%s' class='%s' height='%d' width='%d' %s/>",
2406
-		esc_attr( $args['alt'] ),
2407
-		esc_url( $url ),
2408
-		esc_attr( "$url2x 2x" ),
2409
-		esc_attr( join( ' ', $class ) ),
2406
+		esc_attr($args['alt']),
2407
+		esc_url($url),
2408
+		esc_attr("$url2x 2x"),
2409
+		esc_attr(join(' ', $class)),
2410 2410
 		(int) $args['height'],
2411 2411
 		(int) $args['width'],
2412 2412
 		$args['extra_attr']
@@ -2428,11 +2428,11 @@  discard block
 block discarded – undo
2428 2428
 	 * @param string $alt         Alternative text to use in the avatar image tag. Default empty.
2429 2429
 	 * @param array  $args        Arguments passed to get_avatar_data(), after processing.
2430 2430
 	 */
2431
-	return apply_filters( 'get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args );
2431
+	return apply_filters('get_avatar', $avatar, $id_or_email, $args['size'], $args['default'], $args['alt'], $args);
2432 2432
 }
2433 2433
 endif;
2434 2434
 
2435
-if ( !function_exists( 'wp_text_diff' ) ) :
2435
+if ( ! function_exists('wp_text_diff')) :
2436 2436
 /**
2437 2437
  * Displays a human readable HTML representation of the difference between two strings.
2438 2438
  *
@@ -2460,12 +2460,12 @@  discard block
 block discarded – undo
2460 2460
  * @param string|array $args         Optional. Change 'title', 'title_left', and 'title_right' defaults.
2461 2461
  * @return string Empty string if strings are equivalent or HTML with differences.
2462 2462
  */
2463
-function wp_text_diff( $left_string, $right_string, $args = null ) {
2464
-	$defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
2465
-	$args = wp_parse_args( $args, $defaults );
2463
+function wp_text_diff($left_string, $right_string, $args = null) {
2464
+	$defaults = array('title' => '', 'title_left' => '', 'title_right' => '');
2465
+	$args = wp_parse_args($args, $defaults);
2466 2466
 
2467
-	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) )
2468
-		require( ABSPATH . WPINC . '/wp-diff.php' );
2467
+	if ( ! class_exists('WP_Text_Diff_Renderer_Table', false))
2468
+		require(ABSPATH.WPINC.'/wp-diff.php');
2469 2469
 
2470 2470
 	$left_string  = normalize_whitespace($left_string);
2471 2471
 	$right_string = normalize_whitespace($right_string);
@@ -2473,31 +2473,31 @@  discard block
 block discarded – undo
2473 2473
 	$left_lines  = explode("\n", $left_string);
2474 2474
 	$right_lines = explode("\n", $right_string);
2475 2475
 	$text_diff = new Text_Diff($left_lines, $right_lines);
2476
-	$renderer  = new WP_Text_Diff_Renderer_Table( $args );
2476
+	$renderer  = new WP_Text_Diff_Renderer_Table($args);
2477 2477
 	$diff = $renderer->render($text_diff);
2478 2478
 
2479
-	if ( !$diff )
2479
+	if ( ! $diff)
2480 2480
 		return '';
2481 2481
 
2482
-	$r  = "<table class='diff'>\n";
2482
+	$r = "<table class='diff'>\n";
2483 2483
 
2484
-	if ( ! empty( $args[ 'show_split_view' ] ) ) {
2484
+	if ( ! empty($args['show_split_view'])) {
2485 2485
 		$r .= "<col class='content diffsplit left' /><col class='content diffsplit middle' /><col class='content diffsplit right' />";
2486 2486
 	} else {
2487 2487
 		$r .= "<col class='content' />";
2488 2488
 	}
2489 2489
 
2490
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2490
+	if ($args['title'] || $args['title_left'] || $args['title_right'])
2491 2491
 		$r .= "<thead>";
2492
-	if ( $args['title'] )
2492
+	if ($args['title'])
2493 2493
 		$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2494
-	if ( $args['title_left'] || $args['title_right'] ) {
2494
+	if ($args['title_left'] || $args['title_right']) {
2495 2495
 		$r .= "<tr class='diff-sub-title'>\n";
2496 2496
 		$r .= "\t<td></td><th>$args[title_left]</th>\n";
2497 2497
 		$r .= "\t<td></td><th>$args[title_right]</th>\n";
2498 2498
 		$r .= "</tr>\n";
2499 2499
 	}
2500
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2500
+	if ($args['title'] || $args['title_left'] || $args['title_right'])
2501 2501
 		$r .= "</thead>\n";
2502 2502
 
2503 2503
 	$r .= "<tbody>\n$diff\n</tbody>\n";
Please login to merge, or discard this patch.
Braces   +101 added lines, -69 removed lines patch added patch discarded remove patch
@@ -98,8 +98,9 @@  discard block
 block discarded – undo
98 98
 function get_user_by( $field, $value ) {
99 99
 	$userdata = WP_User::get_data_by( $field, $value );
100 100
 
101
-	if ( !$userdata )
102
-		return false;
101
+	if ( !$userdata ) {
102
+			return false;
103
+	}
103 104
 
104 105
 	$user = new WP_User;
105 106
 	$user->init( $userdata );
@@ -123,8 +124,9 @@  discard block
 block discarded – undo
123 124
 
124 125
 	$clean = _get_non_cached_ids( $user_ids, 'users' );
125 126
 
126
-	if ( empty( $clean ) )
127
-		return;
127
+	if ( empty( $clean ) ) {
128
+			return;
129
+	}
128 130
 
129 131
 	$list = implode( ',', $clean );
130 132
 
@@ -315,8 +317,9 @@  discard block
 block discarded – undo
315 317
 
316 318
 	// From email and name
317 319
 	// If we don't have a name from the input headers
318
-	if ( !isset( $from_name ) )
319
-		$from_name = 'WordPress';
320
+	if ( !isset( $from_name ) ) {
321
+			$from_name = 'WordPress';
322
+	}
320 323
 
321 324
 	/* If we don't have an email from the input headers default to wordpress@$sitename
322 325
 	 * Some hosts will block outgoing mail from this address if it doesn't exist but
@@ -414,8 +417,9 @@  discard block
 block discarded – undo
414 417
 
415 418
 	// Set Content-Type and charset
416 419
 	// If we don't have a content-type from the input headers
417
-	if ( !isset( $content_type ) )
418
-		$content_type = 'text/plain';
420
+	if ( !isset( $content_type ) ) {
421
+			$content_type = 'text/plain';
422
+	}
419 423
 
420 424
 	/**
421 425
 	 * Filters the wp_mail() content type.
@@ -429,12 +433,14 @@  discard block
 block discarded – undo
429 433
 	$phpmailer->ContentType = $content_type;
430 434
 
431 435
 	// Set whether it's plaintext, depending on $content_type
432
-	if ( 'text/html' == $content_type )
433
-		$phpmailer->IsHTML( true );
436
+	if ( 'text/html' == $content_type ) {
437
+			$phpmailer->IsHTML( true );
438
+	}
434 439
 
435 440
 	// If we don't have a charset from the input headers
436
-	if ( !isset( $charset ) )
437
-		$charset = get_bloginfo( 'charset' );
441
+	if ( !isset( $charset ) ) {
442
+			$charset = get_bloginfo( 'charset' );
443
+	}
438 444
 
439 445
 	// Set the content-type and charset
440 446
 
@@ -453,8 +459,9 @@  discard block
 block discarded – undo
453 459
 			$phpmailer->AddCustomHeader( sprintf( '%1$s: %2$s', $name, $content ) );
454 460
 		}
455 461
 
456
-		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) )
457
-			$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
462
+		if ( false !== stripos( $content_type, 'multipart' ) && ! empty($boundary) ) {
463
+					$phpmailer->AddCustomHeader( sprintf( "Content-Type: %s;\n\t boundary=\"%s\"", $content_type, $boundary ) );
464
+		}
458 465
 	}
459 466
 
460 467
 	if ( !empty( $attachments ) ) {
@@ -769,8 +776,9 @@  discard block
 block discarded – undo
769 776
 				}
770 777
 	    }
771 778
 
772
-		if ( empty($_COOKIE[$cookie_name]) )
773
-			return false;
779
+		if ( empty($_COOKIE[$cookie_name]) ) {
780
+					return false;
781
+		}
774 782
 		$cookie = $_COOKIE[$cookie_name];
775 783
 	}
776 784
 
@@ -903,9 +911,10 @@  discard block
 block discarded – undo
903 911
 	setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
904 912
 	setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true);
905 913
 	setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
906
-	if ( COOKIEPATH != SITECOOKIEPATH )
907
-		setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
908
-}
914
+	if ( COOKIEPATH != SITECOOKIEPATH ) {
915
+			setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true);
916
+	}
917
+	}
909 918
 endif;
910 919
 
911 920
 if ( !function_exists('wp_clear_auth_cookie') ) :
@@ -1049,8 +1058,9 @@  discard block
 block discarded – undo
1049 1058
  *                   0-12 hours ago, 2 if the nonce is valid and generated between 12-24 hours ago.
1050 1059
  */
1051 1060
 function check_admin_referer( $action = -1, $query_arg = '_wpnonce' ) {
1052
-	if ( -1 == $action )
1053
-		_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
1061
+	if ( -1 == $action ) {
1062
+			_doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2.0' );
1063
+	}
1054 1064
 
1055 1065
 	$adminurl = strtolower(admin_url());
1056 1066
 	$referer = strtolower(wp_get_referer());
@@ -1098,12 +1108,13 @@  discard block
 block discarded – undo
1098 1108
 
1099 1109
 	$nonce = '';
1100 1110
 
1101
-	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) )
1102
-		$nonce = $_REQUEST[ $query_arg ];
1103
-	elseif ( isset( $_REQUEST['_ajax_nonce'] ) )
1104
-		$nonce = $_REQUEST['_ajax_nonce'];
1105
-	elseif ( isset( $_REQUEST['_wpnonce'] ) )
1106
-		$nonce = $_REQUEST['_wpnonce'];
1111
+	if ( $query_arg && isset( $_REQUEST[ $query_arg ] ) ) {
1112
+			$nonce = $_REQUEST[ $query_arg ];
1113
+	} elseif ( isset( $_REQUEST['_ajax_nonce'] ) ) {
1114
+			$nonce = $_REQUEST['_ajax_nonce'];
1115
+	} elseif ( isset( $_REQUEST['_wpnonce'] ) ) {
1116
+			$nonce = $_REQUEST['_wpnonce'];
1117
+	}
1107 1118
 
1108 1119
 	$result = wp_verify_nonce( $nonce, $action );
1109 1120
 
@@ -1178,13 +1189,16 @@  discard block
 block discarded – undo
1178 1189
 	 */
1179 1190
 	$status = apply_filters( 'wp_redirect_status', $status, $location );
1180 1191
 
1181
-	if ( ! $location )
1182
-		return false;
1192
+	if ( ! $location ) {
1193
+			return false;
1194
+	}
1183 1195
 
1184 1196
 	$location = wp_sanitize_redirect($location);
1185 1197
 
1186
-	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' )
1187
-		status_header($status); // This causes problems on IIS and some FastCGI setups
1198
+	if ( !$is_IIS && PHP_SAPI != 'cgi-fcgi' ) {
1199
+			status_header($status);
1200
+	}
1201
+	// This causes problems on IIS and some FastCGI setups
1188 1202
 
1189 1203
 	header("Location: $location", true, $status);
1190 1204
 
@@ -1295,8 +1309,9 @@  discard block
 block discarded – undo
1295 1309
 function wp_validate_redirect($location, $default = '') {
1296 1310
 	$location = trim( $location );
1297 1311
 	// browsers will assume 'http' is your protocol, and will obey a redirect to a URL starting with '//'
1298
-	if ( substr($location, 0, 2) == '//' )
1299
-		$location = 'http:' . $location;
1312
+	if ( substr($location, 0, 2) == '//' ) {
1313
+			$location = 'http:' . $location;
1314
+	}
1300 1315
 
1301 1316
 	// In php 5 parse_url may fail if the URL query part contains http://, bug #38143
1302 1317
 	$test = ( $cut = strpos($location, '?') ) ? substr( $location, 0, $cut ) : $location;
@@ -1305,12 +1320,14 @@  discard block
 block discarded – undo
1305 1320
 	$lp = @parse_url($test);
1306 1321
 
1307 1322
 	// Give up if malformed URL
1308
-	if ( false === $lp )
1309
-		return $default;
1323
+	if ( false === $lp ) {
1324
+			return $default;
1325
+	}
1310 1326
 
1311 1327
 	// Allow only http and https schemes. No data:, etc.
1312
-	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) )
1313
-		return $default;
1328
+	if ( isset($lp['scheme']) && !('http' == $lp['scheme'] || 'https' == $lp['scheme']) ) {
1329
+			return $default;
1330
+	}
1314 1331
 
1315 1332
 	// Reject if certain components are set but host is not. This catches urls like https:host.com for which parse_url does not set the host field.
1316 1333
 	if ( ! isset( $lp['host'] ) && ( isset( $lp['scheme'] ) || isset( $lp['user'] ) || isset( $lp['pass'] ) || isset( $lp['port'] ) ) ) {
@@ -1336,8 +1353,9 @@  discard block
 block discarded – undo
1336 1353
 	 */
1337 1354
 	$allowed_hosts = (array) apply_filters( 'allowed_redirect_hosts', array($wpp['host']), isset($lp['host']) ? $lp['host'] : '' );
1338 1355
 
1339
-	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) )
1340
-		$location = $default;
1356
+	if ( isset($lp['host']) && ( !in_array($lp['host'], $allowed_hosts) && $lp['host'] != strtolower($wpp['host'])) ) {
1357
+			$location = $default;
1358
+	}
1341 1359
 
1342 1360
 	return $location;
1343 1361
 }
@@ -1359,8 +1377,9 @@  discard block
 block discarded – undo
1359 1377
 	}
1360 1378
 
1361 1379
 	$comment = get_comment( $comment_id );
1362
-	if ( empty( $comment ) || empty( $comment->comment_post_ID ) )
1363
-		return false;
1380
+	if ( empty( $comment ) || empty( $comment->comment_post_ID ) ) {
1381
+			return false;
1382
+	}
1364 1383
 
1365 1384
 	$post    = get_post( $comment->comment_post_ID );
1366 1385
 	$author  = get_userdata( $post->post_author );
@@ -1489,19 +1508,22 @@  discard block
 block discarded – undo
1489 1508
 
1490 1509
 	if ( '' == $comment->comment_author ) {
1491 1510
 		$from = "From: \"$blogname\" <$wp_email>";
1492
-		if ( '' != $comment->comment_author_email )
1493
-			$reply_to = "Reply-To: $comment->comment_author_email";
1511
+		if ( '' != $comment->comment_author_email ) {
1512
+					$reply_to = "Reply-To: $comment->comment_author_email";
1513
+		}
1494 1514
 	} else {
1495 1515
 		$from = "From: \"$comment->comment_author\" <$wp_email>";
1496
-		if ( '' != $comment->comment_author_email )
1497
-			$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1516
+		if ( '' != $comment->comment_author_email ) {
1517
+					$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
1518
+		}
1498 1519
 	}
1499 1520
 
1500 1521
 	$message_headers = "$from\n"
1501 1522
 		. "Content-Type: text/plain; charset=\"" . get_option('blog_charset') . "\"\n";
1502 1523
 
1503
-	if ( isset($reply_to) )
1504
-		$message_headers .= $reply_to . "\n";
1524
+	if ( isset($reply_to) ) {
1525
+			$message_headers .= $reply_to . "\n";
1526
+	}
1505 1527
 
1506 1528
 	/**
1507 1529
 	 * Filters the comment notification email text.
@@ -1584,8 +1606,9 @@  discard block
 block discarded – undo
1584 1606
 	// Send to the administration and to the post author if the author can modify the comment.
1585 1607
 	$emails = array( get_option( 'admin_email' ) );
1586 1608
 	if ( $user && user_can( $user->ID, 'edit_comment', $comment_id ) && ! empty( $user->user_email ) ) {
1587
-		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) )
1588
-			$emails[] = $user->user_email;
1609
+		if ( 0 !== strcasecmp( $user->user_email, get_option( 'admin_email' ) ) ) {
1610
+					$emails[] = $user->user_email;
1611
+		}
1589 1612
 	}
1590 1613
 
1591 1614
 	$switched_locale = switch_to_locale( get_locale() );
@@ -2154,10 +2177,12 @@  discard block
 block discarded – undo
2154 2177
  */
2155 2178
 function wp_generate_password( $length = 12, $special_chars = true, $extra_special_chars = false ) {
2156 2179
 	$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
2157
-	if ( $special_chars )
2158
-		$chars .= '!@#$%^&*()';
2159
-	if ( $extra_special_chars )
2160
-		$chars .= '-_ []{}<>~`+=,.;:/?|';
2180
+	if ( $special_chars ) {
2181
+			$chars .= '!@#$%^&*()';
2182
+	}
2183
+	if ( $extra_special_chars ) {
2184
+			$chars .= '-_ []{}<>~`+=,.;:/?|';
2185
+	}
2161 2186
 
2162 2187
 	$password = '';
2163 2188
 	for ( $i = 0; $i < $length; $i++ ) {
@@ -2224,10 +2249,11 @@  discard block
 block discarded – undo
2224 2249
 	// Reset $rnd_value after 14 uses
2225 2250
 	// 32(md5) + 40(sha1) + 40(sha1) / 8 = 14 random numbers from $rnd_value
2226 2251
 	if ( strlen($rnd_value) < 8 ) {
2227
-		if ( defined( 'WP_SETUP_CONFIG' ) )
2228
-			static $seed = '';
2229
-		else
2230
-			$seed = get_transient('random_seed');
2252
+		if ( defined( 'WP_SETUP_CONFIG' ) ) {
2253
+					static $seed = '';
2254
+		} else {
2255
+					$seed = get_transient('random_seed');
2256
+		}
2231 2257
 		$rnd_value = md5( uniqid(microtime() . mt_rand(), true ) . $seed );
2232 2258
 		$rnd_value .= sha1($rnd_value);
2233 2259
 		$rnd_value .= sha1($rnd_value . $seed);
@@ -2246,8 +2272,9 @@  discard block
 block discarded – undo
2246 2272
 	$value = abs(hexdec($value));
2247 2273
 
2248 2274
 	// Reduce the value to be within the min - max range
2249
-	if ( $max != 0 )
2250
-		$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2275
+	if ( $max != 0 ) {
2276
+			$value = $min + ( $max - $min + 1 ) * $value / ( $max_random_number + 1 );
2277
+	}
2251 2278
 
2252 2279
 	return abs(intval($value));
2253 2280
 }
@@ -2464,8 +2491,9 @@  discard block
 block discarded – undo
2464 2491
 	$defaults = array( 'title' => '', 'title_left' => '', 'title_right' => '' );
2465 2492
 	$args = wp_parse_args( $args, $defaults );
2466 2493
 
2467
-	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) )
2468
-		require( ABSPATH . WPINC . '/wp-diff.php' );
2494
+	if ( ! class_exists( 'WP_Text_Diff_Renderer_Table', false ) ) {
2495
+			require( ABSPATH . WPINC . '/wp-diff.php' );
2496
+	}
2469 2497
 
2470 2498
 	$left_string  = normalize_whitespace($left_string);
2471 2499
 	$right_string = normalize_whitespace($right_string);
@@ -2476,8 +2504,9 @@  discard block
 block discarded – undo
2476 2504
 	$renderer  = new WP_Text_Diff_Renderer_Table( $args );
2477 2505
 	$diff = $renderer->render($text_diff);
2478 2506
 
2479
-	if ( !$diff )
2480
-		return '';
2507
+	if ( !$diff ) {
2508
+			return '';
2509
+	}
2481 2510
 
2482 2511
 	$r  = "<table class='diff'>\n";
2483 2512
 
@@ -2487,18 +2516,21 @@  discard block
 block discarded – undo
2487 2516
 		$r .= "<col class='content' />";
2488 2517
 	}
2489 2518
 
2490
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2491
-		$r .= "<thead>";
2492
-	if ( $args['title'] )
2493
-		$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2519
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
2520
+			$r .= "<thead>";
2521
+	}
2522
+	if ( $args['title'] ) {
2523
+			$r .= "<tr class='diff-title'><th colspan='4'>$args[title]</th></tr>\n";
2524
+	}
2494 2525
 	if ( $args['title_left'] || $args['title_right'] ) {
2495 2526
 		$r .= "<tr class='diff-sub-title'>\n";
2496 2527
 		$r .= "\t<td></td><th>$args[title_left]</th>\n";
2497 2528
 		$r .= "\t<td></td><th>$args[title_right]</th>\n";
2498 2529
 		$r .= "</tr>\n";
2499 2530
 	}
2500
-	if ( $args['title'] || $args['title_left'] || $args['title_right'] )
2501
-		$r .= "</thead>\n";
2531
+	if ( $args['title'] || $args['title_left'] || $args['title_right'] ) {
2532
+			$r .= "</thead>\n";
2533
+	}
2502 2534
 
2503 2535
 	$r .= "<tbody>\n$diff\n</tbody>\n";
2504 2536
 	$r .= "</table>";
Please login to merge, or discard this patch.
src/wp-includes/plugin.php 3 patches
Doc Comments   +4 added lines, -7 removed lines patch added patch discarded remove patch
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
  *                                  and functions with the same priority are executed
99 99
  *                                  in the order in which they were added to the action.
100 100
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
101
- * @return true
101
+ * @return boolean
102 102
  */
103 103
 function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
104 104
 	global $wp_filter, $merged_filters;
@@ -193,7 +193,6 @@  discard block
 block discarded – undo
193 193
  *
194 194
  * @param string $tag     The name of the filter hook.
195 195
  * @param mixed  $value   The value on which the filters hooked to `$tag` are applied on.
196
- * @param mixed  $var,... Additional variables passed to the functions hooked to `$tag`.
197 196
  * @return mixed The filtered value after all hooked functions are applied to it.
198 197
  */
199 198
 function apply_filters( $tag, $value ) {
@@ -347,7 +346,7 @@  discard block
 block discarded – undo
347 346
  *
348 347
  * @param string   $tag      The filter to remove hooks from.
349 348
  * @param int|bool $priority Optional. The priority number to remove. Default false.
350
- * @return true True when finished.
349
+ * @return boolean True when finished.
351 350
  */
352 351
 function remove_all_filters( $tag, $priority = false ) {
353 352
 	global $wp_filter, $merged_filters;
@@ -452,7 +451,7 @@  discard block
 block discarded – undo
452 451
  *                                  and functions with the same priority are executed
453 452
  *                                  in the order in which they were added to the action.
454 453
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
455
- * @return true Will always return true.
454
+ * @return boolean Will always return true.
456 455
  */
457 456
 function add_action($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
458 457
 	return add_filter($tag, $function_to_add, $priority, $accepted_args);
@@ -476,8 +475,6 @@  discard block
 block discarded – undo
476 475
  * @global array $wp_current_filter Stores the list of current filters with the current one last
477 476
  *
478 477
  * @param string $tag     The name of the action to be executed.
479
- * @param mixed  $arg,... Optional. Additional arguments which are passed on to the
480
- *                        functions hooked to the action. Default empty.
481 478
  */
482 479
 function do_action($tag, $arg = '') {
483 480
 	global $wp_filter, $wp_actions, $merged_filters, $wp_current_filter;
@@ -650,7 +647,7 @@  discard block
 block discarded – undo
650 647
  *
651 648
  * @param string   $tag      The action to remove hooks from.
652 649
  * @param int|bool $priority The priority number to remove them from. Default false.
653
- * @return true True when finished.
650
+ * @return boolean True when finished.
654 651
  */
655 652
 function remove_all_actions($tag, $priority = false) {
656 653
 	return remove_all_filters($tag, $priority);
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
  */
23 23
 
24 24
 // Initialize the filter globals.
25
-require( dirname( __FILE__ ) . '/class-wp-hook.php' );
25
+require(dirname(__FILE__).'/class-wp-hook.php');
26 26
 
27 27
 /** @var WP_Hook[] $wp_filter */
28 28
 global $wp_filter, $wp_actions, $wp_current_filter;
29 29
 
30
-if ( $wp_filter ) {
31
-	$wp_filter = WP_Hook::build_preinitialized_hooks( $wp_filter );
30
+if ($wp_filter) {
31
+	$wp_filter = WP_Hook::build_preinitialized_hooks($wp_filter);
32 32
 } else {
33 33
 	$wp_filter = array();
34 34
 }
35 35
 
36
-if ( ! isset( $wp_actions ) )
36
+if ( ! isset($wp_actions))
37 37
 	$wp_actions = array();
38 38
 
39
-if ( ! isset( $wp_current_filter ) )
39
+if ( ! isset($wp_current_filter))
40 40
 	$wp_current_filter = array();
41 41
 
42 42
 /**
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
  * @param int      $accepted_args   Optional. The number of arguments the function accepts. Default 1.
104 104
  * @return true
105 105
  */
106
-function add_filter( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {
106
+function add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1) {
107 107
 	global $wp_filter;
108
-	if ( ! isset( $wp_filter[ $tag ] ) ) {
109
-		$wp_filter[ $tag ] = new WP_Hook();
108
+	if ( ! isset($wp_filter[$tag])) {
109
+		$wp_filter[$tag] = new WP_Hook();
110 110
 	}
111
-	$wp_filter[ $tag ]->add_filter( $tag, $function_to_add, $priority, $accepted_args );
111
+	$wp_filter[$tag]->add_filter($tag, $function_to_add, $priority, $accepted_args);
112 112
 	return true;
113 113
 }
114 114
 
@@ -131,11 +131,11 @@  discard block
 block discarded – undo
131 131
 function has_filter($tag, $function_to_check = false) {
132 132
 	global $wp_filter;
133 133
 
134
-	if ( ! isset( $wp_filter[ $tag ] ) ) {
134
+	if ( ! isset($wp_filter[$tag])) {
135 135
 		return false;
136 136
 	}
137 137
 
138
-	return $wp_filter[ $tag ]->has_filter( $tag, $function_to_check );
138
+	return $wp_filter[$tag]->has_filter($tag, $function_to_check);
139 139
 }
140 140
 
141 141
 /**
@@ -173,36 +173,36 @@  discard block
 block discarded – undo
173 173
  * @param mixed  $var,... Additional variables passed to the functions hooked to `$tag`.
174 174
  * @return mixed The filtered value after all hooked functions are applied to it.
175 175
  */
176
-function apply_filters( $tag, $value ) {
176
+function apply_filters($tag, $value) {
177 177
 	global $wp_filter, $wp_current_filter;
178 178
 
179 179
 	$args = array();
180 180
 
181 181
 	// Do 'all' actions first.
182
-	if ( isset($wp_filter['all']) ) {
182
+	if (isset($wp_filter['all'])) {
183 183
 		$wp_current_filter[] = $tag;
184 184
 		$args = func_get_args();
185 185
 		_wp_call_all_hook($args);
186 186
 	}
187 187
 
188
-	if ( !isset($wp_filter[$tag]) ) {
189
-		if ( isset($wp_filter['all']) )
188
+	if ( ! isset($wp_filter[$tag])) {
189
+		if (isset($wp_filter['all']))
190 190
 			array_pop($wp_current_filter);
191 191
 		return $value;
192 192
 	}
193 193
 
194
-	if ( !isset($wp_filter['all']) )
194
+	if ( ! isset($wp_filter['all']))
195 195
 		$wp_current_filter[] = $tag;
196 196
 
197
-	if ( empty($args) )
197
+	if (empty($args))
198 198
 		$args = func_get_args();
199 199
 
200 200
 	// don't pass the tag name to WP_Hook
201
-	array_shift( $args );
201
+	array_shift($args);
202 202
 
203
-	$filtered = $wp_filter[ $tag ]->apply_filters( $value, $args );
203
+	$filtered = $wp_filter[$tag]->apply_filters($value, $args);
204 204
 
205
-	array_pop( $wp_current_filter );
205
+	array_pop($wp_current_filter);
206 206
 
207 207
 	return $filtered;
208 208
 }
@@ -226,24 +226,24 @@  discard block
 block discarded – undo
226 226
 	global $wp_filter, $wp_current_filter;
227 227
 
228 228
 	// Do 'all' actions first
229
-	if ( isset($wp_filter['all']) ) {
229
+	if (isset($wp_filter['all'])) {
230 230
 		$wp_current_filter[] = $tag;
231 231
 		$all_args = func_get_args();
232 232
 		_wp_call_all_hook($all_args);
233 233
 	}
234 234
 
235
-	if ( !isset($wp_filter[$tag]) ) {
236
-		if ( isset($wp_filter['all']) )
235
+	if ( ! isset($wp_filter[$tag])) {
236
+		if (isset($wp_filter['all']))
237 237
 			array_pop($wp_current_filter);
238 238
 		return $args[0];
239 239
 	}
240 240
 
241
-	if ( !isset($wp_filter['all']) )
241
+	if ( ! isset($wp_filter['all']))
242 242
 		$wp_current_filter[] = $tag;
243 243
 
244
-	$filtered = $wp_filter[ $tag ]->apply_filters( $args[0], $args );
244
+	$filtered = $wp_filter[$tag]->apply_filters($args[0], $args);
245 245
 
246
-	array_pop( $wp_current_filter );
246
+	array_pop($wp_current_filter);
247 247
 
248 248
 	return $filtered;
249 249
 }
@@ -268,14 +268,14 @@  discard block
 block discarded – undo
268 268
  * @param int      $priority           Optional. The priority of the function. Default 10.
269 269
  * @return bool    Whether the function existed before it was removed.
270 270
  */
271
-function remove_filter( $tag, $function_to_remove, $priority = 10 ) {
271
+function remove_filter($tag, $function_to_remove, $priority = 10) {
272 272
 	global $wp_filter;
273 273
 
274 274
 	$r = false;
275
-	if ( isset( $wp_filter[ $tag ] ) ) {
276
-		$r = $wp_filter[ $tag ]->remove_filter( $tag, $function_to_remove, $priority );
277
-		if ( ! $wp_filter[ $tag ]->callbacks ) {
278
-			unset( $wp_filter[ $tag ] );
275
+	if (isset($wp_filter[$tag])) {
276
+		$r = $wp_filter[$tag]->remove_filter($tag, $function_to_remove, $priority);
277
+		if ( ! $wp_filter[$tag]->callbacks) {
278
+			unset($wp_filter[$tag]);
279 279
 		}
280 280
 	}
281 281
 
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
  * @param int|bool $priority Optional. The priority number to remove. Default false.
294 294
  * @return true True when finished.
295 295
  */
296
-function remove_all_filters( $tag, $priority = false ) {
296
+function remove_all_filters($tag, $priority = false) {
297 297
 	global $wp_filter;
298 298
 
299
-	if ( isset( $wp_filter[ $tag ]) ) {
300
-		$wp_filter[ $tag ]->remove_all_filters( $priority );
301
-		if ( ! $wp_filter[ $tag ]->has_filters() ) {
302
-			unset( $wp_filter[ $tag ] );
299
+	if (isset($wp_filter[$tag])) {
300
+		$wp_filter[$tag]->remove_all_filters($priority);
301
+		if ( ! $wp_filter[$tag]->has_filters()) {
302
+			unset($wp_filter[$tag]);
303 303
 		}
304 304
 	}
305 305
 
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
  */
318 318
 function current_filter() {
319 319
 	global $wp_current_filter;
320
-	return end( $wp_current_filter );
320
+	return end($wp_current_filter);
321 321
 }
322 322
 
323 323
 /**
@@ -352,14 +352,14 @@  discard block
 block discarded – undo
352 352
  *                            checks if any filter is currently being run.
353 353
  * @return bool Whether the filter is currently in the stack.
354 354
  */
355
-function doing_filter( $filter = null ) {
355
+function doing_filter($filter = null) {
356 356
 	global $wp_current_filter;
357 357
 
358
-	if ( null === $filter ) {
359
-		return ! empty( $wp_current_filter );
358
+	if (null === $filter) {
359
+		return ! empty($wp_current_filter);
360 360
 	}
361 361
 
362
-	return in_array( $filter, $wp_current_filter );
362
+	return in_array($filter, $wp_current_filter);
363 363
 }
364 364
 
365 365
 /**
@@ -371,8 +371,8 @@  discard block
 block discarded – undo
371 371
  *                            if any action is currently being run.
372 372
  * @return bool Whether the action is currently in the stack.
373 373
  */
374
-function doing_action( $action = null ) {
375
-	return doing_filter( $action );
374
+function doing_action($action = null) {
375
+	return doing_filter($action);
376 376
 }
377 377
 
378 378
 /**
@@ -421,36 +421,36 @@  discard block
 block discarded – undo
421 421
 function do_action($tag, $arg = '') {
422 422
 	global $wp_filter, $wp_actions, $wp_current_filter;
423 423
 
424
-	if ( ! isset($wp_actions[$tag]) )
424
+	if ( ! isset($wp_actions[$tag]))
425 425
 		$wp_actions[$tag] = 1;
426 426
 	else
427 427
 		++$wp_actions[$tag];
428 428
 
429 429
 	// Do 'all' actions first
430
-	if ( isset($wp_filter['all']) ) {
430
+	if (isset($wp_filter['all'])) {
431 431
 		$wp_current_filter[] = $tag;
432 432
 		$all_args = func_get_args();
433 433
 		_wp_call_all_hook($all_args);
434 434
 	}
435 435
 
436
-	if ( !isset($wp_filter[$tag]) ) {
437
-		if ( isset($wp_filter['all']) )
436
+	if ( ! isset($wp_filter[$tag])) {
437
+		if (isset($wp_filter['all']))
438 438
 			array_pop($wp_current_filter);
439 439
 		return;
440 440
 	}
441 441
 
442
-	if ( !isset($wp_filter['all']) )
442
+	if ( ! isset($wp_filter['all']))
443 443
 		$wp_current_filter[] = $tag;
444 444
 
445 445
 	$args = array();
446
-	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
447
-		$args[] =& $arg[0];
446
+	if (is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0])) // array(&$this)
447
+		$args[] = & $arg[0];
448 448
 	else
449 449
 		$args[] = $arg;
450
-	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ )
450
+	for ($a = 2, $num = func_num_args(); $a < $num; $a++)
451 451
 		$args[] = func_get_arg($a);
452 452
 
453
-	$wp_filter[ $tag ]->do_action( $args );
453
+	$wp_filter[$tag]->do_action($args);
454 454
 
455 455
 	array_pop($wp_current_filter);
456 456
 }
@@ -468,7 +468,7 @@  discard block
 block discarded – undo
468 468
 function did_action($tag) {
469 469
 	global $wp_actions;
470 470
 
471
-	if ( ! isset( $wp_actions[ $tag ] ) )
471
+	if ( ! isset($wp_actions[$tag]))
472 472
 		return 0;
473 473
 
474 474
 	return $wp_actions[$tag];
@@ -491,28 +491,28 @@  discard block
 block discarded – undo
491 491
 function do_action_ref_array($tag, $args) {
492 492
 	global $wp_filter, $wp_actions, $wp_current_filter;
493 493
 
494
-	if ( ! isset($wp_actions[$tag]) )
494
+	if ( ! isset($wp_actions[$tag]))
495 495
 		$wp_actions[$tag] = 1;
496 496
 	else
497 497
 		++$wp_actions[$tag];
498 498
 
499 499
 	// Do 'all' actions first
500
-	if ( isset($wp_filter['all']) ) {
500
+	if (isset($wp_filter['all'])) {
501 501
 		$wp_current_filter[] = $tag;
502 502
 		$all_args = func_get_args();
503 503
 		_wp_call_all_hook($all_args);
504 504
 	}
505 505
 
506
-	if ( !isset($wp_filter[$tag]) ) {
507
-		if ( isset($wp_filter['all']) )
506
+	if ( ! isset($wp_filter[$tag])) {
507
+		if (isset($wp_filter['all']))
508 508
 			array_pop($wp_current_filter);
509 509
 		return;
510 510
 	}
511 511
 
512
-	if ( !isset($wp_filter['all']) )
512
+	if ( ! isset($wp_filter['all']))
513 513
 		$wp_current_filter[] = $tag;
514 514
 
515
-	$wp_filter[ $tag ]->do_action( $args );
515
+	$wp_filter[$tag]->do_action($args);
516 516
 
517 517
 	array_pop($wp_current_filter);
518 518
 }
@@ -551,8 +551,8 @@  discard block
 block discarded – undo
551 551
  * @param int      $priority           Optional. The priority of the function. Default 10.
552 552
  * @return bool Whether the function is removed.
553 553
  */
554
-function remove_action( $tag, $function_to_remove, $priority = 10 ) {
555
-	return remove_filter( $tag, $function_to_remove, $priority );
554
+function remove_action($tag, $function_to_remove, $priority = 10) {
555
+	return remove_filter($tag, $function_to_remove, $priority);
556 556
 }
557 557
 
558 558
 /**
@@ -585,14 +585,14 @@  discard block
 block discarded – undo
585 585
  * @param string $replacement Optional. The hook that should have been used. Default false.
586 586
  * @param string $message     Optional. A message regarding the change. Default null.
587 587
  */
588
-function apply_filters_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
589
-	if ( ! has_filter( $tag ) ) {
588
+function apply_filters_deprecated($tag, $args, $version, $replacement = false, $message = null) {
589
+	if ( ! has_filter($tag)) {
590 590
 		return $args[0];
591 591
 	}
592 592
 
593
-	_deprecated_hook( $tag, $version, $replacement, $message );
593
+	_deprecated_hook($tag, $version, $replacement, $message);
594 594
 
595
-	return apply_filters_ref_array( $tag, $args );
595
+	return apply_filters_ref_array($tag, $args);
596 596
 }
597 597
 
598 598
 /**
@@ -612,14 +612,14 @@  discard block
 block discarded – undo
612 612
  * @param string $replacement Optional. The hook that should have been used.
613 613
  * @param string $message     Optional. A message regarding the change.
614 614
  */
615
-function do_action_deprecated( $tag, $args, $version, $replacement = false, $message = null ) {
616
-	if ( ! has_action( $tag ) ) {
615
+function do_action_deprecated($tag, $args, $version, $replacement = false, $message = null) {
616
+	if ( ! has_action($tag)) {
617 617
 		return;
618 618
 	}
619 619
 
620
-	_deprecated_hook( $tag, $version, $replacement, $message );
620
+	_deprecated_hook($tag, $version, $replacement, $message);
621 621
 
622
-	do_action_ref_array( $tag, $args );
622
+	do_action_ref_array($tag, $args);
623 623
 }
624 624
 
625 625
 //
@@ -638,23 +638,23 @@  discard block
 block discarded – undo
638 638
  * @param string $file The filename of plugin.
639 639
  * @return string The name of a plugin.
640 640
  */
641
-function plugin_basename( $file ) {
641
+function plugin_basename($file) {
642 642
 	global $wp_plugin_paths;
643 643
 
644 644
 	// $wp_plugin_paths contains normalized paths.
645
-	$file = wp_normalize_path( $file );
645
+	$file = wp_normalize_path($file);
646 646
 
647
-	arsort( $wp_plugin_paths );
648
-	foreach ( $wp_plugin_paths as $dir => $realdir ) {
649
-		if ( strpos( $file, $realdir ) === 0 ) {
650
-			$file = $dir . substr( $file, strlen( $realdir ) );
647
+	arsort($wp_plugin_paths);
648
+	foreach ($wp_plugin_paths as $dir => $realdir) {
649
+		if (strpos($file, $realdir) === 0) {
650
+			$file = $dir.substr($file, strlen($realdir));
651 651
 		}
652 652
 	}
653 653
 
654
-	$plugin_dir = wp_normalize_path( WP_PLUGIN_DIR );
655
-	$mu_plugin_dir = wp_normalize_path( WPMU_PLUGIN_DIR );
654
+	$plugin_dir = wp_normalize_path(WP_PLUGIN_DIR);
655
+	$mu_plugin_dir = wp_normalize_path(WPMU_PLUGIN_DIR);
656 656
 
657
-	$file = preg_replace('#^' . preg_quote($plugin_dir, '#') . '/|^' . preg_quote($mu_plugin_dir, '#') . '/#','',$file); // get relative path from plugins dir
657
+	$file = preg_replace('#^'.preg_quote($plugin_dir, '#').'/|^'.preg_quote($mu_plugin_dir, '#').'/#', '', $file); // get relative path from plugins dir
658 658
 	$file = trim($file, '/');
659 659
 	return $file;
660 660
 }
@@ -676,25 +676,25 @@  discard block
 block discarded – undo
676 676
  * @param string $file Known path to the file.
677 677
  * @return bool Whether the path was able to be registered.
678 678
  */
679
-function wp_register_plugin_realpath( $file ) {
679
+function wp_register_plugin_realpath($file) {
680 680
 	global $wp_plugin_paths;
681 681
 
682 682
 	// Normalize, but store as static to avoid recalculation of a constant value
683 683
 	static $wp_plugin_path = null, $wpmu_plugin_path = null;
684
-	if ( ! isset( $wp_plugin_path ) ) {
685
-		$wp_plugin_path   = wp_normalize_path( WP_PLUGIN_DIR   );
686
-		$wpmu_plugin_path = wp_normalize_path( WPMU_PLUGIN_DIR );
684
+	if ( ! isset($wp_plugin_path)) {
685
+		$wp_plugin_path   = wp_normalize_path(WP_PLUGIN_DIR);
686
+		$wpmu_plugin_path = wp_normalize_path(WPMU_PLUGIN_DIR);
687 687
 	}
688 688
 
689
-	$plugin_path = wp_normalize_path( dirname( $file ) );
690
-	$plugin_realpath = wp_normalize_path( dirname( realpath( $file ) ) );
689
+	$plugin_path = wp_normalize_path(dirname($file));
690
+	$plugin_realpath = wp_normalize_path(dirname(realpath($file)));
691 691
 
692
-	if ( $plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path ) {
692
+	if ($plugin_path === $wp_plugin_path || $plugin_path === $wpmu_plugin_path) {
693 693
 		return false;
694 694
 	}
695 695
 
696
-	if ( $plugin_path !== $plugin_realpath ) {
697
-		$wp_plugin_paths[ $plugin_path ] = $plugin_realpath;
696
+	if ($plugin_path !== $plugin_realpath) {
697
+		$wp_plugin_paths[$plugin_path] = $plugin_realpath;
698 698
 	}
699 699
 
700 700
 	return true;
@@ -708,8 +708,8 @@  discard block
 block discarded – undo
708 708
  * @param string $file The filename of the plugin (__FILE__).
709 709
  * @return string the filesystem path of the directory that contains the plugin.
710 710
  */
711
-function plugin_dir_path( $file ) {
712
-	return trailingslashit( dirname( $file ) );
711
+function plugin_dir_path($file) {
712
+	return trailingslashit(dirname($file));
713 713
 }
714 714
 
715 715
 /**
@@ -720,8 +720,8 @@  discard block
 block discarded – undo
720 720
  * @param string $file The filename of the plugin (__FILE__).
721 721
  * @return string the URL path of the directory that contains the plugin.
722 722
  */
723
-function plugin_dir_url( $file ) {
724
-	return trailingslashit( plugins_url( '', $file ) );
723
+function plugin_dir_url($file) {
724
+	return trailingslashit(plugins_url('', $file));
725 725
 }
726 726
 
727 727
 /**
@@ -744,7 +744,7 @@  discard block
 block discarded – undo
744 744
  */
745 745
 function register_activation_hook($file, $function) {
746 746
 	$file = plugin_basename($file);
747
-	add_action('activate_' . $file, $function);
747
+	add_action('activate_'.$file, $function);
748 748
 }
749 749
 
750 750
 /**
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
  */
768 768
 function register_deactivation_hook($file, $function) {
769 769
 	$file = plugin_basename($file);
770
-	add_action('deactivate_' . $file, $function);
770
+	add_action('deactivate_'.$file, $function);
771 771
 }
772 772
 
773 773
 /**
@@ -796,9 +796,9 @@  discard block
 block discarded – undo
796 796
  * @param callable $callback The callback to run when the hook is called. Must be
797 797
  *                           a static method or function.
798 798
  */
799
-function register_uninstall_hook( $file, $callback ) {
800
-	if ( is_array( $callback ) && is_object( $callback[0] ) ) {
801
-		_doing_it_wrong( __FUNCTION__, __( 'Only a static class method or function can be used in an uninstall hook.' ), '3.1.0' );
799
+function register_uninstall_hook($file, $callback) {
800
+	if (is_array($callback) && is_object($callback[0])) {
801
+		_doing_it_wrong(__FUNCTION__, __('Only a static class method or function can be used in an uninstall hook.'), '3.1.0');
802 802
 		return;
803 803
 	}
804 804
 
@@ -834,7 +834,7 @@  discard block
 block discarded – undo
834 834
 function _wp_call_all_hook($args) {
835 835
 	global $wp_filter;
836 836
 
837
-	$wp_filter['all']->do_all_hook( $args );
837
+	$wp_filter['all']->do_all_hook($args);
838 838
 }
839 839
 
840 840
 /**
@@ -875,26 +875,26 @@  discard block
 block discarded – undo
875 875
 	global $wp_filter;
876 876
 	static $filter_id_count = 0;
877 877
 
878
-	if ( is_string($function) )
878
+	if (is_string($function))
879 879
 		return $function;
880 880
 
881
-	if ( is_object($function) ) {
881
+	if (is_object($function)) {
882 882
 		// Closures are currently implemented as objects
883
-		$function = array( $function, '' );
883
+		$function = array($function, '');
884 884
 	} else {
885 885
 		$function = (array) $function;
886 886
 	}
887 887
 
888
-	if (is_object($function[0]) ) {
888
+	if (is_object($function[0])) {
889 889
 		// Object Class Calling
890
-		if ( function_exists('spl_object_hash') ) {
891
-			return spl_object_hash($function[0]) . $function[1];
890
+		if (function_exists('spl_object_hash')) {
891
+			return spl_object_hash($function[0]).$function[1];
892 892
 		} else {
893 893
 			$obj_idx = get_class($function[0]).$function[1];
894
-			if ( !isset($function[0]->wp_filter_id) ) {
895
-				if ( false === $priority )
894
+			if ( ! isset($function[0]->wp_filter_id)) {
895
+				if (false === $priority)
896 896
 					return false;
897
-				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
897
+				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array) $wp_filter[$tag][$priority]) : $filter_id_count;
898 898
 				$function[0]->wp_filter_id = $filter_id_count;
899 899
 				++$filter_id_count;
900 900
 			} else {
@@ -903,8 +903,8 @@  discard block
 block discarded – undo
903 903
 
904 904
 			return $obj_idx;
905 905
 		}
906
-	} elseif ( is_string( $function[0] ) ) {
906
+	} elseif (is_string($function[0])) {
907 907
 		// Static Calling
908
-		return $function[0] . '::' . $function[1];
908
+		return $function[0].'::'.$function[1];
909 909
 	}
910 910
 }
Please login to merge, or discard this patch.
Braces   +58 added lines, -39 removed lines patch added patch discarded remove patch
@@ -33,11 +33,13 @@  discard block
 block discarded – undo
33 33
 	$wp_filter = array();
34 34
 }
35 35
 
36
-if ( ! isset( $wp_actions ) )
36
+if ( ! isset( $wp_actions ) ) {
37 37
 	$wp_actions = array();
38
+}
38 39
 
39
-if ( ! isset( $wp_current_filter ) )
40
+if ( ! isset( $wp_current_filter ) ) {
40 41
 	$wp_current_filter = array();
42
+}
41 43
 
42 44
 /**
43 45
  * Hook a function or method to a specific filter action.
@@ -186,16 +188,19 @@  discard block
 block discarded – undo
186 188
 	}
187 189
 
188 190
 	if ( !isset($wp_filter[$tag]) ) {
189
-		if ( isset($wp_filter['all']) )
190
-			array_pop($wp_current_filter);
191
+		if ( isset($wp_filter['all']) ) {
192
+					array_pop($wp_current_filter);
193
+		}
191 194
 		return $value;
192 195
 	}
193 196
 
194
-	if ( !isset($wp_filter['all']) )
195
-		$wp_current_filter[] = $tag;
197
+	if ( !isset($wp_filter['all']) ) {
198
+			$wp_current_filter[] = $tag;
199
+	}
196 200
 
197
-	if ( empty($args) )
198
-		$args = func_get_args();
201
+	if ( empty($args) ) {
202
+			$args = func_get_args();
203
+	}
199 204
 
200 205
 	// don't pass the tag name to WP_Hook
201 206
 	array_shift( $args );
@@ -233,13 +238,15 @@  discard block
 block discarded – undo
233 238
 	}
234 239
 
235 240
 	if ( !isset($wp_filter[$tag]) ) {
236
-		if ( isset($wp_filter['all']) )
237
-			array_pop($wp_current_filter);
241
+		if ( isset($wp_filter['all']) ) {
242
+					array_pop($wp_current_filter);
243
+		}
238 244
 		return $args[0];
239 245
 	}
240 246
 
241
-	if ( !isset($wp_filter['all']) )
242
-		$wp_current_filter[] = $tag;
247
+	if ( !isset($wp_filter['all']) ) {
248
+			$wp_current_filter[] = $tag;
249
+	}
243 250
 
244 251
 	$filtered = $wp_filter[ $tag ]->apply_filters( $args[0], $args );
245 252
 
@@ -421,10 +428,11 @@  discard block
 block discarded – undo
421 428
 function do_action($tag, $arg = '') {
422 429
 	global $wp_filter, $wp_actions, $wp_current_filter;
423 430
 
424
-	if ( ! isset($wp_actions[$tag]) )
425
-		$wp_actions[$tag] = 1;
426
-	else
427
-		++$wp_actions[$tag];
431
+	if ( ! isset($wp_actions[$tag]) ) {
432
+			$wp_actions[$tag] = 1;
433
+	} else {
434
+			++$wp_actions[$tag];
435
+	}
428 436
 
429 437
 	// Do 'all' actions first
430 438
 	if ( isset($wp_filter['all']) ) {
@@ -434,21 +442,26 @@  discard block
 block discarded – undo
434 442
 	}
435 443
 
436 444
 	if ( !isset($wp_filter[$tag]) ) {
437
-		if ( isset($wp_filter['all']) )
438
-			array_pop($wp_current_filter);
445
+		if ( isset($wp_filter['all']) ) {
446
+					array_pop($wp_current_filter);
447
+		}
439 448
 		return;
440 449
 	}
441 450
 
442
-	if ( !isset($wp_filter['all']) )
443
-		$wp_current_filter[] = $tag;
451
+	if ( !isset($wp_filter['all']) ) {
452
+			$wp_current_filter[] = $tag;
453
+	}
444 454
 
445 455
 	$args = array();
446
-	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)
456
+	if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) {
457
+		// array(&$this)
447 458
 		$args[] =& $arg[0];
448
-	else
449
-		$args[] = $arg;
450
-	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ )
451
-		$args[] = func_get_arg($a);
459
+	} else {
460
+			$args[] = $arg;
461
+	}
462
+	for ( $a = 2, $num = func_num_args(); $a < $num; $a++ ) {
463
+			$args[] = func_get_arg($a);
464
+	}
452 465
 
453 466
 	$wp_filter[ $tag ]->do_action( $args );
454 467
 
@@ -468,8 +481,9 @@  discard block
 block discarded – undo
468 481
 function did_action($tag) {
469 482
 	global $wp_actions;
470 483
 
471
-	if ( ! isset( $wp_actions[ $tag ] ) )
472
-		return 0;
484
+	if ( ! isset( $wp_actions[ $tag ] ) ) {
485
+			return 0;
486
+	}
473 487
 
474 488
 	return $wp_actions[$tag];
475 489
 }
@@ -491,10 +505,11 @@  discard block
 block discarded – undo
491 505
 function do_action_ref_array($tag, $args) {
492 506
 	global $wp_filter, $wp_actions, $wp_current_filter;
493 507
 
494
-	if ( ! isset($wp_actions[$tag]) )
495
-		$wp_actions[$tag] = 1;
496
-	else
497
-		++$wp_actions[$tag];
508
+	if ( ! isset($wp_actions[$tag]) ) {
509
+			$wp_actions[$tag] = 1;
510
+	} else {
511
+			++$wp_actions[$tag];
512
+	}
498 513
 
499 514
 	// Do 'all' actions first
500 515
 	if ( isset($wp_filter['all']) ) {
@@ -504,13 +519,15 @@  discard block
 block discarded – undo
504 519
 	}
505 520
 
506 521
 	if ( !isset($wp_filter[$tag]) ) {
507
-		if ( isset($wp_filter['all']) )
508
-			array_pop($wp_current_filter);
522
+		if ( isset($wp_filter['all']) ) {
523
+					array_pop($wp_current_filter);
524
+		}
509 525
 		return;
510 526
 	}
511 527
 
512
-	if ( !isset($wp_filter['all']) )
513
-		$wp_current_filter[] = $tag;
528
+	if ( !isset($wp_filter['all']) ) {
529
+			$wp_current_filter[] = $tag;
530
+	}
514 531
 
515 532
 	$wp_filter[ $tag ]->do_action( $args );
516 533
 
@@ -875,8 +892,9 @@  discard block
 block discarded – undo
875 892
 	global $wp_filter;
876 893
 	static $filter_id_count = 0;
877 894
 
878
-	if ( is_string($function) )
879
-		return $function;
895
+	if ( is_string($function) ) {
896
+			return $function;
897
+	}
880 898
 
881 899
 	if ( is_object($function) ) {
882 900
 		// Closures are currently implemented as objects
@@ -892,8 +910,9 @@  discard block
 block discarded – undo
892 910
 		} else {
893 911
 			$obj_idx = get_class($function[0]).$function[1];
894 912
 			if ( !isset($function[0]->wp_filter_id) ) {
895
-				if ( false === $priority )
896
-					return false;
913
+				if ( false === $priority ) {
914
+									return false;
915
+				}
897 916
 				$obj_idx .= isset($wp_filter[$tag][$priority]) ? count((array)$wp_filter[$tag][$priority]) : $filter_id_count;
898 917
 				$function[0]->wp_filter_id = $filter_id_count;
899 918
 				++$filter_id_count;
Please login to merge, or discard this patch.
src/wp-includes/pomo/po.php 3 patches
Doc Comments   +7 added lines, -2 removed lines patch added patch discarded remove patch
@@ -87,6 +87,7 @@  discard block
 block discarded – undo
87 87
 	 * Text to include as a comment before the start of the PO contents
88 88
 	 *
89 89
 	 * Doesn't need to include # in the beginning of lines, these are added automatically
90
+	 * @param string $text
90 91
 	 */
91 92
 	function set_comment_before_headers( $text ) {
92 93
 		$this->comments_before_headers = $text;
@@ -196,6 +197,7 @@  discard block
 block discarded – undo
196 197
 	 *
197 198
 	 * @static
198 199
 	 * @param Translation_Entry &$entry the entry to convert to po string
200
+	 * @param Translation_Entry $entry
199 201
 	 * @return false|string PO-style formatted string for the entry or
200 202
 	 * 	false if the entry is empty
201 203
 	 */
@@ -223,6 +225,9 @@  discard block
 block discarded – undo
223 225
 		return implode("\n", $po);
224 226
 	}
225 227
 
228
+	/**
229
+	 * @return string
230
+	 */
226 231
 	public static function match_begin_and_end_newlines( $translation, $original ) {
227 232
 		if ( '' === $translation ) {
228 233
 			return $translation;
@@ -395,7 +400,7 @@  discard block
 block discarded – undo
395 400
 	 *
396 401
 	 * @param     resource $f
397 402
 	 * @param     string   $action
398
-	 * @return boolean
403
+	 * @return boolean|string
399 404
 	 */
400 405
 	function read_line($f, $action = 'read') {
401 406
 		static $last_line = '';
@@ -435,7 +440,7 @@  discard block
 block discarded – undo
435 440
 
436 441
 	/**
437 442
 	 * @param string $s
438
-	 * @return sring
443
+	 * @return string
439 444
 	 */
440 445
 	public static function trim_quotes($s) {
441 446
 		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
7 7
  * @subpackage po
8 8
  */
9 9
 
10
-require_once dirname(__FILE__) . '/translations.php';
10
+require_once dirname(__FILE__).'/translations.php';
11 11
 
12
-if ( ! defined( 'PO_MAX_LINE_LEN' ) ) {
12
+if ( ! defined('PO_MAX_LINE_LEN')) {
13 13
 	define('PO_MAX_LINE_LEN', 79);
14 14
 }
15 15
 
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 /**
19 19
  * Routines for working with PO files
20 20
  */
21
-if ( ! class_exists( 'PO', false ) ):
21
+if ( ! class_exists('PO', false)):
22 22
 class PO extends Gettext_Translations {
23 23
 
24 24
 	var $comments_before_headers = '';
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 	 */
31 31
 	function export_headers() {
32 32
 		$header_string = '';
33
-		foreach($this->headers as $header => $value) {
34
-			$header_string.= "$header: $value\n";
33
+		foreach ($this->headers as $header => $value) {
34
+			$header_string .= "$header: $value\n";
35 35
 		}
36 36
 		$poified = PO::poify($header_string);
37 37
 		if ($this->comments_before_headers)
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
 	 *
89 89
 	 * Doesn't need to include # in the beginning of lines, these are added automatically
90 90
 	 */
91
-	function set_comment_before_headers( $text ) {
91
+	function set_comment_before_headers($text) {
92 92
 		$this->comments_before_headers = $text;
93 93
 	}
94 94
 
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 		$po = $quote.implode("${slash}n$quote$newline$quote", explode($newline, $string)).$quote;
116 116
 		// add empty string on first line for readbility
117 117
 		if (false !== strpos($string, $newline) &&
118
-				(substr_count($string, $newline) > 1 || !($newline === substr($string, -strlen($newline))))) {
118
+				(substr_count($string, $newline) > 1 || ! ($newline === substr($string, -strlen($newline))))) {
119 119
 			$po = "$quote$quote$newline$po";
120 120
 		}
121 121
 		// remove empty strings
@@ -136,24 +136,24 @@  discard block
 block discarded – undo
136 136
 		$lines = array_map(array('PO', 'trim_quotes'), $lines);
137 137
 		$unpoified = '';
138 138
 		$previous_is_backslash = false;
139
-		foreach($lines as $line) {
139
+		foreach ($lines as $line) {
140 140
 			preg_match_all('/./u', $line, $chars);
141 141
 			$chars = $chars[0];
142
-			foreach($chars as $char) {
143
-				if (!$previous_is_backslash) {
142
+			foreach ($chars as $char) {
143
+				if ( ! $previous_is_backslash) {
144 144
 					if ('\\' == $char)
145 145
 						$previous_is_backslash = true;
146 146
 					else
147 147
 						$unpoified .= $char;
148 148
 				} else {
149 149
 					$previous_is_backslash = false;
150
-					$unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
150
+					$unpoified .= isset($escapes[$char]) ? $escapes[$char] : $char;
151 151
 				}
152 152
 			}
153 153
 		}
154 154
 
155 155
 		// Standardise the line endings on imported content, technically PO files shouldn't contain \r
156
-		$unpoified = str_replace( array( "\r\n", "\r" ), "\n", $unpoified );
156
+		$unpoified = str_replace(array("\r\n", "\r"), "\n", $unpoified);
157 157
 
158 158
 		return $unpoified;
159 159
 	}
@@ -177,10 +177,10 @@  discard block
 block discarded – undo
177 177
 			$append = "\n";
178 178
 		}
179 179
 		foreach ($lines as &$line) {
180
-			$line = $with . $line;
180
+			$line = $with.$line;
181 181
 		}
182 182
 		unset($line);
183
-		return implode("\n", $lines) . $append;
183
+		return implode("\n", $lines).$append;
184 184
 	}
185 185
 
186 186
 	/**
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 	 * @param string $char character to denote a special PO comment,
193 193
 	 * 	like :, default is a space
194 194
 	 */
195
-	public static function comment_block($text, $char=' ') {
195
+	public static function comment_block($text, $char = ' ') {
196 196
 		$text = wordwrap($text, PO_MAX_LINE_LEN - 3);
197 197
 		return PO::prepend_each_line($text, "#$char ");
198 198
 	}
@@ -206,53 +206,53 @@  discard block
 block discarded – undo
206 206
 	 * 	false if the entry is empty
207 207
 	 */
208 208
 	public static function export_entry(&$entry) {
209
-		if ( null === $entry->singular || '' === $entry->singular ) return false;
209
+		if (null === $entry->singular || '' === $entry->singular) return false;
210 210
 		$po = array();
211
-		if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
212
-		if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
213
-		if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
214
-		if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
211
+		if ( ! empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
212
+		if ( ! empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
213
+		if ( ! empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
214
+		if ( ! empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
215 215
 		if ($entry->context) $po[] = 'msgctxt '.PO::poify($entry->context);
216 216
 		$po[] = 'msgid '.PO::poify($entry->singular);
217
-		if (!$entry->is_plural) {
218
-			$translation = empty($entry->translations)? '' : $entry->translations[0];
219
-			$translation = PO::match_begin_and_end_newlines( $translation, $entry->singular );
217
+		if ( ! $entry->is_plural) {
218
+			$translation = empty($entry->translations) ? '' : $entry->translations[0];
219
+			$translation = PO::match_begin_and_end_newlines($translation, $entry->singular);
220 220
 			$po[] = 'msgstr '.PO::poify($translation);
221 221
 		} else {
222 222
 			$po[] = 'msgid_plural '.PO::poify($entry->plural);
223
-			$translations = empty($entry->translations)? array('', '') : $entry->translations;
224
-			foreach($translations as $i => $translation) {
225
-				$translation = PO::match_begin_and_end_newlines( $translation, $entry->plural );
223
+			$translations = empty($entry->translations) ? array('', '') : $entry->translations;
224
+			foreach ($translations as $i => $translation) {
225
+				$translation = PO::match_begin_and_end_newlines($translation, $entry->plural);
226 226
 				$po[] = "msgstr[$i] ".PO::poify($translation);
227 227
 			}
228 228
 		}
229 229
 		return implode("\n", $po);
230 230
 	}
231 231
 
232
-	public static function match_begin_and_end_newlines( $translation, $original ) {
233
-		if ( '' === $translation ) {
232
+	public static function match_begin_and_end_newlines($translation, $original) {
233
+		if ('' === $translation) {
234 234
 			return $translation;
235 235
 		}
236 236
 
237
-		$original_begin = "\n" === substr( $original, 0, 1 );
238
-		$original_end = "\n" === substr( $original, -1 );
239
-		$translation_begin = "\n" === substr( $translation, 0, 1 );
240
-		$translation_end = "\n" === substr( $translation, -1 );
237
+		$original_begin = "\n" === substr($original, 0, 1);
238
+		$original_end = "\n" === substr($original, -1);
239
+		$translation_begin = "\n" === substr($translation, 0, 1);
240
+		$translation_end = "\n" === substr($translation, -1);
241 241
 
242
-		if ( $original_begin ) {
243
-			if ( ! $translation_begin ) {
244
-				$translation = "\n" . $translation;
242
+		if ($original_begin) {
243
+			if ( ! $translation_begin) {
244
+				$translation = "\n".$translation;
245 245
 			}
246
-		} elseif ( $translation_begin ) {
247
-			$translation = ltrim( $translation, "\n" );
246
+		} elseif ($translation_begin) {
247
+			$translation = ltrim($translation, "\n");
248 248
 		}
249 249
 
250
-		if ( $original_end ) {
251
-			if ( ! $translation_end ) {
250
+		if ($original_end) {
251
+			if ( ! $translation_end) {
252 252
 				$translation .= "\n";
253 253
 			}
254
-		} elseif ( $translation_end ) {
255
-			$translation = rtrim( $translation, "\n" );
254
+		} elseif ($translation_end) {
255
+			$translation = rtrim($translation, "\n");
256 256
 		}
257 257
 
258 258
 		return $translation;
@@ -264,11 +264,11 @@  discard block
 block discarded – undo
264 264
 	 */
265 265
 	function import_from_file($filename) {
266 266
 		$f = fopen($filename, 'r');
267
-		if (!$f) return false;
267
+		if ( ! $f) return false;
268 268
 		$lineno = 0;
269 269
 		while (true) {
270 270
 			$res = $this->read_entry($f, $lineno);
271
-			if (!$res) break;
271
+			if ( ! $res) break;
272 272
 			if ($res['entry']->singular == '') {
273 273
 				$this->set_headers($this->make_headers($res['entry']->translations[0]));
274 274
 			} else {
@@ -276,10 +276,10 @@  discard block
 block discarded – undo
276 276
 			}
277 277
 		}
278 278
 		PO::read_line($f, 'clear');
279
-		if ( false === $res ) {
279
+		if (false === $res) {
280 280
 			return false;
281 281
 		}
282
-		if ( ! $this->headers && ! $this->entries ) {
282
+		if ( ! $this->headers && ! $this->entries) {
283 283
 			return false;
284 284
 		}
285 285
 		return true;
@@ -308,11 +308,11 @@  discard block
 block discarded – undo
308 308
 		while (true) {
309 309
 			$lineno++;
310 310
 			$line = PO::read_line($f);
311
-			if (!$line)  {
311
+			if ( ! $line) {
312 312
 				if (feof($f)) {
313 313
 					if (self::is_final($context))
314 314
 						break;
315
-					elseif (!$context) // we haven't read a line and eof came
315
+					elseif ( ! $context) // we haven't read a line and eof came
316 316
 						return null;
317 317
 					else
318 318
 						return false;
@@ -399,13 +399,13 @@  discard block
 block discarded – undo
399 399
 		}
400 400
 
401 401
 		$have_translations = false;
402
-		foreach ( $entry->translations as $t ) {
403
-			if ( $t || ('0' === $t) ) {
402
+		foreach ($entry->translations as $t) {
403
+			if ($t || ('0' === $t)) {
404 404
 				$have_translations = true;
405 405
 				break;
406 406
 			}
407 407
 		}
408
-		if ( false === $have_translations ) {
408
+		if (false === $have_translations) {
409 409
 			$entry->translations = array();
410 410
 		}
411 411
 
@@ -431,8 +431,8 @@  discard block
 block discarded – undo
431 431
 			$use_last_line = true;
432 432
 			return true;
433 433
 		}
434
-		$line = $use_last_line? $last_line : fgets($f);
435
-		$line = ( "\r\n" == substr( $line, -2 ) ) ? rtrim( $line, "\r\n" ) . "\n" : $line;
434
+		$line = $use_last_line ? $last_line : fgets($f);
435
+		$line = ("\r\n" == substr($line, -2)) ? rtrim($line, "\r\n")."\n" : $line;
436 436
 		$last_line = $line;
437 437
 		$use_last_line = false;
438 438
 		return $line;
@@ -448,11 +448,11 @@  discard block
 block discarded – undo
448 448
 		if ('#:' == $first_two) {
449 449
 			$entry->references = array_merge($entry->references, preg_split('/\s+/', $comment));
450 450
 		} elseif ('#.' == $first_two) {
451
-			$entry->extracted_comments = trim($entry->extracted_comments . "\n" . $comment);
451
+			$entry->extracted_comments = trim($entry->extracted_comments."\n".$comment);
452 452
 		} elseif ('#,' == $first_two) {
453 453
 			$entry->flags = array_merge($entry->flags, preg_split('/,\s*/', $comment));
454 454
 		} else {
455
-			$entry->translator_comments = trim($entry->translator_comments . "\n" . $comment);
455
+			$entry->translator_comments = trim($entry->translator_comments."\n".$comment);
456 456
 		}
457 457
 	}
458 458
 
@@ -461,8 +461,8 @@  discard block
 block discarded – undo
461 461
 	 * @return sring
462 462
 	 */
463 463
 	public static function trim_quotes($s) {
464
-		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
465
-		if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
464
+		if (substr($s, 0, 1) == '"') $s = substr($s, 1);
465
+		if (substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
466 466
 		return $s;
467 467
 	}
468 468
 }
Please login to merge, or discard this patch.
Braces   +56 added lines, -26 removed lines patch added patch discarded remove patch
@@ -34,10 +34,11 @@  discard block
 block discarded – undo
34 34
 			$header_string.= "$header: $value\n";
35 35
 		}
36 36
 		$poified = PO::poify($header_string);
37
-		if ($this->comments_before_headers)
38
-			$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
39
-		else
40
-			$before_headers = '';
37
+		if ($this->comments_before_headers) {
38
+					$before_headers = $this->prepend_each_line(rtrim($this->comments_before_headers)."\n", '# ');
39
+		} else {
40
+					$before_headers = '';
41
+		}
41 42
 		return rtrim("{$before_headers}msgid \"\"\nmsgstr $poified");
42 43
 	}
43 44
 
@@ -76,10 +77,14 @@  discard block
 block discarded – undo
76 77
 	 */
77 78
 	function export_to_file($filename, $include_headers = true) {
78 79
 		$fh = fopen($filename, 'w');
79
-		if (false === $fh) return false;
80
+		if (false === $fh) {
81
+			return false;
82
+		}
80 83
 		$export = $this->export($include_headers);
81 84
 		$res = fwrite($fh, $export);
82
-		if (false === $res) return false;
85
+		if (false === $res) {
86
+			return false;
87
+		}
83 88
 		return fclose($fh);
84 89
 	}
85 90
 
@@ -141,10 +146,11 @@  discard block
 block discarded – undo
141 146
 			$chars = $chars[0];
142 147
 			foreach($chars as $char) {
143 148
 				if (!$previous_is_backslash) {
144
-					if ('\\' == $char)
145
-						$previous_is_backslash = true;
146
-					else
147
-						$unpoified .= $char;
149
+					if ('\\' == $char) {
150
+											$previous_is_backslash = true;
151
+					} else {
152
+											$unpoified .= $char;
153
+					}
148 154
 				} else {
149 155
 					$previous_is_backslash = false;
150 156
 					$unpoified .= isset($escapes[$char])? $escapes[$char] : $char;
@@ -206,13 +212,25 @@  discard block
 block discarded – undo
206 212
 	 * 	false if the entry is empty
207 213
 	 */
208 214
 	public static function export_entry(&$entry) {
209
-		if ( null === $entry->singular || '' === $entry->singular ) return false;
215
+		if ( null === $entry->singular || '' === $entry->singular ) {
216
+			return false;
217
+		}
210 218
 		$po = array();
211
-		if (!empty($entry->translator_comments)) $po[] = PO::comment_block($entry->translator_comments);
212
-		if (!empty($entry->extracted_comments)) $po[] = PO::comment_block($entry->extracted_comments, '.');
213
-		if (!empty($entry->references)) $po[] = PO::comment_block(implode(' ', $entry->references), ':');
214
-		if (!empty($entry->flags)) $po[] = PO::comment_block(implode(", ", $entry->flags), ',');
215
-		if ($entry->context) $po[] = 'msgctxt '.PO::poify($entry->context);
219
+		if (!empty($entry->translator_comments)) {
220
+			$po[] = PO::comment_block($entry->translator_comments);
221
+		}
222
+		if (!empty($entry->extracted_comments)) {
223
+			$po[] = PO::comment_block($entry->extracted_comments, '.');
224
+		}
225
+		if (!empty($entry->references)) {
226
+			$po[] = PO::comment_block(implode(' ', $entry->references), ':');
227
+		}
228
+		if (!empty($entry->flags)) {
229
+			$po[] = PO::comment_block(implode(", ", $entry->flags), ',');
230
+		}
231
+		if ($entry->context) {
232
+			$po[] = 'msgctxt '.PO::poify($entry->context);
233
+		}
216 234
 		$po[] = 'msgid '.PO::poify($entry->singular);
217 235
 		if (!$entry->is_plural) {
218 236
 			$translation = empty($entry->translations)? '' : $entry->translations[0];
@@ -264,11 +282,15 @@  discard block
 block discarded – undo
264 282
 	 */
265 283
 	function import_from_file($filename) {
266 284
 		$f = fopen($filename, 'r');
267
-		if (!$f) return false;
285
+		if (!$f) {
286
+			return false;
287
+		}
268 288
 		$lineno = 0;
269 289
 		while (true) {
270 290
 			$res = $this->read_entry($f, $lineno);
271
-			if (!$res) break;
291
+			if (!$res) {
292
+				break;
293
+			}
272 294
 			if ($res['entry']->singular == '') {
273 295
 				$this->set_headers($this->make_headers($res['entry']->translations[0]));
274 296
 			} else {
@@ -310,17 +332,21 @@  discard block
 block discarded – undo
310 332
 			$line = PO::read_line($f);
311 333
 			if (!$line)  {
312 334
 				if (feof($f)) {
313
-					if (self::is_final($context))
314
-						break;
315
-					elseif (!$context) // we haven't read a line and eof came
335
+					if (self::is_final($context)) {
336
+											break;
337
+					} elseif (!$context) {
338
+						// we haven't read a line and eof came
316 339
 						return null;
317
-					else
318
-						return false;
340
+					} else {
341
+											return false;
342
+					}
319 343
 				} else {
320 344
 					return false;
321 345
 				}
322 346
 			}
323
-			if ($line == "\n") continue;
347
+			if ($line == "\n") {
348
+				continue;
349
+			}
324 350
 			$line = trim($line);
325 351
 			if (preg_match('/^#/', $line, $m)) {
326 352
 				// the comment is the start of a new entry
@@ -461,8 +487,12 @@  discard block
 block discarded – undo
461 487
 	 * @return sring
462 488
 	 */
463 489
 	public static function trim_quotes($s) {
464
-		if ( substr($s, 0, 1) == '"') $s = substr($s, 1);
465
-		if ( substr($s, -1, 1) == '"') $s = substr($s, 0, -1);
490
+		if ( substr($s, 0, 1) == '"') {
491
+			$s = substr($s, 1);
492
+		}
493
+		if ( substr($s, -1, 1) == '"') {
494
+			$s = substr($s, 0, -1);
495
+		}
466 496
 		return $s;
467 497
 	}
468 498
 }
Please login to merge, or discard this patch.