Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-includes/post.php 4 patches
Doc Comments   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -383,7 +383,7 @@  discard block
 block discarded – undo
383 383
  * @since 1.0.0
384 384
  *
385 385
  * @param string $post Post content.
386
- * @return array Post before ('main'), after ('extended'), and custom readmore ('more_text').
386
+ * @return integer Post before ('main'), after ('extended'), and custom readmore ('more_text').
387 387
  */
388 388
 function get_extended( $post ) {
389 389
 	//Match the new style more links.
@@ -652,7 +652,7 @@  discard block
 block discarded – undo
652 652
 	 * @global wpdb $wpdb
653 653
 	 *
654 654
 	 * @param int $post_id Post ID.
655
-	 * @return WP_Post|false Post object, false otherwise.
655
+	 * @return string Post object, false otherwise.
656 656
 	 */
657 657
 	public static function get_instance( $post_id ) {
658 658
 		global $wpdb;
@@ -1956,7 +1956,7 @@  discard block
 block discarded – undo
1956 1956
  *
1957 1957
  * @param int    $post_id    Post ID.
1958 1958
  * @param string $meta_key   Metadata name.
1959
- * @param mixed  $meta_value Optional. Metadata value. Must be serializable if
1959
+ * @param string  $meta_value Optional. Metadata value. Must be serializable if
1960 1960
  *                           non-scalar. Default empty.
1961 1961
  * @return bool True on success, false on failure.
1962 1962
  */
@@ -2863,7 +2863,7 @@  discard block
 block discarded – undo
2863 2863
  *
2864 2864
  * @global wpdb $wpdb WordPress database abstraction object.
2865 2865
  *
2866
- * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2866
+ * @param integer $post Optional. Post ID or post object. Defaults to global $post.
2867 2867
  * @return mixed|void False on failure.
2868 2868
  */
2869 2869
 function wp_trash_post_comments( $post = null ) {
@@ -2919,8 +2919,8 @@  discard block
 block discarded – undo
2919 2919
  *
2920 2920
  * @global wpdb $wpdb
2921 2921
  *
2922
- * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2923
- * @return true|void
2922
+ * @param integer $post Optional. Post ID or post object. Defaults to global $post.
2923
+ * @return null|boolean
2924 2924
  */
2925 2925
 function wp_untrash_post_comments( $post = null ) {
2926 2926
 	global $wpdb;
@@ -5180,7 +5180,7 @@  discard block
 block discarded – undo
5180 5180
  * @since 4.2.0
5181 5181
  *
5182 5182
  * @param string      $type    Attachment type. Accepts 'image', 'audio', or 'video'.
5183
- * @param int|WP_Post $post_id Optional. Attachment ID. Default 0.
5183
+ * @param integer $post_id Optional. Attachment ID. Default 0.
5184 5184
  * @return bool True if one of the accepted types, false otherwise.
5185 5185
  */
5186 5186
 function wp_attachment_is( $type, $post_id = 0 ) {
@@ -5230,7 +5230,7 @@  discard block
 block discarded – undo
5230 5230
  * @since 4.2.0 Modified into wrapper for wp_attachment_is() and
5231 5231
  *              allowed WP_Post object to be passed.
5232 5232
  *
5233
- * @param int|WP_Post $post Optional. Attachment ID. Default 0.
5233
+ * @param integer $post Optional. Attachment ID. Default 0.
5234 5234
  * @return bool Whether the attachment is an image.
5235 5235
  */
5236 5236
 function wp_attachment_is_image( $post = 0 ) {
@@ -5242,7 +5242,7 @@  discard block
 block discarded – undo
5242 5242
  *
5243 5243
  * @since 2.1.0
5244 5244
  *
5245
- * @param string|int $mime MIME type or attachment ID.
5245
+ * @param integer $mime MIME type or attachment ID.
5246 5246
  * @return string|false Icon, false otherwise.
5247 5247
  */
5248 5248
 function wp_mime_type_icon( $mime = 0 ) {
@@ -5976,7 +5976,7 @@  discard block
 block discarded – undo
5976 5976
  *
5977 5977
  * @since 3.3.0
5978 5978
  *
5979
- * @param int|WP_Post $post Post ID or post object where thumbnail should be removed from.
5979
+ * @param integer $post Post ID or post object where thumbnail should be removed from.
5980 5980
  * @return bool True on success, false on failure.
5981 5981
  */
5982 5982
 function delete_post_thumbnail( $post ) {
Please login to merge, or discard this patch.
Switch Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -5208,18 +5208,18 @@
 block discarded – undo
5208 5208
 	}
5209 5209
 
5210 5210
 	switch ( $type ) {
5211
-	case 'image':
5212
-		$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
5213
-		return in_array( $ext, $image_exts );
5211
+		case 'image':
5212
+			$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
5213
+			return in_array( $ext, $image_exts );
5214 5214
 
5215
-	case 'audio':
5216
-		return in_array( $ext, wp_get_audio_extensions() );
5215
+		case 'audio':
5216
+			return in_array( $ext, wp_get_audio_extensions() );
5217 5217
 
5218
-	case 'video':
5219
-		return in_array( $ext, wp_get_video_extensions() );
5218
+		case 'video':
5219
+			return in_array( $ext, wp_get_video_extensions() );
5220 5220
 
5221
-	default:
5222
-		return $type === $ext;
5221
+		default:
5222
+			return $type === $ext;
5223 5223
 	}
5224 5224
 }
5225 5225
 
Please login to merge, or discard this patch.
Spacing   +1198 added lines, -1198 removed lines patch added patch discarded remove patch
@@ -17,9 +17,9 @@  discard block
 block discarded – undo
17 17
  * @since 2.9.0
18 18
  */
19 19
 function create_initial_post_types() {
20
-	register_post_type( 'post', array(
20
+	register_post_type('post', array(
21 21
 		'labels' => array(
22
-			'name_admin_bar' => _x( 'Post', 'add new on admin bar' ),
22
+			'name_admin_bar' => _x('Post', 'add new on admin bar'),
23 23
 		),
24 24
 		'public'  => true,
25 25
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
 		'rewrite' => false,
31 31
 		'query_var' => false,
32 32
 		'delete_with_user' => true,
33
-		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats' ),
34
-	) );
33
+		'supports' => array('title', 'editor', 'author', 'thumbnail', 'excerpt', 'trackbacks', 'custom-fields', 'comments', 'revisions', 'post-formats'),
34
+	));
35 35
 
36
-	register_post_type( 'page', array(
36
+	register_post_type('page', array(
37 37
 		'labels' => array(
38
-			'name_admin_bar' => _x( 'Page', 'add new on admin bar' ),
38
+			'name_admin_bar' => _x('Page', 'add new on admin bar'),
39 39
 		),
40 40
 		'public' => true,
41 41
 		'publicly_queryable' => false,
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 		'rewrite' => false,
48 48
 		'query_var' => false,
49 49
 		'delete_with_user' => true,
50
-		'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions' ),
51
-	) );
50
+		'supports' => array('title', 'editor', 'author', 'thumbnail', 'page-attributes', 'custom-fields', 'comments', 'revisions'),
51
+	));
52 52
 
53
-	register_post_type( 'attachment', array(
53
+	register_post_type('attachment', array(
54 54
 		'labels' => array(
55 55
 			'name' => _x('Media', 'post type general name'),
56
-			'name_admin_bar' => _x( 'Media', 'add new from admin bar' ),
57
-			'add_new' => _x( 'Add New', 'add new media' ),
58
- 			'edit_item' => __( 'Edit Media' ),
59
- 			'view_item' => __( 'View Attachment Page' ),
56
+			'name_admin_bar' => _x('Media', 'add new from admin bar'),
57
+			'add_new' => _x('Add New', 'add new media'),
58
+ 			'edit_item' => __('Edit Media'),
59
+ 			'view_item' => __('View Attachment Page'),
60 60
 		),
61 61
 		'public' => true,
62 62
 		'show_ui' => true,
@@ -72,15 +72,15 @@  discard block
 block discarded – undo
72 72
 		'query_var' => false,
73 73
 		'show_in_nav_menus' => false,
74 74
 		'delete_with_user' => true,
75
-		'supports' => array( 'title', 'author', 'comments' ),
76
-	) );
77
-	add_post_type_support( 'attachment:audio', 'thumbnail' );
78
-	add_post_type_support( 'attachment:video', 'thumbnail' );
75
+		'supports' => array('title', 'author', 'comments'),
76
+	));
77
+	add_post_type_support('attachment:audio', 'thumbnail');
78
+	add_post_type_support('attachment:video', 'thumbnail');
79 79
 
80
-	register_post_type( 'revision', array(
80
+	register_post_type('revision', array(
81 81
 		'labels' => array(
82
-			'name' => __( 'Revisions' ),
83
-			'singular_name' => __( 'Revision' ),
82
+			'name' => __('Revisions'),
83
+			'singular_name' => __('Revision'),
84 84
 		),
85 85
 		'public' => false,
86 86
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -92,13 +92,13 @@  discard block
 block discarded – undo
92 92
 		'query_var' => false,
93 93
 		'can_export' => false,
94 94
 		'delete_with_user' => true,
95
-		'supports' => array( 'author' ),
96
-	) );
95
+		'supports' => array('author'),
96
+	));
97 97
 
98
-	register_post_type( 'nav_menu_item', array(
98
+	register_post_type('nav_menu_item', array(
99 99
 		'labels' => array(
100
-			'name' => __( 'Navigation Menu Items' ),
101
-			'singular_name' => __( 'Navigation Menu Item' ),
100
+			'name' => __('Navigation Menu Items'),
101
+			'singular_name' => __('Navigation Menu Item'),
102 102
 		),
103 103
 		'public' => false,
104 104
 		'_builtin' => true, /* internal use only. don't use this when registering your own post type. */
@@ -106,63 +106,63 @@  discard block
 block discarded – undo
106 106
 		'rewrite' => false,
107 107
 		'delete_with_user' => false,
108 108
 		'query_var' => false,
109
-	) );
109
+	));
110 110
 
111
-	register_post_status( 'publish', array(
112
-		'label'       => _x( 'Published', 'post' ),
111
+	register_post_status('publish', array(
112
+		'label'       => _x('Published', 'post'),
113 113
 		'public'      => true,
114 114
 		'_builtin'    => true, /* internal use only. */
115
-		'label_count' => _n_noop( 'Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>' ),
116
-	) );
115
+		'label_count' => _n_noop('Published <span class="count">(%s)</span>', 'Published <span class="count">(%s)</span>'),
116
+	));
117 117
 
118
-	register_post_status( 'future', array(
119
-		'label'       => _x( 'Scheduled', 'post' ),
118
+	register_post_status('future', array(
119
+		'label'       => _x('Scheduled', 'post'),
120 120
 		'protected'   => true,
121 121
 		'_builtin'    => true, /* internal use only. */
122
-		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>' ),
123
-	) );
122
+		'label_count' => _n_noop('Scheduled <span class="count">(%s)</span>', 'Scheduled <span class="count">(%s)</span>'),
123
+	));
124 124
 
125
-	register_post_status( 'draft', array(
126
-		'label'       => _x( 'Draft', 'post' ),
125
+	register_post_status('draft', array(
126
+		'label'       => _x('Draft', 'post'),
127 127
 		'protected'   => true,
128 128
 		'_builtin'    => true, /* internal use only. */
129
-		'label_count' => _n_noop( 'Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>' ),
130
-	) );
129
+		'label_count' => _n_noop('Draft <span class="count">(%s)</span>', 'Drafts <span class="count">(%s)</span>'),
130
+	));
131 131
 
132
-	register_post_status( 'pending', array(
133
-		'label'       => _x( 'Pending', 'post' ),
132
+	register_post_status('pending', array(
133
+		'label'       => _x('Pending', 'post'),
134 134
 		'protected'   => true,
135 135
 		'_builtin'    => true, /* internal use only. */
136
-		'label_count' => _n_noop( 'Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>' ),
137
-	) );
136
+		'label_count' => _n_noop('Pending <span class="count">(%s)</span>', 'Pending <span class="count">(%s)</span>'),
137
+	));
138 138
 
139
-	register_post_status( 'private', array(
140
-		'label'       => _x( 'Private', 'post' ),
139
+	register_post_status('private', array(
140
+		'label'       => _x('Private', 'post'),
141 141
 		'private'     => true,
142 142
 		'_builtin'    => true, /* internal use only. */
143
-		'label_count' => _n_noop( 'Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>' ),
144
-	) );
143
+		'label_count' => _n_noop('Private <span class="count">(%s)</span>', 'Private <span class="count">(%s)</span>'),
144
+	));
145 145
 
146
-	register_post_status( 'trash', array(
147
-		'label'       => _x( 'Trash', 'post' ),
146
+	register_post_status('trash', array(
147
+		'label'       => _x('Trash', 'post'),
148 148
 		'internal'    => true,
149 149
 		'_builtin'    => true, /* internal use only. */
150
-		'label_count' => _n_noop( 'Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>' ),
150
+		'label_count' => _n_noop('Trash <span class="count">(%s)</span>', 'Trash <span class="count">(%s)</span>'),
151 151
 		'show_in_admin_status_list' => true,
152
-	) );
152
+	));
153 153
 
154
-	register_post_status( 'auto-draft', array(
154
+	register_post_status('auto-draft', array(
155 155
 		'label'    => 'auto-draft',
156 156
 		'internal' => true,
157 157
 		'_builtin' => true, /* internal use only. */
158
-	) );
158
+	));
159 159
 
160
-	register_post_status( 'inherit', array(
160
+	register_post_status('inherit', array(
161 161
 		'label'    => 'inherit',
162 162
 		'internal' => true,
163 163
 		'_builtin' => true, /* internal use only. */
164 164
 		'exclude_from_search' => false,
165
-	) );
165
+	));
166 166
 }
167 167
 
168 168
 /**
@@ -183,12 +183,12 @@  discard block
 block discarded – undo
183 183
  * @param bool $unfiltered    Optional. Whether to apply filters. Default false.
184 184
  * @return string|false The file path to where the attached file should be, false otherwise.
185 185
  */
186
-function get_attached_file( $attachment_id, $unfiltered = false ) {
187
-	$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
186
+function get_attached_file($attachment_id, $unfiltered = false) {
187
+	$file = get_post_meta($attachment_id, '_wp_attached_file', true);
188 188
 	// If the file is relative, prepend upload dir.
189
-	if ( $file && 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
190
-		$file = $uploads['basedir'] . "/$file";
191
-	if ( $unfiltered )
189
+	if ($file && 0 !== strpos($file, '/') && ! preg_match('|^.:\\\|', $file) && (($uploads = wp_upload_dir()) && false === $uploads['error']))
190
+		$file = $uploads['basedir']."/$file";
191
+	if ($unfiltered)
192 192
 		return $file;
193 193
 
194 194
 	/**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
 	 * @param string $file          Path to attached file.
200 200
 	 * @param int    $attachment_id Attachment ID.
201 201
 	 */
202
-	return apply_filters( 'get_attached_file', $file, $attachment_id );
202
+	return apply_filters('get_attached_file', $file, $attachment_id);
203 203
 }
204 204
 
205 205
 /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
  * @param string $file          File path for the attachment.
215 215
  * @return bool True on success, false on failure.
216 216
  */
217
-function update_attached_file( $attachment_id, $file ) {
218
-	if ( !get_post( $attachment_id ) )
217
+function update_attached_file($attachment_id, $file) {
218
+	if ( ! get_post($attachment_id))
219 219
 		return false;
220 220
 
221 221
 	/**
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 	 * @param string $file          Path to the attached file to update.
227 227
 	 * @param int    $attachment_id Attachment ID.
228 228
 	 */
229
-	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
229
+	$file = apply_filters('update_attached_file', $file, $attachment_id);
230 230
 
231
-	if ( $file = _wp_relative_upload_path( $file ) )
232
-		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
231
+	if ($file = _wp_relative_upload_path($file))
232
+		return update_post_meta($attachment_id, '_wp_attached_file', $file);
233 233
 	else
234
-		return delete_post_meta( $attachment_id, '_wp_attached_file' );
234
+		return delete_post_meta($attachment_id, '_wp_attached_file');
235 235
 }
236 236
 
237 237
 /**
@@ -244,13 +244,13 @@  discard block
 block discarded – undo
244 244
  * @param string $path Full path to the file.
245 245
  * @return string Relative path on success, unchanged path on failure.
246 246
  */
247
-function _wp_relative_upload_path( $path ) {
247
+function _wp_relative_upload_path($path) {
248 248
 	$new_path = $path;
249 249
 
250 250
 	$uploads = wp_upload_dir();
251
-	if ( 0 === strpos( $new_path, $uploads['basedir'] ) ) {
252
-			$new_path = str_replace( $uploads['basedir'], '', $new_path );
253
-			$new_path = ltrim( $new_path, '/' );
251
+	if (0 === strpos($new_path, $uploads['basedir'])) {
252
+			$new_path = str_replace($uploads['basedir'], '', $new_path);
253
+			$new_path = ltrim($new_path, '/');
254 254
 	}
255 255
 
256 256
 	/**
@@ -261,7 +261,7 @@  discard block
 block discarded – undo
261 261
 	 * @param string $new_path Relative path to the file.
262 262
 	 * @param string $path     Full path to the file.
263 263
 	 */
264
-	return apply_filters( '_wp_relative_upload_path', $new_path, $path );
264
+	return apply_filters('_wp_relative_upload_path', $new_path, $path);
265 265
 }
266 266
 
267 267
 /**
@@ -316,17 +316,17 @@  discard block
 block discarded – undo
316 316
  * @return array Array of children, where the type of each element is determined by $output parameter.
317 317
  *               Empty array on failure.
318 318
  */
319
-function get_children( $args = '', $output = OBJECT ) {
319
+function get_children($args = '', $output = OBJECT) {
320 320
 	$kids = array();
321
-	if ( empty( $args ) ) {
322
-		if ( isset( $GLOBALS['post'] ) ) {
323
-			$args = array('post_parent' => (int) $GLOBALS['post']->post_parent );
321
+	if (empty($args)) {
322
+		if (isset($GLOBALS['post'])) {
323
+			$args = array('post_parent' => (int) $GLOBALS['post']->post_parent);
324 324
 		} else {
325 325
 			return $kids;
326 326
 		}
327
-	} elseif ( is_object( $args ) ) {
328
-		$args = array('post_parent' => (int) $args->post_parent );
329
-	} elseif ( is_numeric( $args ) ) {
327
+	} elseif (is_object($args)) {
328
+		$args = array('post_parent' => (int) $args->post_parent);
329
+	} elseif (is_numeric($args)) {
330 330
 		$args = array('post_parent' => (int) $args);
331 331
 	}
332 332
 
@@ -335,32 +335,32 @@  discard block
 block discarded – undo
335 335
 		'post_status' => 'any', 'post_parent' => 0,
336 336
 	);
337 337
 
338
-	$r = wp_parse_args( $args, $defaults );
338
+	$r = wp_parse_args($args, $defaults);
339 339
 
340
-	$children = get_posts( $r );
340
+	$children = get_posts($r);
341 341
 
342
-	if ( ! $children )
342
+	if ( ! $children)
343 343
 		return $kids;
344 344
 
345
-	if ( ! empty( $r['fields'] ) )
345
+	if ( ! empty($r['fields']))
346 346
 		return $children;
347 347
 
348 348
 	update_post_cache($children);
349 349
 
350
-	foreach ( $children as $key => $child )
350
+	foreach ($children as $key => $child)
351 351
 		$kids[$child->ID] = $children[$key];
352 352
 
353
-	if ( $output == OBJECT ) {
353
+	if ($output == OBJECT) {
354 354
 		return $kids;
355
-	} elseif ( $output == ARRAY_A ) {
355
+	} elseif ($output == ARRAY_A) {
356 356
 		$weeuns = array();
357
-		foreach ( (array) $kids as $kid ) {
357
+		foreach ((array) $kids as $kid) {
358 358
 			$weeuns[$kid->ID] = get_object_vars($kids[$kid->ID]);
359 359
 		}
360 360
 		return $weeuns;
361
-	} elseif ( $output == ARRAY_N ) {
361
+	} elseif ($output == ARRAY_N) {
362 362
 		$babes = array();
363
-		foreach ( (array) $kids as $kid ) {
363
+		foreach ((array) $kids as $kid) {
364 364
 			$babes[$kid->ID] = array_values(get_object_vars($kids[$kid->ID]));
365 365
 		}
366 366
 		return $babes;
@@ -385,9 +385,9 @@  discard block
 block discarded – undo
385 385
  * @param string $post Post content.
386 386
  * @return array Post before ('main'), after ('extended'), and custom readmore ('more_text').
387 387
  */
388
-function get_extended( $post ) {
388
+function get_extended($post) {
389 389
 	//Match the new style more links.
390
-	if ( preg_match('/<!--more(.*?)?-->/', $post, $matches) ) {
390
+	if (preg_match('/<!--more(.*?)?-->/', $post, $matches)) {
391 391
 		list($main, $extended) = explode($matches[0], $post, 2);
392 392
 		$more_text = $matches[1];
393 393
 	} else {
@@ -401,7 +401,7 @@  discard block
 block discarded – undo
401 401
 	$extended = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $extended);
402 402
 	$more_text = preg_replace('/^[\s]*(.*)[\s]*$/', '\\1', $more_text);
403 403
 
404
-	return array( 'main' => $main, 'extended' => $extended, 'more_text' => $more_text );
404
+	return array('main' => $main, 'extended' => $extended, 'more_text' => $more_text);
405 405
 }
406 406
 
407 407
 /**
@@ -422,34 +422,34 @@  discard block
 block discarded – undo
422 422
  * @return WP_Post|array|null Type corresponding to $output on success or null on failure.
423 423
  *                            When $output is OBJECT, a `WP_Post` instance is returned.
424 424
  */
425
-function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
426
-	if ( empty( $post ) && isset( $GLOBALS['post'] ) )
425
+function get_post($post = null, $output = OBJECT, $filter = 'raw') {
426
+	if (empty($post) && isset($GLOBALS['post']))
427 427
 		$post = $GLOBALS['post'];
428 428
 
429
-	if ( $post instanceof WP_Post ) {
429
+	if ($post instanceof WP_Post) {
430 430
 		$_post = $post;
431
-	} elseif ( is_object( $post ) ) {
432
-		if ( empty( $post->filter ) ) {
433
-			$_post = sanitize_post( $post, 'raw' );
434
-			$_post = new WP_Post( $_post );
435
-		} elseif ( 'raw' == $post->filter ) {
436
-			$_post = new WP_Post( $post );
431
+	} elseif (is_object($post)) {
432
+		if (empty($post->filter)) {
433
+			$_post = sanitize_post($post, 'raw');
434
+			$_post = new WP_Post($_post);
435
+		} elseif ('raw' == $post->filter) {
436
+			$_post = new WP_Post($post);
437 437
 		} else {
438
-			$_post = WP_Post::get_instance( $post->ID );
438
+			$_post = WP_Post::get_instance($post->ID);
439 439
 		}
440 440
 	} else {
441
-		$_post = WP_Post::get_instance( $post );
441
+		$_post = WP_Post::get_instance($post);
442 442
 	}
443 443
 
444
-	if ( ! $_post )
444
+	if ( ! $_post)
445 445
 		return null;
446 446
 
447
-	$_post = $_post->filter( $filter );
447
+	$_post = $_post->filter($filter);
448 448
 
449
-	if ( $output == ARRAY_A )
449
+	if ($output == ARRAY_A)
450 450
 		return $_post->to_array();
451
-	elseif ( $output == ARRAY_N )
452
-		return array_values( $_post->to_array() );
451
+	elseif ($output == ARRAY_N)
452
+		return array_values($_post->to_array());
453 453
 
454 454
 	return $_post;
455 455
 }
@@ -654,28 +654,28 @@  discard block
 block discarded – undo
654 654
 	 * @param int $post_id Post ID.
655 655
 	 * @return WP_Post|false Post object, false otherwise.
656 656
 	 */
657
-	public static function get_instance( $post_id ) {
657
+	public static function get_instance($post_id) {
658 658
 		global $wpdb;
659 659
 
660 660
 		$post_id = (int) $post_id;
661
-		if ( ! $post_id )
661
+		if ( ! $post_id)
662 662
 			return false;
663 663
 
664
-		$_post = wp_cache_get( $post_id, 'posts' );
664
+		$_post = wp_cache_get($post_id, 'posts');
665 665
 
666
-		if ( ! $_post ) {
667
-			$_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
666
+		if ( ! $_post) {
667
+			$_post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id));
668 668
 
669
-			if ( ! $_post )
669
+			if ( ! $_post)
670 670
 				return false;
671 671
 
672
-			$_post = sanitize_post( $_post, 'raw' );
673
-			wp_cache_add( $_post->ID, $_post, 'posts' );
674
-		} elseif ( empty( $_post->filter ) ) {
675
-			$_post = sanitize_post( $_post, 'raw' );
672
+			$_post = sanitize_post($_post, 'raw');
673
+			wp_cache_add($_post->ID, $_post, 'posts');
674
+		} elseif (empty($_post->filter)) {
675
+			$_post = sanitize_post($_post, 'raw');
676 676
 		}
677 677
 
678
-		return new WP_Post( $_post );
678
+		return new WP_Post($_post);
679 679
 	}
680 680
 
681 681
 	/**
@@ -683,8 +683,8 @@  discard block
 block discarded – undo
683 683
 	 *
684 684
 	 * @param WP_Post|object $post Post object.
685 685
 	 */
686
-	public function __construct( $post ) {
687
-		foreach ( get_object_vars( $post ) as $key => $value )
686
+	public function __construct($post) {
687
+		foreach (get_object_vars($post) as $key => $value)
688 688
 			$this->$key = $value;
689 689
 	}
690 690
 
@@ -694,20 +694,20 @@  discard block
 block discarded – undo
694 694
 	 * @param string $key Property to check if set.
695 695
 	 * @return bool
696 696
 	 */
697
-	public function __isset( $key ) {
698
-		if ( 'ancestors' == $key )
697
+	public function __isset($key) {
698
+		if ('ancestors' == $key)
699 699
 			return true;
700 700
 
701
-		if ( 'page_template' == $key )
702
-			return ( 'page' == $this->post_type );
701
+		if ('page_template' == $key)
702
+			return ('page' == $this->post_type);
703 703
 
704
-		if ( 'post_category' == $key )
704
+		if ('post_category' == $key)
705 705
 		   return true;
706 706
 
707
-		if ( 'tags_input' == $key )
707
+		if ('tags_input' == $key)
708 708
 		   return true;
709 709
 
710
-		return metadata_exists( 'post', $this->ID, $key );
710
+		return metadata_exists('post', $this->ID, $key);
711 711
 	}
712 712
 
713 713
 	/**
@@ -716,39 +716,39 @@  discard block
 block discarded – undo
716 716
 	 * @param string $key Key to get.
717 717
 	 * @return mixed
718 718
 	 */
719
-	public function __get( $key ) {
720
-		if ( 'page_template' == $key && $this->__isset( $key ) ) {
721
-			return get_post_meta( $this->ID, '_wp_page_template', true );
719
+	public function __get($key) {
720
+		if ('page_template' == $key && $this->__isset($key)) {
721
+			return get_post_meta($this->ID, '_wp_page_template', true);
722 722
 		}
723 723
 
724
-		if ( 'post_category' == $key ) {
725
-			if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
726
-				$terms = get_the_terms( $this, 'category' );
724
+		if ('post_category' == $key) {
725
+			if (is_object_in_taxonomy($this->post_type, 'category'))
726
+				$terms = get_the_terms($this, 'category');
727 727
 
728
-			if ( empty( $terms ) )
728
+			if (empty($terms))
729 729
 				return array();
730 730
 
731
-			return wp_list_pluck( $terms, 'term_id' );
731
+			return wp_list_pluck($terms, 'term_id');
732 732
 		}
733 733
 
734
-		if ( 'tags_input' == $key ) {
735
-			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
736
-				$terms = get_the_terms( $this, 'post_tag' );
734
+		if ('tags_input' == $key) {
735
+			if (is_object_in_taxonomy($this->post_type, 'post_tag'))
736
+				$terms = get_the_terms($this, 'post_tag');
737 737
 
738
-			if ( empty( $terms ) )
738
+			if (empty($terms))
739 739
 				return array();
740 740
 
741
-			return wp_list_pluck( $terms, 'name' );
741
+			return wp_list_pluck($terms, 'name');
742 742
 		}
743 743
 
744 744
 		// Rest of the values need filtering.
745
-		if ( 'ancestors' == $key )
746
-			$value = get_post_ancestors( $this );
745
+		if ('ancestors' == $key)
746
+			$value = get_post_ancestors($this);
747 747
 		else
748
-			$value = get_post_meta( $this->ID, $key, true );
748
+			$value = get_post_meta($this->ID, $key, true);
749 749
 
750
-		if ( $this->filter )
751
-			$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
750
+		if ($this->filter)
751
+			$value = sanitize_post_field($key, $value, $this->ID, $this->filter);
752 752
 
753 753
 		return $value;
754 754
 	}
@@ -759,14 +759,14 @@  discard block
 block discarded – undo
759 759
 	 * @param string $filter Filter.
760 760
 	 * @return self|array|bool|object|WP_Post
761 761
 	 */
762
-	public function filter( $filter ) {
763
-		if ( $this->filter == $filter )
762
+	public function filter($filter) {
763
+		if ($this->filter == $filter)
764 764
 			return $this;
765 765
 
766
-		if ( $filter == 'raw' )
767
-			return self::get_instance( $this->ID );
766
+		if ($filter == 'raw')
767
+			return self::get_instance($this->ID);
768 768
 
769
-		return sanitize_post( $this, $filter );
769
+		return sanitize_post($this, $filter);
770 770
 	}
771 771
 
772 772
 	/**
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 	 * @return array Object as array.
776 776
 	 */
777 777
 	public function to_array() {
778
-		$post = get_object_vars( $this );
778
+		$post = get_object_vars($this);
779 779
 
780
-		foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
781
-			if ( $this->__isset( $key ) )
782
-				$post[ $key ] = $this->__get( $key );
780
+		foreach (array('ancestors', 'page_template', 'post_category', 'tags_input') as $key) {
781
+			if ($this->__isset($key))
782
+				$post[$key] = $this->__get($key);
783 783
 		}
784 784
 
785 785
 		return $post;
@@ -794,19 +794,19 @@  discard block
 block discarded – undo
794 794
  * @param int|WP_Post $post Post ID or post object.
795 795
  * @return array Ancestor IDs or empty array if none are found.
796 796
  */
797
-function get_post_ancestors( $post ) {
798
-	$post = get_post( $post );
797
+function get_post_ancestors($post) {
798
+	$post = get_post($post);
799 799
 
800
-	if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID )
800
+	if ( ! $post || empty($post->post_parent) || $post->post_parent == $post->ID)
801 801
 		return array();
802 802
 
803 803
 	$ancestors = array();
804 804
 
805 805
 	$id = $ancestors[] = $post->post_parent;
806 806
 
807
-	while ( $ancestor = get_post( $id ) ) {
807
+	while ($ancestor = get_post($id)) {
808 808
 		// Loop detection: If the ancestor has been seen before, break.
809
-		if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
809
+		if (empty($ancestor->post_parent) || ($ancestor->post_parent == $post->ID) || in_array($ancestor->post_parent, $ancestors))
810 810
 			break;
811 811
 
812 812
 		$id = $ancestors[] = $ancestor->post_parent;
@@ -834,13 +834,13 @@  discard block
 block discarded – undo
834 834
  *                             or 'display'. Default 'display'.
835 835
  * @return string The value of the post field on success, empty string on failure.
836 836
  */
837
-function get_post_field( $field, $post, $context = 'display' ) {
838
-	$post = get_post( $post );
837
+function get_post_field($field, $post, $context = 'display') {
838
+	$post = get_post($post);
839 839
 
840
-	if ( !$post )
840
+	if ( ! $post)
841 841
 		return '';
842 842
 
843
-	if ( !isset($post->$field) )
843
+	if ( ! isset($post->$field))
844 844
 		return '';
845 845
 
846 846
 	return sanitize_post_field($field, $post->$field, $post->ID, $context);
@@ -857,10 +857,10 @@  discard block
 block discarded – undo
857 857
  * @param int|WP_Post $ID Optional. Post ID or post object. Default empty.
858 858
  * @return string|false The mime type on success, false on failure.
859 859
  */
860
-function get_post_mime_type( $ID = '' ) {
860
+function get_post_mime_type($ID = '') {
861 861
 	$post = get_post($ID);
862 862
 
863
-	if ( is_object($post) )
863
+	if (is_object($post))
864 864
 		return $post->post_mime_type;
865 865
 
866 866
 	return false;
@@ -877,25 +877,25 @@  discard block
 block discarded – undo
877 877
  * @param int|WP_Post $ID Optional. Post ID or post object. Default empty.
878 878
  * @return string|false Post status on success, false on failure.
879 879
  */
880
-function get_post_status( $ID = '' ) {
880
+function get_post_status($ID = '') {
881 881
 	$post = get_post($ID);
882 882
 
883
-	if ( !is_object($post) )
883
+	if ( ! is_object($post))
884 884
 		return false;
885 885
 
886
-	if ( 'attachment' == $post->post_type ) {
887
-		if ( 'private' == $post->post_status )
886
+	if ('attachment' == $post->post_type) {
887
+		if ('private' == $post->post_status)
888 888
 			return 'private';
889 889
 
890 890
 		// Unattached attachments are assumed to be published.
891
-		if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
891
+		if (('inherit' == $post->post_status) && (0 == $post->post_parent))
892 892
 			return 'publish';
893 893
 
894 894
 		// Inherit status from the parent.
895
-		if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
896
-			$parent_post_status = get_post_status( $post->post_parent );
897
-			if ( 'trash' == $parent_post_status ) {
898
-				return get_post_meta( $post->post_parent, '_wp_trash_meta_status', true );
895
+		if ($post->post_parent && ($post->ID != $post->post_parent)) {
896
+			$parent_post_status = get_post_status($post->post_parent);
897
+			if ('trash' == $parent_post_status) {
898
+				return get_post_meta($post->post_parent, '_wp_trash_meta_status', true);
899 899
 			} else {
900 900
 				return $parent_post_status;
901 901
 			}
@@ -918,10 +918,10 @@  discard block
 block discarded – undo
918 918
  */
919 919
 function get_post_statuses() {
920 920
 	$status = array(
921
-		'draft'   => __( 'Draft' ),
922
-		'pending' => __( 'Pending Review' ),
923
-		'private' => __( 'Private' ),
924
-		'publish' => __( 'Published' )
921
+		'draft'   => __('Draft'),
922
+		'pending' => __('Pending Review'),
923
+		'private' => __('Private'),
924
+		'publish' => __('Published')
925 925
 	);
926 926
 
927 927
 	return $status;
@@ -939,9 +939,9 @@  discard block
 block discarded – undo
939 939
  */
940 940
 function get_page_statuses() {
941 941
 	$status = array(
942
-		'draft'   => __( 'Draft' ),
943
-		'private' => __( 'Private' ),
944
-		'publish' => __( 'Published' )
942
+		'draft'   => __('Draft'),
943
+		'private' => __('Private'),
944
+		'publish' => __('Published')
945 945
 	);
946 946
 
947 947
 	return $status;
@@ -990,10 +990,10 @@  discard block
 block discarded – undo
990 990
  * }
991 991
  * @return object
992 992
  */
993
-function register_post_status( $post_status, $args = array() ) {
993
+function register_post_status($post_status, $args = array()) {
994 994
 	global $wp_post_statuses;
995 995
 
996
-	if (!is_array($wp_post_statuses))
996
+	if ( ! is_array($wp_post_statuses))
997 997
 		$wp_post_statuses = array();
998 998
 
999 999
 	// Args prefixed with an underscore are reserved for internal use.
@@ -1017,38 +1017,38 @@  discard block
 block discarded – undo
1017 1017
 	$args->name = $post_status;
1018 1018
 
1019 1019
 	// Set various defaults.
1020
-	if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
1020
+	if (null === $args->public && null === $args->internal && null === $args->protected && null === $args->private)
1021 1021
 		$args->internal = true;
1022 1022
 
1023
-	if ( null === $args->public  )
1023
+	if (null === $args->public)
1024 1024
 		$args->public = false;
1025 1025
 
1026
-	if ( null === $args->private  )
1026
+	if (null === $args->private)
1027 1027
 		$args->private = false;
1028 1028
 
1029
-	if ( null === $args->protected  )
1029
+	if (null === $args->protected)
1030 1030
 		$args->protected = false;
1031 1031
 
1032
-	if ( null === $args->internal  )
1032
+	if (null === $args->internal)
1033 1033
 		$args->internal = false;
1034 1034
 
1035
-	if ( null === $args->publicly_queryable )
1035
+	if (null === $args->publicly_queryable)
1036 1036
 		$args->publicly_queryable = $args->public;
1037 1037
 
1038
-	if ( null === $args->exclude_from_search )
1038
+	if (null === $args->exclude_from_search)
1039 1039
 		$args->exclude_from_search = $args->internal;
1040 1040
 
1041
-	if ( null === $args->show_in_admin_all_list )
1042
-		$args->show_in_admin_all_list = !$args->internal;
1041
+	if (null === $args->show_in_admin_all_list)
1042
+		$args->show_in_admin_all_list = ! $args->internal;
1043 1043
 
1044
-	if ( null === $args->show_in_admin_status_list )
1045
-		$args->show_in_admin_status_list = !$args->internal;
1044
+	if (null === $args->show_in_admin_status_list)
1045
+		$args->show_in_admin_status_list = ! $args->internal;
1046 1046
 
1047
-	if ( false === $args->label )
1047
+	if (false === $args->label)
1048 1048
 		$args->label = $post_status;
1049 1049
 
1050
-	if ( false === $args->label_count )
1051
-		$args->label_count = array( $args->label, $args->label );
1050
+	if (false === $args->label_count)
1051
+		$args->label_count = array($args->label, $args->label);
1052 1052
 
1053 1053
 	$wp_post_statuses[$post_status] = $args;
1054 1054
 
@@ -1067,10 +1067,10 @@  discard block
 block discarded – undo
1067 1067
  * @param string $post_status The name of a registered post status.
1068 1068
  * @return object|null A post status object.
1069 1069
  */
1070
-function get_post_status_object( $post_status ) {
1070
+function get_post_status_object($post_status) {
1071 1071
 	global $wp_post_statuses;
1072 1072
 
1073
-	if ( empty($wp_post_statuses[$post_status]) )
1073
+	if (empty($wp_post_statuses[$post_status]))
1074 1074
 		return null;
1075 1075
 
1076 1076
 	return $wp_post_statuses[$post_status];
@@ -1093,7 +1093,7 @@  discard block
 block discarded – undo
1093 1093
  *                               Default 'and'.
1094 1094
  * @return array A list of post status names or objects.
1095 1095
  */
1096
-function get_post_stati( $args = array(), $output = 'names', $operator = 'and' ) {
1096
+function get_post_stati($args = array(), $output = 'names', $operator = 'and') {
1097 1097
 	global $wp_post_statuses;
1098 1098
 
1099 1099
 	$field = ('names' == $output) ? 'name' : false;
@@ -1113,11 +1113,11 @@  discard block
 block discarded – undo
1113 1113
  * @param string $post_type Post type name
1114 1114
  * @return bool Whether post type is hierarchical.
1115 1115
  */
1116
-function is_post_type_hierarchical( $post_type ) {
1117
-	if ( ! post_type_exists( $post_type ) )
1116
+function is_post_type_hierarchical($post_type) {
1117
+	if ( ! post_type_exists($post_type))
1118 1118
 		return false;
1119 1119
 
1120
-	$post_type = get_post_type_object( $post_type );
1120
+	$post_type = get_post_type_object($post_type);
1121 1121
 	return $post_type->hierarchical;
1122 1122
 }
1123 1123
 
@@ -1131,8 +1131,8 @@  discard block
 block discarded – undo
1131 1131
  * @param string $post_type Post type name.
1132 1132
  * @return bool Whether post type is registered.
1133 1133
  */
1134
-function post_type_exists( $post_type ) {
1135
-	return (bool) get_post_type_object( $post_type );
1134
+function post_type_exists($post_type) {
1135
+	return (bool) get_post_type_object($post_type);
1136 1136
 }
1137 1137
 
1138 1138
 /**
@@ -1143,8 +1143,8 @@  discard block
 block discarded – undo
1143 1143
  * @param int|WP_Post|null $post Optional. Post ID or post object. Default is global $post.
1144 1144
  * @return string|false          Post type on success, false on failure.
1145 1145
  */
1146
-function get_post_type( $post = null ) {
1147
-	if ( $post = get_post( $post ) )
1146
+function get_post_type($post = null) {
1147
+	if ($post = get_post($post))
1148 1148
 		return $post->post_type;
1149 1149
 
1150 1150
 	return false;
@@ -1162,10 +1162,10 @@  discard block
 block discarded – undo
1162 1162
  * @param string $post_type The name of a registered post type.
1163 1163
  * @return object|null A post type object.
1164 1164
  */
1165
-function get_post_type_object( $post_type ) {
1165
+function get_post_type_object($post_type) {
1166 1166
 	global $wp_post_types;
1167 1167
 
1168
-	if ( empty($wp_post_types[$post_type]) )
1168
+	if (empty($wp_post_types[$post_type]))
1169 1169
 		return null;
1170 1170
 
1171 1171
 	return $wp_post_types[$post_type];
@@ -1189,7 +1189,7 @@  discard block
 block discarded – undo
1189 1189
  *                               must match. Accepts 'or' or 'and'. Default 'and'.
1190 1190
  * @return array A list of post type names or objects.
1191 1191
  */
1192
-function get_post_types( $args = array(), $output = 'names', $operator = 'and' ) {
1192
+function get_post_types($args = array(), $output = 'names', $operator = 'and') {
1193 1193
 	global $wp_post_types;
1194 1194
 
1195 1195
 	$field = ('names' == $output) ? 'name' : false;
@@ -1310,10 +1310,10 @@  discard block
 block discarded – undo
1310 1310
  * }
1311 1311
  * @return object|WP_Error The registered post type object, or an error object.
1312 1312
  */
1313
-function register_post_type( $post_type, $args = array() ) {
1313
+function register_post_type($post_type, $args = array()) {
1314 1314
 	global $wp_post_types, $wp_rewrite, $wp;
1315 1315
 
1316
-	if ( ! is_array( $wp_post_types ) )
1316
+	if ( ! is_array($wp_post_types))
1317 1317
 		$wp_post_types = array();
1318 1318
 
1319 1319
 	// Args prefixed with an underscore are reserved for internal use.
@@ -1344,129 +1344,129 @@  discard block
 block discarded – undo
1344 1344
 		'_builtin'             => false,
1345 1345
 		'_edit_link'           => 'post.php?post=%d',
1346 1346
 	);
1347
-	$args = wp_parse_args( $args, $defaults );
1347
+	$args = wp_parse_args($args, $defaults);
1348 1348
 	$args = (object) $args;
1349 1349
 
1350
-	$post_type = sanitize_key( $post_type );
1350
+	$post_type = sanitize_key($post_type);
1351 1351
 	$args->name = $post_type;
1352 1352
 
1353
-	if ( empty( $post_type ) || strlen( $post_type ) > 20 ) {
1354
-		_doing_it_wrong( __FUNCTION__, __( 'Post type names must be between 1 and 20 characters in length.' ), '4.2' );
1355
-		return new WP_Error( 'post_type_length_invalid', __( 'Post type names must be between 1 and 20 characters in length.' ) );
1353
+	if (empty($post_type) || strlen($post_type) > 20) {
1354
+		_doing_it_wrong(__FUNCTION__, __('Post type names must be between 1 and 20 characters in length.'), '4.2');
1355
+		return new WP_Error('post_type_length_invalid', __('Post type names must be between 1 and 20 characters in length.'));
1356 1356
 	}
1357 1357
 
1358 1358
 	// If not set, default to the setting for public.
1359
-	if ( null === $args->publicly_queryable )
1359
+	if (null === $args->publicly_queryable)
1360 1360
 		$args->publicly_queryable = $args->public;
1361 1361
 
1362 1362
 	// If not set, default to the setting for public.
1363
-	if ( null === $args->show_ui )
1363
+	if (null === $args->show_ui)
1364 1364
 		$args->show_ui = $args->public;
1365 1365
 
1366 1366
 	// If not set, default to the setting for show_ui.
1367
-	if ( null === $args->show_in_menu || ! $args->show_ui )
1367
+	if (null === $args->show_in_menu || ! $args->show_ui)
1368 1368
 		$args->show_in_menu = $args->show_ui;
1369 1369
 
1370 1370
 	// If not set, default to the whether the full UI is shown.
1371
-	if ( null === $args->show_in_admin_bar )
1371
+	if (null === $args->show_in_admin_bar)
1372 1372
 		$args->show_in_admin_bar = (bool) $args->show_in_menu;
1373 1373
 
1374 1374
 	// If not set, default to the setting for public.
1375
-	if ( null === $args->show_in_nav_menus )
1375
+	if (null === $args->show_in_nav_menus)
1376 1376
 		$args->show_in_nav_menus = $args->public;
1377 1377
 
1378 1378
 	// If not set, default to true if not public, false if public.
1379
-	if ( null === $args->exclude_from_search )
1380
-		$args->exclude_from_search = !$args->public;
1379
+	if (null === $args->exclude_from_search)
1380
+		$args->exclude_from_search = ! $args->public;
1381 1381
 
1382 1382
 	// Back compat with quirky handling in version 3.0. #14122.
1383
-	if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) )
1383
+	if (empty($args->capabilities) && null === $args->map_meta_cap && in_array($args->capability_type, array('post', 'page')))
1384 1384
 		$args->map_meta_cap = true;
1385 1385
 
1386 1386
 	// If not set, default to false.
1387
-	if ( null === $args->map_meta_cap )
1387
+	if (null === $args->map_meta_cap)
1388 1388
 		$args->map_meta_cap = false;
1389 1389
 
1390
-	$args->cap = get_post_type_capabilities( $args );
1391
-	unset( $args->capabilities );
1390
+	$args->cap = get_post_type_capabilities($args);
1391
+	unset($args->capabilities);
1392 1392
 
1393
-	if ( is_array( $args->capability_type ) )
1393
+	if (is_array($args->capability_type))
1394 1394
 		$args->capability_type = $args->capability_type[0];
1395 1395
 
1396
-	if ( ! empty( $args->supports ) ) {
1397
-		add_post_type_support( $post_type, $args->supports );
1398
-		unset( $args->supports );
1399
-	} elseif ( false !== $args->supports ) {
1396
+	if ( ! empty($args->supports)) {
1397
+		add_post_type_support($post_type, $args->supports);
1398
+		unset($args->supports);
1399
+	} elseif (false !== $args->supports) {
1400 1400
 		// Add default features
1401
-		add_post_type_support( $post_type, array( 'title', 'editor' ) );
1401
+		add_post_type_support($post_type, array('title', 'editor'));
1402 1402
 	}
1403 1403
 
1404
-	if ( false !== $args->query_var && ! empty( $wp ) ) {
1405
-		if ( true === $args->query_var )
1404
+	if (false !== $args->query_var && ! empty($wp)) {
1405
+		if (true === $args->query_var)
1406 1406
 			$args->query_var = $post_type;
1407 1407
 		else
1408
-			$args->query_var = sanitize_title_with_dashes( $args->query_var );
1409
-		$wp->add_query_var( $args->query_var );
1408
+			$args->query_var = sanitize_title_with_dashes($args->query_var);
1409
+		$wp->add_query_var($args->query_var);
1410 1410
 	}
1411 1411
 
1412
-	if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
1413
-		if ( ! is_array( $args->rewrite ) )
1412
+	if (false !== $args->rewrite && (is_admin() || '' != get_option('permalink_structure'))) {
1413
+		if ( ! is_array($args->rewrite))
1414 1414
 			$args->rewrite = array();
1415
-		if ( empty( $args->rewrite['slug'] ) )
1415
+		if (empty($args->rewrite['slug']))
1416 1416
 			$args->rewrite['slug'] = $post_type;
1417
-		if ( ! isset( $args->rewrite['with_front'] ) )
1417
+		if ( ! isset($args->rewrite['with_front']))
1418 1418
 			$args->rewrite['with_front'] = true;
1419
-		if ( ! isset( $args->rewrite['pages'] ) )
1419
+		if ( ! isset($args->rewrite['pages']))
1420 1420
 			$args->rewrite['pages'] = true;
1421
-		if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
1421
+		if ( ! isset($args->rewrite['feeds']) || ! $args->has_archive)
1422 1422
 			$args->rewrite['feeds'] = (bool) $args->has_archive;
1423
-		if ( ! isset( $args->rewrite['ep_mask'] ) ) {
1424
-			if ( isset( $args->permalink_epmask ) )
1423
+		if ( ! isset($args->rewrite['ep_mask'])) {
1424
+			if (isset($args->permalink_epmask))
1425 1425
 				$args->rewrite['ep_mask'] = $args->permalink_epmask;
1426 1426
 			else
1427 1427
 				$args->rewrite['ep_mask'] = EP_PERMALINK;
1428 1428
 		}
1429 1429
 
1430
-		if ( $args->hierarchical )
1431
-			add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" );
1430
+		if ($args->hierarchical)
1431
+			add_rewrite_tag("%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=");
1432 1432
 		else
1433
-			add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
1433
+			add_rewrite_tag("%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=");
1434 1434
 
1435
-		if ( $args->has_archive ) {
1435
+		if ($args->has_archive) {
1436 1436
 			$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
1437
-			if ( $args->rewrite['with_front'] )
1438
-				$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
1437
+			if ($args->rewrite['with_front'])
1438
+				$archive_slug = substr($wp_rewrite->front, 1).$archive_slug;
1439 1439
 			else
1440
-				$archive_slug = $wp_rewrite->root . $archive_slug;
1440
+				$archive_slug = $wp_rewrite->root.$archive_slug;
1441 1441
 
1442
-			add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
1443
-			if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
1444
-				$feeds = '(' . trim( implode( '|', $wp_rewrite->feeds ) ) . ')';
1445
-				add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
1446
-				add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
1442
+			add_rewrite_rule("{$archive_slug}/?$", "index.php?post_type=$post_type", 'top');
1443
+			if ($args->rewrite['feeds'] && $wp_rewrite->feeds) {
1444
+				$feeds = '('.trim(implode('|', $wp_rewrite->feeds)).')';
1445
+				add_rewrite_rule("{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type".'&feed=$matches[1]', 'top');
1446
+				add_rewrite_rule("{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type".'&feed=$matches[1]', 'top');
1447 1447
 			}
1448
-			if ( $args->rewrite['pages'] )
1449
-				add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
1448
+			if ($args->rewrite['pages'])
1449
+				add_rewrite_rule("{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type".'&paged=$matches[1]', 'top');
1450 1450
 		}
1451 1451
 
1452 1452
 		$permastruct_args = $args->rewrite;
1453 1453
 		$permastruct_args['feed'] = $permastruct_args['feeds'];
1454
-		add_permastruct( $post_type, "{$args->rewrite['slug']}/%$post_type%", $permastruct_args );
1454
+		add_permastruct($post_type, "{$args->rewrite['slug']}/%$post_type%", $permastruct_args);
1455 1455
 	}
1456 1456
 
1457 1457
 	// Register the post type meta box if a custom callback was specified.
1458
-	if ( $args->register_meta_box_cb )
1459
-		add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 );
1458
+	if ($args->register_meta_box_cb)
1459
+		add_action('add_meta_boxes_'.$post_type, $args->register_meta_box_cb, 10, 1);
1460 1460
 
1461
-	$args->labels = get_post_type_labels( $args );
1461
+	$args->labels = get_post_type_labels($args);
1462 1462
 	$args->label = $args->labels->name;
1463 1463
 
1464
-	$wp_post_types[ $post_type ] = $args;
1464
+	$wp_post_types[$post_type] = $args;
1465 1465
 
1466
-	add_action( 'future_' . $post_type, '_future_post_hook', 5, 2 );
1466
+	add_action('future_'.$post_type, '_future_post_hook', 5, 2);
1467 1467
 
1468
-	foreach ( $args->taxonomies as $taxonomy ) {
1469
-		register_taxonomy_for_object_type( $taxonomy, $post_type );
1468
+	foreach ($args->taxonomies as $taxonomy) {
1469
+		register_taxonomy_for_object_type($taxonomy, $post_type);
1470 1470
 	}
1471 1471
 
1472 1472
 	/**
@@ -1477,7 +1477,7 @@  discard block
 block discarded – undo
1477 1477
 	 * @param string $post_type Post type.
1478 1478
 	 * @param object $args      Arguments used to register the post type.
1479 1479
 	 */
1480
-	do_action( 'registered_post_type', $post_type, $args );
1480
+	do_action('registered_post_type', $post_type, $args);
1481 1481
 
1482 1482
 	return $args;
1483 1483
 }
@@ -1537,48 +1537,48 @@  discard block
 block discarded – undo
1537 1537
  * @param object $args Post type registration arguments.
1538 1538
  * @return object object with all the capabilities as member variables.
1539 1539
  */
1540
-function get_post_type_capabilities( $args ) {
1541
-	if ( ! is_array( $args->capability_type ) )
1542
-		$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
1540
+function get_post_type_capabilities($args) {
1541
+	if ( ! is_array($args->capability_type))
1542
+		$args->capability_type = array($args->capability_type, $args->capability_type.'s');
1543 1543
 
1544 1544
 	// Singular base for meta capabilities, plural base for primitive capabilities.
1545
-	list( $singular_base, $plural_base ) = $args->capability_type;
1545
+	list($singular_base, $plural_base) = $args->capability_type;
1546 1546
 
1547 1547
 	$default_capabilities = array(
1548 1548
 		// Meta capabilities
1549
-		'edit_post'          => 'edit_'         . $singular_base,
1550
-		'read_post'          => 'read_'         . $singular_base,
1551
-		'delete_post'        => 'delete_'       . $singular_base,
1549
+		'edit_post'          => 'edit_'.$singular_base,
1550
+		'read_post'          => 'read_'.$singular_base,
1551
+		'delete_post'        => 'delete_'.$singular_base,
1552 1552
 		// Primitive capabilities used outside of map_meta_cap():
1553
-		'edit_posts'         => 'edit_'         . $plural_base,
1554
-		'edit_others_posts'  => 'edit_others_'  . $plural_base,
1555
-		'publish_posts'      => 'publish_'      . $plural_base,
1556
-		'read_private_posts' => 'read_private_' . $plural_base,
1553
+		'edit_posts'         => 'edit_'.$plural_base,
1554
+		'edit_others_posts'  => 'edit_others_'.$plural_base,
1555
+		'publish_posts'      => 'publish_'.$plural_base,
1556
+		'read_private_posts' => 'read_private_'.$plural_base,
1557 1557
 	);
1558 1558
 
1559 1559
 	// Primitive capabilities used within map_meta_cap():
1560
-	if ( $args->map_meta_cap ) {
1560
+	if ($args->map_meta_cap) {
1561 1561
 		$default_capabilities_for_mapping = array(
1562 1562
 			'read'                   => 'read',
1563
-			'delete_posts'           => 'delete_'           . $plural_base,
1564
-			'delete_private_posts'   => 'delete_private_'   . $plural_base,
1565
-			'delete_published_posts' => 'delete_published_' . $plural_base,
1566
-			'delete_others_posts'    => 'delete_others_'    . $plural_base,
1567
-			'edit_private_posts'     => 'edit_private_'     . $plural_base,
1568
-			'edit_published_posts'   => 'edit_published_'   . $plural_base,
1563
+			'delete_posts'           => 'delete_'.$plural_base,
1564
+			'delete_private_posts'   => 'delete_private_'.$plural_base,
1565
+			'delete_published_posts' => 'delete_published_'.$plural_base,
1566
+			'delete_others_posts'    => 'delete_others_'.$plural_base,
1567
+			'edit_private_posts'     => 'edit_private_'.$plural_base,
1568
+			'edit_published_posts'   => 'edit_published_'.$plural_base,
1569 1569
 		);
1570
-		$default_capabilities = array_merge( $default_capabilities, $default_capabilities_for_mapping );
1570
+		$default_capabilities = array_merge($default_capabilities, $default_capabilities_for_mapping);
1571 1571
 	}
1572 1572
 
1573
-	$capabilities = array_merge( $default_capabilities, $args->capabilities );
1573
+	$capabilities = array_merge($default_capabilities, $args->capabilities);
1574 1574
 
1575 1575
 	// Post creation capability simply maps to edit_posts by default:
1576
-	if ( ! isset( $capabilities['create_posts'] ) )
1576
+	if ( ! isset($capabilities['create_posts']))
1577 1577
 		$capabilities['create_posts'] = $capabilities['edit_posts'];
1578 1578
 
1579 1579
 	// Remember meta capabilities for future reference.
1580
-	if ( $args->map_meta_cap )
1581
-		_post_type_meta_capabilities( $capabilities );
1580
+	if ($args->map_meta_cap)
1581
+		_post_type_meta_capabilities($capabilities);
1582 1582
 
1583 1583
 	return (object) $capabilities;
1584 1584
 }
@@ -1593,13 +1593,13 @@  discard block
 block discarded – undo
1593 1593
  *
1594 1594
  * @param array|void $capabilities Post type meta capabilities.
1595 1595
  */
1596
-function _post_type_meta_capabilities( $capabilities = null ) {
1596
+function _post_type_meta_capabilities($capabilities = null) {
1597 1597
 	static $meta_caps = array();
1598
-	if ( null === $capabilities )
1598
+	if (null === $capabilities)
1599 1599
 		return $meta_caps;
1600
-	foreach ( $capabilities as $core => $custom ) {
1601
-		if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) )
1602
-			$meta_caps[ $custom ] = $core;
1600
+	foreach ($capabilities as $core => $custom) {
1601
+		if (in_array($core, array('read_post', 'delete_post', 'edit_post')))
1602
+			$meta_caps[$custom] = $core;
1603 1603
 	}
1604 1604
 }
1605 1605
 
@@ -1642,28 +1642,28 @@  discard block
 block discarded – undo
1642 1642
  * @param object $post_type_object Post type object.
1643 1643
  * @return object object with all the labels as member variables.
1644 1644
  */
1645
-function get_post_type_labels( $post_type_object ) {
1645
+function get_post_type_labels($post_type_object) {
1646 1646
 	$nohier_vs_hier_defaults = array(
1647
-		'name' => array( _x('Posts', 'post type general name'), _x('Pages', 'post type general name') ),
1648
-		'singular_name' => array( _x('Post', 'post type singular name'), _x('Page', 'post type singular name') ),
1649
-		'add_new' => array( _x('Add New', 'post'), _x('Add New', 'page') ),
1650
-		'add_new_item' => array( __('Add New Post'), __('Add New Page') ),
1651
-		'edit_item' => array( __('Edit Post'), __('Edit Page') ),
1652
-		'new_item' => array( __('New Post'), __('New Page') ),
1653
-		'view_item' => array( __('View Post'), __('View Page') ),
1654
-		'search_items' => array( __('Search Posts'), __('Search Pages') ),
1655
-		'not_found' => array( __('No posts found.'), __('No pages found.') ),
1656
-		'not_found_in_trash' => array( __('No posts found in Trash.'), __('No pages found in Trash.') ),
1657
-		'parent_item_colon' => array( null, __('Parent Page:') ),
1658
-		'all_items' => array( __( 'All Posts' ), __( 'All Pages' ) ),
1659
-		'featured_image' => array( __( 'Featured Image' ), __( 'Featured Image' ) ),
1660
-		'set_featured_image' => array( __( 'Set featured image' ), __( 'Set featured image' ) ),
1661
-		'remove_featured_image' => array( __( 'Remove featured image' ), __( 'Remove featured image' ) ),
1662
-		'use_featured_image' => array( __( 'Use as featured image' ), __( 'Use as featured image' ) ),
1647
+		'name' => array(_x('Posts', 'post type general name'), _x('Pages', 'post type general name')),
1648
+		'singular_name' => array(_x('Post', 'post type singular name'), _x('Page', 'post type singular name')),
1649
+		'add_new' => array(_x('Add New', 'post'), _x('Add New', 'page')),
1650
+		'add_new_item' => array(__('Add New Post'), __('Add New Page')),
1651
+		'edit_item' => array(__('Edit Post'), __('Edit Page')),
1652
+		'new_item' => array(__('New Post'), __('New Page')),
1653
+		'view_item' => array(__('View Post'), __('View Page')),
1654
+		'search_items' => array(__('Search Posts'), __('Search Pages')),
1655
+		'not_found' => array(__('No posts found.'), __('No pages found.')),
1656
+		'not_found_in_trash' => array(__('No posts found in Trash.'), __('No pages found in Trash.')),
1657
+		'parent_item_colon' => array(null, __('Parent Page:')),
1658
+		'all_items' => array(__('All Posts'), __('All Pages')),
1659
+		'featured_image' => array(__('Featured Image'), __('Featured Image')),
1660
+		'set_featured_image' => array(__('Set featured image'), __('Set featured image')),
1661
+		'remove_featured_image' => array(__('Remove featured image'), __('Remove featured image')),
1662
+		'use_featured_image' => array(__('Use as featured image'), __('Use as featured image')),
1663 1663
 	);
1664 1664
 	$nohier_vs_hier_defaults['menu_name'] = $nohier_vs_hier_defaults['name'];
1665 1665
 
1666
-	$labels = _get_custom_object_labels( $post_type_object, $nohier_vs_hier_defaults );
1666
+	$labels = _get_custom_object_labels($post_type_object, $nohier_vs_hier_defaults);
1667 1667
 
1668 1668
 	$post_type = $post_type_object->name;
1669 1669
 
@@ -1679,7 +1679,7 @@  discard block
 block discarded – undo
1679 1679
 	 *
1680 1680
 	 * @param object $labels Object with labels for the post type as member variables.
1681 1681
 	 */
1682
-	return apply_filters( "post_type_labels_{$post_type}", $labels );
1682
+	return apply_filters("post_type_labels_{$post_type}", $labels);
1683 1683
 }
1684 1684
 
1685 1685
 /**
@@ -1692,29 +1692,29 @@  discard block
 block discarded – undo
1692 1692
  * @param object $object                  A custom-something object.
1693 1693
  * @param array  $nohier_vs_hier_defaults Hierarchical vs non-hierarchical default labels.
1694 1694
  */
1695
-function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
1695
+function _get_custom_object_labels($object, $nohier_vs_hier_defaults) {
1696 1696
 	$object->labels = (array) $object->labels;
1697 1697
 
1698
-	if ( isset( $object->label ) && empty( $object->labels['name'] ) )
1698
+	if (isset($object->label) && empty($object->labels['name']))
1699 1699
 		$object->labels['name'] = $object->label;
1700 1700
 
1701
-	if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) )
1701
+	if ( ! isset($object->labels['singular_name']) && isset($object->labels['name']))
1702 1702
 		$object->labels['singular_name'] = $object->labels['name'];
1703 1703
 
1704
-	if ( ! isset( $object->labels['name_admin_bar'] ) )
1705
-		$object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name;
1704
+	if ( ! isset($object->labels['name_admin_bar']))
1705
+		$object->labels['name_admin_bar'] = isset($object->labels['singular_name']) ? $object->labels['singular_name'] : $object->name;
1706 1706
 
1707
-	if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) )
1707
+	if ( ! isset($object->labels['menu_name']) && isset($object->labels['name']))
1708 1708
 		$object->labels['menu_name'] = $object->labels['name'];
1709 1709
 
1710
-	if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) )
1710
+	if ( ! isset($object->labels['all_items']) && isset($object->labels['menu_name']))
1711 1711
 		$object->labels['all_items'] = $object->labels['menu_name'];
1712 1712
 
1713 1713
 	$defaults = array();
1714
-	foreach ( $nohier_vs_hier_defaults as $key => $value ) {
1714
+	foreach ($nohier_vs_hier_defaults as $key => $value) {
1715 1715
 		$defaults[$key] = $object->hierarchical ? $value[1] : $value[0];
1716 1716
 	}
1717
-	$labels = array_merge( $defaults, $object->labels );
1717
+	$labels = array_merge($defaults, $object->labels);
1718 1718
 	return (object) $labels;
1719 1719
 }
1720 1720
 
@@ -1725,12 +1725,12 @@  discard block
 block discarded – undo
1725 1725
  * @since 3.1.0
1726 1726
  */
1727 1727
 function _add_post_type_submenus() {
1728
-	foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {
1729
-		$ptype_obj = get_post_type_object( $ptype );
1728
+	foreach (get_post_types(array('show_ui' => true)) as $ptype) {
1729
+		$ptype_obj = get_post_type_object($ptype);
1730 1730
 		// Sub-menus only.
1731
-		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true )
1731
+		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true)
1732 1732
 			continue;
1733
-		add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
1733
+		add_submenu_page($ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype");
1734 1734
 	}
1735 1735
 }
1736 1736
 
@@ -1754,15 +1754,15 @@  discard block
 block discarded – undo
1754 1754
  * @param string|array $feature   The feature being added, accepts an array of
1755 1755
  *                                feature strings or a single string.
1756 1756
  */
1757
-function add_post_type_support( $post_type, $feature ) {
1757
+function add_post_type_support($post_type, $feature) {
1758 1758
 	global $_wp_post_type_features;
1759 1759
 
1760 1760
 	$features = (array) $feature;
1761 1761
 	foreach ($features as $feature) {
1762
-		if ( func_num_args() == 2 )
1762
+		if (func_num_args() == 2)
1763 1763
 			$_wp_post_type_features[$post_type][$feature] = true;
1764 1764
 		else
1765
-			$_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
1765
+			$_wp_post_type_features[$post_type][$feature] = array_slice(func_get_args(), 2);
1766 1766
 	}
1767 1767
 }
1768 1768
 
@@ -1776,10 +1776,10 @@  discard block
 block discarded – undo
1776 1776
  * @param string $post_type The post type for which to remove the feature.
1777 1777
  * @param string $feature   The feature being removed.
1778 1778
  */
1779
-function remove_post_type_support( $post_type, $feature ) {
1779
+function remove_post_type_support($post_type, $feature) {
1780 1780
 	global $_wp_post_type_features;
1781 1781
 
1782
-	unset( $_wp_post_type_features[ $post_type ][ $feature ] );
1782
+	unset($_wp_post_type_features[$post_type][$feature]);
1783 1783
 }
1784 1784
 
1785 1785
 /**
@@ -1792,10 +1792,10 @@  discard block
 block discarded – undo
1792 1792
  * @param string $post_type The post type.
1793 1793
  * @return array Post type supports list.
1794 1794
  */
1795
-function get_all_post_type_supports( $post_type ) {
1795
+function get_all_post_type_supports($post_type) {
1796 1796
 	global $_wp_post_type_features;
1797 1797
 
1798
-	if ( isset( $_wp_post_type_features[$post_type] ) )
1798
+	if (isset($_wp_post_type_features[$post_type]))
1799 1799
 		return $_wp_post_type_features[$post_type];
1800 1800
 
1801 1801
 	return array();
@@ -1812,10 +1812,10 @@  discard block
 block discarded – undo
1812 1812
  * @param string $feature   The feature being checked.
1813 1813
  * @return bool Whether the post type supports the given feature.
1814 1814
  */
1815
-function post_type_supports( $post_type, $feature ) {
1815
+function post_type_supports($post_type, $feature) {
1816 1816
 	global $_wp_post_type_features;
1817 1817
 
1818
-	return ( isset( $_wp_post_type_features[$post_type][$feature] ) );
1818
+	return (isset($_wp_post_type_features[$post_type][$feature]));
1819 1819
 }
1820 1820
 
1821 1821
 /**
@@ -1832,13 +1832,13 @@  discard block
 block discarded – undo
1832 1832
  *                          name a few. Default 'post'.
1833 1833
  * @return int|false Amount of rows changed. Should be 1 for success and 0 for failure.
1834 1834
  */
1835
-function set_post_type( $post_id = 0, $post_type = 'post' ) {
1835
+function set_post_type($post_id = 0, $post_type = 'post') {
1836 1836
 	global $wpdb;
1837 1837
 
1838 1838
 	$post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db');
1839
-	$return = $wpdb->update( $wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) );
1839
+	$return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id));
1840 1840
 
1841
-	clean_post_cache( $post_id );
1841
+	clean_post_cache($post_id);
1842 1842
 
1843 1843
 	return $return;
1844 1844
 }
@@ -1854,8 +1854,8 @@  discard block
 block discarded – undo
1854 1854
  * @param object $post_type_object Post type object.
1855 1855
  * @return bool Whether the post type should be considered viewable.
1856 1856
  */
1857
-function is_post_type_viewable( $post_type_object ) {
1858
-	return $post_type_object->publicly_queryable || ( $post_type_object->_builtin && $post_type_object->public );
1857
+function is_post_type_viewable($post_type_object) {
1858
+	return $post_type_object->publicly_queryable || ($post_type_object->_builtin && $post_type_object->public);
1859 1859
 }
1860 1860
 
1861 1861
 /**
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
  * }
1888 1888
  * @return array List of posts.
1889 1889
  */
1890
-function get_posts( $args = null ) {
1890
+function get_posts($args = null) {
1891 1891
 	$defaults = array(
1892 1892
 		'numberposts' => 5, 'offset' => 0,
1893 1893
 		'category' => 0, 'orderby' => 'date',
@@ -1897,19 +1897,19 @@  discard block
 block discarded – undo
1897 1897
 		'suppress_filters' => true
1898 1898
 	);
1899 1899
 
1900
-	$r = wp_parse_args( $args, $defaults );
1901
-	if ( empty( $r['post_status'] ) )
1902
-		$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
1903
-	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']) )
1900
+	$r = wp_parse_args($args, $defaults);
1901
+	if (empty($r['post_status']))
1902
+		$r['post_status'] = ('attachment' == $r['post_type']) ? 'inherit' : 'publish';
1903
+	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']))
1904 1904
 		$r['posts_per_page'] = $r['numberposts'];
1905
-	if ( ! empty($r['category']) )
1905
+	if ( ! empty($r['category']))
1906 1906
 		$r['cat'] = $r['category'];
1907
-	if ( ! empty($r['include']) ) {
1908
-		$incposts = wp_parse_id_list( $r['include'] );
1909
-		$r['posts_per_page'] = count($incposts);  // only the number of posts included
1907
+	if ( ! empty($r['include'])) {
1908
+		$incposts = wp_parse_id_list($r['include']);
1909
+		$r['posts_per_page'] = count($incposts); // only the number of posts included
1910 1910
 		$r['post__in'] = $incposts;
1911
-	} elseif ( ! empty($r['exclude']) )
1912
-		$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
1911
+	} elseif ( ! empty($r['exclude']))
1912
+		$r['post__not_in'] = wp_parse_id_list($r['exclude']);
1913 1913
 
1914 1914
 	$r['ignore_sticky_posts'] = true;
1915 1915
 	$r['no_found_rows'] = true;
@@ -1937,9 +1937,9 @@  discard block
 block discarded – undo
1937 1937
  *                           Default false.
1938 1938
  * @return int|false Meta ID on success, false on failure.
1939 1939
  */
1940
-function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
1940
+function add_post_meta($post_id, $meta_key, $meta_value, $unique = false) {
1941 1941
 	// Make sure meta is added to the post, not a revision.
1942
-	if ( $the_post = wp_is_post_revision($post_id) )
1942
+	if ($the_post = wp_is_post_revision($post_id))
1943 1943
 		$post_id = $the_post;
1944 1944
 
1945 1945
 	return add_metadata('post', $post_id, $meta_key, $meta_value, $unique);
@@ -1960,9 +1960,9 @@  discard block
 block discarded – undo
1960 1960
  *                           non-scalar. Default empty.
1961 1961
  * @return bool True on success, false on failure.
1962 1962
  */
1963
-function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
1963
+function delete_post_meta($post_id, $meta_key, $meta_value = '') {
1964 1964
 	// Make sure meta is added to the post, not a revision.
1965
-	if ( $the_post = wp_is_post_revision($post_id) )
1965
+	if ($the_post = wp_is_post_revision($post_id))
1966 1966
 		$post_id = $the_post;
1967 1967
 
1968 1968
 	return delete_metadata('post', $post_id, $meta_key, $meta_value);
@@ -1980,7 +1980,7 @@  discard block
 block discarded – undo
1980 1980
  * @return mixed Will be an array if $single is false. Will be value of meta data
1981 1981
  *               field if $single is true.
1982 1982
  */
1983
-function get_post_meta( $post_id, $key = '', $single = false ) {
1983
+function get_post_meta($post_id, $key = '', $single = false) {
1984 1984
 	return get_metadata('post', $post_id, $key, $single);
1985 1985
 }
1986 1986
 
@@ -2002,9 +2002,9 @@  discard block
 block discarded – undo
2002 2002
  * @return int|bool Meta ID if the key didn't exist, true on successful update,
2003 2003
  *                  false on failure.
2004 2004
  */
2005
-function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
2005
+function update_post_meta($post_id, $meta_key, $meta_value, $prev_value = '') {
2006 2006
 	// Make sure meta is added to the post, not a revision.
2007
-	if ( $the_post = wp_is_post_revision($post_id) )
2007
+	if ($the_post = wp_is_post_revision($post_id))
2008 2008
 		$post_id = $the_post;
2009 2009
 
2010 2010
 	return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value);
@@ -2018,8 +2018,8 @@  discard block
 block discarded – undo
2018 2018
  * @param string $post_meta_key Key to search for when deleting.
2019 2019
  * @return bool Whether the post meta key was deleted from the database.
2020 2020
  */
2021
-function delete_post_meta_by_key( $post_meta_key ) {
2022
-	return delete_metadata( 'post', null, $post_meta_key, '', true );
2021
+function delete_post_meta_by_key($post_meta_key) {
2022
+	return delete_metadata('post', null, $post_meta_key, '', true);
2023 2023
 }
2024 2024
 
2025 2025
 /**
@@ -2033,12 +2033,12 @@  discard block
 block discarded – undo
2033 2033
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
2034 2034
  * @return array Post meta for the given post.
2035 2035
  */
2036
-function get_post_custom( $post_id = 0 ) {
2037
-	$post_id = absint( $post_id );
2038
-	if ( ! $post_id )
2036
+function get_post_custom($post_id = 0) {
2037
+	$post_id = absint($post_id);
2038
+	if ( ! $post_id)
2039 2039
 		$post_id = get_the_ID();
2040 2040
 
2041
-	return get_post_meta( $post_id );
2041
+	return get_post_meta($post_id);
2042 2042
 }
2043 2043
 
2044 2044
 /**
@@ -2051,13 +2051,13 @@  discard block
 block discarded – undo
2051 2051
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
2052 2052
  * @return array|void Array of the keys, if retrieved.
2053 2053
  */
2054
-function get_post_custom_keys( $post_id = 0 ) {
2055
-	$custom = get_post_custom( $post_id );
2054
+function get_post_custom_keys($post_id = 0) {
2055
+	$custom = get_post_custom($post_id);
2056 2056
 
2057
-	if ( !is_array($custom) )
2057
+	if ( ! is_array($custom))
2058 2058
 		return;
2059 2059
 
2060
-	if ( $keys = array_keys($custom) )
2060
+	if ($keys = array_keys($custom))
2061 2061
 		return $keys;
2062 2062
 }
2063 2063
 
@@ -2073,8 +2073,8 @@  discard block
 block discarded – undo
2073 2073
  * @param int    $post_id Optional. Post ID. Default is ID of the global $post.
2074 2074
  * @return array|null Meta field values.
2075 2075
  */
2076
-function get_post_custom_values( $key = '', $post_id = 0 ) {
2077
-	if ( !$key )
2076
+function get_post_custom_values($key = '', $post_id = 0) {
2077
+	if ( ! $key)
2078 2078
 		return null;
2079 2079
 
2080 2080
 	$custom = get_post_custom($post_id);
@@ -2093,18 +2093,18 @@  discard block
 block discarded – undo
2093 2093
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
2094 2094
  * @return bool Whether post is sticky.
2095 2095
  */
2096
-function is_sticky( $post_id = 0 ) {
2097
-	$post_id = absint( $post_id );
2096
+function is_sticky($post_id = 0) {
2097
+	$post_id = absint($post_id);
2098 2098
 
2099
-	if ( ! $post_id )
2099
+	if ( ! $post_id)
2100 2100
 		$post_id = get_the_ID();
2101 2101
 
2102
-	$stickies = get_option( 'sticky_posts' );
2102
+	$stickies = get_option('sticky_posts');
2103 2103
 
2104
-	if ( ! is_array( $stickies ) )
2104
+	if ( ! is_array($stickies))
2105 2105
 		return false;
2106 2106
 
2107
-	if ( in_array( $post_id, $stickies ) )
2107
+	if (in_array($post_id, $stickies))
2108 2108
 		return true;
2109 2109
 
2110 2110
 	return false;
@@ -2127,23 +2127,23 @@  discard block
 block discarded – undo
2127 2127
  * @return object|WP_Post|array The now sanitized Post Object or Array (will be the
2128 2128
  *                              same type as $post).
2129 2129
  */
2130
-function sanitize_post( $post, $context = 'display' ) {
2131
-	if ( is_object($post) ) {
2130
+function sanitize_post($post, $context = 'display') {
2131
+	if (is_object($post)) {
2132 2132
 		// Check if post already filtered for this context.
2133
-		if ( isset($post->filter) && $context == $post->filter )
2133
+		if (isset($post->filter) && $context == $post->filter)
2134 2134
 			return $post;
2135
-		if ( !isset($post->ID) )
2135
+		if ( ! isset($post->ID))
2136 2136
 			$post->ID = 0;
2137
-		foreach ( array_keys(get_object_vars($post)) as $field )
2137
+		foreach (array_keys(get_object_vars($post)) as $field)
2138 2138
 			$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
2139 2139
 		$post->filter = $context;
2140 2140
 	} else {
2141 2141
 		// Check if post already filtered for this context.
2142
-		if ( isset($post['filter']) && $context == $post['filter'] )
2142
+		if (isset($post['filter']) && $context == $post['filter'])
2143 2143
 			return $post;
2144
-		if ( !isset($post['ID']) )
2144
+		if ( ! isset($post['ID']))
2145 2145
 			$post['ID'] = 0;
2146
-		foreach ( array_keys($post) as $field )
2146
+		foreach (array_keys($post) as $field)
2147 2147
 			$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
2148 2148
 		$post['filter'] = $context;
2149 2149
 	}
@@ -2168,29 +2168,29 @@  discard block
 block discarded – undo
2168 2168
  */
2169 2169
 function sanitize_post_field($field, $value, $post_id, $context) {
2170 2170
 	$int_fields = array('ID', 'post_parent', 'menu_order');
2171
-	if ( in_array($field, $int_fields) )
2171
+	if (in_array($field, $int_fields))
2172 2172
 		$value = (int) $value;
2173 2173
 
2174 2174
 	// Fields which contain arrays of integers.
2175
-	$array_int_fields = array( 'ancestors' );
2176
-	if ( in_array($field, $array_int_fields) ) {
2177
-		$value = array_map( 'absint', $value);
2175
+	$array_int_fields = array('ancestors');
2176
+	if (in_array($field, $array_int_fields)) {
2177
+		$value = array_map('absint', $value);
2178 2178
 		return $value;
2179 2179
 	}
2180 2180
 
2181
-	if ( 'raw' == $context )
2181
+	if ('raw' == $context)
2182 2182
 		return $value;
2183 2183
 
2184 2184
 	$prefixed = false;
2185
-	if ( false !== strpos($field, 'post_') ) {
2185
+	if (false !== strpos($field, 'post_')) {
2186 2186
 		$prefixed = true;
2187 2187
 		$field_no_prefix = str_replace('post_', '', $field);
2188 2188
 	}
2189 2189
 
2190
-	if ( 'edit' == $context ) {
2190
+	if ('edit' == $context) {
2191 2191
 		$format_to_edit = array('post_content', 'post_excerpt', 'post_title', 'post_password');
2192 2192
 
2193
-		if ( $prefixed ) {
2193
+		if ($prefixed) {
2194 2194
 
2195 2195
 			/**
2196 2196
 			 * Filter the value of a specific post field to edit.
@@ -2203,7 +2203,7 @@  discard block
 block discarded – undo
2203 2203
 			 * @param mixed $value   Value of the post field.
2204 2204
 			 * @param int   $post_id Post ID.
2205 2205
 			 */
2206
-			$value = apply_filters( "edit_{$field}", $value, $post_id );
2206
+			$value = apply_filters("edit_{$field}", $value, $post_id);
2207 2207
 
2208 2208
 			/**
2209 2209
 			 * Filter the value of a specific post field to edit.
@@ -2216,21 +2216,21 @@  discard block
 block discarded – undo
2216 2216
 			 * @param mixed $value   Value of the post field.
2217 2217
 			 * @param int   $post_id Post ID.
2218 2218
 			 */
2219
-			$value = apply_filters( "{$field_no_prefix}_edit_pre", $value, $post_id );
2219
+			$value = apply_filters("{$field_no_prefix}_edit_pre", $value, $post_id);
2220 2220
 		} else {
2221
-			$value = apply_filters( "edit_post_{$field}", $value, $post_id );
2221
+			$value = apply_filters("edit_post_{$field}", $value, $post_id);
2222 2222
 		}
2223 2223
 
2224
-		if ( in_array($field, $format_to_edit) ) {
2225
-			if ( 'post_content' == $field )
2224
+		if (in_array($field, $format_to_edit)) {
2225
+			if ('post_content' == $field)
2226 2226
 				$value = format_to_edit($value, user_can_richedit());
2227 2227
 			else
2228 2228
 				$value = format_to_edit($value);
2229 2229
 		} else {
2230 2230
 			$value = esc_attr($value);
2231 2231
 		}
2232
-	} elseif ( 'db' == $context ) {
2233
-		if ( $prefixed ) {
2232
+	} elseif ('db' == $context) {
2233
+		if ($prefixed) {
2234 2234
 
2235 2235
 			/**
2236 2236
 			 * Filter the value of a specific post field before saving.
@@ -2242,7 +2242,7 @@  discard block
 block discarded – undo
2242 2242
 			 *
2243 2243
 			 * @param mixed $value Value of the post field.
2244 2244
 			 */
2245
-			$value = apply_filters( "pre_{$field}", $value );
2245
+			$value = apply_filters("pre_{$field}", $value);
2246 2246
 
2247 2247
 			/**
2248 2248
 			 * Filter the value of a specific field before saving.
@@ -2254,9 +2254,9 @@  discard block
 block discarded – undo
2254 2254
 			 *
2255 2255
 			 * @param mixed $value Value of the post field.
2256 2256
 			 */
2257
-			$value = apply_filters( "{$field_no_prefix}_save_pre", $value );
2257
+			$value = apply_filters("{$field_no_prefix}_save_pre", $value);
2258 2258
 		} else {
2259
-			$value = apply_filters( "pre_post_{$field}", $value );
2259
+			$value = apply_filters("pre_post_{$field}", $value);
2260 2260
 
2261 2261
 			/**
2262 2262
 			 * Filter the value of a specific post field before saving.
@@ -2268,12 +2268,12 @@  discard block
 block discarded – undo
2268 2268
 			 *
2269 2269
 			 * @param mixed $value Value of the post field.
2270 2270
 			 */
2271
-			$value = apply_filters( "{$field}_pre", $value );
2271
+			$value = apply_filters("{$field}_pre", $value);
2272 2272
 		}
2273 2273
 	} else {
2274 2274
 
2275 2275
 		// Use display filters by default.
2276
-		if ( $prefixed ) {
2276
+		if ($prefixed) {
2277 2277
 
2278 2278
 			/**
2279 2279
 			 * Filter the value of a specific post field for display.
@@ -2289,15 +2289,15 @@  discard block
 block discarded – undo
2289 2289
 			 *                        values include 'raw', 'edit', 'db', 'display',
2290 2290
 			 *                        'attribute' and 'js'.
2291 2291
 			 */
2292
-			$value = apply_filters( $field, $value, $post_id, $context );
2292
+			$value = apply_filters($field, $value, $post_id, $context);
2293 2293
 		} else {
2294
-			$value = apply_filters( "post_{$field}", $value, $post_id, $context );
2294
+			$value = apply_filters("post_{$field}", $value, $post_id, $context);
2295 2295
 		}
2296 2296
 	}
2297 2297
 
2298
-	if ( 'attribute' == $context )
2298
+	if ('attribute' == $context)
2299 2299
 		$value = esc_attr($value);
2300
-	elseif ( 'js' == $context )
2300
+	elseif ('js' == $context)
2301 2301
 		$value = esc_js($value);
2302 2302
 
2303 2303
 	return $value;
@@ -2312,13 +2312,13 @@  discard block
 block discarded – undo
2312 2312
  *
2313 2313
  * @param int $post_id Post ID.
2314 2314
  */
2315
-function stick_post( $post_id ) {
2315
+function stick_post($post_id) {
2316 2316
 	$stickies = get_option('sticky_posts');
2317 2317
 
2318
-	if ( !is_array($stickies) )
2318
+	if ( ! is_array($stickies))
2319 2319
 		$stickies = array($post_id);
2320 2320
 
2321
-	if ( ! in_array($post_id, $stickies) )
2321
+	if ( ! in_array($post_id, $stickies))
2322 2322
 		$stickies[] = $post_id;
2323 2323
 
2324 2324
 	update_option('sticky_posts', $stickies);
@@ -2333,17 +2333,17 @@  discard block
 block discarded – undo
2333 2333
  *
2334 2334
  * @param int $post_id Post ID.
2335 2335
  */
2336
-function unstick_post( $post_id ) {
2336
+function unstick_post($post_id) {
2337 2337
 	$stickies = get_option('sticky_posts');
2338 2338
 
2339
-	if ( !is_array($stickies) )
2339
+	if ( ! is_array($stickies))
2340 2340
 		return;
2341 2341
 
2342
-	if ( ! in_array($post_id, $stickies) )
2342
+	if ( ! in_array($post_id, $stickies))
2343 2343
 		return;
2344 2344
 
2345 2345
 	$offset = array_search($post_id, $stickies);
2346
-	if ( false === $offset )
2346
+	if (false === $offset)
2347 2347
 		return;
2348 2348
 
2349 2349
 	array_splice($stickies, $offset, 1);
@@ -2360,12 +2360,12 @@  discard block
 block discarded – undo
2360 2360
  * @param string $perm Optional. 'readable' or empty. Default empty.
2361 2361
  * @return string The cache key.
2362 2362
  */
2363
-function _count_posts_cache_key( $type = 'post', $perm = '' ) {
2364
-	$cache_key = 'posts-' . $type;
2365
-	if ( 'readable' == $perm && is_user_logged_in() ) {
2366
-		$post_type_object = get_post_type_object( $type );
2367
-		if ( $post_type_object && ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
2368
-			$cache_key .= '_' . $perm . '_' . get_current_user_id();
2363
+function _count_posts_cache_key($type = 'post', $perm = '') {
2364
+	$cache_key = 'posts-'.$type;
2365
+	if ('readable' == $perm && is_user_logged_in()) {
2366
+		$post_type_object = get_post_type_object($type);
2367
+		if ($post_type_object && ! current_user_can($post_type_object->cap->read_private_posts)) {
2368
+			$cache_key .= '_'.$perm.'_'.get_current_user_id();
2369 2369
 		}
2370 2370
 	}
2371 2371
 	return $cache_key;
@@ -2390,40 +2390,40 @@  discard block
 block discarded – undo
2390 2390
  * @param string $perm Optional. 'readable' or empty. Default empty.
2391 2391
  * @return object Number of posts for each status.
2392 2392
  */
2393
-function wp_count_posts( $type = 'post', $perm = '' ) {
2393
+function wp_count_posts($type = 'post', $perm = '') {
2394 2394
 	global $wpdb;
2395 2395
 
2396
-	if ( ! post_type_exists( $type ) )
2396
+	if ( ! post_type_exists($type))
2397 2397
 		return new stdClass;
2398 2398
 
2399
-	$cache_key = _count_posts_cache_key( $type, $perm );
2399
+	$cache_key = _count_posts_cache_key($type, $perm);
2400 2400
 
2401
-	$counts = wp_cache_get( $cache_key, 'counts' );
2402
-	if ( false !== $counts ) {
2401
+	$counts = wp_cache_get($cache_key, 'counts');
2402
+	if (false !== $counts) {
2403 2403
 		/** This filter is documented in wp-includes/post.php */
2404
-		return apply_filters( 'wp_count_posts', $counts, $type, $perm );
2404
+		return apply_filters('wp_count_posts', $counts, $type, $perm);
2405 2405
 	}
2406 2406
 
2407 2407
 	$query = "SELECT post_status, COUNT( * ) AS num_posts FROM {$wpdb->posts} WHERE post_type = %s";
2408
-	if ( 'readable' == $perm && is_user_logged_in() ) {
2408
+	if ('readable' == $perm && is_user_logged_in()) {
2409 2409
 		$post_type_object = get_post_type_object($type);
2410
-		if ( ! current_user_can( $post_type_object->cap->read_private_posts ) ) {
2411
-			$query .= $wpdb->prepare( " AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
2410
+		if ( ! current_user_can($post_type_object->cap->read_private_posts)) {
2411
+			$query .= $wpdb->prepare(" AND (post_status != 'private' OR ( post_author = %d AND post_status = 'private' ))",
2412 2412
 				get_current_user_id()
2413 2413
 			);
2414 2414
 		}
2415 2415
 	}
2416 2416
 	$query .= ' GROUP BY post_status';
2417 2417
 
2418
-	$results = (array) $wpdb->get_results( $wpdb->prepare( $query, $type ), ARRAY_A );
2419
-	$counts = array_fill_keys( get_post_stati(), 0 );
2418
+	$results = (array) $wpdb->get_results($wpdb->prepare($query, $type), ARRAY_A);
2419
+	$counts = array_fill_keys(get_post_stati(), 0);
2420 2420
 
2421
-	foreach ( $results as $row ) {
2422
-		$counts[ $row['post_status'] ] = $row['num_posts'];
2421
+	foreach ($results as $row) {
2422
+		$counts[$row['post_status']] = $row['num_posts'];
2423 2423
 	}
2424 2424
 
2425 2425
 	$counts = (object) $counts;
2426
-	wp_cache_set( $cache_key, $counts, 'counts' );
2426
+	wp_cache_set($cache_key, $counts, 'counts');
2427 2427
 
2428 2428
 	/**
2429 2429
 	 * Modify returned post counts by status for the current post type.
@@ -2436,7 +2436,7 @@  discard block
 block discarded – undo
2436 2436
 	 * @param string $perm   The permission to determine if the posts are 'readable'
2437 2437
 	 *                       by the current user.
2438 2438
 	 */
2439
-	return apply_filters( 'wp_count_posts', $counts, $type, $perm );
2439
+	return apply_filters('wp_count_posts', $counts, $type, $perm);
2440 2440
 }
2441 2441
 
2442 2442
 /**
@@ -2455,17 +2455,17 @@  discard block
 block discarded – undo
2455 2455
  *                                MIME patterns. Default empty.
2456 2456
  * @return object An object containing the attachment counts by mime type.
2457 2457
  */
2458
-function wp_count_attachments( $mime_type = '' ) {
2458
+function wp_count_attachments($mime_type = '') {
2459 2459
 	global $wpdb;
2460 2460
 
2461
-	$and = wp_post_mime_type_where( $mime_type );
2462
-	$count = $wpdb->get_results( "SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A );
2461
+	$and = wp_post_mime_type_where($mime_type);
2462
+	$count = $wpdb->get_results("SELECT post_mime_type, COUNT( * ) AS num_posts FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' $and GROUP BY post_mime_type", ARRAY_A);
2463 2463
 
2464 2464
 	$counts = array();
2465
-	foreach( (array) $count as $row ) {
2466
-		$counts[ $row['post_mime_type'] ] = $row['num_posts'];
2465
+	foreach ((array) $count as $row) {
2466
+		$counts[$row['post_mime_type']] = $row['num_posts'];
2467 2467
 	}
2468
-	$counts['trash'] = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
2468
+	$counts['trash'] = $wpdb->get_var("SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status = 'trash' $and");
2469 2469
 
2470 2470
 	/**
2471 2471
 	 * Modify returned attachment counts by mime type.
@@ -2477,7 +2477,7 @@  discard block
 block discarded – undo
2477 2477
 	 * @param string $mime_type The mime type pattern used to filter the attachments
2478 2478
 	 *                          counted.
2479 2479
 	 */
2480
-	return apply_filters( 'wp_count_attachments', (object) $counts, $mime_type );
2480
+	return apply_filters('wp_count_attachments', (object) $counts, $mime_type);
2481 2481
 }
2482 2482
 
2483 2483
 /**
@@ -2501,7 +2501,7 @@  discard block
 block discarded – undo
2501 2501
 	 *
2502 2502
 	 * @param array $post_mime_types Default list of post mime types.
2503 2503
 	 */
2504
-	return apply_filters( 'post_mime_types', $post_mime_types );
2504
+	return apply_filters('post_mime_types', $post_mime_types);
2505 2505
 }
2506 2506
 
2507 2507
 /**
@@ -2518,35 +2518,35 @@  discard block
 block discarded – undo
2518 2518
  * @param string|array $real_mime_types     Real post mime type values.
2519 2519
  * @return array array(wildcard=>array(real types)).
2520 2520
  */
2521
-function wp_match_mime_types( $wildcard_mime_types, $real_mime_types ) {
2521
+function wp_match_mime_types($wildcard_mime_types, $real_mime_types) {
2522 2522
 	$matches = array();
2523
-	if ( is_string( $wildcard_mime_types ) ) {
2524
-		$wildcard_mime_types = array_map( 'trim', explode( ',', $wildcard_mime_types ) );
2523
+	if (is_string($wildcard_mime_types)) {
2524
+		$wildcard_mime_types = array_map('trim', explode(',', $wildcard_mime_types));
2525 2525
 	}
2526
-	if ( is_string( $real_mime_types ) ) {
2527
-		$real_mime_types = array_map( 'trim', explode( ',', $real_mime_types ) );
2526
+	if (is_string($real_mime_types)) {
2527
+		$real_mime_types = array_map('trim', explode(',', $real_mime_types));
2528 2528
 	}
2529 2529
 
2530 2530
 	$patternses = array();
2531 2531
 	$wild = '[-._a-z0-9]*';
2532 2532
 
2533
-	foreach ( (array) $wildcard_mime_types as $type ) {
2534
-		$mimes = array_map( 'trim', explode( ',', $type ) );
2535
-		foreach ( $mimes as $mime ) {
2536
-			$regex = str_replace( '__wildcard__', $wild, preg_quote( str_replace( '*', '__wildcard__', $mime ) ) );
2533
+	foreach ((array) $wildcard_mime_types as $type) {
2534
+		$mimes = array_map('trim', explode(',', $type));
2535
+		foreach ($mimes as $mime) {
2536
+			$regex = str_replace('__wildcard__', $wild, preg_quote(str_replace('*', '__wildcard__', $mime)));
2537 2537
 			$patternses[][$type] = "^$regex$";
2538
-			if ( false === strpos( $mime, '/' ) ) {
2538
+			if (false === strpos($mime, '/')) {
2539 2539
 				$patternses[][$type] = "^$regex/";
2540 2540
 				$patternses[][$type] = $regex;
2541 2541
 			}
2542 2542
 		}
2543 2543
 	}
2544
-	asort( $patternses );
2544
+	asort($patternses);
2545 2545
 
2546
-	foreach ( $patternses as $patterns ) {
2547
-		foreach ( $patterns as $type => $pattern ) {
2548
-			foreach ( (array) $real_mime_types as $real ) {
2549
-				if ( preg_match( "#$pattern#", $real ) && ( empty( $matches[$type] ) || false === array_search( $real, $matches[$type] ) ) ) {
2546
+	foreach ($patternses as $patterns) {
2547
+		foreach ($patterns as $type => $pattern) {
2548
+			foreach ((array) $real_mime_types as $real) {
2549
+				if (preg_match("#$pattern#", $real) && (empty($matches[$type]) || false === array_search($real, $matches[$type]))) {
2550 2550
 					$matches[$type][] = $real;
2551 2551
 				}
2552 2552
 			}
@@ -2566,43 +2566,43 @@  discard block
 block discarded – undo
2566 2566
  *                                      Default empty.
2567 2567
  * @return string The SQL AND clause for mime searching.
2568 2568
  */
2569
-function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) {
2569
+function wp_post_mime_type_where($post_mime_types, $table_alias = '') {
2570 2570
 	$where = '';
2571 2571
 	$wildcards = array('', '%', '%/%');
2572
-	if ( is_string($post_mime_types) )
2572
+	if (is_string($post_mime_types))
2573 2573
 		$post_mime_types = array_map('trim', explode(',', $post_mime_types));
2574 2574
 
2575 2575
 	$wheres = array();
2576 2576
 
2577
-	foreach ( (array) $post_mime_types as $mime_type ) {
2577
+	foreach ((array) $post_mime_types as $mime_type) {
2578 2578
 		$mime_type = preg_replace('/\s/', '', $mime_type);
2579 2579
 		$slashpos = strpos($mime_type, '/');
2580
-		if ( false !== $slashpos ) {
2580
+		if (false !== $slashpos) {
2581 2581
 			$mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));
2582 2582
 			$mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));
2583
-			if ( empty($mime_subgroup) )
2583
+			if (empty($mime_subgroup))
2584 2584
 				$mime_subgroup = '*';
2585 2585
 			else
2586 2586
 				$mime_subgroup = str_replace('/', '', $mime_subgroup);
2587 2587
 			$mime_pattern = "$mime_group/$mime_subgroup";
2588 2588
 		} else {
2589 2589
 			$mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type);
2590
-			if ( false === strpos($mime_pattern, '*') )
2590
+			if (false === strpos($mime_pattern, '*'))
2591 2591
 				$mime_pattern .= '/*';
2592 2592
 		}
2593 2593
 
2594 2594
 		$mime_pattern = preg_replace('/\*+/', '%', $mime_pattern);
2595 2595
 
2596
-		if ( in_array( $mime_type, $wildcards ) )
2596
+		if (in_array($mime_type, $wildcards))
2597 2597
 			return '';
2598 2598
 
2599
-		if ( false !== strpos($mime_pattern, '%') )
2599
+		if (false !== strpos($mime_pattern, '%'))
2600 2600
 			$wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";
2601 2601
 		else
2602 2602
 			$wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";
2603 2603
 	}
2604
-	if ( !empty($wheres) )
2605
-		$where = ' AND (' . join(' OR ', $wheres) . ') ';
2604
+	if ( ! empty($wheres))
2605
+		$where = ' AND ('.join(' OR ', $wheres).') ';
2606 2606
 	return $where;
2607 2607
 }
2608 2608
 
@@ -2627,17 +2627,17 @@  discard block
 block discarded – undo
2627 2627
  *                           Default false.
2628 2628
  * @return array|false|WP_Post False on failure.
2629 2629
  */
2630
-function wp_delete_post( $postid = 0, $force_delete = false ) {
2630
+function wp_delete_post($postid = 0, $force_delete = false) {
2631 2631
 	global $wpdb;
2632 2632
 
2633
-	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
2633
+	if ( ! $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)))
2634 2634
 		return $post;
2635 2635
 
2636
-	if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )
2637
-		return wp_trash_post( $postid );
2636
+	if ( ! $force_delete && ($post->post_type == 'post' || $post->post_type == 'page') && get_post_status($postid) != 'trash' && EMPTY_TRASH_DAYS)
2637
+		return wp_trash_post($postid);
2638 2638
 
2639
-	if ( $post->post_type == 'attachment' )
2640
-		return wp_delete_attachment( $postid, $force_delete );
2639
+	if ($post->post_type == 'attachment')
2640
+		return wp_delete_attachment($postid, $force_delete);
2641 2641
 
2642 2642
 	/**
2643 2643
 	 * Fires before a post is deleted, at the start of wp_delete_post().
@@ -2648,40 +2648,40 @@  discard block
 block discarded – undo
2648 2648
 	 *
2649 2649
 	 * @param int $postid Post ID.
2650 2650
 	 */
2651
-	do_action( 'before_delete_post', $postid );
2651
+	do_action('before_delete_post', $postid);
2652 2652
 
2653
-	delete_post_meta($postid,'_wp_trash_meta_status');
2654
-	delete_post_meta($postid,'_wp_trash_meta_time');
2653
+	delete_post_meta($postid, '_wp_trash_meta_status');
2654
+	delete_post_meta($postid, '_wp_trash_meta_time');
2655 2655
 
2656 2656
 	wp_delete_object_term_relationships($postid, get_object_taxonomies($post->post_type));
2657 2657
 
2658
-	$parent_data = array( 'post_parent' => $post->post_parent );
2659
-	$parent_where = array( 'post_parent' => $postid );
2658
+	$parent_data = array('post_parent' => $post->post_parent);
2659
+	$parent_where = array('post_parent' => $postid);
2660 2660
 
2661
-	if ( is_post_type_hierarchical( $post->post_type ) ) {
2661
+	if (is_post_type_hierarchical($post->post_type)) {
2662 2662
 		// Point children of this page to its parent, also clean the cache of affected children.
2663
-		$children_query = $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type );
2664
-		$children = $wpdb->get_results( $children_query );
2663
+		$children_query = $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE post_parent = %d AND post_type = %s", $postid, $post->post_type);
2664
+		$children = $wpdb->get_results($children_query);
2665 2665
 
2666
-		$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => $post->post_type ) );
2666
+		$wpdb->update($wpdb->posts, $parent_data, $parent_where + array('post_type' => $post->post_type));
2667 2667
 	}
2668 2668
 
2669 2669
 	// Do raw query. wp_get_post_revisions() is filtered.
2670
-	$revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) );
2670
+	$revision_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid));
2671 2671
 	// Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up.
2672
-	foreach ( $revision_ids as $revision_id )
2673
-		wp_delete_post_revision( $revision_id );
2672
+	foreach ($revision_ids as $revision_id)
2673
+		wp_delete_post_revision($revision_id);
2674 2674
 
2675 2675
 	// Point all attachments to this post up one level.
2676
-	$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
2676
+	$wpdb->update($wpdb->posts, $parent_data, $parent_where + array('post_type' => 'attachment'));
2677 2677
 
2678
-	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
2679
-	foreach ( $comment_ids as $comment_id )
2680
-		wp_delete_comment( $comment_id, true );
2678
+	$comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid));
2679
+	foreach ($comment_ids as $comment_id)
2680
+		wp_delete_comment($comment_id, true);
2681 2681
 
2682
-	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
2683
-	foreach ( $post_meta_ids as $mid )
2684
-		delete_metadata_by_mid( 'post', $mid );
2682
+	$post_meta_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid));
2683
+	foreach ($post_meta_ids as $mid)
2684
+		delete_metadata_by_mid('post', $mid);
2685 2685
 
2686 2686
 	/**
2687 2687
 	 * Fires immediately before a post is deleted from the database.
@@ -2690,9 +2690,9 @@  discard block
 block discarded – undo
2690 2690
 	 *
2691 2691
 	 * @param int $postid Post ID.
2692 2692
 	 */
2693
-	do_action( 'delete_post', $postid );
2694
-	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $postid ) );
2695
-	if ( ! $result ) {
2693
+	do_action('delete_post', $postid);
2694
+	$result = $wpdb->delete($wpdb->posts, array('ID' => $postid));
2695
+	if ( ! $result) {
2696 2696
 		return false;
2697 2697
 	}
2698 2698
 
@@ -2703,16 +2703,16 @@  discard block
 block discarded – undo
2703 2703
 	 *
2704 2704
 	 * @param int $postid Post ID.
2705 2705
 	 */
2706
-	do_action( 'deleted_post', $postid );
2706
+	do_action('deleted_post', $postid);
2707 2707
 
2708
-	clean_post_cache( $post );
2708
+	clean_post_cache($post);
2709 2709
 
2710
-	if ( is_post_type_hierarchical( $post->post_type ) && $children ) {
2711
-		foreach ( $children as $child )
2712
-			clean_post_cache( $child );
2710
+	if (is_post_type_hierarchical($post->post_type) && $children) {
2711
+		foreach ($children as $child)
2712
+			clean_post_cache($child);
2713 2713
 	}
2714 2714
 
2715
-	wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
2715
+	wp_clear_scheduled_hook('publish_future_post', array($postid));
2716 2716
 
2717 2717
 	/**
2718 2718
 	 * Fires after a post is deleted, at the conclusion of wp_delete_post().
@@ -2723,7 +2723,7 @@  discard block
 block discarded – undo
2723 2723
 	 *
2724 2724
 	 * @param int $postid Post ID.
2725 2725
 	 */
2726
-	do_action( 'after_delete_post', $postid );
2726
+	do_action('after_delete_post', $postid);
2727 2727
 
2728 2728
 	return $post;
2729 2729
 }
@@ -2739,22 +2739,22 @@  discard block
 block discarded – undo
2739 2739
  *
2740 2740
  * @param int $post_id Post ID.
2741 2741
  */
2742
-function _reset_front_page_settings_for_post( $post_id ) {
2743
-	$post = get_post( $post_id );
2744
-	if ( 'page' == $post->post_type ) {
2742
+function _reset_front_page_settings_for_post($post_id) {
2743
+	$post = get_post($post_id);
2744
+	if ('page' == $post->post_type) {
2745 2745
 	 	/*
2746 2746
 	 	 * If the page is defined in option page_on_front or post_for_posts,
2747 2747
 	 	 * adjust the corresponding options.
2748 2748
 	 	 */
2749
-		if ( get_option( 'page_on_front' ) == $post->ID ) {
2750
-			update_option( 'show_on_front', 'posts' );
2751
-			update_option( 'page_on_front', 0 );
2749
+		if (get_option('page_on_front') == $post->ID) {
2750
+			update_option('show_on_front', 'posts');
2751
+			update_option('page_on_front', 0);
2752 2752
 		}
2753
-		if ( get_option( 'page_for_posts' ) == $post->ID ) {
2754
-			delete_option( 'page_for_posts', 0 );
2753
+		if (get_option('page_for_posts') == $post->ID) {
2754
+			delete_option('page_for_posts', 0);
2755 2755
 		}
2756 2756
 	}
2757
-	unstick_post( $post->ID );
2757
+	unstick_post($post->ID);
2758 2758
 }
2759 2759
 
2760 2760
 /**
@@ -2770,14 +2770,14 @@  discard block
 block discarded – undo
2770 2770
  *                     if EMPTY_TRASH_DAYS equals true.
2771 2771
  * @return false|array|WP_Post|null Post data array, otherwise false.
2772 2772
  */
2773
-function wp_trash_post( $post_id = 0 ) {
2774
-	if ( !EMPTY_TRASH_DAYS )
2773
+function wp_trash_post($post_id = 0) {
2774
+	if ( ! EMPTY_TRASH_DAYS)
2775 2775
 		return wp_delete_post($post_id, true);
2776 2776
 
2777
-	if ( !$post = get_post($post_id, ARRAY_A) )
2777
+	if ( ! $post = get_post($post_id, ARRAY_A))
2778 2778
 		return $post;
2779 2779
 
2780
-	if ( $post['post_status'] == 'trash' )
2780
+	if ($post['post_status'] == 'trash')
2781 2781
 		return false;
2782 2782
 
2783 2783
 	/**
@@ -2787,10 +2787,10 @@  discard block
 block discarded – undo
2787 2787
 	 *
2788 2788
 	 * @param int $post_id Post ID.
2789 2789
 	 */
2790
-	do_action( 'wp_trash_post', $post_id );
2790
+	do_action('wp_trash_post', $post_id);
2791 2791
 
2792
-	add_post_meta($post_id,'_wp_trash_meta_status', $post['post_status']);
2793
-	add_post_meta($post_id,'_wp_trash_meta_time', time());
2792
+	add_post_meta($post_id, '_wp_trash_meta_status', $post['post_status']);
2793
+	add_post_meta($post_id, '_wp_trash_meta_time', time());
2794 2794
 
2795 2795
 	$post['post_status'] = 'trash';
2796 2796
 	wp_insert_post($post);
@@ -2804,7 +2804,7 @@  discard block
 block discarded – undo
2804 2804
 	 *
2805 2805
 	 * @param int $post_id Post ID.
2806 2806
 	 */
2807
-	do_action( 'trashed_post', $post_id );
2807
+	do_action('trashed_post', $post_id);
2808 2808
 
2809 2809
 	return $post;
2810 2810
 }
@@ -2817,11 +2817,11 @@  discard block
 block discarded – undo
2817 2817
  * @param int $post_id Optional. Post ID. Default is ID of the global $post.
2818 2818
  * @return WP_Post|false WP_Post object. False on failure.
2819 2819
  */
2820
-function wp_untrash_post( $post_id = 0 ) {
2821
-	if ( !$post = get_post($post_id, ARRAY_A) )
2820
+function wp_untrash_post($post_id = 0) {
2821
+	if ( ! $post = get_post($post_id, ARRAY_A))
2822 2822
 		return $post;
2823 2823
 
2824
-	if ( $post['post_status'] != 'trash' )
2824
+	if ($post['post_status'] != 'trash')
2825 2825
 		return false;
2826 2826
 
2827 2827
 	/**
@@ -2831,7 +2831,7 @@  discard block
 block discarded – undo
2831 2831
 	 *
2832 2832
 	 * @param int $post_id Post ID.
2833 2833
 	 */
2834
-	do_action( 'untrash_post', $post_id );
2834
+	do_action('untrash_post', $post_id);
2835 2835
 
2836 2836
 	$post_status = get_post_meta($post_id, '_wp_trash_meta_status', true);
2837 2837
 
@@ -2851,7 +2851,7 @@  discard block
 block discarded – undo
2851 2851
 	 *
2852 2852
 	 * @param int $post_id Post ID.
2853 2853
 	 */
2854
-	do_action( 'untrashed_post', $post_id );
2854
+	do_action('untrashed_post', $post_id);
2855 2855
 
2856 2856
 	return $post;
2857 2857
 }
@@ -2866,11 +2866,11 @@  discard block
 block discarded – undo
2866 2866
  * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2867 2867
  * @return mixed|void False on failure.
2868 2868
  */
2869
-function wp_trash_post_comments( $post = null ) {
2869
+function wp_trash_post_comments($post = null) {
2870 2870
 	global $wpdb;
2871 2871
 
2872 2872
 	$post = get_post($post);
2873
-	if ( empty($post) )
2873
+	if (empty($post))
2874 2874
 		return;
2875 2875
 
2876 2876
 	$post_id = $post->ID;
@@ -2882,22 +2882,22 @@  discard block
 block discarded – undo
2882 2882
 	 *
2883 2883
 	 * @param int $post_id Post ID.
2884 2884
 	 */
2885
-	do_action( 'trash_post_comments', $post_id );
2885
+	do_action('trash_post_comments', $post_id);
2886 2886
 
2887
-	$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
2888
-	if ( empty($comments) )
2887
+	$comments = $wpdb->get_results($wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id));
2888
+	if (empty($comments))
2889 2889
 		return;
2890 2890
 
2891 2891
 	// Cache current status for each comment.
2892 2892
 	$statuses = array();
2893
-	foreach ( $comments as $comment )
2893
+	foreach ($comments as $comment)
2894 2894
 		$statuses[$comment->comment_ID] = $comment->comment_approved;
2895 2895
 	add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);
2896 2896
 
2897 2897
 	// Set status for all comments to post-trashed.
2898 2898
 	$result = $wpdb->update($wpdb->comments, array('comment_approved' => 'post-trashed'), array('comment_post_ID' => $post_id));
2899 2899
 
2900
-	clean_comment_cache( array_keys($statuses) );
2900
+	clean_comment_cache(array_keys($statuses));
2901 2901
 
2902 2902
 	/**
2903 2903
 	 * Fires after comments are sent to the trash.
@@ -2907,7 +2907,7 @@  discard block
 block discarded – undo
2907 2907
 	 * @param int   $post_id  Post ID.
2908 2908
 	 * @param array $statuses Array of comment statuses.
2909 2909
 	 */
2910
-	do_action( 'trashed_post_comments', $post_id, $statuses );
2910
+	do_action('trashed_post_comments', $post_id, $statuses);
2911 2911
 
2912 2912
 	return $result;
2913 2913
 }
@@ -2922,18 +2922,18 @@  discard block
 block discarded – undo
2922 2922
  * @param int|WP_Post|null $post Optional. Post ID or post object. Defaults to global $post.
2923 2923
  * @return true|void
2924 2924
  */
2925
-function wp_untrash_post_comments( $post = null ) {
2925
+function wp_untrash_post_comments($post = null) {
2926 2926
 	global $wpdb;
2927 2927
 
2928 2928
 	$post = get_post($post);
2929
-	if ( empty($post) )
2929
+	if (empty($post))
2930 2930
 		return;
2931 2931
 
2932 2932
 	$post_id = $post->ID;
2933 2933
 
2934 2934
 	$statuses = get_post_meta($post_id, '_wp_trash_meta_comments_status', true);
2935 2935
 
2936
-	if ( empty($statuses) )
2936
+	if (empty($statuses))
2937 2937
 		return true;
2938 2938
 
2939 2939
 	/**
@@ -2943,23 +2943,23 @@  discard block
 block discarded – undo
2943 2943
 	 *
2944 2944
 	 * @param int $post_id Post ID.
2945 2945
 	 */
2946
-	do_action( 'untrash_post_comments', $post_id );
2946
+	do_action('untrash_post_comments', $post_id);
2947 2947
 
2948 2948
 	// Restore each comment to its original status.
2949 2949
 	$group_by_status = array();
2950
-	foreach ( $statuses as $comment_id => $comment_status )
2950
+	foreach ($statuses as $comment_id => $comment_status)
2951 2951
 		$group_by_status[$comment_status][] = $comment_id;
2952 2952
 
2953
-	foreach ( $group_by_status as $status => $comments ) {
2953
+	foreach ($group_by_status as $status => $comments) {
2954 2954
 		// Sanity check. This shouldn't happen.
2955
-		if ( 'post-trashed' == $status ) {
2955
+		if ('post-trashed' == $status) {
2956 2956
 			$status = '0';
2957 2957
 		}
2958
-		$comments_in = implode( ', ', array_map( 'intval', $comments ) );
2959
-		$wpdb->query( $wpdb->prepare( "UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status ) );
2958
+		$comments_in = implode(', ', array_map('intval', $comments));
2959
+		$wpdb->query($wpdb->prepare("UPDATE $wpdb->comments SET comment_approved = %s WHERE comment_ID IN ($comments_in)", $status));
2960 2960
 	}
2961 2961
 
2962
-	clean_comment_cache( array_keys($statuses) );
2962
+	clean_comment_cache(array_keys($statuses));
2963 2963
 
2964 2964
 	delete_post_meta($post_id, '_wp_trash_meta_comments_status');
2965 2965
 
@@ -2970,7 +2970,7 @@  discard block
 block discarded – undo
2970 2970
 	 *
2971 2971
 	 * @param int $post_id Post ID.
2972 2972
 	 */
2973
-	do_action( 'untrashed_post_comments', $post_id );
2973
+	do_action('untrashed_post_comments', $post_id);
2974 2974
 }
2975 2975
 
2976 2976
 /**
@@ -2988,11 +2988,11 @@  discard block
 block discarded – undo
2988 2988
  * @param array $args    Optional. Category arguments. Default empty.
2989 2989
  * @return array List of categories.
2990 2990
  */
2991
-function wp_get_post_categories( $post_id = 0, $args = array() ) {
2991
+function wp_get_post_categories($post_id = 0, $args = array()) {
2992 2992
 	$post_id = (int) $post_id;
2993 2993
 
2994 2994
 	$defaults = array('fields' => 'ids');
2995
-	$args = wp_parse_args( $args, $defaults );
2995
+	$args = wp_parse_args($args, $defaults);
2996 2996
 
2997 2997
 	$cats = wp_get_object_terms($post_id, 'category', $args);
2998 2998
 	return $cats;
@@ -3012,8 +3012,8 @@  discard block
 block discarded – undo
3012 3012
  * @param array $args Optional. Overwrite the defaults
3013 3013
  * @return array List of post tags.
3014 3014
  */
3015
-function wp_get_post_tags( $post_id = 0, $args = array() ) {
3016
-	return wp_get_post_terms( $post_id, 'post_tag', $args);
3015
+function wp_get_post_tags($post_id = 0, $args = array()) {
3016
+	return wp_get_post_terms($post_id, 'post_tag', $args);
3017 3017
 }
3018 3018
 
3019 3019
 /**
@@ -3032,11 +3032,11 @@  discard block
 block discarded – undo
3032 3032
  * @return array|WP_Error  List of post terms or empty array if no terms were found. WP_Error object
3033 3033
  *                         if `$taxonomy` doesn't exist.
3034 3034
  */
3035
-function wp_get_post_terms( $post_id = 0, $taxonomy = 'post_tag', $args = array() ) {
3035
+function wp_get_post_terms($post_id = 0, $taxonomy = 'post_tag', $args = array()) {
3036 3036
 	$post_id = (int) $post_id;
3037 3037
 
3038 3038
 	$defaults = array('fields' => 'all');
3039
-	$args = wp_parse_args( $args, $defaults );
3039
+	$args = wp_parse_args($args, $defaults);
3040 3040
 
3041 3041
 	$tags = wp_get_object_terms($post_id, $taxonomy, $args);
3042 3042
 
@@ -3054,11 +3054,11 @@  discard block
 block discarded – undo
3054 3054
  * @param string $output     Optional. Type of output. Accepts ARRAY_A or ''. Default ARRAY_A.
3055 3055
  * @return array|false Associative array if $output equals ARRAY_A, array or false if no results.
3056 3056
  */
3057
-function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
3057
+function wp_get_recent_posts($args = array(), $output = ARRAY_A) {
3058 3058
 
3059
-	if ( is_numeric( $args ) ) {
3060
-		_deprecated_argument( __FUNCTION__, '3.1', __( 'Passing an integer number of posts is deprecated. Pass an array of arguments instead.' ) );
3061
-		$args = array( 'numberposts' => absint( $args ) );
3059
+	if (is_numeric($args)) {
3060
+		_deprecated_argument(__FUNCTION__, '3.1', __('Passing an integer number of posts is deprecated. Pass an array of arguments instead.'));
3061
+		$args = array('numberposts' => absint($args));
3062 3062
 	}
3063 3063
 
3064 3064
 	// Set default arguments.
@@ -3071,14 +3071,14 @@  discard block
 block discarded – undo
3071 3071
 		'suppress_filters' => true
3072 3072
 	);
3073 3073
 
3074
-	$r = wp_parse_args( $args, $defaults );
3074
+	$r = wp_parse_args($args, $defaults);
3075 3075
 
3076
-	$results = get_posts( $r );
3076
+	$results = get_posts($r);
3077 3077
 
3078 3078
 	// Backward compatibility. Prior to 3.1 expected posts to be returned in array.
3079
-	if ( ARRAY_A == $output ){
3080
-		foreach( $results as $key => $result ) {
3081
-			$results[$key] = get_object_vars( $result );
3079
+	if (ARRAY_A == $output) {
3080
+		foreach ($results as $key => $result) {
3081
+			$results[$key] = get_object_vars($result);
3082 3082
 		}
3083 3083
 		return $results ? $results : array();
3084 3084
 	}
@@ -3140,7 +3140,7 @@  discard block
 block discarded – undo
3140 3140
  * @param bool  $wp_error Optional. Whether to allow return of WP_Error on failure. Default false.
3141 3141
  * @return int|WP_Error The post ID on success. The value 0 or WP_Error on failure.
3142 3142
  */
3143
-function wp_insert_post( $postarr, $wp_error = false ) {
3143
+function wp_insert_post($postarr, $wp_error = false) {
3144 3144
 	global $wpdb;
3145 3145
 
3146 3146
 	$user_id = get_current_user_id();
@@ -3167,7 +3167,7 @@  discard block
 block discarded – undo
3167 3167
 
3168 3168
 	$postarr = wp_parse_args($postarr, $defaults);
3169 3169
 
3170
-	unset( $postarr[ 'filter' ] );
3170
+	unset($postarr['filter']);
3171 3171
 
3172 3172
 	$postarr = sanitize_post($postarr, 'db');
3173 3173
 
@@ -3176,39 +3176,39 @@  discard block
 block discarded – undo
3176 3176
 	$update = false;
3177 3177
 	$guid = $postarr['guid'];
3178 3178
 
3179
-	if ( ! empty( $postarr['ID'] ) ) {
3179
+	if ( ! empty($postarr['ID'])) {
3180 3180
 		$update = true;
3181 3181
 
3182 3182
 		// Get the post ID and GUID.
3183 3183
 		$post_ID = $postarr['ID'];
3184
-		$post_before = get_post( $post_ID );
3185
-		if ( is_null( $post_before ) ) {
3186
-			if ( $wp_error ) {
3187
-				return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
3184
+		$post_before = get_post($post_ID);
3185
+		if (is_null($post_before)) {
3186
+			if ($wp_error) {
3187
+				return new WP_Error('invalid_post', __('Invalid post ID.'));
3188 3188
 			}
3189 3189
 			return 0;
3190 3190
 		}
3191 3191
 
3192
-		$guid = get_post_field( 'guid', $post_ID );
3193
-		$previous_status = get_post_field('post_status', $post_ID );
3192
+		$guid = get_post_field('guid', $post_ID);
3193
+		$previous_status = get_post_field('post_status', $post_ID);
3194 3194
 	} else {
3195 3195
 		$previous_status = 'new';
3196 3196
 	}
3197 3197
 
3198
-	$post_type = empty( $postarr['post_type'] ) ? 'post' : $postarr['post_type'];
3198
+	$post_type = empty($postarr['post_type']) ? 'post' : $postarr['post_type'];
3199 3199
 
3200 3200
 	$post_title = $postarr['post_title'];
3201 3201
 	$post_content = $postarr['post_content'];
3202 3202
 	$post_excerpt = $postarr['post_excerpt'];
3203
-	if ( isset( $postarr['post_name'] ) ) {
3203
+	if (isset($postarr['post_name'])) {
3204 3204
 		$post_name = $postarr['post_name'];
3205 3205
 	}
3206 3206
 
3207 3207
 	$maybe_empty = 'attachment' !== $post_type
3208 3208
 		&& ! $post_content && ! $post_title && ! $post_excerpt
3209
-		&& post_type_supports( $post_type, 'editor' )
3210
-		&& post_type_supports( $post_type, 'title' )
3211
-		&& post_type_supports( $post_type, 'excerpt' );
3209
+		&& post_type_supports($post_type, 'editor')
3210
+		&& post_type_supports($post_type, 'title')
3211
+		&& post_type_supports($post_type, 'excerpt');
3212 3212
 
3213 3213
 	/**
3214 3214
 	 * Filter whether the post should be considered "empty".
@@ -3226,36 +3226,36 @@  discard block
 block discarded – undo
3226 3226
 	 * @param bool  $maybe_empty Whether the post should be considered "empty".
3227 3227
 	 * @param array $postarr     Array of post data.
3228 3228
 	 */
3229
-	if ( apply_filters( 'wp_insert_post_empty_content', $maybe_empty, $postarr ) ) {
3230
-		if ( $wp_error ) {
3231
-			return new WP_Error( 'empty_content', __( 'Content, title, and excerpt are empty.' ) );
3229
+	if (apply_filters('wp_insert_post_empty_content', $maybe_empty, $postarr)) {
3230
+		if ($wp_error) {
3231
+			return new WP_Error('empty_content', __('Content, title, and excerpt are empty.'));
3232 3232
 		} else {
3233 3233
 			return 0;
3234 3234
 		}
3235 3235
 	}
3236 3236
 
3237
-	$post_status = empty( $postarr['post_status'] ) ? 'draft' : $postarr['post_status'];
3238
-	if ( 'attachment' === $post_type && ! in_array( $post_status, array( 'inherit', 'private', 'trash' ) ) ) {
3237
+	$post_status = empty($postarr['post_status']) ? 'draft' : $postarr['post_status'];
3238
+	if ('attachment' === $post_type && ! in_array($post_status, array('inherit', 'private', 'trash'))) {
3239 3239
 		$post_status = 'inherit';
3240 3240
 	}
3241 3241
 
3242
-	if ( ! empty( $postarr['post_category'] ) ) {
3242
+	if ( ! empty($postarr['post_category'])) {
3243 3243
 		// Filter out empty terms.
3244
-		$post_category = array_filter( $postarr['post_category'] );
3244
+		$post_category = array_filter($postarr['post_category']);
3245 3245
 	}
3246 3246
 
3247 3247
 	// Make sure we set a valid category.
3248
-	if ( empty( $post_category ) || 0 == count( $post_category ) || ! is_array( $post_category ) ) {
3248
+	if (empty($post_category) || 0 == count($post_category) || ! is_array($post_category)) {
3249 3249
 		// 'post' requires at least one category.
3250
-		if ( 'post' == $post_type && 'auto-draft' != $post_status ) {
3251
-			$post_category = array( get_option('default_category') );
3250
+		if ('post' == $post_type && 'auto-draft' != $post_status) {
3251
+			$post_category = array(get_option('default_category'));
3252 3252
 		} else {
3253 3253
 			$post_category = array();
3254 3254
 		}
3255 3255
 	}
3256 3256
 
3257 3257
 	// Don't allow contributors to set the post slug for pending review posts.
3258
-	if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) ) {
3258
+	if ('pending' == $post_status && ! current_user_can('publish_posts')) {
3259 3259
 		$post_name = '';
3260 3260
 	}
3261 3261
 
@@ -3263,16 +3263,16 @@  discard block
 block discarded – undo
3263 3263
 	 * Create a valid post name. Drafts and pending posts are allowed to have
3264 3264
 	 * an empty post name.
3265 3265
 	 */
3266
-	if ( empty($post_name) ) {
3267
-		if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
3266
+	if (empty($post_name)) {
3267
+		if ( ! in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
3268 3268
 			$post_name = sanitize_title($post_title);
3269 3269
 		} else {
3270 3270
 			$post_name = '';
3271 3271
 		}
3272 3272
 	} else {
3273 3273
 		// On updates, we need to check to see if it's using the old, fixed sanitization context.
3274
-		$check_name = sanitize_title( $post_name, '', 'old-save' );
3275
-		if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $post_ID ) == $check_name ) {
3274
+		$check_name = sanitize_title($post_name, '', 'old-save');
3275
+		if ($update && strtolower(urlencode($post_name)) == $check_name && get_post_field('post_name', $post_ID) == $check_name) {
3276 3276
 			$post_name = $check_name;
3277 3277
 		} else { // new post, or slug has changed.
3278 3278
 			$post_name = sanitize_title($post_name);
@@ -3283,28 +3283,28 @@  discard block
 block discarded – undo
3283 3283
 	 * If the post date is empty (due to having been new or a draft) and status
3284 3284
 	 * is not 'draft' or 'pending', set date to now.
3285 3285
 	 */
3286
-	if ( empty( $postarr['post_date'] ) || '0000-00-00 00:00:00' == $postarr['post_date'] ) {
3287
-		$post_date = current_time( 'mysql' );
3286
+	if (empty($postarr['post_date']) || '0000-00-00 00:00:00' == $postarr['post_date']) {
3287
+		$post_date = current_time('mysql');
3288 3288
 	} else {
3289 3289
 		$post_date = $postarr['post_date'];
3290 3290
 	}
3291 3291
 
3292 3292
 	// Validate the date.
3293
-	$mm = substr( $post_date, 5, 2 );
3294
-	$jj = substr( $post_date, 8, 2 );
3295
-	$aa = substr( $post_date, 0, 4 );
3296
-	$valid_date = wp_checkdate( $mm, $jj, $aa, $post_date );
3297
-	if ( ! $valid_date ) {
3298
-		if ( $wp_error ) {
3299
-			return new WP_Error( 'invalid_date', __( 'Whoops, the provided date is invalid.' ) );
3293
+	$mm = substr($post_date, 5, 2);
3294
+	$jj = substr($post_date, 8, 2);
3295
+	$aa = substr($post_date, 0, 4);
3296
+	$valid_date = wp_checkdate($mm, $jj, $aa, $post_date);
3297
+	if ( ! $valid_date) {
3298
+		if ($wp_error) {
3299
+			return new WP_Error('invalid_date', __('Whoops, the provided date is invalid.'));
3300 3300
 		} else {
3301 3301
 			return 0;
3302 3302
 		}
3303 3303
 	}
3304 3304
 
3305
-	if ( empty( $postarr['post_date_gmt'] ) || '0000-00-00 00:00:00' == $postarr['post_date_gmt'] ) {
3306
-		if ( ! in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) {
3307
-			$post_date_gmt = get_gmt_from_date( $post_date );
3305
+	if (empty($postarr['post_date_gmt']) || '0000-00-00 00:00:00' == $postarr['post_date_gmt']) {
3306
+		if ( ! in_array($post_status, array('draft', 'pending', 'auto-draft'))) {
3307
+			$post_date_gmt = get_gmt_from_date($post_date);
3308 3308
 		} else {
3309 3309
 			$post_date_gmt = '0000-00-00 00:00:00';
3310 3310
 		}
@@ -3312,34 +3312,34 @@  discard block
 block discarded – undo
3312 3312
 		$post_date_gmt = $postarr['post_date_gmt'];
3313 3313
 	}
3314 3314
 
3315
-	if ( $update || '0000-00-00 00:00:00' == $post_date ) {
3316
-		$post_modified     = current_time( 'mysql' );
3317
-		$post_modified_gmt = current_time( 'mysql', 1 );
3315
+	if ($update || '0000-00-00 00:00:00' == $post_date) {
3316
+		$post_modified     = current_time('mysql');
3317
+		$post_modified_gmt = current_time('mysql', 1);
3318 3318
 	} else {
3319 3319
 		$post_modified     = $post_date;
3320 3320
 		$post_modified_gmt = $post_date_gmt;
3321 3321
 	}
3322 3322
 
3323
-	if ( 'attachment' !== $post_type ) {
3324
-		if ( 'publish' == $post_status ) {
3323
+	if ('attachment' !== $post_type) {
3324
+		if ('publish' == $post_status) {
3325 3325
 			$now = gmdate('Y-m-d H:i:59');
3326
-			if ( mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false) ) {
3326
+			if (mysql2date('U', $post_date_gmt, false) > mysql2date('U', $now, false)) {
3327 3327
 				$post_status = 'future';
3328 3328
 			}
3329
-		} elseif ( 'future' == $post_status ) {
3329
+		} elseif ('future' == $post_status) {
3330 3330
 			$now = gmdate('Y-m-d H:i:59');
3331
-			if ( mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false) ) {
3331
+			if (mysql2date('U', $post_date_gmt, false) <= mysql2date('U', $now, false)) {
3332 3332
 				$post_status = 'publish';
3333 3333
 			}
3334 3334
 		}
3335 3335
 	}
3336 3336
 
3337 3337
 	// Comment status.
3338
-	if ( empty( $postarr['comment_status'] ) ) {
3339
-		if ( $update ) {
3338
+	if (empty($postarr['comment_status'])) {
3339
+		if ($update) {
3340 3340
 			$comment_status = 'closed';
3341 3341
 		} else {
3342
-			$comment_status = get_default_comment_status( $post_type );
3342
+			$comment_status = get_default_comment_status($post_type);
3343 3343
 		}
3344 3344
 	} else {
3345 3345
 		$comment_status = $postarr['comment_status'];
@@ -3347,28 +3347,28 @@  discard block
 block discarded – undo
3347 3347
 
3348 3348
 	// These variables are needed by compact() later.
3349 3349
 	$post_content_filtered = $postarr['post_content_filtered'];
3350
-	$post_author = empty( $postarr['post_author'] ) ? $user_id : $postarr['post_author'];
3351
-	$ping_status = empty( $postarr['ping_status'] ) ? get_default_comment_status( $post_type, 'pingback' ) : $postarr['ping_status'];
3352
-	$to_ping = isset( $postarr['to_ping'] ) ? sanitize_trackback_urls( $postarr['to_ping'] ) : '';
3353
-	$pinged = isset( $postarr['pinged'] ) ? $postarr['pinged'] : '';
3354
-	$import_id = isset( $postarr['import_id'] ) ? $postarr['import_id'] : 0;
3350
+	$post_author = empty($postarr['post_author']) ? $user_id : $postarr['post_author'];
3351
+	$ping_status = empty($postarr['ping_status']) ? get_default_comment_status($post_type, 'pingback') : $postarr['ping_status'];
3352
+	$to_ping = isset($postarr['to_ping']) ? sanitize_trackback_urls($postarr['to_ping']) : '';
3353
+	$pinged = isset($postarr['pinged']) ? $postarr['pinged'] : '';
3354
+	$import_id = isset($postarr['import_id']) ? $postarr['import_id'] : 0;
3355 3355
 
3356 3356
 	/*
3357 3357
 	 * The 'wp_insert_post_parent' filter expects all variables to be present.
3358 3358
 	 * Previously, these variables would have already been extracted
3359 3359
 	 */
3360
-	if ( isset( $postarr['menu_order'] ) ) {
3360
+	if (isset($postarr['menu_order'])) {
3361 3361
 		$menu_order = (int) $postarr['menu_order'];
3362 3362
 	} else {
3363 3363
 		$menu_order = 0;
3364 3364
 	}
3365 3365
 
3366
-	$post_password = isset( $postarr['post_password'] ) ? $postarr['post_password'] : '';
3367
-	if ( 'private' == $post_status ) {
3366
+	$post_password = isset($postarr['post_password']) ? $postarr['post_password'] : '';
3367
+	if ('private' == $post_status) {
3368 3368
 		$post_password = '';
3369 3369
 	}
3370 3370
 
3371
-	if ( isset( $postarr['post_parent'] ) ) {
3371
+	if (isset($postarr['post_parent'])) {
3372 3372
 		$post_parent = (int) $postarr['post_parent'];
3373 3373
 	} else {
3374 3374
 		$post_parent = 0;
@@ -3384,28 +3384,28 @@  discard block
 block discarded – undo
3384 3384
 	 * @param array $new_postarr Array of parsed post data.
3385 3385
 	 * @param array $postarr     Array of sanitized, but otherwise unmodified post data.
3386 3386
 	 */
3387
-	$post_parent = apply_filters( 'wp_insert_post_parent', $post_parent, $post_ID, compact( array_keys( $postarr ) ), $postarr );
3387
+	$post_parent = apply_filters('wp_insert_post_parent', $post_parent, $post_ID, compact(array_keys($postarr)), $postarr);
3388 3388
 
3389
-	$post_name = wp_unique_post_slug( $post_name, $post_ID, $post_status, $post_type, $post_parent );
3389
+	$post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
3390 3390
 
3391 3391
 	// Don't unslash.
3392
-	$post_mime_type = isset( $postarr['post_mime_type'] ) ? $postarr['post_mime_type'] : '';
3392
+	$post_mime_type = isset($postarr['post_mime_type']) ? $postarr['post_mime_type'] : '';
3393 3393
 
3394 3394
 	// Expected_slashed (everything!).
3395
-	$data = compact( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' );
3395
+	$data = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid');
3396 3396
 
3397
-	$emoji_fields = array( 'post_title', 'post_content', 'post_excerpt' );
3397
+	$emoji_fields = array('post_title', 'post_content', 'post_excerpt');
3398 3398
 
3399
-	foreach( $emoji_fields as $emoji_field ) {
3400
-		if ( isset( $data[ $emoji_field ] ) ) {
3401
-			$charset = $wpdb->get_col_charset( $wpdb->posts, $emoji_field );
3402
-			if ( 'utf8' === $charset ) {
3403
-				$data[ $emoji_field ] = wp_encode_emoji( $data[ $emoji_field ] );
3399
+	foreach ($emoji_fields as $emoji_field) {
3400
+		if (isset($data[$emoji_field])) {
3401
+			$charset = $wpdb->get_col_charset($wpdb->posts, $emoji_field);
3402
+			if ('utf8' === $charset) {
3403
+				$data[$emoji_field] = wp_encode_emoji($data[$emoji_field]);
3404 3404
 			}
3405 3405
 		}
3406 3406
 	}
3407 3407
 
3408
-	if ( 'attachment' === $post_type ) {
3408
+	if ('attachment' === $post_type) {
3409 3409
 		/**
3410 3410
 		 * Filter attachment post data before it is updated in or added to the database.
3411 3411
 		 *
@@ -3414,7 +3414,7 @@  discard block
 block discarded – undo
3414 3414
 		 * @param array $data    An array of sanitized attachment post data.
3415 3415
 		 * @param array $postarr An array of unsanitized attachment post data.
3416 3416
 		 */
3417
-		$data = apply_filters( 'wp_insert_attachment_data', $data, $postarr );
3417
+		$data = apply_filters('wp_insert_attachment_data', $data, $postarr);
3418 3418
 	} else {
3419 3419
 		/**
3420 3420
 		 * Filter slashed post data just before it is inserted into the database.
@@ -3424,12 +3424,12 @@  discard block
 block discarded – undo
3424 3424
 		 * @param array $data    An array of slashed post data.
3425 3425
 		 * @param array $postarr An array of sanitized, but otherwise unmodified post data.
3426 3426
 		 */
3427
-		$data = apply_filters( 'wp_insert_post_data', $data, $postarr );
3427
+		$data = apply_filters('wp_insert_post_data', $data, $postarr);
3428 3428
 	}
3429
-	$data = wp_unslash( $data );
3430
-	$where = array( 'ID' => $post_ID );
3429
+	$data = wp_unslash($data);
3430
+	$where = array('ID' => $post_ID);
3431 3431
 
3432
-	if ( $update ) {
3432
+	if ($update) {
3433 3433
 		/**
3434 3434
 		 * Fires immediately before an existing post is updated in the database.
3435 3435
 		 *
@@ -3438,9 +3438,9 @@  discard block
 block discarded – undo
3438 3438
 		 * @param int   $post_ID Post ID.
3439 3439
 		 * @param array $data    Array of unslashed post data.
3440 3440
 		 */
3441
-		do_action( 'pre_post_update', $post_ID, $data );
3442
-		if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
3443
-			if ( $wp_error ) {
3441
+		do_action('pre_post_update', $post_ID, $data);
3442
+		if (false === $wpdb->update($wpdb->posts, $data, $where)) {
3443
+			if ($wp_error) {
3444 3444
 				return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
3445 3445
 			} else {
3446 3446
 				return 0;
@@ -3448,14 +3448,14 @@  discard block
 block discarded – undo
3448 3448
 		}
3449 3449
 	} else {
3450 3450
 		// If there is a suggested ID, use it if not already present.
3451
-		if ( ! empty( $import_id ) ) {
3451
+		if ( ! empty($import_id)) {
3452 3452
 			$import_id = (int) $import_id;
3453
-			if ( ! $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id) ) ) {
3453
+			if ( ! $wpdb->get_var($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE ID = %d", $import_id))) {
3454 3454
 				$data['ID'] = $import_id;
3455 3455
 			}
3456 3456
 		}
3457
-		if ( false === $wpdb->insert( $wpdb->posts, $data ) ) {
3458
-			if ( $wp_error ) {
3457
+		if (false === $wpdb->insert($wpdb->posts, $data)) {
3458
+			if ($wp_error) {
3459 3459
 				return new WP_Error('db_insert_error', __('Could not insert post into the database'), $wpdb->last_error);
3460 3460
 			} else {
3461 3461
 				return 0;
@@ -3464,75 +3464,75 @@  discard block
 block discarded – undo
3464 3464
 		$post_ID = (int) $wpdb->insert_id;
3465 3465
 
3466 3466
 		// Use the newly generated $post_ID.
3467
-		$where = array( 'ID' => $post_ID );
3467
+		$where = array('ID' => $post_ID);
3468 3468
 	}
3469 3469
 
3470
-	if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) {
3471
-		$data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent );
3472
-		$wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where );
3473
-		clean_post_cache( $post_ID );
3470
+	if (empty($data['post_name']) && ! in_array($data['post_status'], array('draft', 'pending', 'auto-draft'))) {
3471
+		$data['post_name'] = wp_unique_post_slug(sanitize_title($data['post_title'], $post_ID), $post_ID, $data['post_status'], $post_type, $post_parent);
3472
+		$wpdb->update($wpdb->posts, array('post_name' => $data['post_name']), $where);
3473
+		clean_post_cache($post_ID);
3474 3474
 	}
3475 3475
 
3476
-	if ( is_object_in_taxonomy( $post_type, 'category' ) ) {
3477
-		wp_set_post_categories( $post_ID, $post_category );
3476
+	if (is_object_in_taxonomy($post_type, 'category')) {
3477
+		wp_set_post_categories($post_ID, $post_category);
3478 3478
 	}
3479 3479
 
3480
-	if ( isset( $postarr['tags_input'] ) && is_object_in_taxonomy( $post_type, 'post_tag' ) ) {
3481
-		wp_set_post_tags( $post_ID, $postarr['tags_input'] );
3480
+	if (isset($postarr['tags_input']) && is_object_in_taxonomy($post_type, 'post_tag')) {
3481
+		wp_set_post_tags($post_ID, $postarr['tags_input']);
3482 3482
 	}
3483 3483
 
3484 3484
 	// New-style support for all custom taxonomies.
3485
-	if ( ! empty( $postarr['tax_input'] ) ) {
3486
-		foreach ( $postarr['tax_input'] as $taxonomy => $tags ) {
3485
+	if ( ! empty($postarr['tax_input'])) {
3486
+		foreach ($postarr['tax_input'] as $taxonomy => $tags) {
3487 3487
 			$taxonomy_obj = get_taxonomy($taxonomy);
3488 3488
 			// array = hierarchical, string = non-hierarchical.
3489
-			if ( is_array( $tags ) ) {
3489
+			if (is_array($tags)) {
3490 3490
 				$tags = array_filter($tags);
3491 3491
 			}
3492
-			if ( current_user_can( $taxonomy_obj->cap->assign_terms ) ) {
3493
-				wp_set_post_terms( $post_ID, $tags, $taxonomy );
3492
+			if (current_user_can($taxonomy_obj->cap->assign_terms)) {
3493
+				wp_set_post_terms($post_ID, $tags, $taxonomy);
3494 3494
 			}
3495 3495
 		}
3496 3496
 	}
3497 3497
 
3498
-	$current_guid = get_post_field( 'guid', $post_ID );
3498
+	$current_guid = get_post_field('guid', $post_ID);
3499 3499
 
3500 3500
 	// Set GUID.
3501
-	if ( ! $update && '' == $current_guid ) {
3502
-		$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post_ID ) ), $where );
3501
+	if ( ! $update && '' == $current_guid) {
3502
+		$wpdb->update($wpdb->posts, array('guid' => get_permalink($post_ID)), $where);
3503 3503
 	}
3504 3504
 
3505
-	if ( 'attachment' === $postarr['post_type'] ) {
3506
-		if ( ! empty( $postarr['file'] ) ) {
3507
-			update_attached_file( $post_ID, $postarr['file'] );
3505
+	if ('attachment' === $postarr['post_type']) {
3506
+		if ( ! empty($postarr['file'])) {
3507
+			update_attached_file($post_ID, $postarr['file']);
3508 3508
 		}
3509 3509
 
3510
-		if ( ! empty( $postarr['context'] ) ) {
3511
-			add_post_meta( $post_ID, '_wp_attachment_context', $postarr['context'], true );
3510
+		if ( ! empty($postarr['context'])) {
3511
+			add_post_meta($post_ID, '_wp_attachment_context', $postarr['context'], true);
3512 3512
 		}
3513 3513
 	}
3514 3514
 
3515
-	clean_post_cache( $post_ID );
3515
+	clean_post_cache($post_ID);
3516 3516
 
3517
-	$post = get_post( $post_ID );
3517
+	$post = get_post($post_ID);
3518 3518
 
3519
-	if ( ! empty( $postarr['page_template'] ) && 'page' == $data['post_type'] ) {
3519
+	if ( ! empty($postarr['page_template']) && 'page' == $data['post_type']) {
3520 3520
 		$post->page_template = $postarr['page_template'];
3521
-		$page_templates = wp_get_theme()->get_page_templates( $post );
3522
-		if ( 'default' != $postarr['page_template'] && ! isset( $page_templates[ $postarr['page_template'] ] ) ) {
3523
-			if ( $wp_error ) {
3521
+		$page_templates = wp_get_theme()->get_page_templates($post);
3522
+		if ('default' != $postarr['page_template'] && ! isset($page_templates[$postarr['page_template']])) {
3523
+			if ($wp_error) {
3524 3524
 				return new WP_Error('invalid_page_template', __('The page template is invalid.'));
3525 3525
 			}
3526
-			update_post_meta( $post_ID, '_wp_page_template', 'default' );
3526
+			update_post_meta($post_ID, '_wp_page_template', 'default');
3527 3527
 		} else {
3528
-			update_post_meta( $post_ID, '_wp_page_template', $postarr['page_template'] );
3528
+			update_post_meta($post_ID, '_wp_page_template', $postarr['page_template']);
3529 3529
 		}
3530 3530
 	}
3531 3531
 
3532
-	if ( 'attachment' !== $postarr['post_type'] ) {
3533
-		wp_transition_post_status( $data['post_status'], $previous_status, $post );
3532
+	if ('attachment' !== $postarr['post_type']) {
3533
+		wp_transition_post_status($data['post_status'], $previous_status, $post);
3534 3534
 	} else {
3535
-		if ( $update ) {
3535
+		if ($update) {
3536 3536
 			/**
3537 3537
 			 * Fires once an existing attachment has been updated.
3538 3538
 			 *
@@ -3540,7 +3540,7 @@  discard block
 block discarded – undo
3540 3540
 			 *
3541 3541
 			 * @param int $post_ID Attachment ID.
3542 3542
 			 */
3543
-			do_action( 'edit_attachment', $post_ID );
3543
+			do_action('edit_attachment', $post_ID);
3544 3544
 		} else {
3545 3545
 
3546 3546
 			/**
@@ -3550,13 +3550,13 @@  discard block
 block discarded – undo
3550 3550
 			 *
3551 3551
 			 * @param int $post_ID Attachment ID.
3552 3552
 			 */
3553
-			do_action( 'add_attachment', $post_ID );
3553
+			do_action('add_attachment', $post_ID);
3554 3554
 		}
3555 3555
 
3556 3556
 		return $post_ID;
3557 3557
 	}
3558 3558
 
3559
-	if ( $update ) {
3559
+	if ($update) {
3560 3560
 		/**
3561 3561
 		 * Fires once an existing post has been updated.
3562 3562
 		 *
@@ -3565,7 +3565,7 @@  discard block
 block discarded – undo
3565 3565
 		 * @param int     $post_ID Post ID.
3566 3566
 		 * @param WP_Post $post    Post object.
3567 3567
 		 */
3568
-		do_action( 'edit_post', $post_ID, $post );
3568
+		do_action('edit_post', $post_ID, $post);
3569 3569
 		$post_after = get_post($post_ID);
3570 3570
 
3571 3571
 		/**
@@ -3577,7 +3577,7 @@  discard block
 block discarded – undo
3577 3577
 		 * @param WP_Post $post_after   Post object following the update.
3578 3578
 		 * @param WP_Post $post_before  Post object before the update.
3579 3579
 		 */
3580
-		do_action( 'post_updated', $post_ID, $post_after, $post_before);
3580
+		do_action('post_updated', $post_ID, $post_after, $post_before);
3581 3581
 	}
3582 3582
 
3583 3583
 	/**
@@ -3592,7 +3592,7 @@  discard block
 block discarded – undo
3592 3592
 	 * @param WP_Post $post    Post object.
3593 3593
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3594 3594
 	 */
3595
-	do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
3595
+	do_action("save_post_{$post->post_type}", $post_ID, $post, $update);
3596 3596
 
3597 3597
 	/**
3598 3598
 	 * Fires once a post has been saved.
@@ -3603,7 +3603,7 @@  discard block
 block discarded – undo
3603 3603
 	 * @param WP_Post $post    Post object.
3604 3604
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3605 3605
 	 */
3606
-	do_action( 'save_post', $post_ID, $post, $update );
3606
+	do_action('save_post', $post_ID, $post, $update);
3607 3607
 
3608 3608
 	/**
3609 3609
 	 * Fires once a post has been saved.
@@ -3614,7 +3614,7 @@  discard block
 block discarded – undo
3614 3614
 	 * @param WP_Post $post    Post object.
3615 3615
 	 * @param bool    $update  Whether this is an existing post being updated or not.
3616 3616
 	 */
3617
-	do_action( 'wp_insert_post', $post_ID, $post, $update );
3617
+	do_action('wp_insert_post', $post_ID, $post, $update);
3618 3618
 
3619 3619
 	return $post_ID;
3620 3620
 }
@@ -3632,8 +3632,8 @@  discard block
 block discarded – undo
3632 3632
  * @param bool         $wp_error Optional. Allow return of WP_Error on failure. Default false.
3633 3633
  * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success.
3634 3634
  */
3635
-function wp_update_post( $postarr = array(), $wp_error = false ) {
3636
-	if ( is_object($postarr) ) {
3635
+function wp_update_post($postarr = array(), $wp_error = false) {
3636
+	if (is_object($postarr)) {
3637 3637
 		// Non-escaped post was passed.
3638 3638
 		$postarr = get_object_vars($postarr);
3639 3639
 		$postarr = wp_slash($postarr);
@@ -3642,9 +3642,9 @@  discard block
 block discarded – undo
3642 3642
 	// First, get all of the original fields.
3643 3643
 	$post = get_post($postarr['ID'], ARRAY_A);
3644 3644
 
3645
-	if ( is_null( $post ) ) {
3646
-		if ( $wp_error )
3647
-			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
3645
+	if (is_null($post)) {
3646
+		if ($wp_error)
3647
+			return new WP_Error('invalid_post', __('Invalid post ID.'));
3648 3648
 		return 0;
3649 3649
 	}
3650 3650
 
@@ -3652,15 +3652,15 @@  discard block
 block discarded – undo
3652 3652
 	$post = wp_slash($post);
3653 3653
 
3654 3654
 	// Passed post category list overwrites existing category list if not empty.
3655
-	if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
3656
-			 && 0 != count($postarr['post_category']) )
3655
+	if (isset($postarr['post_category']) && is_array($postarr['post_category'])
3656
+			 && 0 != count($postarr['post_category']))
3657 3657
 		$post_cats = $postarr['post_category'];
3658 3658
 	else
3659 3659
 		$post_cats = $post['post_category'];
3660 3660
 
3661 3661
 	// Drafts shouldn't be assigned a date unless explicitly done so by the user.
3662
-	if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
3663
-			 ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
3662
+	if (isset($post['post_status']) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
3663
+			 ('0000-00-00 00:00:00' == $post['post_date_gmt']))
3664 3664
 		$clear_date = true;
3665 3665
 	else
3666 3666
 		$clear_date = false;
@@ -3668,7 +3668,7 @@  discard block
 block discarded – undo
3668 3668
 	// Merge old and new fields with new fields overwriting old ones.
3669 3669
 	$postarr = array_merge($post, $postarr);
3670 3670
 	$postarr['post_category'] = $post_cats;
3671
-	if ( $clear_date ) {
3671
+	if ($clear_date) {
3672 3672
 		$postarr['post_date'] = current_time('mysql');
3673 3673
 		$postarr['post_date_gmt'] = '';
3674 3674
 	}
@@ -3676,7 +3676,7 @@  discard block
 block discarded – undo
3676 3676
 	if ($postarr['post_type'] == 'attachment')
3677 3677
 		return wp_insert_attachment($postarr);
3678 3678
 
3679
-	return wp_insert_post( $postarr, $wp_error );
3679
+	return wp_insert_post($postarr, $wp_error);
3680 3680
 }
3681 3681
 
3682 3682
 /**
@@ -3688,34 +3688,34 @@  discard block
 block discarded – undo
3688 3688
  *
3689 3689
  * @param int|WP_Post $post Post ID or post object.
3690 3690
  */
3691
-function wp_publish_post( $post ) {
3691
+function wp_publish_post($post) {
3692 3692
 	global $wpdb;
3693 3693
 
3694
-	if ( ! $post = get_post( $post ) )
3694
+	if ( ! $post = get_post($post))
3695 3695
 		return;
3696 3696
 
3697
-	if ( 'publish' == $post->post_status )
3697
+	if ('publish' == $post->post_status)
3698 3698
 		return;
3699 3699
 
3700
-	$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
3700
+	$wpdb->update($wpdb->posts, array('post_status' => 'publish'), array('ID' => $post->ID));
3701 3701
 
3702
-	clean_post_cache( $post->ID );
3702
+	clean_post_cache($post->ID);
3703 3703
 
3704 3704
 	$old_status = $post->post_status;
3705 3705
 	$post->post_status = 'publish';
3706
-	wp_transition_post_status( 'publish', $old_status, $post );
3706
+	wp_transition_post_status('publish', $old_status, $post);
3707 3707
 
3708 3708
 	/** This action is documented in wp-includes/post.php */
3709
-	do_action( 'edit_post', $post->ID, $post );
3709
+	do_action('edit_post', $post->ID, $post);
3710 3710
 
3711 3711
 	/** This action is documented in wp-includes/post.php */
3712
-	do_action( "save_post_{$post->post_type}", $post->ID, $post, true );
3712
+	do_action("save_post_{$post->post_type}", $post->ID, $post, true);
3713 3713
 
3714 3714
 	/** This action is documented in wp-includes/post.php */
3715
-	do_action( 'save_post', $post->ID, $post, true );
3715
+	do_action('save_post', $post->ID, $post, true);
3716 3716
 
3717 3717
 	/** This action is documented in wp-includes/post.php */
3718
-	do_action( 'wp_insert_post', $post->ID, $post, true );
3718
+	do_action('wp_insert_post', $post->ID, $post, true);
3719 3719
 }
3720 3720
 
3721 3721
 /**
@@ -3728,26 +3728,26 @@  discard block
 block discarded – undo
3728 3728
  *
3729 3729
  * @param int|WP_Post $post_id Post ID or post object.
3730 3730
  */
3731
-function check_and_publish_future_post( $post_id ) {
3731
+function check_and_publish_future_post($post_id) {
3732 3732
 	$post = get_post($post_id);
3733 3733
 
3734
-	if ( empty($post) )
3734
+	if (empty($post))
3735 3735
 		return;
3736 3736
 
3737
-	if ( 'future' != $post->post_status )
3737
+	if ('future' != $post->post_status)
3738 3738
 		return;
3739 3739
 
3740
-	$time = strtotime( $post->post_date_gmt . ' GMT' );
3740
+	$time = strtotime($post->post_date_gmt.' GMT');
3741 3741
 
3742 3742
 	// Uh oh, someone jumped the gun!
3743
-	if ( $time > time() ) {
3744
-		wp_clear_scheduled_hook( 'publish_future_post', array( $post_id ) ); // clear anything else in the system
3745
-		wp_schedule_single_event( $time, 'publish_future_post', array( $post_id ) );
3743
+	if ($time > time()) {
3744
+		wp_clear_scheduled_hook('publish_future_post', array($post_id)); // clear anything else in the system
3745
+		wp_schedule_single_event($time, 'publish_future_post', array($post_id));
3746 3746
 		return;
3747 3747
 	}
3748 3748
 
3749 3749
 	// wp_publish_post(_ returns no meaninful value
3750
-	wp_publish_post( $post_id );
3750
+	wp_publish_post($post_id);
3751 3751
 }
3752 3752
 
3753 3753
 /**
@@ -3765,8 +3765,8 @@  discard block
 block discarded – undo
3765 3765
  * @param int    $post_parent Post parent ID.
3766 3766
  * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
3767 3767
  */
3768
-function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
3769
-	if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
3768
+function wp_unique_post_slug($slug, $post_ID, $post_status, $post_type, $post_parent) {
3769
+	if (in_array($post_status, array('draft', 'pending', 'auto-draft')) || ('inherit' == $post_status && 'revision' == $post_type))
3770 3770
 		return $slug;
3771 3771
 
3772 3772
 	global $wpdb, $wp_rewrite;
@@ -3774,13 +3774,13 @@  discard block
 block discarded – undo
3774 3774
 	$original_slug = $slug;
3775 3775
 
3776 3776
 	$feeds = $wp_rewrite->feeds;
3777
-	if ( ! is_array( $feeds ) )
3777
+	if ( ! is_array($feeds))
3778 3778
 		$feeds = array();
3779 3779
 
3780
-	if ( 'attachment' == $post_type ) {
3780
+	if ('attachment' == $post_type) {
3781 3781
 		// Attachment slugs must be unique across all types.
3782 3782
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1";
3783
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_ID ) );
3783
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID));
3784 3784
 
3785 3785
 		/**
3786 3786
 		 * Filter whether the post slug would make a bad attachment slug.
@@ -3790,17 +3790,17 @@  discard block
 block discarded – undo
3790 3790
 		 * @param bool   $bad_slug Whether the slug would be bad as an attachment slug.
3791 3791
 		 * @param string $slug     The post slug.
3792 3792
 		 */
3793
-		if ( $post_name_check || in_array( $slug, $feeds ) || apply_filters( 'wp_unique_post_slug_is_bad_attachment_slug', false, $slug ) ) {
3793
+		if ($post_name_check || in_array($slug, $feeds) || apply_filters('wp_unique_post_slug_is_bad_attachment_slug', false, $slug)) {
3794 3794
 			$suffix = 2;
3795 3795
 			do {
3796
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3797
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_ID ) );
3796
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3797
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_ID));
3798 3798
 				$suffix++;
3799
-			} while ( $post_name_check );
3799
+			} while ($post_name_check);
3800 3800
 			$slug = $alt_post_name;
3801 3801
 		}
3802
-	} elseif ( is_post_type_hierarchical( $post_type ) ) {
3803
-		if ( 'nav_menu_item' == $post_type )
3802
+	} elseif (is_post_type_hierarchical($post_type)) {
3803
+		if ('nav_menu_item' == $post_type)
3804 3804
 			return $slug;
3805 3805
 
3806 3806
 		/*
@@ -3808,7 +3808,7 @@  discard block
 block discarded – undo
3808 3808
 		 * namespace than posts so page slugs are allowed to overlap post slugs.
3809 3809
 		 */
3810 3810
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( %s, 'attachment' ) AND ID != %d AND post_parent = %d LIMIT 1";
3811
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID, $post_parent ) );
3811
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID, $post_parent));
3812 3812
 
3813 3813
 		/**
3814 3814
 		 * Filter whether the post slug would make a bad hierarchical post slug.
@@ -3820,26 +3820,26 @@  discard block
 block discarded – undo
3820 3820
 		 * @param string $post_type   Post type.
3821 3821
 		 * @param int    $post_parent Post parent ID.
3822 3822
 		 */
3823
-		if ( $post_name_check || in_array( $slug, $feeds ) || preg_match( "@^($wp_rewrite->pagination_base)?\d+$@", $slug )  || apply_filters( 'wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent ) ) {
3823
+		if ($post_name_check || in_array($slug, $feeds) || preg_match("@^($wp_rewrite->pagination_base)?\d+$@", $slug) || apply_filters('wp_unique_post_slug_is_bad_hierarchical_slug', false, $slug, $post_type, $post_parent)) {
3824 3824
 			$suffix = 2;
3825 3825
 			do {
3826
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3827
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID, $post_parent ) );
3826
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3827
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID, $post_parent));
3828 3828
 				$suffix++;
3829
-			} while ( $post_name_check );
3829
+			} while ($post_name_check);
3830 3830
 			$slug = $alt_post_name;
3831 3831
 		}
3832 3832
 	} else {
3833 3833
 		// Post slugs must be unique across all posts.
3834 3834
 		$check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type = %s AND ID != %d LIMIT 1";
3835
-		$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $slug, $post_type, $post_ID ) );
3835
+		$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_type, $post_ID));
3836 3836
 
3837 3837
 		// Prevent new post slugs that could result in URLs that conflict with date archives.
3838
-		$post = get_post( $post_ID );
3838
+		$post = get_post($post_ID);
3839 3839
 		$conflicts_with_date_archive = false;
3840
-		if ( 'post' === $post_type && ( ! $post || $post->post_name !== $slug ) && preg_match( '/^[0-9]+$/', $slug ) && $slug_num = intval( $slug ) ) {
3841
-			$permastructs   = array_values( array_filter( explode( '/', get_option( 'permalink_structure' ) ) ) );
3842
-			$postname_index = array_search( '%postname%', $permastructs );
3840
+		if ('post' === $post_type && ( ! $post || $post->post_name !== $slug) && preg_match('/^[0-9]+$/', $slug) && $slug_num = intval($slug)) {
3841
+			$permastructs   = array_values(array_filter(explode('/', get_option('permalink_structure'))));
3842
+			$postname_index = array_search('%postname%', $permastructs);
3843 3843
 
3844 3844
 			/*
3845 3845
 			 * Potential date clashes are as follows:
@@ -3848,9 +3848,9 @@  discard block
 block discarded – undo
3848 3848
 			 * - An integer between 1 and 12 that follows 'year' conflicts with 'monthnum'.
3849 3849
 			 * - An integer between 1 and 31 that follows 'monthnum' conflicts with 'day'.
3850 3850
 			 */
3851
-			if ( 0 === $postname_index ||
3852
-				( $postname_index && '%year%' === $permastructs[ $postname_index - 1 ] && 13 > $slug_num ) ||
3853
-				( $postname_index && '%monthnum%' === $permastructs[ $postname_index - 1 ] && 32 > $slug_num )
3851
+			if (0 === $postname_index ||
3852
+				($postname_index && '%year%' === $permastructs[$postname_index - 1] && 13 > $slug_num) ||
3853
+				($postname_index && '%monthnum%' === $permastructs[$postname_index - 1] && 32 > $slug_num)
3854 3854
 			) {
3855 3855
 				$conflicts_with_date_archive = true;
3856 3856
 			}
@@ -3865,13 +3865,13 @@  discard block
 block discarded – undo
3865 3865
 		 * @param string $slug      The post slug.
3866 3866
 		 * @param string $post_type Post type.
3867 3867
 		 */
3868
-		if ( $post_name_check || in_array( $slug, $feeds ) || $conflicts_with_date_archive || apply_filters( 'wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type ) ) {
3868
+		if ($post_name_check || in_array($slug, $feeds) || $conflicts_with_date_archive || apply_filters('wp_unique_post_slug_is_bad_flat_slug', false, $slug, $post_type)) {
3869 3869
 			$suffix = 2;
3870 3870
 			do {
3871
-				$alt_post_name = _truncate_post_slug( $slug, 200 - ( strlen( $suffix ) + 1 ) ) . "-$suffix";
3872
-				$post_name_check = $wpdb->get_var( $wpdb->prepare( $check_sql, $alt_post_name, $post_type, $post_ID ) );
3871
+				$alt_post_name = _truncate_post_slug($slug, 200 - (strlen($suffix) + 1))."-$suffix";
3872
+				$post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $alt_post_name, $post_type, $post_ID));
3873 3873
 				$suffix++;
3874
-			} while ( $post_name_check );
3874
+			} while ($post_name_check);
3875 3875
 			$slug = $alt_post_name;
3876 3876
 		}
3877 3877
 	}
@@ -3888,7 +3888,7 @@  discard block
 block discarded – undo
3888 3888
 	 * @param int    $post_parent   Post parent ID
3889 3889
 	 * @param string $original_slug The original post slug.
3890 3890
 	 */
3891
-	return apply_filters( 'wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug );
3891
+	return apply_filters('wp_unique_post_slug', $slug, $post_ID, $post_status, $post_type, $post_parent, $original_slug);
3892 3892
 }
3893 3893
 
3894 3894
 /**
@@ -3903,16 +3903,16 @@  discard block
 block discarded – undo
3903 3903
  * @param int    $length Optional. Max length of the slug. Default 200 (characters).
3904 3904
  * @return string The truncated slug.
3905 3905
  */
3906
-function _truncate_post_slug( $slug, $length = 200 ) {
3907
-	if ( strlen( $slug ) > $length ) {
3908
-		$decoded_slug = urldecode( $slug );
3909
-		if ( $decoded_slug === $slug )
3910
-			$slug = substr( $slug, 0, $length );
3906
+function _truncate_post_slug($slug, $length = 200) {
3907
+	if (strlen($slug) > $length) {
3908
+		$decoded_slug = urldecode($slug);
3909
+		if ($decoded_slug === $slug)
3910
+			$slug = substr($slug, 0, $length);
3911 3911
 		else
3912
-			$slug = utf8_uri_encode( $decoded_slug, $length );
3912
+			$slug = utf8_uri_encode($decoded_slug, $length);
3913 3913
 	}
3914 3914
 
3915
-	return rtrim( $slug, '-' );
3915
+	return rtrim($slug, '-');
3916 3916
 }
3917 3917
 
3918 3918
 /**
@@ -3927,7 +3927,7 @@  discard block
 block discarded – undo
3927 3927
  * @param string $tags    Optional. The tags to set for the post, separated by commas. Default empty.
3928 3928
  * @return array|false|WP_Error Will return false if $post_id is not an integer or is 0.
3929 3929
  */
3930
-function wp_add_post_tags( $post_id = 0, $tags = '' ) {
3930
+function wp_add_post_tags($post_id = 0, $tags = '') {
3931 3931
 	return wp_set_post_tags($post_id, $tags, true);
3932 3932
 }
3933 3933
 
@@ -3945,8 +3945,8 @@  discard block
 block discarded – undo
3945 3945
  *                        replace the tags with the new tags. Default false.
3946 3946
  * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure.
3947 3947
  */
3948
-function wp_set_post_tags( $post_id = 0, $tags = '', $append = false ) {
3949
-	return wp_set_post_terms( $post_id, $tags, 'post_tag', $append);
3948
+function wp_set_post_tags($post_id = 0, $tags = '', $append = false) {
3949
+	return wp_set_post_terms($post_id, $tags, 'post_tag', $append);
3950 3950
 }
3951 3951
 
3952 3952
 /**
@@ -3963,31 +3963,31 @@  discard block
 block discarded – undo
3963 3963
  *                         replace the tags with the new tags. Default false.
3964 3964
  * @return array|false|WP_Error Array of affected term IDs. WP_Error or false on failure.
3965 3965
  */
3966
-function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
3966
+function wp_set_post_terms($post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false) {
3967 3967
 	$post_id = (int) $post_id;
3968 3968
 
3969
-	if ( !$post_id )
3969
+	if ( ! $post_id)
3970 3970
 		return false;
3971 3971
 
3972
-	if ( empty($tags) )
3972
+	if (empty($tags))
3973 3973
 		$tags = array();
3974 3974
 
3975
-	if ( ! is_array( $tags ) ) {
3976
-		$comma = _x( ',', 'tag delimiter' );
3977
-		if ( ',' !== $comma )
3978
-			$tags = str_replace( $comma, ',', $tags );
3979
-		$tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) );
3975
+	if ( ! is_array($tags)) {
3976
+		$comma = _x(',', 'tag delimiter');
3977
+		if (',' !== $comma)
3978
+			$tags = str_replace($comma, ',', $tags);
3979
+		$tags = explode(',', trim($tags, " \n\t\r\0\x0B,"));
3980 3980
 	}
3981 3981
 
3982 3982
 	/*
3983 3983
 	 * Hierarchical taxonomies must always pass IDs rather than names so that
3984 3984
 	 * children with the same names but different parents aren't confused.
3985 3985
 	 */
3986
-	if ( is_taxonomy_hierarchical( $taxonomy ) ) {
3987
-		$tags = array_unique( array_map( 'intval', $tags ) );
3986
+	if (is_taxonomy_hierarchical($taxonomy)) {
3987
+		$tags = array_unique(array_map('intval', $tags));
3988 3988
 	}
3989 3989
 
3990
-	return wp_set_object_terms( $post_id, $tags, $taxonomy, $append );
3990
+	return wp_set_object_terms($post_id, $tags, $taxonomy, $append);
3991 3991
 }
3992 3992
 
3993 3993
 /**
@@ -4006,24 +4006,24 @@  discard block
 block discarded – undo
4006 4006
  *                                  If false, replace the categories with the new categories.
4007 4007
  * @return array|bool|WP_Error
4008 4008
  */
4009
-function wp_set_post_categories( $post_ID = 0, $post_categories = array(), $append = false ) {
4009
+function wp_set_post_categories($post_ID = 0, $post_categories = array(), $append = false) {
4010 4010
 	$post_ID = (int) $post_ID;
4011
-	$post_type = get_post_type( $post_ID );
4012
-	$post_status = get_post_status( $post_ID );
4011
+	$post_type = get_post_type($post_ID);
4012
+	$post_status = get_post_status($post_ID);
4013 4013
 	// If $post_categories isn't already an array, make it one:
4014 4014
 	$post_categories = (array) $post_categories;
4015
-	if ( empty( $post_categories ) ) {
4016
-		if ( 'post' == $post_type && 'auto-draft' != $post_status ) {
4017
-			$post_categories = array( get_option('default_category') );
4015
+	if (empty($post_categories)) {
4016
+		if ('post' == $post_type && 'auto-draft' != $post_status) {
4017
+			$post_categories = array(get_option('default_category'));
4018 4018
 			$append = false;
4019 4019
 		} else {
4020 4020
 			$post_categories = array();
4021 4021
 		}
4022
-	} elseif ( 1 == count( $post_categories ) && '' == reset( $post_categories ) ) {
4022
+	} elseif (1 == count($post_categories) && '' == reset($post_categories)) {
4023 4023
 		return true;
4024 4024
 	}
4025 4025
 
4026
-	return wp_set_post_terms( $post_ID, $post_categories, 'category', $append );
4026
+	return wp_set_post_terms($post_ID, $post_categories, 'category', $append);
4027 4027
 }
4028 4028
 
4029 4029
 /**
@@ -4047,7 +4047,7 @@  discard block
 block discarded – undo
4047 4047
  * @param string  $old_status Previous post status.
4048 4048
  * @param WP_Post $post Post data.
4049 4049
  */
4050
-function wp_transition_post_status( $new_status, $old_status, $post ) {
4050
+function wp_transition_post_status($new_status, $old_status, $post) {
4051 4051
 	/**
4052 4052
 	 * Fires when a post is transitioned from one status to another.
4053 4053
 	 *
@@ -4057,7 +4057,7 @@  discard block
 block discarded – undo
4057 4057
 	 * @param string  $old_status Old post status.
4058 4058
 	 * @param WP_Post $post       Post object.
4059 4059
 	 */
4060
-	do_action( 'transition_post_status', $new_status, $old_status, $post );
4060
+	do_action('transition_post_status', $new_status, $old_status, $post);
4061 4061
 
4062 4062
 	/**
4063 4063
 	 * Fires when a post is transitioned from one status to another.
@@ -4069,7 +4069,7 @@  discard block
 block discarded – undo
4069 4069
 	 *
4070 4070
 	 * @param WP_Post $post Post object.
4071 4071
 	 */
4072
-	do_action( "{$old_status}_to_{$new_status}", $post );
4072
+	do_action("{$old_status}_to_{$new_status}", $post);
4073 4073
 
4074 4074
 	/**
4075 4075
 	 * Fires when a post is transitioned from one status to another.
@@ -4090,7 +4090,7 @@  discard block
 block discarded – undo
4090 4090
 	 * @param int     $post_id Post ID.
4091 4091
 	 * @param WP_Post $post    Post object.
4092 4092
 	 */
4093
-	do_action( "{$new_status}_{$post->post_type}", $post->ID, $post );
4093
+	do_action("{$new_status}_{$post->post_type}", $post->ID, $post);
4094 4094
 }
4095 4095
 
4096 4096
 //
@@ -4108,9 +4108,9 @@  discard block
 block discarded – undo
4108 4108
  * @param string $uri     Ping URI.
4109 4109
  * @return int|false How many rows were updated.
4110 4110
  */
4111
-function add_ping( $post_id, $uri ) {
4111
+function add_ping($post_id, $uri) {
4112 4112
 	global $wpdb;
4113
-	$pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
4113
+	$pung = $wpdb->get_var($wpdb->prepare("SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id));
4114 4114
 	$pung = trim($pung);
4115 4115
 	$pung = preg_split('/\s/', $pung);
4116 4116
 	$pung[] = $uri;
@@ -4123,11 +4123,11 @@  discard block
 block discarded – undo
4123 4123
 	 *
4124 4124
 	 * @param string $new New ping URL to add.
4125 4125
 	 */
4126
-	$new = apply_filters( 'add_ping', $new );
4126
+	$new = apply_filters('add_ping', $new);
4127 4127
 
4128 4128
 	// expected_slashed ($new).
4129 4129
 	$new = wp_unslash($new);
4130
-	return $wpdb->update( $wpdb->posts, array( 'pinged' => $new ), array( 'ID' => $post_id ) );
4130
+	return $wpdb->update($wpdb->posts, array('pinged' => $new), array('ID' => $post_id));
4131 4131
 }
4132 4132
 
4133 4133
 /**
@@ -4138,18 +4138,18 @@  discard block
 block discarded – undo
4138 4138
  * @param int $post_id Post ID.
4139 4139
  * @return array List of enclosures.
4140 4140
  */
4141
-function get_enclosed( $post_id ) {
4142
-	$custom_fields = get_post_custom( $post_id );
4141
+function get_enclosed($post_id) {
4142
+	$custom_fields = get_post_custom($post_id);
4143 4143
 	$pung = array();
4144
-	if ( !is_array( $custom_fields ) )
4144
+	if ( ! is_array($custom_fields))
4145 4145
 		return $pung;
4146 4146
 
4147
-	foreach ( $custom_fields as $key => $val ) {
4148
-		if ( 'enclosure' != $key || !is_array( $val ) )
4147
+	foreach ($custom_fields as $key => $val) {
4148
+		if ('enclosure' != $key || ! is_array($val))
4149 4149
 			continue;
4150
-		foreach( $val as $enc ) {
4151
-			$enclosure = explode( "\n", $enc );
4152
-			$pung[] = trim( $enclosure[ 0 ] );
4150
+		foreach ($val as $enc) {
4151
+			$enclosure = explode("\n", $enc);
4152
+			$pung[] = trim($enclosure[0]);
4153 4153
 		}
4154 4154
 	}
4155 4155
 
@@ -4161,7 +4161,7 @@  discard block
 block discarded – undo
4161 4161
 	 * @param array $pung    Array of enclosures for the given post.
4162 4162
 	 * @param int   $post_id Post ID.
4163 4163
 	 */
4164
-	return apply_filters( 'get_enclosed', $pung, $post_id );
4164
+	return apply_filters('get_enclosed', $pung, $post_id);
4165 4165
 }
4166 4166
 
4167 4167
 /**
@@ -4174,9 +4174,9 @@  discard block
 block discarded – undo
4174 4174
  * @param int $post_id Post ID.
4175 4175
  * @return array
4176 4176
  */
4177
-function get_pung( $post_id ) {
4177
+function get_pung($post_id) {
4178 4178
 	global $wpdb;
4179
-	$pung = $wpdb->get_var( $wpdb->prepare( "SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id ));
4179
+	$pung = $wpdb->get_var($wpdb->prepare("SELECT pinged FROM $wpdb->posts WHERE ID = %d", $post_id));
4180 4180
 	$pung = trim($pung);
4181 4181
 	$pung = preg_split('/\s/', $pung);
4182 4182
 
@@ -4187,7 +4187,7 @@  discard block
 block discarded – undo
4187 4187
 	 *
4188 4188
 	 * @param array $pung Array of URLs already pinged for the given post.
4189 4189
 	 */
4190
-	return apply_filters( 'get_pung', $pung );
4190
+	return apply_filters('get_pung', $pung);
4191 4191
 }
4192 4192
 
4193 4193
 /**
@@ -4200,10 +4200,10 @@  discard block
 block discarded – undo
4200 4200
  * @param int $post_id Post ID
4201 4201
  * @return array
4202 4202
  */
4203
-function get_to_ping( $post_id ) {
4203
+function get_to_ping($post_id) {
4204 4204
 	global $wpdb;
4205
-	$to_ping = $wpdb->get_var( $wpdb->prepare( "SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id ));
4206
-	$to_ping = sanitize_trackback_urls( $to_ping );
4205
+	$to_ping = $wpdb->get_var($wpdb->prepare("SELECT to_ping FROM $wpdb->posts WHERE ID = %d", $post_id));
4206
+	$to_ping = sanitize_trackback_urls($to_ping);
4207 4207
 	$to_ping = preg_split('/\s/', $to_ping, -1, PREG_SPLIT_NO_EMPTY);
4208 4208
 
4209 4209
 	/**
@@ -4213,7 +4213,7 @@  discard block
 block discarded – undo
4213 4213
 	 *
4214 4214
 	 * @param array $to_ping List of URLs yet to ping.
4215 4215
 	 */
4216
-	return apply_filters( 'get_to_ping', $to_ping );
4216
+	return apply_filters('get_to_ping', $to_ping);
4217 4217
 }
4218 4218
 
4219 4219
 /**
@@ -4224,22 +4224,22 @@  discard block
 block discarded – undo
4224 4224
  * @param string $tb_list Comma separated list of URLs.
4225 4225
  * @param int    $post_id Post ID.
4226 4226
  */
4227
-function trackback_url_list( $tb_list, $post_id ) {
4228
-	if ( ! empty( $tb_list ) ) {
4227
+function trackback_url_list($tb_list, $post_id) {
4228
+	if ( ! empty($tb_list)) {
4229 4229
 		// Get post data.
4230
-		$postdata = get_post( $post_id, ARRAY_A );
4230
+		$postdata = get_post($post_id, ARRAY_A);
4231 4231
 
4232 4232
 		// Form an excerpt.
4233
-		$excerpt = strip_tags( $postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content'] );
4233
+		$excerpt = strip_tags($postdata['post_excerpt'] ? $postdata['post_excerpt'] : $postdata['post_content']);
4234 4234
 
4235
-		if ( strlen( $excerpt ) > 255 ) {
4236
-			$excerpt = substr( $excerpt, 0, 252 ) . '&hellip;';
4235
+		if (strlen($excerpt) > 255) {
4236
+			$excerpt = substr($excerpt, 0, 252).'&hellip;';
4237 4237
 		}
4238 4238
 
4239
-		$trackback_urls = explode( ',', $tb_list );
4240
-		foreach( (array) $trackback_urls as $tb_url ) {
4241
-			$tb_url = trim( $tb_url );
4242
-			trackback( $tb_url, wp_unslash( $postdata['post_title'] ), $excerpt, $post_id );
4239
+		$trackback_urls = explode(',', $tb_list);
4240
+		foreach ((array) $trackback_urls as $tb_url) {
4241
+			$tb_url = trim($tb_url);
4242
+			trackback($tb_url, wp_unslash($postdata['post_title']), $excerpt, $post_id);
4243 4243
 		}
4244 4244
 	}
4245 4245
 }
@@ -4261,7 +4261,7 @@  discard block
 block discarded – undo
4261 4261
 	global $wpdb;
4262 4262
 
4263 4263
 	$page_ids = wp_cache_get('all_page_ids', 'posts');
4264
-	if ( ! is_array( $page_ids ) ) {
4264
+	if ( ! is_array($page_ids)) {
4265 4265
 		$page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'");
4266 4266
 		wp_cache_add('all_page_ids', $page_ids, 'posts');
4267 4267
 	}
@@ -4284,8 +4284,8 @@  discard block
 block discarded – undo
4284 4284
  *                       'edit', 'db', 'display'. Default 'raw'.
4285 4285
  * @return WP_Post|array|null WP_Post on success or null on failure.
4286 4286
  */
4287
-function get_page( $page, $output = OBJECT, $filter = 'raw') {
4288
-	return get_post( $page, $output, $filter );
4287
+function get_page($page, $output = OBJECT, $filter = 'raw') {
4288
+	return get_post($page, $output, $filter);
4289 4289
 }
4290 4290
 
4291 4291
 /**
@@ -4301,26 +4301,26 @@  discard block
 block discarded – undo
4301 4301
  * @param string|array $post_type Optional. Post type or array of post types. Default 'page'.
4302 4302
  * @return WP_Post|array|void WP_Post on success.
4303 4303
  */
4304
-function get_page_by_path( $page_path, $output = OBJECT, $post_type = 'page' ) {
4304
+function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
4305 4305
 	global $wpdb;
4306 4306
 
4307 4307
 	$page_path = rawurlencode(urldecode($page_path));
4308 4308
 	$page_path = str_replace('%2F', '/', $page_path);
4309 4309
 	$page_path = str_replace('%20', ' ', $page_path);
4310
-	$parts = explode( '/', trim( $page_path, '/' ) );
4311
-	$parts = esc_sql( $parts );
4312
-	$parts = array_map( 'sanitize_title_for_query', $parts );
4310
+	$parts = explode('/', trim($page_path, '/'));
4311
+	$parts = esc_sql($parts);
4312
+	$parts = array_map('sanitize_title_for_query', $parts);
4313 4313
 
4314
-	$in_string = "'" . implode( "','", $parts ) . "'";
4314
+	$in_string = "'".implode("','", $parts)."'";
4315 4315
 
4316
-	if ( is_array( $post_type ) ) {
4316
+	if (is_array($post_type)) {
4317 4317
 		$post_types = $post_type;
4318 4318
 	} else {
4319
-		$post_types = array( $post_type, 'attachment' );
4319
+		$post_types = array($post_type, 'attachment');
4320 4320
 	}
4321 4321
 
4322
-	$post_types = esc_sql( $post_types );
4323
-	$post_type_in_string = "'" . implode( "','", $post_types ) . "'";
4322
+	$post_types = esc_sql($post_types);
4323
+	$post_type_in_string = "'".implode("','", $post_types)."'";
4324 4324
 	$sql = "
4325 4325
 		SELECT ID, post_name, post_parent, post_type
4326 4326
 		FROM $wpdb->posts
@@ -4328,33 +4328,33 @@  discard block
 block discarded – undo
4328 4328
 		AND post_type IN ($post_type_in_string)
4329 4329
 	";
4330 4330
 
4331
-	$pages = $wpdb->get_results( $sql, OBJECT_K );
4331
+	$pages = $wpdb->get_results($sql, OBJECT_K);
4332 4332
 
4333
-	$revparts = array_reverse( $parts );
4333
+	$revparts = array_reverse($parts);
4334 4334
 
4335 4335
 	$foundid = 0;
4336
-	foreach ( (array) $pages as $page ) {
4337
-		if ( $page->post_name == $revparts[0] ) {
4336
+	foreach ((array) $pages as $page) {
4337
+		if ($page->post_name == $revparts[0]) {
4338 4338
 			$count = 0;
4339 4339
 			$p = $page;
4340
-			while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
4340
+			while ($p->post_parent != 0 && isset($pages[$p->post_parent])) {
4341 4341
 				$count++;
4342
-				$parent = $pages[ $p->post_parent ];
4343
-				if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] )
4342
+				$parent = $pages[$p->post_parent];
4343
+				if ( ! isset($revparts[$count]) || $parent->post_name != $revparts[$count])
4344 4344
 					break;
4345 4345
 				$p = $parent;
4346 4346
 			}
4347 4347
 
4348
-			if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
4348
+			if ($p->post_parent == 0 && $count + 1 == count($revparts) && $p->post_name == $revparts[$count]) {
4349 4349
 				$foundid = $page->ID;
4350
-				if ( $page->post_type == $post_type )
4350
+				if ($page->post_type == $post_type)
4351 4351
 					break;
4352 4352
 			}
4353 4353
 		}
4354 4354
 	}
4355 4355
 
4356
-	if ( $foundid ) {
4357
-		return get_post( $foundid, $output );
4356
+	if ($foundid) {
4357
+		return get_post($foundid, $output);
4358 4358
 	}
4359 4359
 }
4360 4360
 
@@ -4371,31 +4371,31 @@  discard block
 block discarded – undo
4371 4371
  * @param string|array $post_type  Optional. Post type or array of post types. Default 'page'.
4372 4372
  * @return WP_Post|array|void WP_Post on success or null on failure
4373 4373
  */
4374
-function get_page_by_title( $page_title, $output = OBJECT, $post_type = 'page' ) {
4374
+function get_page_by_title($page_title, $output = OBJECT, $post_type = 'page') {
4375 4375
 	global $wpdb;
4376 4376
 
4377
-	if ( is_array( $post_type ) ) {
4378
-		$post_type = esc_sql( $post_type );
4379
-		$post_type_in_string = "'" . implode( "','", $post_type ) . "'";
4380
-		$sql = $wpdb->prepare( "
4377
+	if (is_array($post_type)) {
4378
+		$post_type = esc_sql($post_type);
4379
+		$post_type_in_string = "'".implode("','", $post_type)."'";
4380
+		$sql = $wpdb->prepare("
4381 4381
 			SELECT ID
4382 4382
 			FROM $wpdb->posts
4383 4383
 			WHERE post_title = %s
4384 4384
 			AND post_type IN ($post_type_in_string)
4385
-		", $page_title );
4385
+		", $page_title);
4386 4386
 	} else {
4387
-		$sql = $wpdb->prepare( "
4387
+		$sql = $wpdb->prepare("
4388 4388
 			SELECT ID
4389 4389
 			FROM $wpdb->posts
4390 4390
 			WHERE post_title = %s
4391 4391
 			AND post_type = %s
4392
-		", $page_title, $post_type );
4392
+		", $page_title, $post_type);
4393 4393
 	}
4394 4394
 
4395
-	$page = $wpdb->get_var( $sql );
4395
+	$page = $wpdb->get_var($sql);
4396 4396
 
4397
-	if ( $page ) {
4398
-		return get_post( $page, $output );
4397
+	if ($page) {
4398
+		return get_post($page, $output);
4399 4399
 	}
4400 4400
 }
4401 4401
 
@@ -4410,25 +4410,25 @@  discard block
 block discarded – undo
4410 4410
  * @param array $pages   List of page objects from which descendants should be identified.
4411 4411
  * @return array List of page children.
4412 4412
  */
4413
-function get_page_children( $page_id, $pages ) {
4413
+function get_page_children($page_id, $pages) {
4414 4414
 	// Build a hash of ID -> children.
4415 4415
 	$children = array();
4416
-	foreach ( (array) $pages as $page ) {
4417
-		$children[ intval( $page->post_parent ) ][] = $page;
4416
+	foreach ((array) $pages as $page) {
4417
+		$children[intval($page->post_parent)][] = $page;
4418 4418
 	}
4419 4419
 
4420 4420
 	$page_list = array();
4421 4421
 
4422 4422
 	// Start the search by looking at immediate children.
4423
-	if ( isset( $children[ $page_id ] ) ) {
4423
+	if (isset($children[$page_id])) {
4424 4424
 		// Always start at the end of the stack in order to preserve original `$pages` order.
4425
-		$to_look = array_reverse( $children[ $page_id ] );
4425
+		$to_look = array_reverse($children[$page_id]);
4426 4426
 
4427
-		while ( $to_look ) {
4428
-			$p = array_pop( $to_look );
4427
+		while ($to_look) {
4428
+			$p = array_pop($to_look);
4429 4429
 			$page_list[] = $p;
4430
-			if ( isset( $children[ $p->ID ] ) ) {
4431
-				foreach ( array_reverse( $children[ $p->ID ] ) as $child ) {
4430
+			if (isset($children[$p->ID])) {
4431
+				foreach (array_reverse($children[$p->ID]) as $child) {
4432 4432
 					// Append to the `$to_look` stack to descend the tree.
4433 4433
 					$to_look[] = $child;
4434 4434
 				}
@@ -4451,19 +4451,19 @@  discard block
 block discarded – undo
4451 4451
  * @param int   $page_id Optional. Parent page ID. Default 0.
4452 4452
  * @return array A list arranged by hierarchy. Children immediately follow their parents.
4453 4453
  */
4454
-function get_page_hierarchy( &$pages, $page_id = 0 ) {
4455
-	if ( empty( $pages ) ) {
4454
+function get_page_hierarchy(&$pages, $page_id = 0) {
4455
+	if (empty($pages)) {
4456 4456
 		return array();
4457 4457
 	}
4458 4458
 
4459 4459
 	$children = array();
4460
-	foreach ( (array) $pages as $p ) {
4461
-		$parent_id = intval( $p->post_parent );
4462
-		$children[ $parent_id ][] = $p;
4460
+	foreach ((array) $pages as $p) {
4461
+		$parent_id = intval($p->post_parent);
4462
+		$children[$parent_id][] = $p;
4463 4463
 	}
4464 4464
 
4465 4465
 	$result = array();
4466
-	_page_traverse_name( $page_id, $children, $result );
4466
+	_page_traverse_name($page_id, $children, $result);
4467 4467
 
4468 4468
 	return $result;
4469 4469
 }
@@ -4481,11 +4481,11 @@  discard block
 block discarded – undo
4481 4481
  * @param array &$children Parent-children relations, passed by reference.
4482 4482
  * @param array &$result   Result, passed by reference.
4483 4483
  */
4484
-function _page_traverse_name( $page_id, &$children, &$result ){
4485
-	if ( isset( $children[ $page_id ] ) ){
4486
-		foreach( (array)$children[ $page_id ] as $child ) {
4487
-			$result[ $child->ID ] = $child->post_name;
4488
-			_page_traverse_name( $child->ID, $children, $result );
4484
+function _page_traverse_name($page_id, &$children, &$result) {
4485
+	if (isset($children[$page_id])) {
4486
+		foreach ((array) $children[$page_id] as $child) {
4487
+			$result[$child->ID] = $child->post_name;
4488
+			_page_traverse_name($child->ID, $children, $result);
4489 4489
 		}
4490 4490
 	}
4491 4491
 }
@@ -4500,16 +4500,16 @@  discard block
 block discarded – undo
4500 4500
  * @param WP_Post|object|int $page Page object or page ID.
4501 4501
  * @return string|false Page URI, false on error.
4502 4502
  */
4503
-function get_page_uri( $page ) {
4504
-	$page = get_post( $page );
4503
+function get_page_uri($page) {
4504
+	$page = get_post($page);
4505 4505
 
4506
-	if ( ! $page )
4506
+	if ( ! $page)
4507 4507
 		return false;
4508 4508
 
4509 4509
 	$uri = $page->post_name;
4510 4510
 
4511
-	foreach ( $page->ancestors as $parent ) {
4512
-		$uri = get_post( $parent )->post_name . '/' . $uri;
4511
+	foreach ($page->ancestors as $parent) {
4512
+		$uri = get_post($parent)->post_name.'/'.$uri;
4513 4513
 	}
4514 4514
 
4515 4515
 	return $uri;
@@ -4555,7 +4555,7 @@  discard block
 block discarded – undo
4555 4555
  * }
4556 4556
  * @return array|false List of pages matching defaults or `$args`.
4557 4557
  */
4558
-function get_pages( $args = array() ) {
4558
+function get_pages($args = array()) {
4559 4559
 	global $wpdb;
4560 4560
 
4561 4561
 	$defaults = array(
@@ -4568,7 +4568,7 @@  discard block
 block discarded – undo
4568 4568
 		'post_type' => 'page', 'post_status' => 'publish',
4569 4569
 	);
4570 4570
 
4571
-	$r = wp_parse_args( $args, $defaults );
4571
+	$r = wp_parse_args($args, $defaults);
4572 4572
 
4573 4573
 	$number = (int) $r['number'];
4574 4574
 	$offset = (int) $r['offset'];
@@ -4581,87 +4581,87 @@  discard block
 block discarded – undo
4581 4581
 	$post_status = $r['post_status'];
4582 4582
 
4583 4583
 	// Make sure the post type is hierarchical.
4584
-	$hierarchical_post_types = get_post_types( array( 'hierarchical' => true ) );
4585
-	if ( ! in_array( $r['post_type'], $hierarchical_post_types ) ) {
4584
+	$hierarchical_post_types = get_post_types(array('hierarchical' => true));
4585
+	if ( ! in_array($r['post_type'], $hierarchical_post_types)) {
4586 4586
 		return false;
4587 4587
 	}
4588 4588
 
4589
-	if ( $parent > 0 && ! $child_of ) {
4589
+	if ($parent > 0 && ! $child_of) {
4590 4590
 		$hierarchical = false;
4591 4591
 	}
4592 4592
 
4593 4593
 	// Make sure we have a valid post status.
4594
-	if ( ! is_array( $post_status ) ) {
4595
-		$post_status = explode( ',', $post_status );
4594
+	if ( ! is_array($post_status)) {
4595
+		$post_status = explode(',', $post_status);
4596 4596
 	}
4597
-	if ( array_diff( $post_status, get_post_stati() ) ) {
4597
+	if (array_diff($post_status, get_post_stati())) {
4598 4598
 		return false;
4599 4599
 	}
4600 4600
 
4601 4601
 	// $args can be whatever, only use the args defined in defaults to compute the key.
4602
-	$key = md5( serialize( wp_array_slice_assoc( $r, array_keys( $defaults ) ) ) );
4603
-	$last_changed = wp_cache_get( 'last_changed', 'posts' );
4604
-	if ( ! $last_changed ) {
4602
+	$key = md5(serialize(wp_array_slice_assoc($r, array_keys($defaults))));
4603
+	$last_changed = wp_cache_get('last_changed', 'posts');
4604
+	if ( ! $last_changed) {
4605 4605
 		$last_changed = microtime();
4606
-		wp_cache_set( 'last_changed', $last_changed, 'posts' );
4606
+		wp_cache_set('last_changed', $last_changed, 'posts');
4607 4607
 	}
4608 4608
 
4609 4609
 	$cache_key = "get_pages:$key:$last_changed";
4610
-	if ( $cache = wp_cache_get( $cache_key, 'posts' ) ) {
4610
+	if ($cache = wp_cache_get($cache_key, 'posts')) {
4611 4611
 		// Convert to WP_Post instances.
4612
-		$pages = array_map( 'get_post', $cache );
4612
+		$pages = array_map('get_post', $cache);
4613 4613
 		/** This filter is documented in wp-includes/post.php */
4614
-		$pages = apply_filters( 'get_pages', $pages, $r );
4614
+		$pages = apply_filters('get_pages', $pages, $r);
4615 4615
 		return $pages;
4616 4616
 	}
4617 4617
 
4618 4618
 	$inclusions = '';
4619
-	if ( ! empty( $r['include'] ) ) {
4619
+	if ( ! empty($r['include'])) {
4620 4620
 		$child_of = 0; //ignore child_of, parent, exclude, meta_key, and meta_value params if using include
4621 4621
 		$parent = -1;
4622 4622
 		$exclude = '';
4623 4623
 		$meta_key = '';
4624 4624
 		$meta_value = '';
4625 4625
 		$hierarchical = false;
4626
-		$incpages = wp_parse_id_list( $r['include'] );
4627
-		if ( ! empty( $incpages ) ) {
4628
-			$inclusions = ' AND ID IN (' . implode( ',', $incpages ) .  ')';
4626
+		$incpages = wp_parse_id_list($r['include']);
4627
+		if ( ! empty($incpages)) {
4628
+			$inclusions = ' AND ID IN ('.implode(',', $incpages).')';
4629 4629
 		}
4630 4630
 	}
4631 4631
 
4632 4632
 	$exclusions = '';
4633
-	if ( ! empty( $exclude ) ) {
4634
-		$expages = wp_parse_id_list( $exclude );
4635
-		if ( ! empty( $expages ) ) {
4636
-			$exclusions = ' AND ID NOT IN (' . implode( ',', $expages ) .  ')';
4633
+	if ( ! empty($exclude)) {
4634
+		$expages = wp_parse_id_list($exclude);
4635
+		if ( ! empty($expages)) {
4636
+			$exclusions = ' AND ID NOT IN ('.implode(',', $expages).')';
4637 4637
 		}
4638 4638
 	}
4639 4639
 
4640 4640
 	$author_query = '';
4641
-	if ( ! empty( $r['authors'] ) ) {
4642
-		$post_authors = preg_split( '/[\s,]+/', $r['authors'] );
4641
+	if ( ! empty($r['authors'])) {
4642
+		$post_authors = preg_split('/[\s,]+/', $r['authors']);
4643 4643
 
4644
-		if ( ! empty( $post_authors ) ) {
4645
-			foreach ( $post_authors as $post_author ) {
4644
+		if ( ! empty($post_authors)) {
4645
+			foreach ($post_authors as $post_author) {
4646 4646
 				//Do we have an author id or an author login?
4647
-				if ( 0 == intval($post_author) ) {
4647
+				if (0 == intval($post_author)) {
4648 4648
 					$post_author = get_user_by('login', $post_author);
4649
-					if ( empty( $post_author ) ) {
4649
+					if (empty($post_author)) {
4650 4650
 						continue;
4651 4651
 					}
4652
-					if ( empty( $post_author->ID ) ) {
4652
+					if (empty($post_author->ID)) {
4653 4653
 						continue;
4654 4654
 					}
4655 4655
 					$post_author = $post_author->ID;
4656 4656
 				}
4657 4657
 
4658
-				if ( '' == $author_query ) {
4658
+				if ('' == $author_query) {
4659 4659
 					$author_query = $wpdb->prepare(' post_author = %d ', $post_author);
4660 4660
 				} else {
4661 4661
 					$author_query .= $wpdb->prepare(' OR post_author = %d ', $post_author);
4662 4662
 				}
4663 4663
 			}
4664
-			if ( '' != $author_query ) {
4664
+			if ('' != $author_query) {
4665 4665
 				$author_query = " AND ($author_query)";
4666 4666
 			}
4667 4667
 		}
@@ -4669,49 +4669,49 @@  discard block
 block discarded – undo
4669 4669
 
4670 4670
 	$join = '';
4671 4671
 	$where = "$exclusions $inclusions ";
4672
-	if ( '' !== $meta_key || '' !== $meta_value ) {
4672
+	if ('' !== $meta_key || '' !== $meta_value) {
4673 4673
 		$join = " LEFT JOIN $wpdb->postmeta ON ( $wpdb->posts.ID = $wpdb->postmeta.post_id )";
4674 4674
 
4675 4675
 		// meta_key and meta_value might be slashed
4676 4676
 		$meta_key = wp_unslash($meta_key);
4677 4677
 		$meta_value = wp_unslash($meta_value);
4678
-		if ( '' !== $meta_key ) {
4678
+		if ('' !== $meta_key) {
4679 4679
 			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_key = %s", $meta_key);
4680 4680
 		}
4681
-		if ( '' !== $meta_value ) {
4681
+		if ('' !== $meta_value) {
4682 4682
 			$where .= $wpdb->prepare(" AND $wpdb->postmeta.meta_value = %s", $meta_value);
4683 4683
 		}
4684 4684
 
4685 4685
 	}
4686 4686
 
4687
-	if ( is_array( $parent ) ) {
4688
-		$post_parent__in = implode( ',', array_map( 'absint', (array) $parent ) );
4689
-		if ( ! empty( $post_parent__in ) ) {
4687
+	if (is_array($parent)) {
4688
+		$post_parent__in = implode(',', array_map('absint', (array) $parent));
4689
+		if ( ! empty($post_parent__in)) {
4690 4690
 			$where .= " AND post_parent IN ($post_parent__in)";
4691 4691
 		}
4692
-	} elseif ( $parent >= 0 ) {
4692
+	} elseif ($parent >= 0) {
4693 4693
 		$where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
4694 4694
 	}
4695 4695
 
4696
-	if ( 1 == count( $post_status ) ) {
4697
-		$where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $r['post_type'], reset( $post_status ) );
4696
+	if (1 == count($post_status)) {
4697
+		$where_post_type = $wpdb->prepare("post_type = %s AND post_status = %s", $r['post_type'], reset($post_status));
4698 4698
 	} else {
4699
-		$post_status = implode( "', '", $post_status );
4700
-		$where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $r['post_type'] );
4699
+		$post_status = implode("', '", $post_status);
4700
+		$where_post_type = $wpdb->prepare("post_type = %s AND post_status IN ('$post_status')", $r['post_type']);
4701 4701
 	}
4702 4702
 
4703 4703
 	$orderby_array = array();
4704
-	$allowed_keys = array( 'author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified',
4704
+	$allowed_keys = array('author', 'post_author', 'date', 'post_date', 'title', 'post_title', 'name', 'post_name', 'modified',
4705 4705
 		'post_modified', 'modified_gmt', 'post_modified_gmt', 'menu_order', 'parent', 'post_parent',
4706
-		'ID', 'rand', 'comment_count' );
4706
+		'ID', 'rand', 'comment_count');
4707 4707
 
4708
-	foreach ( explode( ',', $r['sort_column'] ) as $orderby ) {
4709
-		$orderby = trim( $orderby );
4710
-		if ( ! in_array( $orderby, $allowed_keys ) ) {
4708
+	foreach (explode(',', $r['sort_column']) as $orderby) {
4709
+		$orderby = trim($orderby);
4710
+		if ( ! in_array($orderby, $allowed_keys)) {
4711 4711
 			continue;
4712 4712
 		}
4713 4713
 
4714
-		switch ( $orderby ) {
4714
+		switch ($orderby) {
4715 4715
 			case 'menu_order':
4716 4716
 				break;
4717 4717
 			case 'ID':
@@ -4724,36 +4724,36 @@  discard block
 block discarded – undo
4724 4724
 				$orderby = "$wpdb->posts.comment_count";
4725 4725
 				break;
4726 4726
 			default:
4727
-				if ( 0 === strpos( $orderby, 'post_' ) ) {
4728
-					$orderby = "$wpdb->posts." . $orderby;
4727
+				if (0 === strpos($orderby, 'post_')) {
4728
+					$orderby = "$wpdb->posts.".$orderby;
4729 4729
 				} else {
4730
-					$orderby = "$wpdb->posts.post_" . $orderby;
4730
+					$orderby = "$wpdb->posts.post_".$orderby;
4731 4731
 				}
4732 4732
 		}
4733 4733
 
4734 4734
 		$orderby_array[] = $orderby;
4735 4735
 
4736 4736
 	}
4737
-	$sort_column = ! empty( $orderby_array ) ? implode( ',', $orderby_array ) : "$wpdb->posts.post_title";
4737
+	$sort_column = ! empty($orderby_array) ? implode(',', $orderby_array) : "$wpdb->posts.post_title";
4738 4738
 
4739
-	$sort_order = strtoupper( $r['sort_order'] );
4740
-	if ( '' !== $sort_order && ! in_array( $sort_order, array( 'ASC', 'DESC' ) ) ) {
4739
+	$sort_order = strtoupper($r['sort_order']);
4740
+	if ('' !== $sort_order && ! in_array($sort_order, array('ASC', 'DESC'))) {
4741 4741
 		$sort_order = 'ASC';
4742 4742
 	}
4743 4743
 
4744 4744
 	$query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
4745 4745
 	$query .= $author_query;
4746
-	$query .= " ORDER BY " . $sort_column . " " . $sort_order ;
4746
+	$query .= " ORDER BY ".$sort_column." ".$sort_order;
4747 4747
 
4748
-	if ( ! empty( $number ) ) {
4749
-		$query .= ' LIMIT ' . $offset . ',' . $number;
4748
+	if ( ! empty($number)) {
4749
+		$query .= ' LIMIT '.$offset.','.$number;
4750 4750
 	}
4751 4751
 
4752 4752
 	$pages = $wpdb->get_results($query);
4753 4753
 
4754
-	if ( empty($pages) ) {
4754
+	if (empty($pages)) {
4755 4755
 		/** This filter is documented in wp-includes/post.php */
4756
-		$pages = apply_filters( 'get_pages', array(), $r );
4756
+		$pages = apply_filters('get_pages', array(), $r);
4757 4757
 		return $pages;
4758 4758
 	}
4759 4759
 
@@ -4764,38 +4764,38 @@  discard block
 block discarded – undo
4764 4764
 	}
4765 4765
 
4766 4766
 	// Update cache.
4767
-	update_post_cache( $pages );
4767
+	update_post_cache($pages);
4768 4768
 
4769
-	if ( $child_of || $hierarchical ) {
4769
+	if ($child_of || $hierarchical) {
4770 4770
 		$pages = get_page_children($child_of, $pages);
4771 4771
 	}
4772 4772
 
4773
-	if ( ! empty( $r['exclude_tree'] ) ) {
4774
-		$exclude = wp_parse_id_list( $r['exclude_tree'] );
4775
-		foreach( $exclude as $id ) {
4776
-			$children = get_page_children( $id, $pages );
4777
-			foreach ( $children as $child ) {
4773
+	if ( ! empty($r['exclude_tree'])) {
4774
+		$exclude = wp_parse_id_list($r['exclude_tree']);
4775
+		foreach ($exclude as $id) {
4776
+			$children = get_page_children($id, $pages);
4777
+			foreach ($children as $child) {
4778 4778
 				$exclude[] = $child->ID;
4779 4779
 			}
4780 4780
 		}
4781 4781
 
4782
-		$num_pages = count( $pages );
4783
-		for ( $i = 0; $i < $num_pages; $i++ ) {
4784
-			if ( in_array( $pages[$i]->ID, $exclude ) ) {
4785
-				unset( $pages[$i] );
4782
+		$num_pages = count($pages);
4783
+		for ($i = 0; $i < $num_pages; $i++) {
4784
+			if (in_array($pages[$i]->ID, $exclude)) {
4785
+				unset($pages[$i]);
4786 4786
 			}
4787 4787
 		}
4788 4788
 	}
4789 4789
 
4790 4790
 	$page_structure = array();
4791
-	foreach ( $pages as $page ) {
4791
+	foreach ($pages as $page) {
4792 4792
 		$page_structure[] = $page->ID;
4793 4793
 	}
4794 4794
 
4795
-	wp_cache_set( $cache_key, $page_structure, 'posts' );
4795
+	wp_cache_set($cache_key, $page_structure, 'posts');
4796 4796
 
4797 4797
 	// Convert to WP_Post instances
4798
-	$pages = array_map( 'get_post', $pages );
4798
+	$pages = array_map('get_post', $pages);
4799 4799
 
4800 4800
 	/**
4801 4801
 	 * Filter the retrieved list of pages.
@@ -4805,7 +4805,7 @@  discard block
 block discarded – undo
4805 4805
 	 * @param array $pages List of pages to retrieve.
4806 4806
 	 * @param array $r     Array of get_pages() arguments.
4807 4807
 	 */
4808
-	return apply_filters( 'get_pages', $pages, $r );
4808
+	return apply_filters('get_pages', $pages, $r);
4809 4809
 }
4810 4810
 
4811 4811
 //
@@ -4825,9 +4825,9 @@  discard block
 block discarded – undo
4825 4825
 		return false;
4826 4826
 	if (strpos($url, home_url('/?attachment_id=')) !== false)
4827 4827
 		return true;
4828
-	if ( $id = url_to_postid($url) ) {
4828
+	if ($id = url_to_postid($url)) {
4829 4829
 		$post = get_post($id);
4830
-		if ( 'attachment' == $post->post_type )
4830
+		if ('attachment' == $post->post_type)
4831 4831
 			return true;
4832 4832
 	}
4833 4833
 	return false;
@@ -4856,21 +4856,21 @@  discard block
 block discarded – undo
4856 4856
  * @param int          $parent Optional. Parent post ID.
4857 4857
  * @return int Attachment ID.
4858 4858
  */
4859
-function wp_insert_attachment( $args, $file = false, $parent = 0 ) {
4859
+function wp_insert_attachment($args, $file = false, $parent = 0) {
4860 4860
 	$defaults = array(
4861 4861
 		'file'        => $file,
4862 4862
 		'post_parent' => 0
4863 4863
 	);
4864 4864
 
4865
-	$data = wp_parse_args( $args, $defaults );
4865
+	$data = wp_parse_args($args, $defaults);
4866 4866
 
4867
-	if ( ! empty( $parent ) ) {
4867
+	if ( ! empty($parent)) {
4868 4868
 		$data['post_parent'] = $parent;
4869 4869
 	}
4870 4870
 
4871 4871
 	$data['post_type'] = 'attachment';
4872 4872
 
4873
-	return wp_insert_post( $data );
4873
+	return wp_insert_post($data);
4874 4874
 }
4875 4875
 
4876 4876
 /**
@@ -4892,27 +4892,27 @@  discard block
 block discarded – undo
4892 4892
  *                           Default false.
4893 4893
  * @return mixed False on failure. Post data on success.
4894 4894
  */
4895
-function wp_delete_attachment( $post_id, $force_delete = false ) {
4895
+function wp_delete_attachment($post_id, $force_delete = false) {
4896 4896
 	global $wpdb;
4897 4897
 
4898
-	if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) )
4898
+	if ( ! $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id)))
4899 4899
 		return $post;
4900 4900
 
4901
-	if ( 'attachment' != $post->post_type )
4901
+	if ('attachment' != $post->post_type)
4902 4902
 		return false;
4903 4903
 
4904
-	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status )
4905
-		return wp_trash_post( $post_id );
4904
+	if ( ! $force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status)
4905
+		return wp_trash_post($post_id);
4906 4906
 
4907 4907
 	delete_post_meta($post_id, '_wp_trash_meta_status');
4908 4908
 	delete_post_meta($post_id, '_wp_trash_meta_time');
4909 4909
 
4910
-	$meta = wp_get_attachment_metadata( $post_id );
4911
-	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
4912
-	$file = get_attached_file( $post_id );
4910
+	$meta = wp_get_attachment_metadata($post_id);
4911
+	$backup_sizes = get_post_meta($post->ID, '_wp_attachment_backup_sizes', true);
4912
+	$file = get_attached_file($post_id);
4913 4913
 
4914
-	if ( is_multisite() )
4915
-		delete_transient( 'dirsize_cache' );
4914
+	if (is_multisite())
4915
+		delete_transient('dirsize_cache');
4916 4916
 
4917 4917
 	/**
4918 4918
 	 * Fires before an attachment is deleted, at the start of wp_delete_attachment().
@@ -4921,65 +4921,65 @@  discard block
 block discarded – undo
4921 4921
 	 *
4922 4922
 	 * @param int $post_id Attachment ID.
4923 4923
 	 */
4924
-	do_action( 'delete_attachment', $post_id );
4924
+	do_action('delete_attachment', $post_id);
4925 4925
 
4926 4926
 	wp_delete_object_term_relationships($post_id, array('category', 'post_tag'));
4927 4927
 	wp_delete_object_term_relationships($post_id, get_object_taxonomies($post->post_type));
4928 4928
 
4929 4929
 	// Delete all for any posts.
4930
-	delete_metadata( 'post', null, '_thumbnail_id', $post_id, true );
4930
+	delete_metadata('post', null, '_thumbnail_id', $post_id, true);
4931 4931
 
4932
-	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
4933
-	foreach ( $comment_ids as $comment_id )
4934
-		wp_delete_comment( $comment_id, true );
4932
+	$comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id));
4933
+	foreach ($comment_ids as $comment_id)
4934
+		wp_delete_comment($comment_id, true);
4935 4935
 
4936
-	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
4937
-	foreach ( $post_meta_ids as $mid )
4938
-		delete_metadata_by_mid( 'post', $mid );
4936
+	$post_meta_ids = $wpdb->get_col($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id));
4937
+	foreach ($post_meta_ids as $mid)
4938
+		delete_metadata_by_mid('post', $mid);
4939 4939
 
4940 4940
 	/** This action is documented in wp-includes/post.php */
4941
-	do_action( 'delete_post', $post_id );
4942
-	$result = $wpdb->delete( $wpdb->posts, array( 'ID' => $post_id ) );
4943
-	if ( ! $result ) {
4941
+	do_action('delete_post', $post_id);
4942
+	$result = $wpdb->delete($wpdb->posts, array('ID' => $post_id));
4943
+	if ( ! $result) {
4944 4944
 		return false;
4945 4945
 	}
4946 4946
 	/** This action is documented in wp-includes/post.php */
4947
-	do_action( 'deleted_post', $post_id );
4947
+	do_action('deleted_post', $post_id);
4948 4948
 
4949 4949
 	$uploadpath = wp_upload_dir();
4950 4950
 
4951
-	if ( ! empty($meta['thumb']) ) {
4951
+	if ( ! empty($meta['thumb'])) {
4952 4952
 		// Don't delete the thumb if another attachment uses it.
4953
-		if (! $wpdb->get_row( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%' . $wpdb->esc_like( $meta['thumb'] ) . '%', $post_id)) ) {
4953
+		if ( ! $wpdb->get_row($wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE %s AND post_id <> %d", '%'.$wpdb->esc_like($meta['thumb']).'%', $post_id))) {
4954 4954
 			$thumbfile = str_replace(basename($file), $meta['thumb'], $file);
4955 4955
 			/** This filter is documented in wp-includes/functions.php */
4956
-			$thumbfile = apply_filters( 'wp_delete_file', $thumbfile );
4957
-			@ unlink( path_join($uploadpath['basedir'], $thumbfile) );
4956
+			$thumbfile = apply_filters('wp_delete_file', $thumbfile);
4957
+			@ unlink(path_join($uploadpath['basedir'], $thumbfile));
4958 4958
 		}
4959 4959
 	}
4960 4960
 
4961 4961
 	// Remove intermediate and backup images if there are any.
4962
-	if ( isset( $meta['sizes'] ) && is_array( $meta['sizes'] ) ) {
4963
-		foreach ( $meta['sizes'] as $size => $sizeinfo ) {
4964
-			$intermediate_file = str_replace( basename( $file ), $sizeinfo['file'], $file );
4962
+	if (isset($meta['sizes']) && is_array($meta['sizes'])) {
4963
+		foreach ($meta['sizes'] as $size => $sizeinfo) {
4964
+			$intermediate_file = str_replace(basename($file), $sizeinfo['file'], $file);
4965 4965
 			/** This filter is documented in wp-includes/functions.php */
4966
-			$intermediate_file = apply_filters( 'wp_delete_file', $intermediate_file );
4967
-			@ unlink( path_join( $uploadpath['basedir'], $intermediate_file ) );
4966
+			$intermediate_file = apply_filters('wp_delete_file', $intermediate_file);
4967
+			@ unlink(path_join($uploadpath['basedir'], $intermediate_file));
4968 4968
 		}
4969 4969
 	}
4970 4970
 
4971
-	if ( is_array($backup_sizes) ) {
4972
-		foreach ( $backup_sizes as $size ) {
4973
-			$del_file = path_join( dirname($meta['file']), $size['file'] );
4971
+	if (is_array($backup_sizes)) {
4972
+		foreach ($backup_sizes as $size) {
4973
+			$del_file = path_join(dirname($meta['file']), $size['file']);
4974 4974
 			/** This filter is documented in wp-includes/functions.php */
4975
-			$del_file = apply_filters( 'wp_delete_file', $del_file );
4976
-			@ unlink( path_join($uploadpath['basedir'], $del_file) );
4975
+			$del_file = apply_filters('wp_delete_file', $del_file);
4976
+			@ unlink(path_join($uploadpath['basedir'], $del_file));
4977 4977
 		}
4978 4978
 	}
4979 4979
 
4980
-	wp_delete_file( $file );
4980
+	wp_delete_file($file);
4981 4981
 
4982
-	clean_post_cache( $post );
4982
+	clean_post_cache($post);
4983 4983
 
4984 4984
 	return $post;
4985 4985
 }
@@ -4993,14 +4993,14 @@  discard block
 block discarded – undo
4993 4993
  * @param bool $unfiltered Optional. If true, filters are not run. Default false.
4994 4994
  * @return mixed Attachment meta field. False on failure.
4995 4995
  */
4996
-function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
4996
+function wp_get_attachment_metadata($post_id = 0, $unfiltered = false) {
4997 4997
 	$post_id = (int) $post_id;
4998
-	if ( !$post = get_post( $post_id ) )
4998
+	if ( ! $post = get_post($post_id))
4999 4999
 		return false;
5000 5000
 
5001
-	$data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
5001
+	$data = get_post_meta($post->ID, '_wp_attachment_metadata', true);
5002 5002
 
5003
-	if ( $unfiltered )
5003
+	if ($unfiltered)
5004 5004
 		return $data;
5005 5005
 
5006 5006
 	/**
@@ -5012,7 +5012,7 @@  discard block
 block discarded – undo
5012 5012
 	 *                            if the object does not exist.
5013 5013
 	 * @param int        $post_id Attachment ID.
5014 5014
 	 */
5015
-	return apply_filters( 'wp_get_attachment_metadata', $data, $post->ID );
5015
+	return apply_filters('wp_get_attachment_metadata', $data, $post->ID);
5016 5016
 }
5017 5017
 
5018 5018
 /**
@@ -5024,9 +5024,9 @@  discard block
 block discarded – undo
5024 5024
  * @param array $data    Attachment data.
5025 5025
  * @return int|bool False if $post is invalid.
5026 5026
  */
5027
-function wp_update_attachment_metadata( $post_id, $data ) {
5027
+function wp_update_attachment_metadata($post_id, $data) {
5028 5028
 	$post_id = (int) $post_id;
5029
-	if ( !$post = get_post( $post_id ) )
5029
+	if ( ! $post = get_post($post_id))
5030 5030
 		return false;
5031 5031
 
5032 5032
 	/**
@@ -5037,10 +5037,10 @@  discard block
 block discarded – undo
5037 5037
 	 * @param array $data    Array of updated attachment meta data.
5038 5038
 	 * @param int   $post_id Attachment ID.
5039 5039
 	 */
5040
-	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
5041
-		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
5040
+	if ($data = apply_filters('wp_update_attachment_metadata', $data, $post->ID))
5041
+		return update_post_meta($post->ID, '_wp_attachment_metadata', $data);
5042 5042
 	else
5043
-		return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
5043
+		return delete_post_meta($post->ID, '_wp_attachment_metadata');
5044 5044
 }
5045 5045
 
5046 5046
 /**
@@ -5053,28 +5053,28 @@  discard block
 block discarded – undo
5053 5053
  * @param int $post_id Optional. Attachment ID. Default 0.
5054 5054
  * @return string|false Attachment URL, otherwise false.
5055 5055
  */
5056
-function wp_get_attachment_url( $post_id = 0 ) {
5056
+function wp_get_attachment_url($post_id = 0) {
5057 5057
 	$post_id = (int) $post_id;
5058
-	if ( !$post = get_post( $post_id ) )
5058
+	if ( ! $post = get_post($post_id))
5059 5059
 		return false;
5060 5060
 
5061
-	if ( 'attachment' != $post->post_type )
5061
+	if ('attachment' != $post->post_type)
5062 5062
 		return false;
5063 5063
 
5064 5064
 	$url = '';
5065 5065
 	// Get attached file.
5066
-	if ( $file = get_post_meta( $post->ID, '_wp_attached_file', true) ) {
5066
+	if ($file = get_post_meta($post->ID, '_wp_attached_file', true)) {
5067 5067
 		// Get upload directory.
5068
-		if ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) {
5068
+		if (($uploads = wp_upload_dir()) && false === $uploads['error']) {
5069 5069
 			// Check that the upload base exists in the file location.
5070
-			if ( 0 === strpos( $file, $uploads['basedir'] ) ) {
5070
+			if (0 === strpos($file, $uploads['basedir'])) {
5071 5071
 				// Replace file location with url location.
5072 5072
 				$url = str_replace($uploads['basedir'], $uploads['baseurl'], $file);
5073
-			} elseif ( false !== strpos($file, 'wp-content/uploads') ) {
5074
-				$url = $uploads['baseurl'] . substr( $file, strpos($file, 'wp-content/uploads') + 18 );
5073
+			} elseif (false !== strpos($file, 'wp-content/uploads')) {
5074
+				$url = $uploads['baseurl'].substr($file, strpos($file, 'wp-content/uploads') + 18);
5075 5075
 			} else {
5076 5076
 				// It's a newly-uploaded file, therefore $file is relative to the basedir.
5077
-				$url = $uploads['baseurl'] . "/$file";
5077
+				$url = $uploads['baseurl']."/$file";
5078 5078
 			}
5079 5079
 		}
5080 5080
 	}
@@ -5083,13 +5083,13 @@  discard block
 block discarded – undo
5083 5083
 	 * If any of the above options failed, Fallback on the GUID as used pre-2.7,
5084 5084
 	 * not recommended to rely upon this.
5085 5085
 	 */
5086
-	if ( empty($url) ) {
5087
-		$url = get_the_guid( $post->ID );
5086
+	if (empty($url)) {
5087
+		$url = get_the_guid($post->ID);
5088 5088
 	}
5089 5089
 
5090 5090
 	// On SSL front-end, URLs should be HTTPS.
5091
-	if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow'] ) {
5092
-		$url = set_url_scheme( $url );
5091
+	if (is_ssl() && ! is_admin() && 'wp-login.php' !== $GLOBALS['pagenow']) {
5092
+		$url = set_url_scheme($url);
5093 5093
 	}
5094 5094
 
5095 5095
 	/**
@@ -5100,9 +5100,9 @@  discard block
 block discarded – undo
5100 5100
 	 * @param string $url     URL for the given attachment.
5101 5101
 	 * @param int    $post_id Attachment ID.
5102 5102
 	 */
5103
-	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
5103
+	$url = apply_filters('wp_get_attachment_url', $url, $post->ID);
5104 5104
 
5105
-	if ( empty( $url ) )
5105
+	if (empty($url))
5106 5106
 		return false;
5107 5107
 
5108 5108
 	return $url;
@@ -5116,16 +5116,16 @@  discard block
 block discarded – undo
5116 5116
  * @param int $post_id Optional. Attachment ID. Default 0.
5117 5117
  * @return string|false False on failure. Thumbnail file path on success.
5118 5118
  */
5119
-function wp_get_attachment_thumb_file( $post_id = 0 ) {
5119
+function wp_get_attachment_thumb_file($post_id = 0) {
5120 5120
 	$post_id = (int) $post_id;
5121
-	if ( !$post = get_post( $post_id ) )
5121
+	if ( ! $post = get_post($post_id))
5122 5122
 		return false;
5123
-	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
5123
+	if ( ! is_array($imagedata = wp_get_attachment_metadata($post->ID)))
5124 5124
 		return false;
5125 5125
 
5126
-	$file = get_attached_file( $post->ID );
5126
+	$file = get_attached_file($post->ID);
5127 5127
 
5128
-	if ( !empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile) ) {
5128
+	if ( ! empty($imagedata['thumb']) && ($thumbfile = str_replace(basename($file), $imagedata['thumb'], $file)) && file_exists($thumbfile)) {
5129 5129
 		/**
5130 5130
 		 * Filter the attachment thumbnail file path.
5131 5131
 		 *
@@ -5134,7 +5134,7 @@  discard block
 block discarded – undo
5134 5134
 		 * @param string $thumbfile File path to the attachment thumbnail.
5135 5135
 		 * @param int    $post_id   Attachment ID.
5136 5136
 		 */
5137
-		return apply_filters( 'wp_get_attachment_thumb_file', $thumbfile, $post->ID );
5137
+		return apply_filters('wp_get_attachment_thumb_file', $thumbfile, $post->ID);
5138 5138
 	}
5139 5139
 	return false;
5140 5140
 }
@@ -5147,18 +5147,18 @@  discard block
 block discarded – undo
5147 5147
  * @param int $post_id Optional. Attachment ID. Default 0.
5148 5148
  * @return string|false False on failure. Thumbnail URL on success.
5149 5149
  */
5150
-function wp_get_attachment_thumb_url( $post_id = 0 ) {
5150
+function wp_get_attachment_thumb_url($post_id = 0) {
5151 5151
 	$post_id = (int) $post_id;
5152
-	if ( !$post = get_post( $post_id ) )
5152
+	if ( ! $post = get_post($post_id))
5153 5153
 		return false;
5154
-	if ( !$url = wp_get_attachment_url( $post->ID ) )
5154
+	if ( ! $url = wp_get_attachment_url($post->ID))
5155 5155
 		return false;
5156 5156
 
5157
-	$sized = image_downsize( $post_id, 'thumbnail' );
5158
-	if ( $sized )
5157
+	$sized = image_downsize($post_id, 'thumbnail');
5158
+	if ($sized)
5159 5159
 		return $sized[0];
5160 5160
 
5161
-	if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) )
5161
+	if ( ! $thumb = wp_get_attachment_thumb_file($post->ID))
5162 5162
 		return false;
5163 5163
 
5164 5164
 	$url = str_replace(basename($url), basename($thumb), $url);
@@ -5171,7 +5171,7 @@  discard block
 block discarded – undo
5171 5171
 	 * @param string $url     URL for the attachment thumbnail.
5172 5172
 	 * @param int    $post_id Attachment ID.
5173 5173
 	 */
5174
-	return apply_filters( 'wp_get_attachment_thumb_url', $url, $post->ID );
5174
+	return apply_filters('wp_get_attachment_thumb_url', $url, $post->ID);
5175 5175
 }
5176 5176
 
5177 5177
 /**
@@ -5183,40 +5183,40 @@  discard block
 block discarded – undo
5183 5183
  * @param int|WP_Post $post_id Optional. Attachment ID. Default 0.
5184 5184
  * @return bool True if one of the accepted types, false otherwise.
5185 5185
  */
5186
-function wp_attachment_is( $type, $post_id = 0 ) {
5187
-	if ( ! $post = get_post( $post_id ) ) {
5186
+function wp_attachment_is($type, $post_id = 0) {
5187
+	if ( ! $post = get_post($post_id)) {
5188 5188
 		return false;
5189 5189
 	}
5190 5190
 
5191
-	if ( ! $file = get_attached_file( $post->ID ) ) {
5191
+	if ( ! $file = get_attached_file($post->ID)) {
5192 5192
 		return false;
5193 5193
 	}
5194 5194
 
5195
-	if ( 0 === strpos( $post->post_mime_type, $type . '/' ) ) {
5195
+	if (0 === strpos($post->post_mime_type, $type.'/')) {
5196 5196
 		return true;
5197 5197
 	}
5198 5198
 
5199
-	$check = wp_check_filetype( $file );
5200
-	if ( empty( $check['ext'] ) ) {
5199
+	$check = wp_check_filetype($file);
5200
+	if (empty($check['ext'])) {
5201 5201
 		return false;
5202 5202
 	}
5203 5203
 
5204 5204
 	$ext = $check['ext'];
5205 5205
 
5206
-	if ( 'import' !== $post->post_mime_type ) {
5206
+	if ('import' !== $post->post_mime_type) {
5207 5207
 		return $type === $ext;
5208 5208
 	}
5209 5209
 
5210
-	switch ( $type ) {
5210
+	switch ($type) {
5211 5211
 	case 'image':
5212
-		$image_exts = array( 'jpg', 'jpeg', 'jpe', 'gif', 'png' );
5213
-		return in_array( $ext, $image_exts );
5212
+		$image_exts = array('jpg', 'jpeg', 'jpe', 'gif', 'png');
5213
+		return in_array($ext, $image_exts);
5214 5214
 
5215 5215
 	case 'audio':
5216
-		return in_array( $ext, wp_get_audio_extensions() );
5216
+		return in_array($ext, wp_get_audio_extensions());
5217 5217
 
5218 5218
 	case 'video':
5219
-		return in_array( $ext, wp_get_video_extensions() );
5219
+		return in_array($ext, wp_get_video_extensions());
5220 5220
 
5221 5221
 	default:
5222 5222
 		return $type === $ext;
@@ -5233,8 +5233,8 @@  discard block
 block discarded – undo
5233 5233
  * @param int|WP_Post $post Optional. Attachment ID. Default 0.
5234 5234
  * @return bool Whether the attachment is an image.
5235 5235
  */
5236
-function wp_attachment_is_image( $post = 0 ) {
5237
-	return wp_attachment_is( 'image', $post );
5236
+function wp_attachment_is_image($post = 0) {
5237
+	return wp_attachment_is('image', $post);
5238 5238
 }
5239 5239
 
5240 5240
 /**
@@ -5245,21 +5245,21 @@  discard block
 block discarded – undo
5245 5245
  * @param string|int $mime MIME type or attachment ID.
5246 5246
  * @return string|false Icon, false otherwise.
5247 5247
  */
5248
-function wp_mime_type_icon( $mime = 0 ) {
5249
-	if ( !is_numeric($mime) )
5248
+function wp_mime_type_icon($mime = 0) {
5249
+	if ( ! is_numeric($mime))
5250 5250
 		$icon = wp_cache_get("mime_type_icon_$mime");
5251 5251
 
5252 5252
 	$post_id = 0;
5253
-	if ( empty($icon) ) {
5253
+	if (empty($icon)) {
5254 5254
 		$post_mimes = array();
5255
-		if ( is_numeric($mime) ) {
5255
+		if (is_numeric($mime)) {
5256 5256
 			$mime = (int) $mime;
5257
-			if ( $post = get_post( $mime ) ) {
5257
+			if ($post = get_post($mime)) {
5258 5258
 				$post_id = (int) $post->ID;
5259 5259
 				$ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid);
5260
-				if ( !empty($ext) ) {
5260
+				if ( ! empty($ext)) {
5261 5261
 					$post_mimes[] = $ext;
5262
-					if ( $ext_type = wp_ext2type( $ext ) )
5262
+					if ($ext_type = wp_ext2type($ext))
5263 5263
 						$post_mimes[] = $ext_type;
5264 5264
 				}
5265 5265
 				$mime = $post->post_mime_type;
@@ -5272,7 +5272,7 @@  discard block
 block discarded – undo
5272 5272
 
5273 5273
 		$icon_files = wp_cache_get('icon_files');
5274 5274
 
5275
-		if ( !is_array($icon_files) ) {
5275
+		if ( ! is_array($icon_files)) {
5276 5276
 			/**
5277 5277
 			 * Filter the icon directory path.
5278 5278
 			 *
@@ -5280,7 +5280,7 @@  discard block
 block discarded – undo
5280 5280
 			 *
5281 5281
 			 * @param string $path Icon directory absolute path.
5282 5282
 			 */
5283
-			$icon_dir = apply_filters( 'icon_dir', ABSPATH . WPINC . '/images/media' );
5283
+			$icon_dir = apply_filters('icon_dir', ABSPATH.WPINC.'/images/media');
5284 5284
 
5285 5285
 			/**
5286 5286
 			 * Filter the icon directory URI.
@@ -5289,7 +5289,7 @@  discard block
 block discarded – undo
5289 5289
 			 *
5290 5290
 			 * @param string $uri Icon directory URI.
5291 5291
 			 */
5292
-			$icon_dir_uri = apply_filters( 'icon_dir_uri', includes_url( 'images/media' ) );
5292
+			$icon_dir_uri = apply_filters('icon_dir_uri', includes_url('images/media'));
5293 5293
 
5294 5294
 			/**
5295 5295
 			 * Filter the list of icon directory URIs.
@@ -5298,19 +5298,19 @@  discard block
 block discarded – undo
5298 5298
 			 *
5299 5299
 			 * @param array $uris List of icon directory URIs.
5300 5300
 			 */
5301
-			$dirs = apply_filters( 'icon_dirs', array( $icon_dir => $icon_dir_uri ) );
5301
+			$dirs = apply_filters('icon_dirs', array($icon_dir => $icon_dir_uri));
5302 5302
 			$icon_files = array();
5303
-			while ( $dirs ) {
5304
-				$keys = array_keys( $dirs );
5305
-				$dir = array_shift( $keys );
5303
+			while ($dirs) {
5304
+				$keys = array_keys($dirs);
5305
+				$dir = array_shift($keys);
5306 5306
 				$uri = array_shift($dirs);
5307
-				if ( $dh = opendir($dir) ) {
5308
-					while ( false !== $file = readdir($dh) ) {
5307
+				if ($dh = opendir($dir)) {
5308
+					while (false !== $file = readdir($dh)) {
5309 5309
 						$file = basename($file);
5310
-						if ( substr($file, 0, 1) == '.' )
5310
+						if (substr($file, 0, 1) == '.')
5311 5311
 							continue;
5312
-						if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) {
5313
-							if ( is_dir("$dir/$file") )
5312
+						if ( ! in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg'))) {
5313
+							if (is_dir("$dir/$file"))
5314 5314
 								$dirs["$dir/$file"] = "$uri/$file";
5315 5315
 							continue;
5316 5316
 						}
@@ -5319,15 +5319,15 @@  discard block
 block discarded – undo
5319 5319
 					closedir($dh);
5320 5320
 				}
5321 5321
 			}
5322
-			wp_cache_add( 'icon_files', $icon_files, 'default', 600 );
5322
+			wp_cache_add('icon_files', $icon_files, 'default', 600);
5323 5323
 		}
5324 5324
 
5325 5325
 		$types = array();
5326 5326
 		// Icon basename - extension = MIME wildcard.
5327
-		foreach ( $icon_files as $file => $uri )
5328
-			$types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file];
5327
+		foreach ($icon_files as $file => $uri)
5328
+			$types[preg_replace('/^([^.]*).*$/', '$1', basename($file))] = & $icon_files[$file];
5329 5329
 
5330
-		if ( ! empty($mime) ) {
5330
+		if ( ! empty($mime)) {
5331 5331
 			$post_mimes[] = substr($mime, 0, strpos($mime, '/'));
5332 5332
 			$post_mimes[] = substr($mime, strpos($mime, '/') + 1);
5333 5333
 			$post_mimes[] = str_replace('/', '_', $mime);
@@ -5336,10 +5336,10 @@  discard block
 block discarded – undo
5336 5336
 		$matches = wp_match_mime_types(array_keys($types), $post_mimes);
5337 5337
 		$matches['default'] = array('default');
5338 5338
 
5339
-		foreach ( $matches as $match => $wilds ) {
5340
-			if ( isset($types[$wilds[0]])) {
5339
+		foreach ($matches as $match => $wilds) {
5340
+			if (isset($types[$wilds[0]])) {
5341 5341
 				$icon = $types[$wilds[0]];
5342
-				if ( !is_numeric($mime) )
5342
+				if ( ! is_numeric($mime))
5343 5343
 					wp_cache_add("mime_type_icon_$mime", $icon);
5344 5344
 				break;
5345 5345
 			}
@@ -5356,7 +5356,7 @@  discard block
 block discarded – undo
5356 5356
 	 * @param int    $post_id Attachment ID. Will equal 0 if the function passed
5357 5357
 	 *                        the mime type.
5358 5358
 	 */
5359
-	return apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );
5359
+	return apply_filters('wp_mime_type_icon', $icon, $mime, $post_id);
5360 5360
 }
5361 5361
 
5362 5362
 /**
@@ -5378,23 +5378,23 @@  discard block
 block discarded – undo
5378 5378
  * @param WP_Post $post        The Post Object
5379 5379
  * @param WP_Post $post_before The Previous Post Object
5380 5380
  */
5381
-function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
5381
+function wp_check_for_changed_slugs($post_id, $post, $post_before) {
5382 5382
 	// Don't bother if it hasnt changed.
5383
-	if ( $post->post_name == $post_before->post_name )
5383
+	if ($post->post_name == $post_before->post_name)
5384 5384
 		return;
5385 5385
 
5386 5386
 	// We're only concerned with published, non-hierarchical objects.
5387
-	if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) )
5387
+	if ($post->post_status != 'publish' || is_post_type_hierarchical($post->post_type))
5388 5388
 		return;
5389 5389
 
5390 5390
 	$old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');
5391 5391
 
5392 5392
 	// If we haven't added this old slug before, add it now.
5393
-	if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) )
5393
+	if ( ! empty($post_before->post_name) && ! in_array($post_before->post_name, $old_slugs))
5394 5394
 		add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);
5395 5395
 
5396 5396
 	// If the new slug was used previously, delete it from the list.
5397
-	if ( in_array($post->post_name, $old_slugs) )
5397
+	if (in_array($post->post_name, $old_slugs))
5398 5398
 		delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
5399 5399
 }
5400 5400
 
@@ -5412,8 +5412,8 @@  discard block
 block discarded – undo
5412 5412
  * @param string|array $post_type Single post type or an array of post types. Currently only supports 'post' or 'page'.
5413 5413
  * @return string SQL code that can be added to a where clause.
5414 5414
  */
5415
-function get_private_posts_cap_sql( $post_type ) {
5416
-	return get_posts_by_author_sql( $post_type, false );
5415
+function get_private_posts_cap_sql($post_type) {
5416
+	return get_posts_by_author_sql($post_type, false);
5417 5417
 }
5418 5418
 
5419 5419
 /**
@@ -5434,19 +5434,19 @@  discard block
 block discarded – undo
5434 5434
  *                                    $current_user.  Default false.
5435 5435
  * @return string SQL WHERE code that can be added to a query.
5436 5436
  */
5437
-function get_posts_by_author_sql( $post_type, $full = true, $post_author = null, $public_only = false ) {
5437
+function get_posts_by_author_sql($post_type, $full = true, $post_author = null, $public_only = false) {
5438 5438
 	global $wpdb;
5439 5439
 
5440
-	if ( is_array( $post_type ) ) {
5440
+	if (is_array($post_type)) {
5441 5441
 		$post_types = $post_type;
5442 5442
 	} else {
5443
-		$post_types = array( $post_type );
5443
+		$post_types = array($post_type);
5444 5444
 	}
5445 5445
 
5446 5446
 	$post_type_clauses = array();
5447
-	foreach ( $post_types as $post_type ) {
5448
-		$post_type_obj = get_post_type_object( $post_type );
5449
-		if ( ! $post_type_obj ) {
5447
+	foreach ($post_types as $post_type) {
5448
+		$post_type_obj = get_post_type_object($post_type);
5449
+		if ( ! $post_type_obj) {
5450 5450
 			continue;
5451 5451
 		}
5452 5452
 
@@ -5459,42 +5459,42 @@  discard block
 block discarded – undo
5459 5459
 		 *
5460 5460
 		 * @param string $cap Capability.
5461 5461
 		 */
5462
-		if ( ! $cap = apply_filters( 'pub_priv_sql_capability', '' ) ) {
5463
-			$cap = current_user_can( $post_type_obj->cap->read_private_posts );
5462
+		if ( ! $cap = apply_filters('pub_priv_sql_capability', '')) {
5463
+			$cap = current_user_can($post_type_obj->cap->read_private_posts);
5464 5464
 		}
5465 5465
 
5466 5466
 		// Only need to check the cap if $public_only is false.
5467 5467
 		$post_status_sql = "post_status = 'publish'";
5468
-		if ( false === $public_only ) {
5469
-			if ( $cap ) {
5468
+		if (false === $public_only) {
5469
+			if ($cap) {
5470 5470
 				// Does the user have the capability to view private posts? Guess so.
5471 5471
 				$post_status_sql .= " OR post_status = 'private'";
5472
-			} elseif ( is_user_logged_in() ) {
5472
+			} elseif (is_user_logged_in()) {
5473 5473
 				// Users can view their own private posts.
5474 5474
 				$id = get_current_user_id();
5475
-				if ( null === $post_author || ! $full ) {
5475
+				if (null === $post_author || ! $full) {
5476 5476
 					$post_status_sql .= " OR post_status = 'private' AND post_author = $id";
5477
-				} elseif ( $id == (int) $post_author ) {
5477
+				} elseif ($id == (int) $post_author) {
5478 5478
 					$post_status_sql .= " OR post_status = 'private'";
5479 5479
 				} // else none
5480 5480
 			} // else none
5481 5481
 		}
5482 5482
 
5483
-		$post_type_clauses[] = "( post_type = '" . $post_type . "' AND ( $post_status_sql ) )";
5483
+		$post_type_clauses[] = "( post_type = '".$post_type."' AND ( $post_status_sql ) )";
5484 5484
 	}
5485 5485
 
5486
-	if ( empty( $post_type_clauses ) ) {
5486
+	if (empty($post_type_clauses)) {
5487 5487
 		return $full ? 'WHERE 1 = 0' : '1 = 0';
5488 5488
 	}
5489 5489
 
5490
-	$sql = '( '. implode( ' OR ', $post_type_clauses ) . ' )';
5490
+	$sql = '( '.implode(' OR ', $post_type_clauses).' )';
5491 5491
 
5492
-	if ( null !== $post_author ) {
5493
-		$sql .= $wpdb->prepare( ' AND post_author = %d', $post_author );
5492
+	if (null !== $post_author) {
5493
+		$sql .= $wpdb->prepare(' AND post_author = %d', $post_author);
5494 5494
 	}
5495 5495
 
5496
-	if ( $full ) {
5497
-		$sql = 'WHERE ' . $sql;
5496
+	if ($full) {
5497
+		$sql = 'WHERE '.$sql;
5498 5498
 	}
5499 5499
 
5500 5500
 	return $sql;
@@ -5513,7 +5513,7 @@  discard block
 block discarded – undo
5513 5513
  *                         or 'server'. Default 'server'.
5514 5514
  * @return string The date of the last post.
5515 5515
  */
5516
-function get_lastpostdate( $timezone = 'server' ) {
5516
+function get_lastpostdate($timezone = 'server') {
5517 5517
 	/**
5518 5518
 	 * Filter the date the last post was published.
5519 5519
 	 *
@@ -5523,7 +5523,7 @@  discard block
 block discarded – undo
5523 5523
 	 *                         'blog', or 'server'.
5524 5524
 	 * @param string $timezone Location to use for getting the post published date.
5525 5525
 	 */
5526
-	return apply_filters( 'get_lastpostdate', _get_last_post_time( $timezone, 'date' ), $timezone );
5526
+	return apply_filters('get_lastpostdate', _get_last_post_time($timezone, 'date'), $timezone);
5527 5527
 }
5528 5528
 
5529 5529
 /**
@@ -5542,11 +5542,11 @@  discard block
 block discarded – undo
5542 5542
  *                         Default 'server'.
5543 5543
  * @return string The timestamp.
5544 5544
  */
5545
-function get_lastpostmodified( $timezone = 'server' ) {
5546
-	$lastpostmodified = _get_last_post_time( $timezone, 'modified' );
5545
+function get_lastpostmodified($timezone = 'server') {
5546
+	$lastpostmodified = _get_last_post_time($timezone, 'modified');
5547 5547
 
5548 5548
 	$lastpostdate = get_lastpostdate($timezone);
5549
-	if ( $lastpostdate > $lastpostmodified )
5549
+	if ($lastpostdate > $lastpostmodified)
5550 5550
 		$lastpostmodified = $lastpostdate;
5551 5551
 
5552 5552
 	/**
@@ -5558,7 +5558,7 @@  discard block
 block discarded – undo
5558 5558
 	 * @param string $timezone         Location to use for getting the post modified date.
5559 5559
 	 *                                 See {@see get_lastpostmodified()} for accepted `$timezone` values.
5560 5560
 	 */
5561
-	return apply_filters( 'get_lastpostmodified', $lastpostmodified, $timezone );
5561
+	return apply_filters('get_lastpostmodified', $lastpostmodified, $timezone);
5562 5562
 }
5563 5563
 
5564 5564
 /**
@@ -5574,26 +5574,26 @@  discard block
 block discarded – undo
5574 5574
  * @param string $field    Post field to check. Accepts 'date' or 'modified'.
5575 5575
  * @return string|false The timestamp.
5576 5576
  */
5577
-function _get_last_post_time( $timezone, $field ) {
5577
+function _get_last_post_time($timezone, $field) {
5578 5578
 	global $wpdb;
5579 5579
 
5580
-	if ( !in_array( $field, array( 'date', 'modified' ) ) )
5580
+	if ( ! in_array($field, array('date', 'modified')))
5581 5581
 		return false;
5582 5582
 
5583
-	$timezone = strtolower( $timezone );
5583
+	$timezone = strtolower($timezone);
5584 5584
 
5585 5585
 	$key = "lastpost{$field}:$timezone";
5586 5586
 
5587
-	$date = wp_cache_get( $key, 'timeinfo' );
5587
+	$date = wp_cache_get($key, 'timeinfo');
5588 5588
 
5589
-	if ( !$date ) {
5589
+	if ( ! $date) {
5590 5590
 		$add_seconds_server = date('Z');
5591 5591
 
5592
-		$post_types = get_post_types( array( 'public' => true ) );
5593
-		array_walk( $post_types, array( &$wpdb, 'escape_by_ref' ) );
5594
-		$post_types = "'" . implode( "', '", $post_types ) . "'";
5592
+		$post_types = get_post_types(array('public' => true));
5593
+		array_walk($post_types, array(&$wpdb, 'escape_by_ref'));
5594
+		$post_types = "'".implode("', '", $post_types)."'";
5595 5595
 
5596
-		switch ( $timezone ) {
5596
+		switch ($timezone) {
5597 5597
 			case 'gmt':
5598 5598
 				$date = $wpdb->get_var("SELECT post_{$field}_gmt FROM $wpdb->posts WHERE post_status = 'publish' AND post_type IN ({$post_types}) ORDER BY post_{$field}_gmt DESC LIMIT 1");
5599 5599
 				break;
@@ -5605,8 +5605,8 @@  discard block
 block discarded – undo
5605 5605
 				break;
5606 5606
 		}
5607 5607
 
5608
-		if ( $date )
5609
-			wp_cache_set( $key, $date, 'timeinfo' );
5608
+		if ($date)
5609
+			wp_cache_set($key, $date, 'timeinfo');
5610 5610
 	}
5611 5611
 
5612 5612
 	return $date;
@@ -5619,12 +5619,12 @@  discard block
 block discarded – undo
5619 5619
  *
5620 5620
  * @param array $posts Array of post objects, passed by reference.
5621 5621
  */
5622
-function update_post_cache( &$posts ) {
5623
-	if ( ! $posts )
5622
+function update_post_cache(&$posts) {
5623
+	if ( ! $posts)
5624 5624
 		return;
5625 5625
 
5626
-	foreach ( $posts as $post )
5627
-		wp_cache_add( $post->ID, $post, 'posts' );
5626
+	foreach ($posts as $post)
5627
+		wp_cache_add($post->ID, $post, 'posts');
5628 5628
 }
5629 5629
 
5630 5630
 /**
@@ -5643,22 +5643,22 @@  discard block
 block discarded – undo
5643 5643
  *
5644 5644
  * @param int|WP_Post $post Post ID or post object to remove from the cache.
5645 5645
  */
5646
-function clean_post_cache( $post ) {
5646
+function clean_post_cache($post) {
5647 5647
 	global $_wp_suspend_cache_invalidation, $wpdb;
5648 5648
 
5649
-	if ( ! empty( $_wp_suspend_cache_invalidation ) )
5649
+	if ( ! empty($_wp_suspend_cache_invalidation))
5650 5650
 		return;
5651 5651
 
5652
-	$post = get_post( $post );
5653
-	if ( empty( $post ) )
5652
+	$post = get_post($post);
5653
+	if (empty($post))
5654 5654
 		return;
5655 5655
 
5656
-	wp_cache_delete( $post->ID, 'posts' );
5657
-	wp_cache_delete( $post->ID, 'post_meta' );
5656
+	wp_cache_delete($post->ID, 'posts');
5657
+	wp_cache_delete($post->ID, 'post_meta');
5658 5658
 
5659
-	clean_object_term_cache( $post->ID, $post->post_type );
5659
+	clean_object_term_cache($post->ID, $post->post_type);
5660 5660
 
5661
-	wp_cache_delete( 'wp_get_archives', 'general' );
5661
+	wp_cache_delete('wp_get_archives', 'general');
5662 5662
 
5663 5663
 	/**
5664 5664
 	 * Fires immediately after the given post's cache is cleaned.
@@ -5668,10 +5668,10 @@  discard block
 block discarded – undo
5668 5668
 	 * @param int     $post_id Post ID.
5669 5669
 	 * @param WP_Post $post    Post object.
5670 5670
 	 */
5671
-	do_action( 'clean_post_cache', $post->ID, $post );
5671
+	do_action('clean_post_cache', $post->ID, $post);
5672 5672
 
5673
-	if ( 'page' == $post->post_type ) {
5674
-		wp_cache_delete( 'all_page_ids', 'posts' );
5673
+	if ('page' == $post->post_type) {
5674
+		wp_cache_delete('all_page_ids', 'posts');
5675 5675
 
5676 5676
 		/**
5677 5677
 		 * Fires immediately after the given page's cache is cleaned.
@@ -5680,10 +5680,10 @@  discard block
 block discarded – undo
5680 5680
 		 *
5681 5681
 		 * @param int $post_id Post ID.
5682 5682
 		 */
5683
-		do_action( 'clean_page_cache', $post->ID );
5683
+		do_action('clean_page_cache', $post->ID);
5684 5684
 	}
5685 5685
 
5686
-	wp_cache_set( 'last_changed', microtime(), 'posts' );
5686
+	wp_cache_set('last_changed', microtime(), 'posts');
5687 5687
 }
5688 5688
 
5689 5689
 /**
@@ -5696,27 +5696,27 @@  discard block
 block discarded – undo
5696 5696
  * @param bool   $update_term_cache Optional. Whether to update the term cache. Default true.
5697 5697
  * @param bool   $update_meta_cache Optional. Whether to update the meta cache. Default true.
5698 5698
  */
5699
-function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
5699
+function update_post_caches(&$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true) {
5700 5700
 	// No point in doing all this work if we didn't match any posts.
5701
-	if ( !$posts )
5701
+	if ( ! $posts)
5702 5702
 		return;
5703 5703
 
5704 5704
 	update_post_cache($posts);
5705 5705
 
5706 5706
 	$post_ids = array();
5707
-	foreach ( $posts as $post )
5707
+	foreach ($posts as $post)
5708 5708
 		$post_ids[] = $post->ID;
5709 5709
 
5710
-	if ( ! $post_type )
5710
+	if ( ! $post_type)
5711 5711
 		$post_type = 'any';
5712 5712
 
5713
-	if ( $update_term_cache ) {
5714
-		if ( is_array($post_type) ) {
5713
+	if ($update_term_cache) {
5714
+		if (is_array($post_type)) {
5715 5715
 			$ptypes = $post_type;
5716
-		} elseif ( 'any' == $post_type ) {
5716
+		} elseif ('any' == $post_type) {
5717 5717
 			$ptypes = array();
5718 5718
 			// Just use the post_types in the supplied posts.
5719
-			foreach ( $posts as $post ) {
5719
+			foreach ($posts as $post) {
5720 5720
 				$ptypes[] = $post->post_type;
5721 5721
 			}
5722 5722
 			$ptypes = array_unique($ptypes);
@@ -5724,11 +5724,11 @@  discard block
 block discarded – undo
5724 5724
 			$ptypes = array($post_type);
5725 5725
 		}
5726 5726
 
5727
-		if ( ! empty($ptypes) )
5727
+		if ( ! empty($ptypes))
5728 5728
 			update_object_term_cache($post_ids, $ptypes);
5729 5729
 	}
5730 5730
 
5731
-	if ( $update_meta_cache )
5731
+	if ($update_meta_cache)
5732 5732
 		update_postmeta_cache($post_ids);
5733 5733
 }
5734 5734
 
@@ -5745,7 +5745,7 @@  discard block
 block discarded – undo
5745 5745
  * @return array|false Returns false if there is nothing to update or an array
5746 5746
  *                     of metadata.
5747 5747
  */
5748
-function update_postmeta_cache( $post_ids ) {
5748
+function update_postmeta_cache($post_ids) {
5749 5749
 	return update_meta_cache('post', $post_ids);
5750 5750
 }
5751 5751
 
@@ -5764,10 +5764,10 @@  discard block
 block discarded – undo
5764 5764
  * @param int  $id          The attachment ID in the cache to clean.
5765 5765
  * @param bool $clean_terms Optional. Whether to clean terms cache. Default false.
5766 5766
  */
5767
-function clean_attachment_cache( $id, $clean_terms = false ) {
5767
+function clean_attachment_cache($id, $clean_terms = false) {
5768 5768
 	global $_wp_suspend_cache_invalidation;
5769 5769
 
5770
-	if ( !empty($_wp_suspend_cache_invalidation) )
5770
+	if ( ! empty($_wp_suspend_cache_invalidation))
5771 5771
 		return;
5772 5772
 
5773 5773
 	$id = (int) $id;
@@ -5775,7 +5775,7 @@  discard block
 block discarded – undo
5775 5775
 	wp_cache_delete($id, 'posts');
5776 5776
 	wp_cache_delete($id, 'post_meta');
5777 5777
 
5778
-	if ( $clean_terms )
5778
+	if ($clean_terms)
5779 5779
 		clean_object_term_cache($id, 'attachment');
5780 5780
 
5781 5781
 	/**
@@ -5785,7 +5785,7 @@  discard block
 block discarded – undo
5785 5785
 	 *
5786 5786
 	 * @param int $id Attachment ID.
5787 5787
 	 */
5788
-	do_action( 'clean_attachment_cache', $id );
5788
+	do_action('clean_attachment_cache', $id);
5789 5789
 }
5790 5790
 
5791 5791
 //
@@ -5805,13 +5805,13 @@  discard block
 block discarded – undo
5805 5805
  * @param string  $old_status Previous post status.
5806 5806
  * @param WP_Post $post       Post object.
5807 5807
  */
5808
-function _transition_post_status( $new_status, $old_status, $post ) {
5808
+function _transition_post_status($new_status, $old_status, $post) {
5809 5809
 	global $wpdb;
5810 5810
 
5811
-	if ( $old_status != 'publish' && $new_status == 'publish' ) {
5811
+	if ($old_status != 'publish' && $new_status == 'publish') {
5812 5812
 		// Reset GUID if transitioning to publish and it is empty.
5813
-		if ( '' == get_the_guid($post->ID) )
5814
-			$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
5813
+		if ('' == get_the_guid($post->ID))
5814
+			$wpdb->update($wpdb->posts, array('guid' => get_permalink($post->ID)), array('ID' => $post->ID));
5815 5815
 
5816 5816
 		/**
5817 5817
 		 * Fires when a post's status is transitioned from private to published.
@@ -5825,20 +5825,20 @@  discard block
 block discarded – undo
5825 5825
 	}
5826 5826
 
5827 5827
 	// If published posts changed clear the lastpostmodified cache.
5828
-	if ( 'publish' == $new_status || 'publish' == $old_status) {
5829
-		foreach ( array( 'server', 'gmt', 'blog' ) as $timezone ) {
5830
-			wp_cache_delete( "lastpostmodified:$timezone", 'timeinfo' );
5831
-			wp_cache_delete( "lastpostdate:$timezone", 'timeinfo' );
5828
+	if ('publish' == $new_status || 'publish' == $old_status) {
5829
+		foreach (array('server', 'gmt', 'blog') as $timezone) {
5830
+			wp_cache_delete("lastpostmodified:$timezone", 'timeinfo');
5831
+			wp_cache_delete("lastpostdate:$timezone", 'timeinfo');
5832 5832
 		}
5833 5833
 	}
5834 5834
 
5835
-	if ( $new_status !== $old_status ) {
5836
-		wp_cache_delete( _count_posts_cache_key( $post->post_type ), 'counts' );
5837
-		wp_cache_delete( _count_posts_cache_key( $post->post_type, 'readable' ), 'counts' );
5835
+	if ($new_status !== $old_status) {
5836
+		wp_cache_delete(_count_posts_cache_key($post->post_type), 'counts');
5837
+		wp_cache_delete(_count_posts_cache_key($post->post_type, 'readable'), 'counts');
5838 5838
 	}
5839 5839
 
5840 5840
 	// Always clears the hook in case the post status bounced from future to draft.
5841
-	wp_clear_scheduled_hook('publish_future_post', array( $post->ID ) );
5841
+	wp_clear_scheduled_hook('publish_future_post', array($post->ID));
5842 5842
 }
5843 5843
 
5844 5844
 /**
@@ -5855,9 +5855,9 @@  discard block
 block discarded – undo
5855 5855
  *                            {@see _future_post_hook()}.
5856 5856
  * @param WP_Post $post       Post object.
5857 5857
  */
5858
-function _future_post_hook( $deprecated, $post ) {
5859
-	wp_clear_scheduled_hook( 'publish_future_post', array( $post->ID ) );
5860
-	wp_schedule_single_event( strtotime( get_gmt_from_date( $post->post_date ) . ' GMT') , 'publish_future_post', array( $post->ID ) );
5858
+function _future_post_hook($deprecated, $post) {
5859
+	wp_clear_scheduled_hook('publish_future_post', array($post->ID));
5860
+	wp_schedule_single_event(strtotime(get_gmt_from_date($post->post_date).' GMT'), 'publish_future_post', array($post->ID));
5861 5861
 }
5862 5862
 
5863 5863
 /**
@@ -5870,8 +5870,8 @@  discard block
 block discarded – undo
5870 5870
  *
5871 5871
  * @param int $post_id The ID in the database table of the post being published.
5872 5872
  */
5873
-function _publish_post_hook( $post_id ) {
5874
-	if ( defined( 'XMLRPC_REQUEST' ) ) {
5873
+function _publish_post_hook($post_id) {
5874
+	if (defined('XMLRPC_REQUEST')) {
5875 5875
 		/**
5876 5876
 		 * Fires when _publish_post_hook() is called during an XML-RPC request.
5877 5877
 		 *
@@ -5879,15 +5879,15 @@  discard block
 block discarded – undo
5879 5879
 		 *
5880 5880
 		 * @param int $post_id Post ID.
5881 5881
 		 */
5882
-		do_action( 'xmlrpc_publish_post', $post_id );
5882
+		do_action('xmlrpc_publish_post', $post_id);
5883 5883
 	}
5884 5884
 
5885
-	if ( defined('WP_IMPORTING') )
5885
+	if (defined('WP_IMPORTING'))
5886 5886
 		return;
5887 5887
 
5888
-	if ( get_option('default_pingback_flag') )
5889
-		add_post_meta( $post_id, '_pingme', '1' );
5890
-	add_post_meta( $post_id, '_encloseme', '1' );
5888
+	if (get_option('default_pingback_flag'))
5889
+		add_post_meta($post_id, '_pingme', '1');
5890
+	add_post_meta($post_id, '_encloseme', '1');
5891 5891
 
5892 5892
 	wp_schedule_single_event(time(), 'do_pings');
5893 5893
 }
@@ -5901,9 +5901,9 @@  discard block
 block discarded – undo
5901 5901
  *
5902 5902
  * @return int|false Post parent ID, otherwise false.
5903 5903
  */
5904
-function wp_get_post_parent_id( $post_ID ) {
5905
-	$post = get_post( $post_ID );
5906
-	if ( !$post || is_wp_error( $post ) )
5904
+function wp_get_post_parent_id($post_ID) {
5905
+	$post = get_post($post_ID);
5906
+	if ( ! $post || is_wp_error($post))
5907 5907
 		return false;
5908 5908
 	return (int) $post->post_parent;
5909 5909
 }
@@ -5922,30 +5922,30 @@  discard block
 block discarded – undo
5922 5922
  * @param int $post_ID     ID of the post we're checking.
5923 5923
  * @return int The new post_parent for the post, 0 otherwise.
5924 5924
  */
5925
-function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) {
5925
+function wp_check_post_hierarchy_for_loops($post_parent, $post_ID) {
5926 5926
 	// Nothing fancy here - bail.
5927
-	if ( !$post_parent )
5927
+	if ( ! $post_parent)
5928 5928
 		return 0;
5929 5929
 
5930 5930
 	// New post can't cause a loop.
5931
-	if ( empty( $post_ID ) )
5931
+	if (empty($post_ID))
5932 5932
 		return $post_parent;
5933 5933
 
5934 5934
 	// Can't be its own parent.
5935
-	if ( $post_parent == $post_ID )
5935
+	if ($post_parent == $post_ID)
5936 5936
 		return 0;
5937 5937
 
5938 5938
 	// Now look for larger loops.
5939
-	if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) )
5939
+	if ( ! $loop = wp_find_hierarchy_loop('wp_get_post_parent_id', $post_ID, $post_parent))
5940 5940
 		return $post_parent; // No loop
5941 5941
 
5942 5942
 	// Setting $post_parent to the given value causes a loop.
5943
-	if ( isset( $loop[$post_ID] ) )
5943
+	if (isset($loop[$post_ID]))
5944 5944
 		return 0;
5945 5945
 
5946 5946
 	// There's a loop, but it doesn't contain $post_ID. Break the loop.
5947
-	foreach ( array_keys( $loop ) as $loop_member )
5948
-		wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0 ) );
5947
+	foreach (array_keys($loop) as $loop_member)
5948
+		wp_update_post(array('ID' => $loop_member, 'post_parent' => 0));
5949 5949
 
5950 5950
 	return $post_parent;
5951 5951
 }
@@ -5959,14 +5959,14 @@  discard block
 block discarded – undo
5959 5959
  * @param int         $thumbnail_id Thumbnail to attach.
5960 5960
  * @return int|bool True on success, false on failure.
5961 5961
  */
5962
-function set_post_thumbnail( $post, $thumbnail_id ) {
5963
-	$post = get_post( $post );
5964
-	$thumbnail_id = absint( $thumbnail_id );
5965
-	if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
5966
-		if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) )
5967
-			return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
5962
+function set_post_thumbnail($post, $thumbnail_id) {
5963
+	$post = get_post($post);
5964
+	$thumbnail_id = absint($thumbnail_id);
5965
+	if ($post && $thumbnail_id && get_post($thumbnail_id)) {
5966
+		if (wp_get_attachment_image($thumbnail_id, 'thumbnail'))
5967
+			return update_post_meta($post->ID, '_thumbnail_id', $thumbnail_id);
5968 5968
 		else
5969
-			return delete_post_meta( $post->ID, '_thumbnail_id' );
5969
+			return delete_post_meta($post->ID, '_thumbnail_id');
5970 5970
 	}
5971 5971
 	return false;
5972 5972
 }
@@ -5979,10 +5979,10 @@  discard block
 block discarded – undo
5979 5979
  * @param int|WP_Post $post Post ID or post object where thumbnail should be removed from.
5980 5980
  * @return bool True on success, false on failure.
5981 5981
  */
5982
-function delete_post_thumbnail( $post ) {
5983
-	$post = get_post( $post );
5984
-	if ( $post )
5985
-		return delete_post_meta( $post->ID, '_thumbnail_id' );
5982
+function delete_post_thumbnail($post) {
5983
+	$post = get_post($post);
5984
+	if ($post)
5985
+		return delete_post_meta($post->ID, '_thumbnail_id');
5986 5986
 	return false;
5987 5987
 }
5988 5988
 
@@ -5997,10 +5997,10 @@  discard block
 block discarded – undo
5997 5997
 	global $wpdb;
5998 5998
 
5999 5999
 	// Cleanup old auto-drafts more than 7 days old.
6000
-	$old_posts = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date" );
6001
-	foreach ( (array) $old_posts as $delete ) {
6000
+	$old_posts = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_status = 'auto-draft' AND DATE_SUB( NOW(), INTERVAL 7 DAY ) > post_date");
6001
+	foreach ((array) $old_posts as $delete) {
6002 6002
 		// Force delete.
6003
-		wp_delete_post( $delete, true );
6003
+		wp_delete_post($delete, true);
6004 6004
 	}
6005 6005
 }
6006 6006
 
@@ -6017,11 +6017,11 @@  discard block
 block discarded – undo
6017 6017
  * @param string  $old_status Old post status.
6018 6018
  * @param WP_Post $post       Post object.
6019 6019
  */
6020
-function _update_term_count_on_transition_post_status( $new_status, $old_status, $post ) {
6020
+function _update_term_count_on_transition_post_status($new_status, $old_status, $post) {
6021 6021
 	// Update counts for the post's terms.
6022
-	foreach ( (array) get_object_taxonomies( $post->post_type ) as $taxonomy ) {
6023
-		$tt_ids = wp_get_object_terms( $post->ID, $taxonomy, array( 'fields' => 'tt_ids' ) );
6024
-		wp_update_term_count( $tt_ids, $taxonomy );
6022
+	foreach ((array) get_object_taxonomies($post->post_type) as $taxonomy) {
6023
+		$tt_ids = wp_get_object_terms($post->ID, $taxonomy, array('fields' => 'tt_ids'));
6024
+		wp_update_term_count($tt_ids, $taxonomy);
6025 6025
 	}
6026 6026
 }
6027 6027
 
@@ -6039,13 +6039,13 @@  discard block
 block discarded – undo
6039 6039
  * @param bool  $update_term_cache Optional. Whether to update the term cache. Default true.
6040 6040
  * @param bool  $update_meta_cache Optional. Whether to update the meta cache. Default true.
6041 6041
  */
6042
-function _prime_post_caches( $ids, $update_term_cache = true, $update_meta_cache = true ) {
6042
+function _prime_post_caches($ids, $update_term_cache = true, $update_meta_cache = true) {
6043 6043
 	global $wpdb;
6044 6044
 
6045
-	$non_cached_ids = _get_non_cached_ids( $ids, 'posts' );
6046
-	if ( !empty( $non_cached_ids ) ) {
6047
-		$fresh_posts = $wpdb->get_results( sprintf( "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join( ",", $non_cached_ids ) ) );
6045
+	$non_cached_ids = _get_non_cached_ids($ids, 'posts');
6046
+	if ( ! empty($non_cached_ids)) {
6047
+		$fresh_posts = $wpdb->get_results(sprintf("SELECT $wpdb->posts.* FROM $wpdb->posts WHERE ID IN (%s)", join(",", $non_cached_ids)));
6048 6048
 
6049
-		update_post_caches( $fresh_posts, 'any', $update_term_cache, $update_meta_cache );
6049
+		update_post_caches($fresh_posts, 'any', $update_term_cache, $update_meta_cache);
6050 6050
 	}
6051 6051
 }
Please login to merge, or discard this patch.
Braces   +689 added lines, -472 removed lines patch added patch discarded remove patch
@@ -186,10 +186,12 @@  discard block
 block discarded – undo
186 186
 function get_attached_file( $attachment_id, $unfiltered = false ) {
187 187
 	$file = get_post_meta( $attachment_id, '_wp_attached_file', true );
188 188
 	// If the file is relative, prepend upload dir.
189
-	if ( $file && 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) )
190
-		$file = $uploads['basedir'] . "/$file";
191
-	if ( $unfiltered )
192
-		return $file;
189
+	if ( $file && 0 !== strpos($file, '/') && !preg_match('|^.:\\\|', $file) && ( ($uploads = wp_upload_dir()) && false === $uploads['error'] ) ) {
190
+			$file = $uploads['basedir'] . "/$file";
191
+	}
192
+	if ( $unfiltered ) {
193
+			return $file;
194
+	}
193 195
 
194 196
 	/**
195 197
 	 * Filter the attached file based on the given ID.
@@ -215,8 +217,9 @@  discard block
 block discarded – undo
215 217
  * @return bool True on success, false on failure.
216 218
  */
217 219
 function update_attached_file( $attachment_id, $file ) {
218
-	if ( !get_post( $attachment_id ) )
219
-		return false;
220
+	if ( !get_post( $attachment_id ) ) {
221
+			return false;
222
+	}
220 223
 
221 224
 	/**
222 225
 	 * Filter the path to the attached file to update.
@@ -228,11 +231,12 @@  discard block
 block discarded – undo
228 231
 	 */
229 232
 	$file = apply_filters( 'update_attached_file', $file, $attachment_id );
230 233
 
231
-	if ( $file = _wp_relative_upload_path( $file ) )
232
-		return update_post_meta( $attachment_id, '_wp_attached_file', $file );
233
-	else
234
-		return delete_post_meta( $attachment_id, '_wp_attached_file' );
235
-}
234
+	if ( $file = _wp_relative_upload_path( $file ) ) {
235
+			return update_post_meta( $attachment_id, '_wp_attached_file', $file );
236
+	} else {
237
+			return delete_post_meta( $attachment_id, '_wp_attached_file' );
238
+	}
239
+	}
236 240
 
237 241
 /**
238 242
  * Return relative path to an uploaded file.
@@ -339,16 +343,19 @@  discard block
 block discarded – undo
339 343
 
340 344
 	$children = get_posts( $r );
341 345
 
342
-	if ( ! $children )
343
-		return $kids;
346
+	if ( ! $children ) {
347
+			return $kids;
348
+	}
344 349
 
345
-	if ( ! empty( $r['fields'] ) )
346
-		return $children;
350
+	if ( ! empty( $r['fields'] ) ) {
351
+			return $children;
352
+	}
347 353
 
348 354
 	update_post_cache($children);
349 355
 
350
-	foreach ( $children as $key => $child )
351
-		$kids[$child->ID] = $children[$key];
356
+	foreach ( $children as $key => $child ) {
357
+			$kids[$child->ID] = $children[$key];
358
+	}
352 359
 
353 360
 	if ( $output == OBJECT ) {
354 361
 		return $kids;
@@ -423,8 +430,9 @@  discard block
 block discarded – undo
423 430
  *                            When $output is OBJECT, a `WP_Post` instance is returned.
424 431
  */
425 432
 function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
426
-	if ( empty( $post ) && isset( $GLOBALS['post'] ) )
427
-		$post = $GLOBALS['post'];
433
+	if ( empty( $post ) && isset( $GLOBALS['post'] ) ) {
434
+			$post = $GLOBALS['post'];
435
+	}
428 436
 
429 437
 	if ( $post instanceof WP_Post ) {
430 438
 		$_post = $post;
@@ -441,15 +449,17 @@  discard block
 block discarded – undo
441 449
 		$_post = WP_Post::get_instance( $post );
442 450
 	}
443 451
 
444
-	if ( ! $_post )
445
-		return null;
452
+	if ( ! $_post ) {
453
+			return null;
454
+	}
446 455
 
447 456
 	$_post = $_post->filter( $filter );
448 457
 
449
-	if ( $output == ARRAY_A )
450
-		return $_post->to_array();
451
-	elseif ( $output == ARRAY_N )
452
-		return array_values( $_post->to_array() );
458
+	if ( $output == ARRAY_A ) {
459
+			return $_post->to_array();
460
+	} elseif ( $output == ARRAY_N ) {
461
+			return array_values( $_post->to_array() );
462
+	}
453 463
 
454 464
 	return $_post;
455 465
 }
@@ -658,16 +668,18 @@  discard block
 block discarded – undo
658 668
 		global $wpdb;
659 669
 
660 670
 		$post_id = (int) $post_id;
661
-		if ( ! $post_id )
662
-			return false;
671
+		if ( ! $post_id ) {
672
+					return false;
673
+		}
663 674
 
664 675
 		$_post = wp_cache_get( $post_id, 'posts' );
665 676
 
666 677
 		if ( ! $_post ) {
667 678
 			$_post = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->posts WHERE ID = %d LIMIT 1", $post_id ) );
668 679
 
669
-			if ( ! $_post )
670
-				return false;
680
+			if ( ! $_post ) {
681
+							return false;
682
+			}
671 683
 
672 684
 			$_post = sanitize_post( $_post, 'raw' );
673 685
 			wp_cache_add( $_post->ID, $_post, 'posts' );
@@ -684,8 +696,9 @@  discard block
 block discarded – undo
684 696
 	 * @param WP_Post|object $post Post object.
685 697
 	 */
686 698
 	public function __construct( $post ) {
687
-		foreach ( get_object_vars( $post ) as $key => $value )
688
-			$this->$key = $value;
699
+		foreach ( get_object_vars( $post ) as $key => $value ) {
700
+					$this->$key = $value;
701
+		}
689 702
 	}
690 703
 
691 704
 	/**
@@ -695,17 +708,21 @@  discard block
 block discarded – undo
695 708
 	 * @return bool
696 709
 	 */
697 710
 	public function __isset( $key ) {
698
-		if ( 'ancestors' == $key )
699
-			return true;
711
+		if ( 'ancestors' == $key ) {
712
+					return true;
713
+		}
700 714
 
701
-		if ( 'page_template' == $key )
702
-			return ( 'page' == $this->post_type );
715
+		if ( 'page_template' == $key ) {
716
+					return ( 'page' == $this->post_type );
717
+		}
703 718
 
704
-		if ( 'post_category' == $key )
705
-		   return true;
719
+		if ( 'post_category' == $key ) {
720
+				   return true;
721
+		}
706 722
 
707
-		if ( 'tags_input' == $key )
708
-		   return true;
723
+		if ( 'tags_input' == $key ) {
724
+				   return true;
725
+		}
709 726
 
710 727
 		return metadata_exists( 'post', $this->ID, $key );
711 728
 	}
@@ -722,33 +739,39 @@  discard block
 block discarded – undo
722 739
 		}
723 740
 
724 741
 		if ( 'post_category' == $key ) {
725
-			if ( is_object_in_taxonomy( $this->post_type, 'category' ) )
726
-				$terms = get_the_terms( $this, 'category' );
742
+			if ( is_object_in_taxonomy( $this->post_type, 'category' ) ) {
743
+							$terms = get_the_terms( $this, 'category' );
744
+			}
727 745
 
728
-			if ( empty( $terms ) )
729
-				return array();
746
+			if ( empty( $terms ) ) {
747
+							return array();
748
+			}
730 749
 
731 750
 			return wp_list_pluck( $terms, 'term_id' );
732 751
 		}
733 752
 
734 753
 		if ( 'tags_input' == $key ) {
735
-			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) )
736
-				$terms = get_the_terms( $this, 'post_tag' );
754
+			if ( is_object_in_taxonomy( $this->post_type, 'post_tag' ) ) {
755
+							$terms = get_the_terms( $this, 'post_tag' );
756
+			}
737 757
 
738
-			if ( empty( $terms ) )
739
-				return array();
758
+			if ( empty( $terms ) ) {
759
+							return array();
760
+			}
740 761
 
741 762
 			return wp_list_pluck( $terms, 'name' );
742 763
 		}
743 764
 
744 765
 		// Rest of the values need filtering.
745
-		if ( 'ancestors' == $key )
746
-			$value = get_post_ancestors( $this );
747
-		else
748
-			$value = get_post_meta( $this->ID, $key, true );
766
+		if ( 'ancestors' == $key ) {
767
+					$value = get_post_ancestors( $this );
768
+		} else {
769
+					$value = get_post_meta( $this->ID, $key, true );
770
+		}
749 771
 
750
-		if ( $this->filter )
751
-			$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
772
+		if ( $this->filter ) {
773
+					$value = sanitize_post_field( $key, $value, $this->ID, $this->filter );
774
+		}
752 775
 
753 776
 		return $value;
754 777
 	}
@@ -760,11 +783,13 @@  discard block
 block discarded – undo
760 783
 	 * @return self|array|bool|object|WP_Post
761 784
 	 */
762 785
 	public function filter( $filter ) {
763
-		if ( $this->filter == $filter )
764
-			return $this;
786
+		if ( $this->filter == $filter ) {
787
+					return $this;
788
+		}
765 789
 
766
-		if ( $filter == 'raw' )
767
-			return self::get_instance( $this->ID );
790
+		if ( $filter == 'raw' ) {
791
+					return self::get_instance( $this->ID );
792
+		}
768 793
 
769 794
 		return sanitize_post( $this, $filter );
770 795
 	}
@@ -778,8 +803,9 @@  discard block
 block discarded – undo
778 803
 		$post = get_object_vars( $this );
779 804
 
780 805
 		foreach ( array( 'ancestors', 'page_template', 'post_category', 'tags_input' ) as $key ) {
781
-			if ( $this->__isset( $key ) )
782
-				$post[ $key ] = $this->__get( $key );
806
+			if ( $this->__isset( $key ) ) {
807
+							$post[ $key ] = $this->__get( $key );
808
+			}
783 809
 		}
784 810
 
785 811
 		return $post;
@@ -797,8 +823,9 @@  discard block
 block discarded – undo
797 823
 function get_post_ancestors( $post ) {
798 824
 	$post = get_post( $post );
799 825
 
800
-	if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID )
801
-		return array();
826
+	if ( ! $post || empty( $post->post_parent ) || $post->post_parent == $post->ID ) {
827
+			return array();
828
+	}
802 829
 
803 830
 	$ancestors = array();
804 831
 
@@ -806,8 +833,9 @@  discard block
 block discarded – undo
806 833
 
807 834
 	while ( $ancestor = get_post( $id ) ) {
808 835
 		// Loop detection: If the ancestor has been seen before, break.
809
-		if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) )
810
-			break;
836
+		if ( empty( $ancestor->post_parent ) || ( $ancestor->post_parent == $post->ID ) || in_array( $ancestor->post_parent, $ancestors ) ) {
837
+					break;
838
+		}
811 839
 
812 840
 		$id = $ancestors[] = $ancestor->post_parent;
813 841
 	}
@@ -837,11 +865,13 @@  discard block
 block discarded – undo
837 865
 function get_post_field( $field, $post, $context = 'display' ) {
838 866
 	$post = get_post( $post );
839 867
 
840
-	if ( !$post )
841
-		return '';
868
+	if ( !$post ) {
869
+			return '';
870
+	}
842 871
 
843
-	if ( !isset($post->$field) )
844
-		return '';
872
+	if ( !isset($post->$field) ) {
873
+			return '';
874
+	}
845 875
 
846 876
 	return sanitize_post_field($field, $post->$field, $post->ID, $context);
847 877
 }
@@ -860,8 +890,9 @@  discard block
 block discarded – undo
860 890
 function get_post_mime_type( $ID = '' ) {
861 891
 	$post = get_post($ID);
862 892
 
863
-	if ( is_object($post) )
864
-		return $post->post_mime_type;
893
+	if ( is_object($post) ) {
894
+			return $post->post_mime_type;
895
+	}
865 896
 
866 897
 	return false;
867 898
 }
@@ -880,16 +911,19 @@  discard block
 block discarded – undo
880 911
 function get_post_status( $ID = '' ) {
881 912
 	$post = get_post($ID);
882 913
 
883
-	if ( !is_object($post) )
884
-		return false;
914
+	if ( !is_object($post) ) {
915
+			return false;
916
+	}
885 917
 
886 918
 	if ( 'attachment' == $post->post_type ) {
887
-		if ( 'private' == $post->post_status )
888
-			return 'private';
919
+		if ( 'private' == $post->post_status ) {
920
+					return 'private';
921
+		}
889 922
 
890 923
 		// Unattached attachments are assumed to be published.
891
-		if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) )
892
-			return 'publish';
924
+		if ( ( 'inherit' == $post->post_status ) && ( 0 == $post->post_parent) ) {
925
+					return 'publish';
926
+		}
893 927
 
894 928
 		// Inherit status from the parent.
895 929
 		if ( $post->post_parent && ( $post->ID != $post->post_parent ) ) {
@@ -993,8 +1027,9 @@  discard block
 block discarded – undo
993 1027
 function register_post_status( $post_status, $args = array() ) {
994 1028
 	global $wp_post_statuses;
995 1029
 
996
-	if (!is_array($wp_post_statuses))
997
-		$wp_post_statuses = array();
1030
+	if (!is_array($wp_post_statuses)) {
1031
+			$wp_post_statuses = array();
1032
+	}
998 1033
 
999 1034
 	// Args prefixed with an underscore are reserved for internal use.
1000 1035
 	$defaults = array(
@@ -1017,38 +1052,49 @@  discard block
 block discarded – undo
1017 1052
 	$args->name = $post_status;
1018 1053
 
1019 1054
 	// Set various defaults.
1020
-	if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private )
1021
-		$args->internal = true;
1055
+	if ( null === $args->public && null === $args->internal && null === $args->protected && null === $args->private ) {
1056
+			$args->internal = true;
1057
+	}
1022 1058
 
1023
-	if ( null === $args->public  )
1024
-		$args->public = false;
1059
+	if ( null === $args->public  ) {
1060
+			$args->public = false;
1061
+	}
1025 1062
 
1026
-	if ( null === $args->private  )
1027
-		$args->private = false;
1063
+	if ( null === $args->private  ) {
1064
+			$args->private = false;
1065
+	}
1028 1066
 
1029
-	if ( null === $args->protected  )
1030
-		$args->protected = false;
1067
+	if ( null === $args->protected  ) {
1068
+			$args->protected = false;
1069
+	}
1031 1070
 
1032
-	if ( null === $args->internal  )
1033
-		$args->internal = false;
1071
+	if ( null === $args->internal  ) {
1072
+			$args->internal = false;
1073
+	}
1034 1074
 
1035
-	if ( null === $args->publicly_queryable )
1036
-		$args->publicly_queryable = $args->public;
1075
+	if ( null === $args->publicly_queryable ) {
1076
+			$args->publicly_queryable = $args->public;
1077
+	}
1037 1078
 
1038
-	if ( null === $args->exclude_from_search )
1039
-		$args->exclude_from_search = $args->internal;
1079
+	if ( null === $args->exclude_from_search ) {
1080
+			$args->exclude_from_search = $args->internal;
1081
+	}
1040 1082
 
1041
-	if ( null === $args->show_in_admin_all_list )
1042
-		$args->show_in_admin_all_list = !$args->internal;
1083
+	if ( null === $args->show_in_admin_all_list ) {
1084
+			$args->show_in_admin_all_list = !$args->internal;
1085
+	}
1043 1086
 
1044
-	if ( null === $args->show_in_admin_status_list )
1045
-		$args->show_in_admin_status_list = !$args->internal;
1087
+	if ( null === $args->show_in_admin_status_list ) {
1088
+			$args->show_in_admin_status_list = !$args->internal;
1089
+	}
1046 1090
 
1047
-	if ( false === $args->label )
1048
-		$args->label = $post_status;
1091
+	if ( false === $args->label ) {
1092
+			$args->label = $post_status;
1093
+	}
1049 1094
 
1050
-	if ( false === $args->label_count )
1051
-		$args->label_count = array( $args->label, $args->label );
1095
+	if ( false === $args->label_count ) {
1096
+			$args->label_count = array( $args->label, $args->label );
1097
+	}
1052 1098
 
1053 1099
 	$wp_post_statuses[$post_status] = $args;
1054 1100
 
@@ -1070,8 +1116,9 @@  discard block
 block discarded – undo
1070 1116
 function get_post_status_object( $post_status ) {
1071 1117
 	global $wp_post_statuses;
1072 1118
 
1073
-	if ( empty($wp_post_statuses[$post_status]) )
1074
-		return null;
1119
+	if ( empty($wp_post_statuses[$post_status]) ) {
1120
+			return null;
1121
+	}
1075 1122
 
1076 1123
 	return $wp_post_statuses[$post_status];
1077 1124
 }
@@ -1114,8 +1161,9 @@  discard block
 block discarded – undo
1114 1161
  * @return bool Whether post type is hierarchical.
1115 1162
  */
1116 1163
 function is_post_type_hierarchical( $post_type ) {
1117
-	if ( ! post_type_exists( $post_type ) )
1118
-		return false;
1164
+	if ( ! post_type_exists( $post_type ) ) {
1165
+			return false;
1166
+	}
1119 1167
 
1120 1168
 	$post_type = get_post_type_object( $post_type );
1121 1169
 	return $post_type->hierarchical;
@@ -1144,8 +1192,9 @@  discard block
 block discarded – undo
1144 1192
  * @return string|false          Post type on success, false on failure.
1145 1193
  */
1146 1194
 function get_post_type( $post = null ) {
1147
-	if ( $post = get_post( $post ) )
1148
-		return $post->post_type;
1195
+	if ( $post = get_post( $post ) ) {
1196
+			return $post->post_type;
1197
+	}
1149 1198
 
1150 1199
 	return false;
1151 1200
 }
@@ -1165,8 +1214,9 @@  discard block
 block discarded – undo
1165 1214
 function get_post_type_object( $post_type ) {
1166 1215
 	global $wp_post_types;
1167 1216
 
1168
-	if ( empty($wp_post_types[$post_type]) )
1169
-		return null;
1217
+	if ( empty($wp_post_types[$post_type]) ) {
1218
+			return null;
1219
+	}
1170 1220
 
1171 1221
 	return $wp_post_types[$post_type];
1172 1222
 }
@@ -1313,8 +1363,9 @@  discard block
 block discarded – undo
1313 1363
 function register_post_type( $post_type, $args = array() ) {
1314 1364
 	global $wp_post_types, $wp_rewrite, $wp;
1315 1365
 
1316
-	if ( ! is_array( $wp_post_types ) )
1317
-		$wp_post_types = array();
1366
+	if ( ! is_array( $wp_post_types ) ) {
1367
+			$wp_post_types = array();
1368
+	}
1318 1369
 
1319 1370
 	// Args prefixed with an underscore are reserved for internal use.
1320 1371
 	$defaults = array(
@@ -1356,42 +1407,51 @@  discard block
 block discarded – undo
1356 1407
 	}
1357 1408
 
1358 1409
 	// If not set, default to the setting for public.
1359
-	if ( null === $args->publicly_queryable )
1360
-		$args->publicly_queryable = $args->public;
1410
+	if ( null === $args->publicly_queryable ) {
1411
+			$args->publicly_queryable = $args->public;
1412
+	}
1361 1413
 
1362 1414
 	// If not set, default to the setting for public.
1363
-	if ( null === $args->show_ui )
1364
-		$args->show_ui = $args->public;
1415
+	if ( null === $args->show_ui ) {
1416
+			$args->show_ui = $args->public;
1417
+	}
1365 1418
 
1366 1419
 	// If not set, default to the setting for show_ui.
1367
-	if ( null === $args->show_in_menu || ! $args->show_ui )
1368
-		$args->show_in_menu = $args->show_ui;
1420
+	if ( null === $args->show_in_menu || ! $args->show_ui ) {
1421
+			$args->show_in_menu = $args->show_ui;
1422
+	}
1369 1423
 
1370 1424
 	// If not set, default to the whether the full UI is shown.
1371
-	if ( null === $args->show_in_admin_bar )
1372
-		$args->show_in_admin_bar = (bool) $args->show_in_menu;
1425
+	if ( null === $args->show_in_admin_bar ) {
1426
+			$args->show_in_admin_bar = (bool) $args->show_in_menu;
1427
+	}
1373 1428
 
1374 1429
 	// If not set, default to the setting for public.
1375
-	if ( null === $args->show_in_nav_menus )
1376
-		$args->show_in_nav_menus = $args->public;
1430
+	if ( null === $args->show_in_nav_menus ) {
1431
+			$args->show_in_nav_menus = $args->public;
1432
+	}
1377 1433
 
1378 1434
 	// If not set, default to true if not public, false if public.
1379
-	if ( null === $args->exclude_from_search )
1380
-		$args->exclude_from_search = !$args->public;
1435
+	if ( null === $args->exclude_from_search ) {
1436
+			$args->exclude_from_search = !$args->public;
1437
+	}
1381 1438
 
1382 1439
 	// Back compat with quirky handling in version 3.0. #14122.
1383
-	if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) )
1384
-		$args->map_meta_cap = true;
1440
+	if ( empty( $args->capabilities ) && null === $args->map_meta_cap && in_array( $args->capability_type, array( 'post', 'page' ) ) ) {
1441
+			$args->map_meta_cap = true;
1442
+	}
1385 1443
 
1386 1444
 	// If not set, default to false.
1387
-	if ( null === $args->map_meta_cap )
1388
-		$args->map_meta_cap = false;
1445
+	if ( null === $args->map_meta_cap ) {
1446
+			$args->map_meta_cap = false;
1447
+	}
1389 1448
 
1390 1449
 	$args->cap = get_post_type_capabilities( $args );
1391 1450
 	unset( $args->capabilities );
1392 1451
 
1393
-	if ( is_array( $args->capability_type ) )
1394
-		$args->capability_type = $args->capability_type[0];
1452
+	if ( is_array( $args->capability_type ) ) {
1453
+			$args->capability_type = $args->capability_type[0];
1454
+	}
1395 1455
 
1396 1456
 	if ( ! empty( $args->supports ) ) {
1397 1457
 		add_post_type_support( $post_type, $args->supports );
@@ -1402,42 +1462,51 @@  discard block
 block discarded – undo
1402 1462
 	}
1403 1463
 
1404 1464
 	if ( false !== $args->query_var && ! empty( $wp ) ) {
1405
-		if ( true === $args->query_var )
1406
-			$args->query_var = $post_type;
1407
-		else
1408
-			$args->query_var = sanitize_title_with_dashes( $args->query_var );
1465
+		if ( true === $args->query_var ) {
1466
+					$args->query_var = $post_type;
1467
+		} else {
1468
+					$args->query_var = sanitize_title_with_dashes( $args->query_var );
1469
+		}
1409 1470
 		$wp->add_query_var( $args->query_var );
1410 1471
 	}
1411 1472
 
1412 1473
 	if ( false !== $args->rewrite && ( is_admin() || '' != get_option( 'permalink_structure' ) ) ) {
1413
-		if ( ! is_array( $args->rewrite ) )
1414
-			$args->rewrite = array();
1415
-		if ( empty( $args->rewrite['slug'] ) )
1416
-			$args->rewrite['slug'] = $post_type;
1417
-		if ( ! isset( $args->rewrite['with_front'] ) )
1418
-			$args->rewrite['with_front'] = true;
1419
-		if ( ! isset( $args->rewrite['pages'] ) )
1420
-			$args->rewrite['pages'] = true;
1421
-		if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive )
1422
-			$args->rewrite['feeds'] = (bool) $args->has_archive;
1474
+		if ( ! is_array( $args->rewrite ) ) {
1475
+					$args->rewrite = array();
1476
+		}
1477
+		if ( empty( $args->rewrite['slug'] ) ) {
1478
+					$args->rewrite['slug'] = $post_type;
1479
+		}
1480
+		if ( ! isset( $args->rewrite['with_front'] ) ) {
1481
+					$args->rewrite['with_front'] = true;
1482
+		}
1483
+		if ( ! isset( $args->rewrite['pages'] ) ) {
1484
+					$args->rewrite['pages'] = true;
1485
+		}
1486
+		if ( ! isset( $args->rewrite['feeds'] ) || ! $args->has_archive ) {
1487
+					$args->rewrite['feeds'] = (bool) $args->has_archive;
1488
+		}
1423 1489
 		if ( ! isset( $args->rewrite['ep_mask'] ) ) {
1424
-			if ( isset( $args->permalink_epmask ) )
1425
-				$args->rewrite['ep_mask'] = $args->permalink_epmask;
1426
-			else
1427
-				$args->rewrite['ep_mask'] = EP_PERMALINK;
1490
+			if ( isset( $args->permalink_epmask ) ) {
1491
+							$args->rewrite['ep_mask'] = $args->permalink_epmask;
1492
+			} else {
1493
+							$args->rewrite['ep_mask'] = EP_PERMALINK;
1494
+			}
1428 1495
 		}
1429 1496
 
1430
-		if ( $args->hierarchical )
1431
-			add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" );
1432
-		else
1433
-			add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
1497
+		if ( $args->hierarchical ) {
1498
+					add_rewrite_tag( "%$post_type%", '(.+?)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&pagename=" );
1499
+		} else {
1500
+					add_rewrite_tag( "%$post_type%", '([^/]+)', $args->query_var ? "{$args->query_var}=" : "post_type=$post_type&name=" );
1501
+		}
1434 1502
 
1435 1503
 		if ( $args->has_archive ) {
1436 1504
 			$archive_slug = $args->has_archive === true ? $args->rewrite['slug'] : $args->has_archive;
1437
-			if ( $args->rewrite['with_front'] )
1438
-				$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
1439
-			else
1440
-				$archive_slug = $wp_rewrite->root . $archive_slug;
1505
+			if ( $args->rewrite['with_front'] ) {
1506
+							$archive_slug = substr( $wp_rewrite->front, 1 ) . $archive_slug;
1507
+			} else {
1508
+							$archive_slug = $wp_rewrite->root . $archive_slug;
1509
+			}
1441 1510
 
1442 1511
 			add_rewrite_rule( "{$archive_slug}/?$", "index.php?post_type=$post_type", 'top' );
1443 1512
 			if ( $args->rewrite['feeds'] && $wp_rewrite->feeds ) {
@@ -1445,8 +1514,9 @@  discard block
 block discarded – undo
1445 1514
 				add_rewrite_rule( "{$archive_slug}/feed/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
1446 1515
 				add_rewrite_rule( "{$archive_slug}/$feeds/?$", "index.php?post_type=$post_type" . '&feed=$matches[1]', 'top' );
1447 1516
 			}
1448
-			if ( $args->rewrite['pages'] )
1449
-				add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
1517
+			if ( $args->rewrite['pages'] ) {
1518
+							add_rewrite_rule( "{$archive_slug}/{$wp_rewrite->pagination_base}/([0-9]{1,})/?$", "index.php?post_type=$post_type" . '&paged=$matches[1]', 'top' );
1519
+			}
1450 1520
 		}
1451 1521
 
1452 1522
 		$permastruct_args = $args->rewrite;
@@ -1455,8 +1525,9 @@  discard block
 block discarded – undo
1455 1525
 	}
1456 1526
 
1457 1527
 	// Register the post type meta box if a custom callback was specified.
1458
-	if ( $args->register_meta_box_cb )
1459
-		add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 );
1528
+	if ( $args->register_meta_box_cb ) {
1529
+			add_action( 'add_meta_boxes_' . $post_type, $args->register_meta_box_cb, 10, 1 );
1530
+	}
1460 1531
 
1461 1532
 	$args->labels = get_post_type_labels( $args );
1462 1533
 	$args->label = $args->labels->name;
@@ -1538,8 +1609,9 @@  discard block
 block discarded – undo
1538 1609
  * @return object object with all the capabilities as member variables.
1539 1610
  */
1540 1611
 function get_post_type_capabilities( $args ) {
1541
-	if ( ! is_array( $args->capability_type ) )
1542
-		$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
1612
+	if ( ! is_array( $args->capability_type ) ) {
1613
+			$args->capability_type = array( $args->capability_type, $args->capability_type . 's' );
1614
+	}
1543 1615
 
1544 1616
 	// Singular base for meta capabilities, plural base for primitive capabilities.
1545 1617
 	list( $singular_base, $plural_base ) = $args->capability_type;
@@ -1573,12 +1645,14 @@  discard block
 block discarded – undo
1573 1645
 	$capabilities = array_merge( $default_capabilities, $args->capabilities );
1574 1646
 
1575 1647
 	// Post creation capability simply maps to edit_posts by default:
1576
-	if ( ! isset( $capabilities['create_posts'] ) )
1577
-		$capabilities['create_posts'] = $capabilities['edit_posts'];
1648
+	if ( ! isset( $capabilities['create_posts'] ) ) {
1649
+			$capabilities['create_posts'] = $capabilities['edit_posts'];
1650
+	}
1578 1651
 
1579 1652
 	// Remember meta capabilities for future reference.
1580
-	if ( $args->map_meta_cap )
1581
-		_post_type_meta_capabilities( $capabilities );
1653
+	if ( $args->map_meta_cap ) {
1654
+			_post_type_meta_capabilities( $capabilities );
1655
+	}
1582 1656
 
1583 1657
 	return (object) $capabilities;
1584 1658
 }
@@ -1595,11 +1669,13 @@  discard block
 block discarded – undo
1595 1669
  */
1596 1670
 function _post_type_meta_capabilities( $capabilities = null ) {
1597 1671
 	static $meta_caps = array();
1598
-	if ( null === $capabilities )
1599
-		return $meta_caps;
1672
+	if ( null === $capabilities ) {
1673
+			return $meta_caps;
1674
+	}
1600 1675
 	foreach ( $capabilities as $core => $custom ) {
1601
-		if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) )
1602
-			$meta_caps[ $custom ] = $core;
1676
+		if ( in_array( $core, array( 'read_post', 'delete_post', 'edit_post' ) ) ) {
1677
+					$meta_caps[ $custom ] = $core;
1678
+		}
1603 1679
 	}
1604 1680
 }
1605 1681
 
@@ -1695,20 +1771,25 @@  discard block
 block discarded – undo
1695 1771
 function _get_custom_object_labels( $object, $nohier_vs_hier_defaults ) {
1696 1772
 	$object->labels = (array) $object->labels;
1697 1773
 
1698
-	if ( isset( $object->label ) && empty( $object->labels['name'] ) )
1699
-		$object->labels['name'] = $object->label;
1774
+	if ( isset( $object->label ) && empty( $object->labels['name'] ) ) {
1775
+			$object->labels['name'] = $object->label;
1776
+	}
1700 1777
 
1701
-	if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) )
1702
-		$object->labels['singular_name'] = $object->labels['name'];
1778
+	if ( !isset( $object->labels['singular_name'] ) && isset( $object->labels['name'] ) ) {
1779
+			$object->labels['singular_name'] = $object->labels['name'];
1780
+	}
1703 1781
 
1704
-	if ( ! isset( $object->labels['name_admin_bar'] ) )
1705
-		$object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name;
1782
+	if ( ! isset( $object->labels['name_admin_bar'] ) ) {
1783
+			$object->labels['name_admin_bar'] = isset( $object->labels['singular_name'] ) ? $object->labels['singular_name'] : $object->name;
1784
+	}
1706 1785
 
1707
-	if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) )
1708
-		$object->labels['menu_name'] = $object->labels['name'];
1786
+	if ( !isset( $object->labels['menu_name'] ) && isset( $object->labels['name'] ) ) {
1787
+			$object->labels['menu_name'] = $object->labels['name'];
1788
+	}
1709 1789
 
1710
-	if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) )
1711
-		$object->labels['all_items'] = $object->labels['menu_name'];
1790
+	if ( !isset( $object->labels['all_items'] ) && isset( $object->labels['menu_name'] ) ) {
1791
+			$object->labels['all_items'] = $object->labels['menu_name'];
1792
+	}
1712 1793
 
1713 1794
 	$defaults = array();
1714 1795
 	foreach ( $nohier_vs_hier_defaults as $key => $value ) {
@@ -1728,8 +1809,9 @@  discard block
 block discarded – undo
1728 1809
 	foreach ( get_post_types( array( 'show_ui' => true ) ) as $ptype ) {
1729 1810
 		$ptype_obj = get_post_type_object( $ptype );
1730 1811
 		// Sub-menus only.
1731
-		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true )
1732
-			continue;
1812
+		if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) {
1813
+					continue;
1814
+		}
1733 1815
 		add_submenu_page( $ptype_obj->show_in_menu, $ptype_obj->labels->name, $ptype_obj->labels->all_items, $ptype_obj->cap->edit_posts, "edit.php?post_type=$ptype" );
1734 1816
 	}
1735 1817
 }
@@ -1759,10 +1841,11 @@  discard block
 block discarded – undo
1759 1841
 
1760 1842
 	$features = (array) $feature;
1761 1843
 	foreach ($features as $feature) {
1762
-		if ( func_num_args() == 2 )
1763
-			$_wp_post_type_features[$post_type][$feature] = true;
1764
-		else
1765
-			$_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
1844
+		if ( func_num_args() == 2 ) {
1845
+					$_wp_post_type_features[$post_type][$feature] = true;
1846
+		} else {
1847
+					$_wp_post_type_features[$post_type][$feature] = array_slice( func_get_args(), 2 );
1848
+		}
1766 1849
 	}
1767 1850
 }
1768 1851
 
@@ -1795,8 +1878,9 @@  discard block
 block discarded – undo
1795 1878
 function get_all_post_type_supports( $post_type ) {
1796 1879
 	global $_wp_post_type_features;
1797 1880
 
1798
-	if ( isset( $_wp_post_type_features[$post_type] ) )
1799
-		return $_wp_post_type_features[$post_type];
1881
+	if ( isset( $_wp_post_type_features[$post_type] ) ) {
1882
+			return $_wp_post_type_features[$post_type];
1883
+	}
1800 1884
 
1801 1885
 	return array();
1802 1886
 }
@@ -1898,18 +1982,22 @@  discard block
 block discarded – undo
1898 1982
 	);
1899 1983
 
1900 1984
 	$r = wp_parse_args( $args, $defaults );
1901
-	if ( empty( $r['post_status'] ) )
1902
-		$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
1903
-	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']) )
1904
-		$r['posts_per_page'] = $r['numberposts'];
1905
-	if ( ! empty($r['category']) )
1906
-		$r['cat'] = $r['category'];
1985
+	if ( empty( $r['post_status'] ) ) {
1986
+			$r['post_status'] = ( 'attachment' == $r['post_type'] ) ? 'inherit' : 'publish';
1987
+	}
1988
+	if ( ! empty($r['numberposts']) && empty($r['posts_per_page']) ) {
1989
+			$r['posts_per_page'] = $r['numberposts'];
1990
+	}
1991
+	if ( ! empty($r['category']) ) {
1992
+			$r['cat'] = $r['category'];
1993
+	}
1907 1994
 	if ( ! empty($r['include']) ) {
1908 1995
 		$incposts = wp_parse_id_list( $r['include'] );
1909 1996
 		$r['posts_per_page'] = count($incposts);  // only the number of posts included
1910 1997
 		$r['post__in'] = $incposts;
1911
-	} elseif ( ! empty($r['exclude']) )
1912
-		$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
1998
+	} elseif ( ! empty($r['exclude']) ) {
1999
+			$r['post__not_in'] = wp_parse_id_list( $r['exclude'] );
2000
+	}
1913 2001
 
1914 2002
 	$r['ignore_sticky_posts'] = true;
1915 2003
 	$r['no_found_rows'] = true;
@@ -1939,8 +2027,9 @@  discard block
 block discarded – undo
1939 2027
  */
1940 2028
 function add_post_meta( $post_id, $meta_key, $meta_value, $unique = false ) {
1941 2029
 	// Make sure meta is added to the post, not a revision.
1942
-	if ( $the_post = wp_is_post_revision($post_id) )
1943
-		$post_id = $the_post;
2030
+	if ( $the_post = wp_is_post_revision($post_id) ) {
2031
+			$post_id = $the_post;
2032
+	}
1944 2033
 
1945 2034
 	return add_metadata('post', $post_id, $meta_key, $meta_value, $unique);
1946 2035
 }
@@ -1962,8 +2051,9 @@  discard block
 block discarded – undo
1962 2051
  */
1963 2052
 function delete_post_meta( $post_id, $meta_key, $meta_value = '' ) {
1964 2053
 	// Make sure meta is added to the post, not a revision.
1965
-	if ( $the_post = wp_is_post_revision($post_id) )
1966
-		$post_id = $the_post;
2054
+	if ( $the_post = wp_is_post_revision($post_id) ) {
2055
+			$post_id = $the_post;
2056
+	}
1967 2057
 
1968 2058
 	return delete_metadata('post', $post_id, $meta_key, $meta_value);
1969 2059
 }
@@ -2004,8 +2094,9 @@  discard block
 block discarded – undo
2004 2094
  */
2005 2095
 function update_post_meta( $post_id, $meta_key, $meta_value, $prev_value = '' ) {
2006 2096
 	// Make sure meta is added to the post, not a revision.
2007
-	if ( $the_post = wp_is_post_revision($post_id) )
2008
-		$post_id = $the_post;
2097
+	if ( $the_post = wp_is_post_revision($post_id) ) {
2098
+			$post_id = $the_post;
2099
+	}
2009 2100
 
2010 2101
 	return update_metadata('post', $post_id, $meta_key, $meta_value, $prev_value);
2011 2102
 }
@@ -2035,8 +2126,9 @@  discard block
 block discarded – undo
2035 2126
  */
2036 2127
 function get_post_custom( $post_id = 0 ) {
2037 2128
 	$post_id = absint( $post_id );
2038
-	if ( ! $post_id )
2039
-		$post_id = get_the_ID();
2129
+	if ( ! $post_id ) {
2130
+			$post_id = get_the_ID();
2131
+	}
2040 2132
 
2041 2133
 	return get_post_meta( $post_id );
2042 2134
 }
@@ -2054,12 +2146,14 @@  discard block
 block discarded – undo
2054 2146
 function get_post_custom_keys( $post_id = 0 ) {
2055 2147
 	$custom = get_post_custom( $post_id );
2056 2148
 
2057
-	if ( !is_array($custom) )
2058
-		return;
2149
+	if ( !is_array($custom) ) {
2150
+			return;
2151
+	}
2059 2152
 
2060
-	if ( $keys = array_keys($custom) )
2061
-		return $keys;
2062
-}
2153
+	if ( $keys = array_keys($custom) ) {
2154
+			return $keys;
2155
+	}
2156
+	}
2063 2157
 
2064 2158
 /**
2065 2159
  * Retrieve values for a custom post field.
@@ -2074,8 +2168,9 @@  discard block
 block discarded – undo
2074 2168
  * @return array|null Meta field values.
2075 2169
  */
2076 2170
 function get_post_custom_values( $key = '', $post_id = 0 ) {
2077
-	if ( !$key )
2078
-		return null;
2171
+	if ( !$key ) {
2172
+			return null;
2173
+	}
2079 2174
 
2080 2175
 	$custom = get_post_custom($post_id);
2081 2176
 
@@ -2096,16 +2191,19 @@  discard block
 block discarded – undo
2096 2191
 function is_sticky( $post_id = 0 ) {
2097 2192
 	$post_id = absint( $post_id );
2098 2193
 
2099
-	if ( ! $post_id )
2100
-		$post_id = get_the_ID();
2194
+	if ( ! $post_id ) {
2195
+			$post_id = get_the_ID();
2196
+	}
2101 2197
 
2102 2198
 	$stickies = get_option( 'sticky_posts' );
2103 2199
 
2104
-	if ( ! is_array( $stickies ) )
2105
-		return false;
2200
+	if ( ! is_array( $stickies ) ) {
2201
+			return false;
2202
+	}
2106 2203
 
2107
-	if ( in_array( $post_id, $stickies ) )
2108
-		return true;
2204
+	if ( in_array( $post_id, $stickies ) ) {
2205
+			return true;
2206
+	}
2109 2207
 
2110 2208
 	return false;
2111 2209
 }
@@ -2130,21 +2228,27 @@  discard block
 block discarded – undo
2130 2228
 function sanitize_post( $post, $context = 'display' ) {
2131 2229
 	if ( is_object($post) ) {
2132 2230
 		// Check if post already filtered for this context.
2133
-		if ( isset($post->filter) && $context == $post->filter )
2134
-			return $post;
2135
-		if ( !isset($post->ID) )
2136
-			$post->ID = 0;
2137
-		foreach ( array_keys(get_object_vars($post)) as $field )
2138
-			$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
2231
+		if ( isset($post->filter) && $context == $post->filter ) {
2232
+					return $post;
2233
+		}
2234
+		if ( !isset($post->ID) ) {
2235
+					$post->ID = 0;
2236
+		}
2237
+		foreach ( array_keys(get_object_vars($post)) as $field ) {
2238
+					$post->$field = sanitize_post_field($field, $post->$field, $post->ID, $context);
2239
+		}
2139 2240
 		$post->filter = $context;
2140 2241
 	} else {
2141 2242
 		// Check if post already filtered for this context.
2142
-		if ( isset($post['filter']) && $context == $post['filter'] )
2143
-			return $post;
2144
-		if ( !isset($post['ID']) )
2145
-			$post['ID'] = 0;
2146
-		foreach ( array_keys($post) as $field )
2147
-			$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
2243
+		if ( isset($post['filter']) && $context == $post['filter'] ) {
2244
+					return $post;
2245
+		}
2246
+		if ( !isset($post['ID']) ) {
2247
+					$post['ID'] = 0;
2248
+		}
2249
+		foreach ( array_keys($post) as $field ) {
2250
+					$post[$field] = sanitize_post_field($field, $post[$field], $post['ID'], $context);
2251
+		}
2148 2252
 		$post['filter'] = $context;
2149 2253
 	}
2150 2254
 	return $post;
@@ -2168,8 +2272,9 @@  discard block
 block discarded – undo
2168 2272
  */
2169 2273
 function sanitize_post_field($field, $value, $post_id, $context) {
2170 2274
 	$int_fields = array('ID', 'post_parent', 'menu_order');
2171
-	if ( in_array($field, $int_fields) )
2172
-		$value = (int) $value;
2275
+	if ( in_array($field, $int_fields) ) {
2276
+			$value = (int) $value;
2277
+	}
2173 2278
 
2174 2279
 	// Fields which contain arrays of integers.
2175 2280
 	$array_int_fields = array( 'ancestors' );
@@ -2178,8 +2283,9 @@  discard block
 block discarded – undo
2178 2283
 		return $value;
2179 2284
 	}
2180 2285
 
2181
-	if ( 'raw' == $context )
2182
-		return $value;
2286
+	if ( 'raw' == $context ) {
2287
+			return $value;
2288
+	}
2183 2289
 
2184 2290
 	$prefixed = false;
2185 2291
 	if ( false !== strpos($field, 'post_') ) {
@@ -2222,10 +2328,11 @@  discard block
 block discarded – undo
2222 2328
 		}
2223 2329
 
2224 2330
 		if ( in_array($field, $format_to_edit) ) {
2225
-			if ( 'post_content' == $field )
2226
-				$value = format_to_edit($value, user_can_richedit());
2227
-			else
2228
-				$value = format_to_edit($value);
2331
+			if ( 'post_content' == $field ) {
2332
+							$value = format_to_edit($value, user_can_richedit());
2333
+			} else {
2334
+							$value = format_to_edit($value);
2335
+			}
2229 2336
 		} else {
2230 2337
 			$value = esc_attr($value);
2231 2338
 		}
@@ -2295,10 +2402,11 @@  discard block
 block discarded – undo
2295 2402
 		}
2296 2403
 	}
2297 2404
 
2298
-	if ( 'attribute' == $context )
2299
-		$value = esc_attr($value);
2300
-	elseif ( 'js' == $context )
2301
-		$value = esc_js($value);
2405
+	if ( 'attribute' == $context ) {
2406
+			$value = esc_attr($value);
2407
+	} elseif ( 'js' == $context ) {
2408
+			$value = esc_js($value);
2409
+	}
2302 2410
 
2303 2411
 	return $value;
2304 2412
 }
@@ -2315,11 +2423,13 @@  discard block
 block discarded – undo
2315 2423
 function stick_post( $post_id ) {
2316 2424
 	$stickies = get_option('sticky_posts');
2317 2425
 
2318
-	if ( !is_array($stickies) )
2319
-		$stickies = array($post_id);
2426
+	if ( !is_array($stickies) ) {
2427
+			$stickies = array($post_id);
2428
+	}
2320 2429
 
2321
-	if ( ! in_array($post_id, $stickies) )
2322
-		$stickies[] = $post_id;
2430
+	if ( ! in_array($post_id, $stickies) ) {
2431
+			$stickies[] = $post_id;
2432
+	}
2323 2433
 
2324 2434
 	update_option('sticky_posts', $stickies);
2325 2435
 }
@@ -2336,15 +2446,18 @@  discard block
 block discarded – undo
2336 2446
 function unstick_post( $post_id ) {
2337 2447
 	$stickies = get_option('sticky_posts');
2338 2448
 
2339
-	if ( !is_array($stickies) )
2340
-		return;
2449
+	if ( !is_array($stickies) ) {
2450
+			return;
2451
+	}
2341 2452
 
2342
-	if ( ! in_array($post_id, $stickies) )
2343
-		return;
2453
+	if ( ! in_array($post_id, $stickies) ) {
2454
+			return;
2455
+	}
2344 2456
 
2345 2457
 	$offset = array_search($post_id, $stickies);
2346
-	if ( false === $offset )
2347
-		return;
2458
+	if ( false === $offset ) {
2459
+			return;
2460
+	}
2348 2461
 
2349 2462
 	array_splice($stickies, $offset, 1);
2350 2463
 
@@ -2393,8 +2506,9 @@  discard block
 block discarded – undo
2393 2506
 function wp_count_posts( $type = 'post', $perm = '' ) {
2394 2507
 	global $wpdb;
2395 2508
 
2396
-	if ( ! post_type_exists( $type ) )
2397
-		return new stdClass;
2509
+	if ( ! post_type_exists( $type ) ) {
2510
+			return new stdClass;
2511
+	}
2398 2512
 
2399 2513
 	$cache_key = _count_posts_cache_key( $type, $perm );
2400 2514
 
@@ -2569,8 +2683,9 @@  discard block
 block discarded – undo
2569 2683
 function wp_post_mime_type_where( $post_mime_types, $table_alias = '' ) {
2570 2684
 	$where = '';
2571 2685
 	$wildcards = array('', '%', '%/%');
2572
-	if ( is_string($post_mime_types) )
2573
-		$post_mime_types = array_map('trim', explode(',', $post_mime_types));
2686
+	if ( is_string($post_mime_types) ) {
2687
+			$post_mime_types = array_map('trim', explode(',', $post_mime_types));
2688
+	}
2574 2689
 
2575 2690
 	$wheres = array();
2576 2691
 
@@ -2580,29 +2695,34 @@  discard block
 block discarded – undo
2580 2695
 		if ( false !== $slashpos ) {
2581 2696
 			$mime_group = preg_replace('/[^-*.a-zA-Z0-9]/', '', substr($mime_type, 0, $slashpos));
2582 2697
 			$mime_subgroup = preg_replace('/[^-*.+a-zA-Z0-9]/', '', substr($mime_type, $slashpos + 1));
2583
-			if ( empty($mime_subgroup) )
2584
-				$mime_subgroup = '*';
2585
-			else
2586
-				$mime_subgroup = str_replace('/', '', $mime_subgroup);
2698
+			if ( empty($mime_subgroup) ) {
2699
+							$mime_subgroup = '*';
2700
+			} else {
2701
+							$mime_subgroup = str_replace('/', '', $mime_subgroup);
2702
+			}
2587 2703
 			$mime_pattern = "$mime_group/$mime_subgroup";
2588 2704
 		} else {
2589 2705
 			$mime_pattern = preg_replace('/[^-*.a-zA-Z0-9]/', '', $mime_type);
2590
-			if ( false === strpos($mime_pattern, '*') )
2591
-				$mime_pattern .= '/*';
2706
+			if ( false === strpos($mime_pattern, '*') ) {
2707
+							$mime_pattern .= '/*';
2708
+			}
2592 2709
 		}
2593 2710
 
2594 2711
 		$mime_pattern = preg_replace('/\*+/', '%', $mime_pattern);
2595 2712
 
2596
-		if ( in_array( $mime_type, $wildcards ) )
2597
-			return '';
2713
+		if ( in_array( $mime_type, $wildcards ) ) {
2714
+					return '';
2715
+		}
2598 2716
 
2599
-		if ( false !== strpos($mime_pattern, '%') )
2600
-			$wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";
2601
-		else
2602
-			$wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";
2717
+		if ( false !== strpos($mime_pattern, '%') ) {
2718
+					$wheres[] = empty($table_alias) ? "post_mime_type LIKE '$mime_pattern'" : "$table_alias.post_mime_type LIKE '$mime_pattern'";
2719
+		} else {
2720
+					$wheres[] = empty($table_alias) ? "post_mime_type = '$mime_pattern'" : "$table_alias.post_mime_type = '$mime_pattern'";
2721
+		}
2722
+	}
2723
+	if ( !empty($wheres) ) {
2724
+			$where = ' AND (' . join(' OR ', $wheres) . ') ';
2603 2725
 	}
2604
-	if ( !empty($wheres) )
2605
-		$where = ' AND (' . join(' OR ', $wheres) . ') ';
2606 2726
 	return $where;
2607 2727
 }
2608 2728
 
@@ -2630,14 +2750,17 @@  discard block
 block discarded – undo
2630 2750
 function wp_delete_post( $postid = 0, $force_delete = false ) {
2631 2751
 	global $wpdb;
2632 2752
 
2633
-	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) )
2634
-		return $post;
2753
+	if ( !$post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $postid)) ) {
2754
+			return $post;
2755
+	}
2635 2756
 
2636
-	if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS )
2637
-		return wp_trash_post( $postid );
2757
+	if ( !$force_delete && ( $post->post_type == 'post' || $post->post_type == 'page') && get_post_status( $postid ) != 'trash' && EMPTY_TRASH_DAYS ) {
2758
+			return wp_trash_post( $postid );
2759
+	}
2638 2760
 
2639
-	if ( $post->post_type == 'attachment' )
2640
-		return wp_delete_attachment( $postid, $force_delete );
2761
+	if ( $post->post_type == 'attachment' ) {
2762
+			return wp_delete_attachment( $postid, $force_delete );
2763
+	}
2641 2764
 
2642 2765
 	/**
2643 2766
 	 * Fires before a post is deleted, at the start of wp_delete_post().
@@ -2669,19 +2792,22 @@  discard block
 block discarded – undo
2669 2792
 	// Do raw query. wp_get_post_revisions() is filtered.
2670 2793
 	$revision_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'revision'", $postid ) );
2671 2794
 	// Use wp_delete_post (via wp_delete_post_revision) again. Ensures any meta/misplaced data gets cleaned up.
2672
-	foreach ( $revision_ids as $revision_id )
2673
-		wp_delete_post_revision( $revision_id );
2795
+	foreach ( $revision_ids as $revision_id ) {
2796
+			wp_delete_post_revision( $revision_id );
2797
+	}
2674 2798
 
2675 2799
 	// Point all attachments to this post up one level.
2676 2800
 	$wpdb->update( $wpdb->posts, $parent_data, $parent_where + array( 'post_type' => 'attachment' ) );
2677 2801
 
2678 2802
 	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $postid ));
2679
-	foreach ( $comment_ids as $comment_id )
2680
-		wp_delete_comment( $comment_id, true );
2803
+	foreach ( $comment_ids as $comment_id ) {
2804
+			wp_delete_comment( $comment_id, true );
2805
+	}
2681 2806
 
2682 2807
 	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $postid ));
2683
-	foreach ( $post_meta_ids as $mid )
2684
-		delete_metadata_by_mid( 'post', $mid );
2808
+	foreach ( $post_meta_ids as $mid ) {
2809
+			delete_metadata_by_mid( 'post', $mid );
2810
+	}
2685 2811
 
2686 2812
 	/**
2687 2813
 	 * Fires immediately before a post is deleted from the database.
@@ -2708,8 +2834,9 @@  discard block
 block discarded – undo
2708 2834
 	clean_post_cache( $post );
2709 2835
 
2710 2836
 	if ( is_post_type_hierarchical( $post->post_type ) && $children ) {
2711
-		foreach ( $children as $child )
2712
-			clean_post_cache( $child );
2837
+		foreach ( $children as $child ) {
2838
+					clean_post_cache( $child );
2839
+		}
2713 2840
 	}
2714 2841
 
2715 2842
 	wp_clear_scheduled_hook('publish_future_post', array( $postid ) );
@@ -2771,14 +2898,17 @@  discard block
 block discarded – undo
2771 2898
  * @return false|array|WP_Post|null Post data array, otherwise false.
2772 2899
  */
2773 2900
 function wp_trash_post( $post_id = 0 ) {
2774
-	if ( !EMPTY_TRASH_DAYS )
2775
-		return wp_delete_post($post_id, true);
2901
+	if ( !EMPTY_TRASH_DAYS ) {
2902
+			return wp_delete_post($post_id, true);
2903
+	}
2776 2904
 
2777
-	if ( !$post = get_post($post_id, ARRAY_A) )
2778
-		return $post;
2905
+	if ( !$post = get_post($post_id, ARRAY_A) ) {
2906
+			return $post;
2907
+	}
2779 2908
 
2780
-	if ( $post['post_status'] == 'trash' )
2781
-		return false;
2909
+	if ( $post['post_status'] == 'trash' ) {
2910
+			return false;
2911
+	}
2782 2912
 
2783 2913
 	/**
2784 2914
 	 * Fires before a post is sent to the trash.
@@ -2818,11 +2948,13 @@  discard block
 block discarded – undo
2818 2948
  * @return WP_Post|false WP_Post object. False on failure.
2819 2949
  */
2820 2950
 function wp_untrash_post( $post_id = 0 ) {
2821
-	if ( !$post = get_post($post_id, ARRAY_A) )
2822
-		return $post;
2951
+	if ( !$post = get_post($post_id, ARRAY_A) ) {
2952
+			return $post;
2953
+	}
2823 2954
 
2824
-	if ( $post['post_status'] != 'trash' )
2825
-		return false;
2955
+	if ( $post['post_status'] != 'trash' ) {
2956
+			return false;
2957
+	}
2826 2958
 
2827 2959
 	/**
2828 2960
 	 * Fires before a post is restored from the trash.
@@ -2870,8 +3002,9 @@  discard block
 block discarded – undo
2870 3002
 	global $wpdb;
2871 3003
 
2872 3004
 	$post = get_post($post);
2873
-	if ( empty($post) )
2874
-		return;
3005
+	if ( empty($post) ) {
3006
+			return;
3007
+	}
2875 3008
 
2876 3009
 	$post_id = $post->ID;
2877 3010
 
@@ -2885,13 +3018,15 @@  discard block
 block discarded – undo
2885 3018
 	do_action( 'trash_post_comments', $post_id );
2886 3019
 
2887 3020
 	$comments = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_approved FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id) );
2888
-	if ( empty($comments) )
2889
-		return;
3021
+	if ( empty($comments) ) {
3022
+			return;
3023
+	}
2890 3024
 
2891 3025
 	// Cache current status for each comment.
2892 3026
 	$statuses = array();
2893
-	foreach ( $comments as $comment )
2894
-		$statuses[$comment->comment_ID] = $comment->comment_approved;
3027
+	foreach ( $comments as $comment ) {
3028
+			$statuses[$comment->comment_ID] = $comment->comment_approved;
3029
+	}
2895 3030
 	add_post_meta($post_id, '_wp_trash_meta_comments_status', $statuses);
2896 3031
 
2897 3032
 	// Set status for all comments to post-trashed.
@@ -2926,15 +3061,17 @@  discard block
 block discarded – undo
2926 3061
 	global $wpdb;
2927 3062
 
2928 3063
 	$post = get_post($post);
2929
-	if ( empty($post) )
2930
-		return;
3064
+	if ( empty($post) ) {
3065
+			return;
3066
+	}
2931 3067
 
2932 3068
 	$post_id = $post->ID;
2933 3069
 
2934 3070
 	$statuses = get_post_meta($post_id, '_wp_trash_meta_comments_status', true);
2935 3071
 
2936
-	if ( empty($statuses) )
2937
-		return true;
3072
+	if ( empty($statuses) ) {
3073
+			return true;
3074
+	}
2938 3075
 
2939 3076
 	/**
2940 3077
 	 * Fires before comments are restored for a post from the trash.
@@ -2947,8 +3084,9 @@  discard block
 block discarded – undo
2947 3084
 
2948 3085
 	// Restore each comment to its original status.
2949 3086
 	$group_by_status = array();
2950
-	foreach ( $statuses as $comment_id => $comment_status )
2951
-		$group_by_status[$comment_status][] = $comment_id;
3087
+	foreach ( $statuses as $comment_id => $comment_status ) {
3088
+			$group_by_status[$comment_status][] = $comment_id;
3089
+	}
2952 3090
 
2953 3091
 	foreach ( $group_by_status as $status => $comments ) {
2954 3092
 		// Sanity check. This shouldn't happen.
@@ -3643,8 +3781,9 @@  discard block
 block discarded – undo
3643 3781
 	$post = get_post($postarr['ID'], ARRAY_A);
3644 3782
 
3645 3783
 	if ( is_null( $post ) ) {
3646
-		if ( $wp_error )
3647
-			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
3784
+		if ( $wp_error ) {
3785
+					return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
3786
+		}
3648 3787
 		return 0;
3649 3788
 	}
3650 3789
 
@@ -3653,17 +3792,19 @@  discard block
 block discarded – undo
3653 3792
 
3654 3793
 	// Passed post category list overwrites existing category list if not empty.
3655 3794
 	if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
3656
-			 && 0 != count($postarr['post_category']) )
3657
-		$post_cats = $postarr['post_category'];
3658
-	else
3659
-		$post_cats = $post['post_category'];
3795
+			 && 0 != count($postarr['post_category']) ) {
3796
+			$post_cats = $postarr['post_category'];
3797
+	} else {
3798
+			$post_cats = $post['post_category'];
3799
+	}
3660 3800
 
3661 3801
 	// Drafts shouldn't be assigned a date unless explicitly done so by the user.
3662 3802
 	if ( isset( $post['post_status'] ) && in_array($post['post_status'], array('draft', 'pending', 'auto-draft')) && empty($postarr['edit_date']) &&
3663
-			 ('0000-00-00 00:00:00' == $post['post_date_gmt']) )
3664
-		$clear_date = true;
3665
-	else
3666
-		$clear_date = false;
3803
+			 ('0000-00-00 00:00:00' == $post['post_date_gmt']) ) {
3804
+			$clear_date = true;
3805
+	} else {
3806
+			$clear_date = false;
3807
+	}
3667 3808
 
3668 3809
 	// Merge old and new fields with new fields overwriting old ones.
3669 3810
 	$postarr = array_merge($post, $postarr);
@@ -3673,8 +3814,9 @@  discard block
 block discarded – undo
3673 3814
 		$postarr['post_date_gmt'] = '';
3674 3815
 	}
3675 3816
 
3676
-	if ($postarr['post_type'] == 'attachment')
3677
-		return wp_insert_attachment($postarr);
3817
+	if ($postarr['post_type'] == 'attachment') {
3818
+			return wp_insert_attachment($postarr);
3819
+	}
3678 3820
 
3679 3821
 	return wp_insert_post( $postarr, $wp_error );
3680 3822
 }
@@ -3691,11 +3833,13 @@  discard block
 block discarded – undo
3691 3833
 function wp_publish_post( $post ) {
3692 3834
 	global $wpdb;
3693 3835
 
3694
-	if ( ! $post = get_post( $post ) )
3695
-		return;
3836
+	if ( ! $post = get_post( $post ) ) {
3837
+			return;
3838
+	}
3696 3839
 
3697
-	if ( 'publish' == $post->post_status )
3698
-		return;
3840
+	if ( 'publish' == $post->post_status ) {
3841
+			return;
3842
+	}
3699 3843
 
3700 3844
 	$wpdb->update( $wpdb->posts, array( 'post_status' => 'publish' ), array( 'ID' => $post->ID ) );
3701 3845
 
@@ -3731,11 +3875,13 @@  discard block
 block discarded – undo
3731 3875
 function check_and_publish_future_post( $post_id ) {
3732 3876
 	$post = get_post($post_id);
3733 3877
 
3734
-	if ( empty($post) )
3735
-		return;
3878
+	if ( empty($post) ) {
3879
+			return;
3880
+	}
3736 3881
 
3737
-	if ( 'future' != $post->post_status )
3738
-		return;
3882
+	if ( 'future' != $post->post_status ) {
3883
+			return;
3884
+	}
3739 3885
 
3740 3886
 	$time = strtotime( $post->post_date_gmt . ' GMT' );
3741 3887
 
@@ -3766,16 +3912,18 @@  discard block
 block discarded – undo
3766 3912
  * @return string Unique slug for the post, based on $post_name (with a -1, -2, etc. suffix)
3767 3913
  */
3768 3914
 function wp_unique_post_slug( $slug, $post_ID, $post_status, $post_type, $post_parent ) {
3769
-	if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) )
3770
-		return $slug;
3915
+	if ( in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) || ( 'inherit' == $post_status && 'revision' == $post_type ) ) {
3916
+			return $slug;
3917
+	}
3771 3918
 
3772 3919
 	global $wpdb, $wp_rewrite;
3773 3920
 
3774 3921
 	$original_slug = $slug;
3775 3922
 
3776 3923
 	$feeds = $wp_rewrite->feeds;
3777
-	if ( ! is_array( $feeds ) )
3778
-		$feeds = array();
3924
+	if ( ! is_array( $feeds ) ) {
3925
+			$feeds = array();
3926
+	}
3779 3927
 
3780 3928
 	if ( 'attachment' == $post_type ) {
3781 3929
 		// Attachment slugs must be unique across all types.
@@ -3800,8 +3948,9 @@  discard block
 block discarded – undo
3800 3948
 			$slug = $alt_post_name;
3801 3949
 		}
3802 3950
 	} elseif ( is_post_type_hierarchical( $post_type ) ) {
3803
-		if ( 'nav_menu_item' == $post_type )
3804
-			return $slug;
3951
+		if ( 'nav_menu_item' == $post_type ) {
3952
+					return $slug;
3953
+		}
3805 3954
 
3806 3955
 		/*
3807 3956
 		 * Page slugs must be unique within their own trees. Pages are in a separate
@@ -3906,10 +4055,11 @@  discard block
 block discarded – undo
3906 4055
 function _truncate_post_slug( $slug, $length = 200 ) {
3907 4056
 	if ( strlen( $slug ) > $length ) {
3908 4057
 		$decoded_slug = urldecode( $slug );
3909
-		if ( $decoded_slug === $slug )
3910
-			$slug = substr( $slug, 0, $length );
3911
-		else
3912
-			$slug = utf8_uri_encode( $decoded_slug, $length );
4058
+		if ( $decoded_slug === $slug ) {
4059
+					$slug = substr( $slug, 0, $length );
4060
+		} else {
4061
+					$slug = utf8_uri_encode( $decoded_slug, $length );
4062
+		}
3913 4063
 	}
3914 4064
 
3915 4065
 	return rtrim( $slug, '-' );
@@ -3966,16 +4116,19 @@  discard block
 block discarded – undo
3966 4116
 function wp_set_post_terms( $post_id = 0, $tags = '', $taxonomy = 'post_tag', $append = false ) {
3967 4117
 	$post_id = (int) $post_id;
3968 4118
 
3969
-	if ( !$post_id )
3970
-		return false;
4119
+	if ( !$post_id ) {
4120
+			return false;
4121
+	}
3971 4122
 
3972
-	if ( empty($tags) )
3973
-		$tags = array();
4123
+	if ( empty($tags) ) {
4124
+			$tags = array();
4125
+	}
3974 4126
 
3975 4127
 	if ( ! is_array( $tags ) ) {
3976 4128
 		$comma = _x( ',', 'tag delimiter' );
3977
-		if ( ',' !== $comma )
3978
-			$tags = str_replace( $comma, ',', $tags );
4129
+		if ( ',' !== $comma ) {
4130
+					$tags = str_replace( $comma, ',', $tags );
4131
+		}
3979 4132
 		$tags = explode( ',', trim( $tags, " \n\t\r\0\x0B," ) );
3980 4133
 	}
3981 4134
 
@@ -4141,12 +4294,14 @@  discard block
 block discarded – undo
4141 4294
 function get_enclosed( $post_id ) {
4142 4295
 	$custom_fields = get_post_custom( $post_id );
4143 4296
 	$pung = array();
4144
-	if ( !is_array( $custom_fields ) )
4145
-		return $pung;
4297
+	if ( !is_array( $custom_fields ) ) {
4298
+			return $pung;
4299
+	}
4146 4300
 
4147 4301
 	foreach ( $custom_fields as $key => $val ) {
4148
-		if ( 'enclosure' != $key || !is_array( $val ) )
4149
-			continue;
4302
+		if ( 'enclosure' != $key || !is_array( $val ) ) {
4303
+					continue;
4304
+		}
4150 4305
 		foreach( $val as $enc ) {
4151 4306
 			$enclosure = explode( "\n", $enc );
4152 4307
 			$pung[] = trim( $enclosure[ 0 ] );
@@ -4340,15 +4495,17 @@  discard block
 block discarded – undo
4340 4495
 			while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
4341 4496
 				$count++;
4342 4497
 				$parent = $pages[ $p->post_parent ];
4343
-				if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] )
4344
-					break;
4498
+				if ( ! isset( $revparts[ $count ] ) || $parent->post_name != $revparts[ $count ] ) {
4499
+									break;
4500
+				}
4345 4501
 				$p = $parent;
4346 4502
 			}
4347 4503
 
4348 4504
 			if ( $p->post_parent == 0 && $count+1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
4349 4505
 				$foundid = $page->ID;
4350
-				if ( $page->post_type == $post_type )
4351
-					break;
4506
+				if ( $page->post_type == $post_type ) {
4507
+									break;
4508
+				}
4352 4509
 			}
4353 4510
 		}
4354 4511
 	}
@@ -4503,8 +4660,9 @@  discard block
 block discarded – undo
4503 4660
 function get_page_uri( $page ) {
4504 4661
 	$page = get_post( $page );
4505 4662
 
4506
-	if ( ! $page )
4507
-		return false;
4663
+	if ( ! $page ) {
4664
+			return false;
4665
+	}
4508 4666
 
4509 4667
 	$uri = $page->post_name;
4510 4668
 
@@ -4821,14 +4979,17 @@  discard block
 block discarded – undo
4821 4979
  * @return bool True on success, false on failure.
4822 4980
  */
4823 4981
 function is_local_attachment($url) {
4824
-	if (strpos($url, home_url()) === false)
4825
-		return false;
4826
-	if (strpos($url, home_url('/?attachment_id=')) !== false)
4827
-		return true;
4982
+	if (strpos($url, home_url()) === false) {
4983
+			return false;
4984
+	}
4985
+	if (strpos($url, home_url('/?attachment_id=')) !== false) {
4986
+			return true;
4987
+	}
4828 4988
 	if ( $id = url_to_postid($url) ) {
4829 4989
 		$post = get_post($id);
4830
-		if ( 'attachment' == $post->post_type )
4831
-			return true;
4990
+		if ( 'attachment' == $post->post_type ) {
4991
+					return true;
4992
+		}
4832 4993
 	}
4833 4994
 	return false;
4834 4995
 }
@@ -4895,14 +5056,17 @@  discard block
 block discarded – undo
4895 5056
 function wp_delete_attachment( $post_id, $force_delete = false ) {
4896 5057
 	global $wpdb;
4897 5058
 
4898
-	if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) )
4899
-		return $post;
5059
+	if ( !$post = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID = %d", $post_id) ) ) {
5060
+			return $post;
5061
+	}
4900 5062
 
4901
-	if ( 'attachment' != $post->post_type )
4902
-		return false;
5063
+	if ( 'attachment' != $post->post_type ) {
5064
+			return false;
5065
+	}
4903 5066
 
4904
-	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status )
4905
-		return wp_trash_post( $post_id );
5067
+	if ( !$force_delete && EMPTY_TRASH_DAYS && MEDIA_TRASH && 'trash' != $post->post_status ) {
5068
+			return wp_trash_post( $post_id );
5069
+	}
4906 5070
 
4907 5071
 	delete_post_meta($post_id, '_wp_trash_meta_status');
4908 5072
 	delete_post_meta($post_id, '_wp_trash_meta_time');
@@ -4911,8 +5075,9 @@  discard block
 block discarded – undo
4911 5075
 	$backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true );
4912 5076
 	$file = get_attached_file( $post_id );
4913 5077
 
4914
-	if ( is_multisite() )
4915
-		delete_transient( 'dirsize_cache' );
5078
+	if ( is_multisite() ) {
5079
+			delete_transient( 'dirsize_cache' );
5080
+	}
4916 5081
 
4917 5082
 	/**
4918 5083
 	 * Fires before an attachment is deleted, at the start of wp_delete_attachment().
@@ -4930,12 +5095,14 @@  discard block
 block discarded – undo
4930 5095
 	delete_metadata( 'post', null, '_thumbnail_id', $post_id, true );
4931 5096
 
4932 5097
 	$comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d", $post_id ));
4933
-	foreach ( $comment_ids as $comment_id )
4934
-		wp_delete_comment( $comment_id, true );
5098
+	foreach ( $comment_ids as $comment_id ) {
5099
+			wp_delete_comment( $comment_id, true );
5100
+	}
4935 5101
 
4936 5102
 	$post_meta_ids = $wpdb->get_col( $wpdb->prepare( "SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d ", $post_id ));
4937
-	foreach ( $post_meta_ids as $mid )
4938
-		delete_metadata_by_mid( 'post', $mid );
5103
+	foreach ( $post_meta_ids as $mid ) {
5104
+			delete_metadata_by_mid( 'post', $mid );
5105
+	}
4939 5106
 
4940 5107
 	/** This action is documented in wp-includes/post.php */
4941 5108
 	do_action( 'delete_post', $post_id );
@@ -4995,13 +5162,15 @@  discard block
 block discarded – undo
4995 5162
  */
4996 5163
 function wp_get_attachment_metadata( $post_id = 0, $unfiltered = false ) {
4997 5164
 	$post_id = (int) $post_id;
4998
-	if ( !$post = get_post( $post_id ) )
4999
-		return false;
5165
+	if ( !$post = get_post( $post_id ) ) {
5166
+			return false;
5167
+	}
5000 5168
 
5001 5169
 	$data = get_post_meta( $post->ID, '_wp_attachment_metadata', true );
5002 5170
 
5003
-	if ( $unfiltered )
5004
-		return $data;
5171
+	if ( $unfiltered ) {
5172
+			return $data;
5173
+	}
5005 5174
 
5006 5175
 	/**
5007 5176
 	 * Filter the attachment meta data.
@@ -5026,8 +5195,9 @@  discard block
 block discarded – undo
5026 5195
  */
5027 5196
 function wp_update_attachment_metadata( $post_id, $data ) {
5028 5197
 	$post_id = (int) $post_id;
5029
-	if ( !$post = get_post( $post_id ) )
5030
-		return false;
5198
+	if ( !$post = get_post( $post_id ) ) {
5199
+			return false;
5200
+	}
5031 5201
 
5032 5202
 	/**
5033 5203
 	 * Filter the updated attachment meta data.
@@ -5037,11 +5207,12 @@  discard block
 block discarded – undo
5037 5207
 	 * @param array $data    Array of updated attachment meta data.
5038 5208
 	 * @param int   $post_id Attachment ID.
5039 5209
 	 */
5040
-	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) )
5041
-		return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
5042
-	else
5043
-		return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
5044
-}
5210
+	if ( $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ) ) {
5211
+			return update_post_meta( $post->ID, '_wp_attachment_metadata', $data );
5212
+	} else {
5213
+			return delete_post_meta( $post->ID, '_wp_attachment_metadata' );
5214
+	}
5215
+	}
5045 5216
 
5046 5217
 /**
5047 5218
  * Retrieve the URL for an attachment.
@@ -5055,11 +5226,13 @@  discard block
 block discarded – undo
5055 5226
  */
5056 5227
 function wp_get_attachment_url( $post_id = 0 ) {
5057 5228
 	$post_id = (int) $post_id;
5058
-	if ( !$post = get_post( $post_id ) )
5059
-		return false;
5229
+	if ( !$post = get_post( $post_id ) ) {
5230
+			return false;
5231
+	}
5060 5232
 
5061
-	if ( 'attachment' != $post->post_type )
5062
-		return false;
5233
+	if ( 'attachment' != $post->post_type ) {
5234
+			return false;
5235
+	}
5063 5236
 
5064 5237
 	$url = '';
5065 5238
 	// Get attached file.
@@ -5102,8 +5275,9 @@  discard block
 block discarded – undo
5102 5275
 	 */
5103 5276
 	$url = apply_filters( 'wp_get_attachment_url', $url, $post->ID );
5104 5277
 
5105
-	if ( empty( $url ) )
5106
-		return false;
5278
+	if ( empty( $url ) ) {
5279
+			return false;
5280
+	}
5107 5281
 
5108 5282
 	return $url;
5109 5283
 }
@@ -5118,10 +5292,12 @@  discard block
 block discarded – undo
5118 5292
  */
5119 5293
 function wp_get_attachment_thumb_file( $post_id = 0 ) {
5120 5294
 	$post_id = (int) $post_id;
5121
-	if ( !$post = get_post( $post_id ) )
5122
-		return false;
5123
-	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) )
5124
-		return false;
5295
+	if ( !$post = get_post( $post_id ) ) {
5296
+			return false;
5297
+	}
5298
+	if ( !is_array( $imagedata = wp_get_attachment_metadata( $post->ID ) ) ) {
5299
+			return false;
5300
+	}
5125 5301
 
5126 5302
 	$file = get_attached_file( $post->ID );
5127 5303
 
@@ -5149,17 +5325,21 @@  discard block
 block discarded – undo
5149 5325
  */
5150 5326
 function wp_get_attachment_thumb_url( $post_id = 0 ) {
5151 5327
 	$post_id = (int) $post_id;
5152
-	if ( !$post = get_post( $post_id ) )
5153
-		return false;
5154
-	if ( !$url = wp_get_attachment_url( $post->ID ) )
5155
-		return false;
5328
+	if ( !$post = get_post( $post_id ) ) {
5329
+			return false;
5330
+	}
5331
+	if ( !$url = wp_get_attachment_url( $post->ID ) ) {
5332
+			return false;
5333
+	}
5156 5334
 
5157 5335
 	$sized = image_downsize( $post_id, 'thumbnail' );
5158
-	if ( $sized )
5159
-		return $sized[0];
5336
+	if ( $sized ) {
5337
+			return $sized[0];
5338
+	}
5160 5339
 
5161
-	if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) )
5162
-		return false;
5340
+	if ( !$thumb = wp_get_attachment_thumb_file( $post->ID ) ) {
5341
+			return false;
5342
+	}
5163 5343
 
5164 5344
 	$url = str_replace(basename($url), basename($thumb), $url);
5165 5345
 
@@ -5246,8 +5426,9 @@  discard block
 block discarded – undo
5246 5426
  * @return string|false Icon, false otherwise.
5247 5427
  */
5248 5428
 function wp_mime_type_icon( $mime = 0 ) {
5249
-	if ( !is_numeric($mime) )
5250
-		$icon = wp_cache_get("mime_type_icon_$mime");
5429
+	if ( !is_numeric($mime) ) {
5430
+			$icon = wp_cache_get("mime_type_icon_$mime");
5431
+	}
5251 5432
 
5252 5433
 	$post_id = 0;
5253 5434
 	if ( empty($icon) ) {
@@ -5259,8 +5440,9 @@  discard block
 block discarded – undo
5259 5440
 				$ext = preg_replace('/^.+?\.([^.]+)$/', '$1', $post->guid);
5260 5441
 				if ( !empty($ext) ) {
5261 5442
 					$post_mimes[] = $ext;
5262
-					if ( $ext_type = wp_ext2type( $ext ) )
5263
-						$post_mimes[] = $ext_type;
5443
+					if ( $ext_type = wp_ext2type( $ext ) ) {
5444
+											$post_mimes[] = $ext_type;
5445
+					}
5264 5446
 				}
5265 5447
 				$mime = $post->post_mime_type;
5266 5448
 			} else {
@@ -5307,11 +5489,13 @@  discard block
 block discarded – undo
5307 5489
 				if ( $dh = opendir($dir) ) {
5308 5490
 					while ( false !== $file = readdir($dh) ) {
5309 5491
 						$file = basename($file);
5310
-						if ( substr($file, 0, 1) == '.' )
5311
-							continue;
5492
+						if ( substr($file, 0, 1) == '.' ) {
5493
+													continue;
5494
+						}
5312 5495
 						if ( !in_array(strtolower(substr($file, -4)), array('.png', '.gif', '.jpg') ) ) {
5313
-							if ( is_dir("$dir/$file") )
5314
-								$dirs["$dir/$file"] = "$uri/$file";
5496
+							if ( is_dir("$dir/$file") ) {
5497
+															$dirs["$dir/$file"] = "$uri/$file";
5498
+							}
5315 5499
 							continue;
5316 5500
 						}
5317 5501
 						$icon_files["$dir/$file"] = "$uri/$file";
@@ -5324,8 +5508,9 @@  discard block
 block discarded – undo
5324 5508
 
5325 5509
 		$types = array();
5326 5510
 		// Icon basename - extension = MIME wildcard.
5327
-		foreach ( $icon_files as $file => $uri )
5328
-			$types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file];
5511
+		foreach ( $icon_files as $file => $uri ) {
5512
+					$types[ preg_replace('/^([^.]*).*$/', '$1', basename($file)) ] =& $icon_files[$file];
5513
+		}
5329 5514
 
5330 5515
 		if ( ! empty($mime) ) {
5331 5516
 			$post_mimes[] = substr($mime, 0, strpos($mime, '/'));
@@ -5339,8 +5524,9 @@  discard block
 block discarded – undo
5339 5524
 		foreach ( $matches as $match => $wilds ) {
5340 5525
 			if ( isset($types[$wilds[0]])) {
5341 5526
 				$icon = $types[$wilds[0]];
5342
-				if ( !is_numeric($mime) )
5343
-					wp_cache_add("mime_type_icon_$mime", $icon);
5527
+				if ( !is_numeric($mime) ) {
5528
+									wp_cache_add("mime_type_icon_$mime", $icon);
5529
+				}
5344 5530
 				break;
5345 5531
 			}
5346 5532
 		}
@@ -5380,23 +5566,27 @@  discard block
 block discarded – undo
5380 5566
  */
5381 5567
 function wp_check_for_changed_slugs( $post_id, $post, $post_before ) {
5382 5568
 	// Don't bother if it hasnt changed.
5383
-	if ( $post->post_name == $post_before->post_name )
5384
-		return;
5569
+	if ( $post->post_name == $post_before->post_name ) {
5570
+			return;
5571
+	}
5385 5572
 
5386 5573
 	// We're only concerned with published, non-hierarchical objects.
5387
-	if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) )
5388
-		return;
5574
+	if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) ) {
5575
+			return;
5576
+	}
5389 5577
 
5390 5578
 	$old_slugs = (array) get_post_meta($post_id, '_wp_old_slug');
5391 5579
 
5392 5580
 	// If we haven't added this old slug before, add it now.
5393
-	if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) )
5394
-		add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);
5581
+	if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) ) {
5582
+			add_post_meta($post_id, '_wp_old_slug', $post_before->post_name);
5583
+	}
5395 5584
 
5396 5585
 	// If the new slug was used previously, delete it from the list.
5397
-	if ( in_array($post->post_name, $old_slugs) )
5398
-		delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
5399
-}
5586
+	if ( in_array($post->post_name, $old_slugs) ) {
5587
+			delete_post_meta($post_id, '_wp_old_slug', $post->post_name);
5588
+	}
5589
+	}
5400 5590
 
5401 5591
 /**
5402 5592
  * Retrieve the private post SQL based on capability.
@@ -5546,8 +5736,9 @@  discard block
 block discarded – undo
5546 5736
 	$lastpostmodified = _get_last_post_time( $timezone, 'modified' );
5547 5737
 
5548 5738
 	$lastpostdate = get_lastpostdate($timezone);
5549
-	if ( $lastpostdate > $lastpostmodified )
5550
-		$lastpostmodified = $lastpostdate;
5739
+	if ( $lastpostdate > $lastpostmodified ) {
5740
+			$lastpostmodified = $lastpostdate;
5741
+	}
5551 5742
 
5552 5743
 	/**
5553 5744
 	 * Filter the date the last post was modified.
@@ -5577,8 +5768,9 @@  discard block
 block discarded – undo
5577 5768
 function _get_last_post_time( $timezone, $field ) {
5578 5769
 	global $wpdb;
5579 5770
 
5580
-	if ( !in_array( $field, array( 'date', 'modified' ) ) )
5581
-		return false;
5771
+	if ( !in_array( $field, array( 'date', 'modified' ) ) ) {
5772
+			return false;
5773
+	}
5582 5774
 
5583 5775
 	$timezone = strtolower( $timezone );
5584 5776
 
@@ -5605,8 +5797,9 @@  discard block
 block discarded – undo
5605 5797
 				break;
5606 5798
 		}
5607 5799
 
5608
-		if ( $date )
5609
-			wp_cache_set( $key, $date, 'timeinfo' );
5800
+		if ( $date ) {
5801
+					wp_cache_set( $key, $date, 'timeinfo' );
5802
+		}
5610 5803
 	}
5611 5804
 
5612 5805
 	return $date;
@@ -5620,12 +5813,14 @@  discard block
 block discarded – undo
5620 5813
  * @param array $posts Array of post objects, passed by reference.
5621 5814
  */
5622 5815
 function update_post_cache( &$posts ) {
5623
-	if ( ! $posts )
5624
-		return;
5816
+	if ( ! $posts ) {
5817
+			return;
5818
+	}
5625 5819
 
5626
-	foreach ( $posts as $post )
5627
-		wp_cache_add( $post->ID, $post, 'posts' );
5628
-}
5820
+	foreach ( $posts as $post ) {
5821
+			wp_cache_add( $post->ID, $post, 'posts' );
5822
+	}
5823
+	}
5629 5824
 
5630 5825
 /**
5631 5826
  * Will clean the post in the cache.
@@ -5646,12 +5841,14 @@  discard block
 block discarded – undo
5646 5841
 function clean_post_cache( $post ) {
5647 5842
 	global $_wp_suspend_cache_invalidation, $wpdb;
5648 5843
 
5649
-	if ( ! empty( $_wp_suspend_cache_invalidation ) )
5650
-		return;
5844
+	if ( ! empty( $_wp_suspend_cache_invalidation ) ) {
5845
+			return;
5846
+	}
5651 5847
 
5652 5848
 	$post = get_post( $post );
5653
-	if ( empty( $post ) )
5654
-		return;
5849
+	if ( empty( $post ) ) {
5850
+			return;
5851
+	}
5655 5852
 
5656 5853
 	wp_cache_delete( $post->ID, 'posts' );
5657 5854
 	wp_cache_delete( $post->ID, 'post_meta' );
@@ -5698,17 +5895,20 @@  discard block
 block discarded – undo
5698 5895
  */
5699 5896
 function update_post_caches( &$posts, $post_type = 'post', $update_term_cache = true, $update_meta_cache = true ) {
5700 5897
 	// No point in doing all this work if we didn't match any posts.
5701
-	if ( !$posts )
5702
-		return;
5898
+	if ( !$posts ) {
5899
+			return;
5900
+	}
5703 5901
 
5704 5902
 	update_post_cache($posts);
5705 5903
 
5706 5904
 	$post_ids = array();
5707
-	foreach ( $posts as $post )
5708
-		$post_ids[] = $post->ID;
5905
+	foreach ( $posts as $post ) {
5906
+			$post_ids[] = $post->ID;
5907
+	}
5709 5908
 
5710
-	if ( ! $post_type )
5711
-		$post_type = 'any';
5909
+	if ( ! $post_type ) {
5910
+			$post_type = 'any';
5911
+	}
5712 5912
 
5713 5913
 	if ( $update_term_cache ) {
5714 5914
 		if ( is_array($post_type) ) {
@@ -5724,13 +5924,15 @@  discard block
 block discarded – undo
5724 5924
 			$ptypes = array($post_type);
5725 5925
 		}
5726 5926
 
5727
-		if ( ! empty($ptypes) )
5728
-			update_object_term_cache($post_ids, $ptypes);
5927
+		if ( ! empty($ptypes) ) {
5928
+					update_object_term_cache($post_ids, $ptypes);
5929
+		}
5729 5930
 	}
5730 5931
 
5731
-	if ( $update_meta_cache )
5732
-		update_postmeta_cache($post_ids);
5733
-}
5932
+	if ( $update_meta_cache ) {
5933
+			update_postmeta_cache($post_ids);
5934
+	}
5935
+	}
5734 5936
 
5735 5937
 /**
5736 5938
  * Updates metadata cache for list of post IDs.
@@ -5767,16 +5969,18 @@  discard block
 block discarded – undo
5767 5969
 function clean_attachment_cache( $id, $clean_terms = false ) {
5768 5970
 	global $_wp_suspend_cache_invalidation;
5769 5971
 
5770
-	if ( !empty($_wp_suspend_cache_invalidation) )
5771
-		return;
5972
+	if ( !empty($_wp_suspend_cache_invalidation) ) {
5973
+			return;
5974
+	}
5772 5975
 
5773 5976
 	$id = (int) $id;
5774 5977
 
5775 5978
 	wp_cache_delete($id, 'posts');
5776 5979
 	wp_cache_delete($id, 'post_meta');
5777 5980
 
5778
-	if ( $clean_terms )
5779
-		clean_object_term_cache($id, 'attachment');
5981
+	if ( $clean_terms ) {
5982
+			clean_object_term_cache($id, 'attachment');
5983
+	}
5780 5984
 
5781 5985
 	/**
5782 5986
 	 * Fires after the given attachment's cache is cleaned.
@@ -5810,8 +6014,9 @@  discard block
 block discarded – undo
5810 6014
 
5811 6015
 	if ( $old_status != 'publish' && $new_status == 'publish' ) {
5812 6016
 		// Reset GUID if transitioning to publish and it is empty.
5813
-		if ( '' == get_the_guid($post->ID) )
5814
-			$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
6017
+		if ( '' == get_the_guid($post->ID) ) {
6018
+					$wpdb->update( $wpdb->posts, array( 'guid' => get_permalink( $post->ID ) ), array( 'ID' => $post->ID ) );
6019
+		}
5815 6020
 
5816 6021
 		/**
5817 6022
 		 * Fires when a post's status is transitioned from private to published.
@@ -5882,11 +6087,13 @@  discard block
 block discarded – undo
5882 6087
 		do_action( 'xmlrpc_publish_post', $post_id );
5883 6088
 	}
5884 6089
 
5885
-	if ( defined('WP_IMPORTING') )
5886
-		return;
6090
+	if ( defined('WP_IMPORTING') ) {
6091
+			return;
6092
+	}
5887 6093
 
5888
-	if ( get_option('default_pingback_flag') )
5889
-		add_post_meta( $post_id, '_pingme', '1' );
6094
+	if ( get_option('default_pingback_flag') ) {
6095
+			add_post_meta( $post_id, '_pingme', '1' );
6096
+	}
5890 6097
 	add_post_meta( $post_id, '_encloseme', '1' );
5891 6098
 
5892 6099
 	wp_schedule_single_event(time(), 'do_pings');
@@ -5903,8 +6110,9 @@  discard block
 block discarded – undo
5903 6110
  */
5904 6111
 function wp_get_post_parent_id( $post_ID ) {
5905 6112
 	$post = get_post( $post_ID );
5906
-	if ( !$post || is_wp_error( $post ) )
5907
-		return false;
6113
+	if ( !$post || is_wp_error( $post ) ) {
6114
+			return false;
6115
+	}
5908 6116
 	return (int) $post->post_parent;
5909 6117
 }
5910 6118
 
@@ -5924,28 +6132,35 @@  discard block
 block discarded – undo
5924 6132
  */
5925 6133
 function wp_check_post_hierarchy_for_loops( $post_parent, $post_ID ) {
5926 6134
 	// Nothing fancy here - bail.
5927
-	if ( !$post_parent )
5928
-		return 0;
6135
+	if ( !$post_parent ) {
6136
+			return 0;
6137
+	}
5929 6138
 
5930 6139
 	// New post can't cause a loop.
5931
-	if ( empty( $post_ID ) )
5932
-		return $post_parent;
6140
+	if ( empty( $post_ID ) ) {
6141
+			return $post_parent;
6142
+	}
5933 6143
 
5934 6144
 	// Can't be its own parent.
5935
-	if ( $post_parent == $post_ID )
5936
-		return 0;
6145
+	if ( $post_parent == $post_ID ) {
6146
+			return 0;
6147
+	}
5937 6148
 
5938 6149
 	// Now look for larger loops.
5939
-	if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) )
5940
-		return $post_parent; // No loop
6150
+	if ( !$loop = wp_find_hierarchy_loop( 'wp_get_post_parent_id', $post_ID, $post_parent ) ) {
6151
+			return $post_parent;
6152
+	}
6153
+	// No loop
5941 6154
 
5942 6155
 	// Setting $post_parent to the given value causes a loop.
5943
-	if ( isset( $loop[$post_ID] ) )
5944
-		return 0;
6156
+	if ( isset( $loop[$post_ID] ) ) {
6157
+			return 0;
6158
+	}
5945 6159
 
5946 6160
 	// There's a loop, but it doesn't contain $post_ID. Break the loop.
5947
-	foreach ( array_keys( $loop ) as $loop_member )
5948
-		wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0 ) );
6161
+	foreach ( array_keys( $loop ) as $loop_member ) {
6162
+			wp_update_post( array( 'ID' => $loop_member, 'post_parent' => 0 ) );
6163
+	}
5949 6164
 
5950 6165
 	return $post_parent;
5951 6166
 }
@@ -5963,10 +6178,11 @@  discard block
 block discarded – undo
5963 6178
 	$post = get_post( $post );
5964 6179
 	$thumbnail_id = absint( $thumbnail_id );
5965 6180
 	if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {
5966
-		if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) )
5967
-			return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
5968
-		else
5969
-			return delete_post_meta( $post->ID, '_thumbnail_id' );
6181
+		if ( wp_get_attachment_image( $thumbnail_id, 'thumbnail' ) ) {
6182
+					return update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );
6183
+		} else {
6184
+					return delete_post_meta( $post->ID, '_thumbnail_id' );
6185
+		}
5970 6186
 	}
5971 6187
 	return false;
5972 6188
 }
@@ -5981,8 +6197,9 @@  discard block
 block discarded – undo
5981 6197
  */
5982 6198
 function delete_post_thumbnail( $post ) {
5983 6199
 	$post = get_post( $post );
5984
-	if ( $post )
5985
-		return delete_post_meta( $post->ID, '_thumbnail_id' );
6200
+	if ( $post ) {
6201
+			return delete_post_meta( $post->ID, '_thumbnail_id' );
6202
+	}
5986 6203
 	return false;
5987 6204
 }
5988 6205
 
Please login to merge, or discard this patch.
src/wp-includes/query.php 4 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
  *
278 278
  * @global WP_Query $wp_query
279 279
  *
280
- * @param string|array     $taxonomy Optional. Taxonomy slug or slugs.
281
- * @param int|string|array $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
280
+ * @param string     $taxonomy Optional. Taxonomy slug or slugs.
281
+ * @param string $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
282 282
  * @return bool
283 283
  */
284 284
 function is_tax( $taxonomy = '', $term = '' ) {
@@ -2115,7 +2115,7 @@  discard block
 block discarded – undo
2115 2115
 	 *
2116 2116
 	 * @since 3.7.0
2117 2117
 	 *
2118
-	 * @param array $terms Terms to check.
2118
+	 * @param string[] $terms Terms to check.
2119 2119
 	 * @return array Terms that are not stopwords.
2120 2120
 	 */
2121 2121
 	protected function parse_search_terms( $terms ) {
@@ -4013,7 +4013,7 @@  discard block
 block discarded – undo
4013 4013
 	 * @access public
4014 4014
 	 *
4015 4015
 	 * @param string $name Property to check if set.
4016
-	 * @return bool Whether the property is set.
4016
+	 * @return boolean|null Whether the property is set.
4017 4017
 	 */
4018 4018
 	public function __isset( $name ) {
4019 4019
 		if ( in_array( $name, $this->compat_fields ) ) {
@@ -4598,7 +4598,7 @@  discard block
 block discarded – undo
4598 4598
 	 * @global int             $numpages
4599 4599
 	 *
4600 4600
 	 * @param WP_Post $post Post data.
4601
-	 * @return true True when finished.
4601
+	 * @return boolean True when finished.
4602 4602
 	 */
4603 4603
 	public function setup_postdata( $post ) {
4604 4604
 		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
Please login to merge, or discard this patch.
Indentation   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,15 +1,15 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Query API
4
- *
5
- * The query API attempts to get which part of WordPress the user is on. It
6
- * also provides functionality for getting URL query information.
7
- *
8
- * @link https://codex.wordpress.org/The_Loop More information on The Loop.
9
- *
10
- * @package WordPress
11
- * @subpackage Query
12
- */
3
+		 * WordPress Query API
4
+		 *
5
+		 * The query API attempts to get which part of WordPress the user is on. It
6
+		 * also provides functionality for getting URL query information.
7
+		 *
8
+		 * @link https://codex.wordpress.org/The_Loop More information on The Loop.
9
+		 *
10
+		 * @package WordPress
11
+		 * @subpackage Query
12
+		 */
13 13
 
14 14
 /**
15 15
  * Retrieve variable in the WP_Query class.
@@ -4039,14 +4039,14 @@  discard block
 block discarded – undo
4039 4039
 	}
4040 4040
 
4041 4041
 	/**
4042
- 	 * Is the query for an existing archive page?
4043
- 	 *
4044
- 	 * Month, Year, Category, Author, Post Type archive...
4045
-	 *
4046
- 	 * @since 3.1.0
4047
- 	 *
4048
- 	 * @return bool
4049
- 	 */
4042
+	 * Is the query for an existing archive page?
4043
+	 *
4044
+	 * Month, Year, Category, Author, Post Type archive...
4045
+	 *
4046
+	 * @since 3.1.0
4047
+	 *
4048
+	 * @return bool
4049
+	 */
4050 4050
 	public function is_archive() {
4051 4051
 		return (bool) $this->is_archive;
4052 4052
 	}
Please login to merge, or discard this patch.
Spacing   +845 added lines, -845 removed lines patch added patch discarded remove patch
@@ -22,9 +22,9 @@  discard block
 block discarded – undo
22 22
  * @param mixed  $default   Value to return if the query variable is not set. Default ''.
23 23
  * @return mixed
24 24
  */
25
-function get_query_var( $var, $default = '' ) {
25
+function get_query_var($var, $default = '') {
26 26
 	global $wp_query;
27
-	return $wp_query->get( $var, $default );
27
+	return $wp_query->get($var, $default);
28 28
 }
29 29
 
30 30
 /**
@@ -67,9 +67,9 @@  discard block
 block discarded – undo
67 67
  * @param string $var   Query variable key.
68 68
  * @param mixed  $value
69 69
  */
70
-function set_query_var( $var, $value ) {
70
+function set_query_var($var, $value) {
71 71
 	global $wp_query;
72
-	$wp_query->set( $var, $value );
72
+	$wp_query->set($var, $value);
73 73
 }
74 74
 
75 75
 /**
@@ -118,7 +118,7 @@  discard block
 block discarded – undo
118 118
 function wp_reset_postdata() {
119 119
 	global $wp_query;
120 120
 
121
-	if ( isset( $wp_query ) ) {
121
+	if (isset($wp_query)) {
122 122
 		$wp_query->reset_postdata();
123 123
 	}
124 124
 }
@@ -141,8 +141,8 @@  discard block
 block discarded – undo
141 141
 function is_archive() {
142 142
 	global $wp_query;
143 143
 
144
-	if ( ! isset( $wp_query ) ) {
145
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
144
+	if ( ! isset($wp_query)) {
145
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
146 146
 		return false;
147 147
 	}
148 148
 
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
  * @param string|array $post_types Optional. Post type or array of posts types to check against.
160 160
  * @return bool
161 161
  */
162
-function is_post_type_archive( $post_types = '' ) {
162
+function is_post_type_archive($post_types = '') {
163 163
 	global $wp_query;
164 164
 
165
-	if ( ! isset( $wp_query ) ) {
166
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
165
+	if ( ! isset($wp_query)) {
166
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
167 167
 		return false;
168 168
 	}
169 169
 
170
-	return $wp_query->is_post_type_archive( $post_types );
170
+	return $wp_query->is_post_type_archive($post_types);
171 171
 }
172 172
 
173 173
 /**
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
  * @param int|string|array|object $attachment Attachment ID, title, slug, or array of such.
181 181
  * @return bool
182 182
  */
183
-function is_attachment( $attachment = '' ) {
183
+function is_attachment($attachment = '') {
184 184
 	global $wp_query;
185 185
 
186
-	if ( ! isset( $wp_query ) ) {
187
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
186
+	if ( ! isset($wp_query)) {
187
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
188 188
 		return false;
189 189
 	}
190 190
 
191
-	return $wp_query->is_attachment( $attachment );
191
+	return $wp_query->is_attachment($attachment);
192 192
 }
193 193
 
194 194
 /**
@@ -204,15 +204,15 @@  discard block
 block discarded – undo
204 204
  * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
205 205
  * @return bool
206 206
  */
207
-function is_author( $author = '' ) {
207
+function is_author($author = '') {
208 208
 	global $wp_query;
209 209
 
210
-	if ( ! isset( $wp_query ) ) {
211
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
210
+	if ( ! isset($wp_query)) {
211
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
212 212
 		return false;
213 213
 	}
214 214
 
215
-	return $wp_query->is_author( $author );
215
+	return $wp_query->is_author($author);
216 216
 }
217 217
 
218 218
 /**
@@ -228,15 +228,15 @@  discard block
 block discarded – undo
228 228
  * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
229 229
  * @return bool
230 230
  */
231
-function is_category( $category = '' ) {
231
+function is_category($category = '') {
232 232
 	global $wp_query;
233 233
 
234
-	if ( ! isset( $wp_query ) ) {
235
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
234
+	if ( ! isset($wp_query)) {
235
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
236 236
 		return false;
237 237
 	}
238 238
 
239
-	return $wp_query->is_category( $category );
239
+	return $wp_query->is_category($category);
240 240
 }
241 241
 
242 242
 /**
@@ -252,15 +252,15 @@  discard block
 block discarded – undo
252 252
  * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
253 253
  * @return bool
254 254
  */
255
-function is_tag( $tag = '' ) {
255
+function is_tag($tag = '') {
256 256
 	global $wp_query;
257 257
 
258
-	if ( ! isset( $wp_query ) ) {
259
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
258
+	if ( ! isset($wp_query)) {
259
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
260 260
 		return false;
261 261
 	}
262 262
 
263
-	return $wp_query->is_tag( $tag );
263
+	return $wp_query->is_tag($tag);
264 264
 }
265 265
 
266 266
 /**
@@ -281,15 +281,15 @@  discard block
 block discarded – undo
281 281
  * @param int|string|array $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
282 282
  * @return bool
283 283
  */
284
-function is_tax( $taxonomy = '', $term = '' ) {
284
+function is_tax($taxonomy = '', $term = '') {
285 285
 	global $wp_query;
286 286
 
287
-	if ( ! isset( $wp_query ) ) {
288
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
287
+	if ( ! isset($wp_query)) {
288
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
289 289
 		return false;
290 290
 	}
291 291
 
292
-	return $wp_query->is_tax( $taxonomy, $term );
292
+	return $wp_query->is_tax($taxonomy, $term);
293 293
 }
294 294
 
295 295
 /**
@@ -304,8 +304,8 @@  discard block
 block discarded – undo
304 304
 function is_comments_popup() {
305 305
 	global $wp_query;
306 306
 
307
-	if ( ! isset( $wp_query ) ) {
308
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
307
+	if ( ! isset($wp_query)) {
308
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
309 309
 		return false;
310 310
 	}
311 311
 
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 function is_date() {
325 325
 	global $wp_query;
326 326
 
327
-	if ( ! isset( $wp_query ) ) {
328
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
327
+	if ( ! isset($wp_query)) {
328
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
329 329
 		return false;
330 330
 	}
331 331
 
@@ -344,8 +344,8 @@  discard block
 block discarded – undo
344 344
 function is_day() {
345 345
 	global $wp_query;
346 346
 
347
-	if ( ! isset( $wp_query ) ) {
348
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
347
+	if ( ! isset($wp_query)) {
348
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
349 349
 		return false;
350 350
 	}
351 351
 
@@ -362,15 +362,15 @@  discard block
 block discarded – undo
362 362
  * @param string|array $feeds Optional feed types to check.
363 363
  * @return bool
364 364
  */
365
-function is_feed( $feeds = '' ) {
365
+function is_feed($feeds = '') {
366 366
 	global $wp_query;
367 367
 
368
-	if ( ! isset( $wp_query ) ) {
369
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
368
+	if ( ! isset($wp_query)) {
369
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
370 370
 		return false;
371 371
 	}
372 372
 
373
-	return $wp_query->is_feed( $feeds );
373
+	return $wp_query->is_feed($feeds);
374 374
 }
375 375
 
376 376
 /**
@@ -385,8 +385,8 @@  discard block
 block discarded – undo
385 385
 function is_comment_feed() {
386 386
 	global $wp_query;
387 387
 
388
-	if ( ! isset( $wp_query ) ) {
389
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
388
+	if ( ! isset($wp_query)) {
389
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
390 390
 		return false;
391 391
 	}
392 392
 
@@ -414,8 +414,8 @@  discard block
 block discarded – undo
414 414
 function is_front_page() {
415 415
 	global $wp_query;
416 416
 
417
-	if ( ! isset( $wp_query ) ) {
418
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
417
+	if ( ! isset($wp_query)) {
418
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
419 419
 		return false;
420 420
 	}
421 421
 
@@ -443,8 +443,8 @@  discard block
 block discarded – undo
443 443
 function is_home() {
444 444
 	global $wp_query;
445 445
 
446
-	if ( ! isset( $wp_query ) ) {
447
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
446
+	if ( ! isset($wp_query)) {
447
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
448 448
 		return false;
449 449
 	}
450 450
 
@@ -463,8 +463,8 @@  discard block
 block discarded – undo
463 463
 function is_month() {
464 464
 	global $wp_query;
465 465
 
466
-	if ( ! isset( $wp_query ) ) {
467
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
466
+	if ( ! isset($wp_query)) {
467
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
468 468
 		return false;
469 469
 	}
470 470
 
@@ -487,15 +487,15 @@  discard block
 block discarded – undo
487 487
  * @param mixed $page Page ID, title, slug, or array of such.
488 488
  * @return bool
489 489
  */
490
-function is_page( $page = '' ) {
490
+function is_page($page = '') {
491 491
 	global $wp_query;
492 492
 
493
-	if ( ! isset( $wp_query ) ) {
494
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
493
+	if ( ! isset($wp_query)) {
494
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
495 495
 		return false;
496 496
 	}
497 497
 
498
-	return $wp_query->is_page( $page );
498
+	return $wp_query->is_page($page);
499 499
 }
500 500
 
501 501
 /**
@@ -510,8 +510,8 @@  discard block
 block discarded – undo
510 510
 function is_paged() {
511 511
 	global $wp_query;
512 512
 
513
-	if ( ! isset( $wp_query ) ) {
514
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
513
+	if ( ! isset($wp_query)) {
514
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
515 515
 		return false;
516 516
 	}
517 517
 
@@ -530,8 +530,8 @@  discard block
 block discarded – undo
530 530
 function is_preview() {
531 531
 	global $wp_query;
532 532
 
533
-	if ( ! isset( $wp_query ) ) {
534
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
533
+	if ( ! isset($wp_query)) {
534
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
535 535
 		return false;
536 536
 	}
537 537
 
@@ -550,8 +550,8 @@  discard block
 block discarded – undo
550 550
 function is_robots() {
551 551
 	global $wp_query;
552 552
 
553
-	if ( ! isset( $wp_query ) ) {
554
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
553
+	if ( ! isset($wp_query)) {
554
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
555 555
 		return false;
556 556
 	}
557 557
 
@@ -570,8 +570,8 @@  discard block
 block discarded – undo
570 570
 function is_search() {
571 571
 	global $wp_query;
572 572
 
573
-	if ( ! isset( $wp_query ) ) {
574
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
573
+	if ( ! isset($wp_query)) {
574
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
575 575
 		return false;
576 576
 	}
577 577
 
@@ -596,15 +596,15 @@  discard block
 block discarded – undo
596 596
  * @param mixed $post Post ID, title, slug, or array of such.
597 597
  * @return bool
598 598
  */
599
-function is_single( $post = '' ) {
599
+function is_single($post = '') {
600 600
 	global $wp_query;
601 601
 
602
-	if ( ! isset( $wp_query ) ) {
603
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
602
+	if ( ! isset($wp_query)) {
603
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
604 604
 		return false;
605 605
 	}
606 606
 
607
-	return $wp_query->is_single( $post );
607
+	return $wp_query->is_single($post);
608 608
 }
609 609
 
610 610
 /**
@@ -623,15 +623,15 @@  discard block
 block discarded – undo
623 623
  * @param mixed $post_types Optional. Post Type or array of Post Types
624 624
  * @return bool
625 625
  */
626
-function is_singular( $post_types = '' ) {
626
+function is_singular($post_types = '') {
627 627
 	global $wp_query;
628 628
 
629
-	if ( ! isset( $wp_query ) ) {
630
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
629
+	if ( ! isset($wp_query)) {
630
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
631 631
 		return false;
632 632
 	}
633 633
 
634
-	return $wp_query->is_singular( $post_types );
634
+	return $wp_query->is_singular($post_types);
635 635
 }
636 636
 
637 637
 /**
@@ -646,8 +646,8 @@  discard block
 block discarded – undo
646 646
 function is_time() {
647 647
 	global $wp_query;
648 648
 
649
-	if ( ! isset( $wp_query ) ) {
650
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
649
+	if ( ! isset($wp_query)) {
650
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
651 651
 		return false;
652 652
 	}
653 653
 
@@ -666,8 +666,8 @@  discard block
 block discarded – undo
666 666
 function is_trackback() {
667 667
 	global $wp_query;
668 668
 
669
-	if ( ! isset( $wp_query ) ) {
670
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
669
+	if ( ! isset($wp_query)) {
670
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
671 671
 		return false;
672 672
 	}
673 673
 
@@ -686,8 +686,8 @@  discard block
 block discarded – undo
686 686
 function is_year() {
687 687
 	global $wp_query;
688 688
 
689
-	if ( ! isset( $wp_query ) ) {
690
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
689
+	if ( ! isset($wp_query)) {
690
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
691 691
 		return false;
692 692
 	}
693 693
 
@@ -706,8 +706,8 @@  discard block
 block discarded – undo
706 706
 function is_404() {
707 707
 	global $wp_query;
708 708
 
709
-	if ( ! isset( $wp_query ) ) {
710
-		_doing_it_wrong( __FUNCTION__, __( 'Conditional query tags do not work before the query is run. Before then, they always return false.' ), '3.1' );
709
+	if ( ! isset($wp_query)) {
710
+		_doing_it_wrong(__FUNCTION__, __('Conditional query tags do not work before the query is run. Before then, they always return false.'), '3.1');
711 711
 		return false;
712 712
 	}
713 713
 
@@ -724,10 +724,10 @@  discard block
 block discarded – undo
724 724
  * @return bool
725 725
  */
726 726
 function is_main_query() {
727
-	if ( 'pre_get_posts' === current_filter() ) {
728
-		$message = sprintf( __( 'In <code>%1$s</code>, use the <code>%2$s</code> method, not the <code>%3$s</code> function. See %4$s.' ),
729
-			'pre_get_posts', 'WP_Query::is_main_query()', 'is_main_query()', __( 'https://codex.wordpress.org/Function_Reference/is_main_query' ) );
730
-		_doing_it_wrong( __FUNCTION__, $message, '3.7' );
727
+	if ('pre_get_posts' === current_filter()) {
728
+		$message = sprintf(__('In <code>%1$s</code>, use the <code>%2$s</code> method, not the <code>%3$s</code> function. See %4$s.'),
729
+			'pre_get_posts', 'WP_Query::is_main_query()', 'is_main_query()', __('https://codex.wordpress.org/Function_Reference/is_main_query'));
730
+		_doing_it_wrong(__FUNCTION__, $message, '3.7');
731 731
 	}
732 732
 
733 733
 	global $wp_query;
@@ -1300,9 +1300,9 @@  discard block
 block discarded – undo
1300 1300
 	 */
1301 1301
 	private $stopwords;
1302 1302
 
1303
-	private $compat_fields = array( 'query_vars_hash', 'query_vars_changed' );
1303
+	private $compat_fields = array('query_vars_hash', 'query_vars_changed');
1304 1304
 
1305
-	private $compat_methods = array( 'init_query_flags', 'parse_tax_query' );
1305
+	private $compat_methods = array('init_query_flags', 'parse_tax_query');
1306 1306
 
1307 1307
 	/**
1308 1308
 	 * Resets query flags to false.
@@ -1357,10 +1357,10 @@  discard block
 block discarded – undo
1357 1357
 		$this->post_count = 0;
1358 1358
 		$this->current_post = -1;
1359 1359
 		$this->in_the_loop = false;
1360
-		unset( $this->request );
1361
-		unset( $this->post );
1362
-		unset( $this->comments );
1363
-		unset( $this->comment );
1360
+		unset($this->request);
1361
+		unset($this->post);
1362
+		unset($this->comments);
1363
+		unset($this->comment);
1364 1364
 		$this->comment_count = 0;
1365 1365
 		$this->current_comment = -1;
1366 1366
 		$this->found_posts = 0;
@@ -1429,17 +1429,17 @@  discard block
 block discarded – undo
1429 1429
 			, 'menu_order'
1430 1430
 		);
1431 1431
 
1432
-		foreach ( $keys as $key ) {
1433
-			if ( !isset($array[$key]) )
1432
+		foreach ($keys as $key) {
1433
+			if ( ! isset($array[$key]))
1434 1434
 				$array[$key] = '';
1435 1435
 		}
1436 1436
 
1437
-		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
1437
+		$array_keys = array('category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
1438 1438
 			'tag__in', 'tag__not_in', 'tag__and', 'tag_slug__in', 'tag_slug__and', 'post_parent__in', 'post_parent__not_in',
1439
-			'author__in', 'author__not_in' );
1439
+			'author__in', 'author__not_in');
1440 1440
 
1441
-		foreach ( $array_keys as $key ) {
1442
-			if ( !isset($array[$key]) )
1441
+		foreach ($array_keys as $key) {
1442
+			if ( ! isset($array[$key]))
1443 1443
 				$array[$key] = array();
1444 1444
 		}
1445 1445
 		return $array;
@@ -1550,11 +1550,11 @@  discard block
 block discarded – undo
1550 1550
 	 *     @type int          $year                    The four-digit year. Default empty. Accepts any four-digit year.
1551 1551
 	 * }
1552 1552
 	 */
1553
-	public function parse_query( $query =  '' ) {
1554
-		if ( ! empty( $query ) ) {
1553
+	public function parse_query($query = '') {
1554
+		if ( ! empty($query)) {
1555 1555
 			$this->init();
1556
-			$this->query = $this->query_vars = wp_parse_args( $query );
1557
-		} elseif ( ! isset( $this->query ) ) {
1556
+			$this->query = $this->query_vars = wp_parse_args($query);
1557
+		} elseif ( ! isset($this->query)) {
1558 1558
 			$this->query = $this->query_vars;
1559 1559
 		}
1560 1560
 
@@ -1562,79 +1562,79 @@  discard block
 block discarded – undo
1562 1562
 		$qv = &$this->query_vars;
1563 1563
 		$this->query_vars_changed = true;
1564 1564
 
1565
-		if ( ! empty($qv['robots']) )
1565
+		if ( ! empty($qv['robots']))
1566 1566
 			$this->is_robots = true;
1567 1567
 
1568
-		$qv['p'] =  absint($qv['p']);
1569
-		$qv['page_id'] =  absint($qv['page_id']);
1568
+		$qv['p'] = absint($qv['p']);
1569
+		$qv['page_id'] = absint($qv['page_id']);
1570 1570
 		$qv['year'] = absint($qv['year']);
1571 1571
 		$qv['monthnum'] = absint($qv['monthnum']);
1572 1572
 		$qv['day'] = absint($qv['day']);
1573 1573
 		$qv['w'] = absint($qv['w']);
1574
-		$qv['m'] = preg_replace( '|[^0-9]|', '', $qv['m'] );
1574
+		$qv['m'] = preg_replace('|[^0-9]|', '', $qv['m']);
1575 1575
 		$qv['paged'] = absint($qv['paged']);
1576
-		$qv['cat'] = preg_replace( '|[^0-9,-]|', '', $qv['cat'] ); // comma separated list of positive or negative integers
1577
-		$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers
1578
-		$qv['pagename'] = trim( $qv['pagename'] );
1579
-		$qv['name'] = trim( $qv['name'] );
1580
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
1581
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
1582
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
1583
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
1576
+		$qv['cat'] = preg_replace('|[^0-9,-]|', '', $qv['cat']); // comma separated list of positive or negative integers
1577
+		$qv['author'] = preg_replace('|[^0-9,-]|', '', $qv['author']); // comma separated list of positive or negative integers
1578
+		$qv['pagename'] = trim($qv['pagename']);
1579
+		$qv['name'] = trim($qv['name']);
1580
+		if ('' !== $qv['hour']) $qv['hour'] = absint($qv['hour']);
1581
+		if ('' !== $qv['minute']) $qv['minute'] = absint($qv['minute']);
1582
+		if ('' !== $qv['second']) $qv['second'] = absint($qv['second']);
1583
+		if ('' !== $qv['menu_order']) $qv['menu_order'] = absint($qv['menu_order']);
1584 1584
 
1585 1585
 		// Fairly insane upper bound for search string lengths.
1586
-		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
1586
+		if ( ! is_scalar($qv['s']) || ( ! empty($qv['s']) && strlen($qv['s']) > 1600)) {
1587 1587
 			$qv['s'] = '';
1588 1588
 		}
1589 1589
 
1590 1590
 		// Compat. Map subpost to attachment.
1591
-		if ( '' != $qv['subpost'] )
1591
+		if ('' != $qv['subpost'])
1592 1592
 			$qv['attachment'] = $qv['subpost'];
1593
-		if ( '' != $qv['subpost_id'] )
1593
+		if ('' != $qv['subpost_id'])
1594 1594
 			$qv['attachment_id'] = $qv['subpost_id'];
1595 1595
 
1596 1596
 		$qv['attachment_id'] = absint($qv['attachment_id']);
1597 1597
 
1598
-		if ( ('' != $qv['attachment']) || !empty($qv['attachment_id']) ) {
1598
+		if (('' != $qv['attachment']) || ! empty($qv['attachment_id'])) {
1599 1599
 			$this->is_single = true;
1600 1600
 			$this->is_attachment = true;
1601
-		} elseif ( '' != $qv['name'] ) {
1601
+		} elseif ('' != $qv['name']) {
1602 1602
 			$this->is_single = true;
1603
-		} elseif ( $qv['p'] ) {
1603
+		} elseif ($qv['p']) {
1604 1604
 			$this->is_single = true;
1605
-		} elseif ( ('' !== $qv['hour']) && ('' !== $qv['minute']) &&('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day']) ) {
1605
+		} elseif (('' !== $qv['hour']) && ('' !== $qv['minute']) && ('' !== $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
1606 1606
 			// If year, month, day, hour, minute, and second are set, a single
1607 1607
 			// post is being queried.
1608 1608
 			$this->is_single = true;
1609
-		} elseif ( '' != $qv['static'] || '' != $qv['pagename'] || !empty($qv['page_id']) ) {
1609
+		} elseif ('' != $qv['static'] || '' != $qv['pagename'] || ! empty($qv['page_id'])) {
1610 1610
 			$this->is_page = true;
1611 1611
 			$this->is_single = false;
1612 1612
 		} else {
1613 1613
 			// Look for archive queries. Dates, categories, authors, search, post type archives.
1614 1614
 
1615
-			if ( isset( $this->query['s'] ) ) {
1615
+			if (isset($this->query['s'])) {
1616 1616
 				$this->is_search = true;
1617 1617
 			}
1618 1618
 
1619
-			if ( '' !== $qv['second'] ) {
1619
+			if ('' !== $qv['second']) {
1620 1620
 				$this->is_time = true;
1621 1621
 				$this->is_date = true;
1622 1622
 			}
1623 1623
 
1624
-			if ( '' !== $qv['minute'] ) {
1624
+			if ('' !== $qv['minute']) {
1625 1625
 				$this->is_time = true;
1626 1626
 				$this->is_date = true;
1627 1627
 			}
1628 1628
 
1629
-			if ( '' !== $qv['hour'] ) {
1629
+			if ('' !== $qv['hour']) {
1630 1630
 				$this->is_time = true;
1631 1631
 				$this->is_date = true;
1632 1632
 			}
1633 1633
 
1634
-			if ( $qv['day'] ) {
1635
-				if ( ! $this->is_date ) {
1636
-					$date = sprintf( '%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day'] );
1637
-					if ( $qv['monthnum'] && $qv['year'] && ! wp_checkdate( $qv['monthnum'], $qv['day'], $qv['year'], $date ) ) {
1634
+			if ($qv['day']) {
1635
+				if ( ! $this->is_date) {
1636
+					$date = sprintf('%04d-%02d-%02d', $qv['year'], $qv['monthnum'], $qv['day']);
1637
+					if ($qv['monthnum'] && $qv['year'] && ! wp_checkdate($qv['monthnum'], $qv['day'], $qv['year'], $date)) {
1638 1638
 						$qv['error'] = '404';
1639 1639
 					} else {
1640 1640
 						$this->is_day = true;
@@ -1643,9 +1643,9 @@  discard block
 block discarded – undo
1643 1643
 				}
1644 1644
 			}
1645 1645
 
1646
-			if ( $qv['monthnum'] ) {
1647
-				if ( ! $this->is_date ) {
1648
-					if ( 12 < $qv['monthnum'] ) {
1646
+			if ($qv['monthnum']) {
1647
+				if ( ! $this->is_date) {
1648
+					if (12 < $qv['monthnum']) {
1649 1649
 						$qv['error'] = '404';
1650 1650
 					} else {
1651 1651
 						$this->is_month = true;
@@ -1654,40 +1654,40 @@  discard block
 block discarded – undo
1654 1654
 				}
1655 1655
 			}
1656 1656
 
1657
-			if ( $qv['year'] ) {
1658
-				if ( ! $this->is_date ) {
1657
+			if ($qv['year']) {
1658
+				if ( ! $this->is_date) {
1659 1659
 					$this->is_year = true;
1660 1660
 					$this->is_date = true;
1661 1661
 				}
1662 1662
 			}
1663 1663
 
1664
-			if ( $qv['m'] ) {
1664
+			if ($qv['m']) {
1665 1665
 				$this->is_date = true;
1666
-				if ( strlen($qv['m']) > 9 ) {
1666
+				if (strlen($qv['m']) > 9) {
1667 1667
 					$this->is_time = true;
1668
-				} elseif ( strlen( $qv['m'] ) > 7 ) {
1668
+				} elseif (strlen($qv['m']) > 7) {
1669 1669
 					$this->is_day = true;
1670
-				} elseif ( strlen( $qv['m'] ) > 5 ) {
1670
+				} elseif (strlen($qv['m']) > 5) {
1671 1671
 					$this->is_month = true;
1672 1672
 				} else {
1673 1673
 					$this->is_year = true;
1674 1674
 				}
1675 1675
 			}
1676 1676
 
1677
-			if ( '' != $qv['w'] ) {
1677
+			if ('' != $qv['w']) {
1678 1678
 				$this->is_date = true;
1679 1679
 			}
1680 1680
 
1681 1681
 			$this->query_vars_hash = false;
1682
-			$this->parse_tax_query( $qv );
1682
+			$this->parse_tax_query($qv);
1683 1683
 
1684
-			foreach ( $this->tax_query->queries as $tax_query ) {
1685
-				if ( ! is_array( $tax_query ) ) {
1684
+			foreach ($this->tax_query->queries as $tax_query) {
1685
+				if ( ! is_array($tax_query)) {
1686 1686
 					continue;
1687 1687
 				}
1688 1688
 
1689
-				if ( isset( $tax_query['operator'] ) && 'NOT IN' != $tax_query['operator'] ) {
1690
-					switch ( $tax_query['taxonomy'] ) {
1689
+				if (isset($tax_query['operator']) && 'NOT IN' != $tax_query['operator']) {
1690
+					switch ($tax_query['taxonomy']) {
1691 1691
 						case 'category':
1692 1692
 							$this->is_category = true;
1693 1693
 							break;
@@ -1699,123 +1699,123 @@  discard block
 block discarded – undo
1699 1699
 					}
1700 1700
 				}
1701 1701
 			}
1702
-			unset( $tax_query );
1702
+			unset($tax_query);
1703 1703
 
1704
-			if ( empty($qv['author']) || ($qv['author'] == '0') ) {
1704
+			if (empty($qv['author']) || ($qv['author'] == '0')) {
1705 1705
 				$this->is_author = false;
1706 1706
 			} else {
1707 1707
 				$this->is_author = true;
1708 1708
 			}
1709 1709
 
1710
-			if ( '' != $qv['author_name'] )
1710
+			if ('' != $qv['author_name'])
1711 1711
 				$this->is_author = true;
1712 1712
 
1713
-			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
1714
-				$post_type_obj = get_post_type_object( $qv['post_type'] );
1715
-				if ( ! empty( $post_type_obj->has_archive ) )
1713
+			if ( ! empty($qv['post_type']) && ! is_array($qv['post_type'])) {
1714
+				$post_type_obj = get_post_type_object($qv['post_type']);
1715
+				if ( ! empty($post_type_obj->has_archive))
1716 1716
 					$this->is_post_type_archive = true;
1717 1717
 			}
1718 1718
 
1719
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
1719
+			if ($this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax)
1720 1720
 				$this->is_archive = true;
1721 1721
 		}
1722 1722
 
1723
-		if ( '' != $qv['feed'] )
1723
+		if ('' != $qv['feed'])
1724 1724
 			$this->is_feed = true;
1725 1725
 
1726
-		if ( '' != $qv['tb'] )
1726
+		if ('' != $qv['tb'])
1727 1727
 			$this->is_trackback = true;
1728 1728
 
1729
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
1729
+		if ('' != $qv['paged'] && (intval($qv['paged']) > 1))
1730 1730
 			$this->is_paged = true;
1731 1731
 
1732
-		if ( '' != $qv['comments_popup'] )
1732
+		if ('' != $qv['comments_popup'])
1733 1733
 			$this->is_comments_popup = true;
1734 1734
 
1735 1735
 		// if we're previewing inside the write screen
1736
-		if ( '' != $qv['preview'] )
1736
+		if ('' != $qv['preview'])
1737 1737
 			$this->is_preview = true;
1738 1738
 
1739
-		if ( is_admin() )
1739
+		if (is_admin())
1740 1740
 			$this->is_admin = true;
1741 1741
 
1742
-		if ( false !== strpos($qv['feed'], 'comments-') ) {
1742
+		if (false !== strpos($qv['feed'], 'comments-')) {
1743 1743
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
1744 1744
 			$qv['withcomments'] = 1;
1745 1745
 		}
1746 1746
 
1747 1747
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1748 1748
 
1749
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
1749
+		if ($this->is_feed && ( ! empty($qv['withcomments']) || (empty($qv['withoutcomments']) && $this->is_singular)))
1750 1750
 			$this->is_comment_feed = true;
1751 1751
 
1752
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
1752
+		if ( ! ($this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots))
1753 1753
 			$this->is_home = true;
1754 1754
 
1755 1755
 		// Correct is_* for page_on_front and page_for_posts
1756
-		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
1756
+		if ($this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front')) {
1757 1757
 			$_query = wp_parse_args($this->query);
1758 1758
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
1759
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
1759
+			if (isset($_query['pagename']) && '' == $_query['pagename'])
1760 1760
 				unset($_query['pagename']);
1761
-			if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
1761
+			if (empty($_query) || ! array_diff(array_keys($_query), array('preview', 'page', 'paged', 'cpage'))) {
1762 1762
 				$this->is_page = true;
1763 1763
 				$this->is_home = false;
1764 1764
 				$qv['page_id'] = get_option('page_on_front');
1765 1765
 				// Correct <!--nextpage--> for page_on_front
1766
-				if ( !empty($qv['paged']) ) {
1766
+				if ( ! empty($qv['paged'])) {
1767 1767
 					$qv['page'] = $qv['paged'];
1768 1768
 					unset($qv['paged']);
1769 1769
 				}
1770 1770
 			}
1771 1771
 		}
1772 1772
 
1773
-		if ( '' != $qv['pagename'] ) {
1773
+		if ('' != $qv['pagename']) {
1774 1774
 			$this->queried_object = get_page_by_path($qv['pagename']);
1775
-			if ( !empty($this->queried_object) )
1775
+			if ( ! empty($this->queried_object))
1776 1776
 				$this->queried_object_id = (int) $this->queried_object->ID;
1777 1777
 			else
1778 1778
 				unset($this->queried_object);
1779 1779
 
1780
-			if  ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) {
1780
+			if ('page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts')) {
1781 1781
 				$this->is_page = false;
1782 1782
 				$this->is_home = true;
1783 1783
 				$this->is_posts_page = true;
1784 1784
 			}
1785 1785
 		}
1786 1786
 
1787
-		if ( $qv['page_id'] ) {
1788
-			if  ( 'page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts') ) {
1787
+		if ($qv['page_id']) {
1788
+			if ('page' == get_option('show_on_front') && $qv['page_id'] == get_option('page_for_posts')) {
1789 1789
 				$this->is_page = false;
1790 1790
 				$this->is_home = true;
1791 1791
 				$this->is_posts_page = true;
1792 1792
 			}
1793 1793
 		}
1794 1794
 
1795
-		if ( !empty($qv['post_type']) ) {
1796
-			if ( is_array($qv['post_type']) )
1795
+		if ( ! empty($qv['post_type'])) {
1796
+			if (is_array($qv['post_type']))
1797 1797
 				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1798 1798
 			else
1799 1799
 				$qv['post_type'] = sanitize_key($qv['post_type']);
1800 1800
 		}
1801 1801
 
1802
-		if ( ! empty( $qv['post_status'] ) ) {
1803
-			if ( is_array( $qv['post_status'] ) )
1802
+		if ( ! empty($qv['post_status'])) {
1803
+			if (is_array($qv['post_status']))
1804 1804
 				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1805 1805
 			else
1806 1806
 				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1807 1807
 		}
1808 1808
 
1809
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1809
+		if ($this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments']))
1810 1810
 			$this->is_comment_feed = false;
1811 1811
 
1812 1812
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1813 1813
 		// Done correcting is_* for page_on_front and page_for_posts
1814 1814
 
1815
-		if ( '404' == $qv['error'] )
1815
+		if ('404' == $qv['error'])
1816 1816
 			$this->set_404();
1817 1817
 
1818
-		$this->query_vars_hash = md5( serialize( $this->query_vars ) );
1818
+		$this->query_vars_hash = md5(serialize($this->query_vars));
1819 1819
 		$this->query_vars_changed = false;
1820 1820
 
1821 1821
 		/**
@@ -1825,7 +1825,7 @@  discard block
 block discarded – undo
1825 1825
 		 *
1826 1826
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
1827 1827
 		 */
1828
-		do_action_ref_array( 'parse_query', array( &$this ) );
1828
+		do_action_ref_array('parse_query', array(&$this));
1829 1829
 	}
1830 1830
 
1831 1831
 	/**
@@ -1838,72 +1838,72 @@  discard block
 block discarded – undo
1838 1838
 	 *
1839 1839
 	 * @param array &$q The query variables
1840 1840
 	 */
1841
-	public function parse_tax_query( &$q ) {
1842
-		if ( ! empty( $q['tax_query'] ) && is_array( $q['tax_query'] ) ) {
1841
+	public function parse_tax_query(&$q) {
1842
+		if ( ! empty($q['tax_query']) && is_array($q['tax_query'])) {
1843 1843
 			$tax_query = $q['tax_query'];
1844 1844
 		} else {
1845 1845
 			$tax_query = array();
1846 1846
 		}
1847 1847
 
1848
-		if ( !empty($q['taxonomy']) && !empty($q['term']) ) {
1848
+		if ( ! empty($q['taxonomy']) && ! empty($q['term'])) {
1849 1849
 			$tax_query[] = array(
1850 1850
 				'taxonomy' => $q['taxonomy'],
1851
-				'terms' => array( $q['term'] ),
1851
+				'terms' => array($q['term']),
1852 1852
 				'field' => 'slug',
1853 1853
 			);
1854 1854
 		}
1855 1855
 
1856
-		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1857
-			if ( 'post_tag' == $taxonomy )
1858
-				continue;	// Handled further down in the $q['tag'] block
1856
+		foreach (get_taxonomies(array(), 'objects') as $taxonomy => $t) {
1857
+			if ('post_tag' == $taxonomy)
1858
+				continue; // Handled further down in the $q['tag'] block
1859 1859
 
1860
-			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1860
+			if ($t->query_var && ! empty($q[$t->query_var])) {
1861 1861
 				$tax_query_defaults = array(
1862 1862
 					'taxonomy' => $taxonomy,
1863 1863
 					'field' => 'slug',
1864 1864
 				);
1865 1865
 
1866
- 				if ( isset( $t->rewrite['hierarchical'] ) && $t->rewrite['hierarchical'] ) {
1867
-					$q[$t->query_var] = wp_basename( $q[$t->query_var] );
1866
+ 				if (isset($t->rewrite['hierarchical']) && $t->rewrite['hierarchical']) {
1867
+					$q[$t->query_var] = wp_basename($q[$t->query_var]);
1868 1868
 				}
1869 1869
 
1870 1870
 				$term = $q[$t->query_var];
1871 1871
 
1872
-				if ( is_array( $term ) ) {
1873
-					$term = implode( ',', $term );
1872
+				if (is_array($term)) {
1873
+					$term = implode(',', $term);
1874 1874
 				}
1875 1875
 
1876
-				if ( strpos($term, '+') !== false ) {
1877
-					$terms = preg_split( '/[+]+/', $term );
1878
-					foreach ( $terms as $term ) {
1879
-						$tax_query[] = array_merge( $tax_query_defaults, array(
1880
-							'terms' => array( $term )
1881
-						) );
1876
+				if (strpos($term, '+') !== false) {
1877
+					$terms = preg_split('/[+]+/', $term);
1878
+					foreach ($terms as $term) {
1879
+						$tax_query[] = array_merge($tax_query_defaults, array(
1880
+							'terms' => array($term)
1881
+						));
1882 1882
 					}
1883 1883
 				} else {
1884
-					$tax_query[] = array_merge( $tax_query_defaults, array(
1885
-						'terms' => preg_split( '/[,]+/', $term )
1886
-					) );
1884
+					$tax_query[] = array_merge($tax_query_defaults, array(
1885
+						'terms' => preg_split('/[,]+/', $term)
1886
+					));
1887 1887
 				}
1888 1888
 			}
1889 1889
 		}
1890 1890
 
1891 1891
 		// Category stuff
1892
-		if ( ! empty( $q['cat'] ) && ! $this->is_singular ) {
1892
+		if ( ! empty($q['cat']) && ! $this->is_singular) {
1893 1893
 			$cat_in = $cat_not_in = array();
1894 1894
 
1895
-			$cat_array = preg_split( '/[,\s]+/', urldecode( $q['cat'] ) );
1896
-			$cat_array = array_map( 'intval', $cat_array );
1897
-			$q['cat'] = implode( ',', $cat_array );
1895
+			$cat_array = preg_split('/[,\s]+/', urldecode($q['cat']));
1896
+			$cat_array = array_map('intval', $cat_array);
1897
+			$q['cat'] = implode(',', $cat_array);
1898 1898
 
1899
-			foreach ( $cat_array as $cat ) {
1900
-				if ( $cat > 0 )
1899
+			foreach ($cat_array as $cat) {
1900
+				if ($cat > 0)
1901 1901
 					$cat_in[] = $cat;
1902
-				elseif ( $cat < 0 )
1903
-					$cat_not_in[] = abs( $cat );
1902
+				elseif ($cat < 0)
1903
+					$cat_not_in[] = abs($cat);
1904 1904
 			}
1905 1905
 
1906
-			if ( ! empty( $cat_in ) ) {
1906
+			if ( ! empty($cat_in)) {
1907 1907
 				$tax_query[] = array(
1908 1908
 					'taxonomy' => 'category',
1909 1909
 					'terms' => $cat_in,
@@ -1912,7 +1912,7 @@  discard block
 block discarded – undo
1912 1912
 				);
1913 1913
 			}
1914 1914
 
1915
-			if ( ! empty( $cat_not_in ) ) {
1915
+			if ( ! empty($cat_not_in)) {
1916 1916
 				$tax_query[] = array(
1917 1917
 					'taxonomy' => 'category',
1918 1918
 					'terms' => $cat_not_in,
@@ -1921,19 +1921,19 @@  discard block
 block discarded – undo
1921 1921
 					'include_children' => true
1922 1922
 				);
1923 1923
 			}
1924
-			unset( $cat_array, $cat_in, $cat_not_in );
1924
+			unset($cat_array, $cat_in, $cat_not_in);
1925 1925
 		}
1926 1926
 
1927
-		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1927
+		if ( ! empty($q['category__and']) && 1 === count((array) $q['category__and'])) {
1928 1928
 			$q['category__and'] = (array) $q['category__and'];
1929
-			if ( ! isset( $q['category__in'] ) )
1929
+			if ( ! isset($q['category__in']))
1930 1930
 				$q['category__in'] = array();
1931
-			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1932
-			unset( $q['category__and'] );
1931
+			$q['category__in'][] = absint(reset($q['category__and']));
1932
+			unset($q['category__and']);
1933 1933
 		}
1934 1934
 
1935
-		if ( ! empty( $q['category__in'] ) ) {
1936
-			$q['category__in'] = array_map( 'absint', array_unique( (array) $q['category__in'] ) );
1935
+		if ( ! empty($q['category__in'])) {
1936
+			$q['category__in'] = array_map('absint', array_unique((array) $q['category__in']));
1937 1937
 			$tax_query[] = array(
1938 1938
 				'taxonomy' => 'category',
1939 1939
 				'terms' => $q['category__in'],
@@ -1942,8 +1942,8 @@  discard block
 block discarded – undo
1942 1942
 			);
1943 1943
 		}
1944 1944
 
1945
-		if ( ! empty($q['category__not_in']) ) {
1946
-			$q['category__not_in'] = array_map( 'absint', array_unique( (array) $q['category__not_in'] ) );
1945
+		if ( ! empty($q['category__not_in'])) {
1946
+			$q['category__not_in'] = array_map('absint', array_unique((array) $q['category__not_in']));
1947 1947
 			$tax_query[] = array(
1948 1948
 				'taxonomy' => 'category',
1949 1949
 				'terms' => $q['category__not_in'],
@@ -1952,8 +1952,8 @@  discard block
 block discarded – undo
1952 1952
 			);
1953 1953
 		}
1954 1954
 
1955
-		if ( ! empty($q['category__and']) ) {
1956
-			$q['category__and'] = array_map( 'absint', array_unique( (array) $q['category__and'] ) );
1955
+		if ( ! empty($q['category__and'])) {
1956
+			$q['category__and'] = array_map('absint', array_unique((array) $q['category__and']));
1957 1957
 			$tax_query[] = array(
1958 1958
 				'taxonomy' => 'category',
1959 1959
 				'terms' => $q['category__and'],
@@ -1964,16 +1964,16 @@  discard block
 block discarded – undo
1964 1964
 		}
1965 1965
 
1966 1966
 		// Tag stuff
1967
-		if ( '' != $q['tag'] && !$this->is_singular && $this->query_vars_changed ) {
1968
-			if ( strpos($q['tag'], ',') !== false ) {
1967
+		if ('' != $q['tag'] && ! $this->is_singular && $this->query_vars_changed) {
1968
+			if (strpos($q['tag'], ',') !== false) {
1969 1969
 				$tags = preg_split('/[,\r\n\t ]+/', $q['tag']);
1970
-				foreach ( (array) $tags as $tag ) {
1970
+				foreach ((array) $tags as $tag) {
1971 1971
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
1972 1972
 					$q['tag_slug__in'][] = $tag;
1973 1973
 				}
1974
-			} elseif ( preg_match('/[+\r\n\t ]+/', $q['tag'] ) || ! empty( $q['cat'] ) ) {
1974
+			} elseif (preg_match('/[+\r\n\t ]+/', $q['tag']) || ! empty($q['cat'])) {
1975 1975
 				$tags = preg_split('/[+\r\n\t ]+/', $q['tag']);
1976
-				foreach ( (array) $tags as $tag ) {
1976
+				foreach ((array) $tags as $tag) {
1977 1977
 					$tag = sanitize_term_field('slug', $tag, 0, 'post_tag', 'db');
1978 1978
 					$q['tag_slug__and'][] = $tag;
1979 1979
 				}
@@ -1983,24 +1983,24 @@  discard block
 block discarded – undo
1983 1983
 			}
1984 1984
 		}
1985 1985
 
1986
-		if ( !empty($q['tag_id']) ) {
1987
-			$q['tag_id'] = absint( $q['tag_id'] );
1986
+		if ( ! empty($q['tag_id'])) {
1987
+			$q['tag_id'] = absint($q['tag_id']);
1988 1988
 			$tax_query[] = array(
1989 1989
 				'taxonomy' => 'post_tag',
1990 1990
 				'terms' => $q['tag_id']
1991 1991
 			);
1992 1992
 		}
1993 1993
 
1994
-		if ( !empty($q['tag__in']) ) {
1995
-			$q['tag__in'] = array_map('absint', array_unique( (array) $q['tag__in'] ) );
1994
+		if ( ! empty($q['tag__in'])) {
1995
+			$q['tag__in'] = array_map('absint', array_unique((array) $q['tag__in']));
1996 1996
 			$tax_query[] = array(
1997 1997
 				'taxonomy' => 'post_tag',
1998 1998
 				'terms' => $q['tag__in']
1999 1999
 			);
2000 2000
 		}
2001 2001
 
2002
-		if ( !empty($q['tag__not_in']) ) {
2003
-			$q['tag__not_in'] = array_map('absint', array_unique( (array) $q['tag__not_in'] ) );
2002
+		if ( ! empty($q['tag__not_in'])) {
2003
+			$q['tag__not_in'] = array_map('absint', array_unique((array) $q['tag__not_in']));
2004 2004
 			$tax_query[] = array(
2005 2005
 				'taxonomy' => 'post_tag',
2006 2006
 				'terms' => $q['tag__not_in'],
@@ -2008,8 +2008,8 @@  discard block
 block discarded – undo
2008 2008
 			);
2009 2009
 		}
2010 2010
 
2011
-		if ( !empty($q['tag__and']) ) {
2012
-			$q['tag__and'] = array_map('absint', array_unique( (array) $q['tag__and'] ) );
2011
+		if ( ! empty($q['tag__and'])) {
2012
+			$q['tag__and'] = array_map('absint', array_unique((array) $q['tag__and']));
2013 2013
 			$tax_query[] = array(
2014 2014
 				'taxonomy' => 'post_tag',
2015 2015
 				'terms' => $q['tag__and'],
@@ -2017,8 +2017,8 @@  discard block
 block discarded – undo
2017 2017
 			);
2018 2018
 		}
2019 2019
 
2020
-		if ( !empty($q['tag_slug__in']) ) {
2021
-			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__in'] ) );
2020
+		if ( ! empty($q['tag_slug__in'])) {
2021
+			$q['tag_slug__in'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__in']));
2022 2022
 			$tax_query[] = array(
2023 2023
 				'taxonomy' => 'post_tag',
2024 2024
 				'terms' => $q['tag_slug__in'],
@@ -2026,8 +2026,8 @@  discard block
 block discarded – undo
2026 2026
 			);
2027 2027
 		}
2028 2028
 
2029
-		if ( !empty($q['tag_slug__and']) ) {
2030
-			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique( (array) $q['tag_slug__and'] ) );
2029
+		if ( ! empty($q['tag_slug__and'])) {
2030
+			$q['tag_slug__and'] = array_map('sanitize_title_for_query', array_unique((array) $q['tag_slug__and']));
2031 2031
 			$tax_query[] = array(
2032 2032
 				'taxonomy' => 'post_tag',
2033 2033
 				'terms' => $q['tag_slug__and'],
@@ -2036,7 +2036,7 @@  discard block
 block discarded – undo
2036 2036
 			);
2037 2037
 		}
2038 2038
 
2039
-		$this->tax_query = new WP_Tax_Query( $tax_query );
2039
+		$this->tax_query = new WP_Tax_Query($tax_query);
2040 2040
 
2041 2041
 		/**
2042 2042
 		 * Fires after taxonomy-related query vars have been parsed.
@@ -2045,7 +2045,7 @@  discard block
 block discarded – undo
2045 2045
 		 *
2046 2046
 		 * @param WP_Query $this The WP_Query instance.
2047 2047
 		 */
2048
-		do_action( 'parse_tax_query', $this );
2048
+		do_action('parse_tax_query', $this);
2049 2049
 	}
2050 2050
 
2051 2051
 	/**
@@ -2057,49 +2057,49 @@  discard block
 block discarded – undo
2057 2057
 	 * @param array $q Query variables.
2058 2058
 	 * @return string WHERE clause.
2059 2059
 	 */
2060
-	protected function parse_search( &$q ) {
2060
+	protected function parse_search(&$q) {
2061 2061
 		global $wpdb;
2062 2062
 
2063 2063
 		$search = '';
2064 2064
 
2065 2065
 		// added slashes screw with quote grouping when done early, so done later
2066
-		$q['s'] = stripslashes( $q['s'] );
2067
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
2068
-			$q['s'] = urldecode( $q['s'] );
2066
+		$q['s'] = stripslashes($q['s']);
2067
+		if (empty($_GET['s']) && $this->is_main_query())
2068
+			$q['s'] = urldecode($q['s']);
2069 2069
 		// there are no line breaks in <input /> fields
2070
-		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
2070
+		$q['s'] = str_replace(array("\r", "\n"), '', $q['s']);
2071 2071
 		$q['search_terms_count'] = 1;
2072
-		if ( ! empty( $q['sentence'] ) ) {
2073
-			$q['search_terms'] = array( $q['s'] );
2072
+		if ( ! empty($q['sentence'])) {
2073
+			$q['search_terms'] = array($q['s']);
2074 2074
 		} else {
2075
-			if ( preg_match_all( '/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches ) ) {
2076
-				$q['search_terms_count'] = count( $matches[0] );
2077
-				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
2075
+			if (preg_match_all('/".*?("|$)|((?<=[\t ",+])|^)[^\t ",+]+/', $q['s'], $matches)) {
2076
+				$q['search_terms_count'] = count($matches[0]);
2077
+				$q['search_terms'] = $this->parse_search_terms($matches[0]);
2078 2078
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
2079
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
2080
-					$q['search_terms'] = array( $q['s'] );
2079
+				if (empty($q['search_terms']) || count($q['search_terms']) > 9)
2080
+					$q['search_terms'] = array($q['s']);
2081 2081
 			} else {
2082
-				$q['search_terms'] = array( $q['s'] );
2082
+				$q['search_terms'] = array($q['s']);
2083 2083
 			}
2084 2084
 		}
2085 2085
 
2086
-		$n = ! empty( $q['exact'] ) ? '' : '%';
2086
+		$n = ! empty($q['exact']) ? '' : '%';
2087 2087
 		$searchand = '';
2088 2088
 		$q['search_orderby_title'] = array();
2089
-		foreach ( $q['search_terms'] as $term ) {
2090
-			if ( $n ) {
2091
-				$like = '%' . $wpdb->esc_like( $term ) . '%';
2092
-				$q['search_orderby_title'][] = $wpdb->prepare( "$wpdb->posts.post_title LIKE %s", $like );
2089
+		foreach ($q['search_terms'] as $term) {
2090
+			if ($n) {
2091
+				$like = '%'.$wpdb->esc_like($term).'%';
2092
+				$q['search_orderby_title'][] = $wpdb->prepare("$wpdb->posts.post_title LIKE %s", $like);
2093 2093
 			}
2094 2094
 
2095
-			$like = $n . $wpdb->esc_like( $term ) . $n;
2096
-			$search .= $wpdb->prepare( "{$searchand}(($wpdb->posts.post_title LIKE %s) OR ($wpdb->posts.post_content LIKE %s))", $like, $like );
2095
+			$like = $n.$wpdb->esc_like($term).$n;
2096
+			$search .= $wpdb->prepare("{$searchand}(($wpdb->posts.post_title LIKE %s) OR ($wpdb->posts.post_content LIKE %s))", $like, $like);
2097 2097
 			$searchand = ' AND ';
2098 2098
 		}
2099 2099
 
2100
-		if ( ! empty( $search ) ) {
2100
+		if ( ! empty($search)) {
2101 2101
 			$search = " AND ({$search}) ";
2102
-			if ( ! is_user_logged_in() )
2102
+			if ( ! is_user_logged_in())
2103 2103
 				$search .= " AND ($wpdb->posts.post_password = '') ";
2104 2104
 		}
2105 2105
 
@@ -2118,24 +2118,24 @@  discard block
 block discarded – undo
2118 2118
 	 * @param array $terms Terms to check.
2119 2119
 	 * @return array Terms that are not stopwords.
2120 2120
 	 */
2121
-	protected function parse_search_terms( $terms ) {
2122
-		$strtolower = function_exists( 'mb_strtolower' ) ? 'mb_strtolower' : 'strtolower';
2121
+	protected function parse_search_terms($terms) {
2122
+		$strtolower = function_exists('mb_strtolower') ? 'mb_strtolower' : 'strtolower';
2123 2123
 		$checked = array();
2124 2124
 
2125 2125
 		$stopwords = $this->get_search_stopwords();
2126 2126
 
2127
-		foreach ( $terms as $term ) {
2127
+		foreach ($terms as $term) {
2128 2128
 			// keep before/after spaces when term is for exact match
2129
-			if ( preg_match( '/^".+"$/', $term ) )
2130
-				$term = trim( $term, "\"'" );
2129
+			if (preg_match('/^".+"$/', $term))
2130
+				$term = trim($term, "\"'");
2131 2131
 			else
2132
-				$term = trim( $term, "\"' " );
2132
+				$term = trim($term, "\"' ");
2133 2133
 
2134 2134
 			// Avoid single A-Z.
2135
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) )
2135
+			if ( ! $term || (1 === strlen($term) && preg_match('/^[a-z]$/i', $term)))
2136 2136
 				continue;
2137 2137
 
2138
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
2138
+			if (in_array(call_user_func($strtolower, $term), $stopwords, true))
2139 2139
 				continue;
2140 2140
 
2141 2141
 			$checked[] = $term;
@@ -2152,20 +2152,20 @@  discard block
 block discarded – undo
2152 2152
 	 * @return array Stopwords.
2153 2153
 	 */
2154 2154
 	protected function get_search_stopwords() {
2155
-		if ( isset( $this->stopwords ) )
2155
+		if (isset($this->stopwords))
2156 2156
 			return $this->stopwords;
2157 2157
 
2158 2158
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
2159 2159
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
2160 2160
 		 * words into your language. Instead, look for and provide commonly accepted stopwords in your language.
2161 2161
 		 */
2162
-		$words = explode( ',', _x( 'about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
2163
-			'Comma-separated list of search stopwords in your language' ) );
2162
+		$words = explode(',', _x('about,an,are,as,at,be,by,com,for,from,how,in,is,it,of,on,or,that,the,this,to,was,what,when,where,who,will,with,www',
2163
+			'Comma-separated list of search stopwords in your language'));
2164 2164
 
2165 2165
 		$stopwords = array();
2166
-		foreach( $words as $word ) {
2167
-			$word = trim( $word, "\r\n\t " );
2168
-			if ( $word )
2166
+		foreach ($words as $word) {
2167
+			$word = trim($word, "\r\n\t ");
2168
+			if ($word)
2169 2169
 				$stopwords[] = $word;
2170 2170
 		}
2171 2171
 
@@ -2176,7 +2176,7 @@  discard block
 block discarded – undo
2176 2176
 		 *
2177 2177
 		 * @param array $stopwords Stopwords.
2178 2178
 		 */
2179
-		$this->stopwords = apply_filters( 'wp_search_stopwords', $stopwords );
2179
+		$this->stopwords = apply_filters('wp_search_stopwords', $stopwords);
2180 2180
 		return $this->stopwords;
2181 2181
 	}
2182 2182
 
@@ -2188,33 +2188,33 @@  discard block
 block discarded – undo
2188 2188
 	 * @param array $q Query variables.
2189 2189
 	 * @return string ORDER BY clause.
2190 2190
 	 */
2191
-	protected function parse_search_order( &$q ) {
2191
+	protected function parse_search_order(&$q) {
2192 2192
 		global $wpdb;
2193 2193
 
2194
-		if ( $q['search_terms_count'] > 1 ) {
2195
-			$num_terms = count( $q['search_orderby_title'] );
2196
-			$like = '%' . $wpdb->esc_like( $q['s'] ) . '%';
2194
+		if ($q['search_terms_count'] > 1) {
2195
+			$num_terms = count($q['search_orderby_title']);
2196
+			$like = '%'.$wpdb->esc_like($q['s']).'%';
2197 2197
 
2198 2198
 			$search_orderby = '(CASE ';
2199 2199
 			// sentence match in 'post_title'
2200
-			$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like );
2200
+			$search_orderby .= $wpdb->prepare("WHEN $wpdb->posts.post_title LIKE %s THEN 1 ", $like);
2201 2201
 
2202 2202
 			// sanity limit, sort as sentence when more than 6 terms
2203 2203
 			// (few searches are longer than 6 terms and most titles are not)
2204
-			if ( $num_terms < 7 ) {
2204
+			if ($num_terms < 7) {
2205 2205
 				// all words in title
2206
-				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
2206
+				$search_orderby .= 'WHEN '.implode(' AND ', $q['search_orderby_title']).' THEN 2 ';
2207 2207
 				// any word in title, not needed when $num_terms == 1
2208
-				if ( $num_terms > 1 )
2209
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2208
+				if ($num_terms > 1)
2209
+					$search_orderby .= 'WHEN '.implode(' OR ', $q['search_orderby_title']).' THEN 3 ';
2210 2210
 			}
2211 2211
 
2212 2212
 			// sentence match in 'post_content'
2213
-			$search_orderby .= $wpdb->prepare( "WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like );
2213
+			$search_orderby .= $wpdb->prepare("WHEN $wpdb->posts.post_content LIKE %s THEN 4 ", $like);
2214 2214
 			$search_orderby .= 'ELSE 5 END)';
2215 2215
 		} else {
2216 2216
 			// single word or sentence search
2217
-			$search_orderby = reset( $q['search_orderby_title'] ) . ' DESC';
2217
+			$search_orderby = reset($q['search_orderby_title']).' DESC';
2218 2218
 		}
2219 2219
 
2220 2220
 		return $search_orderby;
@@ -2232,7 +2232,7 @@  discard block
 block discarded – undo
2232 2232
 	 * @param string $orderby Alias for the field to order by.
2233 2233
 	 * @return string|false Table-prefixed value to used in the ORDER clause. False otherwise.
2234 2234
 	 */
2235
-	protected function parse_orderby( $orderby ) {
2235
+	protected function parse_orderby($orderby) {
2236 2236
 		global $wpdb;
2237 2237
 
2238 2238
 		// Used to filter values.
@@ -2245,24 +2245,24 @@  discard block
 block discarded – undo
2245 2245
 		$primary_meta_key = '';
2246 2246
 		$primary_meta_query = false;
2247 2247
 		$meta_clauses = $this->meta_query->get_clauses();
2248
-		if ( ! empty( $meta_clauses ) ) {
2249
-			$primary_meta_query = reset( $meta_clauses );
2248
+		if ( ! empty($meta_clauses)) {
2249
+			$primary_meta_query = reset($meta_clauses);
2250 2250
 
2251
-			if ( ! empty( $primary_meta_query['key'] ) ) {
2251
+			if ( ! empty($primary_meta_query['key'])) {
2252 2252
 				$primary_meta_key = $primary_meta_query['key'];
2253 2253
 				$allowed_keys[] = $primary_meta_key;
2254 2254
 			}
2255 2255
 
2256 2256
 			$allowed_keys[] = 'meta_value';
2257 2257
 			$allowed_keys[] = 'meta_value_num';
2258
-			$allowed_keys   = array_merge( $allowed_keys, array_keys( $meta_clauses ) );
2258
+			$allowed_keys   = array_merge($allowed_keys, array_keys($meta_clauses));
2259 2259
 		}
2260 2260
 
2261
-		if ( ! in_array( $orderby, $allowed_keys ) ) {
2261
+		if ( ! in_array($orderby, $allowed_keys)) {
2262 2262
 			return false;
2263 2263
 		}
2264 2264
 
2265
-		switch ( $orderby ) {
2265
+		switch ($orderby) {
2266 2266
 			case 'post_name':
2267 2267
 			case 'post_author':
2268 2268
 			case 'post_date':
@@ -2280,7 +2280,7 @@  discard block
 block discarded – undo
2280 2280
 				break;
2281 2281
 			case $primary_meta_key:
2282 2282
 			case 'meta_value':
2283
-				if ( ! empty( $primary_meta_query['type'] ) ) {
2283
+				if ( ! empty($primary_meta_query['type'])) {
2284 2284
 					$orderby_clause = "CAST({$primary_meta_query['alias']}.meta_value AS {$primary_meta_query['cast']})";
2285 2285
 				} else {
2286 2286
 					$orderby_clause = "{$primary_meta_query['alias']}.meta_value";
@@ -2290,13 +2290,13 @@  discard block
 block discarded – undo
2290 2290
 				$orderby_clause = "{$primary_meta_query['alias']}.meta_value+0";
2291 2291
 				break;
2292 2292
 			default:
2293
-				if ( array_key_exists( $orderby, $meta_clauses ) ) {
2293
+				if (array_key_exists($orderby, $meta_clauses)) {
2294 2294
 					// $orderby corresponds to a meta_query clause.
2295
-					$meta_clause = $meta_clauses[ $orderby ];
2295
+					$meta_clause = $meta_clauses[$orderby];
2296 2296
 					$orderby_clause = "CAST({$meta_clause['alias']}.meta_value AS {$meta_clause['cast']})";
2297 2297
 				} else {
2298 2298
 					// Default: order by post field.
2299
-					$orderby_clause = "$wpdb->posts.post_" . sanitize_key( $orderby );
2299
+					$orderby_clause = "$wpdb->posts.post_".sanitize_key($orderby);
2300 2300
 				}
2301 2301
 
2302 2302
 				break;
@@ -2314,12 +2314,12 @@  discard block
 block discarded – undo
2314 2314
 	 * @param string $order The 'order' query variable.
2315 2315
 	 * @return string The sanitized 'order' query variable.
2316 2316
 	 */
2317
-	protected function parse_order( $order ) {
2318
-		if ( ! is_string( $order ) || empty( $order ) ) {
2317
+	protected function parse_order($order) {
2318
+		if ( ! is_string($order) || empty($order)) {
2319 2319
 			return 'DESC';
2320 2320
 		}
2321 2321
 
2322
-		if ( 'ASC' === strtoupper( $order ) ) {
2322
+		if ('ASC' === strtoupper($order)) {
2323 2323
 			return 'ASC';
2324 2324
 		} else {
2325 2325
 			return 'DESC';
@@ -2351,9 +2351,9 @@  discard block
 block discarded – undo
2351 2351
 	 * @param mixed  $default   Value to return if the query variable is not set. Default ''.
2352 2352
 	 * @return mixed
2353 2353
 	 */
2354
-	public function get( $query_var, $default = '' ) {
2355
-		if ( isset( $this->query_vars[ $query_var ] ) ) {
2356
-			return $this->query_vars[ $query_var ];
2354
+	public function get($query_var, $default = '') {
2355
+		if (isset($this->query_vars[$query_var])) {
2356
+			return $this->query_vars[$query_var];
2357 2357
 		}
2358 2358
 
2359 2359
 		return $default;
@@ -2401,7 +2401,7 @@  discard block
 block discarded – undo
2401 2401
 		 *
2402 2402
 		 * @param WP_Query &$this The WP_Query instance (passed by reference).
2403 2403
 		 */
2404
-		do_action_ref_array( 'pre_get_posts', array( &$this ) );
2404
+		do_action_ref_array('pre_get_posts', array(&$this));
2405 2405
 
2406 2406
 		// Shorthand.
2407 2407
 		$q = &$this->query_vars;
@@ -2411,11 +2411,11 @@  discard block
 block discarded – undo
2411 2411
 
2412 2412
 		// Parse meta query
2413 2413
 		$this->meta_query = new WP_Meta_Query();
2414
-		$this->meta_query->parse_query_vars( $q );
2414
+		$this->meta_query->parse_query_vars($q);
2415 2415
 
2416 2416
 		// Set a flag if a pre_get_posts hook changed the query vars.
2417
-		$hash = md5( serialize( $this->query_vars ) );
2418
-		if ( $hash != $this->query_vars_hash ) {
2417
+		$hash = md5(serialize($this->query_vars));
2418
+		if ($hash != $this->query_vars_hash) {
2419 2419
 			$this->query_vars_changed = true;
2420 2420
 			$this->query_vars_hash = $hash;
2421 2421
 		}
@@ -2433,91 +2433,91 @@  discard block
 block discarded – undo
2433 2433
 		$post_status_join = false;
2434 2434
 		$page = 1;
2435 2435
 
2436
-		if ( isset( $q['caller_get_posts'] ) ) {
2437
-			_deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
2438
-			if ( !isset( $q['ignore_sticky_posts'] ) )
2436
+		if (isset($q['caller_get_posts'])) {
2437
+			_deprecated_argument('WP_Query', '3.1', __('"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.'));
2438
+			if ( ! isset($q['ignore_sticky_posts']))
2439 2439
 				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2440 2440
 		}
2441 2441
 
2442
-		if ( !isset( $q['ignore_sticky_posts'] ) )
2442
+		if ( ! isset($q['ignore_sticky_posts']))
2443 2443
 			$q['ignore_sticky_posts'] = false;
2444 2444
 
2445
-		if ( !isset($q['suppress_filters']) )
2445
+		if ( ! isset($q['suppress_filters']))
2446 2446
 			$q['suppress_filters'] = false;
2447 2447
 
2448
-		if ( !isset($q['cache_results']) ) {
2449
-			if ( wp_using_ext_object_cache() )
2448
+		if ( ! isset($q['cache_results'])) {
2449
+			if (wp_using_ext_object_cache())
2450 2450
 				$q['cache_results'] = false;
2451 2451
 			else
2452 2452
 				$q['cache_results'] = true;
2453 2453
 		}
2454 2454
 
2455
-		if ( !isset($q['update_post_term_cache']) )
2455
+		if ( ! isset($q['update_post_term_cache']))
2456 2456
 			$q['update_post_term_cache'] = true;
2457 2457
 
2458
-		if ( !isset($q['update_post_meta_cache']) )
2458
+		if ( ! isset($q['update_post_meta_cache']))
2459 2459
 			$q['update_post_meta_cache'] = true;
2460 2460
 
2461
-		if ( !isset($q['post_type']) ) {
2462
-			if ( $this->is_search )
2461
+		if ( ! isset($q['post_type'])) {
2462
+			if ($this->is_search)
2463 2463
 				$q['post_type'] = 'any';
2464 2464
 			else
2465 2465
 				$q['post_type'] = '';
2466 2466
 		}
2467 2467
 		$post_type = $q['post_type'];
2468
-		if ( empty( $q['posts_per_page'] ) ) {
2469
-			$q['posts_per_page'] = get_option( 'posts_per_page' );
2468
+		if (empty($q['posts_per_page'])) {
2469
+			$q['posts_per_page'] = get_option('posts_per_page');
2470 2470
 		}
2471
-		if ( isset($q['showposts']) && $q['showposts'] ) {
2471
+		if (isset($q['showposts']) && $q['showposts']) {
2472 2472
 			$q['showposts'] = (int) $q['showposts'];
2473 2473
 			$q['posts_per_page'] = $q['showposts'];
2474 2474
 		}
2475
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
2475
+		if ((isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search))
2476 2476
 			$q['posts_per_page'] = $q['posts_per_archive_page'];
2477
-		if ( !isset($q['nopaging']) ) {
2478
-			if ( $q['posts_per_page'] == -1 ) {
2477
+		if ( ! isset($q['nopaging'])) {
2478
+			if ($q['posts_per_page'] == -1) {
2479 2479
 				$q['nopaging'] = true;
2480 2480
 			} else {
2481 2481
 				$q['nopaging'] = false;
2482 2482
 			}
2483 2483
 		}
2484 2484
 
2485
-		if ( $this->is_feed ) {
2485
+		if ($this->is_feed) {
2486 2486
 			// This overrides posts_per_page.
2487
-			if ( ! empty( $q['posts_per_rss'] ) ) {
2487
+			if ( ! empty($q['posts_per_rss'])) {
2488 2488
 				$q['posts_per_page'] = $q['posts_per_rss'];
2489 2489
 			} else {
2490
-				$q['posts_per_page'] = get_option( 'posts_per_rss' );
2490
+				$q['posts_per_page'] = get_option('posts_per_rss');
2491 2491
 			}
2492 2492
 			$q['nopaging'] = false;
2493 2493
 		}
2494 2494
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
2495
-		if ( $q['posts_per_page'] < -1 )
2495
+		if ($q['posts_per_page'] < -1)
2496 2496
 			$q['posts_per_page'] = abs($q['posts_per_page']);
2497
-		elseif ( $q['posts_per_page'] == 0 )
2497
+		elseif ($q['posts_per_page'] == 0)
2498 2498
 			$q['posts_per_page'] = 1;
2499 2499
 
2500
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
2500
+		if ( ! isset($q['comments_per_page']) || $q['comments_per_page'] == 0)
2501 2501
 			$q['comments_per_page'] = get_option('comments_per_page');
2502 2502
 
2503
-		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
2503
+		if ($this->is_home && (empty($this->query) || $q['preview'] == 'true') && ('page' == get_option('show_on_front')) && get_option('page_on_front')) {
2504 2504
 			$this->is_page = true;
2505 2505
 			$this->is_home = false;
2506 2506
 			$q['page_id'] = get_option('page_on_front');
2507 2507
 		}
2508 2508
 
2509
-		if ( isset($q['page']) ) {
2509
+		if (isset($q['page'])) {
2510 2510
 			$q['page'] = trim($q['page'], '/');
2511 2511
 			$q['page'] = absint($q['page']);
2512 2512
 		}
2513 2513
 
2514 2514
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
2515
-		if ( isset($q['no_found_rows']) )
2515
+		if (isset($q['no_found_rows']))
2516 2516
 			$q['no_found_rows'] = (bool) $q['no_found_rows'];
2517 2517
 		else
2518 2518
 			$q['no_found_rows'] = false;
2519 2519
 
2520
-		switch ( $q['fields'] ) {
2520
+		switch ($q['fields']) {
2521 2521
 			case 'ids':
2522 2522
 				$fields = "$wpdb->posts.ID";
2523 2523
 				break;
@@ -2528,74 +2528,74 @@  discard block
 block discarded – undo
2528 2528
 				$fields = "$wpdb->posts.*";
2529 2529
 		}
2530 2530
 
2531
-		if ( '' !== $q['menu_order'] )
2532
-			$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2531
+		if ('' !== $q['menu_order'])
2532
+			$where .= " AND $wpdb->posts.menu_order = ".$q['menu_order'];
2533 2533
 
2534 2534
 		// The "m" parameter is meant for months but accepts datetimes of varying specificity
2535
-		if ( $q['m'] ) {
2536
-			$where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4);
2537
-			if ( strlen($q['m']) > 5 )
2538
-				$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2539
-			if ( strlen($q['m']) > 7 )
2540
-				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2541
-			if ( strlen($q['m']) > 9 )
2542
-				$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2543
-			if ( strlen($q['m']) > 11 )
2544
-				$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2545
-			if ( strlen($q['m']) > 13 )
2546
-				$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2535
+		if ($q['m']) {
2536
+			$where .= " AND YEAR($wpdb->posts.post_date)=".substr($q['m'], 0, 4);
2537
+			if (strlen($q['m']) > 5)
2538
+				$where .= " AND MONTH($wpdb->posts.post_date)=".substr($q['m'], 4, 2);
2539
+			if (strlen($q['m']) > 7)
2540
+				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=".substr($q['m'], 6, 2);
2541
+			if (strlen($q['m']) > 9)
2542
+				$where .= " AND HOUR($wpdb->posts.post_date)=".substr($q['m'], 8, 2);
2543
+			if (strlen($q['m']) > 11)
2544
+				$where .= " AND MINUTE($wpdb->posts.post_date)=".substr($q['m'], 10, 2);
2545
+			if (strlen($q['m']) > 13)
2546
+				$where .= " AND SECOND($wpdb->posts.post_date)=".substr($q['m'], 12, 2);
2547 2547
 		}
2548 2548
 
2549 2549
 		// Handle the other individual date parameters
2550 2550
 		$date_parameters = array();
2551 2551
 
2552
-		if ( '' !== $q['hour'] )
2552
+		if ('' !== $q['hour'])
2553 2553
 			$date_parameters['hour'] = $q['hour'];
2554 2554
 
2555
-		if ( '' !== $q['minute'] )
2555
+		if ('' !== $q['minute'])
2556 2556
 			$date_parameters['minute'] = $q['minute'];
2557 2557
 
2558
-		if ( '' !== $q['second'] )
2558
+		if ('' !== $q['second'])
2559 2559
 			$date_parameters['second'] = $q['second'];
2560 2560
 
2561
-		if ( $q['year'] )
2561
+		if ($q['year'])
2562 2562
 			$date_parameters['year'] = $q['year'];
2563 2563
 
2564
-		if ( $q['monthnum'] )
2564
+		if ($q['monthnum'])
2565 2565
 			$date_parameters['monthnum'] = $q['monthnum'];
2566 2566
 
2567
-		if ( $q['w'] )
2567
+		if ($q['w'])
2568 2568
 			$date_parameters['week'] = $q['w'];
2569 2569
 
2570
-		if ( $q['day'] )
2570
+		if ($q['day'])
2571 2571
 			$date_parameters['day'] = $q['day'];
2572 2572
 
2573
-		if ( $date_parameters ) {
2574
-			$date_query = new WP_Date_Query( array( $date_parameters ) );
2573
+		if ($date_parameters) {
2574
+			$date_query = new WP_Date_Query(array($date_parameters));
2575 2575
 			$where .= $date_query->get_sql();
2576 2576
 		}
2577
-		unset( $date_parameters, $date_query );
2577
+		unset($date_parameters, $date_query);
2578 2578
 
2579 2579
 		// Handle complex date queries
2580
-		if ( ! empty( $q['date_query'] ) ) {
2581
-			$this->date_query = new WP_Date_Query( $q['date_query'] );
2580
+		if ( ! empty($q['date_query'])) {
2581
+			$this->date_query = new WP_Date_Query($q['date_query']);
2582 2582
 			$where .= $this->date_query->get_sql();
2583 2583
 		}
2584 2584
 
2585 2585
 
2586 2586
 		// If we've got a post_type AND it's not "any" post_type.
2587
-		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
2588
-			foreach ( (array)$q['post_type'] as $_post_type ) {
2587
+		if ( ! empty($q['post_type']) && 'any' != $q['post_type']) {
2588
+			foreach ((array) $q['post_type'] as $_post_type) {
2589 2589
 				$ptype_obj = get_post_type_object($_post_type);
2590
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
2590
+				if ( ! $ptype_obj || ! $ptype_obj->query_var || empty($q[$ptype_obj->query_var]))
2591 2591
 					continue;
2592 2592
 
2593
-				if ( ! $ptype_obj->hierarchical ) {
2593
+				if ( ! $ptype_obj->hierarchical) {
2594 2594
 					// Non-hierarchical post types can directly use 'name'.
2595
-					$q['name'] = $q[ $ptype_obj->query_var ];
2595
+					$q['name'] = $q[$ptype_obj->query_var];
2596 2596
 				} else {
2597 2597
 					// Hierarchical post types will operate through 'pagename'.
2598
-					$q['pagename'] = $q[ $ptype_obj->query_var ];
2598
+					$q['pagename'] = $q[$ptype_obj->query_var];
2599 2599
 					$q['name'] = '';
2600 2600
 				}
2601 2601
 
@@ -2606,93 +2606,93 @@  discard block
 block discarded – undo
2606 2606
 		}
2607 2607
 
2608 2608
 		// Parameters related to 'post_name'.
2609
-		if ( '' != $q['name'] ) {
2610
-			$q['name'] = sanitize_title_for_query( $q['name'] );
2611
-			$where .= " AND $wpdb->posts.post_name = '" . $q['name'] . "'";
2612
-		} elseif ( '' != $q['pagename'] ) {
2613
-			if ( isset($this->queried_object_id) ) {
2609
+		if ('' != $q['name']) {
2610
+			$q['name'] = sanitize_title_for_query($q['name']);
2611
+			$where .= " AND $wpdb->posts.post_name = '".$q['name']."'";
2612
+		} elseif ('' != $q['pagename']) {
2613
+			if (isset($this->queried_object_id)) {
2614 2614
 				$reqpage = $this->queried_object_id;
2615 2615
 			} else {
2616
-				if ( 'page' != $q['post_type'] ) {
2617
-					foreach ( (array)$q['post_type'] as $_post_type ) {
2616
+				if ('page' != $q['post_type']) {
2617
+					foreach ((array) $q['post_type'] as $_post_type) {
2618 2618
 						$ptype_obj = get_post_type_object($_post_type);
2619
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
2619
+						if ( ! $ptype_obj || ! $ptype_obj->hierarchical)
2620 2620
 							continue;
2621 2621
 
2622 2622
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
2623
-						if ( $reqpage )
2623
+						if ($reqpage)
2624 2624
 							break;
2625 2625
 					}
2626 2626
 					unset($ptype_obj);
2627 2627
 				} else {
2628 2628
 					$reqpage = get_page_by_path($q['pagename']);
2629 2629
 				}
2630
-				if ( !empty($reqpage) )
2630
+				if ( ! empty($reqpage))
2631 2631
 					$reqpage = $reqpage->ID;
2632 2632
 				else
2633 2633
 					$reqpage = 0;
2634 2634
 			}
2635 2635
 
2636 2636
 			$page_for_posts = get_option('page_for_posts');
2637
-			if  ( ('page' != get_option('show_on_front') ) || empty($page_for_posts) || ( $reqpage != $page_for_posts ) ) {
2638
-				$q['pagename'] = sanitize_title_for_query( wp_basename( $q['pagename'] ) );
2637
+			if (('page' != get_option('show_on_front')) || empty($page_for_posts) || ($reqpage != $page_for_posts)) {
2638
+				$q['pagename'] = sanitize_title_for_query(wp_basename($q['pagename']));
2639 2639
 				$q['name'] = $q['pagename'];
2640 2640
 				$where .= " AND ($wpdb->posts.ID = '$reqpage')";
2641
-				$reqpage_obj = get_post( $reqpage );
2642
-				if ( is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type ) {
2641
+				$reqpage_obj = get_post($reqpage);
2642
+				if (is_object($reqpage_obj) && 'attachment' == $reqpage_obj->post_type) {
2643 2643
 					$this->is_attachment = true;
2644 2644
 					$post_type = $q['post_type'] = 'attachment';
2645 2645
 					$this->is_page = true;
2646 2646
 					$q['attachment_id'] = $reqpage;
2647 2647
 				}
2648 2648
 			}
2649
-		} elseif ( '' != $q['attachment'] ) {
2650
-			$q['attachment'] = sanitize_title_for_query( wp_basename( $q['attachment'] ) );
2649
+		} elseif ('' != $q['attachment']) {
2650
+			$q['attachment'] = sanitize_title_for_query(wp_basename($q['attachment']));
2651 2651
 			$q['name'] = $q['attachment'];
2652
-			$where .= " AND $wpdb->posts.post_name = '" . $q['attachment'] . "'";
2653
-		} elseif ( is_array( $q['post_name__in'] ) && ! empty( $q['post_name__in'] ) ) {
2654
-			$q['post_name__in'] = array_map( 'sanitize_title_for_query', $q['post_name__in'] );
2655
-			$where .= " AND $wpdb->posts.post_name IN ('" . implode( "' ,'", $q['post_name__in'] ) . "')";
2652
+			$where .= " AND $wpdb->posts.post_name = '".$q['attachment']."'";
2653
+		} elseif (is_array($q['post_name__in']) && ! empty($q['post_name__in'])) {
2654
+			$q['post_name__in'] = array_map('sanitize_title_for_query', $q['post_name__in']);
2655
+			$where .= " AND $wpdb->posts.post_name IN ('".implode("' ,'", $q['post_name__in'])."')";
2656 2656
 		}
2657 2657
 
2658
-		if ( intval($q['comments_popup']) )
2658
+		if (intval($q['comments_popup']))
2659 2659
 			$q['p'] = absint($q['comments_popup']);
2660 2660
 
2661 2661
 		// If an attachment is requested by number, let it supersede any post number.
2662
-		if ( $q['attachment_id'] )
2662
+		if ($q['attachment_id'])
2663 2663
 			$q['p'] = absint($q['attachment_id']);
2664 2664
 
2665 2665
 		// If a post number is specified, load that post
2666
-		if ( $q['p'] ) {
2667
-			$where .= " AND {$wpdb->posts}.ID = " . $q['p'];
2668
-		} elseif ( $q['post__in'] ) {
2669
-			$post__in = implode(',', array_map( 'absint', $q['post__in'] ));
2666
+		if ($q['p']) {
2667
+			$where .= " AND {$wpdb->posts}.ID = ".$q['p'];
2668
+		} elseif ($q['post__in']) {
2669
+			$post__in = implode(',', array_map('absint', $q['post__in']));
2670 2670
 			$where .= " AND {$wpdb->posts}.ID IN ($post__in)";
2671
-		} elseif ( $q['post__not_in'] ) {
2672
-			$post__not_in = implode(',',  array_map( 'absint', $q['post__not_in'] ));
2671
+		} elseif ($q['post__not_in']) {
2672
+			$post__not_in = implode(',', array_map('absint', $q['post__not_in']));
2673 2673
 			$where .= " AND {$wpdb->posts}.ID NOT IN ($post__not_in)";
2674 2674
 		}
2675 2675
 
2676
-		if ( is_numeric( $q['post_parent'] ) ) {
2677
-			$where .= $wpdb->prepare( " AND $wpdb->posts.post_parent = %d ", $q['post_parent'] );
2678
-		} elseif ( $q['post_parent__in'] ) {
2679
-			$post_parent__in = implode( ',', array_map( 'absint', $q['post_parent__in'] ) );
2676
+		if (is_numeric($q['post_parent'])) {
2677
+			$where .= $wpdb->prepare(" AND $wpdb->posts.post_parent = %d ", $q['post_parent']);
2678
+		} elseif ($q['post_parent__in']) {
2679
+			$post_parent__in = implode(',', array_map('absint', $q['post_parent__in']));
2680 2680
 			$where .= " AND {$wpdb->posts}.post_parent IN ($post_parent__in)";
2681
-		} elseif ( $q['post_parent__not_in'] ) {
2682
-			$post_parent__not_in = implode( ',',  array_map( 'absint', $q['post_parent__not_in'] ) );
2681
+		} elseif ($q['post_parent__not_in']) {
2682
+			$post_parent__not_in = implode(',', array_map('absint', $q['post_parent__not_in']));
2683 2683
 			$where .= " AND {$wpdb->posts}.post_parent NOT IN ($post_parent__not_in)";
2684 2684
 		}
2685 2685
 
2686
-		if ( $q['page_id'] ) {
2687
-			if  ( ('page' != get_option('show_on_front') ) || ( $q['page_id'] != get_option('page_for_posts') ) ) {
2686
+		if ($q['page_id']) {
2687
+			if (('page' != get_option('show_on_front')) || ($q['page_id'] != get_option('page_for_posts'))) {
2688 2688
 				$q['p'] = $q['page_id'];
2689
-				$where = " AND {$wpdb->posts}.ID = " . $q['page_id'];
2689
+				$where = " AND {$wpdb->posts}.ID = ".$q['page_id'];
2690 2690
 			}
2691 2691
 		}
2692 2692
 
2693 2693
 		// If a search pattern is specified, load the posts that match.
2694
-		if ( ! empty( $q['s'] ) ) {
2695
-			$search = $this->parse_search( $q );
2694
+		if ( ! empty($q['s'])) {
2695
+			$search = $this->parse_search($q);
2696 2696
 		}
2697 2697
 
2698 2698
 		/**
@@ -2703,35 +2703,35 @@  discard block
 block discarded – undo
2703 2703
 		 * @param string   $search Search SQL for WHERE clause.
2704 2704
 		 * @param WP_Query $this   The current WP_Query object.
2705 2705
 		 */
2706
-		$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );
2706
+		$search = apply_filters_ref_array('posts_search', array($search, &$this));
2707 2707
 
2708 2708
 		// Taxonomies
2709
-		if ( !$this->is_singular ) {
2710
-			$this->parse_tax_query( $q );
2709
+		if ( ! $this->is_singular) {
2710
+			$this->parse_tax_query($q);
2711 2711
 
2712
-			$clauses = $this->tax_query->get_sql( $wpdb->posts, 'ID' );
2712
+			$clauses = $this->tax_query->get_sql($wpdb->posts, 'ID');
2713 2713
 
2714 2714
 			$join .= $clauses['join'];
2715 2715
 			$where .= $clauses['where'];
2716 2716
 		}
2717 2717
 
2718
-		if ( $this->is_tax ) {
2719
-			if ( empty($post_type) ) {
2718
+		if ($this->is_tax) {
2719
+			if (empty($post_type)) {
2720 2720
 				// Do a fully inclusive search for currently registered post types of queried taxonomies
2721 2721
 				$post_type = array();
2722
-				$taxonomies = array_keys( $this->tax_query->queried_terms );
2723
-				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2724
-					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2725
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2722
+				$taxonomies = array_keys($this->tax_query->queried_terms);
2723
+				foreach (get_post_types(array('exclude_from_search' => false)) as $pt) {
2724
+					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies($pt);
2725
+					if (array_intersect($taxonomies, $object_taxonomies))
2726 2726
 						$post_type[] = $pt;
2727 2727
 				}
2728
-				if ( ! $post_type )
2728
+				if ( ! $post_type)
2729 2729
 					$post_type = 'any';
2730
-				elseif ( count( $post_type ) == 1 )
2730
+				elseif (count($post_type) == 1)
2731 2731
 					$post_type = $post_type[0];
2732 2732
 
2733 2733
 				$post_status_join = true;
2734
-			} elseif ( in_array('attachment', (array) $post_type) ) {
2734
+			} elseif (in_array('attachment', (array) $post_type)) {
2735 2735
 				$post_status_join = true;
2736 2736
 			}
2737 2737
 		}
@@ -2740,22 +2740,22 @@  discard block
 block discarded – undo
2740 2740
 		 * Ensure that 'taxonomy', 'term', 'term_id', 'cat', and
2741 2741
 		 * 'category_name' vars are set for backward compatibility.
2742 2742
 		 */
2743
-		if ( ! empty( $this->tax_query->queried_terms ) ) {
2743
+		if ( ! empty($this->tax_query->queried_terms)) {
2744 2744
 
2745 2745
 			/*
2746 2746
 			 * Set 'taxonomy', 'term', and 'term_id' to the
2747 2747
 			 * first taxonomy other than 'post_tag' or 'category'.
2748 2748
 			 */
2749
-			if ( ! isset( $q['taxonomy'] ) ) {
2750
-				foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2751
-					if ( empty( $queried_items['terms'][0] ) ) {
2749
+			if ( ! isset($q['taxonomy'])) {
2750
+				foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2751
+					if (empty($queried_items['terms'][0])) {
2752 2752
 						continue;
2753 2753
 					}
2754 2754
 
2755
-					if ( ! in_array( $queried_taxonomy, array( 'category', 'post_tag' ) ) ) {
2755
+					if ( ! in_array($queried_taxonomy, array('category', 'post_tag'))) {
2756 2756
 						$q['taxonomy'] = $queried_taxonomy;
2757 2757
 
2758
-						if ( 'slug' === $queried_items['field'] ) {
2758
+						if ('slug' === $queried_items['field']) {
2759 2759
 							$q['term'] = $queried_items['terms'][0];
2760 2760
 						} else {
2761 2761
 							$q['term_id'] = $queried_items['terms'][0];
@@ -2765,152 +2765,152 @@  discard block
 block discarded – undo
2765 2765
 			}
2766 2766
 
2767 2767
 			// 'cat', 'category_name', 'tag_id'
2768
-			foreach ( $this->tax_query->queried_terms as $queried_taxonomy => $queried_items ) {
2769
-				if ( empty( $queried_items['terms'][0] ) ) {
2768
+			foreach ($this->tax_query->queried_terms as $queried_taxonomy => $queried_items) {
2769
+				if (empty($queried_items['terms'][0])) {
2770 2770
 					continue;
2771 2771
 				}
2772 2772
 
2773
-				if ( 'category' === $queried_taxonomy ) {
2774
-					$the_cat = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'category' );
2775
-					if ( $the_cat ) {
2776
-						$this->set( 'cat', $the_cat->term_id );
2777
-						$this->set( 'category_name', $the_cat->slug );
2773
+				if ('category' === $queried_taxonomy) {
2774
+					$the_cat = get_term_by($queried_items['field'], $queried_items['terms'][0], 'category');
2775
+					if ($the_cat) {
2776
+						$this->set('cat', $the_cat->term_id);
2777
+						$this->set('category_name', $the_cat->slug);
2778 2778
 					}
2779
-					unset( $the_cat );
2779
+					unset($the_cat);
2780 2780
 				}
2781 2781
 
2782
-				if ( 'post_tag' === $queried_taxonomy ) {
2783
-					$the_tag = get_term_by( $queried_items['field'], $queried_items['terms'][0], 'post_tag' );
2784
-					if ( $the_tag ) {
2785
-						$this->set( 'tag_id', $the_tag->term_id );
2782
+				if ('post_tag' === $queried_taxonomy) {
2783
+					$the_tag = get_term_by($queried_items['field'], $queried_items['terms'][0], 'post_tag');
2784
+					if ($the_tag) {
2785
+						$this->set('tag_id', $the_tag->term_id);
2786 2786
 					}
2787
-					unset( $the_tag );
2787
+					unset($the_tag);
2788 2788
 				}
2789 2789
 			}
2790 2790
 		}
2791 2791
 
2792
-		if ( !empty( $this->tax_query->queries ) || !empty( $this->meta_query->queries ) ) {
2792
+		if ( ! empty($this->tax_query->queries) || ! empty($this->meta_query->queries)) {
2793 2793
 			$groupby = "{$wpdb->posts}.ID";
2794 2794
 		}
2795 2795
 
2796 2796
 		// Author/user stuff
2797 2797
 
2798
-		if ( ! empty( $q['author'] ) && $q['author'] != '0' ) {
2799
-			$q['author'] = addslashes_gpc( '' . urldecode( $q['author'] ) );
2800
-			$authors = array_unique( array_map( 'intval', preg_split( '/[,\s]+/', $q['author'] ) ) );
2801
-			foreach ( $authors as $author ) {
2798
+		if ( ! empty($q['author']) && $q['author'] != '0') {
2799
+			$q['author'] = addslashes_gpc(''.urldecode($q['author']));
2800
+			$authors = array_unique(array_map('intval', preg_split('/[,\s]+/', $q['author'])));
2801
+			foreach ($authors as $author) {
2802 2802
 				$key = $author > 0 ? 'author__in' : 'author__not_in';
2803
-				$q[$key][] = abs( $author );
2803
+				$q[$key][] = abs($author);
2804 2804
 			}
2805
-			$q['author'] = implode( ',', $authors );
2805
+			$q['author'] = implode(',', $authors);
2806 2806
 		}
2807 2807
 
2808
-		if ( ! empty( $q['author__not_in'] ) ) {
2809
-			$author__not_in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__not_in'] ) ) );
2808
+		if ( ! empty($q['author__not_in'])) {
2809
+			$author__not_in = implode(',', array_map('absint', array_unique((array) $q['author__not_in'])));
2810 2810
 			$where .= " AND {$wpdb->posts}.post_author NOT IN ($author__not_in) ";
2811
-		} elseif ( ! empty( $q['author__in'] ) ) {
2812
-			$author__in = implode( ',', array_map( 'absint', array_unique( (array) $q['author__in'] ) ) );
2811
+		} elseif ( ! empty($q['author__in'])) {
2812
+			$author__in = implode(',', array_map('absint', array_unique((array) $q['author__in'])));
2813 2813
 			$where .= " AND {$wpdb->posts}.post_author IN ($author__in) ";
2814 2814
 		}
2815 2815
 
2816 2816
 		// Author stuff for nice URLs
2817 2817
 
2818
-		if ( '' != $q['author_name'] ) {
2819
-			if ( strpos($q['author_name'], '/') !== false ) {
2818
+		if ('' != $q['author_name']) {
2819
+			if (strpos($q['author_name'], '/') !== false) {
2820 2820
 				$q['author_name'] = explode('/', $q['author_name']);
2821
-				if ( $q['author_name'][ count($q['author_name'])-1 ] ) {
2822
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-1]; // no trailing slash
2821
+				if ($q['author_name'][count($q['author_name']) - 1]) {
2822
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 1]; // no trailing slash
2823 2823
 				} else {
2824
-					$q['author_name'] = $q['author_name'][count($q['author_name'])-2]; // there was a trailing slash
2824
+					$q['author_name'] = $q['author_name'][count($q['author_name']) - 2]; // there was a trailing slash
2825 2825
 				}
2826 2826
 			}
2827
-			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2827
+			$q['author_name'] = sanitize_title_for_query($q['author_name']);
2828 2828
 			$q['author'] = get_user_by('slug', $q['author_name']);
2829
-			if ( $q['author'] )
2829
+			if ($q['author'])
2830 2830
 				$q['author'] = $q['author']->ID;
2831
-			$whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
2831
+			$whichauthor .= " AND ($wpdb->posts.post_author = ".absint($q['author']).')';
2832 2832
 		}
2833 2833
 
2834 2834
 		// MIME-Type stuff for attachment browsing
2835 2835
 
2836
-		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] )
2837
-			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
2836
+		if (isset($q['post_mime_type']) && '' != $q['post_mime_type'])
2837
+			$whichmimetype = wp_post_mime_type_where($q['post_mime_type'], $wpdb->posts);
2838 2838
 
2839
-		$where .= $search . $whichauthor . $whichmimetype;
2839
+		$where .= $search.$whichauthor.$whichmimetype;
2840 2840
 
2841
-		if ( ! empty( $this->meta_query->queries ) ) {
2842
-			$clauses = $this->meta_query->get_sql( 'post', $wpdb->posts, 'ID', $this );
2841
+		if ( ! empty($this->meta_query->queries)) {
2842
+			$clauses = $this->meta_query->get_sql('post', $wpdb->posts, 'ID', $this);
2843 2843
 			$join   .= $clauses['join'];
2844 2844
 			$where  .= $clauses['where'];
2845 2845
 		}
2846 2846
 
2847
-		$rand = ( isset( $q['orderby'] ) && 'rand' === $q['orderby'] );
2848
-		if ( ! isset( $q['order'] ) ) {
2847
+		$rand = (isset($q['orderby']) && 'rand' === $q['orderby']);
2848
+		if ( ! isset($q['order'])) {
2849 2849
 			$q['order'] = $rand ? '' : 'DESC';
2850 2850
 		} else {
2851
-			$q['order'] = $rand ? '' : $this->parse_order( $q['order'] );
2851
+			$q['order'] = $rand ? '' : $this->parse_order($q['order']);
2852 2852
 		}
2853 2853
 
2854 2854
 		// Order by.
2855
-		if ( empty( $q['orderby'] ) ) {
2855
+		if (empty($q['orderby'])) {
2856 2856
 			/*
2857 2857
 			 * Boolean false or empty array blanks out ORDER BY,
2858 2858
 			 * while leaving the value unset or otherwise empty sets the default.
2859 2859
 			 */
2860
-			if ( isset( $q['orderby'] ) && ( is_array( $q['orderby'] ) || false === $q['orderby'] ) ) {
2860
+			if (isset($q['orderby']) && (is_array($q['orderby']) || false === $q['orderby'])) {
2861 2861
 				$orderby = '';
2862 2862
 			} else {
2863
-				$orderby = "$wpdb->posts.post_date " . $q['order'];
2863
+				$orderby = "$wpdb->posts.post_date ".$q['order'];
2864 2864
 			}
2865
-		} elseif ( 'none' == $q['orderby'] ) {
2865
+		} elseif ('none' == $q['orderby']) {
2866 2866
 			$orderby = '';
2867
-		} elseif ( $q['orderby'] == 'post__in' && ! empty( $post__in ) ) {
2867
+		} elseif ($q['orderby'] == 'post__in' && ! empty($post__in)) {
2868 2868
 			$orderby = "FIELD( {$wpdb->posts}.ID, $post__in )";
2869
-		} elseif ( $q['orderby'] == 'post_parent__in' && ! empty( $post_parent__in ) ) {
2869
+		} elseif ($q['orderby'] == 'post_parent__in' && ! empty($post_parent__in)) {
2870 2870
 			$orderby = "FIELD( {$wpdb->posts}.post_parent, $post_parent__in )";
2871 2871
 		} else {
2872 2872
 			$orderby_array = array();
2873
-			if ( is_array( $q['orderby'] ) ) {
2874
-				foreach ( $q['orderby'] as $_orderby => $order ) {
2875
-					$orderby = addslashes_gpc( urldecode( $_orderby ) );
2876
-					$parsed  = $this->parse_orderby( $orderby );
2873
+			if (is_array($q['orderby'])) {
2874
+				foreach ($q['orderby'] as $_orderby => $order) {
2875
+					$orderby = addslashes_gpc(urldecode($_orderby));
2876
+					$parsed  = $this->parse_orderby($orderby);
2877 2877
 
2878
-					if ( ! $parsed ) {
2878
+					if ( ! $parsed) {
2879 2879
 						continue;
2880 2880
 					}
2881 2881
 
2882
-					$orderby_array[] = $parsed . ' ' . $this->parse_order( $order );
2882
+					$orderby_array[] = $parsed.' '.$this->parse_order($order);
2883 2883
 				}
2884
-				$orderby = implode( ', ', $orderby_array );
2884
+				$orderby = implode(', ', $orderby_array);
2885 2885
 
2886 2886
 			} else {
2887
-				$q['orderby'] = urldecode( $q['orderby'] );
2888
-				$q['orderby'] = addslashes_gpc( $q['orderby'] );
2887
+				$q['orderby'] = urldecode($q['orderby']);
2888
+				$q['orderby'] = addslashes_gpc($q['orderby']);
2889 2889
 
2890
-				foreach ( explode( ' ', $q['orderby'] ) as $i => $orderby ) {
2891
-					$parsed = $this->parse_orderby( $orderby );
2890
+				foreach (explode(' ', $q['orderby']) as $i => $orderby) {
2891
+					$parsed = $this->parse_orderby($orderby);
2892 2892
 					// Only allow certain values for safety.
2893
-					if ( ! $parsed ) {
2893
+					if ( ! $parsed) {
2894 2894
 						continue;
2895 2895
 					}
2896 2896
 
2897 2897
 					$orderby_array[] = $parsed;
2898 2898
 				}
2899
-				$orderby = implode( ' ' . $q['order'] . ', ', $orderby_array );
2899
+				$orderby = implode(' '.$q['order'].', ', $orderby_array);
2900 2900
 
2901
-				if ( empty( $orderby ) ) {
2902
-					$orderby = "$wpdb->posts.post_date " . $q['order'];
2903
-				} elseif ( ! empty( $q['order'] ) ) {
2901
+				if (empty($orderby)) {
2902
+					$orderby = "$wpdb->posts.post_date ".$q['order'];
2903
+				} elseif ( ! empty($q['order'])) {
2904 2904
 					$orderby .= " {$q['order']}";
2905 2905
 				}
2906 2906
 			}
2907 2907
 		}
2908 2908
 
2909 2909
 		// Order search results by relevance only when another "orderby" is not specified in the query.
2910
-		if ( ! empty( $q['s'] ) ) {
2910
+		if ( ! empty($q['s'])) {
2911 2911
 			$search_orderby = '';
2912
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
2913
-				$search_orderby = $this->parse_search_order( $q );
2912
+			if ( ! empty($q['search_orderby_title']) && (empty($q['orderby']) && ! $this->is_feed) || (isset($q['orderby']) && 'relevance' === $q['orderby']))
2913
+				$search_orderby = $this->parse_search_order($q);
2914 2914
 
2915 2915
 			/**
2916 2916
 			 * Filter the ORDER BY used when ordering search results.
@@ -2920,84 +2920,84 @@  discard block
 block discarded – undo
2920 2920
 			 * @param string   $search_orderby The ORDER BY clause.
2921 2921
 			 * @param WP_Query $this           The current WP_Query instance.
2922 2922
 			 */
2923
-			$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
2924
-			if ( $search_orderby )
2925
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
2923
+			$search_orderby = apply_filters('posts_search_orderby', $search_orderby, $this);
2924
+			if ($search_orderby)
2925
+				$orderby = $orderby ? $search_orderby.', '.$orderby : $search_orderby;
2926 2926
 		}
2927 2927
 
2928
-		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
2928
+		if (is_array($post_type) && count($post_type) > 1) {
2929 2929
 			$post_type_cap = 'multiple_post_type';
2930 2930
 		} else {
2931
-			if ( is_array( $post_type ) )
2932
-				$post_type = reset( $post_type );
2933
-			$post_type_object = get_post_type_object( $post_type );
2934
-			if ( empty( $post_type_object ) )
2931
+			if (is_array($post_type))
2932
+				$post_type = reset($post_type);
2933
+			$post_type_object = get_post_type_object($post_type);
2934
+			if (empty($post_type_object))
2935 2935
 				$post_type_cap = $post_type;
2936 2936
 		}
2937 2937
 
2938
-		if ( isset( $q['post_password'] ) ) {
2939
-			$where .= $wpdb->prepare( " AND $wpdb->posts.post_password = %s", $q['post_password'] );
2940
-			if ( empty( $q['perm'] ) ) {
2938
+		if (isset($q['post_password'])) {
2939
+			$where .= $wpdb->prepare(" AND $wpdb->posts.post_password = %s", $q['post_password']);
2940
+			if (empty($q['perm'])) {
2941 2941
 				$q['perm'] = 'readable';
2942 2942
 			}
2943
-		} elseif ( isset( $q['has_password'] ) ) {
2944
-			$where .= sprintf( " AND $wpdb->posts.post_password %s ''", $q['has_password'] ? '!=' : '=' );
2943
+		} elseif (isset($q['has_password'])) {
2944
+			$where .= sprintf(" AND $wpdb->posts.post_password %s ''", $q['has_password'] ? '!=' : '=');
2945 2945
 		}
2946 2946
 
2947
-		if ( 'any' == $post_type ) {
2948
-			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
2949
-			if ( empty( $in_search_post_types ) )
2947
+		if ('any' == $post_type) {
2948
+			$in_search_post_types = get_post_types(array('exclude_from_search' => false));
2949
+			if (empty($in_search_post_types))
2950 2950
 				$where .= ' AND 1=0 ';
2951 2951
 			else
2952
-				$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
2953
-		} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
2954
-			$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
2955
-		} elseif ( ! empty( $post_type ) ) {
2952
+				$where .= " AND $wpdb->posts.post_type IN ('".join("', '", $in_search_post_types)."')";
2953
+		} elseif ( ! empty($post_type) && is_array($post_type)) {
2954
+			$where .= " AND $wpdb->posts.post_type IN ('".join("', '", $post_type)."')";
2955
+		} elseif ( ! empty($post_type)) {
2956 2956
 			$where .= " AND $wpdb->posts.post_type = '$post_type'";
2957
-			$post_type_object = get_post_type_object ( $post_type );
2958
-		} elseif ( $this->is_attachment ) {
2957
+			$post_type_object = get_post_type_object($post_type);
2958
+		} elseif ($this->is_attachment) {
2959 2959
 			$where .= " AND $wpdb->posts.post_type = 'attachment'";
2960
-			$post_type_object = get_post_type_object ( 'attachment' );
2961
-		} elseif ( $this->is_page ) {
2960
+			$post_type_object = get_post_type_object('attachment');
2961
+		} elseif ($this->is_page) {
2962 2962
 			$where .= " AND $wpdb->posts.post_type = 'page'";
2963
-			$post_type_object = get_post_type_object ( 'page' );
2963
+			$post_type_object = get_post_type_object('page');
2964 2964
 		} else {
2965 2965
 			$where .= " AND $wpdb->posts.post_type = 'post'";
2966
-			$post_type_object = get_post_type_object ( 'post' );
2966
+			$post_type_object = get_post_type_object('post');
2967 2967
 		}
2968 2968
 
2969 2969
 		$edit_cap = 'edit_post';
2970 2970
 		$read_cap = 'read_post';
2971 2971
 
2972
-		if ( ! empty( $post_type_object ) ) {
2972
+		if ( ! empty($post_type_object)) {
2973 2973
 			$edit_others_cap = $post_type_object->cap->edit_others_posts;
2974 2974
 			$read_private_cap = $post_type_object->cap->read_private_posts;
2975 2975
 		} else {
2976
-			$edit_others_cap = 'edit_others_' . $post_type_cap . 's';
2977
-			$read_private_cap = 'read_private_' . $post_type_cap . 's';
2976
+			$edit_others_cap = 'edit_others_'.$post_type_cap.'s';
2977
+			$read_private_cap = 'read_private_'.$post_type_cap.'s';
2978 2978
 		}
2979 2979
 
2980 2980
 		$user_id = get_current_user_id();
2981 2981
 
2982 2982
 		$q_status = array();
2983
-		if ( ! empty( $q['post_status'] ) ) {
2983
+		if ( ! empty($q['post_status'])) {
2984 2984
 			$statuswheres = array();
2985 2985
 			$q_status = $q['post_status'];
2986
-			if ( ! is_array( $q_status ) )
2986
+			if ( ! is_array($q_status))
2987 2987
 				$q_status = explode(',', $q_status);
2988 2988
 			$r_status = array();
2989 2989
 			$p_status = array();
2990 2990
 			$e_status = array();
2991
-			if ( in_array( 'any', $q_status ) ) {
2992
-				foreach ( get_post_stati( array( 'exclude_from_search' => true ) ) as $status ) {
2993
-					if ( ! in_array( $status, $q_status ) ) {
2991
+			if (in_array('any', $q_status)) {
2992
+				foreach (get_post_stati(array('exclude_from_search' => true)) as $status) {
2993
+					if ( ! in_array($status, $q_status)) {
2994 2994
 						$e_status[] = "$wpdb->posts.post_status <> '$status'";
2995 2995
 					}
2996 2996
 				}
2997 2997
 			} else {
2998
-				foreach ( get_post_stati() as $status ) {
2999
-					if ( in_array( $status, $q_status ) ) {
3000
-						if ( 'private' == $status )
2998
+				foreach (get_post_stati() as $status) {
2999
+					if (in_array($status, $q_status)) {
3000
+						if ('private' == $status)
3001 3001
 							$p_status[] = "$wpdb->posts.post_status = '$status'";
3002 3002
 						else
3003 3003
 							$r_status[] = "$wpdb->posts.post_status = '$status'";
@@ -3005,58 +3005,58 @@  discard block
 block discarded – undo
3005 3005
 				}
3006 3006
 			}
3007 3007
 
3008
-			if ( empty($q['perm'] ) || 'readable' != $q['perm'] ) {
3008
+			if (empty($q['perm']) || 'readable' != $q['perm']) {
3009 3009
 				$r_status = array_merge($r_status, $p_status);
3010 3010
 				unset($p_status);
3011 3011
 			}
3012 3012
 
3013
-			if ( !empty($e_status) ) {
3014
-				$statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
3013
+			if ( ! empty($e_status)) {
3014
+				$statuswheres[] = "(".join(' AND ', $e_status).")";
3015 3015
 			}
3016
-			if ( !empty($r_status) ) {
3017
-				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
3018
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3016
+			if ( ! empty($r_status)) {
3017
+				if ( ! empty($q['perm']) && 'editable' == $q['perm'] && ! current_user_can($edit_others_cap))
3018
+					$statuswheres[] = "($wpdb->posts.post_author = $user_id "."AND (".join(' OR ', $r_status)."))";
3019 3019
 				else
3020
-					$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3020
+					$statuswheres[] = "(".join(' OR ', $r_status).")";
3021 3021
 			}
3022
-			if ( !empty($p_status) ) {
3023
-				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
3024
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3022
+			if ( ! empty($p_status)) {
3023
+				if ( ! empty($q['perm']) && 'readable' == $q['perm'] && ! current_user_can($read_private_cap))
3024
+					$statuswheres[] = "($wpdb->posts.post_author = $user_id "."AND (".join(' OR ', $p_status)."))";
3025 3025
 				else
3026
-					$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3026
+					$statuswheres[] = "(".join(' OR ', $p_status).")";
3027 3027
 			}
3028
-			if ( $post_status_join ) {
3028
+			if ($post_status_join) {
3029 3029
 				$join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
3030
-				foreach ( $statuswheres as $index => $statuswhere )
3031
-					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3030
+				foreach ($statuswheres as $index => $statuswhere)
3031
+					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND ".str_replace($wpdb->posts, 'p2', $statuswhere)."))";
3032 3032
 			}
3033
-			$where_status = implode( ' OR ', $statuswheres );
3034
-			if ( ! empty( $where_status ) ) {
3033
+			$where_status = implode(' OR ', $statuswheres);
3034
+			if ( ! empty($where_status)) {
3035 3035
 				$where .= " AND ($where_status)";
3036 3036
 			}
3037
-		} elseif ( !$this->is_singular ) {
3037
+		} elseif ( ! $this->is_singular) {
3038 3038
 			$where .= " AND ($wpdb->posts.post_status = 'publish'";
3039 3039
 
3040 3040
 			// Add public states.
3041
-			$public_states = get_post_stati( array('public' => true) );
3042
-			foreach ( (array) $public_states as $state ) {
3043
-				if ( 'publish' == $state ) // Publish is hard-coded above.
3041
+			$public_states = get_post_stati(array('public' => true));
3042
+			foreach ((array) $public_states as $state) {
3043
+				if ('publish' == $state) // Publish is hard-coded above.
3044 3044
 					continue;
3045 3045
 				$where .= " OR $wpdb->posts.post_status = '$state'";
3046 3046
 			}
3047 3047
 
3048
-			if ( $this->is_admin ) {
3048
+			if ($this->is_admin) {
3049 3049
 				// Add protected states that should show in the admin all list.
3050
-				$admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
3051
-				foreach ( (array) $admin_all_states as $state )
3050
+				$admin_all_states = get_post_stati(array('protected' => true, 'show_in_admin_all_list' => true));
3051
+				foreach ((array) $admin_all_states as $state)
3052 3052
 					$where .= " OR $wpdb->posts.post_status = '$state'";
3053 3053
 			}
3054 3054
 
3055
-			if ( is_user_logged_in() ) {
3055
+			if (is_user_logged_in()) {
3056 3056
 				// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
3057
-				$private_states = get_post_stati( array('private' => true) );
3058
-				foreach ( (array) $private_states as $state )
3059
-					$where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'";
3057
+				$private_states = get_post_stati(array('private' => true));
3058
+				foreach ((array) $private_states as $state)
3059
+					$where .= current_user_can($read_private_cap) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'";
3060 3060
 			}
3061 3061
 
3062 3062
 			$where .= ')';
@@ -3066,7 +3066,7 @@  discard block
 block discarded – undo
3066 3066
 		 * Apply filters on where and join prior to paging so that any
3067 3067
 		 * manipulations to them are reflected in the paging by day queries.
3068 3068
 		 */
3069
-		if ( !$q['suppress_filters'] ) {
3069
+		if ( ! $q['suppress_filters']) {
3070 3070
 			/**
3071 3071
 			 * Filter the WHERE clause of the query.
3072 3072
 			 *
@@ -3075,7 +3075,7 @@  discard block
 block discarded – undo
3075 3075
 			 * @param string   $where The WHERE clause of the query.
3076 3076
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3077 3077
 			 */
3078
-			$where = apply_filters_ref_array( 'posts_where', array( $where, &$this ) );
3078
+			$where = apply_filters_ref_array('posts_where', array($where, &$this));
3079 3079
 
3080 3080
 			/**
3081 3081
 			 * Filter the JOIN clause of the query.
@@ -3085,27 +3085,27 @@  discard block
 block discarded – undo
3085 3085
 			 * @param string   $where The JOIN clause of the query.
3086 3086
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3087 3087
 			 */
3088
-			$join = apply_filters_ref_array( 'posts_join', array( $join, &$this ) );
3088
+			$join = apply_filters_ref_array('posts_join', array($join, &$this));
3089 3089
 		}
3090 3090
 
3091 3091
 		// Paging
3092
-		if ( empty($q['nopaging']) && !$this->is_singular ) {
3092
+		if (empty($q['nopaging']) && ! $this->is_singular) {
3093 3093
 			$page = absint($q['paged']);
3094
-			if ( !$page )
3094
+			if ( ! $page)
3095 3095
 				$page = 1;
3096 3096
 
3097
-			if ( empty($q['offset']) ) {
3098
-				$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
3097
+			if (empty($q['offset'])) {
3098
+				$pgstrt = absint(($page - 1) * $q['posts_per_page']).', ';
3099 3099
 			} else { // we're ignoring $page and using 'offset'
3100 3100
 				$q['offset'] = absint($q['offset']);
3101
-				$pgstrt = $q['offset'] . ', ';
3101
+				$pgstrt = $q['offset'].', ';
3102 3102
 			}
3103
-			$limits = 'LIMIT ' . $pgstrt . $q['posts_per_page'];
3103
+			$limits = 'LIMIT '.$pgstrt.$q['posts_per_page'];
3104 3104
 		}
3105 3105
 
3106 3106
 		// Comments feeds
3107
-		if ( $this->is_comment_feed && ! $this->is_singular ) {
3108
-			if ( $this->is_archive || $this->is_search ) {
3107
+		if ($this->is_comment_feed && ! $this->is_singular) {
3108
+			if ($this->is_archive || $this->is_search) {
3109 3109
 				$cjoin = "JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID) $join ";
3110 3110
 				$cwhere = "WHERE comment_approved = '1' $where";
3111 3111
 				$cgroupby = "$wpdb->comments.comment_id";
@@ -3115,7 +3115,7 @@  discard block
 block discarded – undo
3115 3115
 				$cgroupby = '';
3116 3116
 			}
3117 3117
 
3118
-			if ( !$q['suppress_filters'] ) {
3118
+			if ( ! $q['suppress_filters']) {
3119 3119
 				/**
3120 3120
 				 * Filter the JOIN clause of the comments feed query before sending.
3121 3121
 				 *
@@ -3124,7 +3124,7 @@  discard block
 block discarded – undo
3124 3124
 				 * @param string   $cjoin The JOIN clause of the query.
3125 3125
 				 * @param WP_Query &$this The WP_Query instance (passed by reference).
3126 3126
 				 */
3127
-				$cjoin = apply_filters_ref_array( 'comment_feed_join', array( $cjoin, &$this ) );
3127
+				$cjoin = apply_filters_ref_array('comment_feed_join', array($cjoin, &$this));
3128 3128
 
3129 3129
 				/**
3130 3130
 				 * Filter the WHERE clause of the comments feed query before sending.
@@ -3134,7 +3134,7 @@  discard block
 block discarded – undo
3134 3134
 				 * @param string   $cwhere The WHERE clause of the query.
3135 3135
 				 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3136 3136
 				 */
3137
-				$cwhere = apply_filters_ref_array( 'comment_feed_where', array( $cwhere, &$this ) );
3137
+				$cwhere = apply_filters_ref_array('comment_feed_where', array($cwhere, &$this));
3138 3138
 
3139 3139
 				/**
3140 3140
 				 * Filter the GROUP BY clause of the comments feed query before sending.
@@ -3144,7 +3144,7 @@  discard block
 block discarded – undo
3144 3144
 				 * @param string   $cgroupby The GROUP BY clause of the query.
3145 3145
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3146 3146
 				 */
3147
-				$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( $cgroupby, &$this ) );
3147
+				$cgroupby = apply_filters_ref_array('comment_feed_groupby', array($cgroupby, &$this));
3148 3148
 
3149 3149
 				/**
3150 3150
 				 * Filter the ORDER BY clause of the comments feed query before sending.
@@ -3154,7 +3154,7 @@  discard block
 block discarded – undo
3154 3154
 				 * @param string   $corderby The ORDER BY clause of the query.
3155 3155
 				 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3156 3156
 				 */
3157
-				$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
3157
+				$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
3158 3158
 
3159 3159
 				/**
3160 3160
 				 * Filter the LIMIT clause of the comments feed query before sending.
@@ -3164,34 +3164,34 @@  discard block
 block discarded – undo
3164 3164
 				 * @param string   $climits The JOIN clause of the query.
3165 3165
 				 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3166 3166
 				 */
3167
-				$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
3167
+				$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
3168 3168
 			}
3169
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
3170
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
3169
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
3170
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
3171 3171
 
3172 3172
 			$this->comments = (array) $wpdb->get_results("SELECT $distinct $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits");
3173 3173
 			$this->comment_count = count($this->comments);
3174 3174
 
3175 3175
 			$post_ids = array();
3176 3176
 
3177
-			foreach ( $this->comments as $comment )
3177
+			foreach ($this->comments as $comment)
3178 3178
 				$post_ids[] = (int) $comment->comment_post_ID;
3179 3179
 
3180 3180
 			$post_ids = join(',', $post_ids);
3181 3181
 			$join = '';
3182
-			if ( $post_ids )
3182
+			if ($post_ids)
3183 3183
 				$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3184 3184
 			else
3185 3185
 				$where = "AND 0";
3186 3186
 		}
3187 3187
 
3188
-		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
3188
+		$pieces = array('where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits');
3189 3189
 
3190 3190
 		/*
3191 3191
 		 * Apply post-paging filters on where and join. Only plugins that
3192 3192
 		 * manipulate paging queries should use these hooks.
3193 3193
 		 */
3194
-		if ( !$q['suppress_filters'] ) {
3194
+		if ( ! $q['suppress_filters']) {
3195 3195
 			/**
3196 3196
 			 * Filter the WHERE clause of the query.
3197 3197
 			 *
@@ -3202,7 +3202,7 @@  discard block
 block discarded – undo
3202 3202
 			 * @param string   $where The WHERE clause of the query.
3203 3203
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3204 3204
 			 */
3205
-			$where = apply_filters_ref_array( 'posts_where_paged', array( $where, &$this ) );
3205
+			$where = apply_filters_ref_array('posts_where_paged', array($where, &$this));
3206 3206
 
3207 3207
 			/**
3208 3208
 			 * Filter the GROUP BY clause of the query.
@@ -3212,7 +3212,7 @@  discard block
 block discarded – undo
3212 3212
 			 * @param string   $groupby The GROUP BY clause of the query.
3213 3213
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3214 3214
 			 */
3215
-			$groupby = apply_filters_ref_array( 'posts_groupby', array( $groupby, &$this ) );
3215
+			$groupby = apply_filters_ref_array('posts_groupby', array($groupby, &$this));
3216 3216
 
3217 3217
 			/**
3218 3218
 			 * Filter the JOIN clause of the query.
@@ -3224,7 +3224,7 @@  discard block
 block discarded – undo
3224 3224
 			 * @param string   $join  The JOIN clause of the query.
3225 3225
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3226 3226
 			 */
3227
-			$join = apply_filters_ref_array( 'posts_join_paged', array( $join, &$this ) );
3227
+			$join = apply_filters_ref_array('posts_join_paged', array($join, &$this));
3228 3228
 
3229 3229
 			/**
3230 3230
 			 * Filter the ORDER BY clause of the query.
@@ -3234,7 +3234,7 @@  discard block
 block discarded – undo
3234 3234
 			 * @param string   $orderby The ORDER BY clause of the query.
3235 3235
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3236 3236
 			 */
3237
-			$orderby = apply_filters_ref_array( 'posts_orderby', array( $orderby, &$this ) );
3237
+			$orderby = apply_filters_ref_array('posts_orderby', array($orderby, &$this));
3238 3238
 
3239 3239
 			/**
3240 3240
 			 * Filter the DISTINCT clause of the query.
@@ -3244,7 +3244,7 @@  discard block
 block discarded – undo
3244 3244
 			 * @param string   $distinct The DISTINCT clause of the query.
3245 3245
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3246 3246
 			 */
3247
-			$distinct = apply_filters_ref_array( 'posts_distinct', array( $distinct, &$this ) );
3247
+			$distinct = apply_filters_ref_array('posts_distinct', array($distinct, &$this));
3248 3248
 
3249 3249
 			/**
3250 3250
 			 * Filter the LIMIT clause of the query.
@@ -3254,7 +3254,7 @@  discard block
 block discarded – undo
3254 3254
 			 * @param string   $limits The LIMIT clause of the query.
3255 3255
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3256 3256
 			 */
3257
-			$limits = apply_filters_ref_array( 'post_limits', array( $limits, &$this ) );
3257
+			$limits = apply_filters_ref_array('post_limits', array($limits, &$this));
3258 3258
 
3259 3259
 			/**
3260 3260
 			 * Filter the SELECT clause of the query.
@@ -3264,7 +3264,7 @@  discard block
 block discarded – undo
3264 3264
 			 * @param string   $fields The SELECT clause of the query.
3265 3265
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3266 3266
 			 */
3267
-			$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
3267
+			$fields = apply_filters_ref_array('posts_fields', array($fields, &$this));
3268 3268
 
3269 3269
 			/**
3270 3270
 			 * Filter all query clauses at once, for convenience.
@@ -3277,15 +3277,15 @@  discard block
 block discarded – undo
3277 3277
 			 * @param array    $clauses The list of clauses for the query.
3278 3278
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3279 3279
 			 */
3280
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
3281
-
3282
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3283
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3284
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3285
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3286
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3287
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3288
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3280
+			$clauses = (array) apply_filters_ref_array('posts_clauses', array(compact($pieces), &$this));
3281
+
3282
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
3283
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
3284
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
3285
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
3286
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
3287
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
3288
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
3289 3289
 		}
3290 3290
 
3291 3291
 		/**
@@ -3297,13 +3297,13 @@  discard block
 block discarded – undo
3297 3297
 		 *
3298 3298
 		 * @param string $selection The assembled selection query.
3299 3299
 		 */
3300
-		do_action( 'posts_selection', $where . $groupby . $orderby . $limits . $join );
3300
+		do_action('posts_selection', $where.$groupby.$orderby.$limits.$join);
3301 3301
 
3302 3302
 		/*
3303 3303
 		 * Filter again for the benefit of caching plugins.
3304 3304
 		 * Regular plugins should use the hooks above.
3305 3305
 		 */
3306
-		if ( !$q['suppress_filters'] ) {
3306
+		if ( ! $q['suppress_filters']) {
3307 3307
 			/**
3308 3308
 			 * Filter the WHERE clause of the query.
3309 3309
 			 *
@@ -3314,7 +3314,7 @@  discard block
 block discarded – undo
3314 3314
 			 * @param string   $where The WHERE clause of the query.
3315 3315
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3316 3316
 			 */
3317
-			$where = apply_filters_ref_array( 'posts_where_request', array( $where, &$this ) );
3317
+			$where = apply_filters_ref_array('posts_where_request', array($where, &$this));
3318 3318
 
3319 3319
 			/**
3320 3320
 			 * Filter the GROUP BY clause of the query.
@@ -3326,7 +3326,7 @@  discard block
 block discarded – undo
3326 3326
 			 * @param string   $groupby The GROUP BY clause of the query.
3327 3327
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3328 3328
 			 */
3329
-			$groupby = apply_filters_ref_array( 'posts_groupby_request', array( $groupby, &$this ) );
3329
+			$groupby = apply_filters_ref_array('posts_groupby_request', array($groupby, &$this));
3330 3330
 
3331 3331
 			/**
3332 3332
 			 * Filter the JOIN clause of the query.
@@ -3338,7 +3338,7 @@  discard block
 block discarded – undo
3338 3338
 			 * @param string   $join  The JOIN clause of the query.
3339 3339
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3340 3340
 			 */
3341
-			$join = apply_filters_ref_array( 'posts_join_request', array( $join, &$this ) );
3341
+			$join = apply_filters_ref_array('posts_join_request', array($join, &$this));
3342 3342
 
3343 3343
 			/**
3344 3344
 			 * Filter the ORDER BY clause of the query.
@@ -3350,7 +3350,7 @@  discard block
 block discarded – undo
3350 3350
 			 * @param string   $orderby The ORDER BY clause of the query.
3351 3351
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3352 3352
 			 */
3353
-			$orderby = apply_filters_ref_array( 'posts_orderby_request', array( $orderby, &$this ) );
3353
+			$orderby = apply_filters_ref_array('posts_orderby_request', array($orderby, &$this));
3354 3354
 
3355 3355
 			/**
3356 3356
 			 * Filter the DISTINCT clause of the query.
@@ -3362,7 +3362,7 @@  discard block
 block discarded – undo
3362 3362
 			 * @param string   $distinct The DISTINCT clause of the query.
3363 3363
 			 * @param WP_Query &$this    The WP_Query instance (passed by reference).
3364 3364
 			 */
3365
-			$distinct = apply_filters_ref_array( 'posts_distinct_request', array( $distinct, &$this ) );
3365
+			$distinct = apply_filters_ref_array('posts_distinct_request', array($distinct, &$this));
3366 3366
 
3367 3367
 			/**
3368 3368
 			 * Filter the SELECT clause of the query.
@@ -3374,7 +3374,7 @@  discard block
 block discarded – undo
3374 3374
 			 * @param string   $fields The SELECT clause of the query.
3375 3375
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3376 3376
 			 */
3377
-			$fields = apply_filters_ref_array( 'posts_fields_request', array( $fields, &$this ) );
3377
+			$fields = apply_filters_ref_array('posts_fields_request', array($fields, &$this));
3378 3378
 
3379 3379
 			/**
3380 3380
 			 * Filter the LIMIT clause of the query.
@@ -3386,7 +3386,7 @@  discard block
 block discarded – undo
3386 3386
 			 * @param string   $limits The LIMIT clause of the query.
3387 3387
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3388 3388
 			 */
3389
-			$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
3389
+			$limits = apply_filters_ref_array('post_limits_request', array($limits, &$this));
3390 3390
 
3391 3391
 			/**
3392 3392
 			 * Filter all query clauses at once, for convenience.
@@ -3401,29 +3401,29 @@  discard block
 block discarded – undo
3401 3401
 			 * @param array    $pieces The pieces of the query.
3402 3402
 			 * @param WP_Query &$this  The WP_Query instance (passed by reference).
3403 3403
 			 */
3404
-			$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
3405
-
3406
-			$where = isset( $clauses[ 'where' ] ) ? $clauses[ 'where' ] : '';
3407
-			$groupby = isset( $clauses[ 'groupby' ] ) ? $clauses[ 'groupby' ] : '';
3408
-			$join = isset( $clauses[ 'join' ] ) ? $clauses[ 'join' ] : '';
3409
-			$orderby = isset( $clauses[ 'orderby' ] ) ? $clauses[ 'orderby' ] : '';
3410
-			$distinct = isset( $clauses[ 'distinct' ] ) ? $clauses[ 'distinct' ] : '';
3411
-			$fields = isset( $clauses[ 'fields' ] ) ? $clauses[ 'fields' ] : '';
3412
-			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3404
+			$clauses = (array) apply_filters_ref_array('posts_clauses_request', array(compact($pieces), &$this));
3405
+
3406
+			$where = isset($clauses['where']) ? $clauses['where'] : '';
3407
+			$groupby = isset($clauses['groupby']) ? $clauses['groupby'] : '';
3408
+			$join = isset($clauses['join']) ? $clauses['join'] : '';
3409
+			$orderby = isset($clauses['orderby']) ? $clauses['orderby'] : '';
3410
+			$distinct = isset($clauses['distinct']) ? $clauses['distinct'] : '';
3411
+			$fields = isset($clauses['fields']) ? $clauses['fields'] : '';
3412
+			$limits = isset($clauses['limits']) ? $clauses['limits'] : '';
3413 3413
 		}
3414 3414
 
3415
-		if ( ! empty($groupby) )
3416
-			$groupby = 'GROUP BY ' . $groupby;
3417
-		if ( !empty( $orderby ) )
3418
-			$orderby = 'ORDER BY ' . $orderby;
3415
+		if ( ! empty($groupby))
3416
+			$groupby = 'GROUP BY '.$groupby;
3417
+		if ( ! empty($orderby))
3418
+			$orderby = 'ORDER BY '.$orderby;
3419 3419
 
3420 3420
 		$found_rows = '';
3421
-		if ( !$q['no_found_rows'] && !empty($limits) )
3421
+		if ( ! $q['no_found_rows'] && ! empty($limits))
3422 3422
 			$found_rows = 'SQL_CALC_FOUND_ROWS';
3423 3423
 
3424 3424
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
3425 3425
 
3426
-		if ( !$q['suppress_filters'] ) {
3426
+		if ( ! $q['suppress_filters']) {
3427 3427
 			/**
3428 3428
 			 * Filter the completed SQL query before sending.
3429 3429
 			 *
@@ -3432,35 +3432,35 @@  discard block
 block discarded – undo
3432 3432
 			 * @param array    $request The complete SQL query.
3433 3433
 			 * @param WP_Query &$this   The WP_Query instance (passed by reference).
3434 3434
 			 */
3435
-			$this->request = apply_filters_ref_array( 'posts_request', array( $this->request, &$this ) );
3435
+			$this->request = apply_filters_ref_array('posts_request', array($this->request, &$this));
3436 3436
 		}
3437 3437
 
3438
-		if ( 'ids' == $q['fields'] ) {
3439
-			$this->posts = $wpdb->get_col( $this->request );
3440
-			$this->posts = array_map( 'intval', $this->posts );
3441
-			$this->post_count = count( $this->posts );
3442
-			$this->set_found_posts( $q, $limits );
3438
+		if ('ids' == $q['fields']) {
3439
+			$this->posts = $wpdb->get_col($this->request);
3440
+			$this->posts = array_map('intval', $this->posts);
3441
+			$this->post_count = count($this->posts);
3442
+			$this->set_found_posts($q, $limits);
3443 3443
 
3444 3444
 			return $this->posts;
3445 3445
 		}
3446 3446
 
3447
-		if ( 'id=>parent' == $q['fields'] ) {
3448
-			$this->posts = $wpdb->get_results( $this->request );
3449
-			$this->post_count = count( $this->posts );
3450
-			$this->set_found_posts( $q, $limits );
3447
+		if ('id=>parent' == $q['fields']) {
3448
+			$this->posts = $wpdb->get_results($this->request);
3449
+			$this->post_count = count($this->posts);
3450
+			$this->set_found_posts($q, $limits);
3451 3451
 
3452 3452
 			$r = array();
3453
-			foreach ( $this->posts as $key => $post ) {
3454
-				$this->posts[ $key ]->ID = (int) $post->ID;
3455
-				$this->posts[ $key ]->post_parent = (int) $post->post_parent;
3453
+			foreach ($this->posts as $key => $post) {
3454
+				$this->posts[$key]->ID = (int) $post->ID;
3455
+				$this->posts[$key]->post_parent = (int) $post->post_parent;
3456 3456
 
3457
-				$r[ (int) $post->ID ] = (int) $post->post_parent;
3457
+				$r[(int) $post->ID] = (int) $post->post_parent;
3458 3458
 			}
3459 3459
 
3460 3460
 			return $r;
3461 3461
 		}
3462 3462
 
3463
-		$split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );
3463
+		$split_the_query = ($old_request == $this->request && "$wpdb->posts.*" == $fields && ! empty($limits) && $q['posts_per_page'] < 500);
3464 3464
 
3465 3465
 		/**
3466 3466
 		 * Filter whether to split the query.
@@ -3474,9 +3474,9 @@  discard block
 block discarded – undo
3474 3474
 		 * @param bool     $split_the_query Whether or not to split the query.
3475 3475
 		 * @param WP_Query $this            The WP_Query instance.
3476 3476
 		 */
3477
-		$split_the_query = apply_filters( 'split_the_query', $split_the_query, $this );
3477
+		$split_the_query = apply_filters('split_the_query', $split_the_query, $this);
3478 3478
 
3479
-		if ( $split_the_query ) {
3479
+		if ($split_the_query) {
3480 3480
 			// First get the IDs and then fill in the objects
3481 3481
 
3482 3482
 			$this->request = "SELECT $found_rows $distinct $wpdb->posts.ID FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
@@ -3489,27 +3489,27 @@  discard block
 block discarded – undo
3489 3489
 			 * @param string   $request The post ID request.
3490 3490
 			 * @param WP_Query $this    The WP_Query instance.
3491 3491
 			 */
3492
-			$this->request = apply_filters( 'posts_request_ids', $this->request, $this );
3492
+			$this->request = apply_filters('posts_request_ids', $this->request, $this);
3493 3493
 
3494
-			$ids = $wpdb->get_col( $this->request );
3494
+			$ids = $wpdb->get_col($this->request);
3495 3495
 
3496
-			if ( $ids ) {
3496
+			if ($ids) {
3497 3497
 				$this->posts = $ids;
3498
-				$this->set_found_posts( $q, $limits );
3499
-				_prime_post_caches( $ids, $q['update_post_term_cache'], $q['update_post_meta_cache'] );
3498
+				$this->set_found_posts($q, $limits);
3499
+				_prime_post_caches($ids, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3500 3500
 			} else {
3501 3501
 				$this->posts = array();
3502 3502
 			}
3503 3503
 		} else {
3504
-			$this->posts = $wpdb->get_results( $this->request );
3505
-			$this->set_found_posts( $q, $limits );
3504
+			$this->posts = $wpdb->get_results($this->request);
3505
+			$this->set_found_posts($q, $limits);
3506 3506
 		}
3507 3507
 
3508 3508
 		// Convert to WP_Post objects
3509
-		if ( $this->posts )
3510
-			$this->posts = array_map( 'get_post', $this->posts );
3509
+		if ($this->posts)
3510
+			$this->posts = array_map('get_post', $this->posts);
3511 3511
 
3512
-		if ( ! $q['suppress_filters'] ) {
3512
+		if ( ! $q['suppress_filters']) {
3513 3513
 			/**
3514 3514
 			 * Filter the raw post results array, prior to status checks.
3515 3515
 			 *
@@ -3518,26 +3518,26 @@  discard block
 block discarded – undo
3518 3518
 			 * @param array    $posts The post results array.
3519 3519
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3520 3520
 			 */
3521
-			$this->posts = apply_filters_ref_array( 'posts_results', array( $this->posts, &$this ) );
3521
+			$this->posts = apply_filters_ref_array('posts_results', array($this->posts, &$this));
3522 3522
 		}
3523 3523
 
3524
-		if ( !empty($this->posts) && $this->is_comment_feed && $this->is_singular ) {
3524
+		if ( ! empty($this->posts) && $this->is_comment_feed && $this->is_singular) {
3525 3525
 			/** This filter is documented in wp-includes/query.php */
3526
-			$cjoin = apply_filters_ref_array( 'comment_feed_join', array( '', &$this ) );
3526
+			$cjoin = apply_filters_ref_array('comment_feed_join', array('', &$this));
3527 3527
 
3528 3528
 			/** This filter is documented in wp-includes/query.php */
3529
-			$cwhere = apply_filters_ref_array( 'comment_feed_where', array( "WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this ) );
3529
+			$cwhere = apply_filters_ref_array('comment_feed_where', array("WHERE comment_post_ID = '{$this->posts[0]->ID}' AND comment_approved = '1'", &$this));
3530 3530
 
3531 3531
 			/** This filter is documented in wp-includes/query.php */
3532
-			$cgroupby = apply_filters_ref_array( 'comment_feed_groupby', array( '', &$this ) );
3533
-			$cgroupby = ( ! empty( $cgroupby ) ) ? 'GROUP BY ' . $cgroupby : '';
3532
+			$cgroupby = apply_filters_ref_array('comment_feed_groupby', array('', &$this));
3533
+			$cgroupby = ( ! empty($cgroupby)) ? 'GROUP BY '.$cgroupby : '';
3534 3534
 
3535 3535
 			/** This filter is documented in wp-includes/query.php */
3536
-			$corderby = apply_filters_ref_array( 'comment_feed_orderby', array( 'comment_date_gmt DESC', &$this ) );
3537
-			$corderby = ( ! empty( $corderby ) ) ? 'ORDER BY ' . $corderby : '';
3536
+			$corderby = apply_filters_ref_array('comment_feed_orderby', array('comment_date_gmt DESC', &$this));
3537
+			$corderby = ( ! empty($corderby)) ? 'ORDER BY '.$corderby : '';
3538 3538
 
3539 3539
 			/** This filter is documented in wp-includes/query.php */
3540
-			$climits = apply_filters_ref_array( 'comment_feed_limits', array( 'LIMIT ' . get_option('posts_per_rss'), &$this ) );
3540
+			$climits = apply_filters_ref_array('comment_feed_limits', array('LIMIT '.get_option('posts_per_rss'), &$this));
3541 3541
 
3542 3542
 			$comments_request = "SELECT $wpdb->comments.* FROM $wpdb->comments $cjoin $cwhere $cgroupby $corderby $climits";
3543 3543
 			$this->comments = $wpdb->get_results($comments_request);
@@ -3545,29 +3545,29 @@  discard block
 block discarded – undo
3545 3545
 		}
3546 3546
 
3547 3547
 		// Check post status to determine if post should be displayed.
3548
-		if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
3548
+		if ( ! empty($this->posts) && ($this->is_single || $this->is_page)) {
3549 3549
 			$status = get_post_status($this->posts[0]);
3550 3550
 			$post_status_obj = get_post_status_object($status);
3551 3551
 			//$type = get_post_type($this->posts[0]);
3552 3552
 
3553 3553
 			// If the post_status was specifically requested, let it pass through.
3554
-			if ( !$post_status_obj->public && ! in_array( $status, $q_status ) ) {
3554
+			if ( ! $post_status_obj->public && ! in_array($status, $q_status)) {
3555 3555
 
3556
-				if ( ! is_user_logged_in() ) {
3556
+				if ( ! is_user_logged_in()) {
3557 3557
 					// User must be logged in to view unpublished posts.
3558 3558
 					$this->posts = array();
3559 3559
 				} else {
3560
-					if  ( $post_status_obj->protected ) {
3560
+					if ($post_status_obj->protected) {
3561 3561
 						// User must have edit permissions on the draft to preview.
3562
-						if ( ! current_user_can($edit_cap, $this->posts[0]->ID) ) {
3562
+						if ( ! current_user_can($edit_cap, $this->posts[0]->ID)) {
3563 3563
 							$this->posts = array();
3564 3564
 						} else {
3565 3565
 							$this->is_preview = true;
3566
-							if ( 'future' != $status )
3566
+							if ('future' != $status)
3567 3567
 								$this->posts[0]->post_date = current_time('mysql');
3568 3568
 						}
3569
-					} elseif ( $post_status_obj->private ) {
3570
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
3569
+					} elseif ($post_status_obj->private) {
3570
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID))
3571 3571
 							$this->posts = array();
3572 3572
 					} else {
3573 3573
 						$this->posts = array();
@@ -3575,7 +3575,7 @@  discard block
 block discarded – undo
3575 3575
 				}
3576 3576
 			}
3577 3577
 
3578
-			if ( $this->is_preview && $this->posts && current_user_can( $edit_cap, $this->posts[0]->ID ) ) {
3578
+			if ($this->is_preview && $this->posts && current_user_can($edit_cap, $this->posts[0]->ID)) {
3579 3579
 				/**
3580 3580
 				 * Filter the single post for preview mode.
3581 3581
 				 *
@@ -3584,18 +3584,18 @@  discard block
 block discarded – undo
3584 3584
 				 * @param WP_Post  $post_preview  The Post object.
3585 3585
 				 * @param WP_Query &$this         The WP_Query instance (passed by reference).
3586 3586
 				 */
3587
-				$this->posts[0] = get_post( apply_filters_ref_array( 'the_preview', array( $this->posts[0], &$this ) ) );
3587
+				$this->posts[0] = get_post(apply_filters_ref_array('the_preview', array($this->posts[0], &$this)));
3588 3588
 			}
3589 3589
 		}
3590 3590
 
3591 3591
 		// Put sticky posts at the top of the posts array
3592 3592
 		$sticky_posts = get_option('sticky_posts');
3593
-		if ( $this->is_home && $page <= 1 && is_array($sticky_posts) && !empty($sticky_posts) && !$q['ignore_sticky_posts'] ) {
3593
+		if ($this->is_home && $page <= 1 && is_array($sticky_posts) && ! empty($sticky_posts) && ! $q['ignore_sticky_posts']) {
3594 3594
 			$num_posts = count($this->posts);
3595 3595
 			$sticky_offset = 0;
3596 3596
 			// Loop over posts and relocate stickies to the front.
3597
-			for ( $i = 0; $i < $num_posts; $i++ ) {
3598
-				if ( in_array($this->posts[$i]->ID, $sticky_posts) ) {
3597
+			for ($i = 0; $i < $num_posts; $i++) {
3598
+				if (in_array($this->posts[$i]->ID, $sticky_posts)) {
3599 3599
 					$sticky_post = $this->posts[$i];
3600 3600
 					// Remove sticky from current position
3601 3601
 					array_splice($this->posts, $i, 1);
@@ -3605,31 +3605,31 @@  discard block
 block discarded – undo
3605 3605
 					$sticky_offset++;
3606 3606
 					// Remove post from sticky posts array
3607 3607
 					$offset = array_search($sticky_post->ID, $sticky_posts);
3608
-					unset( $sticky_posts[$offset] );
3608
+					unset($sticky_posts[$offset]);
3609 3609
 				}
3610 3610
 			}
3611 3611
 
3612 3612
 			// If any posts have been excluded specifically, Ignore those that are sticky.
3613
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
3613
+			if ( ! empty($sticky_posts) && ! empty($q['post__not_in']))
3614 3614
 				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3615 3615
 
3616 3616
 			// Fetch sticky posts that weren't in the query results
3617
-			if ( !empty($sticky_posts) ) {
3618
-				$stickies = get_posts( array(
3617
+			if ( ! empty($sticky_posts)) {
3618
+				$stickies = get_posts(array(
3619 3619
 					'post__in' => $sticky_posts,
3620 3620
 					'post_type' => $post_type,
3621 3621
 					'post_status' => 'publish',
3622 3622
 					'nopaging' => true
3623
-				) );
3623
+				));
3624 3624
 
3625
-				foreach ( $stickies as $sticky_post ) {
3626
-					array_splice( $this->posts, $sticky_offset, 0, array( $sticky_post ) );
3625
+				foreach ($stickies as $sticky_post) {
3626
+					array_splice($this->posts, $sticky_offset, 0, array($sticky_post));
3627 3627
 					$sticky_offset++;
3628 3628
 				}
3629 3629
 			}
3630 3630
 		}
3631 3631
 
3632
-		if ( ! $q['suppress_filters'] ) {
3632
+		if ( ! $q['suppress_filters']) {
3633 3633
 			/**
3634 3634
 			 * Filter the array of retrieved posts after they've been fetched and
3635 3635
 			 * internally processed.
@@ -3639,20 +3639,20 @@  discard block
 block discarded – undo
3639 3639
 			 * @param array    $posts The array of retrieved posts.
3640 3640
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3641 3641
 			 */
3642
-			$this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) );
3642
+			$this->posts = apply_filters_ref_array('the_posts', array($this->posts, &$this));
3643 3643
 		}
3644 3644
 
3645 3645
 		// Ensure that any posts added/modified via one of the filters above are
3646 3646
 		// of the type WP_Post and are filtered.
3647
-		if ( $this->posts ) {
3648
-			$this->post_count = count( $this->posts );
3647
+		if ($this->posts) {
3648
+			$this->post_count = count($this->posts);
3649 3649
 
3650
-			$this->posts = array_map( 'get_post', $this->posts );
3650
+			$this->posts = array_map('get_post', $this->posts);
3651 3651
 
3652
-			if ( $q['cache_results'] )
3652
+			if ($q['cache_results'])
3653 3653
 				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3654 3654
 
3655
-			$this->post = reset( $this->posts );
3655
+			$this->post = reset($this->posts);
3656 3656
 		} else {
3657 3657
 			$this->post_count = 0;
3658 3658
 			$this->posts = array();
@@ -3670,15 +3670,15 @@  discard block
 block discarded – undo
3670 3670
 	 *
3671 3671
 	 * @global wpdb $wpdb
3672 3672
 	 */
3673
-	private function set_found_posts( $q, $limits ) {
3673
+	private function set_found_posts($q, $limits) {
3674 3674
 		global $wpdb;
3675 3675
 
3676 3676
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3677 3677
 		// null, or false to accommodate caching plugins that fill posts later.
3678
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3678
+		if ($q['no_found_rows'] || (is_array($this->posts) && ! $this->posts))
3679 3679
 			return;
3680 3680
 
3681
-		if ( ! empty( $limits ) ) {
3681
+		if ( ! empty($limits)) {
3682 3682
 			/**
3683 3683
 			 * Filter the query to run for retrieving the found posts.
3684 3684
 			 *
@@ -3687,9 +3687,9 @@  discard block
 block discarded – undo
3687 3687
 			 * @param string   $found_posts The query to run to find the found posts.
3688 3688
 			 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3689 3689
 			 */
3690
-			$this->found_posts = $wpdb->get_var( apply_filters_ref_array( 'found_posts_query', array( 'SELECT FOUND_ROWS()', &$this ) ) );
3690
+			$this->found_posts = $wpdb->get_var(apply_filters_ref_array('found_posts_query', array('SELECT FOUND_ROWS()', &$this)));
3691 3691
 		} else {
3692
-			$this->found_posts = count( $this->posts );
3692
+			$this->found_posts = count($this->posts);
3693 3693
 		}
3694 3694
 
3695 3695
 		/**
@@ -3700,10 +3700,10 @@  discard block
 block discarded – undo
3700 3700
 		 * @param int      $found_posts The number of posts found.
3701 3701
 		 * @param WP_Query &$this       The WP_Query instance (passed by reference).
3702 3702
 		 */
3703
-		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3703
+		$this->found_posts = apply_filters_ref_array('found_posts', array($this->found_posts, &$this));
3704 3704
 
3705
-		if ( ! empty( $limits ) )
3706
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3705
+		if ( ! empty($limits))
3706
+			$this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']);
3707 3707
 	}
3708 3708
 
3709 3709
 	/**
@@ -3737,7 +3737,7 @@  discard block
 block discarded – undo
3737 3737
 		global $post;
3738 3738
 		$this->in_the_loop = true;
3739 3739
 
3740
-		if ( $this->current_post == -1 ) // loop has just started
3740
+		if ($this->current_post == -1) // loop has just started
3741 3741
 			/**
3742 3742
 			 * Fires once the loop is started.
3743 3743
 			 *
@@ -3745,10 +3745,10 @@  discard block
 block discarded – undo
3745 3745
 			 *
3746 3746
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3747 3747
 			 */
3748
-			do_action_ref_array( 'loop_start', array( &$this ) );
3748
+			do_action_ref_array('loop_start', array(&$this));
3749 3749
 
3750 3750
 		$post = $this->next_post();
3751
-		$this->setup_postdata( $post );
3751
+		$this->setup_postdata($post);
3752 3752
 	}
3753 3753
 
3754 3754
 	/**
@@ -3762,9 +3762,9 @@  discard block
 block discarded – undo
3762 3762
 	 * @return bool True if posts are available, false if end of loop.
3763 3763
 	 */
3764 3764
 	public function have_posts() {
3765
-		if ( $this->current_post + 1 < $this->post_count ) {
3765
+		if ($this->current_post + 1 < $this->post_count) {
3766 3766
 			return true;
3767
-		} elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) {
3767
+		} elseif ($this->current_post + 1 == $this->post_count && $this->post_count > 0) {
3768 3768
 			/**
3769 3769
 			 * Fires once the loop has ended.
3770 3770
 			 *
@@ -3772,7 +3772,7 @@  discard block
 block discarded – undo
3772 3772
 			 *
3773 3773
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3774 3774
 			 */
3775
-			do_action_ref_array( 'loop_end', array( &$this ) );
3775
+			do_action_ref_array('loop_end', array(&$this));
3776 3776
 			// Do some cleaning up after the loop
3777 3777
 			$this->rewind_posts();
3778 3778
 		}
@@ -3789,7 +3789,7 @@  discard block
 block discarded – undo
3789 3789
 	 */
3790 3790
 	public function rewind_posts() {
3791 3791
 		$this->current_post = -1;
3792
-		if ( $this->post_count > 0 ) {
3792
+		if ($this->post_count > 0) {
3793 3793
 			$this->post = $this->posts[0];
3794 3794
 		}
3795 3795
 	}
@@ -3821,13 +3821,13 @@  discard block
 block discarded – undo
3821 3821
 
3822 3822
 		$comment = $this->next_comment();
3823 3823
 
3824
-		if ( $this->current_comment == 0 ) {
3824
+		if ($this->current_comment == 0) {
3825 3825
 			/**
3826 3826
 			 * Fires once the comment loop is started.
3827 3827
 			 *
3828 3828
 			 * @since 2.2.0
3829 3829
 			 */
3830
-			do_action( 'comment_loop_start' );
3830
+			do_action('comment_loop_start');
3831 3831
 		}
3832 3832
 	}
3833 3833
 
@@ -3842,9 +3842,9 @@  discard block
 block discarded – undo
3842 3842
 	 * @return bool True, if more comments. False, if no more posts.
3843 3843
 	 */
3844 3844
 	public function have_comments() {
3845
-		if ( $this->current_comment + 1 < $this->comment_count ) {
3845
+		if ($this->current_comment + 1 < $this->comment_count) {
3846 3846
 			return true;
3847
-		} elseif ( $this->current_comment + 1 == $this->comment_count ) {
3847
+		} elseif ($this->current_comment + 1 == $this->comment_count) {
3848 3848
 			$this->rewind_comments();
3849 3849
 		}
3850 3850
 
@@ -3859,7 +3859,7 @@  discard block
 block discarded – undo
3859 3859
 	 */
3860 3860
 	public function rewind_comments() {
3861 3861
 		$this->current_comment = -1;
3862
-		if ( $this->comment_count > 0 ) {
3862
+		if ($this->comment_count > 0) {
3863 3863
 			$this->comment = $this->comments[0];
3864 3864
 		}
3865 3865
 	}
@@ -3873,9 +3873,9 @@  discard block
 block discarded – undo
3873 3873
 	 * @param string $query URL query string.
3874 3874
 	 * @return array List of posts.
3875 3875
 	 */
3876
-	public function query( $query ) {
3876
+	public function query($query) {
3877 3877
 		$this->init();
3878
-		$this->query = $this->query_vars = wp_parse_args( $query );
3878
+		$this->query = $this->query_vars = wp_parse_args($query);
3879 3879
 		return $this->get_posts();
3880 3880
 	}
3881 3881
 
@@ -3892,66 +3892,66 @@  discard block
 block discarded – undo
3892 3892
 	 * @return object
3893 3893
 	 */
3894 3894
 	public function get_queried_object() {
3895
-		if ( isset($this->queried_object) )
3895
+		if (isset($this->queried_object))
3896 3896
 			return $this->queried_object;
3897 3897
 
3898 3898
 		$this->queried_object = null;
3899 3899
 		$this->queried_object_id = 0;
3900 3900
 
3901
-		if ( $this->is_category || $this->is_tag || $this->is_tax ) {
3902
-			if ( $this->is_category ) {
3903
-				if ( $this->get( 'cat' ) ) {
3904
-					$term = get_term( $this->get( 'cat' ), 'category' );
3905
-				} elseif ( $this->get( 'category_name' ) ) {
3906
-					$term = get_term_by( 'slug', $this->get( 'category_name' ), 'category' );
3901
+		if ($this->is_category || $this->is_tag || $this->is_tax) {
3902
+			if ($this->is_category) {
3903
+				if ($this->get('cat')) {
3904
+					$term = get_term($this->get('cat'), 'category');
3905
+				} elseif ($this->get('category_name')) {
3906
+					$term = get_term_by('slug', $this->get('category_name'), 'category');
3907 3907
 				}
3908
-			} elseif ( $this->is_tag ) {
3909
-				if ( $this->get( 'tag_id' ) ) {
3910
-					$term = get_term( $this->get( 'tag_id' ), 'post_tag' );
3911
-				} elseif ( $this->get( 'tag' ) ) {
3912
-					$term = get_term_by( 'slug', $this->get( 'tag' ), 'post_tag' );
3908
+			} elseif ($this->is_tag) {
3909
+				if ($this->get('tag_id')) {
3910
+					$term = get_term($this->get('tag_id'), 'post_tag');
3911
+				} elseif ($this->get('tag')) {
3912
+					$term = get_term_by('slug', $this->get('tag'), 'post_tag');
3913 3913
 				}
3914 3914
 			} else {
3915 3915
 				// For other tax queries, grab the first term from the first clause.
3916
-				$tax_query_in_and = wp_list_filter( $this->tax_query->queried_terms, array( 'operator' => 'NOT IN' ), 'NOT' );
3916
+				$tax_query_in_and = wp_list_filter($this->tax_query->queried_terms, array('operator' => 'NOT IN'), 'NOT');
3917 3917
 
3918
-				if ( ! empty( $tax_query_in_and ) ) {
3919
-					$queried_taxonomies = array_keys( $tax_query_in_and );
3920
-					$matched_taxonomy = reset( $queried_taxonomies );
3921
-					$query = $tax_query_in_and[ $matched_taxonomy ];
3918
+				if ( ! empty($tax_query_in_and)) {
3919
+					$queried_taxonomies = array_keys($tax_query_in_and);
3920
+					$matched_taxonomy = reset($queried_taxonomies);
3921
+					$query = $tax_query_in_and[$matched_taxonomy];
3922 3922
 
3923
-					if ( $query['terms'] ) {
3924
-						if ( 'term_id' == $query['field'] ) {
3925
-							$term = get_term( reset( $query['terms'] ), $matched_taxonomy );
3923
+					if ($query['terms']) {
3924
+						if ('term_id' == $query['field']) {
3925
+							$term = get_term(reset($query['terms']), $matched_taxonomy);
3926 3926
 						} else {
3927
-							$term = get_term_by( $query['field'], reset( $query['terms'] ), $matched_taxonomy );
3927
+							$term = get_term_by($query['field'], reset($query['terms']), $matched_taxonomy);
3928 3928
 						}
3929 3929
 					}
3930 3930
 				}
3931 3931
 			}
3932 3932
 
3933
-			if ( ! empty( $term ) && ! is_wp_error( $term ) )  {
3933
+			if ( ! empty($term) && ! is_wp_error($term)) {
3934 3934
 				$this->queried_object = $term;
3935 3935
 				$this->queried_object_id = (int) $term->term_id;
3936 3936
 
3937
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
3938
-					_make_cat_compat( $this->queried_object );
3937
+				if ($this->is_category && 'category' === $this->queried_object->taxonomy)
3938
+					_make_cat_compat($this->queried_object);
3939 3939
 			}
3940
-		} elseif ( $this->is_post_type_archive ) {
3941
-			$post_type = $this->get( 'post_type' );
3942
-			if ( is_array( $post_type ) )
3943
-				$post_type = reset( $post_type );
3944
-			$this->queried_object = get_post_type_object( $post_type );
3945
-		} elseif ( $this->is_posts_page ) {
3940
+		} elseif ($this->is_post_type_archive) {
3941
+			$post_type = $this->get('post_type');
3942
+			if (is_array($post_type))
3943
+				$post_type = reset($post_type);
3944
+			$this->queried_object = get_post_type_object($post_type);
3945
+		} elseif ($this->is_posts_page) {
3946 3946
 			$page_for_posts = get_option('page_for_posts');
3947
-			$this->queried_object = get_post( $page_for_posts );
3947
+			$this->queried_object = get_post($page_for_posts);
3948 3948
 			$this->queried_object_id = (int) $this->queried_object->ID;
3949
-		} elseif ( $this->is_singular && ! empty( $this->post ) ) {
3949
+		} elseif ($this->is_singular && ! empty($this->post)) {
3950 3950
 			$this->queried_object = $this->post;
3951 3951
 			$this->queried_object_id = (int) $this->post->ID;
3952
-		} elseif ( $this->is_author ) {
3952
+		} elseif ($this->is_author) {
3953 3953
 			$this->queried_object_id = (int) $this->get('author');
3954
-			$this->queried_object = get_userdata( $this->queried_object_id );
3954
+			$this->queried_object = get_userdata($this->queried_object_id);
3955 3955
 		}
3956 3956
 
3957 3957
 		return $this->queried_object;
@@ -3968,7 +3968,7 @@  discard block
 block discarded – undo
3968 3968
 	public function get_queried_object_id() {
3969 3969
 		$this->get_queried_object();
3970 3970
 
3971
-		if ( isset($this->queried_object_id) ) {
3971
+		if (isset($this->queried_object_id)) {
3972 3972
 			return $this->queried_object_id;
3973 3973
 		}
3974 3974
 
@@ -3986,7 +3986,7 @@  discard block
 block discarded – undo
3986 3986
 	 * @param string|array $query URL query string or array of vars.
3987 3987
 	 */
3988 3988
 	public function __construct($query = '') {
3989
-		if ( ! empty($query) ) {
3989
+		if ( ! empty($query)) {
3990 3990
 			$this->query($query);
3991 3991
 		}
3992 3992
 	}
@@ -4000,8 +4000,8 @@  discard block
 block discarded – undo
4000 4000
 	 * @param string $name Property to get.
4001 4001
 	 * @return mixed Property.
4002 4002
 	 */
4003
-	public function __get( $name ) {
4004
-		if ( in_array( $name, $this->compat_fields ) ) {
4003
+	public function __get($name) {
4004
+		if (in_array($name, $this->compat_fields)) {
4005 4005
 			return $this->$name;
4006 4006
 		}
4007 4007
 	}
@@ -4015,9 +4015,9 @@  discard block
 block discarded – undo
4015 4015
 	 * @param string $name Property to check if set.
4016 4016
 	 * @return bool Whether the property is set.
4017 4017
 	 */
4018
-	public function __isset( $name ) {
4019
-		if ( in_array( $name, $this->compat_fields ) ) {
4020
-			return isset( $this->$name );
4018
+	public function __isset($name) {
4019
+		if (in_array($name, $this->compat_fields)) {
4020
+			return isset($this->$name);
4021 4021
 		}
4022 4022
 	}
4023 4023
 
@@ -4031,9 +4031,9 @@  discard block
 block discarded – undo
4031 4031
 	 * @param array    $arguments Arguments to pass when calling.
4032 4032
 	 * @return mixed|false Return value of the callback, false otherwise.
4033 4033
 	 */
4034
-	public function __call( $name, $arguments ) {
4035
-		if ( in_array( $name, $this->compat_methods ) ) {
4036
-			return call_user_func_array( array( $this, $name ), $arguments );
4034
+	public function __call($name, $arguments) {
4035
+		if (in_array($name, $this->compat_methods)) {
4036
+			return call_user_func_array(array($this, $name), $arguments);
4037 4037
 		}
4038 4038
 		return false;
4039 4039
 	}
@@ -4059,16 +4059,16 @@  discard block
 block discarded – undo
4059 4059
 	 * @param mixed $post_types Optional. Post type or array of posts types to check against.
4060 4060
 	 * @return bool
4061 4061
 	 */
4062
-	public function is_post_type_archive( $post_types = '' ) {
4063
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
4062
+	public function is_post_type_archive($post_types = '') {
4063
+		if (empty($post_types) || ! $this->is_post_type_archive)
4064 4064
 			return (bool) $this->is_post_type_archive;
4065 4065
 
4066
-		$post_type = $this->get( 'post_type' );
4067
-		if ( is_array( $post_type ) )
4068
-			$post_type = reset( $post_type );
4069
-		$post_type_object = get_post_type_object( $post_type );
4066
+		$post_type = $this->get('post_type');
4067
+		if (is_array($post_type))
4068
+			$post_type = reset($post_type);
4069
+		$post_type_object = get_post_type_object($post_type);
4070 4070
 
4071
-		return in_array( $post_type_object->name, (array) $post_types );
4071
+		return in_array($post_type_object->name, (array) $post_types);
4072 4072
 	}
4073 4073
 
4074 4074
 	/**
@@ -4079,12 +4079,12 @@  discard block
 block discarded – undo
4079 4079
 	 * @param mixed $attachment Attachment ID, title, slug, or array of such.
4080 4080
 	 * @return bool
4081 4081
 	 */
4082
-	public function is_attachment( $attachment = '' ) {
4083
-		if ( ! $this->is_attachment ) {
4082
+	public function is_attachment($attachment = '') {
4083
+		if ( ! $this->is_attachment) {
4084 4084
 			return false;
4085 4085
 		}
4086 4086
 
4087
-		if ( empty( $attachment ) ) {
4087
+		if (empty($attachment)) {
4088 4088
 			return true;
4089 4089
 		}
4090 4090
 
@@ -4092,11 +4092,11 @@  discard block
 block discarded – undo
4092 4092
 
4093 4093
 		$post_obj = $this->get_queried_object();
4094 4094
 
4095
-		if ( in_array( (string) $post_obj->ID, $attachment ) ) {
4095
+		if (in_array((string) $post_obj->ID, $attachment)) {
4096 4096
 			return true;
4097
-		} elseif ( in_array( $post_obj->post_title, $attachment ) ) {
4097
+		} elseif (in_array($post_obj->post_title, $attachment)) {
4098 4098
 			return true;
4099
-		} elseif ( in_array( $post_obj->post_name, $attachment ) ) {
4099
+		} elseif (in_array($post_obj->post_name, $attachment)) {
4100 4100
 			return true;
4101 4101
 		}
4102 4102
 		return false;
@@ -4113,22 +4113,22 @@  discard block
 block discarded – undo
4113 4113
 	 * @param mixed $author Optional. User ID, nickname, nicename, or array of User IDs, nicknames, and nicenames
4114 4114
 	 * @return bool
4115 4115
 	 */
4116
-	public function is_author( $author = '' ) {
4117
-		if ( !$this->is_author )
4116
+	public function is_author($author = '') {
4117
+		if ( ! $this->is_author)
4118 4118
 			return false;
4119 4119
 
4120
-		if ( empty($author) )
4120
+		if (empty($author))
4121 4121
 			return true;
4122 4122
 
4123 4123
 		$author_obj = $this->get_queried_object();
4124 4124
 
4125 4125
 		$author = (array) $author;
4126 4126
 
4127
-		if ( in_array( (string) $author_obj->ID, $author ) )
4127
+		if (in_array((string) $author_obj->ID, $author))
4128 4128
 			return true;
4129
-		elseif ( in_array( $author_obj->nickname, $author ) )
4129
+		elseif (in_array($author_obj->nickname, $author))
4130 4130
 			return true;
4131
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
4131
+		elseif (in_array($author_obj->user_nicename, $author))
4132 4132
 			return true;
4133 4133
 
4134 4134
 		return false;
@@ -4145,22 +4145,22 @@  discard block
 block discarded – undo
4145 4145
 	 * @param mixed $category Optional. Category ID, name, slug, or array of Category IDs, names, and slugs.
4146 4146
 	 * @return bool
4147 4147
 	 */
4148
-	public function is_category( $category = '' ) {
4149
-		if ( !$this->is_category )
4148
+	public function is_category($category = '') {
4149
+		if ( ! $this->is_category)
4150 4150
 			return false;
4151 4151
 
4152
-		if ( empty($category) )
4152
+		if (empty($category))
4153 4153
 			return true;
4154 4154
 
4155 4155
 		$cat_obj = $this->get_queried_object();
4156 4156
 
4157 4157
 		$category = (array) $category;
4158 4158
 
4159
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
4159
+		if (in_array((string) $cat_obj->term_id, $category))
4160 4160
 			return true;
4161
-		elseif ( in_array( $cat_obj->name, $category ) )
4161
+		elseif (in_array($cat_obj->name, $category))
4162 4162
 			return true;
4163
-		elseif ( in_array( $cat_obj->slug, $category ) )
4163
+		elseif (in_array($cat_obj->slug, $category))
4164 4164
 			return true;
4165 4165
 
4166 4166
 		return false;
@@ -4177,22 +4177,22 @@  discard block
 block discarded – undo
4177 4177
 	 * @param mixed $tag Optional. Tag ID, name, slug, or array of Tag IDs, names, and slugs.
4178 4178
 	 * @return bool
4179 4179
 	 */
4180
-	public function is_tag( $tag = '' ) {
4181
-		if ( ! $this->is_tag )
4180
+	public function is_tag($tag = '') {
4181
+		if ( ! $this->is_tag)
4182 4182
 			return false;
4183 4183
 
4184
-		if ( empty( $tag ) )
4184
+		if (empty($tag))
4185 4185
 			return true;
4186 4186
 
4187 4187
 		$tag_obj = $this->get_queried_object();
4188 4188
 
4189 4189
 		$tag = (array) $tag;
4190 4190
 
4191
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
4191
+		if (in_array((string) $tag_obj->term_id, $tag))
4192 4192
 			return true;
4193
-		elseif ( in_array( $tag_obj->name, $tag ) )
4193
+		elseif (in_array($tag_obj->name, $tag))
4194 4194
 			return true;
4195
-		elseif ( in_array( $tag_obj->slug, $tag ) )
4195
+		elseif (in_array($tag_obj->slug, $tag))
4196 4196
 			return true;
4197 4197
 
4198 4198
 		return false;
@@ -4216,32 +4216,32 @@  discard block
 block discarded – undo
4216 4216
 	 * @param mixed $term     Optional. Term ID, name, slug or array of Term IDs, names, and slugs.
4217 4217
 	 * @return bool
4218 4218
 	 */
4219
-	public function is_tax( $taxonomy = '', $term = '' ) {
4219
+	public function is_tax($taxonomy = '', $term = '') {
4220 4220
 		global $wp_taxonomies;
4221 4221
 
4222
-		if ( !$this->is_tax )
4222
+		if ( ! $this->is_tax)
4223 4223
 			return false;
4224 4224
 
4225
-		if ( empty( $taxonomy ) )
4225
+		if (empty($taxonomy))
4226 4226
 			return true;
4227 4227
 
4228 4228
 		$queried_object = $this->get_queried_object();
4229
-		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
4229
+		$tax_array = array_intersect(array_keys($wp_taxonomies), (array) $taxonomy);
4230 4230
 		$term_array = (array) $term;
4231 4231
 
4232 4232
 		// Check that the taxonomy matches.
4233
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
4233
+		if ( ! (isset($queried_object->taxonomy) && count($tax_array) && in_array($queried_object->taxonomy, $tax_array)))
4234 4234
 			return false;
4235 4235
 
4236 4236
 		// Only a Taxonomy provided.
4237
-		if ( empty( $term ) )
4237
+		if (empty($term))
4238 4238
 			return true;
4239 4239
 
4240
-		return isset( $queried_object->term_id ) &&
4241
-			count( array_intersect(
4242
-				array( $queried_object->term_id, $queried_object->name, $queried_object->slug ),
4240
+		return isset($queried_object->term_id) &&
4241
+			count(array_intersect(
4242
+				array($queried_object->term_id, $queried_object->name, $queried_object->slug),
4243 4243
 				$term_array
4244
-			) );
4244
+			));
4245 4245
 	}
4246 4246
 
4247 4247
 	/**
@@ -4285,13 +4285,13 @@  discard block
 block discarded – undo
4285 4285
 	 * @param string|array $feeds Optional feed types to check.
4286 4286
 	 * @return bool
4287 4287
 	 */
4288
-	public function is_feed( $feeds = '' ) {
4289
-		if ( empty( $feeds ) || ! $this->is_feed )
4288
+	public function is_feed($feeds = '') {
4289
+		if (empty($feeds) || ! $this->is_feed)
4290 4290
 			return (bool) $this->is_feed;
4291
-		$qv = $this->get( 'feed' );
4292
-		if ( 'feed' == $qv )
4291
+		$qv = $this->get('feed');
4292
+		if ('feed' == $qv)
4293 4293
 			$qv = get_default_feed();
4294
-		return in_array( $qv, (array) $feeds );
4294
+		return in_array($qv, (array) $feeds);
4295 4295
 	}
4296 4296
 
4297 4297
 	/**
@@ -4323,9 +4323,9 @@  discard block
 block discarded – undo
4323 4323
 	 */
4324 4324
 	public function is_front_page() {
4325 4325
 		// most likely case
4326
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
4326
+		if ('posts' == get_option('show_on_front') && $this->is_home())
4327 4327
 			return true;
4328
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
4328
+		elseif ('page' == get_option('show_on_front') && get_option('page_on_front') && $this->is_page(get_option('page_on_front')))
4329 4329
 			return true;
4330 4330
 		else
4331 4331
 			return false;
@@ -4376,31 +4376,31 @@  discard block
 block discarded – undo
4376 4376
 	 * @param mixed $page Page ID, title, slug, path, or array of such.
4377 4377
 	 * @return bool
4378 4378
 	 */
4379
-	public function is_page( $page = '' ) {
4380
-		if ( !$this->is_page )
4379
+	public function is_page($page = '') {
4380
+		if ( ! $this->is_page)
4381 4381
 			return false;
4382 4382
 
4383
-		if ( empty( $page ) )
4383
+		if (empty($page))
4384 4384
 			return true;
4385 4385
 
4386 4386
 		$page_obj = $this->get_queried_object();
4387 4387
 
4388 4388
 		$page = (array) $page;
4389 4389
 
4390
-		if ( in_array( (string) $page_obj->ID, $page ) ) {
4390
+		if (in_array((string) $page_obj->ID, $page)) {
4391 4391
 			return true;
4392
-		} elseif ( in_array( $page_obj->post_title, $page ) ) {
4392
+		} elseif (in_array($page_obj->post_title, $page)) {
4393 4393
 			return true;
4394
-		} elseif ( in_array( $page_obj->post_name, $page ) ) {
4394
+		} elseif (in_array($page_obj->post_name, $page)) {
4395 4395
 			return true;
4396 4396
 		} else {
4397
-			foreach ( $page as $pagepath ) {
4398
-				if ( ! strpos( $pagepath, '/' ) ) {
4397
+			foreach ($page as $pagepath) {
4398
+				if ( ! strpos($pagepath, '/')) {
4399 4399
 					continue;
4400 4400
 				}
4401
-				$pagepath_obj = get_page_by_path( $pagepath );
4401
+				$pagepath_obj = get_page_by_path($pagepath);
4402 4402
 
4403
-				if ( $pagepath_obj && ( $pagepath_obj->ID == $page_obj->ID ) ) {
4403
+				if ($pagepath_obj && ($pagepath_obj->ID == $page_obj->ID)) {
4404 4404
 					return true;
4405 4405
 				}
4406 4406
 			}
@@ -4469,31 +4469,31 @@  discard block
 block discarded – undo
4469 4469
 	 * @param mixed $post Post ID, title, slug, path, or array of such.
4470 4470
 	 * @return bool
4471 4471
 	 */
4472
-	public function is_single( $post = '' ) {
4473
-		if ( !$this->is_single )
4472
+	public function is_single($post = '') {
4473
+		if ( ! $this->is_single)
4474 4474
 			return false;
4475 4475
 
4476
-		if ( empty($post) )
4476
+		if (empty($post))
4477 4477
 			return true;
4478 4478
 
4479 4479
 		$post_obj = $this->get_queried_object();
4480 4480
 
4481 4481
 		$post = (array) $post;
4482 4482
 
4483
-		if ( in_array( (string) $post_obj->ID, $post ) ) {
4483
+		if (in_array((string) $post_obj->ID, $post)) {
4484 4484
 			return true;
4485
-		} elseif ( in_array( $post_obj->post_title, $post ) ) {
4485
+		} elseif (in_array($post_obj->post_title, $post)) {
4486 4486
 			return true;
4487
-		} elseif ( in_array( $post_obj->post_name, $post ) ) {
4487
+		} elseif (in_array($post_obj->post_name, $post)) {
4488 4488
 			return true;
4489 4489
 		} else {
4490
-			foreach ( $post as $postpath ) {
4491
-				if ( ! strpos( $postpath, '/' ) ) {
4490
+			foreach ($post as $postpath) {
4491
+				if ( ! strpos($postpath, '/')) {
4492 4492
 					continue;
4493 4493
 				}
4494
-				$postpath_obj = get_page_by_path( $postpath, OBJECT, $post_obj->post_type );
4494
+				$postpath_obj = get_page_by_path($postpath, OBJECT, $post_obj->post_type);
4495 4495
 
4496
-				if ( $postpath_obj && ( $postpath_obj->ID == $post_obj->ID ) ) {
4496
+				if ($postpath_obj && ($postpath_obj->ID == $post_obj->ID)) {
4497 4497
 					return true;
4498 4498
 				}
4499 4499
 			}
@@ -4515,13 +4515,13 @@  discard block
 block discarded – undo
4515 4515
 	 * @param mixed $post_types Optional. Post Type or array of Post Types
4516 4516
 	 * @return bool
4517 4517
 	 */
4518
-	public function is_singular( $post_types = '' ) {
4519
-		if ( empty( $post_types ) || !$this->is_singular )
4518
+	public function is_singular($post_types = '') {
4519
+		if (empty($post_types) || ! $this->is_singular)
4520 4520
 			return (bool) $this->is_singular;
4521 4521
 
4522 4522
 		$post_obj = $this->get_queried_object();
4523 4523
 
4524
-		return in_array( $post_obj->post_type, (array) $post_types );
4524
+		return in_array($post_obj->post_type, (array) $post_types);
4525 4525
 	}
4526 4526
 
4527 4527
 	/**
@@ -4600,7 +4600,7 @@  discard block
 block discarded – undo
4600 4600
 	 * @param WP_Post $post Post data.
4601 4601
 	 * @return true True when finished.
4602 4602
 	 */
4603
-	public function setup_postdata( $post ) {
4603
+	public function setup_postdata($post) {
4604 4604
 		global $id, $authordata, $currentday, $currentmonth, $page, $pages, $multipage, $more, $numpages;
4605 4605
 
4606 4606
 		$id = (int) $post->ID;
@@ -4611,40 +4611,40 @@  discard block
 block discarded – undo
4611 4611
 		$currentmonth = mysql2date('m', $post->post_date, false);
4612 4612
 		$numpages = 1;
4613 4613
 		$multipage = 0;
4614
-		$page = $this->get( 'page' );
4615
-		if ( ! $page )
4614
+		$page = $this->get('page');
4615
+		if ( ! $page)
4616 4616
 			$page = 1;
4617 4617
 
4618 4618
 		/*
4619 4619
 		 * Force full post content when viewing the permalink for the $post,
4620 4620
 		 * or when on an RSS feed. Otherwise respect the 'more' tag.
4621 4621
 		 */
4622
-		if ( $post->ID === get_queried_object_id() && ( $this->is_page() || $this->is_single() ) ) {
4622
+		if ($post->ID === get_queried_object_id() && ($this->is_page() || $this->is_single())) {
4623 4623
 			$more = 1;
4624
-		} elseif ( $this->is_feed() ) {
4624
+		} elseif ($this->is_feed()) {
4625 4625
 			$more = 1;
4626 4626
 		} else {
4627 4627
 			$more = 0;
4628 4628
 		}
4629 4629
 
4630 4630
 		$content = $post->post_content;
4631
-		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
4632
-			if ( $page > 1 )
4631
+		if (false !== strpos($content, '<!--nextpage-->')) {
4632
+			if ($page > 1)
4633 4633
 				$more = 1;
4634
-			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
4635
-			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
4636
-			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4634
+			$content = str_replace("\n<!--nextpage-->\n", '<!--nextpage-->', $content);
4635
+			$content = str_replace("\n<!--nextpage-->", '<!--nextpage-->', $content);
4636
+			$content = str_replace("<!--nextpage-->\n", '<!--nextpage-->', $content);
4637 4637
 
4638 4638
 			// Ignore nextpage at the beginning of the content.
4639
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4640
-				$content = substr( $content, 15 );
4639
+			if (0 === strpos($content, '<!--nextpage-->'))
4640
+				$content = substr($content, 15);
4641 4641
 
4642 4642
 			$pages = explode('<!--nextpage-->', $content);
4643 4643
 			$numpages = count($pages);
4644
-			if ( $numpages > 1 )
4644
+			if ($numpages > 1)
4645 4645
 				$multipage = 1;
4646 4646
 		} else {
4647
-			$pages = array( $post->post_content );
4647
+			$pages = array($post->post_content);
4648 4648
 		}
4649 4649
 
4650 4650
 		/**
@@ -4656,7 +4656,7 @@  discard block
 block discarded – undo
4656 4656
 		 * @param WP_Post  &$post The Post object (passed by reference).
4657 4657
 		 * @param WP_Query &$this The current Query object (passed by reference).
4658 4658
 		 */
4659
-		do_action_ref_array( 'the_post', array( &$post, &$this ) );
4659
+		do_action_ref_array('the_post', array(&$post, &$this));
4660 4660
 
4661 4661
 		return true;
4662 4662
 	}
@@ -4669,9 +4669,9 @@  discard block
 block discarded – undo
4669 4669
 	 * @global WP_Post $post
4670 4670
 	 */
4671 4671
 	public function reset_postdata() {
4672
-		if ( ! empty( $this->post ) ) {
4672
+		if ( ! empty($this->post)) {
4673 4673
 			$GLOBALS['post'] = $this->post;
4674
-			setup_postdata( $this->post );
4674
+			setup_postdata($this->post);
4675 4675
 		}
4676 4676
 	}
4677 4677
 }
@@ -4688,49 +4688,49 @@  discard block
 block discarded – undo
4688 4688
  */
4689 4689
 function wp_old_slug_redirect() {
4690 4690
 	global $wp_query;
4691
-	if ( is_404() && '' != $wp_query->query_vars['name'] ) :
4691
+	if (is_404() && '' != $wp_query->query_vars['name']) :
4692 4692
 		global $wpdb;
4693 4693
 
4694 4694
 		// Guess the current post_type based on the query vars.
4695
-		if ( get_query_var('post_type') )
4695
+		if (get_query_var('post_type'))
4696 4696
 			$post_type = get_query_var('post_type');
4697
-		elseif ( !empty($wp_query->query_vars['pagename']) )
4697
+		elseif ( ! empty($wp_query->query_vars['pagename']))
4698 4698
 			$post_type = 'page';
4699 4699
 		else
4700 4700
 			$post_type = 'post';
4701 4701
 
4702
-		if ( is_array( $post_type ) ) {
4703
-			if ( count( $post_type ) > 1 )
4702
+		if (is_array($post_type)) {
4703
+			if (count($post_type) > 1)
4704 4704
 				return;
4705
-			$post_type = reset( $post_type );
4705
+			$post_type = reset($post_type);
4706 4706
 		}
4707 4707
 
4708 4708
 		// Do not attempt redirect for hierarchical post types
4709
-		if ( is_post_type_hierarchical( $post_type ) )
4709
+		if (is_post_type_hierarchical($post_type))
4710 4710
 			return;
4711 4711
 
4712 4712
 		$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']);
4713 4713
 
4714 4714
 		// if year, monthnum, or day have been specified, make our query more precise
4715 4715
 		// just in case there are multiple identical _wp_old_slug values
4716
-		if ( '' != $wp_query->query_vars['year'] )
4716
+		if ('' != $wp_query->query_vars['year'])
4717 4717
 			$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
4718
-		if ( '' != $wp_query->query_vars['monthnum'] )
4718
+		if ('' != $wp_query->query_vars['monthnum'])
4719 4719
 			$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
4720
-		if ( '' != $wp_query->query_vars['day'] )
4720
+		if ('' != $wp_query->query_vars['day'])
4721 4721
 			$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
4722 4722
 
4723 4723
 		$id = (int) $wpdb->get_var($query);
4724 4724
 
4725
-		if ( ! $id )
4725
+		if ( ! $id)
4726 4726
 			return;
4727 4727
 
4728 4728
 		$link = get_permalink($id);
4729 4729
 
4730
-		if ( !$link )
4730
+		if ( ! $link)
4731 4731
 			return;
4732 4732
 
4733
-		wp_redirect( $link, 301 ); // Permanent redirect
4733
+		wp_redirect($link, 301); // Permanent redirect
4734 4734
 		exit;
4735 4735
 	endif;
4736 4736
 }
@@ -4745,11 +4745,11 @@  discard block
 block discarded – undo
4745 4745
  * @param object $post Post data.
4746 4746
  * @return bool True when finished.
4747 4747
  */
4748
-function setup_postdata( $post ) {
4748
+function setup_postdata($post) {
4749 4749
 	global $wp_query;
4750 4750
 
4751
-	if ( ! empty( $wp_query ) && $wp_query instanceof WP_Query ) {
4752
-		return $wp_query->setup_postdata( $post );
4751
+	if ( ! empty($wp_query) && $wp_query instanceof WP_Query) {
4752
+		return $wp_query->setup_postdata($post);
4753 4753
 	}
4754 4754
 
4755 4755
 	return false;
Please login to merge, or discard this patch.
Braces   +464 added lines, -320 removed lines patch added patch discarded remove patch
@@ -1430,8 +1430,9 @@  discard block
 block discarded – undo
1430 1430
 		);
1431 1431
 
1432 1432
 		foreach ( $keys as $key ) {
1433
-			if ( !isset($array[$key]) )
1434
-				$array[$key] = '';
1433
+			if ( !isset($array[$key]) ) {
1434
+							$array[$key] = '';
1435
+			}
1435 1436
 		}
1436 1437
 
1437 1438
 		$array_keys = array( 'category__in', 'category__not_in', 'category__and', 'post__in', 'post__not_in', 'post_name__in',
@@ -1439,8 +1440,9 @@  discard block
 block discarded – undo
1439 1440
 			'author__in', 'author__not_in' );
1440 1441
 
1441 1442
 		foreach ( $array_keys as $key ) {
1442
-			if ( !isset($array[$key]) )
1443
-				$array[$key] = array();
1443
+			if ( !isset($array[$key]) ) {
1444
+							$array[$key] = array();
1445
+			}
1444 1446
 		}
1445 1447
 		return $array;
1446 1448
 	}
@@ -1562,8 +1564,9 @@  discard block
 block discarded – undo
1562 1564
 		$qv = &$this->query_vars;
1563 1565
 		$this->query_vars_changed = true;
1564 1566
 
1565
-		if ( ! empty($qv['robots']) )
1566
-			$this->is_robots = true;
1567
+		if ( ! empty($qv['robots']) ) {
1568
+					$this->is_robots = true;
1569
+		}
1567 1570
 
1568 1571
 		$qv['p'] =  absint($qv['p']);
1569 1572
 		$qv['page_id'] =  absint($qv['page_id']);
@@ -1577,10 +1580,18 @@  discard block
 block discarded – undo
1577 1580
 		$qv['author'] = preg_replace( '|[^0-9,-]|', '', $qv['author'] ); // comma separated list of positive or negative integers
1578 1581
 		$qv['pagename'] = trim( $qv['pagename'] );
1579 1582
 		$qv['name'] = trim( $qv['name'] );
1580
-		if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']);
1581
-		if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']);
1582
-		if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']);
1583
-		if ( '' !== $qv['menu_order'] ) $qv['menu_order'] = absint($qv['menu_order']);
1583
+		if ( '' !== $qv['hour'] ) {
1584
+			$qv['hour'] = absint($qv['hour']);
1585
+		}
1586
+		if ( '' !== $qv['minute'] ) {
1587
+			$qv['minute'] = absint($qv['minute']);
1588
+		}
1589
+		if ( '' !== $qv['second'] ) {
1590
+			$qv['second'] = absint($qv['second']);
1591
+		}
1592
+		if ( '' !== $qv['menu_order'] ) {
1593
+			$qv['menu_order'] = absint($qv['menu_order']);
1594
+		}
1584 1595
 
1585 1596
 		// Fairly insane upper bound for search string lengths.
1586 1597
 		if ( ! is_scalar( $qv['s'] ) || ( ! empty( $qv['s'] ) && strlen( $qv['s'] ) > 1600 ) ) {
@@ -1588,10 +1599,12 @@  discard block
 block discarded – undo
1588 1599
 		}
1589 1600
 
1590 1601
 		// Compat. Map subpost to attachment.
1591
-		if ( '' != $qv['subpost'] )
1592
-			$qv['attachment'] = $qv['subpost'];
1593
-		if ( '' != $qv['subpost_id'] )
1594
-			$qv['attachment_id'] = $qv['subpost_id'];
1602
+		if ( '' != $qv['subpost'] ) {
1603
+					$qv['attachment'] = $qv['subpost'];
1604
+		}
1605
+		if ( '' != $qv['subpost_id'] ) {
1606
+					$qv['attachment_id'] = $qv['subpost_id'];
1607
+		}
1595 1608
 
1596 1609
 		$qv['attachment_id'] = absint($qv['attachment_id']);
1597 1610
 
@@ -1707,37 +1720,46 @@  discard block
 block discarded – undo
1707 1720
 				$this->is_author = true;
1708 1721
 			}
1709 1722
 
1710
-			if ( '' != $qv['author_name'] )
1711
-				$this->is_author = true;
1723
+			if ( '' != $qv['author_name'] ) {
1724
+							$this->is_author = true;
1725
+			}
1712 1726
 
1713 1727
 			if ( !empty( $qv['post_type'] ) && ! is_array( $qv['post_type'] ) ) {
1714 1728
 				$post_type_obj = get_post_type_object( $qv['post_type'] );
1715
-				if ( ! empty( $post_type_obj->has_archive ) )
1716
-					$this->is_post_type_archive = true;
1729
+				if ( ! empty( $post_type_obj->has_archive ) ) {
1730
+									$this->is_post_type_archive = true;
1731
+				}
1717 1732
 			}
1718 1733
 
1719
-			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax )
1720
-				$this->is_archive = true;
1734
+			if ( $this->is_post_type_archive || $this->is_date || $this->is_author || $this->is_category || $this->is_tag || $this->is_tax ) {
1735
+							$this->is_archive = true;
1736
+			}
1721 1737
 		}
1722 1738
 
1723
-		if ( '' != $qv['feed'] )
1724
-			$this->is_feed = true;
1739
+		if ( '' != $qv['feed'] ) {
1740
+					$this->is_feed = true;
1741
+		}
1725 1742
 
1726
-		if ( '' != $qv['tb'] )
1727
-			$this->is_trackback = true;
1743
+		if ( '' != $qv['tb'] ) {
1744
+					$this->is_trackback = true;
1745
+		}
1728 1746
 
1729
-		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) )
1730
-			$this->is_paged = true;
1747
+		if ( '' != $qv['paged'] && ( intval($qv['paged']) > 1 ) ) {
1748
+					$this->is_paged = true;
1749
+		}
1731 1750
 
1732
-		if ( '' != $qv['comments_popup'] )
1733
-			$this->is_comments_popup = true;
1751
+		if ( '' != $qv['comments_popup'] ) {
1752
+					$this->is_comments_popup = true;
1753
+		}
1734 1754
 
1735 1755
 		// if we're previewing inside the write screen
1736
-		if ( '' != $qv['preview'] )
1737
-			$this->is_preview = true;
1756
+		if ( '' != $qv['preview'] ) {
1757
+					$this->is_preview = true;
1758
+		}
1738 1759
 
1739
-		if ( is_admin() )
1740
-			$this->is_admin = true;
1760
+		if ( is_admin() ) {
1761
+					$this->is_admin = true;
1762
+		}
1741 1763
 
1742 1764
 		if ( false !== strpos($qv['feed'], 'comments-') ) {
1743 1765
 			$qv['feed'] = str_replace('comments-', '', $qv['feed']);
@@ -1746,18 +1768,21 @@  discard block
 block discarded – undo
1746 1768
 
1747 1769
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1748 1770
 
1749
-		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) )
1750
-			$this->is_comment_feed = true;
1771
+		if ( $this->is_feed && ( !empty($qv['withcomments']) || ( empty($qv['withoutcomments']) && $this->is_singular ) ) ) {
1772
+					$this->is_comment_feed = true;
1773
+		}
1751 1774
 
1752
-		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) )
1753
-			$this->is_home = true;
1775
+		if ( !( $this->is_singular || $this->is_archive || $this->is_search || $this->is_feed || $this->is_trackback || $this->is_404 || $this->is_admin || $this->is_comments_popup || $this->is_robots ) ) {
1776
+					$this->is_home = true;
1777
+		}
1754 1778
 
1755 1779
 		// Correct is_* for page_on_front and page_for_posts
1756 1780
 		if ( $this->is_home && 'page' == get_option('show_on_front') && get_option('page_on_front') ) {
1757 1781
 			$_query = wp_parse_args($this->query);
1758 1782
 			// pagename can be set and empty depending on matched rewrite rules. Ignore an empty pagename.
1759
-			if ( isset($_query['pagename']) && '' == $_query['pagename'] )
1760
-				unset($_query['pagename']);
1783
+			if ( isset($_query['pagename']) && '' == $_query['pagename'] ) {
1784
+							unset($_query['pagename']);
1785
+			}
1761 1786
 			if ( empty($_query) || !array_diff( array_keys($_query), array('preview', 'page', 'paged', 'cpage') ) ) {
1762 1787
 				$this->is_page = true;
1763 1788
 				$this->is_home = false;
@@ -1772,10 +1797,11 @@  discard block
 block discarded – undo
1772 1797
 
1773 1798
 		if ( '' != $qv['pagename'] ) {
1774 1799
 			$this->queried_object = get_page_by_path($qv['pagename']);
1775
-			if ( !empty($this->queried_object) )
1776
-				$this->queried_object_id = (int) $this->queried_object->ID;
1777
-			else
1778
-				unset($this->queried_object);
1800
+			if ( !empty($this->queried_object) ) {
1801
+							$this->queried_object_id = (int) $this->queried_object->ID;
1802
+			} else {
1803
+							unset($this->queried_object);
1804
+			}
1779 1805
 
1780 1806
 			if  ( 'page' == get_option('show_on_front') && isset($this->queried_object_id) && $this->queried_object_id == get_option('page_for_posts') ) {
1781 1807
 				$this->is_page = false;
@@ -1793,27 +1819,31 @@  discard block
 block discarded – undo
1793 1819
 		}
1794 1820
 
1795 1821
 		if ( !empty($qv['post_type']) ) {
1796
-			if ( is_array($qv['post_type']) )
1797
-				$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1798
-			else
1799
-				$qv['post_type'] = sanitize_key($qv['post_type']);
1822
+			if ( is_array($qv['post_type']) ) {
1823
+							$qv['post_type'] = array_map('sanitize_key', $qv['post_type']);
1824
+			} else {
1825
+							$qv['post_type'] = sanitize_key($qv['post_type']);
1826
+			}
1800 1827
 		}
1801 1828
 
1802 1829
 		if ( ! empty( $qv['post_status'] ) ) {
1803
-			if ( is_array( $qv['post_status'] ) )
1804
-				$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1805
-			else
1806
-				$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1830
+			if ( is_array( $qv['post_status'] ) ) {
1831
+							$qv['post_status'] = array_map('sanitize_key', $qv['post_status']);
1832
+			} else {
1833
+							$qv['post_status'] = preg_replace('|[^a-z0-9_,-]|', '', $qv['post_status']);
1834
+			}
1807 1835
 		}
1808 1836
 
1809
-		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) )
1810
-			$this->is_comment_feed = false;
1837
+		if ( $this->is_posts_page && ( ! isset($qv['withcomments']) || ! $qv['withcomments'] ) ) {
1838
+					$this->is_comment_feed = false;
1839
+		}
1811 1840
 
1812 1841
 		$this->is_singular = $this->is_single || $this->is_page || $this->is_attachment;
1813 1842
 		// Done correcting is_* for page_on_front and page_for_posts
1814 1843
 
1815
-		if ( '404' == $qv['error'] )
1816
-			$this->set_404();
1844
+		if ( '404' == $qv['error'] ) {
1845
+					$this->set_404();
1846
+		}
1817 1847
 
1818 1848
 		$this->query_vars_hash = md5( serialize( $this->query_vars ) );
1819 1849
 		$this->query_vars_changed = false;
@@ -1854,8 +1884,10 @@  discard block
 block discarded – undo
1854 1884
 		}
1855 1885
 
1856 1886
 		foreach ( get_taxonomies( array() , 'objects' ) as $taxonomy => $t ) {
1857
-			if ( 'post_tag' == $taxonomy )
1858
-				continue;	// Handled further down in the $q['tag'] block
1887
+			if ( 'post_tag' == $taxonomy ) {
1888
+							continue;
1889
+			}
1890
+			// Handled further down in the $q['tag'] block
1859 1891
 
1860 1892
 			if ( $t->query_var && !empty( $q[$t->query_var] ) ) {
1861 1893
 				$tax_query_defaults = array(
@@ -1897,10 +1929,11 @@  discard block
 block discarded – undo
1897 1929
 			$q['cat'] = implode( ',', $cat_array );
1898 1930
 
1899 1931
 			foreach ( $cat_array as $cat ) {
1900
-				if ( $cat > 0 )
1901
-					$cat_in[] = $cat;
1902
-				elseif ( $cat < 0 )
1903
-					$cat_not_in[] = abs( $cat );
1932
+				if ( $cat > 0 ) {
1933
+									$cat_in[] = $cat;
1934
+				} elseif ( $cat < 0 ) {
1935
+									$cat_not_in[] = abs( $cat );
1936
+				}
1904 1937
 			}
1905 1938
 
1906 1939
 			if ( ! empty( $cat_in ) ) {
@@ -1926,8 +1959,9 @@  discard block
 block discarded – undo
1926 1959
 
1927 1960
 		if ( ! empty( $q['category__and'] ) && 1 === count( (array) $q['category__and'] ) ) {
1928 1961
 			$q['category__and'] = (array) $q['category__and'];
1929
-			if ( ! isset( $q['category__in'] ) )
1930
-				$q['category__in'] = array();
1962
+			if ( ! isset( $q['category__in'] ) ) {
1963
+							$q['category__in'] = array();
1964
+			}
1931 1965
 			$q['category__in'][] = absint( reset( $q['category__and'] ) );
1932 1966
 			unset( $q['category__and'] );
1933 1967
 		}
@@ -2064,8 +2098,9 @@  discard block
 block discarded – undo
2064 2098
 
2065 2099
 		// added slashes screw with quote grouping when done early, so done later
2066 2100
 		$q['s'] = stripslashes( $q['s'] );
2067
-		if ( empty( $_GET['s'] ) && $this->is_main_query() )
2068
-			$q['s'] = urldecode( $q['s'] );
2101
+		if ( empty( $_GET['s'] ) && $this->is_main_query() ) {
2102
+					$q['s'] = urldecode( $q['s'] );
2103
+		}
2069 2104
 		// there are no line breaks in <input /> fields
2070 2105
 		$q['s'] = str_replace( array( "\r", "\n" ), '', $q['s'] );
2071 2106
 		$q['search_terms_count'] = 1;
@@ -2076,8 +2111,9 @@  discard block
 block discarded – undo
2076 2111
 				$q['search_terms_count'] = count( $matches[0] );
2077 2112
 				$q['search_terms'] = $this->parse_search_terms( $matches[0] );
2078 2113
 				// if the search string has only short terms or stopwords, or is 10+ terms long, match it as sentence
2079
-				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 )
2080
-					$q['search_terms'] = array( $q['s'] );
2114
+				if ( empty( $q['search_terms'] ) || count( $q['search_terms'] ) > 9 ) {
2115
+									$q['search_terms'] = array( $q['s'] );
2116
+				}
2081 2117
 			} else {
2082 2118
 				$q['search_terms'] = array( $q['s'] );
2083 2119
 			}
@@ -2099,8 +2135,9 @@  discard block
 block discarded – undo
2099 2135
 
2100 2136
 		if ( ! empty( $search ) ) {
2101 2137
 			$search = " AND ({$search}) ";
2102
-			if ( ! is_user_logged_in() )
2103
-				$search .= " AND ($wpdb->posts.post_password = '') ";
2138
+			if ( ! is_user_logged_in() ) {
2139
+							$search .= " AND ($wpdb->posts.post_password = '') ";
2140
+			}
2104 2141
 		}
2105 2142
 
2106 2143
 		return $search;
@@ -2126,17 +2163,20 @@  discard block
 block discarded – undo
2126 2163
 
2127 2164
 		foreach ( $terms as $term ) {
2128 2165
 			// keep before/after spaces when term is for exact match
2129
-			if ( preg_match( '/^".+"$/', $term ) )
2130
-				$term = trim( $term, "\"'" );
2131
-			else
2132
-				$term = trim( $term, "\"' " );
2166
+			if ( preg_match( '/^".+"$/', $term ) ) {
2167
+							$term = trim( $term, "\"'" );
2168
+			} else {
2169
+							$term = trim( $term, "\"' " );
2170
+			}
2133 2171
 
2134 2172
 			// Avoid single A-Z.
2135
-			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) )
2136
-				continue;
2173
+			if ( ! $term || ( 1 === strlen( $term ) && preg_match( '/^[a-z]$/i', $term ) ) ) {
2174
+							continue;
2175
+			}
2137 2176
 
2138
-			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) )
2139
-				continue;
2177
+			if ( in_array( call_user_func( $strtolower, $term ), $stopwords, true ) ) {
2178
+							continue;
2179
+			}
2140 2180
 
2141 2181
 			$checked[] = $term;
2142 2182
 		}
@@ -2152,8 +2192,9 @@  discard block
 block discarded – undo
2152 2192
 	 * @return array Stopwords.
2153 2193
 	 */
2154 2194
 	protected function get_search_stopwords() {
2155
-		if ( isset( $this->stopwords ) )
2156
-			return $this->stopwords;
2195
+		if ( isset( $this->stopwords ) ) {
2196
+					return $this->stopwords;
2197
+		}
2157 2198
 
2158 2199
 		/* translators: This is a comma-separated list of very common words that should be excluded from a search,
2159 2200
 		 * like a, an, and the. These are usually called "stopwords". You should not simply translate these individual
@@ -2165,8 +2206,9 @@  discard block
 block discarded – undo
2165 2206
 		$stopwords = array();
2166 2207
 		foreach( $words as $word ) {
2167 2208
 			$word = trim( $word, "\r\n\t " );
2168
-			if ( $word )
2169
-				$stopwords[] = $word;
2209
+			if ( $word ) {
2210
+							$stopwords[] = $word;
2211
+			}
2170 2212
 		}
2171 2213
 
2172 2214
 		/**
@@ -2205,8 +2247,9 @@  discard block
 block discarded – undo
2205 2247
 				// all words in title
2206 2248
 				$search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 ';
2207 2249
 				// any word in title, not needed when $num_terms == 1
2208
-				if ( $num_terms > 1 )
2209
-					$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2250
+				if ( $num_terms > 1 ) {
2251
+									$search_orderby .= 'WHEN ' . implode( ' OR ', $q['search_orderby_title'] ) . ' THEN 3 ';
2252
+				}
2210 2253
 			}
2211 2254
 
2212 2255
 			// sentence match in 'post_content'
@@ -2435,34 +2478,41 @@  discard block
 block discarded – undo
2435 2478
 
2436 2479
 		if ( isset( $q['caller_get_posts'] ) ) {
2437 2480
 			_deprecated_argument( 'WP_Query', '3.1', __( '"caller_get_posts" is deprecated. Use "ignore_sticky_posts" instead.' ) );
2438
-			if ( !isset( $q['ignore_sticky_posts'] ) )
2439
-				$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2481
+			if ( !isset( $q['ignore_sticky_posts'] ) ) {
2482
+							$q['ignore_sticky_posts'] = $q['caller_get_posts'];
2483
+			}
2440 2484
 		}
2441 2485
 
2442
-		if ( !isset( $q['ignore_sticky_posts'] ) )
2443
-			$q['ignore_sticky_posts'] = false;
2486
+		if ( !isset( $q['ignore_sticky_posts'] ) ) {
2487
+					$q['ignore_sticky_posts'] = false;
2488
+		}
2444 2489
 
2445
-		if ( !isset($q['suppress_filters']) )
2446
-			$q['suppress_filters'] = false;
2490
+		if ( !isset($q['suppress_filters']) ) {
2491
+					$q['suppress_filters'] = false;
2492
+		}
2447 2493
 
2448 2494
 		if ( !isset($q['cache_results']) ) {
2449
-			if ( wp_using_ext_object_cache() )
2450
-				$q['cache_results'] = false;
2451
-			else
2452
-				$q['cache_results'] = true;
2495
+			if ( wp_using_ext_object_cache() ) {
2496
+							$q['cache_results'] = false;
2497
+			} else {
2498
+							$q['cache_results'] = true;
2499
+			}
2453 2500
 		}
2454 2501
 
2455
-		if ( !isset($q['update_post_term_cache']) )
2456
-			$q['update_post_term_cache'] = true;
2502
+		if ( !isset($q['update_post_term_cache']) ) {
2503
+					$q['update_post_term_cache'] = true;
2504
+		}
2457 2505
 
2458
-		if ( !isset($q['update_post_meta_cache']) )
2459
-			$q['update_post_meta_cache'] = true;
2506
+		if ( !isset($q['update_post_meta_cache']) ) {
2507
+					$q['update_post_meta_cache'] = true;
2508
+		}
2460 2509
 
2461 2510
 		if ( !isset($q['post_type']) ) {
2462
-			if ( $this->is_search )
2463
-				$q['post_type'] = 'any';
2464
-			else
2465
-				$q['post_type'] = '';
2511
+			if ( $this->is_search ) {
2512
+							$q['post_type'] = 'any';
2513
+			} else {
2514
+							$q['post_type'] = '';
2515
+			}
2466 2516
 		}
2467 2517
 		$post_type = $q['post_type'];
2468 2518
 		if ( empty( $q['posts_per_page'] ) ) {
@@ -2472,8 +2522,9 @@  discard block
 block discarded – undo
2472 2522
 			$q['showposts'] = (int) $q['showposts'];
2473 2523
 			$q['posts_per_page'] = $q['showposts'];
2474 2524
 		}
2475
-		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) )
2476
-			$q['posts_per_page'] = $q['posts_per_archive_page'];
2525
+		if ( (isset($q['posts_per_archive_page']) && $q['posts_per_archive_page'] != 0) && ($this->is_archive || $this->is_search) ) {
2526
+					$q['posts_per_page'] = $q['posts_per_archive_page'];
2527
+		}
2477 2528
 		if ( !isset($q['nopaging']) ) {
2478 2529
 			if ( $q['posts_per_page'] == -1 ) {
2479 2530
 				$q['nopaging'] = true;
@@ -2492,13 +2543,15 @@  discard block
 block discarded – undo
2492 2543
 			$q['nopaging'] = false;
2493 2544
 		}
2494 2545
 		$q['posts_per_page'] = (int) $q['posts_per_page'];
2495
-		if ( $q['posts_per_page'] < -1 )
2496
-			$q['posts_per_page'] = abs($q['posts_per_page']);
2497
-		elseif ( $q['posts_per_page'] == 0 )
2498
-			$q['posts_per_page'] = 1;
2546
+		if ( $q['posts_per_page'] < -1 ) {
2547
+					$q['posts_per_page'] = abs($q['posts_per_page']);
2548
+		} elseif ( $q['posts_per_page'] == 0 ) {
2549
+					$q['posts_per_page'] = 1;
2550
+		}
2499 2551
 
2500
-		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 )
2501
-			$q['comments_per_page'] = get_option('comments_per_page');
2552
+		if ( !isset($q['comments_per_page']) || $q['comments_per_page'] == 0 ) {
2553
+					$q['comments_per_page'] = get_option('comments_per_page');
2554
+		}
2502 2555
 
2503 2556
 		if ( $this->is_home && (empty($this->query) || $q['preview'] == 'true') && ( 'page' == get_option('show_on_front') ) && get_option('page_on_front') ) {
2504 2557
 			$this->is_page = true;
@@ -2512,10 +2565,11 @@  discard block
 block discarded – undo
2512 2565
 		}
2513 2566
 
2514 2567
 		// If true, forcibly turns off SQL_CALC_FOUND_ROWS even when limits are present.
2515
-		if ( isset($q['no_found_rows']) )
2516
-			$q['no_found_rows'] = (bool) $q['no_found_rows'];
2517
-		else
2518
-			$q['no_found_rows'] = false;
2568
+		if ( isset($q['no_found_rows']) ) {
2569
+					$q['no_found_rows'] = (bool) $q['no_found_rows'];
2570
+		} else {
2571
+					$q['no_found_rows'] = false;
2572
+		}
2519 2573
 
2520 2574
 		switch ( $q['fields'] ) {
2521 2575
 			case 'ids':
@@ -2528,47 +2582,60 @@  discard block
 block discarded – undo
2528 2582
 				$fields = "$wpdb->posts.*";
2529 2583
 		}
2530 2584
 
2531
-		if ( '' !== $q['menu_order'] )
2532
-			$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2585
+		if ( '' !== $q['menu_order'] ) {
2586
+					$where .= " AND $wpdb->posts.menu_order = " . $q['menu_order'];
2587
+		}
2533 2588
 
2534 2589
 		// The "m" parameter is meant for months but accepts datetimes of varying specificity
2535 2590
 		if ( $q['m'] ) {
2536 2591
 			$where .= " AND YEAR($wpdb->posts.post_date)=" . substr($q['m'], 0, 4);
2537
-			if ( strlen($q['m']) > 5 )
2538
-				$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2539
-			if ( strlen($q['m']) > 7 )
2540
-				$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2541
-			if ( strlen($q['m']) > 9 )
2542
-				$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2543
-			if ( strlen($q['m']) > 11 )
2544
-				$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2545
-			if ( strlen($q['m']) > 13 )
2546
-				$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2592
+			if ( strlen($q['m']) > 5 ) {
2593
+							$where .= " AND MONTH($wpdb->posts.post_date)=" . substr($q['m'], 4, 2);
2594
+			}
2595
+			if ( strlen($q['m']) > 7 ) {
2596
+							$where .= " AND DAYOFMONTH($wpdb->posts.post_date)=" . substr($q['m'], 6, 2);
2597
+			}
2598
+			if ( strlen($q['m']) > 9 ) {
2599
+							$where .= " AND HOUR($wpdb->posts.post_date)=" . substr($q['m'], 8, 2);
2600
+			}
2601
+			if ( strlen($q['m']) > 11 ) {
2602
+							$where .= " AND MINUTE($wpdb->posts.post_date)=" . substr($q['m'], 10, 2);
2603
+			}
2604
+			if ( strlen($q['m']) > 13 ) {
2605
+							$where .= " AND SECOND($wpdb->posts.post_date)=" . substr($q['m'], 12, 2);
2606
+			}
2547 2607
 		}
2548 2608
 
2549 2609
 		// Handle the other individual date parameters
2550 2610
 		$date_parameters = array();
2551 2611
 
2552
-		if ( '' !== $q['hour'] )
2553
-			$date_parameters['hour'] = $q['hour'];
2612
+		if ( '' !== $q['hour'] ) {
2613
+					$date_parameters['hour'] = $q['hour'];
2614
+		}
2554 2615
 
2555
-		if ( '' !== $q['minute'] )
2556
-			$date_parameters['minute'] = $q['minute'];
2616
+		if ( '' !== $q['minute'] ) {
2617
+					$date_parameters['minute'] = $q['minute'];
2618
+		}
2557 2619
 
2558
-		if ( '' !== $q['second'] )
2559
-			$date_parameters['second'] = $q['second'];
2620
+		if ( '' !== $q['second'] ) {
2621
+					$date_parameters['second'] = $q['second'];
2622
+		}
2560 2623
 
2561
-		if ( $q['year'] )
2562
-			$date_parameters['year'] = $q['year'];
2624
+		if ( $q['year'] ) {
2625
+					$date_parameters['year'] = $q['year'];
2626
+		}
2563 2627
 
2564
-		if ( $q['monthnum'] )
2565
-			$date_parameters['monthnum'] = $q['monthnum'];
2628
+		if ( $q['monthnum'] ) {
2629
+					$date_parameters['monthnum'] = $q['monthnum'];
2630
+		}
2566 2631
 
2567
-		if ( $q['w'] )
2568
-			$date_parameters['week'] = $q['w'];
2632
+		if ( $q['w'] ) {
2633
+					$date_parameters['week'] = $q['w'];
2634
+		}
2569 2635
 
2570
-		if ( $q['day'] )
2571
-			$date_parameters['day'] = $q['day'];
2636
+		if ( $q['day'] ) {
2637
+					$date_parameters['day'] = $q['day'];
2638
+		}
2572 2639
 
2573 2640
 		if ( $date_parameters ) {
2574 2641
 			$date_query = new WP_Date_Query( array( $date_parameters ) );
@@ -2587,8 +2654,9 @@  discard block
 block discarded – undo
2587 2654
 		if ( !empty($q['post_type']) && 'any' != $q['post_type'] ) {
2588 2655
 			foreach ( (array)$q['post_type'] as $_post_type ) {
2589 2656
 				$ptype_obj = get_post_type_object($_post_type);
2590
-				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) )
2591
-					continue;
2657
+				if ( !$ptype_obj || !$ptype_obj->query_var || empty($q[ $ptype_obj->query_var ]) ) {
2658
+									continue;
2659
+				}
2592 2660
 
2593 2661
 				if ( ! $ptype_obj->hierarchical ) {
2594 2662
 					// Non-hierarchical post types can directly use 'name'.
@@ -2616,21 +2684,24 @@  discard block
 block discarded – undo
2616 2684
 				if ( 'page' != $q['post_type'] ) {
2617 2685
 					foreach ( (array)$q['post_type'] as $_post_type ) {
2618 2686
 						$ptype_obj = get_post_type_object($_post_type);
2619
-						if ( !$ptype_obj || !$ptype_obj->hierarchical )
2620
-							continue;
2687
+						if ( !$ptype_obj || !$ptype_obj->hierarchical ) {
2688
+													continue;
2689
+						}
2621 2690
 
2622 2691
 						$reqpage = get_page_by_path($q['pagename'], OBJECT, $_post_type);
2623
-						if ( $reqpage )
2624
-							break;
2692
+						if ( $reqpage ) {
2693
+													break;
2694
+						}
2625 2695
 					}
2626 2696
 					unset($ptype_obj);
2627 2697
 				} else {
2628 2698
 					$reqpage = get_page_by_path($q['pagename']);
2629 2699
 				}
2630
-				if ( !empty($reqpage) )
2631
-					$reqpage = $reqpage->ID;
2632
-				else
2633
-					$reqpage = 0;
2700
+				if ( !empty($reqpage) ) {
2701
+									$reqpage = $reqpage->ID;
2702
+				} else {
2703
+									$reqpage = 0;
2704
+				}
2634 2705
 			}
2635 2706
 
2636 2707
 			$page_for_posts = get_option('page_for_posts');
@@ -2655,12 +2726,14 @@  discard block
 block discarded – undo
2655 2726
 			$where .= " AND $wpdb->posts.post_name IN ('" . implode( "' ,'", $q['post_name__in'] ) . "')";
2656 2727
 		}
2657 2728
 
2658
-		if ( intval($q['comments_popup']) )
2659
-			$q['p'] = absint($q['comments_popup']);
2729
+		if ( intval($q['comments_popup']) ) {
2730
+					$q['p'] = absint($q['comments_popup']);
2731
+		}
2660 2732
 
2661 2733
 		// If an attachment is requested by number, let it supersede any post number.
2662
-		if ( $q['attachment_id'] )
2663
-			$q['p'] = absint($q['attachment_id']);
2734
+		if ( $q['attachment_id'] ) {
2735
+					$q['p'] = absint($q['attachment_id']);
2736
+		}
2664 2737
 
2665 2738
 		// If a post number is specified, load that post
2666 2739
 		if ( $q['p'] ) {
@@ -2722,13 +2795,15 @@  discard block
 block discarded – undo
2722 2795
 				$taxonomies = array_keys( $this->tax_query->queried_terms );
2723 2796
 				foreach ( get_post_types( array( 'exclude_from_search' => false ) ) as $pt ) {
2724 2797
 					$object_taxonomies = $pt === 'attachment' ? get_taxonomies_for_attachments() : get_object_taxonomies( $pt );
2725
-					if ( array_intersect( $taxonomies, $object_taxonomies ) )
2726
-						$post_type[] = $pt;
2798
+					if ( array_intersect( $taxonomies, $object_taxonomies ) ) {
2799
+											$post_type[] = $pt;
2800
+					}
2801
+				}
2802
+				if ( ! $post_type ) {
2803
+									$post_type = 'any';
2804
+				} elseif ( count( $post_type ) == 1 ) {
2805
+									$post_type = $post_type[0];
2727 2806
 				}
2728
-				if ( ! $post_type )
2729
-					$post_type = 'any';
2730
-				elseif ( count( $post_type ) == 1 )
2731
-					$post_type = $post_type[0];
2732 2807
 
2733 2808
 				$post_status_join = true;
2734 2809
 			} elseif ( in_array('attachment', (array) $post_type) ) {
@@ -2826,15 +2901,17 @@  discard block
 block discarded – undo
2826 2901
 			}
2827 2902
 			$q['author_name'] = sanitize_title_for_query( $q['author_name'] );
2828 2903
 			$q['author'] = get_user_by('slug', $q['author_name']);
2829
-			if ( $q['author'] )
2830
-				$q['author'] = $q['author']->ID;
2904
+			if ( $q['author'] ) {
2905
+							$q['author'] = $q['author']->ID;
2906
+			}
2831 2907
 			$whichauthor .= " AND ($wpdb->posts.post_author = " . absint($q['author']) . ')';
2832 2908
 		}
2833 2909
 
2834 2910
 		// MIME-Type stuff for attachment browsing
2835 2911
 
2836
-		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] )
2837
-			$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
2912
+		if ( isset( $q['post_mime_type'] ) && '' != $q['post_mime_type'] ) {
2913
+					$whichmimetype = wp_post_mime_type_where( $q['post_mime_type'], $wpdb->posts );
2914
+		}
2838 2915
 
2839 2916
 		$where .= $search . $whichauthor . $whichmimetype;
2840 2917
 
@@ -2909,8 +2986,9 @@  discard block
 block discarded – undo
2909 2986
 		// Order search results by relevance only when another "orderby" is not specified in the query.
2910 2987
 		if ( ! empty( $q['s'] ) ) {
2911 2988
 			$search_orderby = '';
2912
-			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) )
2913
-				$search_orderby = $this->parse_search_order( $q );
2989
+			if ( ! empty( $q['search_orderby_title'] ) && ( empty( $q['orderby'] ) && ! $this->is_feed ) || ( isset( $q['orderby'] ) && 'relevance' === $q['orderby'] ) ) {
2990
+							$search_orderby = $this->parse_search_order( $q );
2991
+			}
2914 2992
 
2915 2993
 			/**
2916 2994
 			 * Filter the ORDER BY used when ordering search results.
@@ -2921,18 +2999,21 @@  discard block
 block discarded – undo
2921 2999
 			 * @param WP_Query $this           The current WP_Query instance.
2922 3000
 			 */
2923 3001
 			$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );
2924
-			if ( $search_orderby )
2925
-				$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
3002
+			if ( $search_orderby ) {
3003
+							$orderby = $orderby ? $search_orderby . ', ' . $orderby : $search_orderby;
3004
+			}
2926 3005
 		}
2927 3006
 
2928 3007
 		if ( is_array( $post_type ) && count( $post_type ) > 1 ) {
2929 3008
 			$post_type_cap = 'multiple_post_type';
2930 3009
 		} else {
2931
-			if ( is_array( $post_type ) )
2932
-				$post_type = reset( $post_type );
3010
+			if ( is_array( $post_type ) ) {
3011
+							$post_type = reset( $post_type );
3012
+			}
2933 3013
 			$post_type_object = get_post_type_object( $post_type );
2934
-			if ( empty( $post_type_object ) )
2935
-				$post_type_cap = $post_type;
3014
+			if ( empty( $post_type_object ) ) {
3015
+							$post_type_cap = $post_type;
3016
+			}
2936 3017
 		}
2937 3018
 
2938 3019
 		if ( isset( $q['post_password'] ) ) {
@@ -2946,10 +3027,11 @@  discard block
 block discarded – undo
2946 3027
 
2947 3028
 		if ( 'any' == $post_type ) {
2948 3029
 			$in_search_post_types = get_post_types( array('exclude_from_search' => false) );
2949
-			if ( empty( $in_search_post_types ) )
2950
-				$where .= ' AND 1=0 ';
2951
-			else
2952
-				$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
3030
+			if ( empty( $in_search_post_types ) ) {
3031
+							$where .= ' AND 1=0 ';
3032
+			} else {
3033
+							$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $in_search_post_types ) . "')";
3034
+			}
2953 3035
 		} elseif ( !empty( $post_type ) && is_array( $post_type ) ) {
2954 3036
 			$where .= " AND $wpdb->posts.post_type IN ('" . join("', '", $post_type) . "')";
2955 3037
 		} elseif ( ! empty( $post_type ) ) {
@@ -2983,8 +3065,9 @@  discard block
 block discarded – undo
2983 3065
 		if ( ! empty( $q['post_status'] ) ) {
2984 3066
 			$statuswheres = array();
2985 3067
 			$q_status = $q['post_status'];
2986
-			if ( ! is_array( $q_status ) )
2987
-				$q_status = explode(',', $q_status);
3068
+			if ( ! is_array( $q_status ) ) {
3069
+							$q_status = explode(',', $q_status);
3070
+			}
2988 3071
 			$r_status = array();
2989 3072
 			$p_status = array();
2990 3073
 			$e_status = array();
@@ -2997,10 +3080,11 @@  discard block
 block discarded – undo
2997 3080
 			} else {
2998 3081
 				foreach ( get_post_stati() as $status ) {
2999 3082
 					if ( in_array( $status, $q_status ) ) {
3000
-						if ( 'private' == $status )
3001
-							$p_status[] = "$wpdb->posts.post_status = '$status'";
3002
-						else
3003
-							$r_status[] = "$wpdb->posts.post_status = '$status'";
3083
+						if ( 'private' == $status ) {
3084
+													$p_status[] = "$wpdb->posts.post_status = '$status'";
3085
+						} else {
3086
+													$r_status[] = "$wpdb->posts.post_status = '$status'";
3087
+						}
3004 3088
 					}
3005 3089
 				}
3006 3090
 			}
@@ -3014,21 +3098,24 @@  discard block
 block discarded – undo
3014 3098
 				$statuswheres[] = "(" . join( ' AND ', $e_status ) . ")";
3015 3099
 			}
3016 3100
 			if ( !empty($r_status) ) {
3017
-				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) )
3018
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3019
-				else
3020
-					$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3101
+				if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can($edit_others_cap) ) {
3102
+									$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $r_status ) . "))";
3103
+				} else {
3104
+									$statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
3105
+				}
3021 3106
 			}
3022 3107
 			if ( !empty($p_status) ) {
3023
-				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) )
3024
-					$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3025
-				else
3026
-					$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3108
+				if ( !empty($q['perm'] ) && 'readable' == $q['perm'] && !current_user_can($read_private_cap) ) {
3109
+									$statuswheres[] = "($wpdb->posts.post_author = $user_id " . "AND (" . join( ' OR ', $p_status ) . "))";
3110
+				} else {
3111
+									$statuswheres[] = "(" . join( ' OR ', $p_status ) . ")";
3112
+				}
3027 3113
 			}
3028 3114
 			if ( $post_status_join ) {
3029 3115
 				$join .= " LEFT JOIN $wpdb->posts AS p2 ON ($wpdb->posts.post_parent = p2.ID) ";
3030
-				foreach ( $statuswheres as $index => $statuswhere )
3031
-					$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3116
+				foreach ( $statuswheres as $index => $statuswhere ) {
3117
+									$statuswheres[$index] = "($statuswhere OR ($wpdb->posts.post_status = 'inherit' AND " . str_replace($wpdb->posts, 'p2', $statuswhere) . "))";
3118
+				}
3032 3119
 			}
3033 3120
 			$where_status = implode( ' OR ', $statuswheres );
3034 3121
 			if ( ! empty( $where_status ) ) {
@@ -3040,23 +3127,27 @@  discard block
 block discarded – undo
3040 3127
 			// Add public states.
3041 3128
 			$public_states = get_post_stati( array('public' => true) );
3042 3129
 			foreach ( (array) $public_states as $state ) {
3043
-				if ( 'publish' == $state ) // Publish is hard-coded above.
3130
+				if ( 'publish' == $state ) {
3131
+					// Publish is hard-coded above.
3044 3132
 					continue;
3133
+				}
3045 3134
 				$where .= " OR $wpdb->posts.post_status = '$state'";
3046 3135
 			}
3047 3136
 
3048 3137
 			if ( $this->is_admin ) {
3049 3138
 				// Add protected states that should show in the admin all list.
3050 3139
 				$admin_all_states = get_post_stati( array('protected' => true, 'show_in_admin_all_list' => true) );
3051
-				foreach ( (array) $admin_all_states as $state )
3052
-					$where .= " OR $wpdb->posts.post_status = '$state'";
3140
+				foreach ( (array) $admin_all_states as $state ) {
3141
+									$where .= " OR $wpdb->posts.post_status = '$state'";
3142
+				}
3053 3143
 			}
3054 3144
 
3055 3145
 			if ( is_user_logged_in() ) {
3056 3146
 				// Add private states that are limited to viewing by the author of a post or someone who has caps to read private states.
3057 3147
 				$private_states = get_post_stati( array('private' => true) );
3058
-				foreach ( (array) $private_states as $state )
3059
-					$where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'";
3148
+				foreach ( (array) $private_states as $state ) {
3149
+									$where .= current_user_can( $read_private_cap ) ? " OR $wpdb->posts.post_status = '$state'" : " OR $wpdb->posts.post_author = $user_id AND $wpdb->posts.post_status = '$state'";
3150
+				}
3060 3151
 			}
3061 3152
 
3062 3153
 			$where .= ')';
@@ -3091,8 +3182,9 @@  discard block
 block discarded – undo
3091 3182
 		// Paging
3092 3183
 		if ( empty($q['nopaging']) && !$this->is_singular ) {
3093 3184
 			$page = absint($q['paged']);
3094
-			if ( !$page )
3095
-				$page = 1;
3185
+			if ( !$page ) {
3186
+							$page = 1;
3187
+			}
3096 3188
 
3097 3189
 			if ( empty($q['offset']) ) {
3098 3190
 				$pgstrt = absint( ( $page - 1 ) * $q['posts_per_page'] ) . ', ';
@@ -3174,15 +3266,17 @@  discard block
 block discarded – undo
3174 3266
 
3175 3267
 			$post_ids = array();
3176 3268
 
3177
-			foreach ( $this->comments as $comment )
3178
-				$post_ids[] = (int) $comment->comment_post_ID;
3269
+			foreach ( $this->comments as $comment ) {
3270
+							$post_ids[] = (int) $comment->comment_post_ID;
3271
+			}
3179 3272
 
3180 3273
 			$post_ids = join(',', $post_ids);
3181 3274
 			$join = '';
3182
-			if ( $post_ids )
3183
-				$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3184
-			else
3185
-				$where = "AND 0";
3275
+			if ( $post_ids ) {
3276
+							$where = "AND $wpdb->posts.ID IN ($post_ids) ";
3277
+			} else {
3278
+							$where = "AND 0";
3279
+			}
3186 3280
 		}
3187 3281
 
3188 3282
 		$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
@@ -3412,14 +3506,17 @@  discard block
 block discarded – undo
3412 3506
 			$limits = isset( $clauses[ 'limits' ] ) ? $clauses[ 'limits' ] : '';
3413 3507
 		}
3414 3508
 
3415
-		if ( ! empty($groupby) )
3416
-			$groupby = 'GROUP BY ' . $groupby;
3417
-		if ( !empty( $orderby ) )
3418
-			$orderby = 'ORDER BY ' . $orderby;
3509
+		if ( ! empty($groupby) ) {
3510
+					$groupby = 'GROUP BY ' . $groupby;
3511
+		}
3512
+		if ( !empty( $orderby ) ) {
3513
+					$orderby = 'ORDER BY ' . $orderby;
3514
+		}
3419 3515
 
3420 3516
 		$found_rows = '';
3421
-		if ( !$q['no_found_rows'] && !empty($limits) )
3422
-			$found_rows = 'SQL_CALC_FOUND_ROWS';
3517
+		if ( !$q['no_found_rows'] && !empty($limits) ) {
3518
+					$found_rows = 'SQL_CALC_FOUND_ROWS';
3519
+		}
3423 3520
 
3424 3521
 		$this->request = $old_request = "SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby $orderby $limits";
3425 3522
 
@@ -3506,8 +3603,9 @@  discard block
 block discarded – undo
3506 3603
 		}
3507 3604
 
3508 3605
 		// Convert to WP_Post objects
3509
-		if ( $this->posts )
3510
-			$this->posts = array_map( 'get_post', $this->posts );
3606
+		if ( $this->posts ) {
3607
+					$this->posts = array_map( 'get_post', $this->posts );
3608
+		}
3511 3609
 
3512 3610
 		if ( ! $q['suppress_filters'] ) {
3513 3611
 			/**
@@ -3563,12 +3661,14 @@  discard block
 block discarded – undo
3563 3661
 							$this->posts = array();
3564 3662
 						} else {
3565 3663
 							$this->is_preview = true;
3566
-							if ( 'future' != $status )
3567
-								$this->posts[0]->post_date = current_time('mysql');
3664
+							if ( 'future' != $status ) {
3665
+															$this->posts[0]->post_date = current_time('mysql');
3666
+							}
3568 3667
 						}
3569 3668
 					} elseif ( $post_status_obj->private ) {
3570
-						if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
3571
-							$this->posts = array();
3669
+						if ( ! current_user_can($read_cap, $this->posts[0]->ID) ) {
3670
+													$this->posts = array();
3671
+						}
3572 3672
 					} else {
3573 3673
 						$this->posts = array();
3574 3674
 					}
@@ -3610,8 +3710,9 @@  discard block
 block discarded – undo
3610 3710
 			}
3611 3711
 
3612 3712
 			// If any posts have been excluded specifically, Ignore those that are sticky.
3613
-			if ( !empty($sticky_posts) && !empty($q['post__not_in']) )
3614
-				$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3713
+			if ( !empty($sticky_posts) && !empty($q['post__not_in']) ) {
3714
+							$sticky_posts = array_diff($sticky_posts, $q['post__not_in']);
3715
+			}
3615 3716
 
3616 3717
 			// Fetch sticky posts that weren't in the query results
3617 3718
 			if ( !empty($sticky_posts) ) {
@@ -3649,8 +3750,9 @@  discard block
 block discarded – undo
3649 3750
 
3650 3751
 			$this->posts = array_map( 'get_post', $this->posts );
3651 3752
 
3652
-			if ( $q['cache_results'] )
3653
-				update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3753
+			if ( $q['cache_results'] ) {
3754
+							update_post_caches($this->posts, $post_type, $q['update_post_term_cache'], $q['update_post_meta_cache']);
3755
+			}
3654 3756
 
3655 3757
 			$this->post = reset( $this->posts );
3656 3758
 		} else {
@@ -3675,8 +3777,9 @@  discard block
 block discarded – undo
3675 3777
 
3676 3778
 		// Bail if posts is an empty array. Continue if posts is an empty string,
3677 3779
 		// null, or false to accommodate caching plugins that fill posts later.
3678
-		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) )
3679
-			return;
3780
+		if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) {
3781
+					return;
3782
+		}
3680 3783
 
3681 3784
 		if ( ! empty( $limits ) ) {
3682 3785
 			/**
@@ -3702,8 +3805,9 @@  discard block
 block discarded – undo
3702 3805
 		 */
3703 3806
 		$this->found_posts = apply_filters_ref_array( 'found_posts', array( $this->found_posts, &$this ) );
3704 3807
 
3705
-		if ( ! empty( $limits ) )
3706
-			$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3808
+		if ( ! empty( $limits ) ) {
3809
+					$this->max_num_pages = ceil( $this->found_posts / $q['posts_per_page'] );
3810
+		}
3707 3811
 	}
3708 3812
 
3709 3813
 	/**
@@ -3737,7 +3841,8 @@  discard block
 block discarded – undo
3737 3841
 		global $post;
3738 3842
 		$this->in_the_loop = true;
3739 3843
 
3740
-		if ( $this->current_post == -1 ) // loop has just started
3844
+		if ( $this->current_post == -1 ) {
3845
+			// loop has just started
3741 3846
 			/**
3742 3847
 			 * Fires once the loop is started.
3743 3848
 			 *
@@ -3746,6 +3851,7 @@  discard block
 block discarded – undo
3746 3851
 			 * @param WP_Query &$this The WP_Query instance (passed by reference).
3747 3852
 			 */
3748 3853
 			do_action_ref_array( 'loop_start', array( &$this ) );
3854
+		}
3749 3855
 
3750 3856
 		$post = $this->next_post();
3751 3857
 		$this->setup_postdata( $post );
@@ -3892,8 +3998,9 @@  discard block
 block discarded – undo
3892 3998
 	 * @return object
3893 3999
 	 */
3894 4000
 	public function get_queried_object() {
3895
-		if ( isset($this->queried_object) )
3896
-			return $this->queried_object;
4001
+		if ( isset($this->queried_object) ) {
4002
+					return $this->queried_object;
4003
+		}
3897 4004
 
3898 4005
 		$this->queried_object = null;
3899 4006
 		$this->queried_object_id = 0;
@@ -3934,13 +4041,15 @@  discard block
 block discarded – undo
3934 4041
 				$this->queried_object = $term;
3935 4042
 				$this->queried_object_id = (int) $term->term_id;
3936 4043
 
3937
-				if ( $this->is_category && 'category' === $this->queried_object->taxonomy )
3938
-					_make_cat_compat( $this->queried_object );
4044
+				if ( $this->is_category && 'category' === $this->queried_object->taxonomy ) {
4045
+									_make_cat_compat( $this->queried_object );
4046
+				}
3939 4047
 			}
3940 4048
 		} elseif ( $this->is_post_type_archive ) {
3941 4049
 			$post_type = $this->get( 'post_type' );
3942
-			if ( is_array( $post_type ) )
3943
-				$post_type = reset( $post_type );
4050
+			if ( is_array( $post_type ) ) {
4051
+							$post_type = reset( $post_type );
4052
+			}
3944 4053
 			$this->queried_object = get_post_type_object( $post_type );
3945 4054
 		} elseif ( $this->is_posts_page ) {
3946 4055
 			$page_for_posts = get_option('page_for_posts');
@@ -4060,12 +4169,14 @@  discard block
 block discarded – undo
4060 4169
 	 * @return bool
4061 4170
 	 */
4062 4171
 	public function is_post_type_archive( $post_types = '' ) {
4063
-		if ( empty( $post_types ) || ! $this->is_post_type_archive )
4064
-			return (bool) $this->is_post_type_archive;
4172
+		if ( empty( $post_types ) || ! $this->is_post_type_archive ) {
4173
+					return (bool) $this->is_post_type_archive;
4174
+		}
4065 4175
 
4066 4176
 		$post_type = $this->get( 'post_type' );
4067
-		if ( is_array( $post_type ) )
4068
-			$post_type = reset( $post_type );
4177
+		if ( is_array( $post_type ) ) {
4178
+					$post_type = reset( $post_type );
4179
+		}
4069 4180
 		$post_type_object = get_post_type_object( $post_type );
4070 4181
 
4071 4182
 		return in_array( $post_type_object->name, (array) $post_types );
@@ -4114,22 +4225,25 @@  discard block
 block discarded – undo
4114 4225
 	 * @return bool
4115 4226
 	 */
4116 4227
 	public function is_author( $author = '' ) {
4117
-		if ( !$this->is_author )
4118
-			return false;
4228
+		if ( !$this->is_author ) {
4229
+					return false;
4230
+		}
4119 4231
 
4120
-		if ( empty($author) )
4121
-			return true;
4232
+		if ( empty($author) ) {
4233
+					return true;
4234
+		}
4122 4235
 
4123 4236
 		$author_obj = $this->get_queried_object();
4124 4237
 
4125 4238
 		$author = (array) $author;
4126 4239
 
4127
-		if ( in_array( (string) $author_obj->ID, $author ) )
4128
-			return true;
4129
-		elseif ( in_array( $author_obj->nickname, $author ) )
4130
-			return true;
4131
-		elseif ( in_array( $author_obj->user_nicename, $author ) )
4132
-			return true;
4240
+		if ( in_array( (string) $author_obj->ID, $author ) ) {
4241
+					return true;
4242
+		} elseif ( in_array( $author_obj->nickname, $author ) ) {
4243
+					return true;
4244
+		} elseif ( in_array( $author_obj->user_nicename, $author ) ) {
4245
+					return true;
4246
+		}
4133 4247
 
4134 4248
 		return false;
4135 4249
 	}
@@ -4146,22 +4260,25 @@  discard block
 block discarded – undo
4146 4260
 	 * @return bool
4147 4261
 	 */
4148 4262
 	public function is_category( $category = '' ) {
4149
-		if ( !$this->is_category )
4150
-			return false;
4263
+		if ( !$this->is_category ) {
4264
+					return false;
4265
+		}
4151 4266
 
4152
-		if ( empty($category) )
4153
-			return true;
4267
+		if ( empty($category) ) {
4268
+					return true;
4269
+		}
4154 4270
 
4155 4271
 		$cat_obj = $this->get_queried_object();
4156 4272
 
4157 4273
 		$category = (array) $category;
4158 4274
 
4159
-		if ( in_array( (string) $cat_obj->term_id, $category ) )
4160
-			return true;
4161
-		elseif ( in_array( $cat_obj->name, $category ) )
4162
-			return true;
4163
-		elseif ( in_array( $cat_obj->slug, $category ) )
4164
-			return true;
4275
+		if ( in_array( (string) $cat_obj->term_id, $category ) ) {
4276
+					return true;
4277
+		} elseif ( in_array( $cat_obj->name, $category ) ) {
4278
+					return true;
4279
+		} elseif ( in_array( $cat_obj->slug, $category ) ) {
4280
+					return true;
4281
+		}
4165 4282
 
4166 4283
 		return false;
4167 4284
 	}
@@ -4178,22 +4295,25 @@  discard block
 block discarded – undo
4178 4295
 	 * @return bool
4179 4296
 	 */
4180 4297
 	public function is_tag( $tag = '' ) {
4181
-		if ( ! $this->is_tag )
4182
-			return false;
4298
+		if ( ! $this->is_tag ) {
4299
+					return false;
4300
+		}
4183 4301
 
4184
-		if ( empty( $tag ) )
4185
-			return true;
4302
+		if ( empty( $tag ) ) {
4303
+					return true;
4304
+		}
4186 4305
 
4187 4306
 		$tag_obj = $this->get_queried_object();
4188 4307
 
4189 4308
 		$tag = (array) $tag;
4190 4309
 
4191
-		if ( in_array( (string) $tag_obj->term_id, $tag ) )
4192
-			return true;
4193
-		elseif ( in_array( $tag_obj->name, $tag ) )
4194
-			return true;
4195
-		elseif ( in_array( $tag_obj->slug, $tag ) )
4196
-			return true;
4310
+		if ( in_array( (string) $tag_obj->term_id, $tag ) ) {
4311
+					return true;
4312
+		} elseif ( in_array( $tag_obj->name, $tag ) ) {
4313
+					return true;
4314
+		} elseif ( in_array( $tag_obj->slug, $tag ) ) {
4315
+					return true;
4316
+		}
4197 4317
 
4198 4318
 		return false;
4199 4319
 	}
@@ -4219,23 +4339,27 @@  discard block
 block discarded – undo
4219 4339
 	public function is_tax( $taxonomy = '', $term = '' ) {
4220 4340
 		global $wp_taxonomies;
4221 4341
 
4222
-		if ( !$this->is_tax )
4223
-			return false;
4342
+		if ( !$this->is_tax ) {
4343
+					return false;
4344
+		}
4224 4345
 
4225
-		if ( empty( $taxonomy ) )
4226
-			return true;
4346
+		if ( empty( $taxonomy ) ) {
4347
+					return true;
4348
+		}
4227 4349
 
4228 4350
 		$queried_object = $this->get_queried_object();
4229 4351
 		$tax_array = array_intersect( array_keys( $wp_taxonomies ), (array) $taxonomy );
4230 4352
 		$term_array = (array) $term;
4231 4353
 
4232 4354
 		// Check that the taxonomy matches.
4233
-		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) )
4234
-			return false;
4355
+		if ( ! ( isset( $queried_object->taxonomy ) && count( $tax_array ) && in_array( $queried_object->taxonomy, $tax_array ) ) ) {
4356
+					return false;
4357
+		}
4235 4358
 
4236 4359
 		// Only a Taxonomy provided.
4237
-		if ( empty( $term ) )
4238
-			return true;
4360
+		if ( empty( $term ) ) {
4361
+					return true;
4362
+		}
4239 4363
 
4240 4364
 		return isset( $queried_object->term_id ) &&
4241 4365
 			count( array_intersect(
@@ -4286,11 +4410,13 @@  discard block
 block discarded – undo
4286 4410
 	 * @return bool
4287 4411
 	 */
4288 4412
 	public function is_feed( $feeds = '' ) {
4289
-		if ( empty( $feeds ) || ! $this->is_feed )
4290
-			return (bool) $this->is_feed;
4413
+		if ( empty( $feeds ) || ! $this->is_feed ) {
4414
+					return (bool) $this->is_feed;
4415
+		}
4291 4416
 		$qv = $this->get( 'feed' );
4292
-		if ( 'feed' == $qv )
4293
-			$qv = get_default_feed();
4417
+		if ( 'feed' == $qv ) {
4418
+					$qv = get_default_feed();
4419
+		}
4294 4420
 		return in_array( $qv, (array) $feeds );
4295 4421
 	}
4296 4422
 
@@ -4323,12 +4449,13 @@  discard block
 block discarded – undo
4323 4449
 	 */
4324 4450
 	public function is_front_page() {
4325 4451
 		// most likely case
4326
-		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() )
4327
-			return true;
4328
-		elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) )
4329
-			return true;
4330
-		else
4331
-			return false;
4452
+		if ( 'posts' == get_option( 'show_on_front') && $this->is_home() ) {
4453
+					return true;
4454
+		} elseif ( 'page' == get_option( 'show_on_front') && get_option( 'page_on_front' ) && $this->is_page( get_option( 'page_on_front' ) ) ) {
4455
+					return true;
4456
+		} else {
4457
+					return false;
4458
+		}
4332 4459
 	}
4333 4460
 
4334 4461
 	/**
@@ -4377,11 +4504,13 @@  discard block
 block discarded – undo
4377 4504
 	 * @return bool
4378 4505
 	 */
4379 4506
 	public function is_page( $page = '' ) {
4380
-		if ( !$this->is_page )
4381
-			return false;
4507
+		if ( !$this->is_page ) {
4508
+					return false;
4509
+		}
4382 4510
 
4383
-		if ( empty( $page ) )
4384
-			return true;
4511
+		if ( empty( $page ) ) {
4512
+					return true;
4513
+		}
4385 4514
 
4386 4515
 		$page_obj = $this->get_queried_object();
4387 4516
 
@@ -4470,11 +4599,13 @@  discard block
 block discarded – undo
4470 4599
 	 * @return bool
4471 4600
 	 */
4472 4601
 	public function is_single( $post = '' ) {
4473
-		if ( !$this->is_single )
4474
-			return false;
4602
+		if ( !$this->is_single ) {
4603
+					return false;
4604
+		}
4475 4605
 
4476
-		if ( empty($post) )
4477
-			return true;
4606
+		if ( empty($post) ) {
4607
+					return true;
4608
+		}
4478 4609
 
4479 4610
 		$post_obj = $this->get_queried_object();
4480 4611
 
@@ -4516,8 +4647,9 @@  discard block
 block discarded – undo
4516 4647
 	 * @return bool
4517 4648
 	 */
4518 4649
 	public function is_singular( $post_types = '' ) {
4519
-		if ( empty( $post_types ) || !$this->is_singular )
4520
-			return (bool) $this->is_singular;
4650
+		if ( empty( $post_types ) || !$this->is_singular ) {
4651
+					return (bool) $this->is_singular;
4652
+		}
4521 4653
 
4522 4654
 		$post_obj = $this->get_queried_object();
4523 4655
 
@@ -4612,8 +4744,9 @@  discard block
 block discarded – undo
4612 4744
 		$numpages = 1;
4613 4745
 		$multipage = 0;
4614 4746
 		$page = $this->get( 'page' );
4615
-		if ( ! $page )
4616
-			$page = 1;
4747
+		if ( ! $page ) {
4748
+					$page = 1;
4749
+		}
4617 4750
 
4618 4751
 		/*
4619 4752
 		 * Force full post content when viewing the permalink for the $post,
@@ -4629,20 +4762,23 @@  discard block
 block discarded – undo
4629 4762
 
4630 4763
 		$content = $post->post_content;
4631 4764
 		if ( false !== strpos( $content, '<!--nextpage-->' ) ) {
4632
-			if ( $page > 1 )
4633
-				$more = 1;
4765
+			if ( $page > 1 ) {
4766
+							$more = 1;
4767
+			}
4634 4768
 			$content = str_replace( "\n<!--nextpage-->\n", '<!--nextpage-->', $content );
4635 4769
 			$content = str_replace( "\n<!--nextpage-->", '<!--nextpage-->', $content );
4636 4770
 			$content = str_replace( "<!--nextpage-->\n", '<!--nextpage-->', $content );
4637 4771
 
4638 4772
 			// Ignore nextpage at the beginning of the content.
4639
-			if ( 0 === strpos( $content, '<!--nextpage-->' ) )
4640
-				$content = substr( $content, 15 );
4773
+			if ( 0 === strpos( $content, '<!--nextpage-->' ) ) {
4774
+							$content = substr( $content, 15 );
4775
+			}
4641 4776
 
4642 4777
 			$pages = explode('<!--nextpage-->', $content);
4643 4778
 			$numpages = count($pages);
4644
-			if ( $numpages > 1 )
4645
-				$multipage = 1;
4779
+			if ( $numpages > 1 ) {
4780
+							$multipage = 1;
4781
+			}
4646 4782
 		} else {
4647 4783
 			$pages = array( $post->post_content );
4648 4784
 		}
@@ -4692,43 +4828,51 @@  discard block
 block discarded – undo
4692 4828
 		global $wpdb;
4693 4829
 
4694 4830
 		// Guess the current post_type based on the query vars.
4695
-		if ( get_query_var('post_type') )
4696
-			$post_type = get_query_var('post_type');
4697
-		elseif ( !empty($wp_query->query_vars['pagename']) )
4698
-			$post_type = 'page';
4699
-		else
4700
-			$post_type = 'post';
4831
+		if ( get_query_var('post_type') ) {
4832
+					$post_type = get_query_var('post_type');
4833
+		} elseif ( !empty($wp_query->query_vars['pagename']) ) {
4834
+					$post_type = 'page';
4835
+		} else {
4836
+					$post_type = 'post';
4837
+		}
4701 4838
 
4702 4839
 		if ( is_array( $post_type ) ) {
4703
-			if ( count( $post_type ) > 1 )
4704
-				return;
4840
+			if ( count( $post_type ) > 1 ) {
4841
+							return;
4842
+			}
4705 4843
 			$post_type = reset( $post_type );
4706 4844
 		}
4707 4845
 
4708 4846
 		// Do not attempt redirect for hierarchical post types
4709
-		if ( is_post_type_hierarchical( $post_type ) )
4710
-			return;
4847
+		if ( is_post_type_hierarchical( $post_type ) ) {
4848
+					return;
4849
+		}
4711 4850
 
4712 4851
 		$query = $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta, $wpdb->posts WHERE ID = post_id AND post_type = %s AND meta_key = '_wp_old_slug' AND meta_value = %s", $post_type, $wp_query->query_vars['name']);
4713 4852
 
4714 4853
 		// if year, monthnum, or day have been specified, make our query more precise
4715 4854
 		// just in case there are multiple identical _wp_old_slug values
4716
-		if ( '' != $wp_query->query_vars['year'] )
4717
-			$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
4718
-		if ( '' != $wp_query->query_vars['monthnum'] )
4719
-			$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
4720
-		if ( '' != $wp_query->query_vars['day'] )
4721
-			$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
4855
+		if ( '' != $wp_query->query_vars['year'] ) {
4856
+					$query .= $wpdb->prepare(" AND YEAR(post_date) = %d", $wp_query->query_vars['year']);
4857
+		}
4858
+		if ( '' != $wp_query->query_vars['monthnum'] ) {
4859
+					$query .= $wpdb->prepare(" AND MONTH(post_date) = %d", $wp_query->query_vars['monthnum']);
4860
+		}
4861
+		if ( '' != $wp_query->query_vars['day'] ) {
4862
+					$query .= $wpdb->prepare(" AND DAYOFMONTH(post_date) = %d", $wp_query->query_vars['day']);
4863
+		}
4722 4864
 
4723 4865
 		$id = (int) $wpdb->get_var($query);
4724 4866
 
4725
-		if ( ! $id )
4726
-			return;
4867
+		if ( ! $id ) {
4868
+					return;
4869
+		}
4727 4870
 
4728 4871
 		$link = get_permalink($id);
4729 4872
 
4730
-		if ( !$link )
4731
-			return;
4873
+		if ( !$link ) {
4874
+					return;
4875
+		}
4732 4876
 
4733 4877
 		wp_redirect( $link, 301 ); // Permanent redirect
4734 4878
 		exit;
Please login to merge, or discard this patch.
src/wp-includes/revision.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -411,7 +411,7 @@  discard block
 block discarded – undo
411 411
  *
412 412
  * @since 2.6.0
413 413
  *
414
- * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
414
+ * @param integer $post_id Optional. Post ID or WP_Post object. Default is global $post.
415 415
  * @return array An array of revisions, or an empty array if none.
416 416
  */
417 417
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
@@ -489,7 +489,7 @@  discard block
 block discarded – undo
489 489
  * @access private
490 490
  *
491 491
  * @param WP_Post $post
492
- * @return WP_Post|false
492
+ * @return WP_Post
493 493
  */
494 494
 function _set_preview( $post ) {
495 495
 	if ( ! is_object( $post ) ) {
Please login to merge, or discard this patch.
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Post revision functions.
4
- *
5
- * @package WordPress
6
- * @subpackage Post_Revisions
7
- */
3
+	 * Post revision functions.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Post_Revisions
7
+	 */
8 8
 
9 9
 /**
10 10
  * Determines which fields of posts are to be saved in revisions.
Please login to merge, or discard this patch.
Spacing   +137 added lines, -137 removed lines patch added patch discarded remove patch
@@ -22,15 +22,15 @@  discard block
 block discarded – undo
22 22
  * @param bool  $autosave Optional. Is the revision an autosave?
23 23
  * @return array Post array ready to be inserted as a post revision or array of fields that can be versioned.
24 24
  */
25
-function _wp_post_revision_fields( $post = null, $autosave = false ) {
25
+function _wp_post_revision_fields($post = null, $autosave = false) {
26 26
 	static $fields = null;
27 27
 
28
-	if ( is_null( $fields ) ) {
28
+	if (is_null($fields)) {
29 29
 		// Allow these to be versioned
30 30
 		$fields = array(
31
-			'post_title' => __( 'Title' ),
32
-			'post_content' => __( 'Content' ),
33
-			'post_excerpt' => __( 'Excerpt' ),
31
+			'post_title' => __('Title'),
32
+			'post_content' => __('Content'),
33
+			'post_excerpt' => __('Excerpt'),
34 34
 		);
35 35
 
36 36
 		/**
@@ -47,18 +47,18 @@  discard block
 block discarded – undo
47 47
 		 * @param array $fields List of fields to revision. Contains 'post_title',
48 48
 		 *                      'post_content', and 'post_excerpt' by default.
49 49
 		 */
50
-		$fields = apply_filters( '_wp_post_revision_fields', $fields );
50
+		$fields = apply_filters('_wp_post_revision_fields', $fields);
51 51
 
52 52
 		// WP uses these internally either in versioning or elsewhere - they cannot be versioned
53
-		foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect )
54
-			unset( $fields[$protect] );
53
+		foreach (array('ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author') as $protect)
54
+			unset($fields[$protect]);
55 55
 	}
56 56
 
57
-	if ( !is_array($post) )
57
+	if ( ! is_array($post))
58 58
 		return $fields;
59 59
 
60 60
 	$return = array();
61
-	foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field )
61
+	foreach (array_intersect(array_keys($post), array_keys($fields)) as $field)
62 62
 		$return[$field] = $post[$field];
63 63
 
64 64
 	$return['post_parent']   = $post['ID'];
@@ -82,29 +82,29 @@  discard block
 block discarded – undo
82 82
  * @param int $post_id The ID of the post to save as a revision.
83 83
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
84 84
  */
85
-function wp_save_post_revision( $post_id ) {
86
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
85
+function wp_save_post_revision($post_id) {
86
+	if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
87 87
 		return;
88 88
 
89
-	if ( ! $post = get_post( $post_id ) )
89
+	if ( ! $post = get_post($post_id))
90 90
 		return;
91 91
 
92
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
92
+	if ( ! post_type_supports($post->post_type, 'revisions'))
93 93
 		return;
94 94
 
95
-	if ( 'auto-draft' == $post->post_status )
95
+	if ('auto-draft' == $post->post_status)
96 96
 		return;
97 97
 
98
-	if ( ! wp_revisions_enabled( $post ) )
98
+	if ( ! wp_revisions_enabled($post))
99 99
 		return;
100 100
 
101 101
 	// Compare the proposed update with the last stored revision verifying that
102 102
 	// they are different, unless a plugin tells us to always save regardless.
103 103
 	// If no previous revisions, save one
104
-	if ( $revisions = wp_get_post_revisions( $post_id ) ) {
104
+	if ($revisions = wp_get_post_revisions($post_id)) {
105 105
 		// grab the last revision, but not an autosave
106
-		foreach ( $revisions as $revision ) {
107
-			if ( false !== strpos( $revision->post_name, "{$revision->post_parent}-revision" ) ) {
106
+		foreach ($revisions as $revision) {
107
+			if (false !== strpos($revision->post_name, "{$revision->post_parent}-revision")) {
108 108
 				$last_revision = $revision;
109 109
 				break;
110 110
 			}
@@ -124,11 +124,11 @@  discard block
 block discarded – undo
124 124
 		 * @param WP_Post $post              The post object.
125 125
 		 *
126 126
 		 */
127
-		if ( isset( $last_revision ) && apply_filters( 'wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post ) ) {
127
+		if (isset($last_revision) && apply_filters('wp_save_post_revision_check_for_changes', $check_for_changes = true, $last_revision, $post)) {
128 128
 			$post_has_changed = false;
129 129
 
130
-			foreach ( array_keys( _wp_post_revision_fields() ) as $field ) {
131
-				if ( normalize_whitespace( $post->$field ) != normalize_whitespace( $last_revision->$field ) ) {
130
+			foreach (array_keys(_wp_post_revision_fields()) as $field) {
131
+				if (normalize_whitespace($post->$field) != normalize_whitespace($last_revision->$field)) {
132 132
 					$post_has_changed = true;
133 133
 					break;
134 134
 				}
@@ -147,38 +147,38 @@  discard block
 block discarded – undo
147 147
 			 * @param WP_Post $post             The post object.
148 148
 			 *
149 149
 			 */
150
-			$post_has_changed = (bool) apply_filters( 'wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post );
150
+			$post_has_changed = (bool) apply_filters('wp_save_post_revision_post_has_changed', $post_has_changed, $last_revision, $post);
151 151
 
152 152
 			//don't save revision if post unchanged
153
-			if ( ! $post_has_changed ) {
153
+			if ( ! $post_has_changed) {
154 154
 				return;
155 155
 			}
156 156
 		}
157 157
 	}
158 158
 
159
-	$return = _wp_put_post_revision( $post );
159
+	$return = _wp_put_post_revision($post);
160 160
 
161 161
 	// If a limit for the number of revisions to keep has been set,
162 162
 	// delete the oldest ones.
163
-	$revisions_to_keep = wp_revisions_to_keep( $post );
163
+	$revisions_to_keep = wp_revisions_to_keep($post);
164 164
 
165
-	if ( $revisions_to_keep < 0 )
165
+	if ($revisions_to_keep < 0)
166 166
 		return $return;
167 167
 
168
-	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
168
+	$revisions = wp_get_post_revisions($post_id, array('order' => 'ASC'));
169 169
 
170 170
 	$delete = count($revisions) - $revisions_to_keep;
171 171
 
172
-	if ( $delete < 1 )
172
+	if ($delete < 1)
173 173
 		return $return;
174 174
 
175
-	$revisions = array_slice( $revisions, 0, $delete );
175
+	$revisions = array_slice($revisions, 0, $delete);
176 176
 
177
-	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
178
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
177
+	for ($i = 0; isset($revisions[$i]); $i++) {
178
+		if (false !== strpos($revisions[$i]->post_name, 'autosave'))
179 179
 			continue;
180 180
 
181
-		wp_delete_post_revision( $revisions[ $i ]->ID );
181
+		wp_delete_post_revision($revisions[$i]->ID);
182 182
 	}
183 183
 
184 184
 	return $return;
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
  * @param int $user_id Optional The post author ID.
198 198
  * @return WP_Post|false The autosaved data or false on failure or when no autosave exists.
199 199
  */
200
-function wp_get_post_autosave( $post_id, $user_id = 0 ) {
201
-	$revisions = wp_get_post_revisions( $post_id, array( 'check_enabled' => false ) );
200
+function wp_get_post_autosave($post_id, $user_id = 0) {
201
+	$revisions = wp_get_post_revisions($post_id, array('check_enabled' => false));
202 202
 
203
-	foreach ( $revisions as $revision ) {
204
-		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
205
-			if ( $user_id && $user_id != $revision->post_author )
203
+	foreach ($revisions as $revision) {
204
+		if (false !== strpos($revision->post_name, "{$post_id}-autosave")) {
205
+			if ($user_id && $user_id != $revision->post_author)
206 206
 				continue;
207 207
 
208 208
 			return $revision;
@@ -220,8 +220,8 @@  discard block
 block discarded – undo
220 220
  * @param int|WP_Post $post Post ID or post object.
221 221
  * @return false|int False if not a revision, ID of revision's parent otherwise.
222 222
  */
223
-function wp_is_post_revision( $post ) {
224
-	if ( !$post = wp_get_post_revision( $post ) )
223
+function wp_is_post_revision($post) {
224
+	if ( ! $post = wp_get_post_revision($post))
225 225
 		return false;
226 226
 
227 227
 	return (int) $post->post_parent;
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
  * @param int|WP_Post $post Post ID or post object.
236 236
  * @return false|int False if not a revision, ID of autosave's parent otherwise
237 237
  */
238
-function wp_is_post_autosave( $post ) {
239
-	if ( !$post = wp_get_post_revision( $post ) )
238
+function wp_is_post_autosave($post) {
239
+	if ( ! $post = wp_get_post_revision($post))
240 240
 		return false;
241 241
 
242
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
242
+	if (false !== strpos($post->post_name, "{$post->post_parent}-autosave"))
243 243
 		return (int) $post->post_parent;
244 244
 
245 245
 	return false;
@@ -255,26 +255,26 @@  discard block
 block discarded – undo
255 255
  * @param bool                   $autosave Optional. Is the revision an autosave?
256 256
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
257 257
  */
258
-function _wp_put_post_revision( $post = null, $autosave = false ) {
259
-	if ( is_object($post) )
260
-		$post = get_object_vars( $post );
261
-	elseif ( !is_array($post) )
258
+function _wp_put_post_revision($post = null, $autosave = false) {
259
+	if (is_object($post))
260
+		$post = get_object_vars($post);
261
+	elseif ( ! is_array($post))
262 262
 		$post = get_post($post, ARRAY_A);
263 263
 
264
-	if ( ! $post || empty($post['ID']) )
265
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
264
+	if ( ! $post || empty($post['ID']))
265
+		return new WP_Error('invalid_post', __('Invalid post ID.'));
266 266
 
267
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
268
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
267
+	if (isset($post['post_type']) && 'revision' == $post['post_type'])
268
+		return new WP_Error('post_type', __('Cannot create a revision of a revision'));
269 269
 
270
-	$post = _wp_post_revision_fields( $post, $autosave );
270
+	$post = _wp_post_revision_fields($post, $autosave);
271 271
 	$post = wp_slash($post); //since data is from db
272 272
 
273
-	$revision_id = wp_insert_post( $post );
274
-	if ( is_wp_error($revision_id) )
273
+	$revision_id = wp_insert_post($post);
274
+	if (is_wp_error($revision_id))
275 275
 		return $revision_id;
276 276
 
277
-	if ( $revision_id ) {
277
+	if ($revision_id) {
278 278
 		/**
279 279
 		 * Fires once a revision has been saved.
280 280
 		 *
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		 *
283 283
 		 * @param int $revision_id Post revision ID.
284 284
 		 */
285
-		do_action( '_wp_put_post_revision', $revision_id );
285
+		do_action('_wp_put_post_revision', $revision_id);
286 286
 	}
287 287
 
288 288
 	return $revision_id;
@@ -299,17 +299,17 @@  discard block
 block discarded – undo
299 299
  * @return WP_Post|array|null Null if error or post object if success.
300 300
  */
301 301
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
302
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
302
+	if ( ! $revision = get_post($post, OBJECT, $filter))
303 303
 		return $revision;
304
-	if ( 'revision' !== $revision->post_type )
304
+	if ('revision' !== $revision->post_type)
305 305
 		return null;
306 306
 
307
-	if ( $output == OBJECT ) {
307
+	if ($output == OBJECT) {
308 308
 		return $revision;
309
-	} elseif ( $output == ARRAY_A ) {
309
+	} elseif ($output == ARRAY_A) {
310 310
 		$_revision = get_object_vars($revision);
311 311
 		return $_revision;
312
-	} elseif ( $output == ARRAY_N ) {
312
+	} elseif ($output == ARRAY_N) {
313 313
 		$_revision = array_values(get_object_vars($revision));
314 314
 		return $_revision;
315 315
 	}
@@ -328,27 +328,27 @@  discard block
 block discarded – undo
328 328
  * @param array       $fields      Optional. What fields to restore from. Defaults to all.
329 329
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
330 330
  */
331
-function wp_restore_post_revision( $revision_id, $fields = null ) {
332
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
331
+function wp_restore_post_revision($revision_id, $fields = null) {
332
+	if ( ! $revision = wp_get_post_revision($revision_id, ARRAY_A))
333 333
 		return $revision;
334 334
 
335
-	if ( !is_array( $fields ) )
336
-		$fields = array_keys( _wp_post_revision_fields() );
335
+	if ( ! is_array($fields))
336
+		$fields = array_keys(_wp_post_revision_fields());
337 337
 
338 338
 	$update = array();
339
-	foreach( array_intersect( array_keys( $revision ), $fields ) as $field ) {
339
+	foreach (array_intersect(array_keys($revision), $fields) as $field) {
340 340
 		$update[$field] = $revision[$field];
341 341
 	}
342 342
 
343
-	if ( !$update )
343
+	if ( ! $update)
344 344
 		return false;
345 345
 
346 346
 	$update['ID'] = $revision['post_parent'];
347 347
 
348
-	$update = wp_slash( $update ); //since data is from db
348
+	$update = wp_slash($update); //since data is from db
349 349
 
350
-	$post_id = wp_update_post( $update );
351
-	if ( ! $post_id || is_wp_error( $post_id ) )
350
+	$post_id = wp_update_post($update);
351
+	if ( ! $post_id || is_wp_error($post_id))
352 352
 		return $post_id;
353 353
 
354 354
 	// Add restore from details
@@ -357,10 +357,10 @@  discard block
 block discarded – undo
357 357
 		'restored_by_user'     => get_current_user_id(),
358 358
 		'restored_time'        => time()
359 359
 	);
360
-	update_post_meta( $post_id, '_post_restored_from', $restore_details );
360
+	update_post_meta($post_id, '_post_restored_from', $restore_details);
361 361
 
362 362
 	// Update last edit user
363
-	update_post_meta( $post_id, '_edit_last', get_current_user_id() );
363
+	update_post_meta($post_id, '_edit_last', get_current_user_id());
364 364
 
365 365
 	/**
366 366
 	 * Fires after a post revision has been restored.
@@ -370,7 +370,7 @@  discard block
 block discarded – undo
370 370
 	 * @param int $post_id     Post ID.
371 371
 	 * @param int $revision_id Post revision ID.
372 372
 	 */
373
-	do_action( 'wp_restore_post_revision', $post_id, $revision['ID'] );
373
+	do_action('wp_restore_post_revision', $post_id, $revision['ID']);
374 374
 
375 375
 	return $post_id;
376 376
 }
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
  * @param int|WP_Post $revision_id Revision ID or revision object.
386 386
  * @return array|false|WP_Post|WP_Error|null Null or WP_Error if error, deleted post if success.
387 387
  */
388
-function wp_delete_post_revision( $revision_id ) {
389
-	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
388
+function wp_delete_post_revision($revision_id) {
389
+	if ( ! $revision = wp_get_post_revision($revision_id)) {
390 390
 		return $revision;
391 391
 	}
392 392
 
393
-	$delete = wp_delete_post( $revision->ID );
394
-	if ( $delete ) {
393
+	$delete = wp_delete_post($revision->ID);
394
+	if ($delete) {
395 395
 		/**
396 396
 		 * Fires once a post revision has been deleted.
397 397
 		 *
@@ -400,7 +400,7 @@  discard block
 block discarded – undo
400 400
 		 * @param int          $revision_id Post revision ID.
401 401
 		 * @param object|array $revision    Post revision object or array.
402 402
 		 */
403
-		do_action( 'wp_delete_post_revision', $revision->ID, $revision );
403
+		do_action('wp_delete_post_revision', $revision->ID, $revision);
404 404
 	}
405 405
 
406 406
 	return $delete;
@@ -414,20 +414,20 @@  discard block
 block discarded – undo
414 414
  * @param int|WP_Post $post_id Optional. Post ID or WP_Post object. Default is global $post.
415 415
  * @return array An array of revisions, or an empty array if none.
416 416
  */
417
-function wp_get_post_revisions( $post_id = 0, $args = null ) {
418
-	$post = get_post( $post_id );
419
-	if ( ! $post || empty( $post->ID ) )
417
+function wp_get_post_revisions($post_id = 0, $args = null) {
418
+	$post = get_post($post_id);
419
+	if ( ! $post || empty($post->ID))
420 420
 		return array();
421 421
 
422
-	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
423
-	$args = wp_parse_args( $args, $defaults );
422
+	$defaults = array('order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true);
423
+	$args = wp_parse_args($args, $defaults);
424 424
 
425
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
425
+	if ($args['check_enabled'] && ! wp_revisions_enabled($post))
426 426
 		return array();
427 427
 
428
-	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
428
+	$args = array_merge($args, array('post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit'));
429 429
 
430
-	if ( ! $revisions = get_children( $args ) )
430
+	if ( ! $revisions = get_children($args))
431 431
 		return array();
432 432
 
433 433
 	return $revisions;
@@ -441,8 +441,8 @@  discard block
 block discarded – undo
441 441
  * @param WP_Post $post The post object.
442 442
  * @return bool True if number of revisions to keep isn't zero, false otherwise.
443 443
  */
444
-function wp_revisions_enabled( $post ) {
445
-	return wp_revisions_to_keep( $post ) !== 0;
444
+function wp_revisions_enabled($post) {
445
+	return wp_revisions_to_keep($post) !== 0;
446 446
 }
447 447
 
448 448
 /**
@@ -458,15 +458,15 @@  discard block
 block discarded – undo
458 458
  * @param WP_Post $post The post object.
459 459
  * @return int The number of revisions to keep.
460 460
  */
461
-function wp_revisions_to_keep( $post ) {
461
+function wp_revisions_to_keep($post) {
462 462
 	$num = WP_POST_REVISIONS;
463 463
 
464
-	if ( true === $num )
464
+	if (true === $num)
465 465
 		$num = -1;
466 466
 	else
467
-		$num = intval( $num );
467
+		$num = intval($num);
468 468
 
469
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
469
+	if ( ! post_type_supports($post->post_type, 'revisions'))
470 470
 		$num = 0;
471 471
 
472 472
 	/**
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
 	 * @param int     $num  Number of revisions to store.
480 480
 	 * @param WP_Post $post Post object.
481 481
 	 */
482
-	return (int) apply_filters( 'wp_revisions_to_keep', $num, $post );
482
+	return (int) apply_filters('wp_revisions_to_keep', $num, $post);
483 483
 }
484 484
 
485 485
 /**
@@ -491,23 +491,23 @@  discard block
 block discarded – undo
491 491
  * @param WP_Post $post
492 492
  * @return WP_Post|false
493 493
  */
494
-function _set_preview( $post ) {
495
-	if ( ! is_object( $post ) ) {
494
+function _set_preview($post) {
495
+	if ( ! is_object($post)) {
496 496
 		return $post;
497 497
 	}
498 498
 
499
-	$preview = wp_get_post_autosave( $post->ID );
500
-	if ( ! is_object( $preview ) ) {
499
+	$preview = wp_get_post_autosave($post->ID);
500
+	if ( ! is_object($preview)) {
501 501
 		return $post;
502 502
 	}
503 503
 
504
-	$preview = sanitize_post( $preview );
504
+	$preview = sanitize_post($preview);
505 505
 
506 506
 	$post->post_content = $preview->post_content;
507 507
 	$post->post_title = $preview->post_title;
508 508
 	$post->post_excerpt = $preview->post_excerpt;
509 509
 
510
-	add_filter( 'get_the_terms', '_wp_preview_terms_filter', 10, 3 );
510
+	add_filter('get_the_terms', '_wp_preview_terms_filter', 10, 3);
511 511
 
512 512
 	return $post;
513 513
 }
@@ -519,11 +519,11 @@  discard block
 block discarded – undo
519 519
  * @access private
520 520
  */
521 521
 function _show_post_preview() {
522
-	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
522
+	if (isset($_GET['preview_id']) && isset($_GET['preview_nonce'])) {
523 523
 		$id = (int) $_GET['preview_id'];
524 524
 
525
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
526
-			wp_die( __('You do not have permission to preview drafts.') );
525
+		if (false === wp_verify_nonce($_GET['preview_nonce'], 'post_preview_'.$id))
526
+			wp_die(__('You do not have permission to preview drafts.'));
527 527
 
528 528
 		add_filter('the_preview', '_set_preview');
529 529
 	}
@@ -540,17 +540,17 @@  discard block
 block discarded – undo
540 540
  * @param string $taxonomy
541 541
  * @return array
542 542
  */
543
-function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
544
-	if ( ! $post = get_post() )
543
+function _wp_preview_terms_filter($terms, $post_id, $taxonomy) {
544
+	if ( ! $post = get_post())
545 545
 		return $terms;
546 546
 
547
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
547
+	if (empty($_REQUEST['post_format']) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type)
548 548
 		return $terms;
549 549
 
550
-	if ( 'standard' == $_REQUEST['post_format'] )
550
+	if ('standard' == $_REQUEST['post_format'])
551 551
 		$terms = array();
552
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
553
-		$terms = array( $term ); // Can only have one post format
552
+	elseif ($term = get_term_by('slug', 'post-format-'.sanitize_key($_REQUEST['post_format']), 'post_format'))
553
+		$terms = array($term); // Can only have one post format
554 554
 
555 555
 	return $terms;
556 556
 }
@@ -564,13 +564,13 @@  discard block
 block discarded – undo
564 564
  * @param WP_Post $revision
565 565
  * @return int|false
566 566
  */
567
-function _wp_get_post_revision_version( $revision ) {
568
-	if ( is_object( $revision ) )
569
-		$revision = get_object_vars( $revision );
570
-	elseif ( !is_array( $revision ) )
567
+function _wp_get_post_revision_version($revision) {
568
+	if (is_object($revision))
569
+		$revision = get_object_vars($revision);
570
+	elseif ( ! is_array($revision))
571 571
 		return false;
572 572
 
573
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
573
+	if (preg_match('/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches))
574 574
 		return (int) $matches[1];
575 575
 
576 576
 	return 0;
@@ -588,23 +588,23 @@  discard block
 block discarded – undo
588 588
  * @param array   $revisions Current revisions of the post
589 589
  * @return bool true if the revisions were upgraded, false if problems
590 590
  */
591
-function _wp_upgrade_revisions_of_post( $post, $revisions ) {
591
+function _wp_upgrade_revisions_of_post($post, $revisions) {
592 592
 	global $wpdb;
593 593
 
594 594
 	// Add post option exclusively
595 595
 	$lock = "revision-upgrade-{$post->ID}";
596 596
 	$now = time();
597
-	$result = $wpdb->query( $wpdb->prepare( "INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now ) );
598
-	if ( ! $result ) {
597
+	$result = $wpdb->query($wpdb->prepare("INSERT IGNORE INTO `$wpdb->options` (`option_name`, `option_value`, `autoload`) VALUES (%s, %s, 'no') /* LOCK */", $lock, $now));
598
+	if ( ! $result) {
599 599
 		// If we couldn't get a lock, see how old the previous lock is
600
-		$locked = get_option( $lock );
601
-		if ( ! $locked ) {
600
+		$locked = get_option($lock);
601
+		if ( ! $locked) {
602 602
 			// Can't write to the lock, and can't read the lock.
603 603
 			// Something broken has happened
604 604
 			return false;
605 605
 		}
606 606
 
607
-		if ( $locked > $now - 3600 ) {
607
+		if ($locked > $now - 3600) {
608 608
 			// Lock is not too old: some other process may be upgrading this post.  Bail.
609 609
 			return false;
610 610
 		}
@@ -613,57 +613,57 @@  discard block
 block discarded – undo
613 613
 	}
614 614
 
615 615
 	// If we could get a lock, re-"add" the option to fire all the correct filters.
616
-	update_option( $lock, $now );
616
+	update_option($lock, $now);
617 617
 
618
-	reset( $revisions );
618
+	reset($revisions);
619 619
 	$add_last = true;
620 620
 
621 621
 	do {
622
-		$this_revision = current( $revisions );
623
-		$prev_revision = next( $revisions );
622
+		$this_revision = current($revisions);
623
+		$prev_revision = next($revisions);
624 624
 
625
-		$this_revision_version = _wp_get_post_revision_version( $this_revision );
625
+		$this_revision_version = _wp_get_post_revision_version($this_revision);
626 626
 
627 627
 		// Something terrible happened
628
-		if ( false === $this_revision_version )
628
+		if (false === $this_revision_version)
629 629
 			continue;
630 630
 
631 631
 		// 1 is the latest revision version, so we're already up to date.
632 632
 		// No need to add a copy of the post as latest revision.
633
-		if ( 0 < $this_revision_version ) {
633
+		if (0 < $this_revision_version) {
634 634
 			$add_last = false;
635 635
 			continue;
636 636
 		}
637 637
 
638 638
 		// Always update the revision version
639 639
 		$update = array(
640
-			'post_name' => preg_replace( '/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name ),
640
+			'post_name' => preg_replace('/^(\d+-(?:autosave|revision))[\d-]*$/', '$1-v1', $this_revision->post_name),
641 641
 		);
642 642
 
643 643
 		// If this revision is the oldest revision of the post, i.e. no $prev_revision,
644 644
 		// the correct post_author is probably $post->post_author, but that's only a good guess.
645 645
 		// Update the revision version only and Leave the author as-is.
646
-		if ( $prev_revision ) {
647
-			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
646
+		if ($prev_revision) {
647
+			$prev_revision_version = _wp_get_post_revision_version($prev_revision);
648 648
 
649 649
 			// If the previous revision is already up to date, it no longer has the information we need :(
650
-			if ( $prev_revision_version < 1 )
650
+			if ($prev_revision_version < 1)
651 651
 				$update['post_author'] = $prev_revision->post_author;
652 652
 		}
653 653
 
654 654
 		// Upgrade this revision
655
-		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
655
+		$result = $wpdb->update($wpdb->posts, $update, array('ID' => $this_revision->ID));
656 656
 
657
-		if ( $result )
658
-			wp_cache_delete( $this_revision->ID, 'posts' );
657
+		if ($result)
658
+			wp_cache_delete($this_revision->ID, 'posts');
659 659
 
660
-	} while ( $prev_revision );
660
+	} while ($prev_revision);
661 661
 
662
-	delete_option( $lock );
662
+	delete_option($lock);
663 663
 
664 664
 	// Add a copy of the post as latest revision.
665
-	if ( $add_last )
666
-		wp_save_post_revision( $post->ID );
665
+	if ($add_last)
666
+		wp_save_post_revision($post->ID);
667 667
 
668 668
 	return true;
669 669
 }
Please login to merge, or discard this patch.
Braces   +129 added lines, -88 removed lines patch added patch discarded remove patch
@@ -50,16 +50,19 @@  discard block
 block discarded – undo
50 50
 		$fields = apply_filters( '_wp_post_revision_fields', $fields );
51 51
 
52 52
 		// WP uses these internally either in versioning or elsewhere - they cannot be versioned
53
-		foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect )
54
-			unset( $fields[$protect] );
53
+		foreach ( array( 'ID', 'post_name', 'post_parent', 'post_date', 'post_date_gmt', 'post_status', 'post_type', 'comment_count', 'post_author' ) as $protect ) {
54
+					unset( $fields[$protect] );
55
+		}
55 56
 	}
56 57
 
57
-	if ( !is_array($post) )
58
-		return $fields;
58
+	if ( !is_array($post) ) {
59
+			return $fields;
60
+	}
59 61
 
60 62
 	$return = array();
61
-	foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field )
62
-		$return[$field] = $post[$field];
63
+	foreach ( array_intersect( array_keys( $post ), array_keys( $fields ) ) as $field ) {
64
+			$return[$field] = $post[$field];
65
+	}
63 66
 
64 67
 	$return['post_parent']   = $post['ID'];
65 68
 	$return['post_status']   = 'inherit';
@@ -83,20 +86,25 @@  discard block
 block discarded – undo
83 86
  * @return int|WP_Error|void Void or 0 if error, new revision ID, if success.
84 87
  */
85 88
 function wp_save_post_revision( $post_id ) {
86
-	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
87
-		return;
89
+	if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
90
+			return;
91
+	}
88 92
 
89
-	if ( ! $post = get_post( $post_id ) )
90
-		return;
93
+	if ( ! $post = get_post( $post_id ) ) {
94
+			return;
95
+	}
91 96
 
92
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
93
-		return;
97
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
98
+			return;
99
+	}
94 100
 
95
-	if ( 'auto-draft' == $post->post_status )
96
-		return;
101
+	if ( 'auto-draft' == $post->post_status ) {
102
+			return;
103
+	}
97 104
 
98
-	if ( ! wp_revisions_enabled( $post ) )
99
-		return;
105
+	if ( ! wp_revisions_enabled( $post ) ) {
106
+			return;
107
+	}
100 108
 
101 109
 	// Compare the proposed update with the last stored revision verifying that
102 110
 	// they are different, unless a plugin tells us to always save regardless.
@@ -162,21 +170,24 @@  discard block
 block discarded – undo
162 170
 	// delete the oldest ones.
163 171
 	$revisions_to_keep = wp_revisions_to_keep( $post );
164 172
 
165
-	if ( $revisions_to_keep < 0 )
166
-		return $return;
173
+	if ( $revisions_to_keep < 0 ) {
174
+			return $return;
175
+	}
167 176
 
168 177
 	$revisions = wp_get_post_revisions( $post_id, array( 'order' => 'ASC' ) );
169 178
 
170 179
 	$delete = count($revisions) - $revisions_to_keep;
171 180
 
172
-	if ( $delete < 1 )
173
-		return $return;
181
+	if ( $delete < 1 ) {
182
+			return $return;
183
+	}
174 184
 
175 185
 	$revisions = array_slice( $revisions, 0, $delete );
176 186
 
177 187
 	for ( $i = 0; isset( $revisions[$i] ); $i++ ) {
178
-		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) )
179
-			continue;
188
+		if ( false !== strpos( $revisions[ $i ]->post_name, 'autosave' ) ) {
189
+					continue;
190
+		}
180 191
 
181 192
 		wp_delete_post_revision( $revisions[ $i ]->ID );
182 193
 	}
@@ -202,8 +213,9 @@  discard block
 block discarded – undo
202 213
 
203 214
 	foreach ( $revisions as $revision ) {
204 215
 		if ( false !== strpos( $revision->post_name, "{$post_id}-autosave" ) ) {
205
-			if ( $user_id && $user_id != $revision->post_author )
206
-				continue;
216
+			if ( $user_id && $user_id != $revision->post_author ) {
217
+							continue;
218
+			}
207 219
 
208 220
 			return $revision;
209 221
 		}
@@ -221,8 +233,9 @@  discard block
 block discarded – undo
221 233
  * @return false|int False if not a revision, ID of revision's parent otherwise.
222 234
  */
223 235
 function wp_is_post_revision( $post ) {
224
-	if ( !$post = wp_get_post_revision( $post ) )
225
-		return false;
236
+	if ( !$post = wp_get_post_revision( $post ) ) {
237
+			return false;
238
+	}
226 239
 
227 240
 	return (int) $post->post_parent;
228 241
 }
@@ -236,11 +249,13 @@  discard block
 block discarded – undo
236 249
  * @return false|int False if not a revision, ID of autosave's parent otherwise
237 250
  */
238 251
 function wp_is_post_autosave( $post ) {
239
-	if ( !$post = wp_get_post_revision( $post ) )
240
-		return false;
252
+	if ( !$post = wp_get_post_revision( $post ) ) {
253
+			return false;
254
+	}
241 255
 
242
-	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) )
243
-		return (int) $post->post_parent;
256
+	if ( false !== strpos( $post->post_name, "{$post->post_parent}-autosave" ) ) {
257
+			return (int) $post->post_parent;
258
+	}
244 259
 
245 260
 	return false;
246 261
 }
@@ -256,23 +271,27 @@  discard block
 block discarded – undo
256 271
  * @return int|WP_Error WP_Error or 0 if error, new revision ID if success.
257 272
  */
258 273
 function _wp_put_post_revision( $post = null, $autosave = false ) {
259
-	if ( is_object($post) )
260
-		$post = get_object_vars( $post );
261
-	elseif ( !is_array($post) )
262
-		$post = get_post($post, ARRAY_A);
274
+	if ( is_object($post) ) {
275
+			$post = get_object_vars( $post );
276
+	} elseif ( !is_array($post) ) {
277
+			$post = get_post($post, ARRAY_A);
278
+	}
263 279
 
264
-	if ( ! $post || empty($post['ID']) )
265
-		return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
280
+	if ( ! $post || empty($post['ID']) ) {
281
+			return new WP_Error( 'invalid_post', __( 'Invalid post ID.' ) );
282
+	}
266 283
 
267
-	if ( isset($post['post_type']) && 'revision' == $post['post_type'] )
268
-		return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
284
+	if ( isset($post['post_type']) && 'revision' == $post['post_type'] ) {
285
+			return new WP_Error( 'post_type', __( 'Cannot create a revision of a revision' ) );
286
+	}
269 287
 
270 288
 	$post = _wp_post_revision_fields( $post, $autosave );
271 289
 	$post = wp_slash($post); //since data is from db
272 290
 
273 291
 	$revision_id = wp_insert_post( $post );
274
-	if ( is_wp_error($revision_id) )
275
-		return $revision_id;
292
+	if ( is_wp_error($revision_id) ) {
293
+			return $revision_id;
294
+	}
276 295
 
277 296
 	if ( $revision_id ) {
278 297
 		/**
@@ -299,10 +318,12 @@  discard block
 block discarded – undo
299 318
  * @return WP_Post|array|null Null if error or post object if success.
300 319
  */
301 320
 function wp_get_post_revision(&$post, $output = OBJECT, $filter = 'raw') {
302
-	if ( !$revision = get_post( $post, OBJECT, $filter ) )
303
-		return $revision;
304
-	if ( 'revision' !== $revision->post_type )
305
-		return null;
321
+	if ( !$revision = get_post( $post, OBJECT, $filter ) ) {
322
+			return $revision;
323
+	}
324
+	if ( 'revision' !== $revision->post_type ) {
325
+			return null;
326
+	}
306 327
 
307 328
 	if ( $output == OBJECT ) {
308 329
 		return $revision;
@@ -329,27 +350,31 @@  discard block
 block discarded – undo
329 350
  * @return int|false|null Null if error, false if no fields to restore, (int) post ID if success.
330 351
  */
331 352
 function wp_restore_post_revision( $revision_id, $fields = null ) {
332
-	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) )
333
-		return $revision;
353
+	if ( !$revision = wp_get_post_revision( $revision_id, ARRAY_A ) ) {
354
+			return $revision;
355
+	}
334 356
 
335
-	if ( !is_array( $fields ) )
336
-		$fields = array_keys( _wp_post_revision_fields() );
357
+	if ( !is_array( $fields ) ) {
358
+			$fields = array_keys( _wp_post_revision_fields() );
359
+	}
337 360
 
338 361
 	$update = array();
339 362
 	foreach( array_intersect( array_keys( $revision ), $fields ) as $field ) {
340 363
 		$update[$field] = $revision[$field];
341 364
 	}
342 365
 
343
-	if ( !$update )
344
-		return false;
366
+	if ( !$update ) {
367
+			return false;
368
+	}
345 369
 
346 370
 	$update['ID'] = $revision['post_parent'];
347 371
 
348 372
 	$update = wp_slash( $update ); //since data is from db
349 373
 
350 374
 	$post_id = wp_update_post( $update );
351
-	if ( ! $post_id || is_wp_error( $post_id ) )
352
-		return $post_id;
375
+	if ( ! $post_id || is_wp_error( $post_id ) ) {
376
+			return $post_id;
377
+	}
353 378
 
354 379
 	// Add restore from details
355 380
 	$restore_details = array(
@@ -416,19 +441,22 @@  discard block
 block discarded – undo
416 441
  */
417 442
 function wp_get_post_revisions( $post_id = 0, $args = null ) {
418 443
 	$post = get_post( $post_id );
419
-	if ( ! $post || empty( $post->ID ) )
420
-		return array();
444
+	if ( ! $post || empty( $post->ID ) ) {
445
+			return array();
446
+	}
421 447
 
422 448
 	$defaults = array( 'order' => 'DESC', 'orderby' => 'date ID', 'check_enabled' => true );
423 449
 	$args = wp_parse_args( $args, $defaults );
424 450
 
425
-	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) )
426
-		return array();
451
+	if ( $args['check_enabled'] && ! wp_revisions_enabled( $post ) ) {
452
+			return array();
453
+	}
427 454
 
428 455
 	$args = array_merge( $args, array( 'post_parent' => $post->ID, 'post_type' => 'revision', 'post_status' => 'inherit' ) );
429 456
 
430
-	if ( ! $revisions = get_children( $args ) )
431
-		return array();
457
+	if ( ! $revisions = get_children( $args ) ) {
458
+			return array();
459
+	}
432 460
 
433 461
 	return $revisions;
434 462
 }
@@ -461,13 +489,15 @@  discard block
 block discarded – undo
461 489
 function wp_revisions_to_keep( $post ) {
462 490
 	$num = WP_POST_REVISIONS;
463 491
 
464
-	if ( true === $num )
465
-		$num = -1;
466
-	else
467
-		$num = intval( $num );
492
+	if ( true === $num ) {
493
+			$num = -1;
494
+	} else {
495
+			$num = intval( $num );
496
+	}
468 497
 
469
-	if ( ! post_type_supports( $post->post_type, 'revisions' ) )
470
-		$num = 0;
498
+	if ( ! post_type_supports( $post->post_type, 'revisions' ) ) {
499
+			$num = 0;
500
+	}
471 501
 
472 502
 	/**
473 503
 	 * Filter the number of revisions to save for the given post.
@@ -522,8 +552,9 @@  discard block
 block discarded – undo
522 552
 	if ( isset($_GET['preview_id']) && isset($_GET['preview_nonce']) ) {
523 553
 		$id = (int) $_GET['preview_id'];
524 554
 
525
-		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) )
526
-			wp_die( __('You do not have permission to preview drafts.') );
555
+		if ( false === wp_verify_nonce( $_GET['preview_nonce'], 'post_preview_' . $id ) ) {
556
+					wp_die( __('You do not have permission to preview drafts.') );
557
+		}
527 558
 
528 559
 		add_filter('the_preview', '_set_preview');
529 560
 	}
@@ -541,16 +572,20 @@  discard block
 block discarded – undo
541 572
  * @return array
542 573
  */
543 574
 function _wp_preview_terms_filter( $terms, $post_id, $taxonomy ) {
544
-	if ( ! $post = get_post() )
545
-		return $terms;
575
+	if ( ! $post = get_post() ) {
576
+			return $terms;
577
+	}
546 578
 
547
-	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type )
548
-		return $terms;
579
+	if ( empty( $_REQUEST['post_format'] ) || $post->ID != $post_id || 'post_format' != $taxonomy || 'revision' == $post->post_type ) {
580
+			return $terms;
581
+	}
549 582
 
550
-	if ( 'standard' == $_REQUEST['post_format'] )
551
-		$terms = array();
552
-	elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) )
553
-		$terms = array( $term ); // Can only have one post format
583
+	if ( 'standard' == $_REQUEST['post_format'] ) {
584
+			$terms = array();
585
+	} elseif ( $term = get_term_by( 'slug', 'post-format-' . sanitize_key( $_REQUEST['post_format'] ), 'post_format' ) ) {
586
+			$terms = array( $term );
587
+	}
588
+	// Can only have one post format
554 589
 
555 590
 	return $terms;
556 591
 }
@@ -565,13 +600,15 @@  discard block
 block discarded – undo
565 600
  * @return int|false
566 601
  */
567 602
 function _wp_get_post_revision_version( $revision ) {
568
-	if ( is_object( $revision ) )
569
-		$revision = get_object_vars( $revision );
570
-	elseif ( !is_array( $revision ) )
571
-		return false;
603
+	if ( is_object( $revision ) ) {
604
+			$revision = get_object_vars( $revision );
605
+	} elseif ( !is_array( $revision ) ) {
606
+			return false;
607
+	}
572 608
 
573
-	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) )
574
-		return (int) $matches[1];
609
+	if ( preg_match( '/^\d+-(?:autosave|revision)-v(\d+)$/', $revision['post_name'], $matches ) ) {
610
+			return (int) $matches[1];
611
+	}
575 612
 
576 613
 	return 0;
577 614
 }
@@ -625,8 +662,9 @@  discard block
 block discarded – undo
625 662
 		$this_revision_version = _wp_get_post_revision_version( $this_revision );
626 663
 
627 664
 		// Something terrible happened
628
-		if ( false === $this_revision_version )
629
-			continue;
665
+		if ( false === $this_revision_version ) {
666
+					continue;
667
+		}
630 668
 
631 669
 		// 1 is the latest revision version, so we're already up to date.
632 670
 		// No need to add a copy of the post as latest revision.
@@ -647,23 +685,26 @@  discard block
 block discarded – undo
647 685
 			$prev_revision_version = _wp_get_post_revision_version( $prev_revision );
648 686
 
649 687
 			// If the previous revision is already up to date, it no longer has the information we need :(
650
-			if ( $prev_revision_version < 1 )
651
-				$update['post_author'] = $prev_revision->post_author;
688
+			if ( $prev_revision_version < 1 ) {
689
+							$update['post_author'] = $prev_revision->post_author;
690
+			}
652 691
 		}
653 692
 
654 693
 		// Upgrade this revision
655 694
 		$result = $wpdb->update( $wpdb->posts, $update, array( 'ID' => $this_revision->ID ) );
656 695
 
657
-		if ( $result )
658
-			wp_cache_delete( $this_revision->ID, 'posts' );
696
+		if ( $result ) {
697
+					wp_cache_delete( $this_revision->ID, 'posts' );
698
+		}
659 699
 
660 700
 	} while ( $prev_revision );
661 701
 
662 702
 	delete_option( $lock );
663 703
 
664 704
 	// Add a copy of the post as latest revision.
665
-	if ( $add_last )
666
-		wp_save_post_revision( $post->ID );
705
+	if ( $add_last ) {
706
+			wp_save_post_revision( $post->ID );
707
+	}
667 708
 
668 709
 	return true;
669 710
 }
Please login to merge, or discard this patch.
src/wp-includes/rss.php 3 patches
Doc Comments   +13 added lines, -4 removed lines patch added patch discarded remove patch
@@ -409,7 +409,7 @@  discard block
 block discarded – undo
409 409
  * @subpackage MagpieRSS
410 410
  *
411 411
  * @param string $url URL to retrieve feed
412
- * @return bool|MagpieRSS false on failure or MagpieRSS object on success.
412
+ * @return integer|null false on failure or MagpieRSS object on success.
413 413
  */
414 414
 function fetch_rss ($url) {
415 415
 	// initialize constants
@@ -547,7 +547,7 @@  discard block
 block discarded – undo
547 547
  *
548 548
  * @param string $url URL to retrieve
549 549
  * @param array $headers Optional. Headers to send to the URL.
550
- * @return Snoopy style response
550
+ * @return stdClass style response
551 551
  */
552 552
 function _fetch_remote_file($url, $headers = "" ) {
553 553
 	$resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) );
@@ -589,7 +589,7 @@  discard block
 block discarded – undo
589 589
  * @package External
590 590
  * @subpackage MagpieRSS
591 591
  *
592
- * @param array $resp
592
+ * @param stdClass $resp
593 593
  * @return MagpieRSS|bool
594 594
  */
595 595
 function _response_to_rss ($resp) {
@@ -746,6 +746,9 @@  discard block
 block discarded – undo
746 746
 	Input:		url from wich the rss file was fetched
747 747
 	Output:		true on success
748 748
 \*=======================================================================*/
749
+	/**
750
+	 * @param string $url
751
+	 */
749 752
 	function set ($url, $rss) {
750 753
 		$cache_option = 'rss_' . $this->file_name( $url );
751 754
 
@@ -760,6 +763,9 @@  discard block
 block discarded – undo
760 763
 	Input:		url from wich the rss file was fetched
761 764
 	Output:		cached object on HIT, false on MISS
762 765
 \*=======================================================================*/
766
+	/**
767
+	 * @param string $url
768
+	 */
763 769
 	function get ($url) {
764 770
 		$this->ERROR = "";
765 771
 		$cache_option = 'rss_' . $this->file_name( $url );
@@ -781,6 +787,9 @@  discard block
 block discarded – undo
781 787
 	Input:		url from wich the rss file was fetched
782 788
 	Output:		cached object on HIT, false on MISS
783 789
 \*=======================================================================*/
790
+	/**
791
+	 * @param string $url
792
+	 */
784 793
 	function check_cache ( $url ) {
785 794
 		$this->ERROR = "";
786 795
 		$cache_option = 'rss_' . $this->file_name( $url );
@@ -936,7 +945,7 @@  discard block
 block discarded – undo
936 945
  *
937 946
  * @param string $url URL of feed to display. Will not auto sense feed URL.
938 947
  * @param int $num_items Optional. Number of items to display, default is all.
939
- * @return bool False on failure.
948
+ * @return null|false False on failure.
940 949
  */
941 950
 function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
942 951
 	$rss = fetch_rss($url);
Please login to merge, or discard this patch.
Spacing   +224 added lines, -224 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 /**
17 17
  * Deprecated. Use SimplePie (class-simplepie.php) instead.
18 18
  */
19
-_deprecated_file( basename( __FILE__ ), '3.0', WPINC . '/class-simplepie.php' );
19
+_deprecated_file(basename(__FILE__), '3.0', WPINC.'/class-simplepie.php');
20 20
 
21 21
 /**
22 22
  * Fires before MagpieRSS is loaded, to optionally replace it.
@@ -24,32 +24,32 @@  discard block
 block discarded – undo
24 24
  * @since 2.3.0
25 25
  * @deprecated 3.0.0
26 26
  */
27
-do_action( 'load_feed_engine' );
27
+do_action('load_feed_engine');
28 28
 
29 29
 /** RSS feed constant. */
30 30
 define('RSS', 'RSS');
31 31
 define('ATOM', 'Atom');
32
-define('MAGPIE_USER_AGENT', 'WordPress/' . $GLOBALS['wp_version']);
32
+define('MAGPIE_USER_AGENT', 'WordPress/'.$GLOBALS['wp_version']);
33 33
 
34 34
 class MagpieRSS {
35 35
 	var $parser;
36
-	var $current_item	= array();	// item currently being parsed
37
-	var $items			= array();	// collection of parsed items
38
-	var $channel		= array();	// hash of channel fields
39
-	var $textinput		= array();
36
+	var $current_item = array(); // item currently being parsed
37
+	var $items			= array(); // collection of parsed items
38
+	var $channel = array(); // hash of channel fields
39
+	var $textinput = array();
40 40
 	var $image			= array();
41 41
 	var $feed_type;
42 42
 	var $feed_version;
43 43
 
44 44
 	// parser variables
45
-	var $stack				= array(); // parser stack
45
+	var $stack = array(); // parser stack
46 46
 	var $inchannel			= false;
47
-	var $initem 			= false;
47
+	var $initem = false;
48 48
 	var $incontent			= false; // if in Atom <content mode="xml"> field
49
-	var $intextinput		= false;
50
-	var $inimage 			= false;
51
-	var $current_field		= '';
52
-	var $current_namespace	= false;
49
+	var $intextinput = false;
50
+	var $inimage = false;
51
+	var $current_field = '';
52
+	var $current_namespace = false;
53 53
 
54 54
 	//var $ERROR = "";
55 55
 
@@ -58,44 +58,44 @@  discard block
 block discarded – undo
58 58
 	/**
59 59
 	 * PHP5 constructor.
60 60
 	 */
61
-	function __construct( $source ) {
61
+	function __construct($source) {
62 62
 
63 63
 		# if PHP xml isn't compiled in, die
64 64
 		#
65
-		if ( !function_exists('xml_parser_create') )
66
-			trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
65
+		if ( ! function_exists('xml_parser_create'))
66
+			trigger_error("Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php");
67 67
 
68 68
 		$parser = @xml_parser_create();
69 69
 
70
-		if ( !is_resource($parser) )
71
-			trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
70
+		if ( ! is_resource($parser))
71
+			trigger_error("Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
72 72
 
73 73
 		$this->parser = $parser;
74 74
 
75 75
 		# pass in parser, and a reference to this object
76 76
 		# set up handlers
77 77
 		#
78
-		xml_set_object( $this->parser, $this );
78
+		xml_set_object($this->parser, $this);
79 79
 		xml_set_element_handler($this->parser,
80
-				'feed_start_element', 'feed_end_element' );
80
+				'feed_start_element', 'feed_end_element');
81 81
 
82
-		xml_set_character_data_handler( $this->parser, 'feed_cdata' );
82
+		xml_set_character_data_handler($this->parser, 'feed_cdata');
83 83
 
84
-		$status = xml_parse( $this->parser, $source );
84
+		$status = xml_parse($this->parser, $source);
85 85
 
86
-		if (! $status ) {
87
-			$errorcode = xml_get_error_code( $this->parser );
88
-			if ( $errorcode != XML_ERROR_NONE ) {
89
-				$xml_error = xml_error_string( $errorcode );
86
+		if ( ! $status) {
87
+			$errorcode = xml_get_error_code($this->parser);
88
+			if ($errorcode != XML_ERROR_NONE) {
89
+				$xml_error = xml_error_string($errorcode);
90 90
 				$error_line = xml_get_current_line_number($this->parser);
91 91
 				$error_col = xml_get_current_column_number($this->parser);
92 92
 				$errormsg = "$xml_error at line $error_line, column $error_col";
93 93
 
94
-				$this->error( $errormsg );
94
+				$this->error($errormsg);
95 95
 			}
96 96
 		}
97 97
 
98
-		xml_parser_free( $this->parser );
98
+		xml_parser_free($this->parser);
99 99
 
100 100
 		$this->normalize();
101 101
 	}
@@ -103,8 +103,8 @@  discard block
 block discarded – undo
103 103
 	/**
104 104
 	 * PHP4 constructor.
105 105
 	 */
106
-	public function MagpieRSS( $source ) {
107
-		self::__construct( $source );
106
+	public function MagpieRSS($source) {
107
+		self::__construct($source);
108 108
 	}
109 109
 
110 110
 	function feed_start_element($p, $element, &$attrs) {
@@ -112,27 +112,27 @@  discard block
 block discarded – undo
112 112
 		$attrs = array_change_key_case($attrs, CASE_LOWER);
113 113
 
114 114
 		// check for a namespace, and split if found
115
-		$ns	= false;
116
-		if ( strpos( $element, ':' ) ) {
117
-			list($ns, $el) = split( ':', $element, 2);
115
+		$ns = false;
116
+		if (strpos($element, ':')) {
117
+			list($ns, $el) = split(':', $element, 2);
118 118
 		}
119
-		if ( $ns and $ns != 'rdf' ) {
119
+		if ($ns and $ns != 'rdf') {
120 120
 			$this->current_namespace = $ns;
121 121
 		}
122 122
 
123 123
 		# if feed type isn't set, then this is first element of feed
124 124
 		# identify feed from root element
125 125
 		#
126
-		if (!isset($this->feed_type) ) {
127
-			if ( $el == 'rdf' ) {
126
+		if ( ! isset($this->feed_type)) {
127
+			if ($el == 'rdf') {
128 128
 				$this->feed_type = RSS;
129 129
 				$this->feed_version = '1.0';
130 130
 			}
131
-			elseif ( $el == 'rss' ) {
131
+			elseif ($el == 'rss') {
132 132
 				$this->feed_type = RSS;
133 133
 				$this->feed_version = $attrs['version'];
134 134
 			}
135
-			elseif ( $el == 'feed' ) {
135
+			elseif ($el == 'feed') {
136 136
 				$this->feed_type = ATOM;
137 137
 				$this->feed_version = $attrs['version'];
138 138
 				$this->inchannel = true;
@@ -140,14 +140,14 @@  discard block
 block discarded – undo
140 140
 			return;
141 141
 		}
142 142
 
143
-		if ( $el == 'channel' )
143
+		if ($el == 'channel')
144 144
 		{
145 145
 			$this->inchannel = true;
146 146
 		}
147
-		elseif ($el == 'item' or $el == 'entry' )
147
+		elseif ($el == 'item' or $el == 'entry')
148 148
 		{
149 149
 			$this->initem = true;
150
-			if ( isset($attrs['rdf:about']) ) {
150
+			if (isset($attrs['rdf:about'])) {
151 151
 				$this->current_item['about'] = $attrs['rdf:about'];
152 152
 			}
153 153
 		}
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 		}
172 172
 
173 173
 		# handle atom content constructs
174
-		elseif ( $this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
174
+		elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS))
175 175
 		{
176 176
 			// avoid clashing w/ RSS mod_content
177
-			if ($el == 'content' ) {
177
+			if ($el == 'content') {
178 178
 				$el = 'atom_content';
179 179
 			}
180 180
 
@@ -183,31 +183,31 @@  discard block
 block discarded – undo
183 183
 		}
184 184
 
185 185
 		// if inside an Atom content construct (e.g. content or summary) field treat tags as text
186
-		elseif ($this->feed_type == ATOM and $this->incontent )
186
+		elseif ($this->feed_type == ATOM and $this->incontent)
187 187
 		{
188 188
 			// if tags are inlined, then flatten
189 189
 			$attrs_str = join(' ',
190 190
 					array_map(array('MagpieRSS', 'map_attrs'),
191 191
 					array_keys($attrs),
192
-					array_values($attrs) ) );
192
+					array_values($attrs)));
193 193
 
194
-			$this->append_content( "<$element $attrs_str>"  );
194
+			$this->append_content("<$element $attrs_str>");
195 195
 
196
-			array_unshift( $this->stack, $el );
196
+			array_unshift($this->stack, $el);
197 197
 		}
198 198
 
199 199
 		// Atom support many links per containging element.
200 200
 		// Magpie treats link elements of type rel='alternate'
201 201
 		// as being equivalent to RSS's simple link element.
202 202
 		//
203
-		elseif ($this->feed_type == ATOM and $el == 'link' )
203
+		elseif ($this->feed_type == ATOM and $el == 'link')
204 204
 		{
205
-			if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
205
+			if (isset($attrs['rel']) and $attrs['rel'] == 'alternate')
206 206
 			{
207 207
 				$link_el = 'link';
208 208
 			}
209 209
 			else {
210
-				$link_el = 'link_' . $attrs['rel'];
210
+				$link_el = 'link_'.$attrs['rel'];
211 211
 			}
212 212
 
213 213
 			$this->append($link_el, $attrs['href']);
@@ -218,11 +218,11 @@  discard block
 block discarded – undo
218 218
 		}
219 219
 	}
220 220
 
221
-	function feed_cdata ($p, $text) {
221
+	function feed_cdata($p, $text) {
222 222
 
223 223
 		if ($this->feed_type == ATOM and $this->incontent)
224 224
 		{
225
-			$this->append_content( $text );
225
+			$this->append_content($text);
226 226
 		}
227 227
 		else {
228 228
 			$current_el = join('_', array_reverse($this->stack));
@@ -230,35 +230,35 @@  discard block
 block discarded – undo
230 230
 		}
231 231
 	}
232 232
 
233
-	function feed_end_element ($p, $el) {
233
+	function feed_end_element($p, $el) {
234 234
 		$el = strtolower($el);
235 235
 
236
-		if ( $el == 'item' or $el == 'entry' )
236
+		if ($el == 'item' or $el == 'entry')
237 237
 		{
238 238
 			$this->items[] = $this->current_item;
239 239
 			$this->current_item = array();
240 240
 			$this->initem = false;
241 241
 		}
242
-		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
242
+		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput')
243 243
 		{
244 244
 			$this->intextinput = false;
245 245
 		}
246
-		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
246
+		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image')
247 247
 		{
248 248
 			$this->inimage = false;
249 249
 		}
250
-		elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
250
+		elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS))
251 251
 		{
252 252
 			$this->incontent = false;
253 253
 		}
254
-		elseif ($el == 'channel' or $el == 'feed' )
254
+		elseif ($el == 'channel' or $el == 'feed')
255 255
 		{
256 256
 			$this->inchannel = false;
257 257
 		}
258
-		elseif ($this->feed_type == ATOM and $this->incontent  ) {
258
+		elseif ($this->feed_type == ATOM and $this->incontent) {
259 259
 			// balance tags properly
260 260
 			// note: This may not actually be necessary
261
-			if ( $this->stack[0] == $el )
261
+			if ($this->stack[0] == $el)
262 262
 			{
263 263
 				$this->append_content("</$el>");
264 264
 			}
@@ -266,97 +266,97 @@  discard block
 block discarded – undo
266 266
 				$this->append_content("<$el />");
267 267
 			}
268 268
 
269
-			array_shift( $this->stack );
269
+			array_shift($this->stack);
270 270
 		}
271 271
 		else {
272
-			array_shift( $this->stack );
272
+			array_shift($this->stack);
273 273
 		}
274 274
 
275 275
 		$this->current_namespace = false;
276 276
 	}
277 277
 
278
-	function concat (&$str1, $str2="") {
279
-		if (!isset($str1) ) {
280
-			$str1="";
278
+	function concat(&$str1, $str2 = "") {
279
+		if ( ! isset($str1)) {
280
+			$str1 = "";
281 281
 		}
282 282
 		$str1 .= $str2;
283 283
 	}
284 284
 
285 285
 	function append_content($text) {
286
-		if ( $this->initem ) {
287
-			$this->concat( $this->current_item[ $this->incontent ], $text );
286
+		if ($this->initem) {
287
+			$this->concat($this->current_item[$this->incontent], $text);
288 288
 		}
289
-		elseif ( $this->inchannel ) {
290
-			$this->concat( $this->channel[ $this->incontent ], $text );
289
+		elseif ($this->inchannel) {
290
+			$this->concat($this->channel[$this->incontent], $text);
291 291
 		}
292 292
 	}
293 293
 
294 294
 	// smart append - field and namespace aware
295 295
 	function append($el, $text) {
296
-		if (!$el) {
296
+		if ( ! $el) {
297 297
 			return;
298 298
 		}
299
-		if ( $this->current_namespace )
299
+		if ($this->current_namespace)
300 300
 		{
301
-			if ( $this->initem ) {
301
+			if ($this->initem) {
302 302
 				$this->concat(
303
-					$this->current_item[ $this->current_namespace ][ $el ], $text);
303
+					$this->current_item[$this->current_namespace][$el], $text);
304 304
 			}
305 305
 			elseif ($this->inchannel) {
306 306
 				$this->concat(
307
-					$this->channel[ $this->current_namespace][ $el ], $text );
307
+					$this->channel[$this->current_namespace][$el], $text );
308 308
 			}
309 309
 			elseif ($this->intextinput) {
310 310
 				$this->concat(
311
-					$this->textinput[ $this->current_namespace][ $el ], $text );
311
+					$this->textinput[$this->current_namespace][$el], $text );
312 312
 			}
313 313
 			elseif ($this->inimage) {
314 314
 				$this->concat(
315
-					$this->image[ $this->current_namespace ][ $el ], $text );
315
+					$this->image[$this->current_namespace][$el], $text );
316 316
 			}
317 317
 		}
318 318
 		else {
319
-			if ( $this->initem ) {
319
+			if ($this->initem) {
320 320
 				$this->concat(
321
-					$this->current_item[ $el ], $text);
321
+					$this->current_item[$el], $text);
322 322
 			}
323 323
 			elseif ($this->intextinput) {
324 324
 				$this->concat(
325
-					$this->textinput[ $el ], $text );
325
+					$this->textinput[$el], $text );
326 326
 			}
327 327
 			elseif ($this->inimage) {
328 328
 				$this->concat(
329
-					$this->image[ $el ], $text );
329
+					$this->image[$el], $text );
330 330
 			}
331 331
 			elseif ($this->inchannel) {
332 332
 				$this->concat(
333
-					$this->channel[ $el ], $text );
333
+					$this->channel[$el], $text );
334 334
 			}
335 335
 
336 336
 		}
337 337
 	}
338 338
 
339
-	function normalize () {
339
+	function normalize() {
340 340
 		// if atom populate rss fields
341
-		if ( $this->is_atom() ) {
341
+		if ($this->is_atom()) {
342 342
 			$this->channel['descripton'] = $this->channel['tagline'];
343
-			for ( $i = 0; $i < count($this->items); $i++) {
343
+			for ($i = 0; $i < count($this->items); $i++) {
344 344
 				$item = $this->items[$i];
345
-				if ( isset($item['summary']) )
345
+				if (isset($item['summary']))
346 346
 					$item['description'] = $item['summary'];
347
-				if ( isset($item['atom_content']))
347
+				if (isset($item['atom_content']))
348 348
 					$item['content']['encoded'] = $item['atom_content'];
349 349
 
350 350
 				$this->items[$i] = $item;
351 351
 			}
352 352
 		}
353
-		elseif ( $this->is_rss() ) {
353
+		elseif ($this->is_rss()) {
354 354
 			$this->channel['tagline'] = $this->channel['description'];
355
-			for ( $i = 0; $i < count($this->items); $i++) {
355
+			for ($i = 0; $i < count($this->items); $i++) {
356 356
 				$item = $this->items[$i];
357
-				if ( isset($item['description']))
357
+				if (isset($item['description']))
358 358
 					$item['summary'] = $item['description'];
359
-				if ( isset($item['content']['encoded'] ) )
359
+				if (isset($item['content']['encoded']))
360 360
 					$item['atom_content'] = $item['content']['encoded'];
361 361
 
362 362
 				$this->items[$i] = $item;
@@ -364,8 +364,8 @@  discard block
 block discarded – undo
364 364
 		}
365 365
 	}
366 366
 
367
-	function is_rss () {
368
-		if ( $this->feed_type == RSS ) {
367
+	function is_rss() {
368
+		if ($this->feed_type == RSS) {
369 369
 			return $this->feed_version;
370 370
 		}
371 371
 		else {
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 	}
375 375
 
376 376
 	function is_atom() {
377
-		if ( $this->feed_type == ATOM ) {
377
+		if ($this->feed_type == ATOM) {
378 378
 			return $this->feed_version;
379 379
 		}
380 380
 		else {
@@ -386,21 +386,21 @@  discard block
 block discarded – undo
386 386
 		return "$k=\"$v\"";
387 387
 	}
388 388
 
389
-	function error( $errormsg, $lvl = E_USER_WARNING ) {
389
+	function error($errormsg, $lvl = E_USER_WARNING) {
390 390
 		// append PHP's error message if track_errors enabled
391
-		if ( isset($php_errormsg) ) {
391
+		if (isset($php_errormsg)) {
392 392
 			$errormsg .= " ($php_errormsg)";
393 393
 		}
394
-		if ( MAGPIE_DEBUG ) {
395
-			trigger_error( $errormsg, $lvl);
394
+		if (MAGPIE_DEBUG) {
395
+			trigger_error($errormsg, $lvl);
396 396
 		} else {
397
-			error_log( $errormsg, 0);
397
+			error_log($errormsg, 0);
398 398
 		}
399 399
 	}
400 400
 
401 401
 }
402 402
 
403
-if ( !function_exists('fetch_rss') ) :
403
+if ( ! function_exists('fetch_rss')) :
404 404
 /**
405 405
  * Build Magpie object based on RSS from URL.
406 406
  *
@@ -411,21 +411,21 @@  discard block
 block discarded – undo
411 411
  * @param string $url URL to retrieve feed
412 412
  * @return bool|MagpieRSS false on failure or MagpieRSS object on success.
413 413
  */
414
-function fetch_rss ($url) {
414
+function fetch_rss($url) {
415 415
 	// initialize constants
416 416
 	init();
417 417
 
418
-	if ( !isset($url) ) {
418
+	if ( ! isset($url)) {
419 419
 		// error("fetch_rss called without a url");
420 420
 		return false;
421 421
 	}
422 422
 
423 423
 	// if cache is disabled
424
-	if ( !MAGPIE_CACHE_ON ) {
424
+	if ( ! MAGPIE_CACHE_ON) {
425 425
 		// fetch file, and parse it
426
-		$resp = _fetch_remote_file( $url );
427
-		if ( is_success( $resp->status ) ) {
428
-			return _response_to_rss( $resp );
426
+		$resp = _fetch_remote_file($url);
427
+		if (is_success($resp->status)) {
428
+			return _response_to_rss($resp);
429 429
 		}
430 430
 		else {
431 431
 			// error("Failed to fetch $url and cache is off");
@@ -440,28 +440,28 @@  discard block
 block discarded – undo
440 440
 		// 3. if cached obj fails freshness check, fetch remote
441 441
 		// 4. if remote fails, return stale object, or error
442 442
 
443
-		$cache = new RSSCache( MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE );
443
+		$cache = new RSSCache(MAGPIE_CACHE_DIR, MAGPIE_CACHE_AGE);
444 444
 
445 445
 		if (MAGPIE_DEBUG and $cache->ERROR) {
446 446
 			debug($cache->ERROR, E_USER_WARNING);
447 447
 		}
448 448
 
449
-		$cache_status 	 = 0;		// response of check_cache
449
+		$cache_status = 0; // response of check_cache
450 450
 		$request_headers = array(); // HTTP headers to send with fetch
451
-		$rss 			 = 0;		// parsed RSS object
452
-		$errormsg		 = 0;		// errors, if any
451
+		$rss = 0; // parsed RSS object
452
+		$errormsg = 0; // errors, if any
453 453
 
454
-		if (!$cache->ERROR) {
454
+		if ( ! $cache->ERROR) {
455 455
 			// return cache HIT, MISS, or STALE
456
-			$cache_status = $cache->check_cache( $url );
456
+			$cache_status = $cache->check_cache($url);
457 457
 		}
458 458
 
459 459
 		// if object cached, and cache is fresh, return cached obj
460
-		if ( $cache_status == 'HIT' ) {
461
-			$rss = $cache->get( $url );
462
-			if ( isset($rss) and $rss ) {
460
+		if ($cache_status == 'HIT') {
461
+			$rss = $cache->get($url);
462
+			if (isset($rss) and $rss) {
463 463
 				$rss->from_cache = 1;
464
-				if ( MAGPIE_DEBUG > 1) {
464
+				if (MAGPIE_DEBUG > 1) {
465 465
 				debug("MagpieRSS: Cache HIT", E_USER_NOTICE);
466 466
 			}
467 467
 				return $rss;
@@ -471,47 +471,47 @@  discard block
 block discarded – undo
471 471
 		// else attempt a conditional get
472 472
 
473 473
 		// set up headers
474
-		if ( $cache_status == 'STALE' ) {
475
-			$rss = $cache->get( $url );
476
-			if ( isset($rss->etag) and $rss->last_modified ) {
474
+		if ($cache_status == 'STALE') {
475
+			$rss = $cache->get($url);
476
+			if (isset($rss->etag) and $rss->last_modified) {
477 477
 				$request_headers['If-None-Match'] = $rss->etag;
478 478
 				$request_headers['If-Last-Modified'] = $rss->last_modified;
479 479
 			}
480 480
 		}
481 481
 
482
-		$resp = _fetch_remote_file( $url, $request_headers );
482
+		$resp = _fetch_remote_file($url, $request_headers);
483 483
 
484 484
 		if (isset($resp) and $resp) {
485
-			if ($resp->status == '304' ) {
485
+			if ($resp->status == '304') {
486 486
 				// we have the most current copy
487
-				if ( MAGPIE_DEBUG > 1) {
487
+				if (MAGPIE_DEBUG > 1) {
488 488
 					debug("Got 304 for $url");
489 489
 				}
490 490
 				// reset cache on 304 (at minutillo insistent prodding)
491 491
 				$cache->set($url, $rss);
492 492
 				return $rss;
493 493
 			}
494
-			elseif ( is_success( $resp->status ) ) {
495
-				$rss = _response_to_rss( $resp );
496
-				if ( $rss ) {
494
+			elseif (is_success($resp->status)) {
495
+				$rss = _response_to_rss($resp);
496
+				if ($rss) {
497 497
 					if (MAGPIE_DEBUG > 1) {
498 498
 						debug("Fetch successful");
499 499
 					}
500 500
 					// add object to cache
501
-					$cache->set( $url, $rss );
501
+					$cache->set($url, $rss);
502 502
 					return $rss;
503 503
 				}
504 504
 			}
505 505
 			else {
506 506
 				$errormsg = "Failed to fetch $url. ";
507
-				if ( $resp->error ) {
507
+				if ($resp->error) {
508 508
 					# compensate for Snoopy's annoying habbit to tacking
509 509
 					# on '\n'
510 510
 					$http_error = substr($resp->error, 0, -2);
511 511
 					$errormsg .= "(HTTP Error: $http_error)";
512 512
 				}
513 513
 				else {
514
-					$errormsg .=  "(HTTP Response: " . $resp->response_code .')';
514
+					$errormsg .= "(HTTP Response: ".$resp->response_code.')';
515 515
 				}
516 516
 			}
517 517
 		}
@@ -523,7 +523,7 @@  discard block
 block discarded – undo
523 523
 
524 524
 		// attempt to return cached object
525 525
 		if ($rss) {
526
-			if ( MAGPIE_DEBUG ) {
526
+			if (MAGPIE_DEBUG) {
527 527
 				debug("Returning STALE object for $url");
528 528
 			}
529 529
 			return $rss;
@@ -549,35 +549,35 @@  discard block
 block discarded – undo
549 549
  * @param array $headers Optional. Headers to send to the URL.
550 550
  * @return Snoopy style response
551 551
  */
552
-function _fetch_remote_file($url, $headers = "" ) {
553
-	$resp = wp_safe_remote_request( $url, array( 'headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT ) );
554
-	if ( is_wp_error($resp) ) {
552
+function _fetch_remote_file($url, $headers = "") {
553
+	$resp = wp_safe_remote_request($url, array('headers' => $headers, 'timeout' => MAGPIE_FETCH_TIME_OUT));
554
+	if (is_wp_error($resp)) {
555 555
 		$error = array_shift($resp->errors);
556 556
 
557 557
 		$resp = new stdClass;
558 558
 		$resp->status = 500;
559 559
 		$resp->response_code = 500;
560
-		$resp->error = $error[0] . "\n"; //\n = Snoopy compatibility
560
+		$resp->error = $error[0]."\n"; //\n = Snoopy compatibility
561 561
 		return $resp;
562 562
 	}
563 563
 
564 564
 	// Snoopy returns headers unprocessed.
565 565
 	// Also note, WP_HTTP lowercases all keys, Snoopy did not.
566 566
 	$return_headers = array();
567
-	foreach ( wp_remote_retrieve_headers( $resp ) as $key => $value ) {
568
-		if ( !is_array($value) ) {
567
+	foreach (wp_remote_retrieve_headers($resp) as $key => $value) {
568
+		if ( ! is_array($value)) {
569 569
 			$return_headers[] = "$key: $value";
570 570
 		} else {
571
-			foreach ( $value as $v )
571
+			foreach ($value as $v)
572 572
 				$return_headers[] = "$key: $v";
573 573
 		}
574 574
 	}
575 575
 
576 576
 	$response = new stdClass;
577
-	$response->status = wp_remote_retrieve_response_code( $resp );
578
-	$response->response_code = wp_remote_retrieve_response_code( $resp );
577
+	$response->status = wp_remote_retrieve_response_code($resp);
578
+	$response->response_code = wp_remote_retrieve_response_code($resp);
579 579
 	$response->headers = $return_headers;
580
-	$response->results = wp_remote_retrieve_body( $resp );
580
+	$response->results = wp_remote_retrieve_body($resp);
581 581
 
582 582
 	return $response;
583 583
 }
@@ -592,14 +592,14 @@  discard block
 block discarded – undo
592 592
  * @param array $resp
593 593
  * @return MagpieRSS|bool
594 594
  */
595
-function _response_to_rss ($resp) {
596
-	$rss = new MagpieRSS( $resp->results );
595
+function _response_to_rss($resp) {
596
+	$rss = new MagpieRSS($resp->results);
597 597
 
598 598
 	// if RSS parsed successfully
599
-	if ( $rss && (!isset($rss->ERROR) || !$rss->ERROR) ) {
599
+	if ($rss && ( ! isset($rss->ERROR) || ! $rss->ERROR)) {
600 600
 
601 601
 		// find Etag, and Last-Modified
602
-		foreach( (array) $resp->headers as $h) {
602
+		foreach ((array) $resp->headers as $h) {
603 603
 			// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
604 604
 			if (strpos($h, ": ")) {
605 605
 				list($field, $val) = explode(": ", $h, 2);
@@ -609,11 +609,11 @@  discard block
 block discarded – undo
609 609
 				$val = "";
610 610
 			}
611 611
 
612
-			if ( $field == 'etag' ) {
612
+			if ($field == 'etag') {
613 613
 				$rss->etag = $val;
614 614
 			}
615 615
 
616
-			if ( $field == 'last-modified' ) {
616
+			if ($field == 'last-modified') {
617 617
 				$rss->last_modified = $val;
618 618
 			}
619 619
 		}
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
 		$errormsg = "Failed to parse RSS file.";
625 625
 
626 626
 		if ($rss) {
627
-			$errormsg .= " (" . $rss->ERROR . ")";
627
+			$errormsg .= " (".$rss->ERROR.")";
628 628
 		}
629 629
 		// error($errormsg);
630 630
 
@@ -639,95 +639,95 @@  discard block
 block discarded – undo
639 639
  * @package External
640 640
  * @subpackage MagpieRSS
641 641
  */
642
-function init () {
643
-	if ( defined('MAGPIE_INITALIZED') ) {
642
+function init() {
643
+	if (defined('MAGPIE_INITALIZED')) {
644 644
 		return;
645 645
 	}
646 646
 	else {
647 647
 		define('MAGPIE_INITALIZED', 1);
648 648
 	}
649 649
 
650
-	if ( !defined('MAGPIE_CACHE_ON') ) {
650
+	if ( ! defined('MAGPIE_CACHE_ON')) {
651 651
 		define('MAGPIE_CACHE_ON', 1);
652 652
 	}
653 653
 
654
-	if ( !defined('MAGPIE_CACHE_DIR') ) {
654
+	if ( ! defined('MAGPIE_CACHE_DIR')) {
655 655
 		define('MAGPIE_CACHE_DIR', './cache');
656 656
 	}
657 657
 
658
-	if ( !defined('MAGPIE_CACHE_AGE') ) {
659
-		define('MAGPIE_CACHE_AGE', 60*60); // one hour
658
+	if ( ! defined('MAGPIE_CACHE_AGE')) {
659
+		define('MAGPIE_CACHE_AGE', 60 * 60); // one hour
660 660
 	}
661 661
 
662
-	if ( !defined('MAGPIE_CACHE_FRESH_ONLY') ) {
662
+	if ( ! defined('MAGPIE_CACHE_FRESH_ONLY')) {
663 663
 		define('MAGPIE_CACHE_FRESH_ONLY', 0);
664 664
 	}
665 665
 
666
-		if ( !defined('MAGPIE_DEBUG') ) {
666
+		if ( ! defined('MAGPIE_DEBUG')) {
667 667
 		define('MAGPIE_DEBUG', 0);
668 668
 	}
669 669
 
670
-	if ( !defined('MAGPIE_USER_AGENT') ) {
671
-		$ua = 'WordPress/' . $GLOBALS['wp_version'];
670
+	if ( ! defined('MAGPIE_USER_AGENT')) {
671
+		$ua = 'WordPress/'.$GLOBALS['wp_version'];
672 672
 
673
-		if ( MAGPIE_CACHE_ON ) {
674
-			$ua = $ua . ')';
673
+		if (MAGPIE_CACHE_ON) {
674
+			$ua = $ua.')';
675 675
 		}
676 676
 		else {
677
-			$ua = $ua . '; No cache)';
677
+			$ua = $ua.'; No cache)';
678 678
 		}
679 679
 
680 680
 		define('MAGPIE_USER_AGENT', $ua);
681 681
 	}
682 682
 
683
-	if ( !defined('MAGPIE_FETCH_TIME_OUT') ) {
684
-		define('MAGPIE_FETCH_TIME_OUT', 2);	// 2 second timeout
683
+	if ( ! defined('MAGPIE_FETCH_TIME_OUT')) {
684
+		define('MAGPIE_FETCH_TIME_OUT', 2); // 2 second timeout
685 685
 	}
686 686
 
687 687
 	// use gzip encoding to fetch rss files if supported?
688
-	if ( !defined('MAGPIE_USE_GZIP') ) {
688
+	if ( ! defined('MAGPIE_USE_GZIP')) {
689 689
 		define('MAGPIE_USE_GZIP', true);
690 690
 	}
691 691
 }
692 692
 
693
-function is_info ($sc) {
693
+function is_info($sc) {
694 694
 	return $sc >= 100 && $sc < 200;
695 695
 }
696 696
 
697
-function is_success ($sc) {
697
+function is_success($sc) {
698 698
 	return $sc >= 200 && $sc < 300;
699 699
 }
700 700
 
701
-function is_redirect ($sc) {
701
+function is_redirect($sc) {
702 702
 	return $sc >= 300 && $sc < 400;
703 703
 }
704 704
 
705
-function is_error ($sc) {
705
+function is_error($sc) {
706 706
 	return $sc >= 400 && $sc < 600;
707 707
 }
708 708
 
709
-function is_client_error ($sc) {
709
+function is_client_error($sc) {
710 710
 	return $sc >= 400 && $sc < 500;
711 711
 }
712 712
 
713
-function is_server_error ($sc) {
713
+function is_server_error($sc) {
714 714
 	return $sc >= 500 && $sc < 600;
715 715
 }
716 716
 
717 717
 class RSSCache {
718
-	var $BASE_CACHE;	// where the cache files are stored
719
-	var $MAX_AGE	= 43200;  		// when are files stale, default twelve hours
720
-	var $ERROR 		= '';			// accumulate error messages
718
+	var $BASE_CACHE; // where the cache files are stored
719
+	var $MAX_AGE	= 43200; // when are files stale, default twelve hours
720
+	var $ERROR 		= ''; // accumulate error messages
721 721
 
722 722
 	/**
723 723
 	 * PHP5 constructor.
724 724
 	 */
725
-	function __construct( $base = '', $age = '' ) {
726
-		$this->BASE_CACHE = WP_CONTENT_DIR . '/cache';
727
-		if ( $base ) {
725
+	function __construct($base = '', $age = '') {
726
+		$this->BASE_CACHE = WP_CONTENT_DIR.'/cache';
727
+		if ($base) {
728 728
 			$this->BASE_CACHE = $base;
729 729
 		}
730
-		if ( $age ) {
730
+		if ($age) {
731 731
 			$this->MAX_AGE = $age;
732 732
 		}
733 733
 
@@ -736,8 +736,8 @@  discard block
 block discarded – undo
736 736
 	/**
737 737
 	 * PHP4 constructor.
738 738
 	 */
739
-	public function RSSCache( $base = '', $age = '' ) {
740
-		self::__construct( $base, $age );
739
+	public function RSSCache($base = '', $age = '') {
740
+		self::__construct($base, $age);
741 741
 	}
742 742
 
743 743
 /*=======================================================================*\
@@ -746,8 +746,8 @@  discard block
 block discarded – undo
746 746
 	Input:		url from wich the rss file was fetched
747 747
 	Output:		true on success
748 748
 \*=======================================================================*/
749
-	function set ($url, $rss) {
750
-		$cache_option = 'rss_' . $this->file_name( $url );
749
+	function set($url, $rss) {
750
+		$cache_option = 'rss_'.$this->file_name($url);
751 751
 
752 752
 		set_transient($cache_option, $rss, $this->MAX_AGE);
753 753
 
@@ -760,11 +760,11 @@  discard block
 block discarded – undo
760 760
 	Input:		url from wich the rss file was fetched
761 761
 	Output:		cached object on HIT, false on MISS
762 762
 \*=======================================================================*/
763
-	function get ($url) {
763
+	function get($url) {
764 764
 		$this->ERROR = "";
765
-		$cache_option = 'rss_' . $this->file_name( $url );
765
+		$cache_option = 'rss_'.$this->file_name($url);
766 766
 
767
-		if ( ! $rss = get_transient( $cache_option ) ) {
767
+		if ( ! $rss = get_transient($cache_option)) {
768 768
 			$this->debug(
769 769
 				"Cache doesn't contain: $url (cache option: $cache_option)"
770 770
 			);
@@ -781,11 +781,11 @@  discard block
 block discarded – undo
781 781
 	Input:		url from wich the rss file was fetched
782 782
 	Output:		cached object on HIT, false on MISS
783 783
 \*=======================================================================*/
784
-	function check_cache ( $url ) {
784
+	function check_cache($url) {
785 785
 		$this->ERROR = "";
786
-		$cache_option = 'rss_' . $this->file_name( $url );
786
+		$cache_option = 'rss_'.$this->file_name($url);
787 787
 
788
-		if ( get_transient($cache_option) ) {
788
+		if (get_transient($cache_option)) {
789 789
 			// object exists and is current
790 790
 				return 'HIT';
791 791
 		} else {
@@ -797,15 +797,15 @@  discard block
 block discarded – undo
797 797
 /*=======================================================================*\
798 798
 	Function:	serialize
799 799
 \*=======================================================================*/
800
-	function serialize ( $rss ) {
801
-		return serialize( $rss );
800
+	function serialize($rss) {
801
+		return serialize($rss);
802 802
 	}
803 803
 
804 804
 /*=======================================================================*\
805 805
 	Function:	unserialize
806 806
 \*=======================================================================*/
807
-	function unserialize ( $data ) {
808
-		return unserialize( $data );
807
+	function unserialize($data) {
808
+		return unserialize($data);
809 809
 	}
810 810
 
811 811
 /*=======================================================================*\
@@ -814,64 +814,64 @@  discard block
 block discarded – undo
814 814
 	Input:		url from wich the rss file was fetched
815 815
 	Output:		a file name
816 816
 \*=======================================================================*/
817
-	function file_name ($url) {
818
-		return md5( $url );
817
+	function file_name($url) {
818
+		return md5($url);
819 819
 	}
820 820
 
821 821
 /*=======================================================================*\
822 822
 	Function:	error
823 823
 	Purpose:	register error
824 824
 \*=======================================================================*/
825
-	function error ($errormsg, $lvl=E_USER_WARNING) {
825
+	function error($errormsg, $lvl = E_USER_WARNING) {
826 826
 		// append PHP's error message if track_errors enabled
827
-		if ( isset($php_errormsg) ) {
827
+		if (isset($php_errormsg)) {
828 828
 			$errormsg .= " ($php_errormsg)";
829 829
 		}
830 830
 		$this->ERROR = $errormsg;
831
-		if ( MAGPIE_DEBUG ) {
832
-			trigger_error( $errormsg, $lvl);
831
+		if (MAGPIE_DEBUG) {
832
+			trigger_error($errormsg, $lvl);
833 833
 		}
834 834
 		else {
835
-			error_log( $errormsg, 0);
835
+			error_log($errormsg, 0);
836 836
 		}
837 837
 	}
838
-			function debug ($debugmsg, $lvl=E_USER_NOTICE) {
839
-		if ( MAGPIE_DEBUG ) {
838
+			function debug($debugmsg, $lvl = E_USER_NOTICE) {
839
+		if (MAGPIE_DEBUG) {
840 840
 			$this->error("MagpieRSS [debug] $debugmsg", $lvl);
841 841
 		}
842 842
 	}
843 843
 }
844 844
 
845
-if ( !function_exists('parse_w3cdtf') ) :
846
-function parse_w3cdtf ( $date_str ) {
845
+if ( ! function_exists('parse_w3cdtf')) :
846
+function parse_w3cdtf($date_str) {
847 847
 
848 848
 	# regex to match wc3dtf
849 849
 	$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
850 850
 
851
-	if ( preg_match( $pat, $date_str, $match ) ) {
852
-		list( $year, $month, $day, $hours, $minutes, $seconds) =
853
-			array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[7]);
851
+	if (preg_match($pat, $date_str, $match)) {
852
+		list($year, $month, $day, $hours, $minutes, $seconds) =
853
+			array($match[1], $match[2], $match[3], $match[4], $match[5], $match[7]);
854 854
 
855 855
 		# calc epoch for current date assuming GMT
856
-		$epoch = gmmktime( $hours, $minutes, $seconds, $month, $day, $year);
856
+		$epoch = gmmktime($hours, $minutes, $seconds, $month, $day, $year);
857 857
 
858 858
 		$offset = 0;
859
-		if ( $match[11] == 'Z' ) {
859
+		if ($match[11] == 'Z') {
860 860
 			# zulu time, aka GMT
861 861
 		}
862 862
 		else {
863
-			list( $tz_mod, $tz_hour, $tz_min ) =
864
-				array( $match[8], $match[9], $match[10]);
863
+			list($tz_mod, $tz_hour, $tz_min) =
864
+				array($match[8], $match[9], $match[10]);
865 865
 
866 866
 			# zero out the variables
867
-			if ( ! $tz_hour ) { $tz_hour = 0; }
868
-			if ( ! $tz_min ) { $tz_min = 0; }
867
+			if ( ! $tz_hour) { $tz_hour = 0; }
868
+			if ( ! $tz_min) { $tz_min = 0; }
869 869
 
870
-			$offset_secs = (($tz_hour*60)+$tz_min)*60;
870
+			$offset_secs = (($tz_hour * 60) + $tz_min) * 60;
871 871
 
872 872
 			# is timezone ahead of GMT?  then subtract offset
873 873
 			#
874
-			if ( $tz_mod == '+' ) {
874
+			if ($tz_mod == '+') {
875 875
 				$offset_secs = $offset_secs * -1;
876 876
 			}
877 877
 
@@ -886,7 +886,7 @@  discard block
 block discarded – undo
886 886
 }
887 887
 endif;
888 888
 
889
-if ( !function_exists('wp_rss') ) :
889
+if ( ! function_exists('wp_rss')) :
890 890
 /**
891 891
  * Display all RSS items in a HTML ordered list.
892 892
  *
@@ -897,31 +897,31 @@  discard block
 block discarded – undo
897 897
  * @param string $url URL of feed to display. Will not auto sense feed URL.
898 898
  * @param int $num_items Optional. Number of items to display, default is all.
899 899
  */
900
-function wp_rss( $url, $num_items = -1 ) {
901
-	if ( $rss = fetch_rss( $url ) ) {
900
+function wp_rss($url, $num_items = -1) {
901
+	if ($rss = fetch_rss($url)) {
902 902
 		echo '<ul>';
903 903
 
904
-		if ( $num_items !== -1 ) {
905
-			$rss->items = array_slice( $rss->items, 0, $num_items );
904
+		if ($num_items !== -1) {
905
+			$rss->items = array_slice($rss->items, 0, $num_items);
906 906
 		}
907 907
 
908
-		foreach ( (array) $rss->items as $item ) {
908
+		foreach ((array) $rss->items as $item) {
909 909
 			printf(
910 910
 				'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
911
-				esc_url( $item['link'] ),
912
-				esc_attr( strip_tags( $item['description'] ) ),
913
-				esc_html( $item['title'] )
911
+				esc_url($item['link']),
912
+				esc_attr(strip_tags($item['description'])),
913
+				esc_html($item['title'])
914 914
 			);
915 915
 		}
916 916
 
917 917
 		echo '</ul>';
918 918
 	} else {
919
-		_e( 'An error has occurred, which probably means the feed is down. Try again later.' );
919
+		_e('An error has occurred, which probably means the feed is down. Try again later.');
920 920
 	}
921 921
 }
922 922
 endif;
923 923
 
924
-if ( !function_exists('get_rss') ) :
924
+if ( ! function_exists('get_rss')) :
925 925
 /**
926 926
  * Display RSS items in HTML list items.
927 927
  *
@@ -938,11 +938,11 @@  discard block
 block discarded – undo
938 938
  * @param int $num_items Optional. Number of items to display, default is all.
939 939
  * @return bool False on failure.
940 940
  */
941
-function get_rss ($url, $num_items = 5) { // Like get posts, but for RSS
941
+function get_rss($url, $num_items = 5) { // Like get posts, but for RSS
942 942
 	$rss = fetch_rss($url);
943
-	if ( $rss ) {
943
+	if ($rss) {
944 944
 		$rss->items = array_slice($rss->items, 0, $num_items);
945
-		foreach ( (array) $rss->items as $item ) {
945
+		foreach ((array) $rss->items as $item) {
946 946
 			echo "<li>\n";
947 947
 			echo "<a href='$item[link]' title='$item[description]'>";
948 948
 			echo esc_html($item['title']);
Please login to merge, or discard this patch.
Braces   +56 added lines, -85 removed lines patch added patch discarded remove patch
@@ -62,13 +62,15 @@  discard block
 block discarded – undo
62 62
 
63 63
 		# if PHP xml isn't compiled in, die
64 64
 		#
65
-		if ( !function_exists('xml_parser_create') )
66
-			trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
65
+		if ( !function_exists('xml_parser_create') ) {
66
+					trigger_error( "Failed to load PHP's XML Extension. http://www.php.net/manual/en/ref.xml.php" );
67
+		}
67 68
 
68 69
 		$parser = @xml_parser_create();
69 70
 
70
-		if ( !is_resource($parser) )
71
-			trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
71
+		if ( !is_resource($parser) ) {
72
+					trigger_error( "Failed to create an instance of PHP's XML parser. http://www.php.net/manual/en/ref.xml.php");
73
+		}
72 74
 
73 75
 		$this->parser = $parser;
74 76
 
@@ -127,12 +129,10 @@  discard block
 block discarded – undo
127 129
 			if ( $el == 'rdf' ) {
128 130
 				$this->feed_type = RSS;
129 131
 				$this->feed_version = '1.0';
130
-			}
131
-			elseif ( $el == 'rss' ) {
132
+			} elseif ( $el == 'rss' ) {
132 133
 				$this->feed_type = RSS;
133 134
 				$this->feed_version = $attrs['version'];
134
-			}
135
-			elseif ( $el == 'feed' ) {
135
+			} elseif ( $el == 'feed' ) {
136 136
 				$this->feed_type = ATOM;
137 137
 				$this->feed_version = $attrs['version'];
138 138
 				$this->inchannel = true;
@@ -143,8 +143,7 @@  discard block
 block discarded – undo
143 143
 		if ( $el == 'channel' )
144 144
 		{
145 145
 			$this->inchannel = true;
146
-		}
147
-		elseif ($el == 'item' or $el == 'entry' )
146
+		} elseif ($el == 'item' or $el == 'entry' )
148 147
 		{
149 148
 			$this->initem = true;
150 149
 			if ( isset($attrs['rdf:about']) ) {
@@ -160,9 +159,7 @@  discard block
 block discarded – undo
160 159
 			$el == 'textinput' )
161 160
 		{
162 161
 			$this->intextinput = true;
163
-		}
164
-
165
-		elseif (
162
+		} elseif (
166 163
 			$this->feed_type == RSS and
167 164
 			$this->current_namespace == '' and
168 165
 			$el == 'image' )
@@ -205,8 +202,7 @@  discard block
 block discarded – undo
205 202
 			if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
206 203
 			{
207 204
 				$link_el = 'link';
208
-			}
209
-			else {
205
+			} else {
210 206
 				$link_el = 'link_' . $attrs['rel'];
211 207
 			}
212 208
 
@@ -223,8 +219,7 @@  discard block
 block discarded – undo
223 219
 		if ($this->feed_type == ATOM and $this->incontent)
224 220
 		{
225 221
 			$this->append_content( $text );
226
-		}
227
-		else {
222
+		} else {
228 223
 			$current_el = join('_', array_reverse($this->stack));
229 224
 			$this->append($current_el, $text);
230 225
 		}
@@ -238,37 +233,30 @@  discard block
 block discarded – undo
238 233
 			$this->items[] = $this->current_item;
239 234
 			$this->current_item = array();
240 235
 			$this->initem = false;
241
-		}
242
-		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
236
+		} elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
243 237
 		{
244 238
 			$this->intextinput = false;
245
-		}
246
-		elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
239
+		} elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
247 240
 		{
248 241
 			$this->inimage = false;
249
-		}
250
-		elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
242
+		} elseif ($this->feed_type == ATOM and in_array($el, $this->_CONTENT_CONSTRUCTS) )
251 243
 		{
252 244
 			$this->incontent = false;
253
-		}
254
-		elseif ($el == 'channel' or $el == 'feed' )
245
+		} elseif ($el == 'channel' or $el == 'feed' )
255 246
 		{
256 247
 			$this->inchannel = false;
257
-		}
258
-		elseif ($this->feed_type == ATOM and $this->incontent  ) {
248
+		} elseif ($this->feed_type == ATOM and $this->incontent  ) {
259 249
 			// balance tags properly
260 250
 			// note: This may not actually be necessary
261 251
 			if ( $this->stack[0] == $el )
262 252
 			{
263 253
 				$this->append_content("</$el>");
264
-			}
265
-			else {
254
+			} else {
266 255
 				$this->append_content("<$el />");
267 256
 			}
268 257
 
269 258
 			array_shift( $this->stack );
270
-		}
271
-		else {
259
+		} else {
272 260
 			array_shift( $this->stack );
273 261
 		}
274 262
 
@@ -285,8 +273,7 @@  discard block
 block discarded – undo
285 273
 	function append_content($text) {
286 274
 		if ( $this->initem ) {
287 275
 			$this->concat( $this->current_item[ $this->incontent ], $text );
288
-		}
289
-		elseif ( $this->inchannel ) {
276
+		} elseif ( $this->inchannel ) {
290 277
 			$this->concat( $this->channel[ $this->incontent ], $text );
291 278
 		}
292 279
 	}
@@ -301,34 +288,27 @@  discard block
 block discarded – undo
301 288
 			if ( $this->initem ) {
302 289
 				$this->concat(
303 290
 					$this->current_item[ $this->current_namespace ][ $el ], $text);
304
-			}
305
-			elseif ($this->inchannel) {
291
+			} elseif ($this->inchannel) {
306 292
 				$this->concat(
307 293
 					$this->channel[ $this->current_namespace][ $el ], $text );
308
-			}
309
-			elseif ($this->intextinput) {
294
+			} elseif ($this->intextinput) {
310 295
 				$this->concat(
311 296
 					$this->textinput[ $this->current_namespace][ $el ], $text );
312
-			}
313
-			elseif ($this->inimage) {
297
+			} elseif ($this->inimage) {
314 298
 				$this->concat(
315 299
 					$this->image[ $this->current_namespace ][ $el ], $text );
316 300
 			}
317
-		}
318
-		else {
301
+		} else {
319 302
 			if ( $this->initem ) {
320 303
 				$this->concat(
321 304
 					$this->current_item[ $el ], $text);
322
-			}
323
-			elseif ($this->intextinput) {
305
+			} elseif ($this->intextinput) {
324 306
 				$this->concat(
325 307
 					$this->textinput[ $el ], $text );
326
-			}
327
-			elseif ($this->inimage) {
308
+			} elseif ($this->inimage) {
328 309
 				$this->concat(
329 310
 					$this->image[ $el ], $text );
330
-			}
331
-			elseif ($this->inchannel) {
311
+			} elseif ($this->inchannel) {
332 312
 				$this->concat(
333 313
 					$this->channel[ $el ], $text );
334 314
 			}
@@ -342,22 +322,25 @@  discard block
 block discarded – undo
342 322
 			$this->channel['descripton'] = $this->channel['tagline'];
343 323
 			for ( $i = 0; $i < count($this->items); $i++) {
344 324
 				$item = $this->items[$i];
345
-				if ( isset($item['summary']) )
346
-					$item['description'] = $item['summary'];
347
-				if ( isset($item['atom_content']))
348
-					$item['content']['encoded'] = $item['atom_content'];
325
+				if ( isset($item['summary']) ) {
326
+									$item['description'] = $item['summary'];
327
+				}
328
+				if ( isset($item['atom_content'])) {
329
+									$item['content']['encoded'] = $item['atom_content'];
330
+				}
349 331
 
350 332
 				$this->items[$i] = $item;
351 333
 			}
352
-		}
353
-		elseif ( $this->is_rss() ) {
334
+		} elseif ( $this->is_rss() ) {
354 335
 			$this->channel['tagline'] = $this->channel['description'];
355 336
 			for ( $i = 0; $i < count($this->items); $i++) {
356 337
 				$item = $this->items[$i];
357
-				if ( isset($item['description']))
358
-					$item['summary'] = $item['description'];
359
-				if ( isset($item['content']['encoded'] ) )
360
-					$item['atom_content'] = $item['content']['encoded'];
338
+				if ( isset($item['description'])) {
339
+									$item['summary'] = $item['description'];
340
+				}
341
+				if ( isset($item['content']['encoded'] ) ) {
342
+									$item['atom_content'] = $item['content']['encoded'];
343
+				}
361 344
 
362 345
 				$this->items[$i] = $item;
363 346
 			}
@@ -367,8 +350,7 @@  discard block
 block discarded – undo
367 350
 	function is_rss () {
368 351
 		if ( $this->feed_type == RSS ) {
369 352
 			return $this->feed_version;
370
-		}
371
-		else {
353
+		} else {
372 354
 			return false;
373 355
 		}
374 356
 	}
@@ -376,8 +358,7 @@  discard block
 block discarded – undo
376 358
 	function is_atom() {
377 359
 		if ( $this->feed_type == ATOM ) {
378 360
 			return $this->feed_version;
379
-		}
380
-		else {
361
+		} else {
381 362
 			return false;
382 363
 		}
383 364
 	}
@@ -426,8 +407,7 @@  discard block
 block discarded – undo
426 407
 		$resp = _fetch_remote_file( $url );
427 408
 		if ( is_success( $resp->status ) ) {
428 409
 			return _response_to_rss( $resp );
429
-		}
430
-		else {
410
+		} else {
431 411
 			// error("Failed to fetch $url and cache is off");
432 412
 			return false;
433 413
 		}
@@ -490,8 +470,7 @@  discard block
 block discarded – undo
490 470
 				// reset cache on 304 (at minutillo insistent prodding)
491 471
 				$cache->set($url, $rss);
492 472
 				return $rss;
493
-			}
494
-			elseif ( is_success( $resp->status ) ) {
473
+			} elseif ( is_success( $resp->status ) ) {
495 474
 				$rss = _response_to_rss( $resp );
496 475
 				if ( $rss ) {
497 476
 					if (MAGPIE_DEBUG > 1) {
@@ -501,21 +480,18 @@  discard block
 block discarded – undo
501 480
 					$cache->set( $url, $rss );
502 481
 					return $rss;
503 482
 				}
504
-			}
505
-			else {
483
+			} else {
506 484
 				$errormsg = "Failed to fetch $url. ";
507 485
 				if ( $resp->error ) {
508 486
 					# compensate for Snoopy's annoying habbit to tacking
509 487
 					# on '\n'
510 488
 					$http_error = substr($resp->error, 0, -2);
511 489
 					$errormsg .= "(HTTP Error: $http_error)";
512
-				}
513
-				else {
490
+				} else {
514 491
 					$errormsg .=  "(HTTP Response: " . $resp->response_code .')';
515 492
 				}
516 493
 			}
517
-		}
518
-		else {
494
+		} else {
519 495
 			$errormsg = "Unable to retrieve RSS file for unknown reasons.";
520 496
 		}
521 497
 
@@ -568,8 +544,9 @@  discard block
 block discarded – undo
568 544
 		if ( !is_array($value) ) {
569 545
 			$return_headers[] = "$key: $value";
570 546
 		} else {
571
-			foreach ( $value as $v )
572
-				$return_headers[] = "$key: $v";
547
+			foreach ( $value as $v ) {
548
+							$return_headers[] = "$key: $v";
549
+			}
573 550
 		}
574 551
 	}
575 552
 
@@ -603,8 +580,7 @@  discard block
 block discarded – undo
603 580
 			// 2003-03-02 - Nicola Asuni (www.tecnick.com) - fixed bug "Undefined offset: 1"
604 581
 			if (strpos($h, ": ")) {
605 582
 				list($field, $val) = explode(": ", $h, 2);
606
-			}
607
-			else {
583
+			} else {
608 584
 				$field = $h;
609 585
 				$val = "";
610 586
 			}
@@ -642,8 +618,7 @@  discard block
 block discarded – undo
642 618
 function init () {
643 619
 	if ( defined('MAGPIE_INITALIZED') ) {
644 620
 		return;
645
-	}
646
-	else {
621
+	} else {
647 622
 		define('MAGPIE_INITALIZED', 1);
648 623
 	}
649 624
 
@@ -672,8 +647,7 @@  discard block
 block discarded – undo
672 647
 
673 648
 		if ( MAGPIE_CACHE_ON ) {
674 649
 			$ua = $ua . ')';
675
-		}
676
-		else {
650
+		} else {
677 651
 			$ua = $ua . '; No cache)';
678 652
 		}
679 653
 
@@ -830,8 +804,7 @@  discard block
 block discarded – undo
830 804
 		$this->ERROR = $errormsg;
831 805
 		if ( MAGPIE_DEBUG ) {
832 806
 			trigger_error( $errormsg, $lvl);
833
-		}
834
-		else {
807
+		} else {
835 808
 			error_log( $errormsg, 0);
836 809
 		}
837 810
 	}
@@ -858,8 +831,7 @@  discard block
 block discarded – undo
858 831
 		$offset = 0;
859 832
 		if ( $match[11] == 'Z' ) {
860 833
 			# zulu time, aka GMT
861
-		}
862
-		else {
834
+		} else {
863 835
 			list( $tz_mod, $tz_hour, $tz_min ) =
864 836
 				array( $match[8], $match[9], $match[10]);
865 837
 
@@ -879,8 +851,7 @@  discard block
 block discarded – undo
879 851
 		}
880 852
 		$epoch = $epoch + $offset;
881 853
 		return $epoch;
882
-	}
883
-	else {
854
+	} else {
884 855
 		return -1;
885 856
 	}
886 857
 }
Please login to merge, or discard this patch.
src/wp-includes/shortcodes.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -283,7 +283,7 @@  discard block
 block discarded – undo
283 283
  *
284 284
  * @global array $shortcode_tags
285 285
  *
286
- * @param array $m Regular expression match array
286
+ * @param string[] $m Regular expression match array
287 287
  * @return string|false False on failure.
288 288
  */
289 289
 function do_shortcode_tag( $m ) {
@@ -546,7 +546,7 @@  discard block
 block discarded – undo
546 546
 /**
547 547
  *
548 548
  * @param array $m
549
- * @return string|false
549
+ * @return string
550 550
  */
551 551
 function strip_shortcode_tag( $m ) {
552 552
 	// allow [[foo]] syntax for escaping a tag
Please login to merge, or discard this patch.
Indentation   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -1,34 +1,34 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress API for creating bbcode like tags or what WordPress calls
4
- * "shortcodes." The tag and attribute parsing or regular expression code is
5
- * based on the Textpattern tag parser.
6
- *
7
- * A few examples are below:
8
- *
9
- * [shortcode /]
10
- * [shortcode foo="bar" baz="bing" /]
11
- * [shortcode foo="bar"]content[/shortcode]
12
- *
13
- * Shortcode tags support attributes and enclosed content, but does not entirely
14
- * support inline shortcodes in other shortcodes. You will have to call the
15
- * shortcode parser in your function to account for that.
16
- *
17
- * {@internal
18
- * Please be aware that the above note was made during the beta of WordPress 2.6
19
- * and in the future may not be accurate. Please update the note when it is no
20
- * longer the case.}}
21
- *
22
- * To apply shortcode tags to content:
23
- *
24
- *     $out = do_shortcode( $content );
25
- *
26
- * @link https://codex.wordpress.org/Shortcode_API
27
- *
28
- * @package WordPress
29
- * @subpackage Shortcodes
30
- * @since 2.5.0
31
- */
3
+	 * WordPress API for creating bbcode like tags or what WordPress calls
4
+	 * "shortcodes." The tag and attribute parsing or regular expression code is
5
+	 * based on the Textpattern tag parser.
6
+	 *
7
+	 * A few examples are below:
8
+	 *
9
+	 * [shortcode /]
10
+	 * [shortcode foo="bar" baz="bing" /]
11
+	 * [shortcode foo="bar"]content[/shortcode]
12
+	 *
13
+	 * Shortcode tags support attributes and enclosed content, but does not entirely
14
+	 * support inline shortcodes in other shortcodes. You will have to call the
15
+	 * shortcode parser in your function to account for that.
16
+	 *
17
+	 * {@internal
18
+	 * Please be aware that the above note was made during the beta of WordPress 2.6
19
+	 * and in the future may not be accurate. Please update the note when it is no
20
+	 * longer the case.}}
21
+	 *
22
+	 * To apply shortcode tags to content:
23
+	 *
24
+	 *     $out = do_shortcode( $content );
25
+	 *
26
+	 * @link https://codex.wordpress.org/Shortcode_API
27
+	 *
28
+	 * @package WordPress
29
+	 * @subpackage Shortcodes
30
+	 * @since 2.5.0
31
+	 */
32 32
 
33 33
 /**
34 34
  * Container for storing shortcode tags and their hook to call for the shortcode
@@ -426,11 +426,11 @@  discard block
 block discarded – undo
426 426
  * @return string Content with placeholders removed.
427 427
  */
428 428
 function unescape_invalid_shortcodes( $content ) {
429
-        // Clean up entire string, avoids re-parsing HTML.
430
-        $trans = array( '&#91;' => '[', '&#93;' => ']' );
431
-        $content = strtr( $content, $trans );
429
+		// Clean up entire string, avoids re-parsing HTML.
430
+		$trans = array( '&#91;' => '[', '&#93;' => ']' );
431
+		$content = strtr( $content, $trans );
432 432
 
433
-        return $content;
433
+		return $content;
434 434
 }
435 435
 
436 436
 /**
Please login to merge, or discard this patch.
Spacing   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -88,7 +88,7 @@  discard block
 block discarded – undo
88 88
  */
89 89
 function add_shortcode($tag, $func) {
90 90
 	global $shortcode_tags;
91
-	$shortcode_tags[ $tag ] = $func;
91
+	$shortcode_tags[$tag] = $func;
92 92
 }
93 93
 
94 94
 /**
@@ -133,9 +133,9 @@  discard block
 block discarded – undo
133 133
  * @param string $tag Shortcode tag to check.
134 134
  * @return bool Whether the given shortcode exists.
135 135
  */
136
-function shortcode_exists( $tag ) {
136
+function shortcode_exists($tag) {
137 137
 	global $shortcode_tags;
138
-	return array_key_exists( $tag, $shortcode_tags );
138
+	return array_key_exists($tag, $shortcode_tags);
139 139
 }
140 140
 
141 141
 /**
@@ -149,20 +149,20 @@  discard block
 block discarded – undo
149 149
  * @param string $tag     Shortcode tag to check.
150 150
  * @return bool Whether the passed content contains the given shortcode.
151 151
  */
152
-function has_shortcode( $content, $tag ) {
153
-	if ( false === strpos( $content, '[' ) ) {
152
+function has_shortcode($content, $tag) {
153
+	if (false === strpos($content, '[')) {
154 154
 		return false;
155 155
 	}
156 156
 
157
-	if ( shortcode_exists( $tag ) ) {
158
-		preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
159
-		if ( empty( $matches ) )
157
+	if (shortcode_exists($tag)) {
158
+		preg_match_all('/'.get_shortcode_regex().'/s', $content, $matches, PREG_SET_ORDER);
159
+		if (empty($matches))
160 160
 			return false;
161 161
 
162
-		foreach ( $matches as $shortcode ) {
163
-			if ( $tag === $shortcode[2] ) {
162
+		foreach ($matches as $shortcode) {
163
+			if ($tag === $shortcode[2]) {
164 164
 				return true;
165
-			} elseif ( ! empty( $shortcode[5] ) && has_shortcode( $shortcode[5], $tag ) ) {
165
+			} elseif ( ! empty($shortcode[5]) && has_shortcode($shortcode[5], $tag)) {
166 166
 				return true;
167 167
 			}
168 168
 		}
@@ -185,32 +185,32 @@  discard block
 block discarded – undo
185 185
  * @param bool $ignore_html When true, shortcodes inside HTML elements will be skipped.
186 186
  * @return string Content with shortcodes filtered out.
187 187
  */
188
-function do_shortcode( $content, $ignore_html = false ) {
188
+function do_shortcode($content, $ignore_html = false) {
189 189
 	global $shortcode_tags;
190 190
 
191
-	if ( false === strpos( $content, '[' ) ) {
191
+	if (false === strpos($content, '[')) {
192 192
 		return $content;
193 193
 	}
194 194
 
195
-	if (empty($shortcode_tags) || !is_array($shortcode_tags))
195
+	if (empty($shortcode_tags) || ! is_array($shortcode_tags))
196 196
 		return $content;
197 197
 
198 198
 	$tagnames = array_keys($shortcode_tags);
199
-	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
199
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
200 200
 	$pattern = "/\\[($tagregexp)/s";
201 201
 
202
-	if ( 1 !== preg_match( $pattern, $content ) ) {
202
+	if (1 !== preg_match($pattern, $content)) {
203 203
 		// Avoids parsing HTML when there are no shortcodes or embeds anyway.
204 204
 		return $content;
205 205
 	}
206 206
 
207
-	$content = do_shortcodes_in_html_tags( $content, $ignore_html );
207
+	$content = do_shortcodes_in_html_tags($content, $ignore_html);
208 208
 
209 209
 	$pattern = get_shortcode_regex();
210
-	$content = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $content );
210
+	$content = preg_replace_callback("/$pattern/s", 'do_shortcode_tag', $content);
211 211
 
212 212
 	// Always restore square braces so we don't break things like <!--[if IE ]>
213
-	$content = unescape_invalid_shortcodes( $content );
213
+	$content = unescape_invalid_shortcodes($content);
214 214
 
215 215
 	return $content;
216 216
 }
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 function get_shortcode_regex() {
240 240
 	global $shortcode_tags;
241 241
 	$tagnames = array_keys($shortcode_tags);
242
-	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
242
+	$tagregexp = join('|', array_map('preg_quote', $tagnames));
243 243
 
244 244
 	// WARNING! Do not change this regex without changing do_shortcode_tag() and strip_shortcode_tag()
245 245
 	// Also, see shortcode_unautop() and shortcode.js.
@@ -271,7 +271,7 @@  discard block
 block discarded – undo
271 271
 		.         '\\[\\/\\2\\]'             // Closing shortcode tag
272 272
 		.     ')?'
273 273
 		. ')'
274
-		. '(\\]?)';                          // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
274
+		. '(\\]?)'; // 6: Optional second closing brocket for escaping shortcodes: [[tag]]
275 275
 }
276 276
 
277 277
 /**
@@ -286,29 +286,29 @@  discard block
 block discarded – undo
286 286
  * @param array $m Regular expression match array
287 287
  * @return string|false False on failure.
288 288
  */
289
-function do_shortcode_tag( $m ) {
289
+function do_shortcode_tag($m) {
290 290
 	global $shortcode_tags;
291 291
 
292 292
 	// allow [[foo]] syntax for escaping a tag
293
-	if ( $m[1] == '[' && $m[6] == ']' ) {
293
+	if ($m[1] == '[' && $m[6] == ']') {
294 294
 		return substr($m[0], 1, -1);
295 295
 	}
296 296
 
297 297
 	$tag = $m[2];
298
-	$attr = shortcode_parse_atts( $m[3] );
298
+	$attr = shortcode_parse_atts($m[3]);
299 299
 
300
-	if ( ! is_callable( $shortcode_tags[ $tag ] ) ) {
301
-		$message = sprintf( __( 'Attempting to parse a shortcode without a valid callback: %s' ), $tag );
302
-		_doing_it_wrong( __FUNCTION__, $message, '4.3.0' );
300
+	if ( ! is_callable($shortcode_tags[$tag])) {
301
+		$message = sprintf(__('Attempting to parse a shortcode without a valid callback: %s'), $tag);
302
+		_doing_it_wrong(__FUNCTION__, $message, '4.3.0');
303 303
 		return $m[0];
304 304
 	}
305 305
 
306
-	if ( isset( $m[5] ) ) {
306
+	if (isset($m[5])) {
307 307
 		// enclosing tag - extra parameter
308
-		return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, $m[5], $tag ) . $m[6];
308
+		return $m[1].call_user_func($shortcode_tags[$tag], $attr, $m[5], $tag).$m[6];
309 309
 	} else {
310 310
 		// self-closing tag
311
-		return $m[1] . call_user_func( $shortcode_tags[$tag], $attr, null,  $tag ) . $m[6];
311
+		return $m[1].call_user_func($shortcode_tags[$tag], $attr, null, $tag).$m[6];
312 312
 	}
313 313
 }
314 314
 
@@ -326,93 +326,93 @@  discard block
 block discarded – undo
326 326
  * @param bool $ignore_html When true, all square braces inside elements will be encoded.
327 327
  * @return string Content with shortcodes filtered out.
328 328
  */
329
-function do_shortcodes_in_html_tags( $content, $ignore_html ) {
329
+function do_shortcodes_in_html_tags($content, $ignore_html) {
330 330
 	// Normalize entities in unfiltered HTML before adding placeholders.
331
-	$trans = array( '&#91;' => '&#091;', '&#93;' => '&#093;' );
332
-	$content = strtr( $content, $trans );
333
-	$trans = array( '[' => '&#91;', ']' => '&#93;' );
331
+	$trans = array('&#91;' => '&#091;', '&#93;' => '&#093;');
332
+	$content = strtr($content, $trans);
333
+	$trans = array('[' => '&#91;', ']' => '&#93;');
334 334
 
335 335
 	$pattern = get_shortcode_regex();
336
-	$textarr = wp_html_split( $content );
336
+	$textarr = wp_html_split($content);
337 337
 
338
-	foreach ( $textarr as &$element ) {
339
-		if ( '' == $element || '<' !== $element[0] ) {
338
+	foreach ($textarr as &$element) {
339
+		if ('' == $element || '<' !== $element[0]) {
340 340
 			continue;
341 341
 		}
342 342
 
343
-		$noopen = false === strpos( $element, '[' );
344
-		$noclose = false === strpos( $element, ']' );
345
-		if ( $noopen || $noclose ) {
343
+		$noopen = false === strpos($element, '[');
344
+		$noclose = false === strpos($element, ']');
345
+		if ($noopen || $noclose) {
346 346
 			// This element does not contain shortcodes.
347
-			if ( $noopen xor $noclose ) {
347
+			if ($noopen xor $noclose) {
348 348
 				// Need to encode stray [ or ] chars.
349
-				$element = strtr( $element, $trans );
349
+				$element = strtr($element, $trans);
350 350
 			}
351 351
 			continue;
352 352
 		}
353 353
 
354
-		if ( $ignore_html || '<!--' === substr( $element, 0, 4 ) || '<![CDATA[' === substr( $element, 0, 9 ) ) {
354
+		if ($ignore_html || '<!--' === substr($element, 0, 4) || '<![CDATA[' === substr($element, 0, 9)) {
355 355
 			// Encode all [ and ] chars.
356
-			$element = strtr( $element, $trans );
356
+			$element = strtr($element, $trans);
357 357
 			continue;
358 358
 		}
359 359
 
360
-		$attributes = wp_kses_attr_parse( $element );
361
-		if ( false === $attributes ) {
360
+		$attributes = wp_kses_attr_parse($element);
361
+		if (false === $attributes) {
362 362
 			// Some plugins are doing things like [name] <[email]>.
363
-			if ( 1 === preg_match( '%^<\s*\[\[?[^\[\]]+\]%', $element ) ) {
364
-				$element = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $element );
363
+			if (1 === preg_match('%^<\s*\[\[?[^\[\]]+\]%', $element)) {
364
+				$element = preg_replace_callback("/$pattern/s", 'do_shortcode_tag', $element);
365 365
 			}
366 366
 
367 367
 			// Looks like we found some crazy unfiltered HTML.  Skipping it for sanity.
368
-			$element = strtr( $element, $trans );
368
+			$element = strtr($element, $trans);
369 369
 			continue;
370 370
 		}
371 371
 
372 372
 		// Get element name
373
-		$front = array_shift( $attributes );
374
-		$back = array_pop( $attributes );
373
+		$front = array_shift($attributes);
374
+		$back = array_pop($attributes);
375 375
 		$matches = array();
376 376
 		preg_match('%[a-zA-Z0-9]+%', $front, $matches);
377 377
 		$elname = $matches[0];
378 378
 
379 379
 		// Look for shortcodes in each attribute separately.
380
-		foreach ( $attributes as &$attr ) {
381
-			$open = strpos( $attr, '[' );
382
-			$close = strpos( $attr, ']' );
383
-			if ( false === $open || false === $close ) {
380
+		foreach ($attributes as &$attr) {
381
+			$open = strpos($attr, '[');
382
+			$close = strpos($attr, ']');
383
+			if (false === $open || false === $close) {
384 384
 				continue; // Go to next attribute.  Square braces will be escaped at end of loop.
385 385
 			}
386
-			$double = strpos( $attr, '"' );
387
-			$single = strpos( $attr, "'" );
388
-			if ( ( false === $single || $open < $single ) && ( false === $double || $open < $double ) ) {
386
+			$double = strpos($attr, '"');
387
+			$single = strpos($attr, "'");
388
+			if ((false === $single || $open < $single) && (false === $double || $open < $double)) {
389 389
 				// $attr like '[shortcode]' or 'name = [shortcode]' implies unfiltered_html.
390 390
 				// In this specific situation we assume KSES did not run because the input
391 391
 				// was written by an administrator, so we should avoid changing the output
392 392
 				// and we do not need to run KSES here.
393
-				$attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr );
393
+				$attr = preg_replace_callback("/$pattern/s", 'do_shortcode_tag', $attr);
394 394
 			} else {
395 395
 				// $attr like 'name = "[shortcode]"' or "name = '[shortcode]'"
396 396
 				// We do not know if $content was unfiltered. Assume KSES ran before shortcodes.
397 397
 				$count = 0;
398
-				$new_attr = preg_replace_callback( "/$pattern/s", 'do_shortcode_tag', $attr, -1, $count );
399
-				if ( $count > 0 ) {
398
+				$new_attr = preg_replace_callback("/$pattern/s", 'do_shortcode_tag', $attr, -1, $count);
399
+				if ($count > 0) {
400 400
 					// Sanitize the shortcode output using KSES.
401
-					$new_attr = wp_kses_one_attr( $new_attr, $elname );
402
-					if ( '' !== trim( $new_attr ) ) {
401
+					$new_attr = wp_kses_one_attr($new_attr, $elname);
402
+					if ('' !== trim($new_attr)) {
403 403
 						// The shortcode is safe to use now.
404 404
 						$attr = $new_attr;
405 405
 					}
406 406
 				}
407 407
 			}
408 408
 		}
409
-		$element = $front . implode( '', $attributes ) . $back;
409
+		$element = $front.implode('', $attributes).$back;
410 410
 
411 411
 		// Now encode any remaining [ or ] chars.
412
-		$element = strtr( $element, $trans );
412
+		$element = strtr($element, $trans);
413 413
 	}
414 414
 
415
-	$content = implode( '', $textarr );
415
+	$content = implode('', $textarr);
416 416
 
417 417
 	return $content;
418 418
 }
@@ -425,10 +425,10 @@  discard block
 block discarded – undo
425 425
  * @param string $content Content to search for placeholders.
426 426
  * @return string Content with placeholders removed.
427 427
  */
428
-function unescape_invalid_shortcodes( $content ) {
428
+function unescape_invalid_shortcodes($content) {
429 429
         // Clean up entire string, avoids re-parsing HTML.
430
-        $trans = array( '&#91;' => '[', '&#93;' => ']' );
431
-        $content = strtr( $content, $trans );
430
+        $trans = array('&#91;' => '[', '&#93;' => ']');
431
+        $content = strtr($content, $trans);
432 432
 
433 433
         return $content;
434 434
 }
@@ -449,13 +449,13 @@  discard block
 block discarded – undo
449 449
 	$atts = array();
450 450
 	$pattern = '/([\w-]+)\s*=\s*"([^"]*)"(?:\s|$)|([\w-]+)\s*=\s*\'([^\']*)\'(?:\s|$)|([\w-]+)\s*=\s*([^\s\'"]+)(?:\s|$)|"([^"]*)"(?:\s|$)|(\S+)(?:\s|$)/';
451 451
 	$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
452
-	if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
452
+	if (preg_match_all($pattern, $text, $match, PREG_SET_ORDER)) {
453 453
 		foreach ($match as $m) {
454
-			if (!empty($m[1]))
454
+			if ( ! empty($m[1]))
455 455
 				$atts[strtolower($m[1])] = stripcslashes($m[2]);
456
-			elseif (!empty($m[3]))
456
+			elseif ( ! empty($m[3]))
457 457
 				$atts[strtolower($m[3])] = stripcslashes($m[4]);
458
-			elseif (!empty($m[5]))
458
+			elseif ( ! empty($m[5]))
459 459
 				$atts[strtolower($m[5])] = stripcslashes($m[6]);
460 460
 			elseif (isset($m[7]) && strlen($m[7]))
461 461
 				$atts[] = stripcslashes($m[7]);
@@ -485,11 +485,11 @@  discard block
 block discarded – undo
485 485
  * @param string $shortcode Optional. The name of the shortcode, provided for context to enable filtering
486 486
  * @return array Combined and filtered attribute list.
487 487
  */
488
-function shortcode_atts( $pairs, $atts, $shortcode = '' ) {
489
-	$atts = (array)$atts;
488
+function shortcode_atts($pairs, $atts, $shortcode = '') {
489
+	$atts = (array) $atts;
490 490
 	$out = array();
491
-	foreach($pairs as $name => $default) {
492
-		if ( array_key_exists($name, $atts) )
491
+	foreach ($pairs as $name => $default) {
492
+		if (array_key_exists($name, $atts))
493 493
 			$out[$name] = $atts[$name];
494 494
 		else
495 495
 			$out[$name] = $default;
@@ -506,8 +506,8 @@  discard block
 block discarded – undo
506 506
 	 * @param array $pairs The supported attributes and their defaults.
507 507
 	 * @param array $atts  The user defined shortcode attributes.
508 508
 	 */
509
-	if ( $shortcode )
510
-		$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
509
+	if ($shortcode)
510
+		$out = apply_filters("shortcode_atts_{$shortcode}", $out, $pairs, $atts);
511 511
 
512 512
 	return $out;
513 513
 }
@@ -522,23 +522,23 @@  discard block
 block discarded – undo
522 522
  * @param string $content Content to remove shortcode tags.
523 523
  * @return string Content without shortcode tags.
524 524
  */
525
-function strip_shortcodes( $content ) {
525
+function strip_shortcodes($content) {
526 526
 	global $shortcode_tags;
527 527
 
528
-	if ( false === strpos( $content, '[' ) ) {
528
+	if (false === strpos($content, '[')) {
529 529
 		return $content;
530 530
 	}
531 531
 
532
-	if (empty($shortcode_tags) || !is_array($shortcode_tags))
532
+	if (empty($shortcode_tags) || ! is_array($shortcode_tags))
533 533
 		return $content;
534 534
 
535
-	$content = do_shortcodes_in_html_tags( $content, true );
535
+	$content = do_shortcodes_in_html_tags($content, true);
536 536
 
537 537
 	$pattern = get_shortcode_regex();
538
-	$content = preg_replace_callback( "/$pattern/s", 'strip_shortcode_tag', $content );
538
+	$content = preg_replace_callback("/$pattern/s", 'strip_shortcode_tag', $content);
539 539
 
540 540
 	// Always restore square braces so we don't break things like <!--[if IE ]>
541
-	$content = unescape_invalid_shortcodes( $content );
541
+	$content = unescape_invalid_shortcodes($content);
542 542
 
543 543
 	return $content;
544 544
 }
@@ -548,11 +548,11 @@  discard block
 block discarded – undo
548 548
  * @param array $m
549 549
  * @return string|false
550 550
  */
551
-function strip_shortcode_tag( $m ) {
551
+function strip_shortcode_tag($m) {
552 552
 	// allow [[foo]] syntax for escaping a tag
553
-	if ( $m[1] == '[' && $m[6] == ']' ) {
553
+	if ($m[1] == '[' && $m[6] == ']') {
554 554
 		return substr($m[0], 1, -1);
555 555
 	}
556 556
 
557
-	return $m[1] . $m[6];
557
+	return $m[1].$m[6];
558 558
 }
Please login to merge, or discard this patch.
Braces   +28 added lines, -22 removed lines patch added patch discarded remove patch
@@ -156,8 +156,9 @@  discard block
 block discarded – undo
156 156
 
157 157
 	if ( shortcode_exists( $tag ) ) {
158 158
 		preg_match_all( '/' . get_shortcode_regex() . '/s', $content, $matches, PREG_SET_ORDER );
159
-		if ( empty( $matches ) )
160
-			return false;
159
+		if ( empty( $matches ) ) {
160
+					return false;
161
+		}
161 162
 
162 163
 		foreach ( $matches as $shortcode ) {
163 164
 			if ( $tag === $shortcode[2] ) {
@@ -192,8 +193,9 @@  discard block
 block discarded – undo
192 193
 		return $content;
193 194
 	}
194 195
 
195
-	if (empty($shortcode_tags) || !is_array($shortcode_tags))
196
-		return $content;
196
+	if (empty($shortcode_tags) || !is_array($shortcode_tags)) {
197
+			return $content;
198
+	}
197 199
 
198 200
 	$tagnames = array_keys($shortcode_tags);
199 201
 	$tagregexp = join( '|', array_map('preg_quote', $tagnames) );
@@ -451,16 +453,17 @@  discard block
 block discarded – undo
451 453
 	$text = preg_replace("/[\x{00a0}\x{200b}]+/u", " ", $text);
452 454
 	if ( preg_match_all($pattern, $text, $match, PREG_SET_ORDER) ) {
453 455
 		foreach ($match as $m) {
454
-			if (!empty($m[1]))
455
-				$atts[strtolower($m[1])] = stripcslashes($m[2]);
456
-			elseif (!empty($m[3]))
457
-				$atts[strtolower($m[3])] = stripcslashes($m[4]);
458
-			elseif (!empty($m[5]))
459
-				$atts[strtolower($m[5])] = stripcslashes($m[6]);
460
-			elseif (isset($m[7]) && strlen($m[7]))
461
-				$atts[] = stripcslashes($m[7]);
462
-			elseif (isset($m[8]))
463
-				$atts[] = stripcslashes($m[8]);
456
+			if (!empty($m[1])) {
457
+							$atts[strtolower($m[1])] = stripcslashes($m[2]);
458
+			} elseif (!empty($m[3])) {
459
+							$atts[strtolower($m[3])] = stripcslashes($m[4]);
460
+			} elseif (!empty($m[5])) {
461
+							$atts[strtolower($m[5])] = stripcslashes($m[6]);
462
+			} elseif (isset($m[7]) && strlen($m[7])) {
463
+							$atts[] = stripcslashes($m[7]);
464
+			} elseif (isset($m[8])) {
465
+							$atts[] = stripcslashes($m[8]);
466
+			}
464 467
 		}
465 468
 	} else {
466 469
 		$atts = ltrim($text);
@@ -489,10 +492,11 @@  discard block
 block discarded – undo
489 492
 	$atts = (array)$atts;
490 493
 	$out = array();
491 494
 	foreach($pairs as $name => $default) {
492
-		if ( array_key_exists($name, $atts) )
493
-			$out[$name] = $atts[$name];
494
-		else
495
-			$out[$name] = $default;
495
+		if ( array_key_exists($name, $atts) ) {
496
+					$out[$name] = $atts[$name];
497
+		} else {
498
+					$out[$name] = $default;
499
+		}
496 500
 	}
497 501
 	/**
498 502
 	 * Filter a shortcode's default attributes.
@@ -506,8 +510,9 @@  discard block
 block discarded – undo
506 510
 	 * @param array $pairs The supported attributes and their defaults.
507 511
 	 * @param array $atts  The user defined shortcode attributes.
508 512
 	 */
509
-	if ( $shortcode )
510
-		$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
513
+	if ( $shortcode ) {
514
+			$out = apply_filters( "shortcode_atts_{$shortcode}", $out, $pairs, $atts );
515
+	}
511 516
 
512 517
 	return $out;
513 518
 }
@@ -529,8 +534,9 @@  discard block
 block discarded – undo
529 534
 		return $content;
530 535
 	}
531 536
 
532
-	if (empty($shortcode_tags) || !is_array($shortcode_tags))
533
-		return $content;
537
+	if (empty($shortcode_tags) || !is_array($shortcode_tags)) {
538
+			return $content;
539
+	}
534 540
 
535 541
 	$content = do_shortcodes_in_html_tags( $content, true );
536 542
 
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Decode/HTML/Entities.php 4 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 	 * Consume the next byte
110 110
 	 *
111 111
 	 * @access private
112
-	 * @return mixed The next byte, or false, if there is no more data
112
+	 * @return string|false The next byte, or false, if there is no more data
113 113
 	 */
114 114
 	public function consume()
115 115
 	{
@@ -129,7 +129,7 @@  discard block
 block discarded – undo
129 129
 	 *
130 130
 	 * @access private
131 131
 	 * @param string $chars Characters to consume
132
-	 * @return mixed A series of characters that match the range, or false
132
+	 * @return string|false A series of characters that match the range, or false
133 133
 	 */
134 134
 	public function consume_range($chars)
135 135
 	{
Please login to merge, or discard this patch.
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -1,46 +1,46 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * SimplePie
4
- *
5
- * A PHP-Based RSS and Atom Feed Framework.
6
- * Takes the hard work out of managing a complete RSS/Atom solution.
7
- *
8
- * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
9
- * All rights reserved.
10
- *
11
- * Redistribution and use in source and binary forms, with or without modification, are
12
- * permitted provided that the following conditions are met:
13
- *
14
- * 	* Redistributions of source code must retain the above copyright notice, this list of
15
- * 	  conditions and the following disclaimer.
16
- *
17
- * 	* Redistributions in binary form must reproduce the above copyright notice, this list
18
- * 	  of conditions and the following disclaimer in the documentation and/or other materials
19
- * 	  provided with the distribution.
20
- *
21
- * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
22
- * 	  to endorse or promote products derived from this software without specific prior
23
- * 	  written permission.
24
- *
25
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
26
- * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
- * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
28
- * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
- * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
- * POSSIBILITY OF SUCH DAMAGE.
34
- *
35
- * @package SimplePie
36
- * @version 1.3.1
37
- * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
38
- * @author Ryan Parman
39
- * @author Geoffrey Sneddon
40
- * @author Ryan McCue
41
- * @link http://simplepie.org/ SimplePie
42
- * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43
- */
3
+	 * SimplePie
4
+	 *
5
+	 * A PHP-Based RSS and Atom Feed Framework.
6
+	 * Takes the hard work out of managing a complete RSS/Atom solution.
7
+	 *
8
+	 * Copyright (c) 2004-2012, Ryan Parman, Geoffrey Sneddon, Ryan McCue, and contributors
9
+	 * All rights reserved.
10
+	 *
11
+	 * Redistribution and use in source and binary forms, with or without modification, are
12
+	 * permitted provided that the following conditions are met:
13
+	 *
14
+	 * 	* Redistributions of source code must retain the above copyright notice, this list of
15
+	 * 	  conditions and the following disclaimer.
16
+	 *
17
+	 * 	* Redistributions in binary form must reproduce the above copyright notice, this list
18
+	 * 	  of conditions and the following disclaimer in the documentation and/or other materials
19
+	 * 	  provided with the distribution.
20
+	 *
21
+	 * 	* Neither the name of the SimplePie Team nor the names of its contributors may be used
22
+	 * 	  to endorse or promote products derived from this software without specific prior
23
+	 * 	  written permission.
24
+	 *
25
+	 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
26
+	 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
27
+	 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS
28
+	 * AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
29
+	 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30
+	 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31
+	 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
32
+	 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
33
+	 * POSSIBILITY OF SUCH DAMAGE.
34
+	 *
35
+	 * @package SimplePie
36
+	 * @version 1.3.1
37
+	 * @copyright 2004-2012 Ryan Parman, Geoffrey Sneddon, Ryan McCue
38
+	 * @author Ryan Parman
39
+	 * @author Geoffrey Sneddon
40
+	 * @author Ryan McCue
41
+	 * @link http://simplepie.org/ SimplePie
42
+	 * @license http://www.opensource.org/licenses/bsd-license.php BSD License
43
+	 */
44 44
 
45 45
 
46 46
 /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -215,7 +215,7 @@
 block discarded – undo
215 215
 						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
216 216
 					}
217 217
 
218
-					if (!in_array($this->consume(), array(';', false), true))
218
+					if ( ! in_array($this->consume(), array(';', false), true))
219 219
 					{
220 220
 						$this->unconsume();
221 221
 					}
Please login to merge, or discard this patch.
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -117,8 +117,7 @@  discard block
 block discarded – undo
117 117
 		{
118 118
 			$this->consumed .= $this->data[$this->position];
119 119
 			return $this->data[$this->position++];
120
-		}
121
-		else
120
+		} else
122 121
 		{
123 122
 			return false;
124 123
 		}
@@ -139,8 +138,7 @@  discard block
 block discarded – undo
139 138
 			$this->consumed .= $data;
140 139
 			$this->position += $len;
141 140
 			return $data;
142
-		}
143
-		else
141
+		} else
144 142
 		{
145 143
 			return false;
146 144
 		}
@@ -200,8 +198,7 @@  discard block
 block discarded – undo
200 198
 					if ($hex)
201 199
 					{
202 200
 						$codepoint = hexdec($codepoint);
203
-					}
204
-					else
201
+					} else
205 202
 					{
206 203
 						$codepoint = intval($codepoint);
207 204
 					}
@@ -209,8 +206,7 @@  discard block
 block discarded – undo
209 206
 					if (isset($windows_1252_specials[$codepoint]))
210 207
 					{
211 208
 						$replacement = $windows_1252_specials[$codepoint];
212
-					}
213
-					else
209
+					} else
214 210
 					{
215 211
 						$replacement = SimplePie_Misc::codepoint_to_utf8($codepoint);
216 212
 					}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Enclosure.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -647,7 +647,7 @@
 block discarded – undo
647 647
 	/**
648 648
 	 * Get length
649 649
 	 *
650
-	 * @return float Length in bytes
650
+	 * @return string|null Length in bytes
651 651
 	 */
652 652
 	public function get_length()
653 653
 	{
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -813,7 +813,7 @@  discard block
 block discarded – undo
813 813
 		$length = $this->get_length();
814 814
 		if ($length !== null)
815 815
 		{
816
-			return round($length/1048576, 2);
816
+			return round($length / 1048576, 2);
817 817
 		}
818 818
 		else
819 819
 		{
@@ -917,7 +917,7 @@  discard block
 block discarded – undo
917 917
 	 * @param array|string $options See first paramter to {@see embed}
918 918
 	 * @return string HTML string to output
919 919
 	 */
920
-	public function native_embed($options='')
920
+	public function native_embed($options = '')
921 921
 	{
922 922
 		return $this->embed($options, true);
923 923
 	}
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 		else
992 992
 		{
993 993
 			$options = explode(',', $options);
994
-			foreach($options as $option)
994
+			foreach ($options as $option)
995 995
 			{
996 996
 				$opt = explode(':', $option, 2);
997 997
 				if (isset($opt[0], $opt[1]))
@@ -1058,11 +1058,11 @@  discard block
 block discarded – undo
1058 1058
 				}
1059 1059
 				elseif ($widescreen)
1060 1060
 				{
1061
-					$width = round((intval($height)/9)*16);
1061
+					$width = round((intval($height) / 9) * 16);
1062 1062
 				}
1063 1063
 				else
1064 1064
 				{
1065
-					$width = round((intval($height)/3)*4);
1065
+					$width = round((intval($height) / 3) * 4);
1066 1066
 				}
1067 1067
 			}
1068 1068
 			else
@@ -1092,11 +1092,11 @@  discard block
 block discarded – undo
1092 1092
 				}
1093 1093
 				elseif ($widescreen)
1094 1094
 				{
1095
-					$height = round((intval($width)/16)*9);
1095
+					$height = round((intval($width) / 16) * 9);
1096 1096
 				}
1097 1097
 				else
1098 1098
 				{
1099
-					$height = round((intval($width)/4)*3);
1099
+					$height = round((intval($width) / 4) * 3);
1100 1100
 				}
1101 1101
 			}
1102 1102
 			else
@@ -1126,11 +1126,11 @@  discard block
 block discarded – undo
1126 1126
 		{
1127 1127
 			if ($native)
1128 1128
 			{
1129
-				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
1129
+				$embed .= "<embed src=\"".$this->get_link()."\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
1130 1130
 			}
1131 1131
 			else
1132 1132
 			{
1133
-				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
1133
+				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '".$this->get_link()."', '$loop', '$type');</script>";
1134 1134
 			}
1135 1135
 		}
1136 1136
 
@@ -1141,11 +1141,11 @@  discard block
 block discarded – undo
1141 1141
 			$height += 20;
1142 1142
 			if ($native)
1143 1143
 			{
1144
-				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
1144
+				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
1145 1145
 			}
1146 1146
 			else
1147 1147
 			{
1148
-				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
1148
+				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '".rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension())."', '$placeholder', '$loop', '$mediaplayer');</script>";
1149 1149
 			}
1150 1150
 		}
1151 1151
 
@@ -1158,16 +1158,16 @@  discard block
 block discarded – undo
1158 1158
 			{
1159 1159
 				if ($placeholder !== '')
1160 1160
 				{
1161
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1161
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"".$this->get_link()."\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1162 1162
 				}
1163 1163
 				else
1164 1164
 				{
1165
-					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1165
+					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"".$this->get_link()."\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1166 1166
 				}
1167 1167
 			}
1168 1168
 			else
1169 1169
 			{
1170
-				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
1170
+				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '".$this->get_link()."', '$placeholder', '$loop');</script>";
1171 1171
 			}
1172 1172
 		}
1173 1173
 
@@ -1177,16 +1177,16 @@  discard block
 block discarded – undo
1177 1177
 			$height += 45;
1178 1178
 			if ($native)
1179 1179
 			{
1180
-				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
1180
+				$embed .= "<embed type=\"application/x-mplayer2\" src=\"".$this->get_link()."\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
1181 1181
 			}
1182 1182
 			else
1183 1183
 			{
1184
-				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
1184
+				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '".$this->get_link()."');</script>";
1185 1185
 			}
1186 1186
 		}
1187 1187
 
1188 1188
 		// Everything else
1189
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
1189
+		else $embed .= '<a href="'.$this->get_link().'" class="'.$altclass.'">'.$alt.'</a>';
1190 1190
 
1191 1191
 		return $embed;
1192 1192
 	}
@@ -1206,7 +1206,7 @@  discard block
 block discarded – undo
1206 1206
 	{
1207 1207
 		// Mime-types by handler.
1208 1208
 		$types_flash = array('application/x-shockwave-flash', 'application/futuresplash'); // Flash
1209
-		$types_fmedia = array('video/flv', 'video/x-flv','flv-application/octet-stream'); // Flash Media Player
1209
+		$types_fmedia = array('video/flv', 'video/x-flv', 'flv-application/octet-stream'); // Flash Media Player
1210 1210
 		$types_quicktime = array('audio/3gpp', 'audio/3gpp2', 'audio/aac', 'audio/x-aac', 'audio/aiff', 'audio/x-aiff', 'audio/mid', 'audio/midi', 'audio/x-midi', 'audio/mp4', 'audio/m4a', 'audio/x-m4a', 'audio/wav', 'audio/x-wav', 'video/3gpp', 'video/3gpp2', 'video/m4v', 'video/x-m4v', 'video/mp4', 'video/mpeg', 'video/x-mpeg', 'video/quicktime', 'video/sd-video'); // QuickTime
1211 1211
 		$types_wmedia = array('application/asx', 'application/x-mplayer2', 'audio/x-ms-wma', 'audio/x-ms-wax', 'video/x-ms-asf-plugin', 'video/x-ms-asf', 'video/x-ms-wm', 'video/x-ms-wmv', 'video/x-ms-wvx'); // Windows Media
1212 1212
 		$types_mp3 = array('audio/mp3', 'audio/x-mp3', 'audio/mpeg', 'audio/x-mpeg'); // MP3
@@ -1221,7 +1221,7 @@  discard block
 block discarded – undo
1221 1221
 		}
1222 1222
 
1223 1223
 		// If we encounter an unsupported mime-type, check the file extension and guess intelligently.
1224
-		if (!in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
1224
+		if ( ! in_array($type, array_merge($types_flash, $types_fmedia, $types_quicktime, $types_wmedia, $types_mp3)))
1225 1225
 		{
1226 1226
 			switch (strtolower($this->get_extension()))
1227 1227
 			{
Please login to merge, or discard this patch.
Braces   +61 added lines, -117 removed lines patch added patch discarded remove patch
@@ -282,8 +282,7 @@  discard block
 block discarded – undo
282 282
 		if ($this->bitrate !== null)
283 283
 		{
284 284
 			return $this->bitrate;
285
-		}
286
-		else
285
+		} else
287 286
 		{
288 287
 			return null;
289 288
 		}
@@ -301,8 +300,7 @@  discard block
 block discarded – undo
301 300
 		if (isset($captions[$key]))
302 301
 		{
303 302
 			return $captions[$key];
304
-		}
305
-		else
303
+		} else
306 304
 		{
307 305
 			return null;
308 306
 		}
@@ -318,8 +316,7 @@  discard block
 block discarded – undo
318 316
 		if ($this->captions !== null)
319 317
 		{
320 318
 			return $this->captions;
321
-		}
322
-		else
319
+		} else
323 320
 		{
324 321
 			return null;
325 322
 		}
@@ -337,8 +334,7 @@  discard block
 block discarded – undo
337 334
 		if (isset($categories[$key]))
338 335
 		{
339 336
 			return $categories[$key];
340
-		}
341
-		else
337
+		} else
342 338
 		{
343 339
 			return null;
344 340
 		}
@@ -354,8 +350,7 @@  discard block
 block discarded – undo
354 350
 		if ($this->categories !== null)
355 351
 		{
356 352
 			return $this->categories;
357
-		}
358
-		else
353
+		} else
359 354
 		{
360 355
 			return null;
361 356
 		}
@@ -371,8 +366,7 @@  discard block
 block discarded – undo
371 366
 		if ($this->channels !== null)
372 367
 		{
373 368
 			return $this->channels;
374
-		}
375
-		else
369
+		} else
376 370
 		{
377 371
 			return null;
378 372
 		}
@@ -388,8 +382,7 @@  discard block
 block discarded – undo
388 382
 		if ($this->copyright !== null)
389 383
 		{
390 384
 			return $this->copyright;
391
-		}
392
-		else
385
+		} else
393 386
 		{
394 387
 			return null;
395 388
 		}
@@ -407,8 +400,7 @@  discard block
 block discarded – undo
407 400
 		if (isset($credits[$key]))
408 401
 		{
409 402
 			return $credits[$key];
410
-		}
411
-		else
403
+		} else
412 404
 		{
413 405
 			return null;
414 406
 		}
@@ -424,8 +416,7 @@  discard block
 block discarded – undo
424 416
 		if ($this->credits !== null)
425 417
 		{
426 418
 			return $this->credits;
427
-		}
428
-		else
419
+		} else
429 420
 		{
430 421
 			return null;
431 422
 		}
@@ -441,8 +432,7 @@  discard block
 block discarded – undo
441 432
 		if ($this->description !== null)
442 433
 		{
443 434
 			return $this->description;
444
-		}
445
-		else
435
+		} else
446 436
 		{
447 437
 			return null;
448 438
 		}
@@ -462,13 +452,11 @@  discard block
 block discarded – undo
462 452
 			{
463 453
 				$time = SimplePie_Misc::time_hms($this->duration);
464 454
 				return $time;
465
-			}
466
-			else
455
+			} else
467 456
 			{
468 457
 				return $this->duration;
469 458
 			}
470
-		}
471
-		else
459
+		} else
472 460
 		{
473 461
 			return null;
474 462
 		}
@@ -484,8 +472,7 @@  discard block
 block discarded – undo
484 472
 		if ($this->expression !== null)
485 473
 		{
486 474
 			return $this->expression;
487
-		}
488
-		else
475
+		} else
489 476
 		{
490 477
 			return 'full';
491 478
 		}
@@ -519,8 +506,7 @@  discard block
 block discarded – undo
519 506
 		if ($this->framerate !== null)
520 507
 		{
521 508
 			return $this->framerate;
522
-		}
523
-		else
509
+		} else
524 510
 		{
525 511
 			return null;
526 512
 		}
@@ -549,8 +535,7 @@  discard block
 block discarded – undo
549 535
 		if (isset($hashes[$key]))
550 536
 		{
551 537
 			return $hashes[$key];
552
-		}
553
-		else
538
+		} else
554 539
 		{
555 540
 			return null;
556 541
 		}
@@ -566,8 +551,7 @@  discard block
 block discarded – undo
566 551
 		if ($this->hashes !== null)
567 552
 		{
568 553
 			return $this->hashes;
569
-		}
570
-		else
554
+		} else
571 555
 		{
572 556
 			return null;
573 557
 		}
@@ -583,8 +567,7 @@  discard block
 block discarded – undo
583 567
 		if ($this->height !== null)
584 568
 		{
585 569
 			return $this->height;
586
-		}
587
-		else
570
+		} else
588 571
 		{
589 572
 			return null;
590 573
 		}
@@ -601,8 +584,7 @@  discard block
 block discarded – undo
601 584
 		if ($this->lang !== null)
602 585
 		{
603 586
 			return $this->lang;
604
-		}
605
-		else
587
+		} else
606 588
 		{
607 589
 			return null;
608 590
 		}
@@ -620,8 +602,7 @@  discard block
 block discarded – undo
620 602
 		if (isset($keywords[$key]))
621 603
 		{
622 604
 			return $keywords[$key];
623
-		}
624
-		else
605
+		} else
625 606
 		{
626 607
 			return null;
627 608
 		}
@@ -637,8 +618,7 @@  discard block
 block discarded – undo
637 618
 		if ($this->keywords !== null)
638 619
 		{
639 620
 			return $this->keywords;
640
-		}
641
-		else
621
+		} else
642 622
 		{
643 623
 			return null;
644 624
 		}
@@ -654,8 +634,7 @@  discard block
 block discarded – undo
654 634
 		if ($this->length !== null)
655 635
 		{
656 636
 			return $this->length;
657
-		}
658
-		else
637
+		} else
659 638
 		{
660 639
 			return null;
661 640
 		}
@@ -671,8 +650,7 @@  discard block
 block discarded – undo
671 650
 		if ($this->link !== null)
672 651
 		{
673 652
 			return urldecode($this->link);
674
-		}
675
-		else
653
+		} else
676 654
 		{
677 655
 			return null;
678 656
 		}
@@ -689,8 +667,7 @@  discard block
 block discarded – undo
689 667
 		if ($this->medium !== null)
690 668
 		{
691 669
 			return $this->medium;
692
-		}
693
-		else
670
+		} else
694 671
 		{
695 672
 			return null;
696 673
 		}
@@ -707,8 +684,7 @@  discard block
 block discarded – undo
707 684
 		if ($this->player !== null)
708 685
 		{
709 686
 			return $this->player;
710
-		}
711
-		else
687
+		} else
712 688
 		{
713 689
 			return null;
714 690
 		}
@@ -726,8 +702,7 @@  discard block
 block discarded – undo
726 702
 		if (isset($ratings[$key]))
727 703
 		{
728 704
 			return $ratings[$key];
729
-		}
730
-		else
705
+		} else
731 706
 		{
732 707
 			return null;
733 708
 		}
@@ -743,8 +718,7 @@  discard block
 block discarded – undo
743 718
 		if ($this->ratings !== null)
744 719
 		{
745 720
 			return $this->ratings;
746
-		}
747
-		else
721
+		} else
748 722
 		{
749 723
 			return null;
750 724
 		}
@@ -762,8 +736,7 @@  discard block
 block discarded – undo
762 736
 		if (isset($restrictions[$key]))
763 737
 		{
764 738
 			return $restrictions[$key];
765
-		}
766
-		else
739
+		} else
767 740
 		{
768 741
 			return null;
769 742
 		}
@@ -779,8 +752,7 @@  discard block
 block discarded – undo
779 752
 		if ($this->restrictions !== null)
780 753
 		{
781 754
 			return $this->restrictions;
782
-		}
783
-		else
755
+		} else
784 756
 		{
785 757
 			return null;
786 758
 		}
@@ -796,8 +768,7 @@  discard block
 block discarded – undo
796 768
 		if ($this->samplingrate !== null)
797 769
 		{
798 770
 			return $this->samplingrate;
799
-		}
800
-		else
771
+		} else
801 772
 		{
802 773
 			return null;
803 774
 		}
@@ -814,8 +785,7 @@  discard block
 block discarded – undo
814 785
 		if ($length !== null)
815 786
 		{
816 787
 			return round($length/1048576, 2);
817
-		}
818
-		else
788
+		} else
819 789
 		{
820 790
 			return null;
821 791
 		}
@@ -833,8 +803,7 @@  discard block
 block discarded – undo
833 803
 		if (isset($thumbnails[$key]))
834 804
 		{
835 805
 			return $thumbnails[$key];
836
-		}
837
-		else
806
+		} else
838 807
 		{
839 808
 			return null;
840 809
 		}
@@ -850,8 +819,7 @@  discard block
 block discarded – undo
850 819
 		if ($this->thumbnails !== null)
851 820
 		{
852 821
 			return $this->thumbnails;
853
-		}
854
-		else
822
+		} else
855 823
 		{
856 824
 			return null;
857 825
 		}
@@ -867,8 +835,7 @@  discard block
 block discarded – undo
867 835
 		if ($this->title !== null)
868 836
 		{
869 837
 			return $this->title;
870
-		}
871
-		else
838
+		} else
872 839
 		{
873 840
 			return null;
874 841
 		}
@@ -885,8 +852,7 @@  discard block
 block discarded – undo
885 852
 		if ($this->type !== null)
886 853
 		{
887 854
 			return $this->type;
888
-		}
889
-		else
855
+		} else
890 856
 		{
891 857
 			return null;
892 858
 		}
@@ -902,8 +868,7 @@  discard block
 block discarded – undo
902 868
 		if ($this->width !== null)
903 869
 		{
904 870
 			return $this->width;
905
-		}
906
-		else
871
+		} else
907 872
 		{
908 873
 			return null;
909 874
 		}
@@ -987,8 +952,7 @@  discard block
 block discarded – undo
987 952
 		if (is_array($options))
988 953
 		{
989 954
 			extract($options);
990
-		}
991
-		else
955
+		} else
992 956
 		{
993 957
 			$options = explode(',', $options);
994 958
 			foreach($options as $option)
@@ -1055,17 +1019,14 @@  discard block
 block discarded – undo
1055 1019
 				if ($height === 'auto')
1056 1020
 				{
1057 1021
 					$width = 480;
1058
-				}
1059
-				elseif ($widescreen)
1022
+				} elseif ($widescreen)
1060 1023
 				{
1061 1024
 					$width = round((intval($height)/9)*16);
1062
-				}
1063
-				else
1025
+				} else
1064 1026
 				{
1065 1027
 					$width = round((intval($height)/3)*4);
1066 1028
 				}
1067
-			}
1068
-			else
1029
+			} else
1069 1030
 			{
1070 1031
 				$width = '100%';
1071 1032
 			}
@@ -1076,35 +1037,29 @@  discard block
 block discarded – undo
1076 1037
 			if ($mime === 'audio')
1077 1038
 			{
1078 1039
 				$height = 0;
1079
-			}
1080
-			elseif ($mime === 'video')
1040
+			} elseif ($mime === 'video')
1081 1041
 			{
1082 1042
 				if ($width === 'auto')
1083 1043
 				{
1084 1044
 					if ($widescreen)
1085 1045
 					{
1086 1046
 						$height = 270;
1087
-					}
1088
-					else
1047
+					} else
1089 1048
 					{
1090 1049
 						$height = 360;
1091 1050
 					}
1092
-				}
1093
-				elseif ($widescreen)
1051
+				} elseif ($widescreen)
1094 1052
 				{
1095 1053
 					$height = round((intval($width)/16)*9);
1096
-				}
1097
-				else
1054
+				} else
1098 1055
 				{
1099 1056
 					$height = round((intval($width)/4)*3);
1100 1057
 				}
1101
-			}
1102
-			else
1058
+			} else
1103 1059
 			{
1104 1060
 				$height = 376;
1105 1061
 			}
1106
-		}
1107
-		elseif ($mime === 'audio')
1062
+		} elseif ($mime === 'audio')
1108 1063
 		{
1109 1064
 			$height = 0;
1110 1065
 		}
@@ -1113,8 +1068,7 @@  discard block
 block discarded – undo
1113 1068
 		if ($mime === 'audio')
1114 1069
 		{
1115 1070
 			$placeholder = $audio;
1116
-		}
1117
-		elseif ($mime === 'video')
1071
+		} elseif ($mime === 'video')
1118 1072
 		{
1119 1073
 			$placeholder = $video;
1120 1074
 		}
@@ -1127,8 +1081,7 @@  discard block
 block discarded – undo
1127 1081
 			if ($native)
1128 1082
 			{
1129 1083
 				$embed .= "<embed src=\"" . $this->get_link() . "\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"$type\" quality=\"high\" width=\"$width\" height=\"$height\" bgcolor=\"$bgcolor\" loop=\"$loop\"></embed>";
1130
-			}
1131
-			else
1084
+			} else
1132 1085
 			{
1133 1086
 				$embed .= "<script type='text/javascript'>embed_flash('$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$loop', '$type');</script>";
1134 1087
 			}
@@ -1142,8 +1095,7 @@  discard block
 block discarded – undo
1142 1095
 			if ($native)
1143 1096
 			{
1144 1097
 				$embed .= "<embed src=\"$mediaplayer\" pluginspage=\"http://adobe.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" quality=\"high\" width=\"$width\" height=\"$height\" wmode=\"transparent\" flashvars=\"file=" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "&autostart=false&repeat=$loop&showdigits=true&showfsbutton=false\"></embed>";
1145
-			}
1146
-			else
1098
+			} else
1147 1099
 			{
1148 1100
 				$embed .= "<script type='text/javascript'>embed_flv('$width', '$height', '" . rawurlencode($this->get_link().'?file_extension=.'.$this->get_extension()) . "', '$placeholder', '$loop', '$mediaplayer');</script>";
1149 1101
 			}
@@ -1159,13 +1111,11 @@  discard block
 block discarded – undo
1159 1111
 				if ($placeholder !== '')
1160 1112
 				{
1161 1113
 					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" href=\"" . $this->get_link() . "\" src=\"$placeholder\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"false\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1162
-				}
1163
-				else
1114
+				} else
1164 1115
 				{
1165 1116
 					$embed .= "<embed type=\"$type\" style=\"cursor:hand; cursor:pointer;\" src=\"" . $this->get_link() . "\" width=\"$width\" height=\"$height\" autoplay=\"false\" target=\"myself\" controller=\"true\" loop=\"$loop\" scale=\"aspect\" bgcolor=\"$bgcolor\" pluginspage=\"http://apple.com/quicktime/download/\"></embed>";
1166 1117
 				}
1167
-			}
1168
-			else
1118
+			} else
1169 1119
 			{
1170 1120
 				$embed .= "<script type='text/javascript'>embed_quicktime('$type', '$bgcolor', '$width', '$height', '" . $this->get_link() . "', '$placeholder', '$loop');</script>";
1171 1121
 			}
@@ -1178,15 +1128,16 @@  discard block
 block discarded – undo
1178 1128
 			if ($native)
1179 1129
 			{
1180 1130
 				$embed .= "<embed type=\"application/x-mplayer2\" src=\"" . $this->get_link() . "\" autosize=\"1\" width=\"$width\" height=\"$height\" showcontrols=\"1\" showstatusbar=\"0\" showdisplay=\"0\" autostart=\"0\"></embed>";
1181
-			}
1182
-			else
1131
+			} else
1183 1132
 			{
1184 1133
 				$embed .= "<script type='text/javascript'>embed_wmedia('$width', '$height', '" . $this->get_link() . "');</script>";
1185 1134
 			}
1186 1135
 		}
1187 1136
 
1188 1137
 		// Everything else
1189
-		else $embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
1138
+		else {
1139
+			$embed .= '<a href="' . $this->get_link() . '" class="' . $altclass . '">' . $alt . '</a>';
1140
+		}
1190 1141
 
1191 1142
 		return $embed;
1192 1143
 	}
@@ -1214,8 +1165,7 @@  discard block
 block discarded – undo
1214 1165
 		if ($this->get_type() !== null)
1215 1166
 		{
1216 1167
 			$type = strtolower($this->type);
1217
-		}
1218
-		else
1168
+		} else
1219 1169
 		{
1220 1170
 			$type = null;
1221 1171
 		}
@@ -1349,29 +1299,23 @@  discard block
 block discarded – undo
1349 1299
 			if (in_array($type, $types_flash))
1350 1300
 			{
1351 1301
 				return 'flash';
1352
-			}
1353
-			elseif (in_array($type, $types_fmedia))
1302
+			} elseif (in_array($type, $types_fmedia))
1354 1303
 			{
1355 1304
 				return 'fmedia';
1356
-			}
1357
-			elseif (in_array($type, $types_quicktime))
1305
+			} elseif (in_array($type, $types_quicktime))
1358 1306
 			{
1359 1307
 				return 'quicktime';
1360
-			}
1361
-			elseif (in_array($type, $types_wmedia))
1308
+			} elseif (in_array($type, $types_wmedia))
1362 1309
 			{
1363 1310
 				return 'wmedia';
1364
-			}
1365
-			elseif (in_array($type, $types_mp3))
1311
+			} elseif (in_array($type, $types_mp3))
1366 1312
 			{
1367 1313
 				return 'mp3';
1368
-			}
1369
-			else
1314
+			} else
1370 1315
 			{
1371 1316
 				return null;
1372 1317
 			}
1373
-		}
1374
-		else
1318
+		} else
1375 1319
 		{
1376 1320
 			return $type;
1377 1321
 		}
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/IRI.php 3 patches
Doc Comments   +2 added lines, -1 removed lines patch added patch discarded remove patch
@@ -264,7 +264,7 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * Returns false if $base is not absolute, otherwise an IRI.
266 266
 	 *
267
-	 * @param IRI|string $base (Absolute) Base IRI
267
+	 * @param SimplePie_IRI $base (Absolute) Base IRI
268 268
 	 * @param IRI|string $relative Relative IRI
269 269
 	 * @return IRI|false
270 270
 	 */
@@ -1119,6 +1119,7 @@  discard block
 block discarded – undo
1119 1119
 	/**
1120 1120
 	 * Convert an IRI to a URI (or parts thereof)
1121 1121
 	 *
1122
+	 * @param false|string $string
1122 1123
 	 * @return string
1123 1124
 	 */
1124 1125
 	public function to_uri($string)
Please login to merge, or discard this patch.
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -148,9 +148,9 @@  discard block
 block discarded – undo
148 148
 	 */
149 149
 	public function __set($name, $value)
150 150
 	{
151
-		if (method_exists($this, 'set_' . $name))
151
+		if (method_exists($this, 'set_'.$name))
152 152
 		{
153
-			call_user_func(array($this, 'set_' . $name), $value);
153
+			call_user_func(array($this, 'set_'.$name), $value);
154 154
 		}
155 155
 		elseif (
156 156
 			   $name === 'iauthority'
@@ -161,7 +161,7 @@  discard block
 block discarded – undo
161 161
 			|| $name === 'ifragment'
162 162
 		)
163 163
 		{
164
-			call_user_func(array($this, 'set_' . substr($name, 1)), $value);
164
+			call_user_func(array($this, 'set_'.substr($name, 1)), $value);
165 165
 		}
166 166
 	}
167 167
 
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 			$return = $this->$name;
192 192
 		}
193 193
 		// host -> ihost
194
-		elseif (($prop = 'i' . $name) && array_key_exists($prop, $props))
194
+		elseif (($prop = 'i'.$name) && array_key_exists($prop, $props))
195 195
 		{
196 196
 			$name = $prop;
197 197
 			$return = $this->$prop;
@@ -204,7 +204,7 @@  discard block
 block discarded – undo
204 204
 		}
205 205
 		else
206 206
 		{
207
-			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
207
+			trigger_error('Undefined property: '.get_class($this).'::'.$name, E_USER_NOTICE);
208 208
 			$return = null;
209 209
 		}
210 210
 
@@ -226,7 +226,7 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	public function __isset($name)
228 228
 	{
229
-		if (method_exists($this, 'get_' . $name) || isset($this->$name))
229
+		if (method_exists($this, 'get_'.$name) || isset($this->$name))
230 230
 		{
231 231
 			return true;
232 232
 		}
@@ -243,9 +243,9 @@  discard block
 block discarded – undo
243 243
 	 */
244 244
 	public function __unset($name)
245 245
 	{
246
-		if (method_exists($this, 'set_' . $name))
246
+		if (method_exists($this, 'set_'.$name))
247 247
 		{
248
-			call_user_func(array($this, 'set_' . $name), '');
248
+			call_user_func(array($this, 'set_'.$name), '');
249 249
 		}
250 250
 	}
251 251
 
@@ -270,11 +270,11 @@  discard block
 block discarded – undo
270 270
 	 */
271 271
 	public static function absolutize($base, $relative)
272 272
 	{
273
-		if (!($relative instanceof SimplePie_IRI))
273
+		if ( ! ($relative instanceof SimplePie_IRI))
274 274
 		{
275 275
 			$relative = new SimplePie_IRI($relative);
276 276
 		}
277
-		if (!$relative->is_valid())
277
+		if ( ! $relative->is_valid())
278 278
 		{
279 279
 			return false;
280 280
 		}
@@ -284,7 +284,7 @@  discard block
 block discarded – undo
284 284
 		}
285 285
 		else
286 286
 		{
287
-			if (!($base instanceof SimplePie_IRI))
287
+			if ( ! ($base instanceof SimplePie_IRI))
288 288
 			{
289 289
 				$base = new SimplePie_IRI($base);
290 290
 			}
@@ -312,11 +312,11 @@  discard block
 block discarded – undo
312 312
 							}
313 313
 							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
314 314
 							{
315
-								$target->ipath = '/' . $relative->ipath;
315
+								$target->ipath = '/'.$relative->ipath;
316 316
 							}
317 317
 							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
318 318
 							{
319
-								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
319
+								$target->ipath = substr($base->ipath, 0, $last_segment + 1).$relative->ipath;
320 320
 							}
321 321
 							else
322 322
 							{
@@ -370,19 +370,19 @@  discard block
 block discarded – undo
370 370
 			{
371 371
 				$match['scheme'] = null;
372 372
 			}
373
-			if (!isset($match[3]) || $match[3] === '')
373
+			if ( ! isset($match[3]) || $match[3] === '')
374 374
 			{
375 375
 				$match['authority'] = null;
376 376
 			}
377
-			if (!isset($match[5]))
377
+			if ( ! isset($match[5]))
378 378
 			{
379 379
 				$match['path'] = '';
380 380
 			}
381
-			if (!isset($match[6]) || $match[6] === '')
381
+			if ( ! isset($match[6]) || $match[6] === '')
382 382
 			{
383 383
 				$match['query'] = null;
384 384
 			}
385
-			if (!isset($match[8]) || $match[8] === '')
385
+			if ( ! isset($match[8]) || $match[8] === '')
386 386
 			{
387 387
 				$match['fragment'] = null;
388 388
 			}
@@ -452,7 +452,7 @@  discard block
 block discarded – undo
452 452
 				$input = '';
453 453
 			}
454 454
 		}
455
-		return $output . $input;
455
+		return $output.$input;
456 456
 	}
457 457
 
458 458
 	/**
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
 			// Percent encode anything invalid or not in ucschar
552 552
 			if (
553 553
 				// Invalid sequences
554
-				!$valid
554
+				! $valid
555 555
 				// Non-shortest form sequences are invalid
556 556
 				|| $length > 1 && $character <= 0x7F
557 557
 				|| $length > 2 && $character <= 0x7FF
@@ -568,7 +568,7 @@  discard block
 block discarded – undo
568 568
 				)
569 569
 				&& (
570 570
 					// Everything not in iprivate, if it applies
571
-					   !$iprivate
571
+					   ! $iprivate
572 572
 					|| $character < 0xE000
573 573
 					|| $character > 0x10FFFD
574 574
 				)
@@ -618,7 +618,7 @@  discard block
 block discarded – undo
618 618
 			$value = hexdec($bytes[$i]);
619 619
 
620 620
 			// If we're the first byte of sequence:
621
-			if (!$remaining)
621
+			if ( ! $remaining)
622 622
 			{
623 623
 				// Start position
624 624
 				$start = $i;
@@ -679,12 +679,12 @@  discard block
 block discarded – undo
679 679
 			}
680 680
 
681 681
 			// If we've reached the end of the current byte sequence, append it to Unicode::$data
682
-			if (!$remaining)
682
+			if ( ! $remaining)
683 683
 			{
684 684
 				// Percent encode anything invalid or not in iunreserved
685 685
 				if (
686 686
 					// Invalid sequences
687
-					!$valid
687
+					! $valid
688 688
 					// Non-shortest form sequences are invalid
689 689
 					|| $length > 1 && $character <= 0x7F
690 690
 					|| $length > 2 && $character <= 0x7FF
@@ -706,7 +706,7 @@  discard block
 block discarded – undo
706 706
 				{
707 707
 					for ($j = $start; $j <= $i; $j++)
708 708
 					{
709
-						$string .= '%' . strtoupper($bytes[$j]);
709
+						$string .= '%'.strtoupper($bytes[$j]);
710 710
 					}
711 711
 				}
712 712
 				else
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
 		{
726 726
 			for ($j = $start; $j < $len; $j++)
727 727
 			{
728
-				$string .= '%' . strtoupper($bytes[$j]);
728
+				$string .= '%'.strtoupper($bytes[$j]);
729 729
 			}
730 730
 		}
731 731
 
@@ -777,7 +777,7 @@  discard block
 block discarded – undo
777 777
 				) ||
778 778
 				(
779 779
 					$this->scheme === null &&
780
-					!$isauthority &&
780
+					! $isauthority &&
781 781
 					strpos($this->ipath, ':') !== false &&
782 782
 					(strpos($this->ipath, '/') === false ? true : strpos($this->ipath, ':') < strpos($this->ipath, '/'))
783 783
 				)
@@ -800,7 +800,7 @@  discard block
 block discarded – undo
800 800
 	public function set_iri($iri)
801 801
 	{
802 802
 		static $cache;
803
-		if (!$cache)
803
+		if ( ! $cache)
804 804
 		{
805 805
 			$cache = array();
806 806
 		}
@@ -824,7 +824,7 @@  discard block
 block discarded – undo
824 824
 		else
825 825
 		{
826 826
 			$parsed = $this->parse_iri((string) $iri);
827
-			if (!$parsed)
827
+			if ( ! $parsed)
828 828
 			{
829 829
 				return false;
830 830
 			}
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 		{
861 861
 			$this->scheme = null;
862 862
 		}
863
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
863
+		elseif ( ! preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
864 864
 		{
865 865
 			$this->scheme = null;
866 866
 			return false;
@@ -882,7 +882,7 @@  discard block
 block discarded – undo
882 882
 	public function set_authority($authority)
883 883
 	{
884 884
 		static $cache;
885
-		if (!$cache)
885
+		if ( ! $cache)
886 886
 			$cache = array();
887 887
 
888 888
 		if ($authority === null)
@@ -978,7 +978,7 @@  discard block
 block discarded – undo
978 978
 		{
979 979
 			if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
980 980
 			{
981
-				$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
981
+				$this->ihost = '['.SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)).']';
982 982
 			}
983 983
 			else
984 984
 			{
@@ -1052,7 +1052,7 @@  discard block
 block discarded – undo
1052 1052
 	public function set_path($ipath)
1053 1053
 	{
1054 1054
 		static $cache;
1055
-		if (!$cache)
1055
+		if ( ! $cache)
1056 1056
 		{
1057 1057
 			$cache = array();
1058 1058
 		}
@@ -1069,7 +1069,7 @@  discard block
 block discarded – undo
1069 1069
 			$removed = $this->remove_dot_segments($valid);
1070 1070
 
1071 1071
 			$cache[$ipath] = array($valid, $removed);
1072
-			$this->ipath =  ($this->scheme !== null) ? $removed : $valid;
1072
+			$this->ipath = ($this->scheme !== null) ? $removed : $valid;
1073 1073
 		}
1074 1074
 
1075 1075
 		$this->scheme_normalization();
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
 	public function to_uri($string)
1125 1125
 	{
1126 1126
 		static $non_ascii;
1127
-		if (!$non_ascii)
1127
+		if ( ! $non_ascii)
1128 1128
 		{
1129 1129
 			$non_ascii = implode('', range("\x80", "\xFF"));
1130 1130
 		}
@@ -1148,7 +1148,7 @@  discard block
 block discarded – undo
1148 1148
 	 */
1149 1149
 	public function get_iri()
1150 1150
 	{
1151
-		if (!$this->is_valid())
1151
+		if ( ! $this->is_valid())
1152 1152
 		{
1153 1153
 			return false;
1154 1154
 		}
@@ -1156,27 +1156,27 @@  discard block
 block discarded – undo
1156 1156
 		$iri = '';
1157 1157
 		if ($this->scheme !== null)
1158 1158
 		{
1159
-			$iri .= $this->scheme . ':';
1159
+			$iri .= $this->scheme.':';
1160 1160
 		}
1161 1161
 		if (($iauthority = $this->get_iauthority()) !== null)
1162 1162
 		{
1163
-			$iri .= '//' . $iauthority;
1163
+			$iri .= '//'.$iauthority;
1164 1164
 		}
1165 1165
 		if ($this->ipath !== '')
1166 1166
 		{
1167 1167
 			$iri .= $this->ipath;
1168 1168
 		}
1169
-		elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
1169
+		elseif ( ! empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
1170 1170
 		{
1171 1171
 			$iri .= $this->normalization[$this->scheme]['ipath'];
1172 1172
 		}
1173 1173
 		if ($this->iquery !== null)
1174 1174
 		{
1175
-			$iri .= '?' . $this->iquery;
1175
+			$iri .= '?'.$this->iquery;
1176 1176
 		}
1177 1177
 		if ($this->ifragment !== null)
1178 1178
 		{
1179
-			$iri .= '#' . $this->ifragment;
1179
+			$iri .= '#'.$this->ifragment;
1180 1180
 		}
1181 1181
 
1182 1182
 		return $iri;
@@ -1204,7 +1204,7 @@  discard block
 block discarded – undo
1204 1204
 			$iauthority = '';
1205 1205
 			if ($this->iuserinfo !== null)
1206 1206
 			{
1207
-				$iauthority .= $this->iuserinfo . '@';
1207
+				$iauthority .= $this->iuserinfo.'@';
1208 1208
 			}
1209 1209
 			if ($this->ihost !== null)
1210 1210
 			{
@@ -1212,7 +1212,7 @@  discard block
 block discarded – undo
1212 1212
 			}
1213 1213
 			if ($this->port !== null)
1214 1214
 			{
1215
-				$iauthority .= ':' . $this->port;
1215
+				$iauthority .= ':'.$this->port;
1216 1216
 			}
1217 1217
 			return $iauthority;
1218 1218
 		}
Please login to merge, or discard this patch.
Braces   +53 added lines, -92 removed lines patch added patch discarded remove patch
@@ -151,8 +151,7 @@  discard block
 block discarded – undo
151 151
 		if (method_exists($this, 'set_' . $name))
152 152
 		{
153 153
 			call_user_func(array($this, 'set_' . $name), $value);
154
-		}
155
-		elseif (
154
+		} elseif (
156 155
 			   $name === 'iauthority'
157 156
 			|| $name === 'iuserinfo'
158 157
 			|| $name === 'ihost'
@@ -185,8 +184,7 @@  discard block
 block discarded – undo
185 184
 		)
186 185
 		{
187 186
 			$return = $this->{"get_$name"}();
188
-		}
189
-		elseif (array_key_exists($name, $props))
187
+		} elseif (array_key_exists($name, $props))
190 188
 		{
191 189
 			$return = $this->$name;
192 190
 		}
@@ -201,8 +199,7 @@  discard block
 block discarded – undo
201 199
 		{
202 200
 			$name = $prop;
203 201
 			$return = $this->$prop;
204
-		}
205
-		else
202
+		} else
206 203
 		{
207 204
 			trigger_error('Undefined property: ' . get_class($this) . '::' . $name, E_USER_NOTICE);
208 205
 			$return = null;
@@ -211,8 +208,7 @@  discard block
 block discarded – undo
211 208
 		if ($return === null && isset($this->normalization[$this->scheme][$name]))
212 209
 		{
213 210
 			return $this->normalization[$this->scheme][$name];
214
-		}
215
-		else
211
+		} else
216 212
 		{
217 213
 			return $return;
218 214
 		}
@@ -229,8 +225,7 @@  discard block
 block discarded – undo
229 225
 		if (method_exists($this, 'get_' . $name) || isset($this->$name))
230 226
 		{
231 227
 			return true;
232
-		}
233
-		else
228
+		} else
234 229
 		{
235 230
 			return false;
236 231
 		}
@@ -277,12 +272,10 @@  discard block
 block discarded – undo
277 272
 		if (!$relative->is_valid())
278 273
 		{
279 274
 			return false;
280
-		}
281
-		elseif ($relative->scheme !== null)
275
+		} elseif ($relative->scheme !== null)
282 276
 		{
283 277
 			return clone $relative;
284
-		}
285
-		else
278
+		} else
286 279
 		{
287 280
 			if (!($base instanceof SimplePie_IRI))
288 281
 			{
@@ -296,8 +289,7 @@  discard block
 block discarded – undo
296 289
 					{
297 290
 						$target = clone $relative;
298 291
 						$target->scheme = $base->scheme;
299
-					}
300
-					else
292
+					} else
301 293
 					{
302 294
 						$target = new SimplePie_IRI;
303 295
 						$target->scheme = $base->scheme;
@@ -309,46 +301,39 @@  discard block
 block discarded – undo
309 301
 							if ($relative->ipath[0] === '/')
310 302
 							{
311 303
 								$target->ipath = $relative->ipath;
312
-							}
313
-							elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
304
+							} elseif (($base->iuserinfo !== null || $base->ihost !== null || $base->port !== null) && $base->ipath === '')
314 305
 							{
315 306
 								$target->ipath = '/' . $relative->ipath;
316
-							}
317
-							elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
307
+							} elseif (($last_segment = strrpos($base->ipath, '/')) !== false)
318 308
 							{
319 309
 								$target->ipath = substr($base->ipath, 0, $last_segment + 1) . $relative->ipath;
320
-							}
321
-							else
310
+							} else
322 311
 							{
323 312
 								$target->ipath = $relative->ipath;
324 313
 							}
325 314
 							$target->ipath = $target->remove_dot_segments($target->ipath);
326 315
 							$target->iquery = $relative->iquery;
327
-						}
328
-						else
316
+						} else
329 317
 						{
330 318
 							$target->ipath = $base->ipath;
331 319
 							if ($relative->iquery !== null)
332 320
 							{
333 321
 								$target->iquery = $relative->iquery;
334
-							}
335
-							elseif ($base->iquery !== null)
322
+							} elseif ($base->iquery !== null)
336 323
 							{
337 324
 								$target->iquery = $base->iquery;
338 325
 							}
339 326
 						}
340 327
 						$target->ifragment = $relative->ifragment;
341 328
 					}
342
-				}
343
-				else
329
+				} else
344 330
 				{
345 331
 					$target = clone $base;
346 332
 					$target->ifragment = null;
347 333
 				}
348 334
 				$target->scheme_normalization();
349 335
 				return $target;
350
-			}
351
-			else
336
+			} else
352 337
 			{
353 338
 				return false;
354 339
 			}
@@ -387,8 +372,7 @@  discard block
 block discarded – undo
387 372
 				$match['fragment'] = null;
388 373
 			}
389 374
 			return $match;
390
-		}
391
-		else
375
+		} else
392 376
 		{
393 377
 			// This can occur when a paragraph is accidentally parsed as a URI
394 378
 			return false;
@@ -410,8 +394,7 @@  discard block
 block discarded – undo
410 394
 			if (strpos($input, '../') === 0)
411 395
 			{
412 396
 				$input = substr($input, 3);
413
-			}
414
-			elseif (strpos($input, './') === 0)
397
+			} elseif (strpos($input, './') === 0)
415 398
 			{
416 399
 				$input = substr($input, 2);
417 400
 			}
@@ -419,8 +402,7 @@  discard block
 block discarded – undo
419 402
 			elseif (strpos($input, '/./') === 0)
420 403
 			{
421 404
 				$input = substr($input, 2);
422
-			}
423
-			elseif ($input === '/.')
405
+			} elseif ($input === '/.')
424 406
 			{
425 407
 				$input = '/';
426 408
 			}
@@ -429,8 +411,7 @@  discard block
 block discarded – undo
429 411
 			{
430 412
 				$input = substr($input, 3);
431 413
 				$output = substr_replace($output, '', strrpos($output, '/'));
432
-			}
433
-			elseif ($input === '/..')
414
+			} elseif ($input === '/..')
434 415
 			{
435 416
 				$input = '/';
436 417
 				$output = substr_replace($output, '', strrpos($output, '/'));
@@ -445,8 +426,7 @@  discard block
 block discarded – undo
445 426
 			{
446 427
 				$output .= substr($input, 0, $pos);
447 428
 				$input = substr_replace($input, '', 0, $pos);
448
-			}
449
-			else
429
+			} else
450 430
 			{
451 431
 				$output .= $input;
452 432
 				$input = '';
@@ -540,8 +520,7 @@  discard block
 block discarded – undo
540 520
 							break;
541 521
 						}
542 522
 					}
543
-				}
544
-				else
523
+				} else
545 524
 				{
546 525
 					$position = $strlen - 1;
547 526
 					$valid = false;
@@ -575,8 +554,9 @@  discard block
 block discarded – undo
575 554
 			)
576 555
 			{
577 556
 				// If we were a character, pretend we weren't, but rather an error.
578
-				if ($valid)
579
-					$position--;
557
+				if ($valid) {
558
+									$position--;
559
+				}
580 560
 
581 561
 				for ($j = $start; $j <= $position; $j++)
582 562
 				{
@@ -708,8 +688,7 @@  discard block
 block discarded – undo
708 688
 					{
709 689
 						$string .= '%' . strtoupper($bytes[$j]);
710 690
 					}
711
-				}
712
-				else
691
+				} else
713 692
 				{
714 693
 					for ($j = $start; $j <= $i; $j++)
715 694
 					{
@@ -808,8 +787,7 @@  discard block
 block discarded – undo
808 787
 		if ($iri === null)
809 788
 		{
810 789
 			return true;
811
-		}
812
-		elseif (isset($cache[$iri]))
790
+		} elseif (isset($cache[$iri]))
813 791
 		{
814 792
 			list($this->scheme,
815 793
 				 $this->iuserinfo,
@@ -820,8 +798,7 @@  discard block
 block discarded – undo
820 798
 				 $this->ifragment,
821 799
 				 $return) = $cache[$iri];
822 800
 			return $return;
823
-		}
824
-		else
801
+		} else
825 802
 		{
826 803
 			$parsed = $this->parse_iri((string) $iri);
827 804
 			if (!$parsed)
@@ -859,13 +836,11 @@  discard block
 block discarded – undo
859 836
 		if ($scheme === null)
860 837
 		{
861 838
 			$this->scheme = null;
862
-		}
863
-		elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
839
+		} elseif (!preg_match('/^[A-Za-z][0-9A-Za-z+\-.]*$/', $scheme))
864 840
 		{
865 841
 			$this->scheme = null;
866 842
 			return false;
867
-		}
868
-		else
843
+		} else
869 844
 		{
870 845
 			$this->scheme = strtolower($scheme);
871 846
 		}
@@ -882,8 +857,9 @@  discard block
 block discarded – undo
882 857
 	public function set_authority($authority)
883 858
 	{
884 859
 		static $cache;
885
-		if (!$cache)
886
-			$cache = array();
860
+		if (!$cache) {
861
+					$cache = array();
862
+		}
887 863
 
888 864
 		if ($authority === null)
889 865
 		{
@@ -891,8 +867,7 @@  discard block
 block discarded – undo
891 867
 			$this->ihost = null;
892 868
 			$this->port = null;
893 869
 			return true;
894
-		}
895
-		elseif (isset($cache[$authority]))
870
+		} elseif (isset($cache[$authority]))
896 871
 		{
897 872
 			list($this->iuserinfo,
898 873
 				 $this->ihost,
@@ -900,16 +875,14 @@  discard block
 block discarded – undo
900 875
 				 $return) = $cache[$authority];
901 876
 
902 877
 			return $return;
903
-		}
904
-		else
878
+		} else
905 879
 		{
906 880
 			$remaining = $authority;
907 881
 			if (($iuserinfo_end = strrpos($remaining, '@')) !== false)
908 882
 			{
909 883
 				$iuserinfo = substr($remaining, 0, $iuserinfo_end);
910 884
 				$remaining = substr($remaining, $iuserinfo_end + 1);
911
-			}
912
-			else
885
+			} else
913 886
 			{
914 887
 				$iuserinfo = null;
915 888
 			}
@@ -920,8 +893,7 @@  discard block
 block discarded – undo
920 893
 					$port = null;
921 894
 				}
922 895
 				$remaining = substr($remaining, 0, $port_start);
923
-			}
924
-			else
896
+			} else
925 897
 			{
926 898
 				$port = null;
927 899
 			}
@@ -950,8 +922,7 @@  discard block
 block discarded – undo
950 922
 		if ($iuserinfo === null)
951 923
 		{
952 924
 			$this->iuserinfo = null;
953
-		}
954
-		else
925
+		} else
955 926
 		{
956 927
 			$this->iuserinfo = $this->replace_invalid_with_pct_encoding($iuserinfo, '!$&\'()*+,;=:');
957 928
 			$this->scheme_normalization();
@@ -973,20 +944,17 @@  discard block
 block discarded – undo
973 944
 		{
974 945
 			$this->ihost = null;
975 946
 			return true;
976
-		}
977
-		elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
947
+		} elseif (substr($ihost, 0, 1) === '[' && substr($ihost, -1) === ']')
978 948
 		{
979 949
 			if (SimplePie_Net_IPv6::check_ipv6(substr($ihost, 1, -1)))
980 950
 			{
981 951
 				$this->ihost = '[' . SimplePie_Net_IPv6::compress(substr($ihost, 1, -1)) . ']';
982
-			}
983
-			else
952
+			} else
984 953
 			{
985 954
 				$this->ihost = null;
986 955
 				return false;
987 956
 			}
988
-		}
989
-		else
957
+		} else
990 958
 		{
991 959
 			$ihost = $this->replace_invalid_with_pct_encoding($ihost, '!$&\'()*+,;=');
992 960
 
@@ -1000,8 +968,7 @@  discard block
 block discarded – undo
1000 968
 				if ($ihost[$position] === '%')
1001 969
 				{
1002 970
 					$position += 3;
1003
-				}
1004
-				else
971
+				} else
1005 972
 				{
1006 973
 					$ihost[$position] = strtolower($ihost[$position]);
1007 974
 					$position++;
@@ -1029,14 +996,12 @@  discard block
 block discarded – undo
1029 996
 		{
1030 997
 			$this->port = null;
1031 998
 			return true;
1032
-		}
1033
-		elseif (strspn($port, '0123456789') === strlen($port))
999
+		} elseif (strspn($port, '0123456789') === strlen($port))
1034 1000
 		{
1035 1001
 			$this->port = (int) $port;
1036 1002
 			$this->scheme_normalization();
1037 1003
 			return true;
1038
-		}
1039
-		else
1004
+		} else
1040 1005
 		{
1041 1006
 			$this->port = null;
1042 1007
 			return false;
@@ -1062,8 +1027,7 @@  discard block
 block discarded – undo
1062 1027
 		if (isset($cache[$ipath]))
1063 1028
 		{
1064 1029
 			$this->ipath = $cache[$ipath][(int) ($this->scheme !== null)];
1065
-		}
1066
-		else
1030
+		} else
1067 1031
 		{
1068 1032
 			$valid = $this->replace_invalid_with_pct_encoding($ipath, '!$&\'()*+,;=@:/');
1069 1033
 			$removed = $this->remove_dot_segments($valid);
@@ -1087,8 +1051,7 @@  discard block
 block discarded – undo
1087 1051
 		if ($iquery === null)
1088 1052
 		{
1089 1053
 			$this->iquery = null;
1090
-		}
1091
-		else
1054
+		} else
1092 1055
 		{
1093 1056
 			$this->iquery = $this->replace_invalid_with_pct_encoding($iquery, '!$&\'()*+,;=:@/?', true);
1094 1057
 			$this->scheme_normalization();
@@ -1107,8 +1070,7 @@  discard block
 block discarded – undo
1107 1070
 		if ($ifragment === null)
1108 1071
 		{
1109 1072
 			$this->ifragment = null;
1110
-		}
1111
-		else
1073
+		} else
1112 1074
 		{
1113 1075
 			$this->ifragment = $this->replace_invalid_with_pct_encoding($ifragment, '!$&\'()*+,;=:@/?');
1114 1076
 			$this->scheme_normalization();
@@ -1165,8 +1127,7 @@  discard block
 block discarded – undo
1165 1127
 		if ($this->ipath !== '')
1166 1128
 		{
1167 1129
 			$iri .= $this->ipath;
1168
-		}
1169
-		elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
1130
+		} elseif (!empty($this->normalization[$this->scheme]['ipath']) && $iauthority !== null && $iauthority !== '')
1170 1131
 		{
1171 1132
 			$iri .= $this->normalization[$this->scheme]['ipath'];
1172 1133
 		}
@@ -1215,8 +1176,7 @@  discard block
 block discarded – undo
1215 1176
 				$iauthority .= ':' . $this->port;
1216 1177
 			}
1217 1178
 			return $iauthority;
1218
-		}
1219
-		else
1179
+		} else
1220 1180
 		{
1221 1181
 			return null;
1222 1182
 		}
@@ -1230,9 +1190,10 @@  discard block
 block discarded – undo
1230 1190
 	protected function get_authority()
1231 1191
 	{
1232 1192
 		$iauthority = $this->get_iauthority();
1233
-		if (is_string($iauthority))
1234
-			return $this->to_uri($iauthority);
1235
-		else
1236
-			return $iauthority;
1193
+		if (is_string($iauthority)) {
1194
+					return $this->to_uri($iauthority);
1195
+		} else {
1196
+					return $iauthority;
1197
+		}
1237 1198
 	}
1238 1199
 }
Please login to merge, or discard this patch.
src/wp-includes/SimplePie/Item.php 3 patches
Doc Comments   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -860,7 +860,7 @@  discard block
 block discarded – undo
860 860
 	 * @since 1.0
861 861
 	 *
862 862
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/strftime} (empty for the raw data)
863
-	 * @return int|string|null
863
+	 * @return string|null
864 864
 	 */
865 865
 	public function get_local_date($date_format = '%c')
866 866
 	{
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 	 *
884 884
 	 * @see get_date
885 885
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
886
-	 * @return int|string|null
886
+	 * @return null|string
887 887
 	 */
888 888
 	public function get_gmdate($date_format = 'j F Y, g:i a')
889 889
 	{
@@ -901,7 +901,7 @@  discard block
 block discarded – undo
901 901
 	 *
902 902
 	 * @see get_updated_date
903 903
 	 * @param string $date_format Supports any PHP date format from {@see http://php.net/date}
904
-	 * @return int|string|null
904
+	 * @return null|string
905 905
 	 */
906 906
 	public function get_updated_gmdate($date_format = 'j F Y, g:i a')
907 907
 	{
@@ -2893,7 +2893,7 @@  discard block
 block discarded – undo
2893 2893
 	 * @since 1.0
2894 2894
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2895 2895
 	 * @link http://www.georss.org/ GeoRSS
2896
-	 * @return string|null
2896
+	 * @return double|null
2897 2897
 	 */
2898 2898
 	public function get_latitude()
2899 2899
 	{
@@ -2921,7 +2921,7 @@  discard block
 block discarded – undo
2921 2921
 	 * @since 1.0
2922 2922
 	 * @link http://www.w3.org/2003/01/geo/ W3C WGS84 Basic Geo
2923 2923
 	 * @link http://www.georss.org/ GeoRSS
2924
-	 * @return string|null
2924
+	 * @return double|null
2925 2925
 	 */
2926 2926
 	public function get_longitude()
2927 2927
 	{
Please login to merge, or discard this patch.
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function __destruct()
124 124
 	{
125
-		if ((version_compare(PHP_VERSION, '5.3', '<') || !gc_enabled()) && !ini_get('zend.ze1_compatibility_mode'))
125
+		if ((version_compare(PHP_VERSION, '5.3', '<') || ! gc_enabled()) && ! ini_get('zend.ze1_compatibility_mode'))
126 126
 		{
127 127
 			unset($this->feed);
128 128
 		}
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 	 */
213 213
 	public function get_id($hash = false)
214 214
 	{
215
-		if (!$hash)
215
+		if ( ! $hash)
216 216
 		{
217 217
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
218 218
 			{
@@ -249,7 +249,7 @@  discard block
 block discarded – undo
249 249
 		}
250 250
 		if ($this->get_permalink() !== null || $this->get_title() !== null)
251 251
 		{
252
-			return md5($this->get_permalink() . $this->get_title());
252
+			return md5($this->get_permalink().$this->get_title());
253 253
 		}
254 254
 		else
255 255
 		{
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 */
268 268
 	public function get_title()
269 269
 	{
270
-		if (!isset($this->data['title']))
270
+		if ( ! isset($this->data['title']))
271 271
 		{
272 272
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
273 273
 			{
@@ -359,7 +359,7 @@  discard block
 block discarded – undo
359 359
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
360 360
 		}
361 361
 
362
-		elseif (!$description_only)
362
+		elseif ( ! $description_only)
363 363
 		{
364 364
 			return $this->get_content(true);
365 365
 		}
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 		{
398 398
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
399 399
 		}
400
-		elseif (!$content_only)
400
+		elseif ( ! $content_only)
401 401
 		{
402 402
 			return $this->get_description(true);
403 403
 		}
@@ -482,7 +482,7 @@  discard block
 block discarded – undo
482 482
 			$categories[] = $this->registry->create('Category', array($this->sanitize($category['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
483 483
 		}
484 484
 
485
-		if (!empty($categories))
485
+		if ( ! empty($categories))
486 486
 		{
487 487
 			return array_unique($categories);
488 488
 		}
@@ -588,7 +588,7 @@  discard block
 block discarded – undo
588 588
 			}
589 589
 		}
590 590
 
591
-		if (!empty($contributors))
591
+		if ( ! empty($contributors))
592 592
 		{
593 593
 			return array_unique($contributors);
594 594
 		}
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 			$authors[] = $this->registry->create('Author', array($this->sanitize($author['data'], SIMPLEPIE_CONSTRUCT_TEXT), null, null));
671 671
 		}
672 672
 
673
-		if (!empty($authors))
673
+		if ( ! empty($authors))
674 674
 		{
675 675
 			return array_unique($authors);
676 676
 		}
@@ -732,7 +732,7 @@  discard block
 block discarded – undo
732 732
 	 */
733 733
 	public function get_date($date_format = 'j F Y, g:i a')
734 734
 	{
735
-		if (!isset($this->data['date']))
735
+		if ( ! isset($this->data['date']))
736 736
 		{
737 737
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
738 738
 			{
@@ -767,7 +767,7 @@  discard block
 block discarded – undo
767 767
 				$this->data['date']['raw'] = $return[0]['data'];
768 768
 			}
769 769
 
770
-			if (!empty($this->data['date']['raw']))
770
+			if ( ! empty($this->data['date']['raw']))
771 771
 			{
772 772
 				$parser = $this->registry->call('Parse_Date', 'get');
773 773
 				$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
@@ -811,14 +811,14 @@  discard block
 block discarded – undo
811 811
 	 */
812 812
 	public function get_updated_date($date_format = 'j F Y, g:i a')
813 813
 	{
814
-		if (!isset($this->data['updated']))
814
+		if ( ! isset($this->data['updated']))
815 815
 		{
816 816
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
817 817
 			{
818 818
 				$this->data['updated']['raw'] = $return[0]['data'];
819 819
 			}
820 820
 
821
-			if (!empty($this->data['updated']['raw']))
821
+			if ( ! empty($this->data['updated']['raw']))
822 822
 			{
823 823
 				$parser = $this->registry->call('Parse_Date', 'get');
824 824
 				$this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	 */
865 865
 	public function get_local_date($date_format = '%c')
866 866
 	{
867
-		if (!$date_format)
867
+		if ( ! $date_format)
868 868
 		{
869 869
 			return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
870 870
 		}
@@ -974,7 +974,7 @@  discard block
 block discarded – undo
974 974
 	 */
975 975
 	public function get_links($rel = 'alternate')
976 976
 	{
977
-		if (!isset($this->data['links']))
977
+		if ( ! isset($this->data['links']))
978 978
 		{
979 979
 			$this->data['links'] = array();
980 980
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
 			}
1009 1009
 			if ($links = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
1010 1010
 			{
1011
-				if (!isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
1011
+				if ( ! isset($links[0]['attribs']['']['isPermaLink']) || strtolower(trim($links[0]['attribs']['']['isPermaLink'])) === 'true')
1012 1012
 				{
1013 1013
 					$this->data['links']['alternate'][] = $this->sanitize($links[0]['data'], SIMPLEPIE_CONSTRUCT_IRI, $this->get_base($links[0]));
1014 1014
 				}
@@ -1019,19 +1019,19 @@  discard block
 block discarded – undo
1019 1019
 			{
1020 1020
 				if ($this->registry->call('Misc', 'is_isegment_nz_nc', array($key)))
1021 1021
 				{
1022
-					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]))
1022
+					if (isset($this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]))
1023 1023
 					{
1024
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
1025
-						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
1024
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key]);
1025
+						$this->data['links'][$key] = & $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key];
1026 1026
 					}
1027 1027
 					else
1028 1028
 					{
1029
-						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
1029
+						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY.$key] = & $this->data['links'][$key];
1030 1030
 					}
1031 1031
 				}
1032 1032
 				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
1033 1033
 				{
1034
-					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
1034
+					$this->data['links'][substr($key, 41)] = & $this->data['links'][$key];
1035 1035
 				}
1036 1036
 				$this->data['links'][$key] = array_unique($this->data['links'][$key]);
1037 1037
 			}
@@ -1085,7 +1085,7 @@  discard block
 block discarded – undo
1085 1085
 	 */
1086 1086
 	public function get_enclosures()
1087 1087
 	{
1088
-		if (!isset($this->data['enclosures']))
1088
+		if ( ! isset($this->data['enclosures']))
1089 1089
 		{
1090 1090
 			$this->data['enclosures'] = array();
1091 1091
 
@@ -1732,7 +1732,7 @@  discard block
 block discarded – undo
1732 1732
 			// If we have media:group tags, loop through them.
1733 1733
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'group') as $group)
1734 1734
 			{
1735
-				if(isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
1735
+				if (isset($group['child']) && isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content']))
1736 1736
 				{
1737 1737
 					// If we have media:content tags, loop through them.
1738 1738
 					foreach ((array) $group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['content'] as $content)
@@ -2762,7 +2762,7 @@  discard block
 block discarded – undo
2762 2762
 
2763 2763
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'link') as $link)
2764 2764
 			{
2765
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
2765
+				if (isset($link['attribs']['']['href']) && ! empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
2766 2766
 				{
2767 2767
 					// Attributes
2768 2768
 					$bitrate = null;
@@ -2797,7 +2797,7 @@  discard block
 block discarded – undo
2797 2797
 
2798 2798
 			foreach ((array) $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'link') as $link)
2799 2799
 			{
2800
-				if (isset($link['attribs']['']['href']) && !empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
2800
+				if (isset($link['attribs']['']['href']) && ! empty($link['attribs']['']['rel']) && $link['attribs']['']['rel'] === 'enclosure')
2801 2801
 				{
2802 2802
 					// Attributes
2803 2803
 					$bitrate = null;
@@ -2873,7 +2873,7 @@  discard block
 block discarded – undo
2873 2873
 
2874 2874
 			$this->data['enclosures'] = array_values(array_unique($this->data['enclosures']));
2875 2875
 		}
2876
-		if (!empty($this->data['enclosures']))
2876
+		if ( ! empty($this->data['enclosures']))
2877 2877
 		{
2878 2878
 			return $this->data['enclosures'];
2879 2879
 		}
Please login to merge, or discard this patch.
Braces   +147 added lines, -295 removed lines patch added patch discarded remove patch
@@ -147,8 +147,7 @@  discard block
 block discarded – undo
147 147
 		if (isset($this->data['child'][$namespace][$tag]))
148 148
 		{
149 149
 			return $this->data['child'][$namespace][$tag];
150
-		}
151
-		else
150
+		} else
152 151
 		{
153 152
 			return null;
154 153
 		}
@@ -217,32 +216,25 @@  discard block
 block discarded – undo
217 216
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'id'))
218 217
 			{
219 218
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
220
-			}
221
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
219
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'id'))
222 220
 			{
223 221
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
224
-			}
225
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
222
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'guid'))
226 223
 			{
227 224
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
228
-			}
229
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
225
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'identifier'))
230 226
 			{
231 227
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
232
-			}
233
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
228
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'identifier'))
234 229
 			{
235 230
 				return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
236
-			}
237
-			elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
231
+			} elseif (isset($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about']))
238 232
 			{
239 233
 				return $this->sanitize($this->data['attribs'][SIMPLEPIE_NAMESPACE_RDF]['about'], SIMPLEPIE_CONSTRUCT_TEXT);
240
-			}
241
-			elseif (($return = $this->get_permalink()) !== null)
234
+			} elseif (($return = $this->get_permalink()) !== null)
242 235
 			{
243 236
 				return $return;
244
-			}
245
-			elseif (($return = $this->get_title()) !== null)
237
+			} elseif (($return = $this->get_title()) !== null)
246 238
 			{
247 239
 				return $return;
248 240
 			}
@@ -250,8 +242,7 @@  discard block
 block discarded – undo
250 242
 		if ($this->get_permalink() !== null || $this->get_title() !== null)
251 243
 		{
252 244
 			return md5($this->get_permalink() . $this->get_title());
253
-		}
254
-		else
245
+		} else
255 246
 		{
256 247
 			return md5(serialize($this->data));
257 248
 		}
@@ -272,32 +263,25 @@  discard block
 block discarded – undo
272 263
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'title'))
273 264
 			{
274 265
 				$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
275
-			}
276
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
266
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'title'))
277 267
 			{
278 268
 				$this->data['title'] = $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
279
-			}
280
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
269
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'title'))
281 270
 			{
282 271
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
283
-			}
284
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
272
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'title'))
285 273
 			{
286 274
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
287
-			}
288
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
275
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'title'))
289 276
 			{
290 277
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
291
-			}
292
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
278
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'title'))
293 279
 			{
294 280
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
295
-			}
296
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
281
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'title'))
297 282
 			{
298 283
 				$this->data['title'] = $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
299
-			}
300
-			else
284
+			} else
301 285
 			{
302 286
 				$this->data['title'] = null;
303 287
 			}
@@ -325,45 +309,34 @@  discard block
 block discarded – undo
325 309
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'summary'))
326 310
 		{
327 311
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
328
-		}
329
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
312
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'summary'))
330 313
 		{
331 314
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
332
-		}
333
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
315
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10, 'description'))
334 316
 		{
335 317
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_MAYBE_HTML, $this->get_base($return[0]));
336
-		}
337
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
318
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'description'))
338 319
 		{
339 320
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
340
-		}
341
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
321
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'description'))
342 322
 		{
343 323
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
344
-		}
345
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
324
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'description'))
346 325
 		{
347 326
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
348
-		}
349
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
327
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'summary'))
350 328
 		{
351 329
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
352
-		}
353
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
330
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'subtitle'))
354 331
 		{
355 332
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
356
-		}
357
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
333
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_090, 'description'))
358 334
 		{
359 335
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML);
360
-		}
361
-
362
-		elseif (!$description_only)
336
+		} elseif (!$description_only)
363 337
 		{
364 338
 			return $this->get_content(true);
365
-		}
366
-		else
339
+		} else
367 340
 		{
368 341
 			return null;
369 342
 		}
@@ -388,20 +361,16 @@  discard block
 block discarded – undo
388 361
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'content'))
389 362
 		{
390 363
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_content_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
391
-		}
392
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
364
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'content'))
393 365
 		{
394 366
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_03_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
395
-		}
396
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
367
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_10_MODULES_CONTENT, 'encoded'))
397 368
 		{
398 369
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_HTML, $this->get_base($return[0]));
399
-		}
400
-		elseif (!$content_only)
370
+		} elseif (!$content_only)
401 371
 		{
402 372
 			return $this->get_description(true);
403
-		}
404
-		else
373
+		} else
405 374
 		{
406 375
 			return null;
407 376
 		}
@@ -420,8 +389,7 @@  discard block
 block discarded – undo
420 389
 		if (isset($categories[$key]))
421 390
 		{
422 391
 			return $categories[$key];
423
-		}
424
-		else
392
+		} else
425 393
 		{
426 394
 			return null;
427 395
 		}
@@ -466,8 +434,7 @@  discard block
 block discarded – undo
466 434
 			if (isset($category['attribs']['']['domain']))
467 435
 			{
468 436
 				$scheme = $this->sanitize($category['attribs']['']['domain'], SIMPLEPIE_CONSTRUCT_TEXT);
469
-			}
470
-			else
437
+			} else
471 438
 			{
472 439
 				$scheme = null;
473 440
 			}
@@ -485,8 +452,7 @@  discard block
 block discarded – undo
485 452
 		if (!empty($categories))
486 453
 		{
487 454
 			return array_unique($categories);
488
-		}
489
-		else
455
+		} else
490 456
 		{
491 457
 			return null;
492 458
 		}
@@ -505,8 +471,7 @@  discard block
 block discarded – undo
505 471
 		if (isset($authors[$key]))
506 472
 		{
507 473
 			return $authors[$key];
508
-		}
509
-		else
474
+		} else
510 475
 		{
511 476
 			return null;
512 477
 		}
@@ -525,8 +490,7 @@  discard block
 block discarded – undo
525 490
 		if (isset($contributors[$key]))
526 491
 		{
527 492
 			return $contributors[$key];
528
-		}
529
-		else
493
+		} else
530 494
 		{
531 495
 			return null;
532 496
 		}
@@ -591,8 +555,7 @@  discard block
 block discarded – undo
591 555
 		if (!empty($contributors))
592 556
 		{
593 557
 			return array_unique($contributors);
594
-		}
595
-		else
558
+		} else
596 559
 		{
597 560
 			return null;
598 561
 		}
@@ -673,16 +636,13 @@  discard block
 block discarded – undo
673 636
 		if (!empty($authors))
674 637
 		{
675 638
 			return array_unique($authors);
676
-		}
677
-		elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
639
+		} elseif (($source = $this->get_source()) && ($authors = $source->get_authors()))
678 640
 		{
679 641
 			return $authors;
680
-		}
681
-		elseif ($authors = $this->feed->get_authors())
642
+		} elseif ($authors = $this->feed->get_authors())
682 643
 		{
683 644
 			return $authors;
684
-		}
685
-		else
645
+		} else
686 646
 		{
687 647
 			return null;
688 648
 		}
@@ -701,16 +661,13 @@  discard block
 block discarded – undo
701 661
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'rights'))
702 662
 		{
703 663
 			return $this->sanitize($return[0]['data'], $this->registry->call('Misc', 'atom_10_construct_type', array($return[0]['attribs'])), $this->get_base($return[0]));
704
-		}
705
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
664
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'rights'))
706 665
 		{
707 666
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
708
-		}
709
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
667
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'rights'))
710 668
 		{
711 669
 			return $this->sanitize($return[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
712
-		}
713
-		else
670
+		} else
714 671
 		{
715 672
 			return null;
716 673
 		}
@@ -737,32 +694,25 @@  discard block
 block discarded – undo
737 694
 			if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'published'))
738 695
 			{
739 696
 				$this->data['date']['raw'] = $return[0]['data'];
740
-			}
741
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
697
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'updated'))
742 698
 			{
743 699
 				$this->data['date']['raw'] = $return[0]['data'];
744
-			}
745
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
700
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'issued'))
746 701
 			{
747 702
 				$this->data['date']['raw'] = $return[0]['data'];
748
-			}
749
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
703
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'created'))
750 704
 			{
751 705
 				$this->data['date']['raw'] = $return[0]['data'];
752
-			}
753
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
706
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_03, 'modified'))
754 707
 			{
755 708
 				$this->data['date']['raw'] = $return[0]['data'];
756
-			}
757
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
709
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_RSS_20, 'pubDate'))
758 710
 			{
759 711
 				$this->data['date']['raw'] = $return[0]['data'];
760
-			}
761
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
712
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_11, 'date'))
762 713
 			{
763 714
 				$this->data['date']['raw'] = $return[0]['data'];
764
-			}
765
-			elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
715
+			} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_DC_10, 'date'))
766 716
 			{
767 717
 				$this->data['date']['raw'] = $return[0]['data'];
768 718
 			}
@@ -771,8 +721,7 @@  discard block
 block discarded – undo
771 721
 			{
772 722
 				$parser = $this->registry->call('Parse_Date', 'get');
773 723
 				$this->data['date']['parsed'] = $parser->parse($this->data['date']['raw']);
774
-			}
775
-			else
724
+			} else
776 725
 			{
777 726
 				$this->data['date'] = null;
778 727
 			}
@@ -791,8 +740,7 @@  discard block
 block discarded – undo
791 740
 				default:
792 741
 					return date($date_format, $this->data['date']['parsed']);
793 742
 			}
794
-		}
795
-		else
743
+		} else
796 744
 		{
797 745
 			return null;
798 746
 		}
@@ -822,8 +770,7 @@  discard block
 block discarded – undo
822 770
 			{
823 771
 				$parser = $this->registry->call('Parse_Date', 'get');
824 772
 				$this->data['updated']['parsed'] = $parser->parse($this->data['date']['raw']);
825
-			}
826
-			else
773
+			} else
827 774
 			{
828 775
 				$this->data['updated'] = null;
829 776
 			}
@@ -842,8 +789,7 @@  discard block
 block discarded – undo
842 789
 				default:
843 790
 					return date($date_format, $this->data['updated']['parsed']);
844 791
 			}
845
-		}
846
-		else
792
+		} else
847 793
 		{
848 794
 			return null;
849 795
 		}
@@ -867,12 +813,10 @@  discard block
 block discarded – undo
867 813
 		if (!$date_format)
868 814
 		{
869 815
 			return $this->sanitize($this->get_date(''), SIMPLEPIE_CONSTRUCT_TEXT);
870
-		}
871
-		elseif (($date = $this->get_date('U')) !== null && $date !== false)
816
+		} elseif (($date = $this->get_date('U')) !== null && $date !== false)
872 817
 		{
873 818
 			return strftime($date_format, $date);
874
-		}
875
-		else
819
+		} else
876 820
 		{
877 821
 			return null;
878 822
 		}
@@ -931,12 +875,10 @@  discard block
 block discarded – undo
931 875
 		if ($link !== null)
932 876
 		{
933 877
 			return $link;
934
-		}
935
-		elseif ($enclosure !== null)
878
+		} elseif ($enclosure !== null)
936 879
 		{
937 880
 			return $enclosure->get_link();
938
-		}
939
-		else
881
+		} else
940 882
 		{
941 883
 			return null;
942 884
 		}
@@ -956,8 +898,7 @@  discard block
 block discarded – undo
956 898
 		if ($links[$key] !== null)
957 899
 		{
958 900
 			return $links[$key];
959
-		}
960
-		else
901
+		} else
961 902
 		{
962 903
 			return null;
963 904
 		}
@@ -1023,13 +964,11 @@  discard block
 block discarded – undo
1023 964
 					{
1024 965
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] = array_merge($this->data['links'][$key], $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key]);
1025 966
 						$this->data['links'][$key] =& $this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key];
1026
-					}
1027
-					else
967
+					} else
1028 968
 					{
1029 969
 						$this->data['links'][SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY . $key] =& $this->data['links'][$key];
1030 970
 					}
1031
-				}
1032
-				elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
971
+				} elseif (substr($key, 0, 41) === SIMPLEPIE_IANA_LINK_RELATIONS_REGISTRY)
1033 972
 				{
1034 973
 					$this->data['links'][substr($key, 41)] =& $this->data['links'][$key];
1035 974
 				}
@@ -1039,8 +978,7 @@  discard block
 block discarded – undo
1039 978
 		if (isset($this->data['links'][$rel]))
1040 979
 		{
1041 980
 			return $this->data['links'][$rel];
1042
-		}
1043
-		else
981
+		} else
1044 982
 		{
1045 983
 			return null;
1046 984
 		}
@@ -1062,8 +1000,7 @@  discard block
 block discarded – undo
1062 1000
 		if (isset($enclosures[$key]))
1063 1001
 		{
1064 1002
 			return $enclosures[$key];
1065
-		}
1066
-		else
1003
+		} else
1067 1004
 		{
1068 1005
 			return null;
1069 1006
 		}
@@ -1139,8 +1076,7 @@  discard block
 block discarded – undo
1139 1076
 					}
1140 1077
 					$captions_parent[] = $this->registry->create('Caption', array($caption_type, $caption_lang, $caption_startTime, $caption_endTime, $caption_text));
1141 1078
 				}
1142
-			}
1143
-			elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
1079
+			} elseif ($captions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'text'))
1144 1080
 			{
1145 1081
 				foreach ($captions as $caption)
1146 1082
 				{
@@ -1190,8 +1126,7 @@  discard block
 block discarded – undo
1190 1126
 				if (isset($category['attribs']['']['scheme']))
1191 1127
 				{
1192 1128
 					$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1193
-				}
1194
-				else
1129
+				} else
1195 1130
 				{
1196 1131
 					$scheme = 'http://search.yahoo.com/mrss/category_schema';
1197 1132
 				}
@@ -1213,8 +1148,7 @@  discard block
 block discarded – undo
1213 1148
 				if (isset($category['attribs']['']['scheme']))
1214 1149
 				{
1215 1150
 					$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1216
-				}
1217
-				else
1151
+				} else
1218 1152
 				{
1219 1153
 					$scheme = 'http://search.yahoo.com/mrss/category_schema';
1220 1154
 				}
@@ -1266,8 +1200,7 @@  discard block
 block discarded – undo
1266 1200
 					$copyright_label = $this->sanitize($copyright[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1267 1201
 				}
1268 1202
 				$copyrights_parent = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
1269
-			}
1270
-			elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
1203
+			} elseif ($copyright = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'copyright'))
1271 1204
 			{
1272 1205
 				$copyright_url = null;
1273 1206
 				$copyright_label = null;
@@ -1297,8 +1230,7 @@  discard block
 block discarded – undo
1297 1230
 					if (isset($credit['attribs']['']['scheme']))
1298 1231
 					{
1299 1232
 						$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1300
-					}
1301
-					else
1233
+					} else
1302 1234
 					{
1303 1235
 						$credit_scheme = 'urn:ebu';
1304 1236
 					}
@@ -1308,8 +1240,7 @@  discard block
 block discarded – undo
1308 1240
 					}
1309 1241
 					$credits_parent[] = $this->registry->create('Credit', array($credit_role, $credit_scheme, $credit_name));
1310 1242
 				}
1311
-			}
1312
-			elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
1243
+			} elseif ($credits = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'credit'))
1313 1244
 			{
1314 1245
 				foreach ($credits as $credit)
1315 1246
 				{
@@ -1323,8 +1254,7 @@  discard block
 block discarded – undo
1323 1254
 					if (isset($credit['attribs']['']['scheme']))
1324 1255
 					{
1325 1256
 						$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1326
-					}
1327
-					else
1257
+					} else
1328 1258
 					{
1329 1259
 						$credit_scheme = 'urn:ebu';
1330 1260
 					}
@@ -1347,8 +1277,7 @@  discard block
 block discarded – undo
1347 1277
 				{
1348 1278
 					$description_parent = $this->sanitize($description_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1349 1279
 				}
1350
-			}
1351
-			elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
1280
+			} elseif ($description_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'description'))
1352 1281
 			{
1353 1282
 				if (isset($description_parent[0]['data']))
1354 1283
 				{
@@ -1398,15 +1327,13 @@  discard block
 block discarded – undo
1398 1327
 					if (isset($hash['attribs']['']['algo']))
1399 1328
 					{
1400 1329
 						$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
1401
-					}
1402
-					else
1330
+					} else
1403 1331
 					{
1404 1332
 						$algo = 'md5';
1405 1333
 					}
1406 1334
 					$hashes_parent[] = $algo.':'.$value;
1407 1335
 				}
1408
-			}
1409
-			elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
1336
+			} elseif ($hashes_iterator = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'hash'))
1410 1337
 			{
1411 1338
 				foreach ($hashes_iterator as $hash)
1412 1339
 				{
@@ -1419,8 +1346,7 @@  discard block
 block discarded – undo
1419 1346
 					if (isset($hash['attribs']['']['algo']))
1420 1347
 					{
1421 1348
 						$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
1422
-					}
1423
-					else
1349
+					} else
1424 1350
 					{
1425 1351
 						$algo = 'md5';
1426 1352
 					}
@@ -1444,8 +1370,7 @@  discard block
 block discarded – undo
1444 1370
 					}
1445 1371
 				}
1446 1372
 				unset($temp);
1447
-			}
1448
-			elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
1373
+			} elseif ($keywords = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
1449 1374
 			{
1450 1375
 				if (isset($keywords[0]['data']))
1451 1376
 				{
@@ -1456,8 +1381,7 @@  discard block
 block discarded – undo
1456 1381
 					}
1457 1382
 				}
1458 1383
 				unset($temp);
1459
-			}
1460
-			elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
1384
+			} elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'keywords'))
1461 1385
 			{
1462 1386
 				if (isset($keywords[0]['data']))
1463 1387
 				{
@@ -1468,8 +1392,7 @@  discard block
 block discarded – undo
1468 1392
 					}
1469 1393
 				}
1470 1394
 				unset($temp);
1471
-			}
1472
-			elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
1395
+			} elseif ($keywords = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'keywords'))
1473 1396
 			{
1474 1397
 				if (isset($keywords[0]['data']))
1475 1398
 				{
@@ -1493,8 +1416,7 @@  discard block
 block discarded – undo
1493 1416
 				{
1494 1417
 					$player_parent = $this->sanitize($player_parent[0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
1495 1418
 				}
1496
-			}
1497
-			elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
1419
+			} elseif ($player_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'player'))
1498 1420
 			{
1499 1421
 				if (isset($player_parent[0]['attribs']['']['url']))
1500 1422
 				{
@@ -1512,8 +1434,7 @@  discard block
 block discarded – undo
1512 1434
 					if (isset($rating['attribs']['']['scheme']))
1513 1435
 					{
1514 1436
 						$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1515
-					}
1516
-					else
1437
+					} else
1517 1438
 					{
1518 1439
 						$rating_scheme = 'urn:simple';
1519 1440
 					}
@@ -1523,8 +1444,7 @@  discard block
 block discarded – undo
1523 1444
 					}
1524 1445
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
1525 1446
 				}
1526
-			}
1527
-			elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
1447
+			} elseif ($ratings = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
1528 1448
 			{
1529 1449
 				foreach ($ratings as $rating)
1530 1450
 				{
@@ -1536,8 +1456,7 @@  discard block
 block discarded – undo
1536 1456
 					}
1537 1457
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
1538 1458
 				}
1539
-			}
1540
-			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
1459
+			} elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'rating'))
1541 1460
 			{
1542 1461
 				foreach ($ratings as $rating)
1543 1462
 				{
@@ -1546,8 +1465,7 @@  discard block
 block discarded – undo
1546 1465
 					if (isset($rating['attribs']['']['scheme']))
1547 1466
 					{
1548 1467
 						$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1549
-					}
1550
-					else
1468
+					} else
1551 1469
 					{
1552 1470
 						$rating_scheme = 'urn:simple';
1553 1471
 					}
@@ -1557,8 +1475,7 @@  discard block
 block discarded – undo
1557 1475
 					}
1558 1476
 					$ratings_parent[] = $this->registry->create('Rating', array($rating_scheme, $rating_value));
1559 1477
 				}
1560
-			}
1561
-			elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
1478
+			} elseif ($ratings = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'explicit'))
1562 1479
 			{
1563 1480
 				foreach ($ratings as $rating)
1564 1481
 				{
@@ -1598,8 +1515,7 @@  discard block
 block discarded – undo
1598 1515
 					}
1599 1516
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
1600 1517
 				}
1601
-			}
1602
-			elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
1518
+			} elseif ($restrictions = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
1603 1519
 			{
1604 1520
 				foreach ($restrictions as $restriction)
1605 1521
 				{
@@ -1612,8 +1528,7 @@  discard block
 block discarded – undo
1612 1528
 					}
1613 1529
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
1614 1530
 				}
1615
-			}
1616
-			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
1531
+			} elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'restriction'))
1617 1532
 			{
1618 1533
 				foreach ($restrictions as $restriction)
1619 1534
 				{
@@ -1634,8 +1549,7 @@  discard block
 block discarded – undo
1634 1549
 					}
1635 1550
 					$restrictions_parent[] = $this->registry->create('Restriction', array($restriction_relationship, $restriction_type, $restriction_value));
1636 1551
 				}
1637
-			}
1638
-			elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
1552
+			} elseif ($restrictions = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES, 'block'))
1639 1553
 			{
1640 1554
 				foreach ($restrictions as $restriction)
1641 1555
 				{
@@ -1652,8 +1566,7 @@  discard block
 block discarded – undo
1652 1566
 			if (is_array($restrictions_parent))
1653 1567
 			{
1654 1568
 				$restrictions_parent = array_values(array_unique($restrictions_parent));
1655
-			}
1656
-			else
1569
+			} else
1657 1570
 			{
1658 1571
 				$restrictions_parent = array(new SimplePie_Restriction('allow', null, 'default'));
1659 1572
 			}
@@ -1668,8 +1581,7 @@  discard block
 block discarded – undo
1668 1581
 						$thumbnails_parent[] = $this->sanitize($thumbnail['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
1669 1582
 					}
1670 1583
 				}
1671
-			}
1672
-			elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
1584
+			} elseif ($thumbnails = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail'))
1673 1585
 			{
1674 1586
 				foreach ($thumbnails as $thumbnail)
1675 1587
 				{
@@ -1687,8 +1599,7 @@  discard block
 block discarded – undo
1687 1599
 				{
1688 1600
 					$title_parent = $this->sanitize($title_parent[0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1689 1601
 				}
1690
-			}
1691
-			elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
1602
+			} elseif ($title_parent = $parent->get_channel_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'title'))
1692 1603
 			{
1693 1604
 				if (isset($title_parent[0]['data']))
1694 1605
 				{
@@ -1781,8 +1692,7 @@  discard block
 block discarded – undo
1781 1692
 							if (isset($content['attribs']['']['duration']))
1782 1693
 							{
1783 1694
 								$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
1784
-							}
1785
-							else
1695
+							} else
1786 1696
 							{
1787 1697
 								$duration = $duration_parent;
1788 1698
 							}
@@ -1862,8 +1772,7 @@  discard block
 block discarded – undo
1862 1772
 								{
1863 1773
 									$captions = array_values(array_unique($captions));
1864 1774
 								}
1865
-							}
1866
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
1775
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text']))
1867 1776
 							{
1868 1777
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['text'] as $caption)
1869 1778
 								{
@@ -1898,8 +1807,7 @@  discard block
 block discarded – undo
1898 1807
 								{
1899 1808
 									$captions = array_values(array_unique($captions));
1900 1809
 								}
1901
-							}
1902
-							else
1810
+							} else
1903 1811
 							{
1904 1812
 								$captions = $captions_parent;
1905 1813
 							}
@@ -1919,8 +1827,7 @@  discard block
 block discarded – undo
1919 1827
 									if (isset($category['attribs']['']['scheme']))
1920 1828
 									{
1921 1829
 										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1922
-									}
1923
-									else
1830
+									} else
1924 1831
 									{
1925 1832
 										$scheme = 'http://search.yahoo.com/mrss/category_schema';
1926 1833
 									}
@@ -1945,8 +1852,7 @@  discard block
 block discarded – undo
1945 1852
 									if (isset($category['attribs']['']['scheme']))
1946 1853
 									{
1947 1854
 										$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
1948
-									}
1949
-									else
1855
+									} else
1950 1856
 									{
1951 1857
 										$scheme = 'http://search.yahoo.com/mrss/category_schema';
1952 1858
 									}
@@ -1960,12 +1866,10 @@  discard block
 block discarded – undo
1960 1866
 							if (is_array($categories) && is_array($categories_parent))
1961 1867
 							{
1962 1868
 								$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
1963
-							}
1964
-							elseif (is_array($categories))
1869
+							} elseif (is_array($categories))
1965 1870
 							{
1966 1871
 								$categories = array_values(array_unique($categories));
1967
-							}
1968
-							elseif (is_array($categories_parent))
1872
+							} elseif (is_array($categories_parent))
1969 1873
 							{
1970 1874
 								$categories = array_values(array_unique($categories_parent));
1971 1875
 							}
@@ -1984,8 +1888,7 @@  discard block
 block discarded – undo
1984 1888
 									$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1985 1889
 								}
1986 1890
 								$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
1987
-							}
1988
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
1891
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright']))
1989 1892
 							{
1990 1893
 								$copyright_url = null;
1991 1894
 								$copyright_label = null;
@@ -1998,8 +1901,7 @@  discard block
 block discarded – undo
1998 1901
 									$copyright_label = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
1999 1902
 								}
2000 1903
 								$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
2001
-							}
2002
-							else
1904
+							} else
2003 1905
 							{
2004 1906
 								$copyrights = $copyrights_parent;
2005 1907
 							}
@@ -2019,8 +1921,7 @@  discard block
 block discarded – undo
2019 1921
 									if (isset($credit['attribs']['']['scheme']))
2020 1922
 									{
2021 1923
 										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2022
-									}
2023
-									else
1924
+									} else
2024 1925
 									{
2025 1926
 										$credit_scheme = 'urn:ebu';
2026 1927
 									}
@@ -2034,8 +1935,7 @@  discard block
 block discarded – undo
2034 1935
 								{
2035 1936
 									$credits = array_values(array_unique($credits));
2036 1937
 								}
2037
-							}
2038
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
1938
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit']))
2039 1939
 							{
2040 1940
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['credit'] as $credit)
2041 1941
 								{
@@ -2049,8 +1949,7 @@  discard block
 block discarded – undo
2049 1949
 									if (isset($credit['attribs']['']['scheme']))
2050 1950
 									{
2051 1951
 										$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2052
-									}
2053
-									else
1952
+									} else
2054 1953
 									{
2055 1954
 										$credit_scheme = 'urn:ebu';
2056 1955
 									}
@@ -2064,8 +1963,7 @@  discard block
 block discarded – undo
2064 1963
 								{
2065 1964
 									$credits = array_values(array_unique($credits));
2066 1965
 								}
2067
-							}
2068
-							else
1966
+							} else
2069 1967
 							{
2070 1968
 								$credits = $credits_parent;
2071 1969
 							}
@@ -2074,12 +1972,10 @@  discard block
 block discarded – undo
2074 1972
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
2075 1973
 							{
2076 1974
 								$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2077
-							}
2078
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
1975
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
2079 1976
 							{
2080 1977
 								$description = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2081
-							}
2082
-							else
1978
+							} else
2083 1979
 							{
2084 1980
 								$description = $description_parent;
2085 1981
 							}
@@ -2098,8 +1994,7 @@  discard block
 block discarded – undo
2098 1994
 									if (isset($hash['attribs']['']['algo']))
2099 1995
 									{
2100 1996
 										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
2101
-									}
2102
-									else
1997
+									} else
2103 1998
 									{
2104 1999
 										$algo = 'md5';
2105 2000
 									}
@@ -2109,8 +2004,7 @@  discard block
 block discarded – undo
2109 2004
 								{
2110 2005
 									$hashes = array_values(array_unique($hashes));
2111 2006
 								}
2112
-							}
2113
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
2007
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash']))
2114 2008
 							{
2115 2009
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['hash'] as $hash)
2116 2010
 								{
@@ -2123,8 +2017,7 @@  discard block
 block discarded – undo
2123 2017
 									if (isset($hash['attribs']['']['algo']))
2124 2018
 									{
2125 2019
 										$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
2126
-									}
2127
-									else
2020
+									} else
2128 2021
 									{
2129 2022
 										$algo = 'md5';
2130 2023
 									}
@@ -2134,8 +2027,7 @@  discard block
 block discarded – undo
2134 2027
 								{
2135 2028
 									$hashes = array_values(array_unique($hashes));
2136 2029
 								}
2137
-							}
2138
-							else
2030
+							} else
2139 2031
 							{
2140 2032
 								$hashes = $hashes_parent;
2141 2033
 							}
@@ -2156,8 +2048,7 @@  discard block
 block discarded – undo
2156 2048
 								{
2157 2049
 									$keywords = array_values(array_unique($keywords));
2158 2050
 								}
2159
-							}
2160
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
2051
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords']))
2161 2052
 							{
2162 2053
 								if (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['keywords'][0]['data']))
2163 2054
 								{
@@ -2172,8 +2063,7 @@  discard block
 block discarded – undo
2172 2063
 								{
2173 2064
 									$keywords = array_values(array_unique($keywords));
2174 2065
 								}
2175
-							}
2176
-							else
2066
+							} else
2177 2067
 							{
2178 2068
 								$keywords = $keywords_parent;
2179 2069
 							}
@@ -2182,12 +2072,10 @@  discard block
 block discarded – undo
2182 2072
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
2183 2073
 							{
2184 2074
 								$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
2185
-							}
2186
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
2075
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
2187 2076
 							{
2188 2077
 								$player = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
2189
-							}
2190
-							else
2078
+							} else
2191 2079
 							{
2192 2080
 								$player = $player_parent;
2193 2081
 							}
@@ -2202,8 +2090,7 @@  discard block
 block discarded – undo
2202 2090
 									if (isset($rating['attribs']['']['scheme']))
2203 2091
 									{
2204 2092
 										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2205
-									}
2206
-									else
2093
+									} else
2207 2094
 									{
2208 2095
 										$rating_scheme = 'urn:simple';
2209 2096
 									}
@@ -2217,8 +2104,7 @@  discard block
 block discarded – undo
2217 2104
 								{
2218 2105
 									$ratings = array_values(array_unique($ratings));
2219 2106
 								}
2220
-							}
2221
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
2107
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating']))
2222 2108
 							{
2223 2109
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['rating'] as $rating)
2224 2110
 								{
@@ -2227,8 +2113,7 @@  discard block
 block discarded – undo
2227 2113
 									if (isset($rating['attribs']['']['scheme']))
2228 2114
 									{
2229 2115
 										$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2230
-									}
2231
-									else
2116
+									} else
2232 2117
 									{
2233 2118
 										$rating_scheme = 'urn:simple';
2234 2119
 									}
@@ -2242,8 +2127,7 @@  discard block
 block discarded – undo
2242 2127
 								{
2243 2128
 									$ratings = array_values(array_unique($ratings));
2244 2129
 								}
2245
-							}
2246
-							else
2130
+							} else
2247 2131
 							{
2248 2132
 								$ratings = $ratings_parent;
2249 2133
 							}
@@ -2274,8 +2158,7 @@  discard block
 block discarded – undo
2274 2158
 								{
2275 2159
 									$restrictions = array_values(array_unique($restrictions));
2276 2160
 								}
2277
-							}
2278
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
2161
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction']))
2279 2162
 							{
2280 2163
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['restriction'] as $restriction)
2281 2164
 								{
@@ -2300,8 +2183,7 @@  discard block
 block discarded – undo
2300 2183
 								{
2301 2184
 									$restrictions = array_values(array_unique($restrictions));
2302 2185
 								}
2303
-							}
2304
-							else
2186
+							} else
2305 2187
 							{
2306 2188
 								$restrictions = $restrictions_parent;
2307 2189
 							}
@@ -2317,8 +2199,7 @@  discard block
 block discarded – undo
2317 2199
 								{
2318 2200
 									$thumbnails = array_values(array_unique($thumbnails));
2319 2201
 								}
2320
-							}
2321
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
2202
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail']))
2322 2203
 							{
2323 2204
 								foreach ($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['thumbnail'] as $thumbnail)
2324 2205
 								{
@@ -2328,8 +2209,7 @@  discard block
 block discarded – undo
2328 2209
 								{
2329 2210
 									$thumbnails = array_values(array_unique($thumbnails));
2330 2211
 								}
2331
-							}
2332
-							else
2212
+							} else
2333 2213
 							{
2334 2214
 								$thumbnails = $thumbnails_parent;
2335 2215
 							}
@@ -2338,12 +2218,10 @@  discard block
 block discarded – undo
2338 2218
 							if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
2339 2219
 							{
2340 2220
 								$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2341
-							}
2342
-							elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
2221
+							} elseif (isset($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
2343 2222
 							{
2344 2223
 								$title = $this->sanitize($group['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2345
-							}
2346
-							else
2224
+							} else
2347 2225
 							{
2348 2226
 								$title = $title_parent;
2349 2227
 							}
@@ -2403,8 +2281,7 @@  discard block
 block discarded – undo
2403 2281
 						if (isset($content['attribs']['']['duration']))
2404 2282
 						{
2405 2283
 							$duration = $this->sanitize($content['attribs']['']['duration'], SIMPLEPIE_CONSTRUCT_TEXT);
2406
-						}
2407
-						else
2284
+						} else
2408 2285
 						{
2409 2286
 							$duration = $duration_parent;
2410 2287
 						}
@@ -2486,8 +2363,7 @@  discard block
 block discarded – undo
2486 2363
 							{
2487 2364
 								$captions = array_values(array_unique($captions));
2488 2365
 							}
2489
-						}
2490
-						else
2366
+						} else
2491 2367
 						{
2492 2368
 							$captions = $captions_parent;
2493 2369
 						}
@@ -2507,8 +2383,7 @@  discard block
 block discarded – undo
2507 2383
 								if (isset($category['attribs']['']['scheme']))
2508 2384
 								{
2509 2385
 									$scheme = $this->sanitize($category['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2510
-								}
2511
-								else
2386
+								} else
2512 2387
 								{
2513 2388
 									$scheme = 'http://search.yahoo.com/mrss/category_schema';
2514 2389
 								}
@@ -2522,16 +2397,13 @@  discard block
 block discarded – undo
2522 2397
 						if (is_array($categories) && is_array($categories_parent))
2523 2398
 						{
2524 2399
 							$categories = array_values(array_unique(array_merge($categories, $categories_parent)));
2525
-						}
2526
-						elseif (is_array($categories))
2400
+						} elseif (is_array($categories))
2527 2401
 						{
2528 2402
 							$categories = array_values(array_unique($categories));
2529
-						}
2530
-						elseif (is_array($categories_parent))
2403
+						} elseif (is_array($categories_parent))
2531 2404
 						{
2532 2405
 							$categories = array_values(array_unique($categories_parent));
2533
-						}
2534
-						else
2406
+						} else
2535 2407
 						{
2536 2408
 							$categories = null;
2537 2409
 						}
@@ -2550,8 +2422,7 @@  discard block
 block discarded – undo
2550 2422
 								$copyright_label = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['copyright'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2551 2423
 							}
2552 2424
 							$copyrights = $this->registry->create('Copyright', array($copyright_url, $copyright_label));
2553
-						}
2554
-						else
2425
+						} else
2555 2426
 						{
2556 2427
 							$copyrights = $copyrights_parent;
2557 2428
 						}
@@ -2571,8 +2442,7 @@  discard block
 block discarded – undo
2571 2442
 								if (isset($credit['attribs']['']['scheme']))
2572 2443
 								{
2573 2444
 									$credit_scheme = $this->sanitize($credit['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2574
-								}
2575
-								else
2445
+								} else
2576 2446
 								{
2577 2447
 									$credit_scheme = 'urn:ebu';
2578 2448
 								}
@@ -2586,8 +2456,7 @@  discard block
 block discarded – undo
2586 2456
 							{
2587 2457
 								$credits = array_values(array_unique($credits));
2588 2458
 							}
2589
-						}
2590
-						else
2459
+						} else
2591 2460
 						{
2592 2461
 							$credits = $credits_parent;
2593 2462
 						}
@@ -2596,8 +2465,7 @@  discard block
 block discarded – undo
2596 2465
 						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description']))
2597 2466
 						{
2598 2467
 							$description = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['description'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2599
-						}
2600
-						else
2468
+						} else
2601 2469
 						{
2602 2470
 							$description = $description_parent;
2603 2471
 						}
@@ -2616,8 +2484,7 @@  discard block
 block discarded – undo
2616 2484
 								if (isset($hash['attribs']['']['algo']))
2617 2485
 								{
2618 2486
 									$algo = $this->sanitize($hash['attribs']['']['algo'], SIMPLEPIE_CONSTRUCT_TEXT);
2619
-								}
2620
-								else
2487
+								} else
2621 2488
 								{
2622 2489
 									$algo = 'md5';
2623 2490
 								}
@@ -2627,8 +2494,7 @@  discard block
 block discarded – undo
2627 2494
 							{
2628 2495
 								$hashes = array_values(array_unique($hashes));
2629 2496
 							}
2630
-						}
2631
-						else
2497
+						} else
2632 2498
 						{
2633 2499
 							$hashes = $hashes_parent;
2634 2500
 						}
@@ -2649,8 +2515,7 @@  discard block
 block discarded – undo
2649 2515
 							{
2650 2516
 								$keywords = array_values(array_unique($keywords));
2651 2517
 							}
2652
-						}
2653
-						else
2518
+						} else
2654 2519
 						{
2655 2520
 							$keywords = $keywords_parent;
2656 2521
 						}
@@ -2659,8 +2524,7 @@  discard block
 block discarded – undo
2659 2524
 						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player']))
2660 2525
 						{
2661 2526
 							$player = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['player'][0]['attribs']['']['url'], SIMPLEPIE_CONSTRUCT_IRI);
2662
-						}
2663
-						else
2527
+						} else
2664 2528
 						{
2665 2529
 							$player = $player_parent;
2666 2530
 						}
@@ -2675,8 +2539,7 @@  discard block
 block discarded – undo
2675 2539
 								if (isset($rating['attribs']['']['scheme']))
2676 2540
 								{
2677 2541
 									$rating_scheme = $this->sanitize($rating['attribs']['']['scheme'], SIMPLEPIE_CONSTRUCT_TEXT);
2678
-								}
2679
-								else
2542
+								} else
2680 2543
 								{
2681 2544
 									$rating_scheme = 'urn:simple';
2682 2545
 								}
@@ -2690,8 +2553,7 @@  discard block
 block discarded – undo
2690 2553
 							{
2691 2554
 								$ratings = array_values(array_unique($ratings));
2692 2555
 							}
2693
-						}
2694
-						else
2556
+						} else
2695 2557
 						{
2696 2558
 							$ratings = $ratings_parent;
2697 2559
 						}
@@ -2722,8 +2584,7 @@  discard block
 block discarded – undo
2722 2584
 							{
2723 2585
 								$restrictions = array_values(array_unique($restrictions));
2724 2586
 							}
2725
-						}
2726
-						else
2587
+						} else
2727 2588
 						{
2728 2589
 							$restrictions = $restrictions_parent;
2729 2590
 						}
@@ -2739,8 +2600,7 @@  discard block
 block discarded – undo
2739 2600
 							{
2740 2601
 								$thumbnails = array_values(array_unique($thumbnails));
2741 2602
 							}
2742
-						}
2743
-						else
2603
+						} else
2744 2604
 						{
2745 2605
 							$thumbnails = $thumbnails_parent;
2746 2606
 						}
@@ -2749,8 +2609,7 @@  discard block
 block discarded – undo
2749 2609
 						if (isset($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title']))
2750 2610
 						{
2751 2611
 							$title = $this->sanitize($content['child'][SIMPLEPIE_NAMESPACE_MEDIARSS]['title'][0]['data'], SIMPLEPIE_CONSTRUCT_TEXT);
2752
-						}
2753
-						else
2612
+						} else
2754 2613
 						{
2755 2614
 							$title = $title_parent;
2756 2615
 						}
@@ -2876,8 +2735,7 @@  discard block
 block discarded – undo
2876 2735
 		if (!empty($this->data['enclosures']))
2877 2736
 		{
2878 2737
 			return $this->data['enclosures'];
2879
-		}
2880
-		else
2738
+		} else
2881 2739
 		{
2882 2740
 			return null;
2883 2741
 		}
@@ -2900,12 +2758,10 @@  discard block
 block discarded – undo
2900 2758
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lat'))
2901 2759
 		{
2902 2760
 			return (float) $return[0]['data'];
2903
-		}
2904
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2761
+		} elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2905 2762
 		{
2906 2763
 			return (float) $match[1];
2907
-		}
2908
-		else
2764
+		} else
2909 2765
 		{
2910 2766
 			return null;
2911 2767
 		}
@@ -2928,16 +2784,13 @@  discard block
 block discarded – undo
2928 2784
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'long'))
2929 2785
 		{
2930 2786
 			return (float) $return[0]['data'];
2931
-		}
2932
-		elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2787
+		} elseif ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_W3C_BASIC_GEO, 'lon'))
2933 2788
 		{
2934 2789
 			return (float) $return[0]['data'];
2935
-		}
2936
-		elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2790
+		} elseif (($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_GEORSS, 'point')) && preg_match('/^((?:-)?[0-9]+(?:\.[0-9]+)) ((?:-)?[0-9]+(?:\.[0-9]+))$/', trim($return[0]['data']), $match))
2937 2791
 		{
2938 2792
 			return (float) $match[2];
2939
-		}
2940
-		else
2793
+		} else
2941 2794
 		{
2942 2795
 			return null;
2943 2796
 		}
@@ -2954,8 +2807,7 @@  discard block
 block discarded – undo
2954 2807
 		if ($return = $this->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'source'))
2955 2808
 		{
2956 2809
 			return $this->registry->create('Source', array($this, $return[0]));
2957
-		}
2958
-		else
2810
+		} else
2959 2811
 		{
2960 2812
 			return null;
2961 2813
 		}
Please login to merge, or discard this patch.