Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-includes/Requests/Proxy.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -29,5 +29,5 @@
 block discarded – undo
29 29
 	 * @see Requests_Hooks::register
30 30
 	 * @param Requests_Hooks $hooks Hook system
31 31
 	 */
32
-	public function register(Requests_Hooks &$hooks);
32
+	public function register(Requests_Hooks & $hooks);
33 33
 }
34 34
\ No newline at end of file
Please login to merge, or discard this patch.
src/wp-includes/customize/class-wp-customize-nav-menu-location-control.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -56,28 +56,28 @@
 block discarded – undo
56 56
 	 * @access public
57 57
 	 */
58 58
 	public function render_content() {
59
-		if ( empty( $this->choices ) ) {
59
+		if (empty($this->choices)) {
60 60
 			return;
61 61
 		}
62 62
 		?>
63 63
 		<label>
64
-			<?php if ( ! empty( $this->label ) ) : ?>
65
-			<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
64
+			<?php if ( ! empty($this->label)) : ?>
65
+			<span class="customize-control-title"><?php echo esc_html($this->label); ?></span>
66 66
 			<?php endif; ?>
67 67
 
68
-			<?php if ( ! empty( $this->description ) ) : ?>
68
+			<?php if ( ! empty($this->description)) : ?>
69 69
 			<span class="description customize-control-description"><?php echo $this->description; ?></span>
70 70
 			<?php endif; ?>
71 71
 
72 72
 			<select <?php $this->link(); ?>>
73 73
 				<?php
74
-				foreach ( $this->choices as $value => $label ) :
75
-					echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>';
74
+				foreach ($this->choices as $value => $label) :
75
+					echo '<option value="'.esc_attr($value).'"'.selected($this->value(), $value, false).'>'.$label.'</option>';
76 76
 				endforeach;
77 77
 				?>
78 78
 			</select>
79 79
 		</label>
80
-		<button type="button" class="button-link edit-menu<?php if ( ! $this->value() ) { echo ' hidden'; } ?>" aria-label="<?php esc_attr_e( 'Edit selected menu' ); ?>"><?php _e( 'Edit Menu' ); ?></button>
80
+		<button type="button" class="button-link edit-menu<?php if ( ! $this->value()) { echo ' hidden'; } ?>" aria-label="<?php esc_attr_e('Edit selected menu'); ?>"><?php _e('Edit Menu'); ?></button>
81 81
 		<?php
82 82
 	}
83 83
 }
Please login to merge, or discard this patch.
src/wp-includes/customize/class-wp-customize-nav-menu-section.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
 	 */
37 37
 	public function json() {
38 38
 		$exported = parent::json();
39
-		$exported['menu_id'] = intval( preg_replace( '/^nav_menu\[(-?\d+)\]/', '$1', $this->id ) );
39
+		$exported['menu_id'] = intval(preg_replace('/^nav_menu\[(-?\d+)\]/', '$1', $this->id));
40 40
 
41 41
 		return $exported;
42 42
 	}
Please login to merge, or discard this patch.
src/wp-includes/customize/class-wp-customize-nav-menu-auto-add-control.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -41,10 +41,10 @@
 block discarded – undo
41 41
 	 */
42 42
 	protected function content_template() {
43 43
 		?>
44
-		<span class="customize-control-title"><?php _e( 'Menu Options' ); ?></span>
44
+		<span class="customize-control-title"><?php _e('Menu Options'); ?></span>
45 45
 		<label>
46 46
 			<input type="checkbox" class="auto_add" />
47
-			<?php _e( 'Automatically add new top-level pages to this menu' ); ?>
47
+			<?php _e('Automatically add new top-level pages to this menu'); ?>
48 48
 		</label>
49 49
 		<?php
50 50
 	}
Please login to merge, or discard this patch.
src/wp-includes/customize/class-wp-customize-site-icon-control.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
 	 * @param string               $id      Control ID.
38 38
 	 * @param array                $args    Optional. Arguments to override class property defaults.
39 39
 	 */
40
-	public function __construct( $manager, $id, $args = array() ) {
41
-		parent::__construct( $manager, $id, $args );
42
-		add_action( 'customize_controls_print_styles', 'wp_site_icon', 99 );
40
+	public function __construct($manager, $id, $args = array()) {
41
+		parent::__construct($manager, $id, $args);
42
+		add_action('customize_controls_print_styles', 'wp_site_icon', 99);
43 43
 	}
44 44
 
45 45
 	/**
@@ -64,14 +64,14 @@  discard block
 block discarded – undo
64 64
 				<# if ( data.attachment.sizes ) { #>
65 65
 					<div class="site-icon-preview">
66 66
 						<div class="favicon-preview">
67
-							<img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" alt="" />
67
+							<img src="<?php echo esc_url(admin_url('images/'.(is_rtl() ? 'browser-rtl.png' : 'browser.png'))); ?>" class="browser-preview" width="182" alt="" />
68 68
 
69 69
 							<div class="favicon">
70
-								<img src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/>
70
+								<img src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e('Preview as a browser icon'); ?>"/>
71 71
 							</div>
72
-							<span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span>
72
+							<span class="browser-title" aria-hidden="true"><?php bloginfo('name'); ?></span>
73 73
 						</div>
74
-						<img class="app-icon-preview" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/>
74
+						<img class="app-icon-preview" src="{{ data.attachment.sizes.full.url }}" alt="<?php esc_attr_e('Preview as an app icon'); ?>"/>
75 75
 					</div>
76 76
 				<# } #>
77 77
 				<div class="actions">
Please login to merge, or discard this patch.
src/wp-includes/meta.php 2 patches
Braces   +84 added lines, -59 removed lines patch added patch discarded remove patch
@@ -68,13 +68,15 @@  discard block
 block discarded – undo
68 68
 	 *                              for the object. Optional. Default false.
69 69
 	 */
70 70
 	$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
71
-	if ( null !== $check )
72
-		return $check;
71
+	if ( null !== $check ) {
72
+			return $check;
73
+	}
73 74
 
74 75
 	if ( $unique && $wpdb->get_var( $wpdb->prepare(
75 76
 		"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
76
-		$meta_key, $object_id ) ) )
77
-		return false;
77
+		$meta_key, $object_id ) ) ) {
78
+			return false;
79
+	}
78 80
 
79 81
 	$_meta_value = $meta_value;
80 82
 	$meta_value = maybe_serialize( $meta_value );
@@ -99,8 +101,9 @@  discard block
 block discarded – undo
99 101
 		'meta_value' => $meta_value
100 102
 	) );
101 103
 
102
-	if ( ! $result )
103
-		return false;
104
+	if ( ! $result ) {
105
+			return false;
106
+	}
104 107
 
105 108
 	$mid = (int) $wpdb->insert_id;
106 109
 
@@ -185,15 +188,17 @@  discard block
 block discarded – undo
185 188
 	 *                              Otherwise, update all entries.
186 189
 	 */
187 190
 	$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
188
-	if ( null !== $check )
189
-		return (bool) $check;
191
+	if ( null !== $check ) {
192
+			return (bool) $check;
193
+	}
190 194
 
191 195
 	// Compare existing value to new value if no prev value given and the key exists only once.
192 196
 	if ( empty($prev_value) ) {
193 197
 		$old_value = get_metadata($meta_type, $object_id, $meta_key);
194 198
 		if ( count($old_value) == 1 ) {
195
-			if ( $old_value[0] === $meta_value )
196
-				return false;
199
+			if ( $old_value[0] === $meta_value ) {
200
+							return false;
201
+			}
197 202
 		}
198 203
 	}
199 204
 
@@ -245,8 +250,9 @@  discard block
 block discarded – undo
245 250
 	}
246 251
 
247 252
 	$result = $wpdb->update( $table, $data, $where );
248
-	if ( ! $result )
249
-		return false;
253
+	if ( ! $result ) {
254
+			return false;
255
+	}
250 256
 
251 257
 	wp_cache_delete($object_id, $meta_type . '_meta');
252 258
 
@@ -345,23 +351,27 @@  discard block
 block discarded – undo
345 351
 	 *                              Default false.
346 352
 	 */
347 353
 	$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
348
-	if ( null !== $check )
349
-		return (bool) $check;
354
+	if ( null !== $check ) {
355
+			return (bool) $check;
356
+	}
350 357
 
351 358
 	$_meta_value = $meta_value;
352 359
 	$meta_value = maybe_serialize( $meta_value );
353 360
 
354 361
 	$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
355 362
 
356
-	if ( !$delete_all )
357
-		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
363
+	if ( !$delete_all ) {
364
+			$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
365
+	}
358 366
 
359
-	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value )
360
-		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
367
+	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
368
+			$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
369
+	}
361 370
 
362 371
 	$meta_ids = $wpdb->get_col( $query );
363
-	if ( !count( $meta_ids ) )
364
-		return false;
372
+	if ( !count( $meta_ids ) ) {
373
+			return false;
374
+	}
365 375
 
366 376
 	if ( $delete_all ) {
367 377
 		$value_clause = '';
@@ -403,8 +413,9 @@  discard block
 block discarded – undo
403 413
 
404 414
 	$count = $wpdb->query($query);
405 415
 
406
-	if ( !$count )
407
-		return false;
416
+	if ( !$count ) {
417
+			return false;
418
+	}
408 419
 
409 420
 	if ( $delete_all ) {
410 421
 		foreach ( (array) $object_ids as $o_id ) {
@@ -485,10 +496,11 @@  discard block
 block discarded – undo
485 496
 	 */
486 497
 	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
487 498
 	if ( null !== $check ) {
488
-		if ( $single && is_array( $check ) )
489
-			return $check[0];
490
-		else
491
-			return $check;
499
+		if ( $single && is_array( $check ) ) {
500
+					return $check[0];
501
+		} else {
502
+					return $check;
503
+		}
492 504
 	}
493 505
 
494 506
 	$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
@@ -503,17 +515,19 @@  discard block
 block discarded – undo
503 515
 	}
504 516
 
505 517
 	if ( isset($meta_cache[$meta_key]) ) {
506
-		if ( $single )
507
-			return maybe_unserialize( $meta_cache[$meta_key][0] );
508
-		else
509
-			return array_map('maybe_unserialize', $meta_cache[$meta_key]);
518
+		if ( $single ) {
519
+					return maybe_unserialize( $meta_cache[$meta_key][0] );
520
+		} else {
521
+					return array_map('maybe_unserialize', $meta_cache[$meta_key]);
522
+		}
510 523
 	}
511 524
 
512
-	if ($single)
513
-		return '';
514
-	else
515
-		return array();
516
-}
525
+	if ($single) {
526
+			return '';
527
+	} else {
528
+			return array();
529
+	}
530
+	}
517 531
 
518 532
 /**
519 533
  * Determine if a meta key is set for a given object
@@ -537,8 +551,9 @@  discard block
 block discarded – undo
537 551
 
538 552
 	/** This filter is documented in wp-includes/meta.php */
539 553
 	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
540
-	if ( null !== $check )
541
-		return (bool) $check;
554
+	if ( null !== $check ) {
555
+			return (bool) $check;
556
+	}
542 557
 
543 558
 	$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
544 559
 
@@ -547,8 +562,9 @@  discard block
 block discarded – undo
547 562
 		$meta_cache = $meta_cache[$object_id];
548 563
 	}
549 564
 
550
-	if ( isset( $meta_cache[ $meta_key ] ) )
551
-		return true;
565
+	if ( isset( $meta_cache[ $meta_key ] ) ) {
566
+			return true;
567
+	}
552 568
 
553 569
 	return false;
554 570
 }
@@ -585,11 +601,13 @@  discard block
 block discarded – undo
585 601
 
586 602
 	$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
587 603
 
588
-	if ( empty( $meta ) )
589
-		return false;
604
+	if ( empty( $meta ) ) {
605
+			return false;
606
+	}
590 607
 
591
-	if ( isset( $meta->meta_value ) )
592
-		$meta->meta_value = maybe_unserialize( $meta->meta_value );
608
+	if ( isset( $meta->meta_value ) ) {
609
+			$meta->meta_value = maybe_unserialize( $meta->meta_value );
610
+	}
593 611
 
594 612
 	return $meta;
595 613
 }
@@ -666,8 +684,9 @@  discard block
 block discarded – undo
666 684
 
667 685
 		// Run the update query, all fields in $data are %s, $where is a %d.
668 686
 		$result = $wpdb->update( $table, $data, $where, '%s', '%d' );
669
-		if ( ! $result )
670
-			return false;
687
+		if ( ! $result ) {
688
+					return false;
689
+		}
671 690
 
672 691
 		// Clear the caches.
673 692
 		wp_cache_delete($object_id, $meta_type . '_meta');
@@ -811,14 +830,16 @@  discard block
 block discarded – undo
811 830
 	$cache = array();
812 831
 	foreach ( $object_ids as $id ) {
813 832
 		$cached_object = wp_cache_get( $id, $cache_key );
814
-		if ( false === $cached_object )
815
-			$ids[] = $id;
816
-		else
817
-			$cache[$id] = $cached_object;
833
+		if ( false === $cached_object ) {
834
+					$ids[] = $id;
835
+		} else {
836
+					$cache[$id] = $cached_object;
837
+		}
818 838
 	}
819 839
 
820
-	if ( empty( $ids ) )
821
-		return $cache;
840
+	if ( empty( $ids ) ) {
841
+			return $cache;
842
+	}
822 843
 
823 844
 	// Get meta info
824 845
 	$id_list = join( ',', $ids );
@@ -832,10 +853,12 @@  discard block
 block discarded – undo
832 853
 			$mval = $metarow['meta_value'];
833 854
 
834 855
 			// Force subkeys to be array type:
835
-			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
836
-				$cache[$mpid] = array();
837
-			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
838
-				$cache[$mpid][$mkey] = array();
856
+			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) ) {
857
+							$cache[$mpid] = array();
858
+			}
859
+			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) ) {
860
+							$cache[$mpid][$mkey] = array();
861
+			}
839 862
 
840 863
 			// Add a value to the current pid/key:
841 864
 			$cache[$mpid][$mkey][] = $mval;
@@ -843,8 +866,9 @@  discard block
 block discarded – undo
843 866
 	}
844 867
 
845 868
 	foreach ( $ids as $id ) {
846
-		if ( ! isset($cache[$id]) )
847
-			$cache[$id] = array();
869
+		if ( ! isset($cache[$id]) ) {
870
+					$cache[$id] = array();
871
+		}
848 872
 		wp_cache_add( $id, $cache[$id], $cache_key );
849 873
 	}
850 874
 
@@ -902,8 +926,9 @@  discard block
 block discarded – undo
902 926
 
903 927
 	$table_name = $type . 'meta';
904 928
 
905
-	if ( empty($wpdb->$table_name) )
906
-		return false;
929
+	if ( empty($wpdb->$table_name) ) {
930
+			return false;
931
+	}
907 932
 
908 933
 	return $wpdb->$table_name;
909 934
 }
Please login to merge, or discard this patch.
Spacing   +228 added lines, -228 removed lines patch added patch discarded remove patch
@@ -30,26 +30,26 @@  discard block
 block discarded – undo
30 30
 function add_metadata($meta_type, $object_id, $meta_key, $meta_value, $unique = false) {
31 31
 	global $wpdb;
32 32
 
33
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
33
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id)) {
34 34
 		return false;
35 35
 	}
36 36
 
37
-	$object_id = absint( $object_id );
38
-	if ( ! $object_id ) {
37
+	$object_id = absint($object_id);
38
+	if ( ! $object_id) {
39 39
 		return false;
40 40
 	}
41 41
 
42
-	$table = _get_meta_table( $meta_type );
43
-	if ( ! $table ) {
42
+	$table = _get_meta_table($meta_type);
43
+	if ( ! $table) {
44 44
 		return false;
45 45
 	}
46 46
 
47
-	$column = sanitize_key($meta_type . '_id');
47
+	$column = sanitize_key($meta_type.'_id');
48 48
 
49 49
 	// expected_slashed ($meta_key)
50 50
 	$meta_key = wp_unslash($meta_key);
51 51
 	$meta_value = wp_unslash($meta_value);
52
-	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
52
+	$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
53 53
 
54 54
 	/**
55 55
 	 * Filters whether to add metadata of a specific type.
@@ -67,17 +67,17 @@  discard block
 block discarded – undo
67 67
 	 * @param bool      $unique     Whether the specified meta key should be unique
68 68
 	 *                              for the object. Optional. Default false.
69 69
 	 */
70
-	$check = apply_filters( "add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique );
71
-	if ( null !== $check )
70
+	$check = apply_filters("add_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $unique);
71
+	if (null !== $check)
72 72
 		return $check;
73 73
 
74
-	if ( $unique && $wpdb->get_var( $wpdb->prepare(
74
+	if ($unique && $wpdb->get_var($wpdb->prepare(
75 75
 		"SELECT COUNT(*) FROM $table WHERE meta_key = %s AND $column = %d",
76
-		$meta_key, $object_id ) ) )
76
+		$meta_key, $object_id )))
77 77
 		return false;
78 78
 
79 79
 	$_meta_value = $meta_value;
80
-	$meta_value = maybe_serialize( $meta_value );
80
+	$meta_value = maybe_serialize($meta_value);
81 81
 
82 82
 	/**
83 83
 	 * Fires immediately before meta of a specific type is added.
@@ -91,20 +91,20 @@  discard block
 block discarded – undo
91 91
 	 * @param string $meta_key   Meta key.
92 92
 	 * @param mixed  $meta_value Meta value.
93 93
 	 */
94
-	do_action( "add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value );
94
+	do_action("add_{$meta_type}_meta", $object_id, $meta_key, $_meta_value);
95 95
 
96
-	$result = $wpdb->insert( $table, array(
96
+	$result = $wpdb->insert($table, array(
97 97
 		$column => $object_id,
98 98
 		'meta_key' => $meta_key,
99 99
 		'meta_value' => $meta_value
100
-	) );
100
+	));
101 101
 
102
-	if ( ! $result )
102
+	if ( ! $result)
103 103
 		return false;
104 104
 
105 105
 	$mid = (int) $wpdb->insert_id;
106 106
 
107
-	wp_cache_delete($object_id, $meta_type . '_meta');
107
+	wp_cache_delete($object_id, $meta_type.'_meta');
108 108
 
109 109
 	/**
110 110
 	 * Fires immediately after meta of a specific type is added.
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 	 * @param string $meta_key   Meta key.
120 120
 	 * @param mixed  $meta_value Meta value.
121 121
 	 */
122
-	do_action( "added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value );
122
+	do_action("added_{$meta_type}_meta", $mid, $object_id, $meta_key, $_meta_value);
123 123
 
124 124
 	return $mid;
125 125
 }
@@ -143,21 +143,21 @@  discard block
 block discarded – undo
143 143
 function update_metadata($meta_type, $object_id, $meta_key, $meta_value, $prev_value = '') {
144 144
 	global $wpdb;
145 145
 
146
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) ) {
146
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id)) {
147 147
 		return false;
148 148
 	}
149 149
 
150
-	$object_id = absint( $object_id );
151
-	if ( ! $object_id ) {
150
+	$object_id = absint($object_id);
151
+	if ( ! $object_id) {
152 152
 		return false;
153 153
 	}
154 154
 
155
-	$table = _get_meta_table( $meta_type );
156
-	if ( ! $table ) {
155
+	$table = _get_meta_table($meta_type);
156
+	if ( ! $table) {
157 157
 		return false;
158 158
 	}
159 159
 
160
-	$column = sanitize_key($meta_type . '_id');
160
+	$column = sanitize_key($meta_type.'_id');
161 161
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
162 162
 
163 163
 	// expected_slashed ($meta_key)
@@ -165,7 +165,7 @@  discard block
 block discarded – undo
165 165
 	$meta_key = wp_unslash($meta_key);
166 166
 	$passed_value = $meta_value;
167 167
 	$meta_value = wp_unslash($meta_value);
168
-	$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
168
+	$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
169 169
 
170 170
 	/**
171 171
 	 * Filters whether to update metadata of a specific type.
@@ -184,36 +184,36 @@  discard block
 block discarded – undo
184 184
 	 *                              metadata entries with the specified value.
185 185
 	 *                              Otherwise, update all entries.
186 186
 	 */
187
-	$check = apply_filters( "update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value );
188
-	if ( null !== $check )
187
+	$check = apply_filters("update_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $prev_value);
188
+	if (null !== $check)
189 189
 		return (bool) $check;
190 190
 
191 191
 	// Compare existing value to new value if no prev value given and the key exists only once.
192
-	if ( empty($prev_value) ) {
192
+	if (empty($prev_value)) {
193 193
 		$old_value = get_metadata($meta_type, $object_id, $meta_key);
194
-		if ( count($old_value) == 1 ) {
195
-			if ( $old_value[0] === $meta_value )
194
+		if (count($old_value) == 1) {
195
+			if ($old_value[0] === $meta_value)
196 196
 				return false;
197 197
 		}
198 198
 	}
199 199
 
200
-	$meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id ) );
201
-	if ( empty( $meta_ids ) ) {
202
-		return add_metadata( $meta_type, $object_id, $raw_meta_key, $passed_value );
200
+	$meta_ids = $wpdb->get_col($wpdb->prepare("SELECT $id_column FROM $table WHERE meta_key = %s AND $column = %d", $meta_key, $object_id));
201
+	if (empty($meta_ids)) {
202
+		return add_metadata($meta_type, $object_id, $raw_meta_key, $passed_value);
203 203
 	}
204 204
 
205 205
 	$_meta_value = $meta_value;
206
-	$meta_value = maybe_serialize( $meta_value );
206
+	$meta_value = maybe_serialize($meta_value);
207 207
 
208
-	$data  = compact( 'meta_value' );
209
-	$where = array( $column => $object_id, 'meta_key' => $meta_key );
208
+	$data  = compact('meta_value');
209
+	$where = array($column => $object_id, 'meta_key' => $meta_key);
210 210
 
211
-	if ( !empty( $prev_value ) ) {
211
+	if ( ! empty($prev_value)) {
212 212
 		$prev_value = maybe_serialize($prev_value);
213 213
 		$where['meta_value'] = $prev_value;
214 214
 	}
215 215
 
216
-	foreach ( $meta_ids as $meta_id ) {
216
+	foreach ($meta_ids as $meta_id) {
217 217
 		/**
218 218
 		 * Fires immediately before updating metadata of a specific type.
219 219
 		 *
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
 		 * @param string $meta_key   Meta key.
228 228
 		 * @param mixed  $meta_value Meta value.
229 229
 		 */
230
-		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
230
+		do_action("update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
231 231
 
232
-		if ( 'post' == $meta_type ) {
232
+		if ('post' == $meta_type) {
233 233
 			/**
234 234
 			 * Fires immediately before updating a post's metadata.
235 235
 			 *
@@ -240,17 +240,17 @@  discard block
 block discarded – undo
240 240
 			 * @param string $meta_key   Meta key.
241 241
 			 * @param mixed  $meta_value Meta value.
242 242
 			 */
243
-			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
243
+			do_action('update_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
244 244
 		}
245 245
 	}
246 246
 
247
-	$result = $wpdb->update( $table, $data, $where );
248
-	if ( ! $result )
247
+	$result = $wpdb->update($table, $data, $where);
248
+	if ( ! $result)
249 249
 		return false;
250 250
 
251
-	wp_cache_delete($object_id, $meta_type . '_meta');
251
+	wp_cache_delete($object_id, $meta_type.'_meta');
252 252
 
253
-	foreach ( $meta_ids as $meta_id ) {
253
+	foreach ($meta_ids as $meta_id) {
254 254
 		/**
255 255
 		 * Fires immediately after updating metadata of a specific type.
256 256
 		 *
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 		 * @param string $meta_key   Meta key.
265 265
 		 * @param mixed  $meta_value Meta value.
266 266
 		 */
267
-		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
267
+		do_action("updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
268 268
 
269
-		if ( 'post' == $meta_type ) {
269
+		if ('post' == $meta_type) {
270 270
 			/**
271 271
 			 * Fires immediately after updating a post's metadata.
272 272
 			 *
@@ -277,7 +277,7 @@  discard block
 block discarded – undo
277 277
 			 * @param string $meta_key   Meta key.
278 278
 			 * @param mixed  $meta_value Meta value.
279 279
 			 */
280
-			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
280
+			do_action('updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
281 281
 		}
282 282
 	}
283 283
 
@@ -307,21 +307,21 @@  discard block
 block discarded – undo
307 307
 function delete_metadata($meta_type, $object_id, $meta_key, $meta_value = '', $delete_all = false) {
308 308
 	global $wpdb;
309 309
 
310
-	if ( ! $meta_type || ! $meta_key || ! is_numeric( $object_id ) && ! $delete_all ) {
310
+	if ( ! $meta_type || ! $meta_key || ! is_numeric($object_id) && ! $delete_all) {
311 311
 		return false;
312 312
 	}
313 313
 
314
-	$object_id = absint( $object_id );
315
-	if ( ! $object_id && ! $delete_all ) {
314
+	$object_id = absint($object_id);
315
+	if ( ! $object_id && ! $delete_all) {
316 316
 		return false;
317 317
 	}
318 318
 
319
-	$table = _get_meta_table( $meta_type );
320
-	if ( ! $table ) {
319
+	$table = _get_meta_table($meta_type);
320
+	if ( ! $table) {
321 321
 		return false;
322 322
 	}
323 323
 
324
-	$type_column = sanitize_key($meta_type . '_id');
324
+	$type_column = sanitize_key($meta_type.'_id');
325 325
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
326 326
 	// expected_slashed ($meta_key)
327 327
 	$meta_key = wp_unslash($meta_key);
@@ -344,32 +344,32 @@  discard block
 block discarded – undo
344 344
 	 *                              for all objects, ignoring the specified $object_id.
345 345
 	 *                              Default false.
346 346
 	 */
347
-	$check = apply_filters( "delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all );
348
-	if ( null !== $check )
347
+	$check = apply_filters("delete_{$meta_type}_metadata", null, $object_id, $meta_key, $meta_value, $delete_all);
348
+	if (null !== $check)
349 349
 		return (bool) $check;
350 350
 
351 351
 	$_meta_value = $meta_value;
352
-	$meta_value = maybe_serialize( $meta_value );
352
+	$meta_value = maybe_serialize($meta_value);
353 353
 
354
-	$query = $wpdb->prepare( "SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key );
354
+	$query = $wpdb->prepare("SELECT $id_column FROM $table WHERE meta_key = %s", $meta_key);
355 355
 
356
-	if ( !$delete_all )
357
-		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id );
356
+	if ( ! $delete_all)
357
+		$query .= $wpdb->prepare(" AND $type_column = %d", $object_id);
358 358
 
359
-	if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value )
360
-		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value );
359
+	if ('' !== $meta_value && null !== $meta_value && false !== $meta_value)
360
+		$query .= $wpdb->prepare(" AND meta_value = %s", $meta_value);
361 361
 
362
-	$meta_ids = $wpdb->get_col( $query );
363
-	if ( !count( $meta_ids ) )
362
+	$meta_ids = $wpdb->get_col($query);
363
+	if ( ! count($meta_ids))
364 364
 		return false;
365 365
 
366
-	if ( $delete_all ) {
366
+	if ($delete_all) {
367 367
 		$value_clause = '';
368
-		if ( '' !== $meta_value && null !== $meta_value && false !== $meta_value ) {
369
-			$value_clause = $wpdb->prepare( " AND meta_value = %s", $meta_value );
368
+		if ('' !== $meta_value && null !== $meta_value && false !== $meta_value) {
369
+			$value_clause = $wpdb->prepare(" AND meta_value = %s", $meta_value);
370 370
 		}
371 371
 
372
-		$object_ids = $wpdb->get_col( $wpdb->prepare( "SELECT $type_column FROM $table WHERE meta_key = %s $value_clause", $meta_key ) );
372
+		$object_ids = $wpdb->get_col($wpdb->prepare("SELECT $type_column FROM $table WHERE meta_key = %s $value_clause", $meta_key));
373 373
 	}
374 374
 
375 375
 	/**
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 	 * @param string $meta_key   Meta key.
386 386
 	 * @param mixed  $meta_value Meta value.
387 387
 	 */
388
-	do_action( "delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
388
+	do_action("delete_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value);
389 389
 
390 390
 	// Old-style action.
391
-	if ( 'post' == $meta_type ) {
391
+	if ('post' == $meta_type) {
392 392
 		/**
393 393
 		 * Fires immediately before deleting metadata for a post.
394 394
 		 *
@@ -396,22 +396,22 @@  discard block
 block discarded – undo
396 396
 		 *
397 397
 		 * @param array $meta_ids An array of post metadata entry IDs to delete.
398 398
 		 */
399
-		do_action( 'delete_postmeta', $meta_ids );
399
+		do_action('delete_postmeta', $meta_ids);
400 400
 	}
401 401
 
402
-	$query = "DELETE FROM $table WHERE $id_column IN( " . implode( ',', $meta_ids ) . " )";
402
+	$query = "DELETE FROM $table WHERE $id_column IN( ".implode(',', $meta_ids)." )";
403 403
 
404 404
 	$count = $wpdb->query($query);
405 405
 
406
-	if ( !$count )
406
+	if ( ! $count)
407 407
 		return false;
408 408
 
409
-	if ( $delete_all ) {
410
-		foreach ( (array) $object_ids as $o_id ) {
411
-			wp_cache_delete($o_id, $meta_type . '_meta');
409
+	if ($delete_all) {
410
+		foreach ((array) $object_ids as $o_id) {
411
+			wp_cache_delete($o_id, $meta_type.'_meta');
412 412
 		}
413 413
 	} else {
414
-		wp_cache_delete($object_id, $meta_type . '_meta');
414
+		wp_cache_delete($object_id, $meta_type.'_meta');
415 415
 	}
416 416
 
417 417
 	/**
@@ -427,10 +427,10 @@  discard block
 block discarded – undo
427 427
 	 * @param string $meta_key   Meta key.
428 428
 	 * @param mixed  $meta_value Meta value.
429 429
 	 */
430
-	do_action( "deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value );
430
+	do_action("deleted_{$meta_type}_meta", $meta_ids, $object_id, $meta_key, $_meta_value);
431 431
 
432 432
 	// Old-style action.
433
-	if ( 'post' == $meta_type ) {
433
+	if ('post' == $meta_type) {
434 434
 		/**
435 435
 		 * Fires immediately after deleting metadata for a post.
436 436
 		 *
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 		 *
439 439
 		 * @param array $meta_ids An array of deleted post metadata entry IDs.
440 440
 		 */
441
-		do_action( 'deleted_postmeta', $meta_ids );
441
+		do_action('deleted_postmeta', $meta_ids);
442 442
 	}
443 443
 
444 444
 	return true;
@@ -459,12 +459,12 @@  discard block
 block discarded – undo
459 459
  * @return mixed Single metadata value, or array of values
460 460
  */
461 461
 function get_metadata($meta_type, $object_id, $meta_key = '', $single = false) {
462
-	if ( ! $meta_type || ! is_numeric( $object_id ) ) {
462
+	if ( ! $meta_type || ! is_numeric($object_id)) {
463 463
 		return false;
464 464
 	}
465 465
 
466
-	$object_id = absint( $object_id );
467
-	if ( ! $object_id ) {
466
+	$object_id = absint($object_id);
467
+	if ( ! $object_id) {
468 468
 		return false;
469 469
 	}
470 470
 
@@ -483,28 +483,28 @@  discard block
 block discarded – undo
483 483
 	 * @param string            $meta_key  Meta key.
484 484
 	 * @param bool              $single    Whether to return only the first value of the specified $meta_key.
485 485
 	 */
486
-	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single );
487
-	if ( null !== $check ) {
488
-		if ( $single && is_array( $check ) )
486
+	$check = apply_filters("get_{$meta_type}_metadata", null, $object_id, $meta_key, $single);
487
+	if (null !== $check) {
488
+		if ($single && is_array($check))
489 489
 			return $check[0];
490 490
 		else
491 491
 			return $check;
492 492
 	}
493 493
 
494
-	$meta_cache = wp_cache_get($object_id, $meta_type . '_meta');
494
+	$meta_cache = wp_cache_get($object_id, $meta_type.'_meta');
495 495
 
496
-	if ( !$meta_cache ) {
497
-		$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
496
+	if ( ! $meta_cache) {
497
+		$meta_cache = update_meta_cache($meta_type, array($object_id));
498 498
 		$meta_cache = $meta_cache[$object_id];
499 499
 	}
500 500
 
501
-	if ( ! $meta_key ) {
501
+	if ( ! $meta_key) {
502 502
 		return $meta_cache;
503 503
 	}
504 504
 
505
-	if ( isset($meta_cache[$meta_key]) ) {
506
-		if ( $single )
507
-			return maybe_unserialize( $meta_cache[$meta_key][0] );
505
+	if (isset($meta_cache[$meta_key])) {
506
+		if ($single)
507
+			return maybe_unserialize($meta_cache[$meta_key][0]);
508 508
 		else
509 509
 			return array_map('maybe_unserialize', $meta_cache[$meta_key]);
510 510
 	}
@@ -525,29 +525,29 @@  discard block
 block discarded – undo
525 525
  * @param string $meta_key  Metadata key.
526 526
  * @return bool True of the key is set, false if not.
527 527
  */
528
-function metadata_exists( $meta_type, $object_id, $meta_key ) {
529
-	if ( ! $meta_type || ! is_numeric( $object_id ) ) {
528
+function metadata_exists($meta_type, $object_id, $meta_key) {
529
+	if ( ! $meta_type || ! is_numeric($object_id)) {
530 530
 		return false;
531 531
 	}
532 532
 
533
-	$object_id = absint( $object_id );
534
-	if ( ! $object_id ) {
533
+	$object_id = absint($object_id);
534
+	if ( ! $object_id) {
535 535
 		return false;
536 536
 	}
537 537
 
538 538
 	/** This filter is documented in wp-includes/meta.php */
539
-	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );
540
-	if ( null !== $check )
539
+	$check = apply_filters("get_{$meta_type}_metadata", null, $object_id, $meta_key, true);
540
+	if (null !== $check)
541 541
 		return (bool) $check;
542 542
 
543
-	$meta_cache = wp_cache_get( $object_id, $meta_type . '_meta' );
543
+	$meta_cache = wp_cache_get($object_id, $meta_type.'_meta');
544 544
 
545
-	if ( !$meta_cache ) {
546
-		$meta_cache = update_meta_cache( $meta_type, array( $object_id ) );
545
+	if ( ! $meta_cache) {
546
+		$meta_cache = update_meta_cache($meta_type, array($object_id));
547 547
 		$meta_cache = $meta_cache[$object_id];
548 548
 	}
549 549
 
550
-	if ( isset( $meta_cache[ $meta_key ] ) )
550
+	if (isset($meta_cache[$meta_key]))
551 551
 		return true;
552 552
 
553 553
 	return false;
@@ -564,32 +564,32 @@  discard block
 block discarded – undo
564 564
  * @param int    $meta_id   ID for a specific meta row
565 565
  * @return object|false Meta object or false.
566 566
  */
567
-function get_metadata_by_mid( $meta_type, $meta_id ) {
567
+function get_metadata_by_mid($meta_type, $meta_id) {
568 568
 	global $wpdb;
569 569
 
570
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
570
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
571 571
 		return false;
572 572
 	}
573 573
 
574
-	$meta_id = intval( $meta_id );
575
-	if ( $meta_id <= 0 ) {
574
+	$meta_id = intval($meta_id);
575
+	if ($meta_id <= 0) {
576 576
 		return false;
577 577
 	}
578 578
 
579
-	$table = _get_meta_table( $meta_type );
580
-	if ( ! $table ) {
579
+	$table = _get_meta_table($meta_type);
580
+	if ( ! $table) {
581 581
 		return false;
582 582
 	}
583 583
 
584
-	$id_column = ( 'user' == $meta_type ) ? 'umeta_id' : 'meta_id';
584
+	$id_column = ('user' == $meta_type) ? 'umeta_id' : 'meta_id';
585 585
 
586
-	$meta = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table WHERE $id_column = %d", $meta_id ) );
586
+	$meta = $wpdb->get_row($wpdb->prepare("SELECT * FROM $table WHERE $id_column = %d", $meta_id));
587 587
 
588
-	if ( empty( $meta ) )
588
+	if (empty($meta))
589 589
 		return false;
590 590
 
591
-	if ( isset( $meta->meta_value ) )
592
-		$meta->meta_value = maybe_unserialize( $meta->meta_value );
591
+	if (isset($meta->meta_value))
592
+		$meta->meta_value = maybe_unserialize($meta->meta_value);
593 593
 
594 594
 	return $meta;
595 595
 }
@@ -607,44 +607,44 @@  discard block
 block discarded – undo
607 607
  * @param string $meta_key   Optional, you can provide a meta key to update it
608 608
  * @return bool True on successful update, false on failure.
609 609
  */
610
-function update_metadata_by_mid( $meta_type, $meta_id, $meta_value, $meta_key = false ) {
610
+function update_metadata_by_mid($meta_type, $meta_id, $meta_value, $meta_key = false) {
611 611
 	global $wpdb;
612 612
 
613 613
 	// Make sure everything is valid.
614
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
614
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
615 615
 		return false;
616 616
 	}
617 617
 
618
-	$meta_id = intval( $meta_id );
619
-	if ( $meta_id <= 0 ) {
618
+	$meta_id = intval($meta_id);
619
+	if ($meta_id <= 0) {
620 620
 		return false;
621 621
 	}
622 622
 
623
-	$table = _get_meta_table( $meta_type );
624
-	if ( ! $table ) {
623
+	$table = _get_meta_table($meta_type);
624
+	if ( ! $table) {
625 625
 		return false;
626 626
 	}
627 627
 
628
-	$column = sanitize_key($meta_type . '_id');
628
+	$column = sanitize_key($meta_type.'_id');
629 629
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
630 630
 
631 631
 	// Fetch the meta and go on if it's found.
632
-	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
632
+	if ($meta = get_metadata_by_mid($meta_type, $meta_id)) {
633 633
 		$original_key = $meta->meta_key;
634 634
 		$object_id = $meta->{$column};
635 635
 
636 636
 		// If a new meta_key (last parameter) was specified, change the meta key,
637 637
 		// otherwise use the original key in the update statement.
638
-		if ( false === $meta_key ) {
638
+		if (false === $meta_key) {
639 639
 			$meta_key = $original_key;
640
-		} elseif ( ! is_string( $meta_key ) ) {
640
+		} elseif ( ! is_string($meta_key)) {
641 641
 			return false;
642 642
 		}
643 643
 
644 644
 		// Sanitize the meta
645 645
 		$_meta_value = $meta_value;
646
-		$meta_value = sanitize_meta( $meta_key, $meta_value, $meta_type );
647
-		$meta_value = maybe_serialize( $meta_value );
646
+		$meta_value = sanitize_meta($meta_key, $meta_value, $meta_type);
647
+		$meta_value = maybe_serialize($meta_value);
648 648
 
649 649
 		// Format the data query arguments.
650 650
 		$data = array(
@@ -657,27 +657,27 @@  discard block
 block discarded – undo
657 657
 		$where[$id_column] = $meta_id;
658 658
 
659 659
 		/** This action is documented in wp-includes/meta.php */
660
-		do_action( "update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
660
+		do_action("update_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
661 661
 
662
-		if ( 'post' == $meta_type ) {
662
+		if ('post' == $meta_type) {
663 663
 			/** This action is documented in wp-includes/meta.php */
664
-			do_action( 'update_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
664
+			do_action('update_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
665 665
 		}
666 666
 
667 667
 		// Run the update query, all fields in $data are %s, $where is a %d.
668
-		$result = $wpdb->update( $table, $data, $where, '%s', '%d' );
669
-		if ( ! $result )
668
+		$result = $wpdb->update($table, $data, $where, '%s', '%d');
669
+		if ( ! $result)
670 670
 			return false;
671 671
 
672 672
 		// Clear the caches.
673
-		wp_cache_delete($object_id, $meta_type . '_meta');
673
+		wp_cache_delete($object_id, $meta_type.'_meta');
674 674
 
675 675
 		/** This action is documented in wp-includes/meta.php */
676
-		do_action( "updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value );
676
+		do_action("updated_{$meta_type}_meta", $meta_id, $object_id, $meta_key, $_meta_value);
677 677
 
678
-		if ( 'post' == $meta_type ) {
678
+		if ('post' == $meta_type) {
679 679
 			/** This action is documented in wp-includes/meta.php */
680
-			do_action( 'updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value );
680
+			do_action('updated_postmeta', $meta_id, $object_id, $meta_key, $meta_value);
681 681
 		}
682 682
 
683 683
 		return true;
@@ -698,37 +698,37 @@  discard block
 block discarded – undo
698 698
  * @param int    $meta_id   ID for a specific meta row
699 699
  * @return bool True on successful delete, false on failure.
700 700
  */
701
-function delete_metadata_by_mid( $meta_type, $meta_id ) {
701
+function delete_metadata_by_mid($meta_type, $meta_id) {
702 702
 	global $wpdb;
703 703
 
704 704
 	// Make sure everything is valid.
705
-	if ( ! $meta_type || ! is_numeric( $meta_id ) || floor( $meta_id ) != $meta_id ) {
705
+	if ( ! $meta_type || ! is_numeric($meta_id) || floor($meta_id) != $meta_id) {
706 706
 		return false;
707 707
 	}
708 708
 
709
-	$meta_id = intval( $meta_id );
710
-	if ( $meta_id <= 0 ) {
709
+	$meta_id = intval($meta_id);
710
+	if ($meta_id <= 0) {
711 711
 		return false;
712 712
 	}
713 713
 
714
-	$table = _get_meta_table( $meta_type );
715
-	if ( ! $table ) {
714
+	$table = _get_meta_table($meta_type);
715
+	if ( ! $table) {
716 716
 		return false;
717 717
 	}
718 718
 
719 719
 	// object and id columns
720
-	$column = sanitize_key($meta_type . '_id');
720
+	$column = sanitize_key($meta_type.'_id');
721 721
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
722 722
 
723 723
 	// Fetch the meta and go on if it's found.
724
-	if ( $meta = get_metadata_by_mid( $meta_type, $meta_id ) ) {
724
+	if ($meta = get_metadata_by_mid($meta_type, $meta_id)) {
725 725
 		$object_id = $meta->{$column};
726 726
 
727 727
 		/** This action is documented in wp-includes/meta.php */
728
-		do_action( "delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
728
+		do_action("delete_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value);
729 729
 
730 730
 		// Old-style action.
731
-		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
731
+		if ('post' == $meta_type || 'comment' == $meta_type) {
732 732
 			/**
733 733
 			 * Fires immediately before deleting post or comment metadata of a specific type.
734 734
 			 *
@@ -739,20 +739,20 @@  discard block
 block discarded – undo
739 739
 			 *
740 740
 			 * @param int $meta_id ID of the metadata entry to delete.
741 741
 			 */
742
-			do_action( "delete_{$meta_type}meta", $meta_id );
742
+			do_action("delete_{$meta_type}meta", $meta_id);
743 743
 		}
744 744
 
745 745
 		// Run the query, will return true if deleted, false otherwise
746
-		$result = (bool) $wpdb->delete( $table, array( $id_column => $meta_id ) );
746
+		$result = (bool) $wpdb->delete($table, array($id_column => $meta_id));
747 747
 
748 748
 		// Clear the caches.
749
-		wp_cache_delete($object_id, $meta_type . '_meta');
749
+		wp_cache_delete($object_id, $meta_type.'_meta');
750 750
 
751 751
 		/** This action is documented in wp-includes/meta.php */
752
-		do_action( "deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value );
752
+		do_action("deleted_{$meta_type}_meta", (array) $meta_id, $object_id, $meta->meta_key, $meta->meta_value);
753 753
 
754 754
 		// Old-style action.
755
-		if ( 'post' == $meta_type || 'comment' == $meta_type ) {
755
+		if ('post' == $meta_type || 'comment' == $meta_type) {
756 756
 			/**
757 757
 			 * Fires immediately after deleting post or comment metadata of a specific type.
758 758
 			 *
@@ -763,7 +763,7 @@  discard block
 block discarded – undo
763 763
 			 *
764 764
 			 * @param int $meta_ids Deleted metadata entry ID.
765 765
 			 */
766
-			do_action( "deleted_{$meta_type}meta", $meta_id );
766
+			do_action("deleted_{$meta_type}meta", $meta_id);
767 767
 		}
768 768
 
769 769
 		return $result;
@@ -788,53 +788,53 @@  discard block
 block discarded – undo
788 788
 function update_meta_cache($meta_type, $object_ids) {
789 789
 	global $wpdb;
790 790
 
791
-	if ( ! $meta_type || ! $object_ids ) {
791
+	if ( ! $meta_type || ! $object_ids) {
792 792
 		return false;
793 793
 	}
794 794
 
795
-	$table = _get_meta_table( $meta_type );
796
-	if ( ! $table ) {
795
+	$table = _get_meta_table($meta_type);
796
+	if ( ! $table) {
797 797
 		return false;
798 798
 	}
799 799
 
800
-	$column = sanitize_key($meta_type . '_id');
800
+	$column = sanitize_key($meta_type.'_id');
801 801
 
802
-	if ( !is_array($object_ids) ) {
802
+	if ( ! is_array($object_ids)) {
803 803
 		$object_ids = preg_replace('|[^0-9,]|', '', $object_ids);
804 804
 		$object_ids = explode(',', $object_ids);
805 805
 	}
806 806
 
807 807
 	$object_ids = array_map('intval', $object_ids);
808 808
 
809
-	$cache_key = $meta_type . '_meta';
809
+	$cache_key = $meta_type.'_meta';
810 810
 	$ids = array();
811 811
 	$cache = array();
812
-	foreach ( $object_ids as $id ) {
813
-		$cached_object = wp_cache_get( $id, $cache_key );
814
-		if ( false === $cached_object )
812
+	foreach ($object_ids as $id) {
813
+		$cached_object = wp_cache_get($id, $cache_key);
814
+		if (false === $cached_object)
815 815
 			$ids[] = $id;
816 816
 		else
817 817
 			$cache[$id] = $cached_object;
818 818
 	}
819 819
 
820
-	if ( empty( $ids ) )
820
+	if (empty($ids))
821 821
 		return $cache;
822 822
 
823 823
 	// Get meta info
824
-	$id_list = join( ',', $ids );
824
+	$id_list = join(',', $ids);
825 825
 	$id_column = 'user' == $meta_type ? 'umeta_id' : 'meta_id';
826
-	$meta_list = $wpdb->get_results( "SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A );
826
+	$meta_list = $wpdb->get_results("SELECT $column, meta_key, meta_value FROM $table WHERE $column IN ($id_list) ORDER BY $id_column ASC", ARRAY_A);
827 827
 
828
-	if ( !empty($meta_list) ) {
829
-		foreach ( $meta_list as $metarow) {
828
+	if ( ! empty($meta_list)) {
829
+		foreach ($meta_list as $metarow) {
830 830
 			$mpid = intval($metarow[$column]);
831 831
 			$mkey = $metarow['meta_key'];
832 832
 			$mval = $metarow['meta_value'];
833 833
 
834 834
 			// Force subkeys to be array type:
835
-			if ( !isset($cache[$mpid]) || !is_array($cache[$mpid]) )
835
+			if ( ! isset($cache[$mpid]) || ! is_array($cache[$mpid]))
836 836
 				$cache[$mpid] = array();
837
-			if ( !isset($cache[$mpid][$mkey]) || !is_array($cache[$mpid][$mkey]) )
837
+			if ( ! isset($cache[$mpid][$mkey]) || ! is_array($cache[$mpid][$mkey]))
838 838
 				$cache[$mpid][$mkey] = array();
839 839
 
840 840
 			// Add a value to the current pid/key:
@@ -842,10 +842,10 @@  discard block
 block discarded – undo
842 842
 		}
843 843
 	}
844 844
 
845
-	foreach ( $ids as $id ) {
846
-		if ( ! isset($cache[$id]) )
845
+	foreach ($ids as $id) {
846
+		if ( ! isset($cache[$id]))
847 847
 			$cache[$id] = array();
848
-		wp_cache_add( $id, $cache[$id], $cache_key );
848
+		wp_cache_add($id, $cache[$id], $cache_key);
849 849
 	}
850 850
 
851 851
 	return $cache;
@@ -861,7 +861,7 @@  discard block
 block discarded – undo
861 861
 function wp_metadata_lazyloader() {
862 862
 	static $wp_metadata_lazyloader;
863 863
 
864
-	if ( null === $wp_metadata_lazyloader ) {
864
+	if (null === $wp_metadata_lazyloader) {
865 865
 		$wp_metadata_lazyloader = new WP_Metadata_Lazyloader();
866 866
 	}
867 867
 
@@ -882,9 +882,9 @@  discard block
 block discarded – undo
882 882
  * @param object $context           Optional. The main query object
883 883
  * @return array Associative array of `JOIN` and `WHERE` SQL.
884 884
  */
885
-function get_meta_sql( $meta_query, $type, $primary_table, $primary_id_column, $context = null ) {
886
-	$meta_query_obj = new WP_Meta_Query( $meta_query );
887
-	return $meta_query_obj->get_sql( $type, $primary_table, $primary_id_column, $context );
885
+function get_meta_sql($meta_query, $type, $primary_table, $primary_id_column, $context = null) {
886
+	$meta_query_obj = new WP_Meta_Query($meta_query);
887
+	return $meta_query_obj->get_sql($type, $primary_table, $primary_id_column, $context);
888 888
 }
889 889
 
890 890
 /**
@@ -900,9 +900,9 @@  discard block
 block discarded – undo
900 900
 function _get_meta_table($type) {
901 901
 	global $wpdb;
902 902
 
903
-	$table_name = $type . 'meta';
903
+	$table_name = $type.'meta';
904 904
 
905
-	if ( empty($wpdb->$table_name) )
905
+	if (empty($wpdb->$table_name))
906 906
 		return false;
907 907
 
908 908
 	return $wpdb->$table_name;
@@ -917,8 +917,8 @@  discard block
 block discarded – undo
917 917
  * @param string|null $meta_type
918 918
  * @return bool True if the key is protected, false otherwise.
919 919
  */
920
-function is_protected_meta( $meta_key, $meta_type = null ) {
921
-	$protected = ( '_' == $meta_key[0] );
920
+function is_protected_meta($meta_key, $meta_type = null) {
921
+	$protected = ('_' == $meta_key[0]);
922 922
 
923 923
 	/**
924 924
 	 * Filters whether a meta key is protected.
@@ -929,7 +929,7 @@  discard block
 block discarded – undo
929 929
 	 * @param string $meta_key  Meta key.
930 930
 	 * @param string $meta_type Meta type.
931 931
 	 */
932
-	return apply_filters( 'is_protected_meta', $protected, $meta_key, $meta_type );
932
+	return apply_filters('is_protected_meta', $protected, $meta_key, $meta_type);
933 933
 }
934 934
 
935 935
 /**
@@ -943,7 +943,7 @@  discard block
 block discarded – undo
943 943
  *
944 944
  * @return mixed Sanitized $meta_value.
945 945
  */
946
-function sanitize_meta( $meta_key, $meta_value, $object_type ) {
946
+function sanitize_meta($meta_key, $meta_value, $object_type) {
947 947
 	/**
948 948
 	 * Filters the sanitization of a specific meta key of a specific meta type.
949 949
 	 *
@@ -957,7 +957,7 @@  discard block
 block discarded – undo
957 957
 	 * @param string $meta_key        Meta key.
958 958
 	 * @param string $object_type     Object type.
959 959
 	 */
960
-	return apply_filters( "sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type );
960
+	return apply_filters("sanitize_{$object_type}_meta_{$meta_key}", $meta_value, $meta_key, $object_type);
961 961
 }
962 962
 
963 963
 /**
@@ -986,10 +986,10 @@  discard block
 block discarded – undo
986 986
  *                       Registering a meta key with distinct sanitize and auth callbacks will fire those
987 987
  *                       callbacks, but will not add to the global registry.
988 988
  */
989
-function register_meta( $object_type, $meta_key, $args, $deprecated = null ) {
989
+function register_meta($object_type, $meta_key, $args, $deprecated = null) {
990 990
 	global $wp_meta_keys;
991 991
 
992
-	if ( ! is_array( $wp_meta_keys ) ) {
992
+	if ( ! is_array($wp_meta_keys)) {
993 993
 		$wp_meta_keys = array();
994 994
 	}
995 995
 
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 	$has_old_sanitize_cb = false;
1007 1007
 	$has_old_auth_cb = false;
1008 1008
 
1009
-	if ( is_callable( $args ) ) {
1009
+	if (is_callable($args)) {
1010 1010
 		$args = array(
1011 1011
 			'sanitize_callback' => $args,
1012 1012
 		);
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
 		$args = (array) $args;
1017 1017
 	}
1018 1018
 
1019
-	if ( is_callable( $deprecated ) ) {
1019
+	if (is_callable($deprecated)) {
1020 1020
 		$args['auth_callback'] = $deprecated;
1021 1021
 		$has_old_auth_cb = true;
1022 1022
 	}
@@ -1031,12 +1031,12 @@  discard block
 block discarded – undo
1031 1031
 	 * @param string $object_type Object type.
1032 1032
 	 * @param string $meta_key    Meta key.
1033 1033
 	 */
1034
-	$args = apply_filters( 'register_meta_args', $args, $defaults, $object_type, $meta_key );
1035
-	$args = wp_parse_args( $args, $defaults );
1034
+	$args = apply_filters('register_meta_args', $args, $defaults, $object_type, $meta_key);
1035
+	$args = wp_parse_args($args, $defaults);
1036 1036
 
1037 1037
 	// If `auth_callback` is not provided, fall back to `is_protected_meta()`.
1038
-	if ( empty( $args['auth_callback'] ) ) {
1039
-		if ( is_protected_meta( $meta_key, $object_type ) ) {
1038
+	if (empty($args['auth_callback'])) {
1039
+		if (is_protected_meta($meta_key, $object_type)) {
1040 1040
 			$args['auth_callback'] = '__return_false';
1041 1041
 		} else {
1042 1042
 			$args['auth_callback'] = '__return_true';
@@ -1044,17 +1044,17 @@  discard block
 block discarded – undo
1044 1044
 	}
1045 1045
 
1046 1046
 	// Back-compat: old sanitize and auth callbacks are applied to all of an object type.
1047
-	if ( is_callable( $args['sanitize_callback'] ) ) {
1048
-		add_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3 );
1047
+	if (is_callable($args['sanitize_callback'])) {
1048
+		add_filter("sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'], 10, 3);
1049 1049
 	}
1050 1050
 
1051
-	if ( is_callable( $args['auth_callback'] ) ) {
1052
-		add_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6 );
1051
+	if (is_callable($args['auth_callback'])) {
1052
+		add_filter("auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'], 10, 6);
1053 1053
 	}
1054 1054
 
1055 1055
 	// Global registry only contains meta keys registered with the array of arguments added in 4.6.0.
1056
-	if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb ) {
1057
-		$wp_meta_keys[ $object_type ][ $meta_key ] = $args;
1056
+	if ( ! $has_old_auth_cb && ! $has_old_sanitize_cb) {
1057
+		$wp_meta_keys[$object_type][$meta_key] = $args;
1058 1058
 
1059 1059
 		return true;
1060 1060
 	}
@@ -1072,18 +1072,18 @@  discard block
 block discarded – undo
1072 1072
  *
1073 1073
  * @return bool True if the meta key is registered to the object type. False if not.
1074 1074
  */
1075
-function registered_meta_key_exists( $object_type, $meta_key ) {
1075
+function registered_meta_key_exists($object_type, $meta_key) {
1076 1076
 	global $wp_meta_keys;
1077 1077
 
1078
-	if ( ! is_array( $wp_meta_keys ) ) {
1078
+	if ( ! is_array($wp_meta_keys)) {
1079 1079
 		return false;
1080 1080
 	}
1081 1081
 
1082
-	if ( ! isset( $wp_meta_keys[ $object_type ] ) ) {
1082
+	if ( ! isset($wp_meta_keys[$object_type])) {
1083 1083
 		return false;
1084 1084
 	}
1085 1085
 
1086
-	if ( isset( $wp_meta_keys[ $object_type ][ $meta_key ] ) ) {
1086
+	if (isset($wp_meta_keys[$object_type][$meta_key])) {
1087 1087
 		return true;
1088 1088
 	}
1089 1089
 
@@ -1099,28 +1099,28 @@  discard block
 block discarded – undo
1099 1099
  * @param string $meta_key    The meta key.
1100 1100
  * @return bool True if successful. False if the meta key was not registered.
1101 1101
  */
1102
-function unregister_meta_key( $object_type, $meta_key ) {
1102
+function unregister_meta_key($object_type, $meta_key) {
1103 1103
 	global $wp_meta_keys;
1104 1104
 
1105
-	if ( ! registered_meta_key_exists( $object_type, $meta_key ) ) {
1105
+	if ( ! registered_meta_key_exists($object_type, $meta_key)) {
1106 1106
 		return false;
1107 1107
 	}
1108 1108
 
1109
-	$args = $wp_meta_keys[ $object_type ][ $meta_key ];
1109
+	$args = $wp_meta_keys[$object_type][$meta_key];
1110 1110
 
1111
-	if ( isset( $args['sanitize_callback'] ) && is_callable( $args['sanitize_callback'] ) ) {
1112
-		remove_filter( "sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback'] );
1111
+	if (isset($args['sanitize_callback']) && is_callable($args['sanitize_callback'])) {
1112
+		remove_filter("sanitize_{$object_type}_meta_{$meta_key}", $args['sanitize_callback']);
1113 1113
 	}
1114 1114
 
1115
-	if ( isset( $args['auth_callback'] ) && is_callable( $args['auth_callback'] ) ) {
1116
-		remove_filter( "auth_{$object_type}_meta_{$meta_key}", $args['auth_callback'] );
1115
+	if (isset($args['auth_callback']) && is_callable($args['auth_callback'])) {
1116
+		remove_filter("auth_{$object_type}_meta_{$meta_key}", $args['auth_callback']);
1117 1117
 	}
1118 1118
 
1119
-	unset( $wp_meta_keys[ $object_type ][ $meta_key ] );
1119
+	unset($wp_meta_keys[$object_type][$meta_key]);
1120 1120
 
1121 1121
 	// Do some clean up
1122
-	if ( empty( $wp_meta_keys[ $object_type ] ) ) {
1123
-		unset( $wp_meta_keys[ $object_type ] );
1122
+	if (empty($wp_meta_keys[$object_type])) {
1123
+		unset($wp_meta_keys[$object_type]);
1124 1124
 	}
1125 1125
 
1126 1126
 	return true;
@@ -1134,14 +1134,14 @@  discard block
 block discarded – undo
1134 1134
  * @param string $object_type The type of object. Post, comment, user, term.
1135 1135
  * @return array List of registered meta keys.
1136 1136
  */
1137
-function get_registered_meta_keys( $object_type ) {
1137
+function get_registered_meta_keys($object_type) {
1138 1138
 	global $wp_meta_keys;
1139 1139
 
1140
-	if ( ! is_array( $wp_meta_keys ) || ! isset( $wp_meta_keys[ $object_type ] ) ) {
1140
+	if ( ! is_array($wp_meta_keys) || ! isset($wp_meta_keys[$object_type])) {
1141 1141
 		return array();
1142 1142
 	}
1143 1143
 
1144
-	return $wp_meta_keys[ $object_type ];
1144
+	return $wp_meta_keys[$object_type];
1145 1145
 }
1146 1146
 
1147 1147
 /**
@@ -1156,28 +1156,28 @@  discard block
 block discarded – undo
1156 1156
  * @return mixed A single value or array of values for a key if specified. An array of all registered keys
1157 1157
  *               and values for an object ID if not.
1158 1158
  */
1159
-function get_registered_metadata( $object_type, $object_id, $meta_key = '' ) {
1160
-	if ( ! empty( $meta_key ) ) {
1161
-		if ( ! registered_meta_key_exists( $object_type, $meta_key ) ) {
1159
+function get_registered_metadata($object_type, $object_id, $meta_key = '') {
1160
+	if ( ! empty($meta_key)) {
1161
+		if ( ! registered_meta_key_exists($object_type, $meta_key)) {
1162 1162
 			return false;
1163 1163
 		}
1164
-		$meta_keys = get_registered_meta_keys( $object_type );
1165
-		$meta_key_data = $meta_keys[ $meta_key ];
1164
+		$meta_keys = get_registered_meta_keys($object_type);
1165
+		$meta_key_data = $meta_keys[$meta_key];
1166 1166
 
1167
-		$data = get_metadata( $object_type, $object_id, $meta_key, $meta_key_data['single'] );
1167
+		$data = get_metadata($object_type, $object_id, $meta_key, $meta_key_data['single']);
1168 1168
 
1169 1169
 		return $data;
1170 1170
 	}
1171 1171
 
1172
-	$data = get_metadata( $object_type, $object_id );
1172
+	$data = get_metadata($object_type, $object_id);
1173 1173
 
1174
-	$meta_keys = get_registered_meta_keys( $object_type );
1174
+	$meta_keys = get_registered_meta_keys($object_type);
1175 1175
 	$registered_data = array();
1176 1176
 
1177 1177
 	// Someday, array_filter()
1178
-	foreach ( $meta_keys as $k => $v ) {
1179
-		if ( isset( $data[ $k ] ) ) {
1180
-			$registered_data[ $k ] = $data[ $k ];
1178
+	foreach ($meta_keys as $k => $v) {
1179
+		if (isset($data[$k])) {
1180
+			$registered_data[$k] = $data[$k];
1181 1181
 		}
1182 1182
 	}
1183 1183
 
@@ -1197,13 +1197,13 @@  discard block
 block discarded – undo
1197 1197
  *
1198 1198
  * @return array Filtered arguments.
1199 1199
  */
1200
-function _wp_register_meta_args_whitelist( $args, $default_args ) {
1201
-	$whitelist = array_keys( $default_args );
1200
+function _wp_register_meta_args_whitelist($args, $default_args) {
1201
+	$whitelist = array_keys($default_args);
1202 1202
 
1203 1203
 	// In an anonymous function world, this would be better as an array_filter()
1204
-	foreach ( $args as $key => $value ) {
1205
-		if ( ! in_array( $key, $whitelist ) ) {
1206
-			unset( $args[ $key ] );
1204
+	foreach ($args as $key => $value) {
1205
+		if ( ! in_array($key, $whitelist)) {
1206
+			unset($args[$key]);
1207 1207
 		}
1208 1208
 	}
1209 1209
 
Please login to merge, or discard this patch.
src/wp-includes/registration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
  *
5 5
  * @package WordPress
6 6
  */
7
-_deprecated_file( basename(__FILE__), '3.1.0', null, __( 'This file no longer needs to be included.' ) );
7
+_deprecated_file(basename(__FILE__), '3.1.0', null, __('This file no longer needs to be included.'));
Please login to merge, or discard this patch.
src/wp-includes/author-template.php 2 patches
Braces   +9 added lines, -6 removed lines patch added patch discarded remove patch
@@ -23,8 +23,9 @@  discard block
 block discarded – undo
23 23
 function get_the_author($deprecated = '') {
24 24
 	global $authordata;
25 25
 
26
-	if ( !empty( $deprecated ) )
27
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
26
+	if ( !empty( $deprecated ) ) {
27
+			_deprecated_argument( __FUNCTION__, '2.1.0' );
28
+	}
28 29
 
29 30
 	/**
30 31
 	 * Filters the display name of the current post's author.
@@ -131,8 +132,9 @@  discard block
 block discarded – undo
131 132
 		$authordata = get_userdata( $user_id );
132 133
 	}
133 134
 
134
-	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) )
135
-		$field = 'user_' . $field;
135
+	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) ) {
136
+			$field = 'user_' . $field;
137
+	}
136 138
 
137 139
 	$value = isset( $authordata->$field ) ? $authordata->$field : '';
138 140
 
@@ -304,8 +306,9 @@  discard block
 block discarded – undo
304 306
 	} else {
305 307
 		if ( '' == $author_nicename ) {
306 308
 			$user = get_userdata($author_id);
307
-			if ( !empty($user->user_nicename) )
308
-				$author_nicename = $user->user_nicename;
309
+			if ( !empty($user->user_nicename) ) {
310
+							$author_nicename = $user->user_nicename;
311
+			}
309 312
 		}
310 313
 		$link = str_replace('%author%', $author_nicename, $link);
311 314
 		$link = home_url( user_trailingslashit( $link ) );
Please login to merge, or discard this patch.
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
 function get_the_author($deprecated = '') {
24 24
 	global $authordata;
25 25
 
26
-	if ( !empty( $deprecated ) )
27
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
26
+	if ( ! empty($deprecated))
27
+		_deprecated_argument(__FUNCTION__, '2.1.0');
28 28
 
29 29
 	/**
30 30
 	 * Filters the display name of the current post's author.
@@ -55,21 +55,21 @@  discard block
 block discarded – undo
55 55
  * @param string $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it.
56 56
  * @return string|null The author's display name, from get_the_author().
57 57
  */
58
-function the_author( $deprecated = '', $deprecated_echo = true ) {
59
-	if ( ! empty( $deprecated ) ) {
60
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
58
+function the_author($deprecated = '', $deprecated_echo = true) {
59
+	if ( ! empty($deprecated)) {
60
+		_deprecated_argument(__FUNCTION__, '2.1.0');
61 61
 	}
62 62
 
63
-	if ( true !== $deprecated_echo ) {
64
-		_deprecated_argument( __FUNCTION__, '1.5.0',
63
+	if (true !== $deprecated_echo) {
64
+		_deprecated_argument(__FUNCTION__, '1.5.0',
65 65
 			/* translators: %s: get_the_author() */
66
-			sprintf( __( 'Use %s instead if you do not want the value echoed.' ),
66
+			sprintf(__('Use %s instead if you do not want the value echoed.'),
67 67
 				'<code>get_the_author()</code>'
68 68
 			)
69 69
 		);
70 70
 	}
71 71
 
72
-	if ( $deprecated_echo ) {
72
+	if ($deprecated_echo) {
73 73
 		echo get_the_author();
74 74
 	}
75 75
 
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
  * @return string|void The author's display name.
85 85
  */
86 86
 function get_the_modified_author() {
87
-	if ( $last_id = get_post_meta( get_post()->ID, '_edit_last', true) ) {
87
+	if ($last_id = get_post_meta(get_post()->ID, '_edit_last', true)) {
88 88
 		$last_user = get_userdata($last_id);
89 89
 
90 90
 		/**
@@ -121,20 +121,20 @@  discard block
 block discarded – undo
121 121
  * @param int $user_id Optional. User ID.
122 122
  * @return string The author's field from the current author's DB object.
123 123
  */
124
-function get_the_author_meta( $field = '', $user_id = false ) {
124
+function get_the_author_meta($field = '', $user_id = false) {
125 125
 	$original_user_id = $user_id;
126 126
 
127
-	if ( ! $user_id ) {
127
+	if ( ! $user_id) {
128 128
 		global $authordata;
129
-		$user_id = isset( $authordata->ID ) ? $authordata->ID : 0;
129
+		$user_id = isset($authordata->ID) ? $authordata->ID : 0;
130 130
 	} else {
131
-		$authordata = get_userdata( $user_id );
131
+		$authordata = get_userdata($user_id);
132 132
 	}
133 133
 
134
-	if ( in_array( $field, array( 'login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status' ) ) )
135
-		$field = 'user_' . $field;
134
+	if (in_array($field, array('login', 'pass', 'nicename', 'email', 'url', 'registered', 'activation_key', 'status')))
135
+		$field = 'user_'.$field;
136 136
 
137
-	$value = isset( $authordata->$field ) ? $authordata->$field : '';
137
+	$value = isset($authordata->$field) ? $authordata->$field : '';
138 138
 
139 139
 	/**
140 140
 	 * Filters the value of the requested user metadata.
@@ -148,7 +148,7 @@  discard block
 block discarded – undo
148 148
 	 * @param int      $user_id          The user ID for the value.
149 149
 	 * @param int|bool $original_user_id The original user ID, as passed to the function.
150 150
 	 */
151
-	return apply_filters( "get_the_author_{$field}", $value, $user_id, $original_user_id );
151
+	return apply_filters("get_the_author_{$field}", $value, $user_id, $original_user_id);
152 152
 }
153 153
 
154 154
 /**
@@ -161,8 +161,8 @@  discard block
 block discarded – undo
161 161
  * @param string $field selects the field of the users record.
162 162
  * @param int $user_id Optional. User ID.
163 163
  */
164
-function the_author_meta( $field = '', $user_id = false ) {
165
-	$author_meta = get_the_author_meta( $field, $user_id );
164
+function the_author_meta($field = '', $user_id = false) {
165
+	$author_meta = get_the_author_meta($field, $user_id);
166 166
 
167 167
 	/**
168 168
 	 * The value of the requested user metadata.
@@ -174,7 +174,7 @@  discard block
 block discarded – undo
174 174
 	 * @param string $author_meta The value of the metadata.
175 175
 	 * @param int    $user_id     The user ID.
176 176
 	 */
177
-	echo apply_filters( "the_author_{$field}", $author_meta, $user_id );
177
+	echo apply_filters("the_author_{$field}", $author_meta, $user_id);
178 178
 }
179 179
 
180 180
 /**
@@ -189,11 +189,11 @@  discard block
 block discarded – undo
189 189
  *                     else the result of get_the_author().
190 190
  */
191 191
 function get_the_author_link() {
192
-	if ( get_the_author_meta('url') ) {
193
-		return sprintf( '<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
194
-			esc_url( get_the_author_meta('url') ),
192
+	if (get_the_author_meta('url')) {
193
+		return sprintf('<a href="%1$s" title="%2$s" rel="author external">%3$s</a>',
194
+			esc_url(get_the_author_meta('url')),
195 195
 			/* translators: %s: author's display name */
196
-			esc_attr( sprintf( __( 'Visit %s&#8217;s website' ), get_the_author() ) ),
196
+			esc_attr(sprintf(__('Visit %s&#8217;s website'), get_the_author())),
197 197
 			get_the_author()
198 198
 		);
199 199
 	} else {
@@ -224,10 +224,10 @@  discard block
 block discarded – undo
224 224
  */
225 225
 function get_the_author_posts() {
226 226
 	$post = get_post();
227
-	if ( ! $post ) {
227
+	if ( ! $post) {
228 228
 		return 0;
229 229
 	}
230
-	return count_user_posts( $post->post_author, $post->post_type );
230
+	return count_user_posts($post->post_author, $post->post_type);
231 231
 }
232 232
 
233 233
 /**
@@ -253,14 +253,14 @@  discard block
 block discarded – undo
253 253
  */
254 254
 function get_the_author_posts_link() {
255 255
 	global $authordata;
256
-	if ( ! is_object( $authordata ) ) {
256
+	if ( ! is_object($authordata)) {
257 257
 		return;
258 258
 	}
259 259
 
260
-	$link = sprintf( '<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
261
-		esc_url( get_author_posts_url( $authordata->ID, $authordata->user_nicename ) ),
260
+	$link = sprintf('<a href="%1$s" title="%2$s" rel="author">%3$s</a>',
261
+		esc_url(get_author_posts_url($authordata->ID, $authordata->user_nicename)),
262 262
 		/* translators: %s: author's display name */
263
-		esc_attr( sprintf( __( 'Posts by %s' ), get_the_author() ) ),
263
+		esc_attr(sprintf(__('Posts by %s'), get_the_author())),
264 264
 		get_the_author()
265 265
 	);
266 266
 
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 	 *
272 272
 	 * @param string $link HTML link.
273 273
 	 */
274
-	return apply_filters( 'the_author_posts_link', $link );
274
+	return apply_filters('the_author_posts_link', $link);
275 275
 }
276 276
 
277 277
 /**
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
  *
283 283
  * @param string $deprecated Unused.
284 284
  */
285
-function the_author_posts_link( $deprecated = '' ) {
286
-	if ( ! empty( $deprecated ) ) {
287
-		_deprecated_argument( __FUNCTION__, '2.1.0' );
285
+function the_author_posts_link($deprecated = '') {
286
+	if ( ! empty($deprecated)) {
287
+		_deprecated_argument(__FUNCTION__, '2.1.0');
288 288
 	}
289 289
 	echo get_the_author_posts_link();
290 290
 }
@@ -300,22 +300,22 @@  discard block
 block discarded – undo
300 300
  * @param string $author_nicename Optional. The author's nicename (slug). Default empty.
301 301
  * @return string The URL to the author's page.
302 302
  */
303
-function get_author_posts_url( $author_id, $author_nicename = '' ) {
303
+function get_author_posts_url($author_id, $author_nicename = '') {
304 304
 	global $wp_rewrite;
305 305
 	$auth_ID = (int) $author_id;
306 306
 	$link = $wp_rewrite->get_author_permastruct();
307 307
 
308
-	if ( empty($link) ) {
309
-		$file = home_url( '/' );
310
-		$link = $file . '?author=' . $auth_ID;
308
+	if (empty($link)) {
309
+		$file = home_url('/');
310
+		$link = $file.'?author='.$auth_ID;
311 311
 	} else {
312
-		if ( '' == $author_nicename ) {
312
+		if ('' == $author_nicename) {
313 313
 			$user = get_userdata($author_id);
314
-			if ( !empty($user->user_nicename) )
314
+			if ( ! empty($user->user_nicename))
315 315
 				$author_nicename = $user->user_nicename;
316 316
 		}
317 317
 		$link = str_replace('%author%', $author_nicename, $link);
318
-		$link = home_url( user_trailingslashit( $link ) );
318
+		$link = home_url(user_trailingslashit($link));
319 319
 	}
320 320
 
321 321
 	/**
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
 	 * @param int    $author_id       The author's id.
328 328
 	 * @param string $author_nicename The author's nice name.
329 329
 	 */
330
-	$link = apply_filters( 'author_link', $link, $author_id, $author_nicename );
330
+	$link = apply_filters('author_link', $link, $author_id, $author_nicename);
331 331
 
332 332
 	return $link;
333 333
 }
@@ -367,7 +367,7 @@  discard block
 block discarded – undo
367 367
  * }
368 368
  * @return string|void The output, if echo is set to false.
369 369
  */
370
-function wp_list_authors( $args = '' ) {
370
+function wp_list_authors($args = '') {
371 371
 	global $wpdb;
372 372
 
373 373
 	$defaults = array(
@@ -378,94 +378,94 @@  discard block
 block discarded – undo
378 378
 		'style' => 'list', 'html' => true, 'exclude' => '', 'include' => ''
379 379
 	);
380 380
 
381
-	$args = wp_parse_args( $args, $defaults );
381
+	$args = wp_parse_args($args, $defaults);
382 382
 
383 383
 	$return = '';
384 384
 
385
-	$query_args = wp_array_slice_assoc( $args, array( 'orderby', 'order', 'number', 'exclude', 'include' ) );
385
+	$query_args = wp_array_slice_assoc($args, array('orderby', 'order', 'number', 'exclude', 'include'));
386 386
 	$query_args['fields'] = 'ids';
387
-	$authors = get_users( $query_args );
387
+	$authors = get_users($query_args);
388 388
 
389 389
 	$author_count = array();
390
-	foreach ( (array) $wpdb->get_results( "SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE " . get_private_posts_cap_sql( 'post' ) . " GROUP BY post_author" ) as $row ) {
390
+	foreach ((array) $wpdb->get_results("SELECT DISTINCT post_author, COUNT(ID) AS count FROM $wpdb->posts WHERE ".get_private_posts_cap_sql('post')." GROUP BY post_author") as $row) {
391 391
 		$author_count[$row->post_author] = $row->count;
392 392
 	}
393
-	foreach ( $authors as $author_id ) {
394
-		$author = get_userdata( $author_id );
393
+	foreach ($authors as $author_id) {
394
+		$author = get_userdata($author_id);
395 395
 
396
-		if ( $args['exclude_admin'] && 'admin' == $author->display_name ) {
396
+		if ($args['exclude_admin'] && 'admin' == $author->display_name) {
397 397
 			continue;
398 398
 		}
399 399
 
400
-		$posts = isset( $author_count[$author->ID] ) ? $author_count[$author->ID] : 0;
400
+		$posts = isset($author_count[$author->ID]) ? $author_count[$author->ID] : 0;
401 401
 
402
-		if ( ! $posts && $args['hide_empty'] ) {
402
+		if ( ! $posts && $args['hide_empty']) {
403 403
 			continue;
404 404
 		}
405 405
 
406
-		if ( $args['show_fullname'] && $author->first_name && $author->last_name ) {
406
+		if ($args['show_fullname'] && $author->first_name && $author->last_name) {
407 407
 			$name = "$author->first_name $author->last_name";
408 408
 		} else {
409 409
 			$name = $author->display_name;
410 410
 		}
411 411
 
412
-		if ( ! $args['html'] ) {
413
-			$return .= $name . ', ';
412
+		if ( ! $args['html']) {
413
+			$return .= $name.', ';
414 414
 
415 415
 			continue; // No need to go further to process HTML.
416 416
 		}
417 417
 
418
-		if ( 'list' == $args['style'] ) {
418
+		if ('list' == $args['style']) {
419 419
 			$return .= '<li>';
420 420
 		}
421 421
 
422
-		$link = sprintf( '<a href="%1$s" title="%2$s">%3$s</a>',
423
-			get_author_posts_url( $author->ID, $author->user_nicename ),
422
+		$link = sprintf('<a href="%1$s" title="%2$s">%3$s</a>',
423
+			get_author_posts_url($author->ID, $author->user_nicename),
424 424
 			/* translators: %s: author's display name */
425
-			esc_attr( sprintf( __( 'Posts by %s' ), $author->display_name ) ),
425
+			esc_attr(sprintf(__('Posts by %s'), $author->display_name)),
426 426
 			$name
427 427
 		);
428 428
 
429
-		if ( ! empty( $args['feed_image'] ) || ! empty( $args['feed'] ) ) {
429
+		if ( ! empty($args['feed_image']) || ! empty($args['feed'])) {
430 430
 			$link .= ' ';
431
-			if ( empty( $args['feed_image'] ) ) {
431
+			if (empty($args['feed_image'])) {
432 432
 				$link .= '(';
433 433
 			}
434 434
 
435
-			$link .= '<a href="' . get_author_feed_link( $author->ID, $args['feed_type'] ) . '"';
435
+			$link .= '<a href="'.get_author_feed_link($author->ID, $args['feed_type']).'"';
436 436
 
437 437
 			$alt = '';
438
-			if ( ! empty( $args['feed'] ) ) {
439
-				$alt = ' alt="' . esc_attr( $args['feed'] ) . '"';
438
+			if ( ! empty($args['feed'])) {
439
+				$alt = ' alt="'.esc_attr($args['feed']).'"';
440 440
 				$name = $args['feed'];
441 441
 			}
442 442
 
443 443
 			$link .= '>';
444 444
 
445
-			if ( ! empty( $args['feed_image'] ) ) {
446
-				$link .= '<img src="' . esc_url( $args['feed_image'] ) . '" style="border: none;"' . $alt . ' />';
445
+			if ( ! empty($args['feed_image'])) {
446
+				$link .= '<img src="'.esc_url($args['feed_image']).'" style="border: none;"'.$alt.' />';
447 447
 			} else {
448 448
 				$link .= $name;
449 449
 			}
450 450
 
451 451
 			$link .= '</a>';
452 452
 
453
-			if ( empty( $args['feed_image'] ) ) {
453
+			if (empty($args['feed_image'])) {
454 454
 				$link .= ')';
455 455
 			}
456 456
 		}
457 457
 
458
-		if ( $args['optioncount'] ) {
459
-			$link .= ' ('. $posts . ')';
458
+		if ($args['optioncount']) {
459
+			$link .= ' ('.$posts.')';
460 460
 		}
461 461
 
462 462
 		$return .= $link;
463
-		$return .= ( 'list' == $args['style'] ) ? '</li>' : ', ';
463
+		$return .= ('list' == $args['style']) ? '</li>' : ', ';
464 464
 	}
465 465
 
466
-	$return = rtrim( $return, ', ' );
466
+	$return = rtrim($return, ', ');
467 467
 
468
-	if ( ! $args['echo'] ) {
468
+	if ( ! $args['echo']) {
469 469
 		return $return;
470 470
 	}
471 471
 	echo $return;
@@ -485,10 +485,10 @@  discard block
 block discarded – undo
485 485
 function is_multi_author() {
486 486
 	global $wpdb;
487 487
 
488
-	if ( false === ( $is_multi_author = get_transient( 'is_multi_author' ) ) ) {
488
+	if (false === ($is_multi_author = get_transient('is_multi_author'))) {
489 489
 		$rows = (array) $wpdb->get_col("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' LIMIT 2");
490
-		$is_multi_author = 1 < count( $rows ) ? 1 : 0;
491
-		set_transient( 'is_multi_author', $is_multi_author );
490
+		$is_multi_author = 1 < count($rows) ? 1 : 0;
491
+		set_transient('is_multi_author', $is_multi_author);
492 492
 	}
493 493
 
494 494
 	/**
@@ -498,7 +498,7 @@  discard block
 block discarded – undo
498 498
 	 *
499 499
 	 * @param bool $is_multi_author Whether $is_multi_author should evaluate as true.
500 500
 	 */
501
-	return apply_filters( 'is_multi_author', (bool) $is_multi_author );
501
+	return apply_filters('is_multi_author', (bool) $is_multi_author);
502 502
 }
503 503
 
504 504
 /**
@@ -509,5 +509,5 @@  discard block
 block discarded – undo
509 509
  * @private
510 510
  */
511 511
 function __clear_multi_author_cache() {
512
-	delete_transient( 'is_multi_author' );
512
+	delete_transient('is_multi_author');
513 513
 }
Please login to merge, or discard this patch.
src/wp-includes/registration-functions.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -4,4 +4,4 @@
 block discarded – undo
4 4
  *
5 5
  * @package WordPress
6 6
  */
7
-_deprecated_file( basename(__FILE__), '2.1.0', null, __( 'This file no longer needs to be included.' ) );
7
+_deprecated_file(basename(__FILE__), '2.1.0', null, __('This file no longer needs to be included.'));
Please login to merge, or discard this patch.